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 12:55:40 +00:00
parent c7cfb95559
commit ae8a68f40c
16 changed files with 466 additions and 284 deletions

View file

@ -1,12 +1,12 @@
# Progress dialog # Progress dialog
from addpack import addpack from addpack import addpack
addpack('Demo') addpack('Tools')
addpack('bgen') addpack('bgen')
addpack('dlg') addpack('dlg')
addpack('evt') addpack('evt')
from Dlg import GetNewDialog, ModalDialog, SetIText from Dlg import GetNewDialog, ModalDialog, SetDialogItemText
count = 0 count = 0
@ -17,12 +17,12 @@ def filter(d, e):
def main(): def main():
d = GetNewDialog(256, -1) d = GetNewDialog(256, -1)
tp, h, rect = d.GetDItem(2) tp, h, rect = d.GetDialogItem(2)
SetIText(h, "Progress...") SetDialogItemText(h, "Progress...")
for i in range(100): for i in range(100):
if i%10 == 0: if i%10 == 0:
str = "Progress...%d" % i str = "Progress...%d" % i
SetIText(h, str) SetDialogItemText(h, str)
ModalDialog(filter) ModalDialog(filter)
for j in range(100): pass for j in range(100): pass

View file

@ -5,6 +5,7 @@ from Ctl import *
from Win import * from Win import *
from Evt import * from Evt import *
import time import time
import sys
def main(): def main():
r = (40, 40, 400, 300) r = (40, 40, 400, 300)
@ -12,6 +13,8 @@ def main():
w.DrawGrowIcon() w.DrawGrowIcon()
r = (40, 40, 100, 60) r = (40, 40, 100, 60)
c = NewControl(w, r, "SPAM!", 1, 0, 0, 1, 0, 0) 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() main()

View file

@ -3,6 +3,9 @@
# Python library. # Python library.
# The ID can be overridden by passing a second parameter. # The ID can be overridden by passing a second parameter.
import addpack
addpack.addpack(':Tools:bgen:evt')
from Dlg import * from Dlg import *
from Events import * from Events import *
import string import string
@ -17,8 +20,8 @@ def f(d, event):
def message(str = "Hello, world!", id = ID): def message(str = "Hello, world!", id = ID):
d = GetNewDialog(id, -1) d = GetNewDialog(id, -1)
tp, h, rect = d.GetDItem(2) tp, h, rect = d.GetDialogItem(2)
SetIText(h, str) SetDialogItemText(h, str)
while 1: while 1:
n = ModalDialog(f) n = ModalDialog(f)
if n == 1: break if n == 1: break

View file

@ -1,10 +1,14 @@
# 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 pushButProc = 0
checkBoxProc = 1 checkBoxProc = 1
radioButProc = 2 radioButProc = 2
useWFont = 8
scrollBarProc = 16 scrollBarProc = 16
popupMenuProc = 1008
useWFont = 8
inLabel = 1
inMenu = 2
inTriangle = 4
inButton = 10 inButton = 10
inCheckBox = 11 inCheckBox = 11
inUpButton = 20 inUpButton = 20
@ -12,17 +16,34 @@ inDownButton = 21
inPageUp = 22 inPageUp = 22
inPageDown = 23 inPageDown = 23
inThumb = 129 inThumb = 129
popupMenuProc = 1008 kNoHiliteControlPart = 0
inLabel = 1 kInLabelControlPart = 1
inMenu = 2 kInMenuControlPart = 2
inTriangle = 4 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 popupUseWFont = 1 << 3
popupTitleBold = 1 << 8
popupTitleItalic = 1 << 9
popupTitleUnderline = 1 << 10
popupTitleOutline = 1 << 11 popupTitleOutline = 1 << 11
popupTitleShadow = 1 << 12
popupTitleCondense = 1 << 13
popupTitleExtend = 1 << 14 popupTitleExtend = 1 << 14
popupTitleNoStyle = 1 << 15
popupTitleLeftJust = 0x00000000 popupTitleLeftJust = 0x00000000
popupTitleCenterJust = 0x00000001 popupTitleCenterJust = 0x00000001
popupTitleRightJust = 0x000000FF popupTitleRightJust = 0x000000FF
noConstraint = 0
hAxisOnly = 1 hAxisOnly = 1
vAxisOnly = 2 vAxisOnly = 2
drawCntl = 0 drawCntl = 0
@ -36,6 +57,7 @@ dragCntl = 7
autoTrack = 8 autoTrack = 8
calcCntlRgn = 10 calcCntlRgn = 10
calcThumbRgn = 11 calcThumbRgn = 11
drawThumbOutline = 12
cFrameColor = 0 cFrameColor = 0
cBodyColor = 1 cBodyColor = 1
cTextColor = 2 cTextColor = 2

View file

@ -1,4 +1,4 @@
# 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 ctrlItem = 4
btnCtrl = 0 btnCtrl = 0
@ -16,6 +16,7 @@ cancel = 2
stopIcon = 0 stopIcon = 0
noteIcon = 1 noteIcon = 1
cautionIcon = 2 cautionIcon = 2
kIDODialogItem = 24
overlayDITL = 0 overlayDITL = 0
appendDITLRight = 1 appendDITLRight = 1
appendDITLBottom = 2 appendDITLBottom = 2

View file

@ -56,7 +56,7 @@ typedef struct ControlObject {
} ControlObject; } ControlObject;
PyObject *CtlObj_New(itself) PyObject *CtlObj_New(itself)
const ControlHandle itself; ControlHandle itself;
{ {
ControlObject *it; ControlObject *it;
if (itself == NULL) return PyMac_Error(resNotFound); if (itself == NULL) return PyMac_Error(resNotFound);
@ -86,7 +86,7 @@ static void CtlObj_dealloc(self)
PyMem_DEL(self); PyMem_DEL(self);
} }
static PyObject *CtlObj_SetCTitle(_self, _args) static PyObject *CtlObj_SetControlTitle(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -95,14 +95,14 @@ static PyObject *CtlObj_SetCTitle(_self, _args)
if (!PyArg_ParseTuple(_args, "O&", if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, title)) PyMac_GetStr255, title))
return NULL; return NULL;
SetCTitle(_self->ob_itself, SetControlTitle(_self->ob_itself,
title); title);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *CtlObj_GetCTitle(_self, _args) static PyObject *CtlObj_GetControlTitle(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -111,8 +111,8 @@ static PyObject *CtlObj_GetCTitle(_self, _args)
if (!PyArg_ParseTuple(_args, "O&", if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, title)) PyMac_GetStr255, title))
return NULL; return NULL;
GetCTitle(_self->ob_itself, GetControlTitle(_self->ob_itself,
title); title);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
@ -224,7 +224,7 @@ static PyObject *CtlObj_SizeControl(_self, _args)
return _res; return _res;
} }
static PyObject *CtlObj_SetCtlValue(_self, _args) static PyObject *CtlObj_SetControlValue(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -233,14 +233,14 @@ static PyObject *CtlObj_SetCtlValue(_self, _args)
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&theValue)) &theValue))
return NULL; return NULL;
SetCtlValue(_self->ob_itself, SetControlValue(_self->ob_itself,
theValue); theValue);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *CtlObj_GetCtlValue(_self, _args) static PyObject *CtlObj_GetControlValue(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -248,13 +248,13 @@ static PyObject *CtlObj_GetCtlValue(_self, _args)
short _rv; short _rv;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
_rv = GetCtlValue(_self->ob_itself); _rv = GetControlValue(_self->ob_itself);
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
} }
static PyObject *CtlObj_SetCtlMin(_self, _args) static PyObject *CtlObj_SetControlMinimum(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -263,14 +263,14 @@ static PyObject *CtlObj_SetCtlMin(_self, _args)
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&minValue)) &minValue))
return NULL; return NULL;
SetCtlMin(_self->ob_itself, SetControlMinimum(_self->ob_itself,
minValue); minValue);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *CtlObj_GetCtlMin(_self, _args) static PyObject *CtlObj_GetControlMinimum(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -278,13 +278,13 @@ static PyObject *CtlObj_GetCtlMin(_self, _args)
short _rv; short _rv;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
_rv = GetCtlMin(_self->ob_itself); _rv = GetControlMinimum(_self->ob_itself);
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
} }
static PyObject *CtlObj_SetCtlMax(_self, _args) static PyObject *CtlObj_SetControlMaximum(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -293,14 +293,14 @@ static PyObject *CtlObj_SetCtlMax(_self, _args)
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&maxValue)) &maxValue))
return NULL; return NULL;
SetCtlMax(_self->ob_itself, SetControlMaximum(_self->ob_itself,
maxValue); maxValue);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *CtlObj_GetCtlMax(_self, _args) static PyObject *CtlObj_GetControlMaximum(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -308,13 +308,13 @@ static PyObject *CtlObj_GetCtlMax(_self, _args)
short _rv; short _rv;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
_rv = GetCtlMax(_self->ob_itself); _rv = GetControlMaximum(_self->ob_itself);
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
} }
static PyObject *CtlObj_SetCRefCon(_self, _args) static PyObject *CtlObj_SetControlReference(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -323,14 +323,14 @@ static PyObject *CtlObj_SetCRefCon(_self, _args)
if (!PyArg_ParseTuple(_args, "l", if (!PyArg_ParseTuple(_args, "l",
&data)) &data))
return NULL; return NULL;
SetCRefCon(_self->ob_itself, SetControlReference(_self->ob_itself,
data); data);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *CtlObj_GetCRefCon(_self, _args) static PyObject *CtlObj_GetControlReference(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -338,12 +338,26 @@ static PyObject *CtlObj_GetCRefCon(_self, _args)
long _rv; long _rv;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
_rv = GetCRefCon(_self->ob_itself); _rv = GetControlReference(_self->ob_itself);
_res = Py_BuildValue("l", _res = Py_BuildValue("l",
_rv); _rv);
return _res; 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) static PyObject *CtlObj_DragControl(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
@ -386,6 +400,20 @@ static PyObject *CtlObj_TestControl(_self, _args)
return _res; return _res;
} }
static PyObject *CtlObj_GetControlVariant(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetControlVariant(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *CtlObj_TrackControl(_self, _args) static PyObject *CtlObj_TrackControl(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
@ -404,24 +432,10 @@ static PyObject *CtlObj_TrackControl(_self, _args)
return _res; return _res;
} }
static PyObject *CtlObj_GetCVariant(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCVariant(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyMethodDef CtlObj_methods[] = { static PyMethodDef CtlObj_methods[] = {
{"SetCTitle", (PyCFunction)CtlObj_SetCTitle, 1, {"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1,
"(Str255 title) -> None"}, "(Str255 title) -> None"},
{"GetCTitle", (PyCFunction)CtlObj_GetCTitle, 1, {"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1,
"(Str255 title) -> None"}, "(Str255 title) -> None"},
{"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1, {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
"() -> None"}, "() -> None"},
@ -437,30 +451,32 @@ static PyMethodDef CtlObj_methods[] = {
"(short h, short v) -> None"}, "(short h, short v) -> None"},
{"SizeControl", (PyCFunction)CtlObj_SizeControl, 1, {"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
"(short w, short h) -> None"}, "(short w, short h) -> None"},
{"SetCtlValue", (PyCFunction)CtlObj_SetCtlValue, 1, {"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1,
"(short theValue) -> None"}, "(short theValue) -> None"},
{"GetCtlValue", (PyCFunction)CtlObj_GetCtlValue, 1, {"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
{"SetCtlMin", (PyCFunction)CtlObj_SetCtlMin, 1, {"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1,
"(short minValue) -> None"}, "(short minValue) -> None"},
{"GetCtlMin", (PyCFunction)CtlObj_GetCtlMin, 1, {"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
{"SetCtlMax", (PyCFunction)CtlObj_SetCtlMax, 1, {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1,
"(short maxValue) -> None"}, "(short maxValue) -> None"},
{"GetCtlMax", (PyCFunction)CtlObj_GetCtlMax, 1, {"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
{"SetCRefCon", (PyCFunction)CtlObj_SetCRefCon, 1, {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
"(long data) -> None"}, "(long data) -> None"},
{"GetCRefCon", (PyCFunction)CtlObj_GetCRefCon, 1, {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
"() -> (long _rv)"}, "() -> (long _rv)"},
{"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1,
"() -> None"},
{"DragControl", (PyCFunction)CtlObj_DragControl, 1, {"DragControl", (PyCFunction)CtlObj_DragControl, 1,
"(Point startPt, Rect limitRect, Rect slopRect, short axis) -> None"}, "(Point startPt, Rect limitRect, Rect slopRect, short axis) -> None"},
{"TestControl", (PyCFunction)CtlObj_TestControl, 1, {"TestControl", (PyCFunction)CtlObj_TestControl, 1,
"(Point thePt) -> (short _rv)"}, "(Point thePt) -> (short _rv)"},
{"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
"() -> (short _rv)"},
{"TrackControl", (PyCFunction)CtlObj_TrackControl, 1, {"TrackControl", (PyCFunction)CtlObj_TrackControl, 1,
"(Point thePoint) -> (short _rv)"}, "(Point thePoint) -> (short _rv)"},
{"GetCVariant", (PyCFunction)CtlObj_GetCVariant, 1,
"() -> (short _rv)"},
{NULL, NULL, 0} {NULL, NULL, 0}
}; };
@ -580,22 +596,6 @@ static PyObject *Ctl_DrawControls(_self, _args)
return _res; 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) static PyObject *Ctl_UpdateControls(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -643,8 +643,6 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr theWindow) -> None"}, "(WindowPtr theWindow) -> None"},
{"DrawControls", (PyCFunction)Ctl_DrawControls, 1, {"DrawControls", (PyCFunction)Ctl_DrawControls, 1,
"(WindowPtr theWindow) -> None"}, "(WindowPtr theWindow) -> None"},
{"UpdtControl", (PyCFunction)Ctl_UpdtControl, 1,
"(WindowPtr theWindow) -> None"},
{"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1, {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1,
"(WindowPtr theWindow) -> None"}, "(WindowPtr theWindow) -> None"},
{"FindControl", (PyCFunction)Ctl_FindControl, 1, {"FindControl", (PyCFunction)Ctl_FindControl, 1,

View file

@ -1,7 +1,7 @@
# 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', f = Function(ControlRef, 'NewControl',
(WindowPtr, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
(Rect_ptr, 'boundsRect', InMode), (Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode), (ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode), (Boolean, 'visible', InMode),
@ -13,132 +13,132 @@ f = Function(ControlHandle, 'NewControl',
) )
functions.append(f) functions.append(f)
f = Method(void, 'SetCTitle', f = Method(void, 'SetControlTitle',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(ConstStr255Param, 'title', InMode), (ConstStr255Param, 'title', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'GetCTitle', f = Method(void, 'GetControlTitle',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(Str255, 'title', InMode), (Str255, 'title', InMode),
) )
methods.append(f) methods.append(f)
f = Function(ControlHandle, 'GetNewControl', f = Function(ControlRef, 'GetNewControl',
(short, 'controlID', InMode), (short, 'controlID', InMode),
(WindowPtr, 'owner', InMode), (WindowRef, 'owner', InMode),
) )
functions.append(f) functions.append(f)
f = Method(void, 'DisposeControl', f = Method(void, 'DisposeControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Function(void, 'KillControls', f = Function(void, 'KillControls',
(WindowPtr, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
) )
functions.append(f) functions.append(f)
f = Method(void, 'HideControl', f = Method(void, 'HideControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'ShowControl', f = Method(void, 'ShowControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Function(void, 'DrawControls', f = Function(void, 'DrawControls',
(WindowPtr, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
) )
functions.append(f) functions.append(f)
f = Method(void, 'Draw1Control', f = Method(void, 'Draw1Control',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'HiliteControl', f = Method(void, 'HiliteControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(short, 'hiliteState', InMode), (short, 'hiliteState', InMode),
) )
methods.append(f) methods.append(f)
f = Function(void, 'UpdtControl',
(WindowPtr, 'theWindow', InMode),
(RgnHandle, 'updateRgn', InMode),
)
functions.append(f)
f = Function(void, 'UpdateControls', f = Function(void, 'UpdateControls',
(WindowPtr, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
(RgnHandle, 'updateRgn', InMode), (RgnHandle, 'updateRgn', InMode),
) )
functions.append(f) functions.append(f)
f = Method(void, 'MoveControl', f = Method(void, 'MoveControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(short, 'h', InMode), (short, 'h', InMode),
(short, 'v', InMode), (short, 'v', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'SizeControl', f = Method(void, 'SizeControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(short, 'w', InMode), (short, 'w', InMode),
(short, 'h', InMode), (short, 'h', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'SetCtlValue', f = Method(void, 'SetControlValue',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(short, 'theValue', InMode), (short, 'theValue', InMode),
) )
methods.append(f) methods.append(f)
f = Method(short, 'GetCtlValue', f = Method(short, 'GetControlValue',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'SetCtlMin', f = Method(void, 'SetControlMinimum',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(short, 'minValue', InMode), (short, 'minValue', InMode),
) )
methods.append(f) methods.append(f)
f = Method(short, 'GetCtlMin', f = Method(short, 'GetControlMinimum',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'SetCtlMax', f = Method(void, 'SetControlMaximum',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(short, 'maxValue', InMode), (short, 'maxValue', InMode),
) )
methods.append(f) methods.append(f)
f = Method(short, 'GetCtlMax', f = Method(short, 'GetControlMaximum',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'SetCRefCon', f = Method(void, 'SetControlReference',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(long, 'data', InMode), (long, 'data', InMode),
) )
methods.append(f) methods.append(f)
f = Method(long, 'GetCRefCon', f = Method(long, 'GetControlReference',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'SetControlAction',
(ControlRef, 'theControl', InMode),
(FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'DragControl', f = Method(void, 'DragControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(Point, 'startPt', InMode), (Point, 'startPt', InMode),
(Rect_ptr, 'limitRect', InMode), (Rect_ptr, 'limitRect', InMode),
(Rect_ptr, 'slopRect', InMode), (Rect_ptr, 'slopRect', InMode),
@ -147,27 +147,27 @@ f = Method(void, 'DragControl',
methods.append(f) methods.append(f)
f = Method(short, 'TestControl', f = Method(short, 'TestControl',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
(Point, 'thePt', InMode), (Point, 'thePt', InMode),
) )
methods.append(f) 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', f = Function(short, 'FindControl',
(Point, 'thePoint', InMode), (Point, 'thePoint', InMode),
(WindowPtr, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
(ExistingControlHandle, 'theControl', OutMode), (ExistingControlHandle, 'theControl', OutMode),
) )
functions.append(f) functions.append(f)
f = Method(short, 'GetCVariant', f = Method(short, 'GetControlVariant',
(ControlHandle, 'theControl', InMode), (ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(short, 'TrackControl',
(ControlRef, 'theControl', InMode),
(Point, 'thePoint', InMode),
(FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
) )
methods.append(f) methods.append(f)

View file

@ -1,4 +1,6 @@
# Scan <Controls.h>, generating ctlgen.py. # Scan <Controls.h>, generating ctlgen.py.
import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner from scantools import Scanner
@ -20,7 +22,7 @@ class MyScanner(Scanner):
listname = "functions" listname = "functions"
if arglist: if arglist:
t, n, m = arglist[0] t, n, m = arglist[0]
if t == "ControlHandle" and m == "InMode": if t in ("ControlHandle", "ControlRef") and m == "InMode":
classname = "Method" classname = "Method"
listname = "methods" listname = "methods"
return classname, listname return classname, listname
@ -35,6 +37,7 @@ class MyScanner(Scanner):
def makeblacklisttypes(self): def makeblacklisttypes(self):
return [ return [
'ProcPtr', 'ProcPtr',
'ControlActionUPP',
'CCTabHandle', 'CCTabHandle',
'AuxCtlHandle', 'AuxCtlHandle',
] ]
@ -51,9 +54,13 @@ class MyScanner(Scanner):
# For TrackControl # For TrackControl
([("ProcPtr", "actionProc", "InMode")], ([("ProcPtr", "actionProc", "InMode")],
[("FakeType('(ControlActionUPP)0')", "*", "*")]), [("FakeType('(ControlActionUPP)0')", "*", "*")]),
([("ControlActionUPP", "actionProc", "InMode")],
[("FakeType('(ControlActionUPP)0')", "*", "*")]),
([("ControlHandle", "*", "OutMode")], ([("ControlHandle", "*", "OutMode")],
[("ExistingControlHandle", "*", "*")]), [("ExistingControlHandle", "*", "*")]),
([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
[("ExistingControlHandle", "*", "*")]),
] ]
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -5,6 +5,9 @@
import string import string
import addpack
addpack.addpack(':Tools:bgen:bgen')
# Declarations that change for each manager # Declarations that change for each manager
MACHEADERFILE = 'Controls.h' # The Apple header file MACHEADERFILE = 'Controls.h' # The Apple header file
MODNAME = 'Ctl' # The name of the module MODNAME = 'Ctl' # The name of the module
@ -22,6 +25,7 @@ from macsupport import *
# Create the type objects # Create the type objects
ControlHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) ControlHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
ControlRef = ControlHandle
ExistingControlHandle = OpaqueByValueType(OBJECTTYPE, "CtlObj_WhichControl", "BUG") ExistingControlHandle = OpaqueByValueType(OBJECTTYPE, "CtlObj_WhichControl", "BUG")
RgnHandle = FakeType("theWindow->visRgn") # XXX RgnHandle = FakeType("theWindow->visRgn") # XXX

View file

@ -172,7 +172,7 @@ static PyObject *DlgObj_UpdateDialog(_self, _args)
return _res; return _res;
} }
static PyObject *DlgObj_GetDItem(_self, _args) static PyObject *DlgObj_GetDialogItem(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -184,11 +184,11 @@ static PyObject *DlgObj_GetDItem(_self, _args)
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&itemNo)) &itemNo))
return NULL; return NULL;
GetDItem(_self->ob_itself, GetDialogItem(_self->ob_itself,
itemNo, itemNo,
&itemType, &itemType,
&item, &item,
&box); &box);
_res = Py_BuildValue("hO&O&", _res = Py_BuildValue("hO&O&",
itemType, itemType,
ResObj_New, item, ResObj_New, item,
@ -196,7 +196,7 @@ static PyObject *DlgObj_GetDItem(_self, _args)
return _res; return _res;
} }
static PyObject *DlgObj_SetDItem(_self, _args) static PyObject *DlgObj_SetDialogItem(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -211,17 +211,17 @@ static PyObject *DlgObj_SetDItem(_self, _args)
ResObj_Convert, &item, ResObj_Convert, &item,
PyMac_GetRect, &box)) PyMac_GetRect, &box))
return NULL; return NULL;
SetDItem(_self->ob_itself, SetDialogItem(_self->ob_itself,
itemNo, itemNo,
itemType, itemType,
item, item,
&box); &box);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_HideDItem(_self, _args) static PyObject *DlgObj_HideDialogItem(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -230,14 +230,14 @@ static PyObject *DlgObj_HideDItem(_self, _args)
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&itemNo)) &itemNo))
return NULL; return NULL;
HideDItem(_self->ob_itself, HideDialogItem(_self->ob_itself,
itemNo); itemNo);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_ShowDItem(_self, _args) static PyObject *DlgObj_ShowDialogItem(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -246,14 +246,14 @@ static PyObject *DlgObj_ShowDItem(_self, _args)
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&itemNo)) &itemNo))
return NULL; return NULL;
ShowDItem(_self->ob_itself, ShowDialogItem(_self->ob_itself,
itemNo); itemNo);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_SelIText(_self, _args) static PyObject *DlgObj_SelectDialogItemText(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -266,16 +266,16 @@ static PyObject *DlgObj_SelIText(_self, _args)
&strtSel, &strtSel,
&endSel)) &endSel))
return NULL; return NULL;
SelIText(_self->ob_itself, SelectDialogItemText(_self->ob_itself,
itemNo, itemNo,
strtSel, strtSel,
endSel); endSel);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_FindDItem(_self, _args) static PyObject *DlgObj_FindDialogItem(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -285,60 +285,60 @@ static PyObject *DlgObj_FindDItem(_self, _args)
if (!PyArg_ParseTuple(_args, "O&", if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetPoint, &thePt)) PyMac_GetPoint, &thePt))
return NULL; return NULL;
_rv = FindDItem(_self->ob_itself, _rv = FindDialogItem(_self->ob_itself,
thePt); thePt);
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
} }
static PyObject *DlgObj_DlgCut(_self, _args) static PyObject *DlgObj_DialogCut(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
DlgCut(_self->ob_itself); DialogCut(_self->ob_itself);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_DlgPaste(_self, _args) static PyObject *DlgObj_DialogPaste(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
DlgPaste(_self->ob_itself); DialogPaste(_self->ob_itself);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_DlgCopy(_self, _args) static PyObject *DlgObj_DialogCopy(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
DlgCopy(_self->ob_itself); DialogCopy(_self->ob_itself);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *DlgObj_DlgDelete(_self, _args) static PyObject *DlgObj_DialogDelete(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
DlgDelete(_self->ob_itself); DialogDelete(_self->ob_itself);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
@ -393,30 +393,104 @@ static PyObject *DlgObj_ShortenDITL(_self, _args)
return _res; return _res;
} }
static PyObject *DlgObj_StdFilterProc(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
EventRecord event;
short itemHit;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = StdFilterProc(_self->ob_itself,
&event,
&itemHit);
_res = Py_BuildValue("bO&h",
_rv,
PyMac_BuildEventRecord, &event,
itemHit);
return _res;
}
static PyObject *DlgObj_SetDialogDefaultItem(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
short newItem;
if (!PyArg_ParseTuple(_args, "h",
&newItem))
return NULL;
_err = SetDialogDefaultItem(_self->ob_itself,
newItem);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *DlgObj_SetDialogCancelItem(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
short newItem;
if (!PyArg_ParseTuple(_args, "h",
&newItem))
return NULL;
_err = SetDialogCancelItem(_self->ob_itself,
newItem);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *DlgObj_SetDialogTracksCursor(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
Boolean tracks;
if (!PyArg_ParseTuple(_args, "b",
&tracks))
return NULL;
_err = SetDialogTracksCursor(_self->ob_itself,
tracks);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyMethodDef DlgObj_methods[] = { static PyMethodDef DlgObj_methods[] = {
{"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
"() -> None"}, "() -> None"},
{"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1, {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1,
"() -> None"}, "() -> None"},
{"GetDItem", (PyCFunction)DlgObj_GetDItem, 1, {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1,
"(short itemNo) -> (short itemType, Handle item, Rect box)"}, "(short itemNo) -> (short itemType, Handle item, Rect box)"},
{"SetDItem", (PyCFunction)DlgObj_SetDItem, 1, {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1,
"(short itemNo, short itemType, Handle item, Rect box) -> None"}, "(short itemNo, short itemType, Handle item, Rect box) -> None"},
{"HideDItem", (PyCFunction)DlgObj_HideDItem, 1, {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1,
"(short itemNo) -> None"}, "(short itemNo) -> None"},
{"ShowDItem", (PyCFunction)DlgObj_ShowDItem, 1, {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1,
"(short itemNo) -> None"}, "(short itemNo) -> None"},
{"SelIText", (PyCFunction)DlgObj_SelIText, 1, {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1,
"(short itemNo, short strtSel, short endSel) -> None"}, "(short itemNo, short strtSel, short endSel) -> None"},
{"FindDItem", (PyCFunction)DlgObj_FindDItem, 1, {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1,
"(Point thePt) -> (short _rv)"}, "(Point thePt) -> (short _rv)"},
{"DlgCut", (PyCFunction)DlgObj_DlgCut, 1, {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1,
"() -> None"}, "() -> None"},
{"DlgPaste", (PyCFunction)DlgObj_DlgPaste, 1, {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1,
"() -> None"}, "() -> None"},
{"DlgCopy", (PyCFunction)DlgObj_DlgCopy, 1, {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1,
"() -> None"}, "() -> None"},
{"DlgDelete", (PyCFunction)DlgObj_DlgDelete, 1, {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1,
"() -> None"}, "() -> None"},
{"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1, {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1,
"(Handle theHandle, DITLMethod method) -> None"}, "(Handle theHandle, DITLMethod method) -> None"},
@ -424,6 +498,14 @@ static PyMethodDef DlgObj_methods[] = {
"() -> (short _rv)"}, "() -> (short _rv)"},
{"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1, {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1,
"(short numberItems) -> None"}, "(short numberItems) -> None"},
{"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1,
"() -> (Boolean _rv, EventRecord event, short itemHit)"},
{"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1,
"(short newItem) -> None"},
{"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1,
"(short newItem) -> None"},
{"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1,
"(Boolean tracks) -> None"},
{NULL, NULL, 0} {NULL, NULL, 0}
}; };
@ -541,12 +623,12 @@ static PyObject *Dlg_ModalDialog(_self, _args)
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
PyObject* filterProc; PyObject* modalFilter;
short itemHit; short itemHit;
if (!PyArg_ParseTuple(_args, "O", if (!PyArg_ParseTuple(_args, "O",
&filterProc)) &modalFilter))
return NULL; return NULL;
ModalDialog(NewModalFilterProc(Dlg_PassFilterProc(filterProc)), ModalDialog(NewModalFilterProc(Dlg_PassFilterProc(modalFilter)),
&itemHit); &itemHit);
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
itemHit); itemHit);
@ -598,13 +680,13 @@ static PyObject *Dlg_Alert(_self, _args)
PyObject *_res = NULL; PyObject *_res = NULL;
short _rv; short _rv;
short alertID; short alertID;
PyObject* filterProc; PyObject* modalFilter;
if (!PyArg_ParseTuple(_args, "hO", if (!PyArg_ParseTuple(_args, "hO",
&alertID, &alertID,
&filterProc)) &modalFilter))
return NULL; return NULL;
_rv = Alert(alertID, _rv = Alert(alertID,
NewModalFilterProc(Dlg_PassFilterProc(filterProc))); NewModalFilterProc(Dlg_PassFilterProc(modalFilter)));
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
@ -617,13 +699,13 @@ static PyObject *Dlg_StopAlert(_self, _args)
PyObject *_res = NULL; PyObject *_res = NULL;
short _rv; short _rv;
short alertID; short alertID;
PyObject* filterProc; PyObject* modalFilter;
if (!PyArg_ParseTuple(_args, "hO", if (!PyArg_ParseTuple(_args, "hO",
&alertID, &alertID,
&filterProc)) &modalFilter))
return NULL; return NULL;
_rv = StopAlert(alertID, _rv = StopAlert(alertID,
NewModalFilterProc(Dlg_PassFilterProc(filterProc))); NewModalFilterProc(Dlg_PassFilterProc(modalFilter)));
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
@ -636,13 +718,13 @@ static PyObject *Dlg_NoteAlert(_self, _args)
PyObject *_res = NULL; PyObject *_res = NULL;
short _rv; short _rv;
short alertID; short alertID;
PyObject* filterProc; PyObject* modalFilter;
if (!PyArg_ParseTuple(_args, "hO", if (!PyArg_ParseTuple(_args, "hO",
&alertID, &alertID,
&filterProc)) &modalFilter))
return NULL; return NULL;
_rv = NoteAlert(alertID, _rv = NoteAlert(alertID,
NewModalFilterProc(Dlg_PassFilterProc(filterProc))); NewModalFilterProc(Dlg_PassFilterProc(modalFilter)));
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
@ -655,19 +737,19 @@ static PyObject *Dlg_CautionAlert(_self, _args)
PyObject *_res = NULL; PyObject *_res = NULL;
short _rv; short _rv;
short alertID; short alertID;
PyObject* filterProc; PyObject* modalFilter;
if (!PyArg_ParseTuple(_args, "hO", if (!PyArg_ParseTuple(_args, "hO",
&alertID, &alertID,
&filterProc)) &modalFilter))
return NULL; return NULL;
_rv = CautionAlert(alertID, _rv = CautionAlert(alertID,
NewModalFilterProc(Dlg_PassFilterProc(filterProc))); NewModalFilterProc(Dlg_PassFilterProc(modalFilter)));
_res = Py_BuildValue("h", _res = Py_BuildValue("h",
_rv); _rv);
return _res; return _res;
} }
static PyObject *Dlg_GetIText(_self, _args) static PyObject *Dlg_GetDialogItemText(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -677,14 +759,14 @@ static PyObject *Dlg_GetIText(_self, _args)
if (!PyArg_ParseTuple(_args, "O&", if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &item)) ResObj_Convert, &item))
return NULL; return NULL;
GetIText(item, GetDialogItemText(item,
text); text);
_res = Py_BuildValue("O&", _res = Py_BuildValue("O&",
PyMac_BuildStr255, text); PyMac_BuildStr255, text);
return _res; return _res;
} }
static PyObject *Dlg_SetIText(_self, _args) static PyObject *Dlg_SetDialogItemText(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -695,14 +777,14 @@ static PyObject *Dlg_SetIText(_self, _args)
ResObj_Convert, &item, ResObj_Convert, &item,
PyMac_GetStr255, text)) PyMac_GetStr255, text))
return NULL; return NULL;
SetIText(item, SetDialogItemText(item,
text); text);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *Dlg_NewCDialog(_self, _args) static PyObject *Dlg_NewColorDialog(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
{ {
@ -726,43 +808,57 @@ static PyObject *Dlg_NewCDialog(_self, _args)
&refCon, &refCon,
ResObj_Convert, &items)) ResObj_Convert, &items))
return NULL; return NULL;
_rv = NewCDialog((void *)0, _rv = NewColorDialog((void *)0,
&boundsRect, &boundsRect,
title, title,
visible, visible,
procID, procID,
behind, behind,
goAwayFlag, goAwayFlag,
refCon, refCon,
items); items);
_res = Py_BuildValue("O&", _res = Py_BuildValue("O&",
DlgObj_New, _rv); DlgObj_New, _rv);
return _res; return _res;
} }
static PyObject *Dlg_ResetAlrtStage(_self, _args) static PyObject *Dlg_GetAlertStage(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetAlertStage();
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *Dlg_ResetAlertStage(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
ResetAlrtStage(); ResetAlertStage();
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
static PyObject *Dlg_SetDAFont(_self, _args) static PyObject *Dlg_SetDialogFont(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
short fontNum; short value;
if (!PyArg_ParseTuple(_args, "h", if (!PyArg_ParseTuple(_args, "h",
&fontNum)) &value))
return NULL; return NULL;
SetDAFont(fontNum); SetDialogFont(value);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
return _res; return _res;
@ -776,29 +872,31 @@ static PyMethodDef Dlg_methods[] = {
{"ParamText", (PyCFunction)Dlg_ParamText, 1, {"ParamText", (PyCFunction)Dlg_ParamText, 1,
"(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"}, "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
{"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1, {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1,
"(PyObject* filterProc) -> (short itemHit)"}, "(PyObject* modalFilter) -> (short itemHit)"},
{"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1, {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1,
"(EventRecord theEvent) -> (Boolean _rv)"}, "(EventRecord theEvent) -> (Boolean _rv)"},
{"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1, {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1,
"(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, short itemHit)"}, "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, short itemHit)"},
{"Alert", (PyCFunction)Dlg_Alert, 1, {"Alert", (PyCFunction)Dlg_Alert, 1,
"(short alertID, PyObject* filterProc) -> (short _rv)"}, "(short alertID, PyObject* modalFilter) -> (short _rv)"},
{"StopAlert", (PyCFunction)Dlg_StopAlert, 1, {"StopAlert", (PyCFunction)Dlg_StopAlert, 1,
"(short alertID, PyObject* filterProc) -> (short _rv)"}, "(short alertID, PyObject* modalFilter) -> (short _rv)"},
{"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1, {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1,
"(short alertID, PyObject* filterProc) -> (short _rv)"}, "(short alertID, PyObject* modalFilter) -> (short _rv)"},
{"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1, {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1,
"(short alertID, PyObject* filterProc) -> (short _rv)"}, "(short alertID, PyObject* modalFilter) -> (short _rv)"},
{"GetIText", (PyCFunction)Dlg_GetIText, 1, {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1,
"(Handle item) -> (Str255 text)"}, "(Handle item) -> (Str255 text)"},
{"SetIText", (PyCFunction)Dlg_SetIText, 1, {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1,
"(Handle item, Str255 text) -> None"}, "(Handle item, Str255 text) -> None"},
{"NewCDialog", (PyCFunction)Dlg_NewCDialog, 1, {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1,
"(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon, Handle items) -> (DialogPtr _rv)"}, "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon, Handle items) -> (DialogPtr _rv)"},
{"ResetAlrtStage", (PyCFunction)Dlg_ResetAlrtStage, 1, {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1,
"() -> (short _rv)"},
{"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1,
"() -> None"}, "() -> None"},
{"SetDAFont", (PyCFunction)Dlg_SetDAFont, 1, {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1,
"(short fontNum) -> None"}, "(short value) -> None"},
{NULL, NULL, 0} {NULL, NULL, 0}
}; };

View file

@ -1,22 +1,22 @@
# 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), (NullStorage, 'wStorage', InMode),
(Rect_ptr, 'boundsRect', InMode), (Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode), (ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode), (Boolean, 'visible', InMode),
(short, 'procID', InMode), (short, 'procID', InMode),
(WindowPtr, 'behind', InMode), (WindowRef, 'behind', InMode),
(Boolean, 'goAwayFlag', InMode), (Boolean, 'goAwayFlag', InMode),
(long, 'refCon', InMode), (long, 'refCon', InMode),
(Handle, 'itmLstHndl', InMode), (Handle, 'itmLstHndl', InMode),
) )
functions.append(f) functions.append(f)
f = Function(DialogPtr, 'GetNewDialog', f = Function(DialogRef, 'GetNewDialog',
(short, 'dialogID', InMode), (short, 'dialogID', InMode),
(NullStorage, 'dStorage', InMode), (NullStorage, 'dStorage', InMode),
(WindowPtr, 'behind', InMode), (WindowRef, 'behind', InMode),
) )
functions.append(f) functions.append(f)
@ -29,7 +29,7 @@ f = Function(void, 'ParamText',
functions.append(f) functions.append(f)
f = Function(void, 'ModalDialog', f = Function(void, 'ModalDialog',
(ModalFilterProcPtr, 'filterProc', InMode), (ModalFilterUPP, 'modalFilter', InMode),
(short, 'itemHit', OutMode), (short, 'itemHit', OutMode),
) )
functions.append(f) functions.append(f)
@ -47,42 +47,42 @@ f = Function(Boolean, 'DialogSelect',
functions.append(f) functions.append(f)
f = Method(void, 'DrawDialog', f = Method(void, 'DrawDialog',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'UpdateDialog', f = Method(void, 'UpdateDialog',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(RgnHandle, 'updateRgn', InMode), (RgnHandle, 'updateRgn', InMode),
) )
methods.append(f) methods.append(f)
f = Function(short, 'Alert', f = Function(short, 'Alert',
(short, 'alertID', InMode), (short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode), (ModalFilterUPP, 'modalFilter', InMode),
) )
functions.append(f) functions.append(f)
f = Function(short, 'StopAlert', f = Function(short, 'StopAlert',
(short, 'alertID', InMode), (short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode), (ModalFilterUPP, 'modalFilter', InMode),
) )
functions.append(f) functions.append(f)
f = Function(short, 'NoteAlert', f = Function(short, 'NoteAlert',
(short, 'alertID', InMode), (short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode), (ModalFilterUPP, 'modalFilter', InMode),
) )
functions.append(f) functions.append(f)
f = Function(short, 'CautionAlert', f = Function(short, 'CautionAlert',
(short, 'alertID', InMode), (short, 'alertID', InMode),
(ModalFilterProcPtr, 'filterProc', InMode), (ModalFilterUPP, 'modalFilter', InMode),
) )
functions.append(f) functions.append(f)
f = Method(void, 'GetDItem', f = Method(void, 'GetDialogItem',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode), (short, 'itemNo', InMode),
(short, 'itemType', OutMode), (short, 'itemType', OutMode),
(Handle, 'item', OutMode), (Handle, 'item', OutMode),
@ -90,8 +90,8 @@ f = Method(void, 'GetDItem',
) )
methods.append(f) methods.append(f)
f = Method(void, 'SetDItem', f = Method(void, 'SetDialogItem',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode), (short, 'itemNo', InMode),
(short, 'itemType', InMode), (short, 'itemType', InMode),
(Handle, 'item', InMode), (Handle, 'item', InMode),
@ -99,101 +99,130 @@ f = Method(void, 'SetDItem',
) )
methods.append(f) methods.append(f)
f = Method(void, 'HideDItem', f = Method(void, 'HideDialogItem',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode), (short, 'itemNo', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'ShowDItem', f = Method(void, 'ShowDialogItem',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode), (short, 'itemNo', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'SelIText', f = Method(void, 'SelectDialogItemText',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(short, 'itemNo', InMode), (short, 'itemNo', InMode),
(short, 'strtSel', InMode), (short, 'strtSel', InMode),
(short, 'endSel', InMode), (short, 'endSel', InMode),
) )
methods.append(f) methods.append(f)
f = Function(void, 'GetIText', f = Function(void, 'GetDialogItemText',
(Handle, 'item', InMode), (Handle, 'item', InMode),
(Str255, 'text', OutMode), (Str255, 'text', OutMode),
) )
functions.append(f) functions.append(f)
f = Function(void, 'SetIText', f = Function(void, 'SetDialogItemText',
(Handle, 'item', InMode), (Handle, 'item', InMode),
(ConstStr255Param, 'text', InMode), (ConstStr255Param, 'text', InMode),
) )
functions.append(f) functions.append(f)
f = Method(short, 'FindDItem', f = Method(short, 'FindDialogItem',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(Point, 'thePt', InMode), (Point, 'thePt', InMode),
) )
methods.append(f) methods.append(f)
f = Function(DialogPtr, 'NewCDialog', f = Function(DialogRef, 'NewColorDialog',
(NullStorage, 'dStorage', InMode), (NullStorage, 'dStorage', InMode),
(Rect_ptr, 'boundsRect', InMode), (Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode), (ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode), (Boolean, 'visible', InMode),
(short, 'procID', InMode), (short, 'procID', InMode),
(WindowPtr, 'behind', InMode), (WindowRef, 'behind', InMode),
(Boolean, 'goAwayFlag', InMode), (Boolean, 'goAwayFlag', InMode),
(long, 'refCon', InMode), (long, 'refCon', InMode),
(Handle, 'items', InMode), (Handle, 'items', InMode),
) )
functions.append(f) functions.append(f)
f = Function(void, 'ResetAlrtStage', f = Function(short, 'GetAlertStage',
) )
functions.append(f) functions.append(f)
f = Method(void, 'DlgCut', f = Function(void, 'ResetAlertStage',
(DialogPtr, 'theDialog', InMode), )
functions.append(f)
f = Method(void, 'DialogCut',
(DialogRef, 'theDialog', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'DlgPaste', f = Method(void, 'DialogPaste',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'DlgCopy', f = Method(void, 'DialogCopy',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'DlgDelete', f = Method(void, 'DialogDelete',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
) )
methods.append(f) methods.append(f)
f = Function(void, 'SetDAFont', f = Function(void, 'SetDialogFont',
(short, 'fontNum', InMode), (short, 'value', InMode),
) )
functions.append(f) functions.append(f)
f = Method(void, 'AppendDITL', f = Method(void, 'AppendDITL',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(Handle, 'theHandle', InMode), (Handle, 'theHandle', InMode),
(DITLMethod, 'method', InMode), (DITLMethod, 'method', InMode),
) )
methods.append(f) methods.append(f)
f = Method(short, 'CountDITL', f = Method(short, 'CountDITL',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
) )
methods.append(f) methods.append(f)
f = Method(void, 'ShortenDITL', f = Method(void, 'ShortenDITL',
(DialogPtr, 'theDialog', InMode), (DialogRef, 'theDialog', InMode),
(short, 'numberItems', InMode), (short, 'numberItems', InMode),
) )
methods.append(f) 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)

View file

@ -1,5 +1,8 @@
# Scan an Apple header file, generating a Python file of generator calls. # Scan an Apple header file, generating a Python file of generator calls.
import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner from scantools import Scanner
LONG = "Dialogs" LONG = "Dialogs"
@ -24,7 +27,7 @@ class MyScanner(Scanner):
listname = "functions" listname = "functions"
if arglist: if arglist:
t, n, m = arglist[0] t, n, m = arglist[0]
if t == "DialogPtr" and m == "InMode": if t in ("DialogPtr", "DialogRef") and m == "InMode":
classname = "Method" classname = "Method"
listname = "methods" listname = "methods"
return classname, listname return classname, listname
@ -42,6 +45,7 @@ class MyScanner(Scanner):
'FreeAlert', 'FreeAlert',
'CouldDialog', 'CouldDialog',
'FreeDialog', 'FreeDialog',
'GetStdFilterProc',
] ]
def makeblacklisttypes(self): def makeblacklisttypes(self):
@ -66,6 +70,8 @@ class MyScanner(Scanner):
([("DialogPtr", "*", "OutMode")], ([("DialogPtr", "*", "OutMode")],
[("ExistingDialogPtr", "*", "*")]), [("ExistingDialogPtr", "*", "*")]),
([("DialogRef", "*", "OutMode")],
[("ExistingDialogPtr", "*", "*")]),
] ]
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -3,14 +3,19 @@
# It execs the file dlggen.py which contain the function definitions # It execs the file dlggen.py which contain the function definitions
# (dlggen.py was generated by dlgscan.py, scanning the <Dialogs.h> header file). # (dlggen.py was generated by dlgscan.py, scanning the <Dialogs.h> header file).
import addpack
addpack.addpack(':Tools:bgen:bgen')
from macsupport import * from macsupport import *
# Create the type objects # Create the type objects
DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj") DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj")
DialogRef = DialogPtr
ModalFilterProcPtr = InputOnlyType("PyObject*", "O") ModalFilterProcPtr = InputOnlyType("PyObject*", "O")
ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterProc(%s))" % name ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterProc(%s))" % name
ModalFilterUPP = ModalFilterProcPtr
RgnHandle = FakeType("_self->ob_itself->visRgn") # XXX RgnHandle = FakeType("_self->ob_itself->visRgn") # XXX

View file

@ -68,9 +68,9 @@ class FixedInputOutputBufferType(InputOnlyType):
self.size) self.size)
Output("goto %s__error__;", name) Output("goto %s__error__;", name)
OutRbrace() OutRbrace()
self.transferSize() self.transferSize(name)
def transferSize(): def transferSize(self, name):
Output("%s__len__ = %s__in_len__;", name, name) Output("%s__len__ = %s__in_len__;", name, name)
def passOutput(self, name): def passOutput(self, name):
@ -174,7 +174,7 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
def getargsArgs(self, name): def getargsArgs(self, name):
return "(char **)&%s__in__, &%s__in_len__" % (name, name) return "(char **)&%s__in__, &%s__in_len__" % (name, name)
def transferSize(self): def transferSize(self, name):
pass pass
def passInput(self, name): def passInput(self, name):

View file

@ -32,11 +32,15 @@ ResType = OSTypeType("ResType")
# Handles (always resources in our case) # Handles (always resources in our case)
Handle = OpaqueByValueType("Handle", "ResObj") Handle = OpaqueByValueType("Handle", "ResObj")
MenuHandle = OpaqueByValueType("MenuHandle", "MenuObj") MenuHandle = OpaqueByValueType("MenuHandle", "MenuObj")
MenuRef = MenuHandle
ControlHandle = OpaqueByValueType("ControlHandle", "CtlObj") ControlHandle = OpaqueByValueType("ControlHandle", "CtlObj")
ControlRef = ControlHandle
# Windows and Dialogs # Windows and Dialogs
WindowPtr = OpaqueByValueType("WindowPtr", "WinObj") WindowPtr = OpaqueByValueType("WindowPtr", "WinObj")
WindowRef = WindowPtr
DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj") DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj")
DialogRef = DialogPtr
ExistingWindowPtr = OpaqueByValueType("WindowPtr", "WinObj_WhichWindow", "BUG") ExistingWindowPtr = OpaqueByValueType("WindowPtr", "WinObj_WhichWindow", "BUG")
ExistingDialogPtr = OpaqueByValueType("DialogPtr", "WinObj_WhichWindow", "BUG") ExistingDialogPtr = OpaqueByValueType("DialogPtr", "WinObj_WhichWindow", "BUG")
@ -137,8 +141,8 @@ class MacModule(Module):
_SetOutputFileName = SetOutputFileName # Save original _SetOutputFileName = SetOutputFileName # Save original
def SetOutputFileName(file = None): 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) _SetOutputFileName(file)
if file: if file:
import MacOS import MacOS
MacOS.SetCreatorAndType(file, 'KAHL', 'TEXT') MacOS.SetCreatorAndType(file, 'MPCC', 'TEXT')

View file

@ -27,8 +27,10 @@ except ImportError:
MacOS = None MacOS = None
# Default preferences # Default preferences
CREATOR = 'KAHL' # My favorite text editor on the Mac #CREATOR = 'KAHL' # Guido's favorite text editor on the Mac
INCLUDEDIR = "D:Development:THINK C:Mac #includes:Apple #includes:" #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" Error = "scantools.Error"
@ -203,9 +205,9 @@ class Scanner:
self.includepath = [':', INCLUDEDIR] self.includepath = [':', INCLUDEDIR]
def initpatterns(self): def initpatterns(self):
self.head_pat = "^pascal[ \t]+" # XXX Mac specific! self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
self.tail_pat = "[;={}]" 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.name_pat = "\(<name>[a-zA-Z0-9_]+\)[ \t\n]*"
self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))" self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))"
self.whole_pat = self.type_pat + self.name_pat + self.args_pat self.whole_pat = self.type_pat + self.name_pat + self.args_pat