Trying again to check it in. Changes to:

- Use Universal Headers as input
- Change addpack calls to not depend on Guido's disklayout
- Checkge testprograms to use new names for some functions
This commit is contained in:
Jack Jansen 1995-06-06 13:08:40 +00:00
parent ae8a68f40c
commit b81cf9d61c
31 changed files with 1231 additions and 599 deletions

View file

@ -109,7 +109,7 @@ static PyObject *MenuObj_AppendMenu(_self, _args)
return _res;
}
static PyObject *MenuObj_AddResMenu(_self, _args)
static PyObject *MenuObj_AppendResMenu(_self, _args)
MenuObject *_self;
PyObject *_args;
{
@ -118,8 +118,8 @@ static PyObject *MenuObj_AddResMenu(_self, _args)
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetOSType, &theType))
return NULL;
AddResMenu(_self->ob_itself,
theType);
AppendResMenu(_self->ob_itself,
theType);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
@ -160,7 +160,7 @@ static PyObject *MenuObj_InsertMenu(_self, _args)
return _res;
}
static PyObject *MenuObj_InsMenuItem(_self, _args)
static PyObject *MenuObj_InsertMenuItem(_self, _args)
MenuObject *_self;
PyObject *_args;
{
@ -171,15 +171,15 @@ static PyObject *MenuObj_InsMenuItem(_self, _args)
PyMac_GetStr255, itemString,
&afterItem))
return NULL;
InsMenuItem(_self->ob_itself,
itemString,
afterItem);
InsertMenuItem(_self->ob_itself,
itemString,
afterItem);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *MenuObj_DelMenuItem(_self, _args)
static PyObject *MenuObj_DeleteMenuItem(_self, _args)
MenuObject *_self;
PyObject *_args;
{
@ -188,14 +188,14 @@ static PyObject *MenuObj_DelMenuItem(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
DelMenuItem(_self->ob_itself,
item);
DeleteMenuItem(_self->ob_itself,
item);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *MenuObj_SetItem(_self, _args)
static PyObject *MenuObj_SetMenuItemText(_self, _args)
MenuObject *_self;
PyObject *_args;
{
@ -206,15 +206,15 @@ static PyObject *MenuObj_SetItem(_self, _args)
&item,
PyMac_GetStr255, itemString))
return NULL;
SetItem(_self->ob_itself,
item,
itemString);
SetMenuItemText(_self->ob_itself,
item,
itemString);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *MenuObj_GetItem(_self, _args)
static PyObject *MenuObj_GetMenuItemText(_self, _args)
MenuObject *_self;
PyObject *_args;
{
@ -224,9 +224,9 @@ static PyObject *MenuObj_GetItem(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
GetItem(_self->ob_itself,
item,
itemString);
GetMenuItemText(_self->ob_itself,
item,
itemString);
_res = Py_BuildValue("O&",
PyMac_BuildStr255, itemString);
return _res;
@ -382,7 +382,7 @@ static PyObject *MenuObj_GetItemStyle(_self, _args)
{
PyObject *_res = NULL;
short item;
Style chStyle;
unsigned char chStyle;
if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
@ -481,24 +481,65 @@ static PyObject *MenuObj_PopUpMenuSelect(_self, _args)
return _res;
}
static PyObject *MenuObj_InsertFontResMenu(_self, _args)
MenuObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short afterItem;
short scriptFilter;
if (!PyArg_ParseTuple(_args, "hh",
&afterItem,
&scriptFilter))
return NULL;
InsertFontResMenu(_self->ob_itself,
afterItem,
scriptFilter);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *MenuObj_InsertIntlResMenu(_self, _args)
MenuObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ResType theType;
short afterItem;
short scriptFilter;
if (!PyArg_ParseTuple(_args, "O&hh",
PyMac_GetOSType, &theType,
&afterItem,
&scriptFilter))
return NULL;
InsertIntlResMenu(_self->ob_itself,
theType,
afterItem,
scriptFilter);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyMethodDef MenuObj_methods[] = {
{"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
"() -> None"},
{"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
"(Str255 data) -> None"},
{"AddResMenu", (PyCFunction)MenuObj_AddResMenu, 1,
{"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
"(ResType theType) -> None"},
{"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
"(ResType theType, short afterItem) -> None"},
{"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
"(short beforeID) -> None"},
{"InsMenuItem", (PyCFunction)MenuObj_InsMenuItem, 1,
{"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
"(Str255 itemString, short afterItem) -> None"},
{"DelMenuItem", (PyCFunction)MenuObj_DelMenuItem, 1,
{"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
"(short item) -> None"},
{"SetItem", (PyCFunction)MenuObj_SetItem, 1,
{"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
"(short item, Str255 itemString) -> None"},
{"GetItem", (PyCFunction)MenuObj_GetItem, 1,
{"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
"(short item) -> (Str255 itemString)"},
{"DisableItem", (PyCFunction)MenuObj_DisableItem, 1,
"(short item) -> None"},
@ -517,7 +558,7 @@ static PyMethodDef MenuObj_methods[] = {
{"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1,
"(short item, short chStyle) -> None"},
{"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
"(short item) -> (Style chStyle)"},
"(short item) -> (unsigned char chStyle)"},
{"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
"() -> None"},
{"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
@ -528,6 +569,10 @@ static PyMethodDef MenuObj_methods[] = {
"(short item, short cmdChar) -> None"},
{"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
"(short top, short left, short popUpItem) -> (long _rv)"},
{"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
"(short afterItem, short scriptFilter) -> None"},
{"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
"(ResType theType, short afterItem, short scriptFilter) -> None"},
{NULL, NULL, 0}
};
@ -558,6 +603,20 @@ PyTypeObject Menu_Type = {
/* ---------------------- End object type Menu ---------------------- */
static PyObject *Menu_GetMBarHeight(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetMBarHeight();
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *Menu_InitMenus(_self, _args)
PyObject *_self;
PyObject *_args;
@ -736,7 +795,7 @@ static PyObject *Menu_HiliteMenu(_self, _args)
return _res;
}
static PyObject *Menu_GetMHandle(_self, _args)
static PyObject *Menu_GetMenuHandle(_self, _args)
PyObject *_self;
PyObject *_args;
{
@ -746,7 +805,7 @@ static PyObject *Menu_GetMHandle(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&menuID))
return NULL;
_rv = GetMHandle(menuID);
_rv = GetMenuHandle(menuID);
_res = Py_BuildValue("O&",
MenuObj_New, _rv);
return _res;
@ -827,7 +886,7 @@ static PyObject *Menu_MenuChoice(_self, _args)
return _res;
}
static PyObject *Menu_DelMCEntries(_self, _args)
static PyObject *Menu_DeleteMCEntries(_self, _args)
PyObject *_self;
PyObject *_args;
{
@ -838,8 +897,39 @@ static PyObject *Menu_DelMCEntries(_self, _args)
&menuID,
&menuItem))
return NULL;
DelMCEntries(menuID,
menuItem);
DeleteMCEntries(menuID,
menuItem);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Menu_SystemEdit(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
short editCmd;
if (!PyArg_ParseTuple(_args, "h",
&editCmd))
return NULL;
_rv = SystemEdit(editCmd);
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Menu_SystemMenu(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
long menuResult;
if (!PyArg_ParseTuple(_args, "l",
&menuResult))
return NULL;
SystemMenu(menuResult);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
@ -861,6 +951,8 @@ static PyObject *Menu_OpenDeskAcc(_self, _args)
}
static PyMethodDef Menu_methods[] = {
{"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1,
"() -> (short _rv)"},
{"InitMenus", (PyCFunction)Menu_InitMenus, 1,
"() -> None"},
{"NewMenu", (PyCFunction)Menu_NewMenu, 1,
@ -885,7 +977,7 @@ static PyMethodDef Menu_methods[] = {
"(short ch) -> (long _rv)"},
{"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
"(short menuID) -> None"},
{"GetMHandle", (PyCFunction)Menu_GetMHandle, 1,
{"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
"(short menuID) -> (MenuHandle _rv)"},
{"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
"(short menuID) -> None"},
@ -897,8 +989,12 @@ static PyMethodDef Menu_methods[] = {
"(short resID) -> None"},
{"MenuChoice", (PyCFunction)Menu_MenuChoice, 1,
"() -> (long _rv)"},
{"DelMCEntries", (PyCFunction)Menu_DelMCEntries, 1,
{"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
"(short menuID, short menuItem) -> None"},
{"SystemEdit", (PyCFunction)Menu_SystemEdit, 1,
"(short editCmd) -> (Boolean _rv)"},
{"SystemMenu", (PyCFunction)Menu_SystemMenu, 1,
"(long menuResult) -> None"},
{"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1,
"(Str255 name) -> None"},
{NULL, NULL, 0}

View file

@ -1,46 +1,50 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Menus.h'
# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Menus.h'
f = Function(short, 'GetMBarHeight',
)
functions.append(f)
f = Function(void, 'InitMenus',
)
functions.append(f)
f = Function(MenuHandle, 'NewMenu',
f = Function(MenuRef, 'NewMenu',
(short, 'menuID', InMode),
(Str255, 'menuTitle', InMode),
(ConstStr255Param, 'menuTitle', InMode),
)
functions.append(f)
f = Function(MenuHandle, 'GetMenu',
f = Function(MenuRef, 'GetMenu',
(short, 'resourceID', InMode),
)
functions.append(f)
f = Method(void, 'DisposeMenu',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
)
methods.append(f)
f = Method(void, 'AppendMenu',
(MenuHandle, 'menu', InMode),
(MenuRef, 'menu', InMode),
(ConstStr255Param, 'data', InMode),
)
methods.append(f)
f = Method(void, 'AddResMenu',
(MenuHandle, 'theMenu', InMode),
f = Method(void, 'AppendResMenu',
(MenuRef, 'theMenu', InMode),
(ResType, 'theType', InMode),
)
methods.append(f)
f = Method(void, 'InsertResMenu',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(ResType, 'theType', InMode),
(short, 'afterItem', InMode),
)
methods.append(f)
f = Method(void, 'InsertMenu',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'beforeID', InMode),
)
methods.append(f)
@ -76,15 +80,15 @@ f = Function(void, 'SetMenuBar',
)
functions.append(f)
f = Method(void, 'InsMenuItem',
(MenuHandle, 'theMenu', InMode),
f = Method(void, 'InsertMenuItem',
(MenuRef, 'theMenu', InMode),
(ConstStr255Param, 'itemString', InMode),
(short, 'afterItem', InMode),
)
methods.append(f)
f = Method(void, 'DelMenuItem',
(MenuHandle, 'theMenu', InMode),
f = Method(void, 'DeleteMenuItem',
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
)
methods.append(f)
@ -99,92 +103,92 @@ f = Function(void, 'HiliteMenu',
)
functions.append(f)
f = Method(void, 'SetItem',
(MenuHandle, 'theMenu', InMode),
f = Method(void, 'SetMenuItemText',
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(ConstStr255Param, 'itemString', InMode),
)
methods.append(f)
f = Method(void, 'GetItem',
(MenuHandle, 'theMenu', InMode),
f = Method(void, 'GetMenuItemText',
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(Str255, 'itemString', OutMode),
)
methods.append(f)
f = Method(void, 'DisableItem',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
)
methods.append(f)
f = Method(void, 'EnableItem',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
)
methods.append(f)
f = Method(void, 'CheckItem',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(Boolean, 'checked', InMode),
)
methods.append(f)
f = Method(void, 'SetItemMark',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'markChar', InMode),
)
methods.append(f)
f = Method(void, 'GetItemMark',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'markChar', OutMode),
)
methods.append(f)
f = Method(void, 'SetItemIcon',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'iconIndex', InMode),
)
methods.append(f)
f = Method(void, 'GetItemIcon',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'iconIndex', OutMode),
)
methods.append(f)
f = Method(void, 'SetItemStyle',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'chStyle', InMode),
)
methods.append(f)
f = Method(void, 'GetItemStyle',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(Style, 'chStyle', OutMode),
(unsigned_char, 'chStyle', OutMode),
)
methods.append(f)
f = Method(void, 'CalcMenuSize',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
)
methods.append(f)
f = Method(short, 'CountMItems',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
)
methods.append(f)
f = Function(MenuHandle, 'GetMHandle',
f = Function(MenuRef, 'GetMenuHandle',
(short, 'menuID', InMode),
)
functions.append(f)
@ -210,21 +214,21 @@ f = Function(void, 'InitProcMenu',
functions.append(f)
f = Method(void, 'GetItemCmd',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'cmdChar', OutMode),
)
methods.append(f)
f = Method(void, 'SetItemCmd',
(MenuHandle, 'theMenu', InMode),
(MenuRef, 'theMenu', InMode),
(short, 'item', InMode),
(short, 'cmdChar', InMode),
)
methods.append(f)
f = Method(long, 'PopUpMenuSelect',
(MenuHandle, 'menu', InMode),
(MenuRef, 'menu', InMode),
(short, 'top', InMode),
(short, 'left', InMode),
(short, 'popUpItem', InMode),
@ -235,9 +239,34 @@ f = Function(long, 'MenuChoice',
)
functions.append(f)
f = Function(void, 'DelMCEntries',
f = Function(void, 'DeleteMCEntries',
(short, 'menuID', InMode),
(short, 'menuItem', InMode),
)
functions.append(f)
f = Method(void, 'InsertFontResMenu',
(MenuRef, 'theMenu', InMode),
(short, 'afterItem', InMode),
(short, 'scriptFilter', InMode),
)
methods.append(f)
f = Method(void, 'InsertIntlResMenu',
(MenuRef, 'theMenu', InMode),
(ResType, 'theType', InMode),
(short, 'afterItem', InMode),
(short, 'scriptFilter', InMode),
)
methods.append(f)
f = Function(Boolean, 'SystemEdit',
(short, 'editCmd', InMode),
)
functions.append(f)
f = Function(void, 'SystemMenu',
(long, 'menuResult', InMode),
)
functions.append(f)

View file

@ -1,4 +1,6 @@
# Scan <Menus.h>, generating menugen.py.
import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner
@ -20,7 +22,7 @@ class MyScanner(Scanner):
listname = "functions"
if arglist:
t, n, m = arglist[0]
if t == "MenuHandle" and m == "InMode":
if t in ("MenuHandle", "MenuRef") and m == "InMode":
classname = "Method"
listname = "methods"
return classname, listname

View file

@ -6,7 +6,7 @@
import string
import addpack
addpack.addpack('D:python:Tools:bgen:bgen')
addpack.addpack(':Tools:bgen:bgen')
# Declarations that change for each manager
MACHEADERFILE = 'Menus.h' # The Apple header file
@ -26,6 +26,9 @@ from macsupport import *
# Create the type objects
MenuHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
MenuRef = MenuHandle
unsigned_char = Type('unsigned char', 'b')
includestuff = includestuff + """
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */