Kaydet (Commit) ae8a68f4 authored tarafından Jack Jansen's avatar Jack Jansen

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
üst c7cfb955
# Progress dialog
from addpack import addpack
addpack('Demo')
addpack('Tools')
addpack('bgen')
addpack('dlg')
addpack('evt')
from Dlg import GetNewDialog, ModalDialog, SetIText
from Dlg import GetNewDialog, ModalDialog, SetDialogItemText
count = 0
......@@ -17,12 +17,12 @@ def filter(d, e):
def main():
d = GetNewDialog(256, -1)
tp, h, rect = d.GetDItem(2)
SetIText(h, "Progress...")
tp, h, rect = d.GetDialogItem(2)
SetDialogItemText(h, "Progress...")
for i in range(100):
if i%10 == 0:
str = "Progress...%d" % i
SetIText(h, str)
SetDialogItemText(h, str)
ModalDialog(filter)
for j in range(100): pass
......
......@@ -5,6 +5,7 @@ from Ctl import *
from Win import *
from Evt import *
import time
import sys
def main():
r = (40, 40, 400, 300)
......@@ -12,6 +13,8 @@ def main():
w.DrawGrowIcon()
r = (40, 40, 100, 60)
c = NewControl(w, r, "SPAM!", 1, 0, 0, 1, 0, 0)
print 'Ok, try it...'
sys.exit(1) # So we can see what happens...
main()
......@@ -3,6 +3,9 @@
# Python library.
# The ID can be overridden by passing a second parameter.
import addpack
addpack.addpack(':Tools:bgen:evt')
from Dlg import *
from Events import *
import string
......@@ -17,8 +20,8 @@ def f(d, event):
def message(str = "Hello, world!", id = ID):
d = GetNewDialog(id, -1)
tp, h, rect = d.GetDItem(2)
SetIText(h, str)
tp, h, rect = d.GetDialogItem(2)
SetDialogItemText(h, str)
while 1:
n = ModalDialog(f)
if n == 1: break
......
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Controls.h'
# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Controls.h'
pushButProc = 0
checkBoxProc = 1
radioButProc = 2
useWFont = 8
scrollBarProc = 16
popupMenuProc = 1008
useWFont = 8
inLabel = 1
inMenu = 2
inTriangle = 4
inButton = 10
inCheckBox = 11
inUpButton = 20
......@@ -12,17 +16,34 @@ inDownButton = 21
inPageUp = 22
inPageDown = 23
inThumb = 129
popupMenuProc = 1008
inLabel = 1
inMenu = 2
inTriangle = 4
kNoHiliteControlPart = 0
kInLabelControlPart = 1
kInMenuControlPart = 2
kInTriangleControlPart = 4
kInButtonControlPart = 10
kInCheckBoxControlPart = 11
kInUpButtonControlPart = 20
kInDownButtonControlPart = 21
kInPageUpControlPart = 22
kInPageDownControlPart = 23
kInIndicatorControlPart = 129
kReservedControlPart = 254
kControlInactiveControlPart = 255
popupFixedWidth = 1 << 0
popupVariableWidth = 1 << 1
popupUseAddResMenu = 1 << 2
popupUseWFont = 1 << 3
popupTitleBold = 1 << 8
popupTitleItalic = 1 << 9
popupTitleUnderline = 1 << 10
popupTitleOutline = 1 << 11
popupTitleShadow = 1 << 12
popupTitleCondense = 1 << 13
popupTitleExtend = 1 << 14
popupTitleNoStyle = 1 << 15
popupTitleLeftJust = 0x00000000
popupTitleCenterJust = 0x00000001
popupTitleRightJust = 0x000000FF
noConstraint = 0
hAxisOnly = 1
vAxisOnly = 2
drawCntl = 0
......@@ -36,6 +57,7 @@ dragCntl = 7
autoTrack = 8
calcCntlRgn = 10
calcThumbRgn = 11
drawThumbOutline = 12
cFrameColor = 0
cBodyColor = 1
cTextColor = 2
......
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Dialogs.h'
# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Dialogs.h'
ctrlItem = 4
btnCtrl = 0
......@@ -16,6 +16,7 @@ cancel = 2
stopIcon = 0
noteIcon = 1
cautionIcon = 2
kIDODialogItem = 24
overlayDITL = 0
appendDITLRight = 1
appendDITLBottom = 2
......@@ -56,7 +56,7 @@ typedef struct ControlObject {
} ControlObject;
PyObject *CtlObj_New(itself)
const ControlHandle itself;
ControlHandle itself;
{
ControlObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
......@@ -86,7 +86,7 @@ static void CtlObj_dealloc(self)
PyMem_DEL(self);
}
static PyObject *CtlObj_SetCTitle(_self, _args)
static PyObject *CtlObj_SetControlTitle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -95,14 +95,14 @@ static PyObject *CtlObj_SetCTitle(_self, _args)
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, title))
return NULL;
SetCTitle(_self->ob_itself,
title);
SetControlTitle(_self->ob_itself,
title);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetCTitle(_self, _args)
static PyObject *CtlObj_GetControlTitle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -111,8 +111,8 @@ static PyObject *CtlObj_GetCTitle(_self, _args)
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, title))
return NULL;
GetCTitle(_self->ob_itself,
title);
GetControlTitle(_self->ob_itself,
title);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
......@@ -224,7 +224,7 @@ static PyObject *CtlObj_SizeControl(_self, _args)
return _res;
}
static PyObject *CtlObj_SetCtlValue(_self, _args)
static PyObject *CtlObj_SetControlValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -233,14 +233,14 @@ static PyObject *CtlObj_SetCtlValue(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&theValue))
return NULL;
SetCtlValue(_self->ob_itself,
theValue);
SetControlValue(_self->ob_itself,
theValue);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetCtlValue(_self, _args)
static PyObject *CtlObj_GetControlValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -248,13 +248,13 @@ static PyObject *CtlObj_GetCtlValue(_self, _args)
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCtlValue(_self->ob_itself);
_rv = GetControlValue(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *CtlObj_SetCtlMin(_self, _args)
static PyObject *CtlObj_SetControlMinimum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -263,14 +263,14 @@ static PyObject *CtlObj_SetCtlMin(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&minValue))
return NULL;
SetCtlMin(_self->ob_itself,
minValue);
SetControlMinimum(_self->ob_itself,
minValue);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetCtlMin(_self, _args)
static PyObject *CtlObj_GetControlMinimum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -278,13 +278,13 @@ static PyObject *CtlObj_GetCtlMin(_self, _args)
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCtlMin(_self->ob_itself);
_rv = GetControlMinimum(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *CtlObj_SetCtlMax(_self, _args)
static PyObject *CtlObj_SetControlMaximum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -293,14 +293,14 @@ static PyObject *CtlObj_SetCtlMax(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&maxValue))
return NULL;
SetCtlMax(_self->ob_itself,
maxValue);
SetControlMaximum(_self->ob_itself,
maxValue);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetCtlMax(_self, _args)
static PyObject *CtlObj_GetControlMaximum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -308,13 +308,13 @@ static PyObject *CtlObj_GetCtlMax(_self, _args)
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCtlMax(_self->ob_itself);
_rv = GetControlMaximum(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *CtlObj_SetCRefCon(_self, _args)
static PyObject *CtlObj_SetControlReference(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -323,14 +323,14 @@ static PyObject *CtlObj_SetCRefCon(_self, _args)
if (!PyArg_ParseTuple(_args, "l",
&data))
return NULL;
SetCRefCon(_self->ob_itself,
data);
SetControlReference(_self->ob_itself,
data);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetCRefCon(_self, _args)
static PyObject *CtlObj_GetControlReference(_self, _args)
ControlObject *_self;
PyObject *_args;
{
......@@ -338,12 +338,26 @@ static PyObject *CtlObj_GetCRefCon(_self, _args)
long _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCRefCon(_self->ob_itself);
_rv = GetControlReference(_self->ob_itself);
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *CtlObj_SetControlAction(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
SetControlAction(_self->ob_itself,
(ControlActionUPP)0);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_DragControl(_self, _args)
ControlObject *_self;
PyObject *_args;
......@@ -386,42 +400,42 @@ static PyObject *CtlObj_TestControl(_self, _args)
return _res;
}
static PyObject *CtlObj_TrackControl(_self, _args)
static PyObject *CtlObj_GetControlVariant(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
Point thePoint;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetPoint, &thePoint))
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = TrackControl(_self->ob_itself,
thePoint,
(ControlActionUPP)0);
_rv = GetControlVariant(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *CtlObj_GetCVariant(_self, _args)
static PyObject *CtlObj_TrackControl(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
if (!PyArg_ParseTuple(_args, ""))
Point thePoint;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetPoint, &thePoint))
return NULL;
_rv = GetCVariant(_self->ob_itself);
_rv = TrackControl(_self->ob_itself,
thePoint,
(ControlActionUPP)0);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyMethodDef CtlObj_methods[] = {
{"SetCTitle", (PyCFunction)CtlObj_SetCTitle, 1,
{"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1,
"(Str255 title) -> None"},
{"GetCTitle", (PyCFunction)CtlObj_GetCTitle, 1,
{"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1,
"(Str255 title) -> None"},
{"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
"() -> None"},
......@@ -437,30 +451,32 @@ static PyMethodDef CtlObj_methods[] = {
"(short h, short v) -> None"},
{"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
"(short w, short h) -> None"},
{"SetCtlValue", (PyCFunction)CtlObj_SetCtlValue, 1,
{"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1,
"(short theValue) -> None"},
{"GetCtlValue", (PyCFunction)CtlObj_GetCtlValue, 1,
{"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1,
"() -> (short _rv)"},
{"SetCtlMin", (PyCFunction)CtlObj_SetCtlMin, 1,
{"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1,
"(short minValue) -> None"},
{"GetCtlMin", (PyCFunction)CtlObj_GetCtlMin, 1,
{"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1,
"() -> (short _rv)"},
{"SetCtlMax", (PyCFunction)CtlObj_SetCtlMax, 1,
{"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1,
"(short maxValue) -> None"},
{"GetCtlMax", (PyCFunction)CtlObj_GetCtlMax, 1,
{"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1,
"() -> (short _rv)"},
{"SetCRefCon", (PyCFunction)CtlObj_SetCRefCon, 1,
{"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
"(long data) -> None"},
{"GetCRefCon", (PyCFunction)CtlObj_GetCRefCon, 1,
{"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
"() -> (long _rv)"},
{"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1,
"() -> None"},
{"DragControl", (PyCFunction)CtlObj_DragControl, 1,
"(Point startPt, Rect limitRect, Rect slopRect, short axis) -> None"},
{"TestControl", (PyCFunction)CtlObj_TestControl, 1,
"(Point thePt) -> (short _rv)"},
{"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
"() -> (short _rv)"},
{"TrackControl", (PyCFunction)CtlObj_TrackControl, 1,
"(Point thePoint) -> (short _rv)"},
{"GetCVariant", (PyCFunction)CtlObj_GetCVariant, 1,
"() -> (short _rv)"},
{NULL, NULL, 0}
};
......@@ -580,22 +596,6 @@ static PyObject *Ctl_DrawControls(_self, _args)
return _res;
}
static PyObject *Ctl_UpdtControl(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
WindowPtr theWindow;
if (!PyArg_ParseTuple(_args, "O&",
WinObj_Convert, &theWindow))
return NULL;
UpdtControl(theWindow,
theWindow->visRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Ctl_UpdateControls(_self, _args)
PyObject *_self;
PyObject *_args;
......@@ -643,8 +643,6 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr theWindow) -> None"},
{"DrawControls", (PyCFunction)Ctl_DrawControls, 1,
"(WindowPtr theWindow) -> None"},
{"UpdtControl", (PyCFunction)Ctl_UpdtControl, 1,
"(WindowPtr theWindow) -> None"},
{"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1,
"(WindowPtr theWindow) -> None"},
{"FindControl", (PyCFunction)Ctl_FindControl, 1,
......
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Controls.h'
# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Controls.h'
f = Function(ControlHandle, 'NewControl',
(WindowPtr, 'theWindow', InMode),
f = Function(ControlRef, 'NewControl',
(WindowRef, 'theWindow', InMode),
(Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode),
......@@ -13,132 +13,132 @@ f = Function(ControlHandle, 'NewControl',
)
functions.append(f)
f = Method(void, 'SetCTitle',
(ControlHandle, 'theControl', InMode),
f = Method(void, 'SetControlTitle',
(ControlRef, 'theControl', InMode),
(ConstStr255Param, 'title', InMode),
)
methods.append(f)
f = Method(void, 'GetCTitle',
(ControlHandle, 'theControl', InMode),
f = Method(void, 'GetControlTitle',
(ControlRef, 'theControl', InMode),
(Str255, 'title', InMode),
)
methods.append(f)
f = Function(ControlHandle, 'GetNewControl',
f = Function(ControlRef, 'GetNewControl',
(short, 'controlID', InMode),
(WindowPtr, 'owner', InMode),
(WindowRef, 'owner', InMode),
)
functions.append(f)
f = Method(void, 'DisposeControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Function(void, 'KillControls',
(WindowPtr, 'theWindow', InMode),
(WindowRef, 'theWindow', InMode),
)
functions.append(f)
f = Method(void, 'HideControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'ShowControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Function(void, 'DrawControls',
(WindowPtr, 'theWindow', InMode),
(WindowRef, 'theWindow', InMode),
)
functions.append(f)
f = Method(void, 'Draw1Control',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'HiliteControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
(short, 'hiliteState', InMode),
)
methods.append(f)
f = Function(void, 'UpdtControl',
(WindowPtr, 'theWindow', InMode),
(RgnHandle, 'updateRgn', InMode),
)
functions.append(f)
f = Function(void, 'UpdateControls',
(WindowPtr, 'theWindow', InMode),
(WindowRef, 'theWindow', InMode),
(RgnHandle, 'updateRgn', InMode),
)
functions.append(f)
f = Method(void, 'MoveControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
(short, 'h', InMode),
(short, 'v', InMode),
)
methods.append(f)
f = Method(void, 'SizeControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
(short, 'w', InMode),
(short, 'h', InMode),
)
methods.append(f)
f = Method(void, 'SetCtlValue',
(ControlHandle, 'theControl', InMode),
f = Method(void, 'SetControlValue',
(ControlRef, 'theControl', InMode),
(short, 'theValue', InMode),
)
methods.append(f)
f = Method(short, 'GetCtlValue',
(ControlHandle, 'theControl', InMode),
f = Method(short, 'GetControlValue',
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'SetCtlMin',
(ControlHandle, 'theControl', InMode),
f = Method(void, 'SetControlMinimum',
(ControlRef, 'theControl', InMode),
(short, 'minValue', InMode),
)
methods.append(f)
f = Method(short, 'GetCtlMin',
(ControlHandle, 'theControl', InMode),
f = Method(short, 'GetControlMinimum',
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'SetCtlMax',
(ControlHandle, 'theControl', InMode),
f = Method(void, 'SetControlMaximum',
(ControlRef, 'theControl', InMode),
(short, 'maxValue', InMode),
)
methods.append(f)
f = Method(short, 'GetCtlMax',
(ControlHandle, 'theControl', InMode),
f = Method(short, 'GetControlMaximum',
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'SetCRefCon',
(ControlHandle, 'theControl', InMode),
f = Method(void, 'SetControlReference',
(ControlRef, 'theControl', InMode),
(long, 'data', InMode),
)
methods.append(f)
f = Method(long, 'GetCRefCon',
(ControlHandle, 'theControl', InMode),
f = Method(long, 'GetControlReference',
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'SetControlAction',
(ControlRef, 'theControl', InMode),
(FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
)
methods.append(f)
f = Method(void, 'DragControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
(Point, 'startPt', InMode),
(Rect_ptr, 'limitRect', InMode),
(Rect_ptr, 'slopRect', InMode),
......@@ -147,27 +147,27 @@ f = Method(void, 'DragControl',
methods.append(f)
f = Method(short, 'TestControl',
(ControlHandle, 'theControl', InMode),
(ControlRef, 'theControl', InMode),
(Point, 'thePt', InMode),
)
methods.append(f)
f = Method(short, 'TrackControl',
(ControlHandle, 'theControl', InMode),
(Point, 'thePoint', InMode),
(FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
)
methods.append(f)
f = Function(short, 'FindControl',
(Point, 'thePoint', InMode),
(WindowPtr, 'theWindow', InMode),
(WindowRef, 'theWindow', InMode),
(ExistingControlHandle, 'theControl', OutMode),
)
functions.append(f)
f = Method(short, 'GetCVariant',
(ControlHandle, 'theControl', InMode),
f = Method(short, 'GetControlVariant',
(ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(short, 'TrackControl',
(ControlRef, 'theControl', InMode),
(Point, 'thePoint', InMode),
(FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
)
methods.append(f)
# Scan <Controls.h>, generating ctlgen.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 == "ControlHandle" and m == "InMode":
if t in ("ControlHandle", "ControlRef") and m == "InMode":
classname = "Method"
listname = "methods"
return classname, listname
......@@ -35,6 +37,7 @@ class MyScanner(Scanner):
def makeblacklisttypes(self):
return [
'ProcPtr',
'ControlActionUPP',
'CCTabHandle',
'AuxCtlHandle',
]
......@@ -51,9 +54,13 @@ class MyScanner(Scanner):
# For TrackControl
([("ProcPtr", "actionProc", "InMode")],
[("FakeType('(ControlActionUPP)0')", "*", "*")]),
([("ControlActionUPP", "actionProc", "InMode")],
[("FakeType('(ControlActionUPP)0')", "*", "*")]),
([("ControlHandle", "*", "OutMode")],
[("ExistingControlHandle", "*", "*")]),
([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
[("ExistingControlHandle", "*", "*")]),
]
if __name__ == "__main__":
......
......@@ -5,6 +5,9 @@
import string
import addpack
addpack.addpack(':Tools:bgen:bgen')
# Declarations that change for each manager
MACHEADERFILE = 'Controls.h' # The Apple header file
MODNAME = 'Ctl' # The name of the module
......@@ -22,6 +25,7 @@ from macsupport import *
# Create the type objects
ControlHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
ControlRef = ControlHandle
ExistingControlHandle = OpaqueByValueType(OBJECTTYPE, "CtlObj_WhichControl", "BUG")
RgnHandle = FakeType("theWindow->visRgn") # XXX
......
This diff is collapsed.
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Dialogs.h'
# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Dialogs.h'
f = Function(DialogPtr, 'NewDialog',
f = Function(DialogRef, 'NewDialog',
(NullStorage, 'wStorage', InMode),
(Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode),
(short, 'procID', InMode),
(WindowPtr, 'behind', InMode),
(WindowRef, 'behind', InMode),
(Boolean, 'goAwayFlag', InMode),
(long, 'refCon', InMode),
(Handle, 'itmLstHndl', InMode),
)
functions.append(f)
f = Function(DialogPtr, 'GetNewDialog',
f = Function(DialogRef, 'GetNewDialog',
(short, 'dialogID', InMode),
(NullStorage, 'dStorage', InMode),
(WindowPtr, 'behind', InMode),
(WindowRef, 'behind', InMode),
)
functions.append(f)
......@@ -29,7 +29,7 @@ f = Function(void, 'ParamText',
functions.append(f)
f = Function(void, 'ModalDialog',
(ModalFilterProcPtr, 'filterProc', InMode),
(ModalFilterUPP, 'modalFilter', InMode),
(short, 'itemHit', OutMode),
)
functions.append(f)
......@@ -47,42 +47,42 @@ f = Function(Boolean, 'DialogSelect',
functions.append(f)
f = Method(void, 'DrawDialog',
(DialogPtr, 'theDialog', InMode),
(DialogRef, 'theDialog', InMode),
)
methods.append(f)
f = Method(void, 'UpdateDialog',
(DialogPtr, 'theDialog', InMode),
(DialogRef, 'theDialog', InMode),
(RgnHandle, 'updateRgn', InMode),
)
methods.append(f)
f = Function(short, 'Alert',
(short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode),
(ModalFilterUPP, 'modalFilter', InMode),
)
functions.append(f)
f = Function(short, 'StopAlert',
(short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode),
(ModalFilterUPP, 'modalFilter', InMode),
)
functions.append(f)
f = Function(short, 'NoteAlert',
(short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode),
(ModalFilterUPP, 'modalFilter', InMode),
)
functions.append(f)
f = Function(short, 'CautionAlert',
(short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode),
(ModalFilterUPP, 'modalFilter', InMode),
)
functions.append(f)
f = Method(void, 'GetDItem',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'GetDialogItem',
(DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode),
(short, 'itemType', OutMode),
(Handle, 'item', OutMode),
......@@ -90,8 +90,8 @@ f = Method(void, 'GetDItem',
)
methods.append(f)
f = Method(void, 'SetDItem',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'SetDialogItem',
(DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode),
(short, 'itemType', InMode),
(Handle, 'item', InMode),
......@@ -99,101 +99,130 @@ f = Method(void, 'SetDItem',
)
methods.append(f)
f = Method(void, 'HideDItem',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'HideDialogItem',
(DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode),
)
methods.append(f)
f = Method(void, 'ShowDItem',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'ShowDialogItem',
(DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode),
)
methods.append(f)
f = Method(void, 'SelIText',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'SelectDialogItemText',
(DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode),
(short, 'strtSel', InMode),
(short, 'endSel', InMode),
)
methods.append(f)
f = Function(void, 'GetIText',
f = Function(void, 'GetDialogItemText',
(Handle, 'item', InMode),
(Str255, 'text', OutMode),
)
functions.append(f)
f = Function(void, 'SetIText',
f = Function(void, 'SetDialogItemText',
(Handle, 'item', InMode),
(ConstStr255Param, 'text', InMode),
)
functions.append(f)
f = Method(short, 'FindDItem',
(DialogPtr, 'theDialog', InMode),
f = Method(short, 'FindDialogItem',
(DialogRef, 'theDialog', InMode),
(Point, 'thePt', InMode),
)
methods.append(f)
f = Function(DialogPtr, 'NewCDialog',
f = Function(DialogRef, 'NewColorDialog',
(NullStorage, 'dStorage', InMode),
(Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode),
(short, 'procID', InMode),
(WindowPtr, 'behind', InMode),
(WindowRef, 'behind', InMode),
(Boolean, 'goAwayFlag', InMode),
(long, 'refCon', InMode),
(Handle, 'items', InMode),
)
functions.append(f)
f = Function(void, 'ResetAlrtStage',
f = Function(short, 'GetAlertStage',
)
functions.append(f)
f = Method(void, 'DlgCut',
(DialogPtr, 'theDialog', InMode),
f = Function(void, 'ResetAlertStage',
)
functions.append(f)
f = Method(void, 'DialogCut',
(DialogRef, 'theDialog', InMode),
)
methods.append(f)
f = Method(void, 'DlgPaste',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'DialogPaste',
(DialogRef, 'theDialog', InMode),
)
methods.append(f)
f = Method(void, 'DlgCopy',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'DialogCopy',
(DialogRef, 'theDialog', InMode),
)
methods.append(f)
f = Method(void, 'DlgDelete',
(DialogPtr, 'theDialog', InMode),
f = Method(void, 'DialogDelete',
(DialogRef, 'theDialog', InMode),
)
methods.append(f)
f = Function(void, 'SetDAFont',
(short, 'fontNum', InMode),
f = Function(void, 'SetDialogFont',
(short, 'value', InMode),
)
functions.append(f)
f = Method(void, 'AppendDITL',
(DialogPtr, 'theDialog', InMode),
(DialogRef, 'theDialog', InMode),
(Handle, 'theHandle', InMode),
(DITLMethod, 'method', InMode),
)
methods.append(f)
f = Method(short, 'CountDITL',
(DialogPtr, 'theDialog', InMode),
(DialogRef, 'theDialog', InMode),
)
methods.append(f)
f = Method(void, 'ShortenDITL',
(DialogPtr, 'theDialog', InMode),
(DialogRef, 'theDialog', InMode),
(short, 'numberItems', InMode),
)
methods.append(f)
f = Method(Boolean, 'StdFilterProc',
(DialogRef, 'theDialog', InMode),
(EventRecord, 'event', OutMode),
(short, 'itemHit', OutMode),
)
methods.append(f)
f = Method(OSErr, 'SetDialogDefaultItem',
(DialogRef, 'theDialog', InMode),
(short, 'newItem', InMode),
)
methods.append(f)
f = Method(OSErr, 'SetDialogCancelItem',
(DialogRef, 'theDialog', InMode),
(short, 'newItem', InMode),
)
methods.append(f)
f = Method(OSErr, 'SetDialogTracksCursor',
(DialogRef, 'theDialog', InMode),
(Boolean, 'tracks', InMode),
)
methods.append(f)
# Scan an Apple header file, generating a Python file of generator calls.
import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner
LONG = "Dialogs"
......@@ -24,7 +27,7 @@ class MyScanner(Scanner):
listname = "functions"
if arglist:
t, n, m = arglist[0]
if t == "DialogPtr" and m == "InMode":
if t in ("DialogPtr", "DialogRef") and m == "InMode":
classname = "Method"
listname = "methods"
return classname, listname
......@@ -42,6 +45,7 @@ class MyScanner(Scanner):
'FreeAlert',
'CouldDialog',
'FreeDialog',
'GetStdFilterProc',
]
def makeblacklisttypes(self):
......@@ -66,6 +70,8 @@ class MyScanner(Scanner):
([("DialogPtr", "*", "OutMode")],
[("ExistingDialogPtr", "*", "*")]),
([("DialogRef", "*", "OutMode")],
[("ExistingDialogPtr", "*", "*")]),
]
if __name__ == "__main__":
......
......@@ -3,14 +3,19 @@
# It execs the file dlggen.py which contain the function definitions
# (dlggen.py was generated by dlgscan.py, scanning the <Dialogs.h> header file).
import addpack
addpack.addpack(':Tools:bgen:bgen')
from macsupport import *
# Create the type objects
DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj")
DialogRef = DialogPtr
ModalFilterProcPtr = InputOnlyType("PyObject*", "O")
ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterProc(%s))" % name
ModalFilterUPP = ModalFilterProcPtr
RgnHandle = FakeType("_self->ob_itself->visRgn") # XXX
......
......@@ -68,9 +68,9 @@ class FixedInputOutputBufferType(InputOnlyType):
self.size)
Output("goto %s__error__;", name)
OutRbrace()
self.transferSize()
self.transferSize(name)
def transferSize():
def transferSize(self, name):
Output("%s__len__ = %s__in_len__;", name, name)
def passOutput(self, name):
......@@ -174,7 +174,7 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
def getargsArgs(self, name):
return "(char **)&%s__in__, &%s__in_len__" % (name, name)
def transferSize(self):
def transferSize(self, name):
pass
def passInput(self, name):
......
......@@ -32,11 +32,15 @@ ResType = OSTypeType("ResType")
# Handles (always resources in our case)
Handle = OpaqueByValueType("Handle", "ResObj")
MenuHandle = OpaqueByValueType("MenuHandle", "MenuObj")
MenuRef = MenuHandle
ControlHandle = OpaqueByValueType("ControlHandle", "CtlObj")
ControlRef = ControlHandle
# Windows and Dialogs
WindowPtr = OpaqueByValueType("WindowPtr", "WinObj")
WindowRef = WindowPtr
DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj")
DialogRef = DialogPtr
ExistingWindowPtr = OpaqueByValueType("WindowPtr", "WinObj_WhichWindow", "BUG")
ExistingDialogPtr = OpaqueByValueType("DialogPtr", "WinObj_WhichWindow", "BUG")
......@@ -137,8 +141,8 @@ class MacModule(Module):
_SetOutputFileName = SetOutputFileName # Save original
def SetOutputFileName(file = None):
"Set the output file name and set its creator&type to KAHL&TEXT"
"Set the output file name and set its creator&type to MPCC&TEXT"
_SetOutputFileName(file)
if file:
import MacOS
MacOS.SetCreatorAndType(file, 'KAHL', 'TEXT')
MacOS.SetCreatorAndType(file, 'MPCC', 'TEXT')
......@@ -27,8 +27,10 @@ except ImportError:
MacOS = None
# Default preferences
CREATOR = 'KAHL' # My favorite text editor on the Mac
INCLUDEDIR = "D:Development:THINK C:Mac #includes:Apple #includes:"
#CREATOR = 'KAHL' # Guido's favorite text editor on the Mac
#INCLUDEDIR = "D:Development:THINK C:Mac #includes:Apple #includes:"
CREATOR = 'MPCC' # Jack's favorite text editor on the Mac
INCLUDEDIR = "Moes:CW5 GOLD :Metrowerks C/C++ :Headers :Universal Headers 2.0a3 :"
Error = "scantools.Error"
......@@ -203,9 +205,9 @@ class Scanner:
self.includepath = [':', INCLUDEDIR]
def initpatterns(self):
self.head_pat = "^pascal[ \t]+" # XXX Mac specific!
self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
self.tail_pat = "[;={}]"
self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_]+\)[ \t\n]+"
self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+"
self.name_pat = "\(<name>[a-zA-Z0-9_]+\)[ \t\n]*"
self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))"
self.whole_pat = self.type_pat + self.name_pat + self.args_pat
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment