Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.

Macmodule and macosmodule have also been carbonified. Some functionality is still missing there.
This commit is contained in:
Jack Jansen 2000-06-02 21:35:07 +00:00
parent 33d1ad28cb
commit e79dc76f53
35 changed files with 667 additions and 129 deletions

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AEDataModel.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AEDataModel.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
typeBoolean = FOUR_CHAR_CODE('bool') typeBoolean = FOUR_CHAR_CODE('bool')

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AEObjects.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AEObjects.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
kAEAND = FOUR_CHAR_CODE('AND ') kAEAND = FOUR_CHAR_CODE('AND ')

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AERegistry.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AERegistry.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
from AEDataModel import * from AEDataModel import *

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AppleEvents.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:AppleEvents.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
from AEDataModel import * from AEDataModel import *

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Controls.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Controls.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
from TextEdit import * from TextEdit import *

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Dialogs.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Dialogs.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
gestaltDialogMgrAttr = FOUR_CHAR_CODE('dlog') gestaltDialogMgrAttr = FOUR_CHAR_CODE('dlog')

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Menus.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Menus.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
gestaltMenuMgrAttr = FOUR_CHAR_CODE('menu') gestaltMenuMgrAttr = FOUR_CHAR_CODE('menu')

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDraw.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDraw.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
@ -141,7 +141,7 @@ kUYVY422PixelFormat = FOUR_CHAR_CODE('UYVY')
kYUV211PixelFormat = FOUR_CHAR_CODE('Y211') kYUV211PixelFormat = FOUR_CHAR_CODE('Y211')
kCursorImageMajorVersion = 0x0001 kCursorImageMajorVersion = 0x0001
kCursorImageMinorVersion = 0x0000 kCursorImageMinorVersion = 0x0000
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDrawText.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDrawText.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Resources.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Resources.h'
resSysHeap = 64 resSysHeap = 64
resPurgeable = 32 resPurgeable = 32

View file

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:MacWindows.h' # Generated from 'Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:MacWindows.h'
def FOUR_CHAR_CODE(x): return x def FOUR_CHAR_CODE(x): return x
kAlertWindowClass = 1L kAlertWindowClass = 1L

View file

@ -323,6 +323,8 @@ navrr_getattr(self, name)
navrrobject *self; navrrobject *self;
char *name; char *name;
{ {
FSSpec fss;
if( strcmp(name, "__members__") == 0 ) if( strcmp(name, "__members__") == 0 )
return Py_BuildValue("sssssss", "version", "validRecord", "replacing", return Py_BuildValue("sssssss", "version", "validRecord", "replacing",
"isStationery", "translationNeeded", "selection", "fileTranslation"); "isStationery", "translationNeeded", "selection", "fileTranslation");
@ -355,7 +357,16 @@ navrr_getattr(self, name)
PyErr_Mac(ErrorObject, err); PyErr_Mac(ErrorObject, err);
return NULL; return NULL;
} }
rvitem = PyMac_BuildFSSpec((FSSpec *)*desc.dataHandle); #ifdef TARGET_API_MAC_CARBON
if (err=AEGetDescData(&desc, &fss, sizeof(FSSpec))) {
Py_DECREF(rv);
PyErr_Mac(ErrorObject, err);
return NULL;
}
#else
memcpy((void *)&fss, (void *)*desc.dataHandle, sizeof(FSSpec));
#endif
rvitem = PyMac_BuildFSSpec(&fss);
PyList_SetItem(rv, i, rvitem); PyList_SetItem(rv, i, rvitem);
AEDisposeDesc(&desc); AEDisposeDesc(&desc);
} }

View file

@ -795,6 +795,7 @@ static PyObject *AEDesc_getattr(self, name)
return PyMac_BuildOSType(self->ob_itself.descriptorType); return PyMac_BuildOSType(self->ob_itself.descriptorType);
if (strcmp(name, "data") == 0) { if (strcmp(name, "data") == 0) {
PyObject *res; PyObject *res;
#ifndef TARGET_API_MAC_CARBON
char state; char state;
state = HGetState(self->ob_itself.dataHandle); state = HGetState(self->ob_itself.dataHandle);
HLock(self->ob_itself.dataHandle); HLock(self->ob_itself.dataHandle);
@ -803,6 +804,19 @@ static PyObject *AEDesc_getattr(self, name)
GetHandleSize(self->ob_itself.dataHandle)); GetHandleSize(self->ob_itself.dataHandle));
HUnlock(self->ob_itself.dataHandle); HUnlock(self->ob_itself.dataHandle);
HSetState(self->ob_itself.dataHandle, state); HSetState(self->ob_itself.dataHandle, state);
#else
Size size;
char *ptr;
OSErr err;
size = AEGetDescDataSize(&self->ob_itself);
if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
return NULL;
if ( (ptr = PyString_AsString(res)) == NULL )
return NULL;
if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
return PyMac_Error(err);
#endif
return res; return res;
} }
if (strcmp(name, "__members__") == 0) if (strcmp(name, "__members__") == 0)
@ -1145,7 +1159,7 @@ static PyMethodDef AE_methods[] = {
static pascal OSErr static pascal OSErr
GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon) GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long refcon)
{ {
PyObject *handler = (PyObject *)refcon; PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject; AEDescObject *requestObject, *replyObject;

View file

@ -126,7 +126,7 @@ AEIdleUPP upp_AEIdleProc;
finalstuff = finalstuff + """ finalstuff = finalstuff + """
static pascal OSErr static pascal OSErr
GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon) GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long refcon)
{ {
PyObject *handler = (PyObject *)refcon; PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject; AEDescObject *requestObject, *replyObject;
@ -178,6 +178,7 @@ if (strcmp(name, "type") == 0)
return PyMac_BuildOSType(self->ob_itself.descriptorType); return PyMac_BuildOSType(self->ob_itself.descriptorType);
if (strcmp(name, "data") == 0) { if (strcmp(name, "data") == 0) {
PyObject *res; PyObject *res;
#ifndef TARGET_API_MAC_CARBON
char state; char state;
state = HGetState(self->ob_itself.dataHandle); state = HGetState(self->ob_itself.dataHandle);
HLock(self->ob_itself.dataHandle); HLock(self->ob_itself.dataHandle);
@ -186,6 +187,19 @@ if (strcmp(name, "data") == 0) {
GetHandleSize(self->ob_itself.dataHandle)); GetHandleSize(self->ob_itself.dataHandle));
HUnlock(self->ob_itself.dataHandle); HUnlock(self->ob_itself.dataHandle);
HSetState(self->ob_itself.dataHandle, state); HSetState(self->ob_itself.dataHandle, state);
#else
Size size;
char *ptr;
OSErr err;
size = AEGetDescDataSize(&self->ob_itself);
if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
return NULL;
if ( (ptr = PyString_AsString(res)) == NULL )
return NULL;
if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
return PyMac_Error(err);
#endif
return res; return res;
} }
if (strcmp(name, "__members__") == 0) if (strcmp(name, "__members__") == 0)

View file

@ -46,8 +46,11 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
#define as_Control(h) ((ControlHandle)h) #define as_Control(h) ((ControlHandle)h)
#define as_Resource(ctl) ((Handle)ctl) #define as_Resource(ctl) ((Handle)ctl)
#ifdef TARGET_API_MAC_CARBON
#define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
#else
#define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect)) #define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect))
#endif
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */ extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
@ -85,10 +88,12 @@ ControlFontStyle_Convert(v, itself)
/* TrackControl and HandleControlClick callback support */ /* TrackControl and HandleControlClick callback support */
static PyObject *tracker; static PyObject *tracker;
static ControlActionUPP mytracker_upp; static ControlActionUPP mytracker_upp;
#ifndef TARGET_API_MAC_CARBON_NOTYET
static ControlUserPaneDrawUPP mydrawproc_upp; static ControlUserPaneDrawUPP mydrawproc_upp;
static ControlUserPaneIdleUPP myidleproc_upp; static ControlUserPaneIdleUPP myidleproc_upp;
static ControlUserPaneHitTestUPP myhittestproc_upp; static ControlUserPaneHitTestUPP myhittestproc_upp;
static ControlUserPaneTrackingUPP mytrackingproc_upp; static ControlUserPaneTrackingUPP mytrackingproc_upp;
#endif
extern int settrackfunc(PyObject *); /* forward */ extern int settrackfunc(PyObject *); /* forward */
extern void clrtrackfunc(void); /* forward */ extern void clrtrackfunc(void); /* forward */
@ -730,18 +735,19 @@ static PyObject *CtlObj_RemoveControlProperty(_self, _args)
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
OSStatus _rv; OSStatus _err;
OSType propertyCreator; OSType propertyCreator;
OSType propertyTag; OSType propertyTag;
if (!PyArg_ParseTuple(_args, "O&O&", if (!PyArg_ParseTuple(_args, "O&O&",
PyMac_GetOSType, &propertyCreator, PyMac_GetOSType, &propertyCreator,
PyMac_GetOSType, &propertyTag)) PyMac_GetOSType, &propertyTag))
return NULL; return NULL;
_rv = RemoveControlProperty(_self->ob_itself, _err = RemoveControlProperty(_self->ob_itself,
propertyCreator, propertyCreator,
propertyTag); propertyTag);
_res = Py_BuildValue("l", if (_err != noErr) return PyMac_Error(_err);
_rv); Py_INCREF(Py_None);
_res = Py_None;
return _res; return _res;
} }
@ -750,18 +756,19 @@ static PyObject *CtlObj_GetControlRegion(_self, _args)
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
OSStatus _rv; OSStatus _err;
ControlPartCode inPart; ControlPartCode inPart;
RgnHandle outRegion; RgnHandle outRegion;
if (!PyArg_ParseTuple(_args, "hO&", if (!PyArg_ParseTuple(_args, "hO&",
&inPart, &inPart,
ResObj_Convert, &outRegion)) ResObj_Convert, &outRegion))
return NULL; return NULL;
_rv = GetControlRegion(_self->ob_itself, _err = GetControlRegion(_self->ob_itself,
inPart, inPart,
outRegion); outRegion);
_res = Py_BuildValue("l", if (_err != noErr) return PyMac_Error(_err);
_rv); Py_INCREF(Py_None);
_res = Py_None;
return _res; return _res;
} }
@ -809,6 +816,8 @@ static PyObject *CtlObj_GetControlReference(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *CtlObj_GetAuxiliaryControlRecord(_self, _args) static PyObject *CtlObj_GetAuxiliaryControlRecord(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
@ -825,6 +834,9 @@ static PyObject *CtlObj_GetAuxiliaryControlRecord(_self, _args)
ResObj_New, acHndl); ResObj_New, acHndl);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *CtlObj_SetControlColor(_self, _args) static PyObject *CtlObj_SetControlColor(_self, _args)
ControlObject *_self; ControlObject *_self;
@ -841,6 +853,151 @@ static PyObject *CtlObj_SetControlColor(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *CtlObj_GetBevelButtonMenuValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
SInt16 outValue;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = GetBevelButtonMenuValue(_self->ob_itself,
&outValue);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("h",
outValue);
return _res;
}
static PyObject *CtlObj_SetBevelButtonMenuValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
SInt16 inValue;
if (!PyArg_ParseTuple(_args, "h",
&inValue))
return NULL;
_err = SetBevelButtonMenuValue(_self->ob_itself,
inValue);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetBevelButtonMenuHandle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
MenuHandle outHandle;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = GetBevelButtonMenuHandle(_self->ob_itself,
&outHandle);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
MenuObj_New, outHandle);
return _res;
}
static PyObject *CtlObj_SetBevelButtonTransform(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
IconTransformType transform;
if (!PyArg_ParseTuple(_args, "h",
&transform))
return NULL;
_err = SetBevelButtonTransform(_self->ob_itself,
transform);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_SetImageWellTransform(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
IconTransformType inTransform;
if (!PyArg_ParseTuple(_args, "h",
&inTransform))
return NULL;
_err = SetImageWellTransform(_self->ob_itself,
inTransform);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_GetTabContentRect(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
Rect outContentRect;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = GetTabContentRect(_self->ob_itself,
&outContentRect);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
PyMac_BuildRect, &outContentRect);
return _res;
}
static PyObject *CtlObj_SetTabEnabled(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
SInt16 inTabToHilite;
Boolean inEnabled;
if (!PyArg_ParseTuple(_args, "hb",
&inTabToHilite,
&inEnabled))
return NULL;
_err = SetTabEnabled(_self->ob_itself,
inTabToHilite,
inEnabled);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_SetDisclosureTriangleLastValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
SInt16 inValue;
if (!PyArg_ParseTuple(_args, "h",
&inValue))
return NULL;
_err = SetDisclosureTriangleLastValue(_self->ob_itself,
inValue);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CtlObj_SendControlMessage(_self, _args) static PyObject *CtlObj_SendControlMessage(_self, _args)
ControlObject *_self; ControlObject *_self;
@ -1276,6 +1433,8 @@ static PyObject *CtlObj_GetControlDataHandle(_self, _args)
} }
#ifndef TARGET_API_MAC_CARBON_NOTYET
static PyObject *CtlObj_SetControlDataCallback(_self, _args) static PyObject *CtlObj_SetControlDataCallback(_self, _args)
ControlObject *_self; ControlObject *_self;
PyObject *_args; PyObject *_args;
@ -1308,6 +1467,9 @@ static PyObject *CtlObj_SetControlDataCallback(_self, _args)
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON_NOTYET
static PyObject *CtlObj_GetPopupData(_self, _args) static PyObject *CtlObj_GetPopupData(_self, _args)
ControlObject *_self; ControlObject *_self;
@ -1328,6 +1490,9 @@ static PyObject *CtlObj_GetPopupData(_self, _args)
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON_NOTYET
static PyObject *CtlObj_SetPopupData(_self, _args) static PyObject *CtlObj_SetPopupData(_self, _args)
ControlObject *_self; ControlObject *_self;
@ -1352,6 +1517,7 @@ static PyObject *CtlObj_SetPopupData(_self, _args)
return Py_None; return Py_None;
} }
#endif
static PyMethodDef CtlObj_methods[] = { static PyMethodDef CtlObj_methods[] = {
{"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1, {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1,
@ -1427,19 +1593,41 @@ static PyMethodDef CtlObj_methods[] = {
{"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1, {"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1,
"() -> (Boolean _rv)"}, "() -> (Boolean _rv)"},
{"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1, {"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1,
"(OSType propertyCreator, OSType propertyTag) -> (OSStatus _rv)"}, "(OSType propertyCreator, OSType propertyTag) -> None"},
{"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1, {"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1,
"(ControlPartCode inPart, RgnHandle outRegion) -> (OSStatus _rv)"}, "(ControlPartCode inPart, RgnHandle outRegion) -> None"},
{"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1, {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
"() -> (ControlVariant _rv)"}, "() -> (ControlVariant _rv)"},
{"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1, {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
"(SInt32 data) -> None"}, "(SInt32 data) -> None"},
{"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1, {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
"() -> (SInt32 _rv)"}, "() -> (SInt32 _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"GetAuxiliaryControlRecord", (PyCFunction)CtlObj_GetAuxiliaryControlRecord, 1, {"GetAuxiliaryControlRecord", (PyCFunction)CtlObj_GetAuxiliaryControlRecord, 1,
"() -> (Boolean _rv, AuxCtlHandle acHndl)"}, "() -> (Boolean _rv, AuxCtlHandle acHndl)"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"SetControlColor", (PyCFunction)CtlObj_SetControlColor, 1, {"SetControlColor", (PyCFunction)CtlObj_SetControlColor, 1,
"(CCTabHandle newColorTable) -> None"}, "(CCTabHandle newColorTable) -> None"},
#endif
{"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1,
"() -> (SInt16 outValue)"},
{"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1,
"(SInt16 inValue) -> None"},
{"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1,
"() -> (MenuHandle outHandle)"},
{"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1,
"(IconTransformType transform) -> None"},
{"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1,
"(IconTransformType inTransform) -> None"},
{"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1,
"() -> (Rect outContentRect)"},
{"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1,
"(SInt16 inTabToHilite, Boolean inEnabled) -> None"},
{"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1,
"(SInt16 inValue) -> None"},
{"SendControlMessage", (PyCFunction)CtlObj_SendControlMessage, 1, {"SendControlMessage", (PyCFunction)CtlObj_SendControlMessage, 1,
"(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"}, "(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"},
{"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1, {"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1,
@ -1476,12 +1664,21 @@ static PyMethodDef CtlObj_methods[] = {
"(ResObj) -> None"}, "(ResObj) -> None"},
{"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1, {"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1,
"(part, type) -> ResObj"}, "(part, type) -> ResObj"},
#ifndef TARGET_API_MAC_CARBON_NOTYET
{"SetControlDataCallback", (PyCFunction)CtlObj_SetControlDataCallback, 1, {"SetControlDataCallback", (PyCFunction)CtlObj_SetControlDataCallback, 1,
"(callbackfunc) -> None"}, "(callbackfunc) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON_NOTYET
{"GetPopupData", (PyCFunction)CtlObj_GetPopupData, 1, {"GetPopupData", (PyCFunction)CtlObj_GetPopupData, 1,
NULL}, NULL},
#endif
#ifndef TARGET_API_MAC_CARBON_NOTYET
{"SetPopupData", (PyCFunction)CtlObj_SetPopupData, 1, {"SetPopupData", (PyCFunction)CtlObj_SetPopupData, 1,
NULL}, NULL},
#endif
{NULL, NULL, 0} {NULL, NULL, 0}
}; };
@ -1954,9 +2151,7 @@ clrtrackfunc()
} }
static pascal void static pascal void
mytracker(ctl, part) mytracker(ControlHandle ctl, short part)
ControlHandle ctl;
short part;
{ {
PyObject *args, *rv=0; PyObject *args, *rv=0;
@ -1971,6 +2166,7 @@ mytracker(ctl, part)
PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\n"); PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\n");
} }
#ifndef TARGET_API_MAC_CARBON_NOTYET
static int static int
setcallback(self, which, callback, uppp) setcallback(self, which, callback, uppp)
ControlObject *self; ControlObject *self;
@ -2086,7 +2282,7 @@ mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc
Py_XDECREF(rv); Py_XDECREF(rv);
return (ControlPartCode)c_rv; return (ControlPartCode)c_rv;
} }
#endif
void initCtl() void initCtl()
@ -2097,10 +2293,12 @@ void initCtl()
mytracker_upp = NewControlActionProc(mytracker); mytracker_upp = NewControlActionProc(mytracker);
#ifndef TARGET_API_MAC_CARBON_NOTYET
mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc); mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc);
myidleproc_upp = NewControlUserPaneIdleProc(myidleproc); myidleproc_upp = NewControlUserPaneIdleProc(myidleproc);
myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc); myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc);
mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc); mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc);
#endif
m = Py_InitModule("Ctl", Ctl_methods); m = Py_InitModule("Ctl", Ctl_methods);

View file

@ -48,17 +48,17 @@ class MyScanner(Scanner):
'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition 'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition
'kControlProgressBarIndeterminateTag', # ditto 'kControlProgressBarIndeterminateTag', # ditto
# The following are unavailable for static 68k (appearance manager) # The following are unavailable for static 68k (appearance manager)
'GetBevelButtonMenuValue', ## 'GetBevelButtonMenuValue',
'SetBevelButtonMenuValue', ## 'SetBevelButtonMenuValue',
'GetBevelButtonMenuHandle', ## 'GetBevelButtonMenuHandle',
'SetBevelButtonTransform', ## 'SetBevelButtonTransform',
'SetBevelButtonGraphicAlignment', 'SetBevelButtonGraphicAlignment',
'SetBevelButtonTextAlignment', 'SetBevelButtonTextAlignment',
'SetBevelButtonTextPlacement', 'SetBevelButtonTextPlacement',
'SetImageWellTransform', ## 'SetImageWellTransform',
'GetTabContentRect', ## 'GetTabContentRect',
'SetTabEnabled', ## 'SetTabEnabled',
'SetDisclosureTriangleLastValue', ## 'SetDisclosureTriangleLastValue',
## # Unavailable in CW Pro 3 libraries ## # Unavailable in CW Pro 3 libraries
## 'SetUpControlTextColor', ## 'SetUpControlTextColor',
## # Unavailable in Jack's CW Pro 5.1 libraries ## # Unavailable in Jack's CW Pro 5.1 libraries
@ -79,6 +79,13 @@ class MyScanner(Scanner):
'GetControlPropertySize', 'GetControlPropertySize',
] ]
def makegreylist(self):
return [
('#ifndef TARGET_API_MAC_CARBON', [
'GetAuxiliaryControlRecord',
'SetControlColor',
])]
def makeblacklisttypes(self): def makeblacklisttypes(self):
return [ return [
'ProcPtr', 'ProcPtr',

View file

@ -46,8 +46,11 @@ includestuff = includestuff + """
#define as_Control(h) ((ControlHandle)h) #define as_Control(h) ((ControlHandle)h)
#define as_Resource(ctl) ((Handle)ctl) #define as_Resource(ctl) ((Handle)ctl)
#ifdef TARGET_API_MAC_CARBON
#define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
#else
#define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect)) #define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect))
#endif
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */ extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
@ -85,10 +88,12 @@ ControlFontStyle_Convert(v, itself)
/* TrackControl and HandleControlClick callback support */ /* TrackControl and HandleControlClick callback support */
static PyObject *tracker; static PyObject *tracker;
static ControlActionUPP mytracker_upp; static ControlActionUPP mytracker_upp;
#ifndef TARGET_API_MAC_CARBON_NOTYET
static ControlUserPaneDrawUPP mydrawproc_upp; static ControlUserPaneDrawUPP mydrawproc_upp;
static ControlUserPaneIdleUPP myidleproc_upp; static ControlUserPaneIdleUPP myidleproc_upp;
static ControlUserPaneHitTestUPP myhittestproc_upp; static ControlUserPaneHitTestUPP myhittestproc_upp;
static ControlUserPaneTrackingUPP mytrackingproc_upp; static ControlUserPaneTrackingUPP mytrackingproc_upp;
#endif
extern int settrackfunc(PyObject *); /* forward */ extern int settrackfunc(PyObject *); /* forward */
extern void clrtrackfunc(void); /* forward */ extern void clrtrackfunc(void); /* forward */
@ -147,9 +152,7 @@ clrtrackfunc()
} }
static pascal void static pascal void
mytracker(ctl, part) mytracker(ControlHandle ctl, short part)
ControlHandle ctl;
short part;
{ {
PyObject *args, *rv=0; PyObject *args, *rv=0;
@ -164,6 +167,7 @@ mytracker(ctl, part)
PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\\n"); PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\\n");
} }
#ifndef TARGET_API_MAC_CARBON_NOTYET
static int static int
setcallback(self, which, callback, uppp) setcallback(self, which, callback, uppp)
ControlObject *self; ControlObject *self;
@ -279,15 +283,17 @@ mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc
Py_XDECREF(rv); Py_XDECREF(rv);
return (ControlPartCode)c_rv; return (ControlPartCode)c_rv;
} }
#endif
""" """
initstuff = initstuff + """ initstuff = initstuff + """
mytracker_upp = NewControlActionProc(mytracker); mytracker_upp = NewControlActionProc(mytracker);
#ifndef TARGET_API_MAC_CARBON_NOTYET
mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc); mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc);
myidleproc_upp = NewControlUserPaneIdleProc(myidleproc); myidleproc_upp = NewControlUserPaneIdleProc(myidleproc);
myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc); myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc);
mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc); mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc);
#endif
""" """
class MyObjectDefinition(ObjectIdentityMixin, GlobalObjectDefinition): class MyObjectDefinition(ObjectIdentityMixin, GlobalObjectDefinition):
@ -564,7 +570,7 @@ _res = Py_None;
return _res; return _res;
""" """
f = ManualGenerator("SetControlDataCallback", setcontroldatacallback_body); f = ManualGenerator("SetControlDataCallback", setcontroldatacallback_body, condition="#ifndef TARGET_API_MAC_CARBON_NOTYET");
f.docstring = lambda: "(callbackfunc) -> None" f.docstring = lambda: "(callbackfunc) -> None"
object.add(f) object.add(f)
@ -582,7 +588,7 @@ _res = Py_BuildValue("O&i", MenuObj_New, (*hdl)->mHandle, (int)(*hdl)->mID);
HUnlock((Handle)hdl); HUnlock((Handle)hdl);
return _res; return _res;
""" """
f = ManualGenerator("GetPopupData", getpopupdata_body) f = ManualGenerator("GetPopupData", getpopupdata_body, condition="#ifndef TARGET_API_MAC_CARBON_NOTYET")
object.add(f) object.add(f)
setpopupdata_body = """ setpopupdata_body = """
@ -602,7 +608,7 @@ hdl = (PopupPrivateDataHandle)(*_self->ob_itself)->contrlData;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
""" """
f = ManualGenerator("SetPopupData", setpopupdata_body) f = ManualGenerator("SetPopupData", setpopupdata_body, condition="#ifndef TARGET_API_MAC_CARBON_NOTYET")
object.add(f) object.add(f)

View file

@ -154,7 +154,7 @@ PyObject *DlgObj_New(itself)
it = PyObject_NEW(DialogObject, &Dialog_Type); it = PyObject_NEW(DialogObject, &Dialog_Type);
if (it == NULL) return NULL; if (it == NULL) return NULL;
it->ob_itself = itself; it->ob_itself = itself;
SetWRefCon(itself, (long)it); SetWRefCon(GetDialogWindow(itself), (long)it);
return (PyObject *)it; return (PyObject *)it;
} }
DlgObj_Convert(v, p_itself) DlgObj_Convert(v, p_itself)
@ -692,12 +692,12 @@ static PyObject *DlgObj_GetDialogWindow(_self, _args)
PyObject *_args; PyObject *_args;
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
DialogPtr _rv; WindowPtr _rv;
if (!PyArg_ParseTuple(_args, "")) if (!PyArg_ParseTuple(_args, ""))
return NULL; return NULL;
_rv = GetDialogWindow(_self->ob_itself); _rv = GetDialogWindow(_self->ob_itself);
_res = Py_BuildValue("O&", _res = Py_BuildValue("O&",
WinObj_WhichWindow, _rv); WinObj_New, _rv);
return _res; return _res;
} }
@ -743,6 +743,8 @@ static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args) static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args)
DialogObject *_self; DialogObject *_self;
PyObject *_args; PyObject *_args;
@ -755,6 +757,7 @@ static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyMethodDef DlgObj_methods[] = { static PyMethodDef DlgObj_methods[] = {
{"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
@ -814,15 +817,18 @@ static PyMethodDef DlgObj_methods[] = {
{"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1, {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1,
"() -> (EventMask outMask)"}, "() -> (EventMask outMask)"},
{"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
"() -> (DialogPtr _rv)"}, "() -> (WindowPtr _rv)"},
{"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
"() -> (SInt16 _rv)"}, "() -> (SInt16 _rv)"},
{"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1, {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
"() -> (SInt16 _rv)"}, "() -> (SInt16 _rv)"},
{"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1, {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
"() -> (SInt16 _rv)"}, "() -> (SInt16 _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1, {"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1,
"() -> None"}, "() -> None"},
#endif
{NULL, NULL, 0} {NULL, NULL, 0}
}; };

View file

@ -55,6 +55,12 @@ class MyScanner(Scanner):
'GetDialogControlNotificationProc', 'GetDialogControlNotificationProc',
] ]
def makegreylist(self):
return [
('#ifndef TARGET_API_MAC_CARBON', [
'SetGrafPortOfDialog',
])]
def makeblacklisttypes(self): def makeblacklisttypes(self):
return [ return [
"AlertStdAlertParamPtr", # Too much work, for now "AlertStdAlertParamPtr", # Too much work, for now

View file

@ -129,7 +129,7 @@ class MyObjectDefinition(GlobalObjectDefinition):
self.basechain = "&WinObj_chain" self.basechain = "&WinObj_chain"
def outputInitStructMembers(self): def outputInitStructMembers(self):
GlobalObjectDefinition.outputInitStructMembers(self) GlobalObjectDefinition.outputInitStructMembers(self)
Output("SetWRefCon(itself, (long)it);") Output("SetWRefCon(GetDialogWindow(itself), (long)it);")
def outputCheckNewArg(self): def outputCheckNewArg(self):
Output("if (itself == NULL) return Py_None;") Output("if (itself == NULL) return Py_None;")
def outputCheckConvertArg(self): def outputCheckConvertArg(self):
@ -160,7 +160,7 @@ for f in methods: object.add(f)
# Some methods that are currently macro's in C, but will be real routines # Some methods that are currently macro's in C, but will be real routines
# in MacOS 8. # in MacOS 8.
f = Method(ExistingDialogPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode)) f = Method(WindowPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode))
object.add(f) object.add(f)
f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode)) f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode))
object.add(f) object.add(f)
@ -168,7 +168,8 @@ f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode))
object.add(f) object.add(f)
f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode)) f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode))
object.add(f) object.add(f)
f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode)) f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode),
condition='#ifndef TARGET_API_MAC_CARBON')
object.add(f) object.add(f)
setuseritembody = """ setuseritembody = """

View file

@ -115,7 +115,6 @@ extern void initTE();
extern void initColorPicker(); extern void initColorPicker();
extern void initPrinting(); extern void initPrinting();
extern void initDrag(); extern void initDrag();
extern void initNav();
#endif #endif
#ifdef USE_CORE_TOOLBOX #ifdef USE_CORE_TOOLBOX
extern void initCtl(); extern void initCtl();
@ -124,6 +123,7 @@ extern void initMenu();
extern void initQd(); extern void initQd();
extern void initRes(); extern void initRes();
extern void initWin(); extern void initWin();
extern void initNav();
#endif #endif
#ifdef USE_QT #ifdef USE_QT
extern void initCm(); extern void initCm();
@ -225,6 +225,7 @@ struct _inittab _PyImport_Inittab[] = {
{"Ctl", initCtl}, {"Ctl", initCtl},
{"Dlg", initDlg}, {"Dlg", initDlg},
{"Menu", initMenu}, {"Menu", initMenu},
{"Nav", initNav},
{"Qd", initQd}, {"Qd", initQd},
{"Win", initWin}, {"Win", initWin},
{"Res", initRes}, {"Res", initRes},
@ -234,7 +235,6 @@ struct _inittab _PyImport_Inittab[] = {
{"App", initApp}, {"App", initApp},
{"Evt", initEvt}, {"Evt", initEvt},
{"Fm", initFm}, {"Fm", initFm},
{"Help", initHelp},
{"Icn", initIcn}, {"Icn", initIcn},
{"List", initList}, {"List", initList},
{"Snd", initSnd}, {"Snd", initSnd},
@ -242,9 +242,11 @@ struct _inittab _PyImport_Inittab[] = {
{"Scrap", initScrap}, {"Scrap", initScrap},
{"TE", initTE}, {"TE", initTE},
{"ColorPicker", initColorPicker}, {"ColorPicker", initColorPicker},
#ifndef TARGET_API_MAC_CARBON
{"Help", initHelp},
{"Printing", initPrinting}, {"Printing", initPrinting},
#endif
{"Drag", initDrag}, {"Drag", initDrag},
{"Nav", initNav},
#endif #endif
#ifdef USE_QT #ifdef USE_QT
{"Cm", initCm}, {"Cm", initCm},
@ -302,4 +304,3 @@ struct _inittab _PyImport_Inittab[] = {
/* Sentinel */ /* Sentinel */
{0, 0} {0, 0}
}; };

View file

@ -713,6 +713,7 @@ mfs_ResolveAliasFile(self, args)
return Py_BuildValue("Oii", newmfssobject(&fss), (int)isfolder, (int)wasaliased); return Py_BuildValue("Oii", newmfssobject(&fss), (int)isfolder, (int)wasaliased);
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject * static PyObject *
mfs_StandardGetFile(self, args) mfs_StandardGetFile(self, args)
PyObject *self; /* Not used */ PyObject *self; /* Not used */
@ -803,6 +804,7 @@ mfs_SetFolder(self, args)
LMSetCurDirStore(spec.parID); LMSetCurDirStore(spec.parID);
return (PyObject *)newmfssobject(&ospec); return (PyObject *)newmfssobject(&ospec);
} }
#endif
static PyObject * static PyObject *
mfs_FSSpec(self, args) mfs_FSSpec(self, args)
@ -950,11 +952,13 @@ mfs_NewAliasMinimalFromFullPath(self, args)
static struct PyMethodDef mfs_methods[] = { static struct PyMethodDef mfs_methods[] = {
{"ResolveAliasFile", mfs_ResolveAliasFile, 1}, {"ResolveAliasFile", mfs_ResolveAliasFile, 1},
#ifndef TARGET_API_MAC_CARBON
{"StandardGetFile", mfs_StandardGetFile, 1}, {"StandardGetFile", mfs_StandardGetFile, 1},
{"PromptGetFile", mfs_PromptGetFile, 1}, {"PromptGetFile", mfs_PromptGetFile, 1},
{"StandardPutFile", mfs_StandardPutFile, 1}, {"StandardPutFile", mfs_StandardPutFile, 1},
{"GetDirectory", mfs_GetDirectory, 1}, {"GetDirectory", mfs_GetDirectory, 1},
{"SetFolder", mfs_SetFolder, 1}, {"SetFolder", mfs_SetFolder, 1},
#endif
{"FSSpec", mfs_FSSpec, 1}, {"FSSpec", mfs_FSSpec, 1},
{"RawFSSpec", mfs_RawFSSpec, 1}, {"RawFSSpec", mfs_RawFSSpec, 1},
{"RawAlias", mfs_RawAlias, 1}, {"RawAlias", mfs_RawAlias, 1},

View file

@ -42,7 +42,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#undef S_ISREG #undef S_ISREG
#endif /* THINK_C */ #endif /* THINK_C */
#ifndef TARGET_API_MAC_CARBON_NOTYET
/* XXXX Skip for Carbon, for now */
#include "macstat.h" #include "macstat.h"
#endif
#ifdef USE_GUSI #ifdef USE_GUSI
/* Remove defines from macstat.h */ /* Remove defines from macstat.h */
#undef S_IFMT #undef S_IFMT
@ -58,7 +62,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#else /* USE_GUSI */ #else /* USE_GUSI */
#ifndef TARGET_API_MAC_CARBON_NOTYET
#define stat macstat #define stat macstat
#endif
#endif /* USE_GUSI */ #endif /* USE_GUSI */
#ifdef USE_GUSI2 #ifdef USE_GUSI2
@ -70,6 +76,10 @@ int sync(void);
#else #else
#define mode_t int #define mode_t int
#include <fcntl.h> #include <fcntl.h>
#ifdef _POSIX
#include <unistd.h>
#include <stat.h>
#endif
#endif #endif
/* Optional routines, for some compiler/runtime combinations */ /* Optional routines, for some compiler/runtime combinations */
@ -264,6 +274,7 @@ mac_fdopen(self, args)
} }
#endif #endif
#ifndef TARGET_API_MAC_CARBON
static PyObject * static PyObject *
mac_getbootvol(self, args) mac_getbootvol(self, args)
PyObject *self; PyObject *self;
@ -279,6 +290,7 @@ mac_getbootvol(self, args)
return mac_error(); return mac_error();
return PyString_FromString(res); return PyString_FromString(res);
} }
#endif
static PyObject * static PyObject *
mac_getcwd(self, args) mac_getcwd(self, args)
@ -502,6 +514,7 @@ mac_fstat(self, args)
} }
#endif /* WEHAVE_FSTAT */ #endif /* WEHAVE_FSTAT */
#ifndef TARGET_API_MAC_CARBON_NOTYET
static PyObject * static PyObject *
mac_xstat(self, args) mac_xstat(self, args)
PyObject *self; PyObject *self;
@ -543,6 +556,7 @@ mac_xstat(self, args)
mst.st_creator, 4, mst.st_creator, 4,
mst.st_type, 4); mst.st_type, 4);
} }
#endif
static PyObject * static PyObject *
mac_sync(self, args) mac_sync(self, args)
@ -610,7 +624,9 @@ static struct PyMethodDef mac_methods[] = {
#ifdef WEHAVE_FSTAT #ifdef WEHAVE_FSTAT
{"fstat", mac_fstat}, {"fstat", mac_fstat},
#endif #endif
#ifndef TARGET_API_MAC_CARBON
{"getbootvol", mac_getbootvol}, /* non-standard */ {"getbootvol", mac_getbootvol}, /* non-standard */
#endif
{"getcwd", mac_getcwd}, {"getcwd", mac_getcwd},
{"listdir", mac_listdir, 0}, {"listdir", mac_listdir, 0},
{"lseek", mac_lseek}, {"lseek", mac_lseek},
@ -620,7 +636,9 @@ static struct PyMethodDef mac_methods[] = {
{"rename", mac_rename}, {"rename", mac_rename},
{"rmdir", mac_rmdir}, {"rmdir", mac_rmdir},
{"stat", mac_stat}, {"stat", mac_stat},
#ifndef TARGET_API_MAC_CARBON_NOTYET
{"xstat", mac_xstat}, {"xstat", mac_xstat},
#endif
{"sync", mac_sync}, {"sync", mac_sync},
{"remove", mac_unlink}, {"remove", mac_unlink},
{"unlink", mac_unlink}, {"unlink", mac_unlink},

View file

@ -31,6 +31,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <Files.h> #include <Files.h>
#include <LowMem.h> #include <LowMem.h>
#include <Sound.h> #include <Sound.h>
#include <Events.h>
static PyObject *MacOS_Error; /* Exception MacOS.Error */ static PyObject *MacOS_Error; /* Exception MacOS.Error */
@ -312,14 +313,14 @@ static char getcrtp_doc[] = "Obsolete, use macfs module";
static PyObject * static PyObject *
MacOS_GetCreatorAndType(PyObject *self, PyObject *args) MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
{ {
Str255 name; FSSpec fss;
FInfo info; FInfo info;
PyObject *creator, *type, *res; PyObject *creator, *type, *res;
OSErr err; OSErr err;
if (!PyArg_ParseTuple(args, "O&", PyMac_GetStr255, &name)) if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
return NULL; return NULL;
if ((err = GetFInfo(name, 0, &info)) != noErr) if ((err = FSpGetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err); return PyErr_Mac(MacOS_Error, err);
creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4); creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4);
type = PyString_FromStringAndSize((char *)&info.fdType, 4); type = PyString_FromStringAndSize((char *)&info.fdType, 4);
@ -334,19 +335,19 @@ static char setcrtp_doc[] = "Obsolete, use macfs module";
static PyObject * static PyObject *
MacOS_SetCreatorAndType(PyObject *self, PyObject *args) MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
{ {
Str255 name; FSSpec fss;
ResType creator, type; ResType creator, type;
FInfo info; FInfo info;
OSErr err; OSErr err;
if (!PyArg_ParseTuple(args, "O&O&O&", if (!PyArg_ParseTuple(args, "O&O&O&",
PyMac_GetStr255, &name, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
return NULL; return NULL;
if ((err = GetFInfo(name, 0, &info)) != noErr) if ((err = FSpGetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err); return PyErr_Mac(MacOS_Error, err);
info.fdCreator = creator; info.fdCreator = creator;
info.fdType = type; info.fdType = type;
if ((err = SetFInfo(name, 0, &info)) != noErr) if ((err = FSpSetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err); return PyErr_Mac(MacOS_Error, err);
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
@ -413,6 +414,7 @@ MacOS_SetHighLevelEventHandler(self, args)
#endif /* USE_STDWIN */ #endif /* USE_STDWIN */
#ifndef TARGET_API_MAC_CARBON
static char accepthle_doc[] = "Get arguments of pending high-level event"; static char accepthle_doc[] = "Get arguments of pending high-level event";
static PyObject * static PyObject *
@ -447,7 +449,7 @@ MacOS_AcceptHighLevelEvent(self, args)
free(buf); free(buf);
return res; return res;
} }
#endif
static char schedparams_doc[] = "Set/return mainloop interrupt check flag, etc"; static char schedparams_doc[] = "Set/return mainloop interrupt check flag, etc";
/* /*
@ -559,7 +561,9 @@ MacOS_splash(PyObject *self, PyObject *args)
DialogPtr olddialog; DialogPtr olddialog;
WindowRef theWindow; WindowRef theWindow;
CGrafPtr thePort; CGrafPtr thePort;
#if 0
short xpos, ypos, width, height, swidth, sheight; short xpos, ypos, width, height, swidth, sheight;
#endif
if (!PyArg_ParseTuple(args, "|i", &resid)) if (!PyArg_ParseTuple(args, "|i", &resid))
return NULL; return NULL;
@ -571,6 +575,7 @@ MacOS_splash(PyObject *self, PyObject *args)
if ( curdialog ) { if ( curdialog ) {
theWindow = GetDialogWindow(curdialog); theWindow = GetDialogWindow(curdialog);
thePort = GetWindowPort(theWindow); thePort = GetWindowPort(theWindow);
#if 0
width = thePort->portRect.right - thePort->portRect.left; width = thePort->portRect.right - thePort->portRect.left;
height = thePort->portRect.bottom - thePort->portRect.top; height = thePort->portRect.bottom - thePort->portRect.top;
swidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left; swidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left;
@ -579,6 +584,7 @@ MacOS_splash(PyObject *self, PyObject *args)
ypos = (sheight-height)/5 + LMGetMBarHeight(); ypos = (sheight-height)/5 + LMGetMBarHeight();
MoveWindow(theWindow, xpos, ypos, 0); MoveWindow(theWindow, xpos, ypos, 0);
ShowWindow(theWindow); ShowWindow(theWindow);
#endif
DrawDialog(curdialog); DrawDialog(curdialog);
} }
} }
@ -622,7 +628,7 @@ static char GetTicks_doc[] = "Return number of ticks since bootup";
static PyObject * static PyObject *
MacOS_GetTicks(PyObject *self, PyObject *args) MacOS_GetTicks(PyObject *self, PyObject *args)
{ {
return Py_BuildValue("i", (int)LMGetTicks()); return Py_BuildValue("i", (int)TickCount());
} }
static char openrf_doc[] = "Open resource fork of a file"; static char openrf_doc[] = "Open resource fork of a file";
@ -726,7 +732,9 @@ MacOS_CompactMem(PyObject *self, PyObject *args)
} }
static PyMethodDef MacOS_Methods[] = { static PyMethodDef MacOS_Methods[] = {
#ifndef TARGET_API_MAC_CARBON
{"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc}, {"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc},
#endif
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc}, {"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc}, {"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
#ifdef USE_STDWIN #ifdef USE_STDWIN

View file

@ -29,9 +29,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "Speech.h" #include "Speech.h"
#ifdef __MWERKS__ #ifdef __MWERKS__
#define OLDP2C 1
#include <TextUtils.h> #include <TextUtils.h>
#ifndef c2pstr
#define c2pstr C2PStr #define c2pstr C2PStr
#endif
#ifndef p2cstr
#define p2cstr P2CStr #define p2cstr P2CStr
#endif
#else #else
#include "pascal.h" #include "pascal.h"
#endif /* __MWERKS__ */ #endif /* __MWERKS__ */

View file

@ -118,6 +118,8 @@ static PyObject *MenuObj_CalcMenuSize(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *MenuObj_CountMItems(_self, _args) static PyObject *MenuObj_CountMItems(_self, _args)
MenuObject *_self; MenuObject *_self;
PyObject *_args; PyObject *_args;
@ -131,6 +133,7 @@ static PyObject *MenuObj_CountMItems(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
static PyObject *MenuObj_GetMenuFont(_self, _args) static PyObject *MenuObj_GetMenuFont(_self, _args)
MenuObject *_self; MenuObject *_self;
@ -410,6 +413,8 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *MenuObj_CheckItem(_self, _args) static PyObject *MenuObj_CheckItem(_self, _args)
MenuObject *_self; MenuObject *_self;
PyObject *_args; PyObject *_args;
@ -428,6 +433,7 @@ static PyObject *MenuObj_CheckItem(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *MenuObj_SetMenuItemText(_self, _args) static PyObject *MenuObj_SetMenuItemText(_self, _args)
MenuObject *_self; MenuObject *_self;
@ -614,6 +620,8 @@ static PyObject *MenuObj_GetItemStyle(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *MenuObj_DisableItem(_self, _args) static PyObject *MenuObj_DisableItem(_self, _args)
MenuObject *_self; MenuObject *_self;
PyObject *_args; PyObject *_args;
@ -629,6 +637,9 @@ static PyObject *MenuObj_DisableItem(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *MenuObj_EnableItem(_self, _args) static PyObject *MenuObj_EnableItem(_self, _args)
MenuObject *_self; MenuObject *_self;
@ -645,6 +656,7 @@ static PyObject *MenuObj_EnableItem(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *MenuObj_SetMenuItemCommandID(_self, _args) static PyObject *MenuObj_SetMenuItemCommandID(_self, _args)
MenuObject *_self; MenuObject *_self;
@ -939,6 +951,8 @@ static PyObject *MenuObj_GetMenuItemRefCon(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *MenuObj_SetMenuItemRefCon2(_self, _args) static PyObject *MenuObj_SetMenuItemRefCon2(_self, _args)
MenuObject *_self; MenuObject *_self;
PyObject *_args; PyObject *_args;
@ -959,6 +973,9 @@ static PyObject *MenuObj_SetMenuItemRefCon2(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *MenuObj_GetMenuItemRefCon2(_self, _args) static PyObject *MenuObj_GetMenuItemRefCon2(_self, _args)
MenuObject *_self; MenuObject *_self;
@ -979,6 +996,7 @@ static PyObject *MenuObj_GetMenuItemRefCon2(_self, _args)
outRefCon2); outRefCon2);
return _res; return _res;
} }
#endif
static PyObject *MenuObj_SetMenuItemKeyGlyph(_self, _args) static PyObject *MenuObj_SetMenuItemKeyGlyph(_self, _args)
MenuObject *_self; MenuObject *_self;
@ -1189,8 +1207,11 @@ static PyMethodDef MenuObj_methods[] = {
"() -> None"}, "() -> None"},
{"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
"() -> None"}, "() -> None"},
#ifndef TARGET_API_MAC_CARBON
{"CountMItems", (PyCFunction)MenuObj_CountMItems, 1, {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
#endif
{"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1, {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1,
"() -> (SInt16 outFontID, UInt16 outFontSize)"}, "() -> (SInt16 outFontID, UInt16 outFontSize)"},
{"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1, {"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1,
@ -1221,8 +1242,11 @@ static PyMethodDef MenuObj_methods[] = {
"(short top, short left, short popUpItem) -> (long _rv)"}, "(short top, short left, short popUpItem) -> (long _rv)"},
{"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1, {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1,
"(short beforeID) -> None"}, "(short beforeID) -> None"},
#ifndef TARGET_API_MAC_CARBON
{"CheckItem", (PyCFunction)MenuObj_CheckItem, 1, {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1,
"(short item, Boolean checked) -> None"}, "(short item, Boolean checked) -> None"},
#endif
{"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1, {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
"(short item, Str255 itemString) -> None"}, "(short item, Str255 itemString) -> None"},
{"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1, {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
@ -1243,10 +1267,16 @@ static PyMethodDef MenuObj_methods[] = {
"(short item, StyleParameter chStyle) -> None"}, "(short item, StyleParameter chStyle) -> None"},
{"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1, {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
"(short item) -> (Style chStyle)"}, "(short item) -> (Style chStyle)"},
#ifndef TARGET_API_MAC_CARBON
{"DisableItem", (PyCFunction)MenuObj_DisableItem, 1, {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1,
"(short item) -> None"}, "(short item) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"EnableItem", (PyCFunction)MenuObj_EnableItem, 1, {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1,
"(short item) -> None"}, "(short item) -> None"},
#endif
{"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1, {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
"(SInt16 inItem, UInt32 inCommandID) -> None"}, "(SInt16 inItem, UInt32 inCommandID) -> None"},
{"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1, {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
@ -1275,10 +1305,16 @@ static PyMethodDef MenuObj_methods[] = {
"(SInt16 inItem, UInt32 inRefCon) -> None"}, "(SInt16 inItem, UInt32 inRefCon) -> None"},
{"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1, {"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1,
"(SInt16 inItem) -> (UInt32 outRefCon)"}, "(SInt16 inItem) -> (UInt32 outRefCon)"},
#ifndef TARGET_API_MAC_CARBON
{"SetMenuItemRefCon2", (PyCFunction)MenuObj_SetMenuItemRefCon2, 1, {"SetMenuItemRefCon2", (PyCFunction)MenuObj_SetMenuItemRefCon2, 1,
"(SInt16 inItem, UInt32 inRefCon2) -> None"}, "(SInt16 inItem, UInt32 inRefCon2) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetMenuItemRefCon2", (PyCFunction)MenuObj_GetMenuItemRefCon2, 1, {"GetMenuItemRefCon2", (PyCFunction)MenuObj_GetMenuItemRefCon2, 1,
"(SInt16 inItem) -> (UInt32 outRefCon2)"}, "(SInt16 inItem) -> (UInt32 outRefCon2)"},
#endif
{"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1, {"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1,
"(SInt16 inItem, SInt16 inGlyph) -> None"}, "(SInt16 inItem, SInt16 inGlyph) -> None"},
{"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1, {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
@ -1345,6 +1381,8 @@ PyTypeObject Menu_Type = {
/* ---------------------- End object type Menu ---------------------- */ /* ---------------------- End object type Menu ---------------------- */
#ifndef TARGET_API_MAC_CARBON
static PyObject *Menu_InitProcMenu(_self, _args) static PyObject *Menu_InitProcMenu(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -1359,6 +1397,9 @@ static PyObject *Menu_InitProcMenu(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Menu_InitMenus(_self, _args) static PyObject *Menu_InitMenus(_self, _args)
PyObject *_self; PyObject *_self;
@ -1372,6 +1413,7 @@ static PyObject *Menu_InitMenus(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Menu_NewMenu(_self, _args) static PyObject *Menu_NewMenu(_self, _args)
PyObject *_self; PyObject *_self;
@ -1614,6 +1656,8 @@ static PyObject *Menu_ClearMenuBar(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Menu_SetMenuFlash(_self, _args) static PyObject *Menu_SetMenuFlash(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -1628,6 +1672,7 @@ static PyObject *Menu_SetMenuFlash(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Menu_FlashMenuBar(_self, _args) static PyObject *Menu_FlashMenuBar(_self, _args)
PyObject *_self; PyObject *_self;
@ -1644,6 +1689,8 @@ static PyObject *Menu_FlashMenuBar(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Menu_SystemEdit(_self, _args) static PyObject *Menu_SystemEdit(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -1659,6 +1706,9 @@ static PyObject *Menu_SystemEdit(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Menu_SystemMenu(_self, _args) static PyObject *Menu_SystemMenu(_self, _args)
PyObject *_self; PyObject *_self;
@ -1674,6 +1724,7 @@ static PyObject *Menu_SystemMenu(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Menu_IsMenuBarVisible(_self, _args) static PyObject *Menu_IsMenuBarVisible(_self, _args)
PyObject *_self; PyObject *_self;
@ -1764,6 +1815,8 @@ static PyObject *Menu_IsShowContextualMenuClick(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Menu_OpenDeskAcc(_self, _args) static PyObject *Menu_OpenDeskAcc(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -1778,6 +1831,7 @@ static PyObject *Menu_OpenDeskAcc(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Menu_as_Menu(_self, _args) static PyObject *Menu_as_Menu(_self, _args)
PyObject *_self; PyObject *_self;
@ -1840,10 +1894,16 @@ static PyObject *Menu_DrawMenuBar(_self, _args)
} }
static PyMethodDef Menu_methods[] = { static PyMethodDef Menu_methods[] = {
#ifndef TARGET_API_MAC_CARBON
{"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1, {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1,
"(short resID) -> None"}, "(short resID) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"InitMenus", (PyCFunction)Menu_InitMenus, 1, {"InitMenus", (PyCFunction)Menu_InitMenus, 1,
"() -> None"}, "() -> None"},
#endif
{"NewMenu", (PyCFunction)Menu_NewMenu, 1, {"NewMenu", (PyCFunction)Menu_NewMenu, 1,
"(short menuID, Str255 menuTitle) -> (MenuHandle _rv)"}, "(short menuID, Str255 menuTitle) -> (MenuHandle _rv)"},
{"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1, {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1,
@ -1876,14 +1936,23 @@ static PyMethodDef Menu_methods[] = {
"(short menuID) -> None"}, "(short menuID) -> None"},
{"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1, {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
"() -> None"}, "() -> None"},
#ifndef TARGET_API_MAC_CARBON
{"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1, {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1,
"(short count) -> None"}, "(short count) -> None"},
#endif
{"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1, {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
"(short menuID) -> None"}, "(short menuID) -> None"},
#ifndef TARGET_API_MAC_CARBON
{"SystemEdit", (PyCFunction)Menu_SystemEdit, 1, {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1,
"(short editCmd) -> (Boolean _rv)"}, "(short editCmd) -> (Boolean _rv)"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"SystemMenu", (PyCFunction)Menu_SystemMenu, 1, {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1,
"(long menuResult) -> None"}, "(long menuResult) -> None"},
#endif
{"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1, {"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1,
"() -> (Boolean _rv)"}, "() -> (Boolean _rv)"},
{"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1, {"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1,
@ -1896,8 +1965,11 @@ static PyMethodDef Menu_methods[] = {
"() -> None"}, "() -> None"},
{"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1, {"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1,
"(EventRecord inEvent) -> (Boolean _rv)"}, "(EventRecord inEvent) -> (Boolean _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1, {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1,
"(Str255 name) -> None"}, "(Str255 name) -> None"},
#endif
{"as_Menu", (PyCFunction)Menu_as_Menu, 1, {"as_Menu", (PyCFunction)Menu_as_Menu, 1,
"(Handle h) -> (MenuHandle _rv)"}, "(Handle h) -> (MenuHandle _rv)"},
{"GetMenu", (PyCFunction)Menu_GetMenu, 1, {"GetMenu", (PyCFunction)Menu_GetMenu, 1,

View file

@ -1,5 +1,6 @@
f = Function(void, 'OpenDeskAcc', f = Function(void, 'OpenDeskAcc',
(Str255, 'name', InMode), (Str255, 'name', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
functions.append(f) functions.append(f)

View file

@ -40,6 +40,23 @@ class MyScanner(Scanner):
"RemoveMenuItemProperty", "RemoveMenuItemProperty",
] ]
def makegreylist(self):
return [
('#ifndef TARGET_API_MAC_CARBON', [
'GetMenuItemRefCon2',
'SetMenuItemRefCon2',
'EnableItem',
'DisableItem',
'CheckItem',
'CountMItems',
'OpenDeskAcc',
'SystemEdit',
'SystemMenu',
'SetMenuFlash',
'InitMenus',
'InitProcMenu',
])]
def makeblacklisttypes(self): def makeblacklisttypes(self):
return [ return [
'MCTableHandle', 'MCTableHandle',

View file

@ -141,6 +141,7 @@ static PyObject *GrafObj_getattr(self, name)
GrafPortObject *self; GrafPortObject *self;
char *name; char *name;
{ {
#ifndef TARGET_API_MAC_CARBON
{ CGrafPtr itself_color = (CGrafPtr)self->ob_itself; { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
@ -218,6 +219,7 @@ static PyObject *GrafObj_getattr(self, name)
if ( strcmp(name, "_id") == 0 ) if ( strcmp(name, "_id") == 0 )
return Py_BuildValue("l", (long)self->ob_itself); return Py_BuildValue("l", (long)self->ob_itself);
} }
#endif
return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name); return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
} }
@ -424,6 +426,7 @@ static PyObject *QDGA_getattr(self, name)
QDGlobalsAccessObject *self; QDGlobalsAccessObject *self;
char *name; char *name;
{ {
#ifndef TARGET_API_MAC_CARBON
if ( strcmp(name, "arrow") == 0 ) if ( strcmp(name, "arrow") == 0 )
return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow)); return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
@ -444,6 +447,7 @@ static PyObject *QDGA_getattr(self, name)
if ( strcmp(name, "randSeed") == 0 ) if ( strcmp(name, "randSeed") == 0 )
return Py_BuildValue("l", &qd.randSeed); return Py_BuildValue("l", &qd.randSeed);
#endif
return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name); return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
} }

View file

@ -132,6 +132,7 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
Output("return 1;") Output("return 1;")
OutRbrace() OutRbrace()
def outputGetattrHook(self): def outputGetattrHook(self):
Output("#ifndef TARGET_API_MAC_CARBON")
Output(""" Output("""
{ CGrafPtr itself_color = (CGrafPtr)self->ob_itself; { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
@ -209,6 +210,7 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
if ( strcmp(name, "_id") == 0 ) if ( strcmp(name, "_id") == 0 )
return Py_BuildValue("l", (long)self->ob_itself); return Py_BuildValue("l", (long)self->ob_itself);
}""") }""")
Output("#endif")
class MyBMObjectDefinition(GlobalObjectDefinition): class MyBMObjectDefinition(GlobalObjectDefinition):
def outputCheckNewArg(self): def outputCheckNewArg(self):
@ -259,6 +261,7 @@ class QDGlobalsAccessObjectDefinition(ObjectDefinition):
pass pass
def outputGetattrHook(self): def outputGetattrHook(self):
Output("#ifndef TARGET_API_MAC_CARBON")
Output(""" Output("""
if ( strcmp(name, "arrow") == 0 ) if ( strcmp(name, "arrow") == 0 )
return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow)); return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
@ -279,6 +282,7 @@ class QDGlobalsAccessObjectDefinition(ObjectDefinition):
if ( strcmp(name, "randSeed") == 0 ) if ( strcmp(name, "randSeed") == 0 )
return Py_BuildValue("l", &qd.randSeed); return Py_BuildValue("l", &qd.randSeed);
""") """)
Output("#endif")
# Create the generator groups and link them # Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff) module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)

View file

@ -311,6 +311,8 @@ static PyObject *ResObj_GetMaxResourceSize(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *ResObj_RsrcMapEntry(_self, _args) static PyObject *ResObj_RsrcMapEntry(_self, _args)
ResourceObject *_self; ResourceObject *_self;
PyObject *_args; PyObject *_args;
@ -328,6 +330,7 @@ static PyObject *ResObj_RsrcMapEntry(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
static PyObject *ResObj_SetResAttrs(_self, _args) static PyObject *ResObj_SetResAttrs(_self, _args)
ResourceObject *_self; ResourceObject *_self;
@ -515,8 +518,11 @@ static PyMethodDef ResObj_methods[] = {
"() -> (long _rv)"}, "() -> (long _rv)"},
{"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1, {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1,
"() -> (long _rv)"}, "() -> (long _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"RsrcMapEntry", (PyCFunction)ResObj_RsrcMapEntry, 1, {"RsrcMapEntry", (PyCFunction)ResObj_RsrcMapEntry, 1,
"() -> (long _rv)"}, "() -> (long _rv)"},
#endif
{"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1, {"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1,
"(short attrs) -> None"}, "(short attrs) -> None"},
{"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1, {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1,
@ -622,6 +628,8 @@ PyTypeObject Resource_Type = {
/* -------------------- End object type Resource -------------------- */ /* -------------------- End object type Resource -------------------- */
#ifndef TARGET_API_MAC_CARBON
static PyObject *Res_InitResources(_self, _args) static PyObject *Res_InitResources(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -639,6 +647,9 @@ static PyObject *Res_InitResources(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Res_RsrcZoneInit(_self, _args) static PyObject *Res_RsrcZoneInit(_self, _args)
PyObject *_self; PyObject *_self;
@ -656,6 +667,7 @@ static PyObject *Res_RsrcZoneInit(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Res_CloseResFile(_self, _args) static PyObject *Res_CloseResFile(_self, _args)
PyObject *_self; PyObject *_self;
@ -712,6 +724,8 @@ static PyObject *Res_CurResFile(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Res_CreateResFile(_self, _args) static PyObject *Res_CreateResFile(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -730,6 +744,9 @@ static PyObject *Res_CreateResFile(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Res_OpenResFile(_self, _args) static PyObject *Res_OpenResFile(_self, _args)
PyObject *_self; PyObject *_self;
@ -750,6 +767,7 @@ static PyObject *Res_OpenResFile(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
static PyObject *Res_UseResFile(_self, _args) static PyObject *Res_UseResFile(_self, _args)
PyObject *_self; PyObject *_self;
@ -1191,6 +1209,8 @@ static PyObject *Res_OpenRFPerm(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Res_RGetResource(_self, _args) static PyObject *Res_RGetResource(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -1213,6 +1233,7 @@ static PyObject *Res_RGetResource(_self, _args)
ResObj_New, _rv); ResObj_New, _rv);
return _res; return _res;
} }
#endif
static PyObject *Res_HOpenResFile(_self, _args) static PyObject *Res_HOpenResFile(_self, _args)
PyObject *_self; PyObject *_self;
@ -1371,20 +1392,32 @@ static PyObject *Res_Handle(_self, _args)
} }
static PyMethodDef Res_methods[] = { static PyMethodDef Res_methods[] = {
#ifndef TARGET_API_MAC_CARBON
{"InitResources", (PyCFunction)Res_InitResources, 1, {"InitResources", (PyCFunction)Res_InitResources, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"RsrcZoneInit", (PyCFunction)Res_RsrcZoneInit, 1, {"RsrcZoneInit", (PyCFunction)Res_RsrcZoneInit, 1,
"() -> None"}, "() -> None"},
#endif
{"CloseResFile", (PyCFunction)Res_CloseResFile, 1, {"CloseResFile", (PyCFunction)Res_CloseResFile, 1,
"(short refNum) -> None"}, "(short refNum) -> None"},
{"ResError", (PyCFunction)Res_ResError, 1, {"ResError", (PyCFunction)Res_ResError, 1,
"() -> (OSErr _rv)"}, "() -> (OSErr _rv)"},
{"CurResFile", (PyCFunction)Res_CurResFile, 1, {"CurResFile", (PyCFunction)Res_CurResFile, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"CreateResFile", (PyCFunction)Res_CreateResFile, 1, {"CreateResFile", (PyCFunction)Res_CreateResFile, 1,
"(Str255 fileName) -> None"}, "(Str255 fileName) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"OpenResFile", (PyCFunction)Res_OpenResFile, 1, {"OpenResFile", (PyCFunction)Res_OpenResFile, 1,
"(Str255 fileName) -> (short _rv)"}, "(Str255 fileName) -> (short _rv)"},
#endif
{"UseResFile", (PyCFunction)Res_UseResFile, 1, {"UseResFile", (PyCFunction)Res_UseResFile, 1,
"(short refNum) -> None"}, "(short refNum) -> None"},
{"CountTypes", (PyCFunction)Res_CountTypes, 1, {"CountTypes", (PyCFunction)Res_CountTypes, 1,
@ -1427,8 +1460,11 @@ static PyMethodDef Res_methods[] = {
"(short refNum, short attrs) -> None"}, "(short refNum, short attrs) -> None"},
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1, {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
"(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)"}, "(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"RGetResource", (PyCFunction)Res_RGetResource, 1, {"RGetResource", (PyCFunction)Res_RGetResource, 1,
"(ResType theType, short theID) -> (Handle _rv)"}, "(ResType theType, short theID) -> (Handle _rv)"},
#endif
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1, {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
"(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)"}, "(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)"},
{"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1, {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1,

View file

@ -47,6 +47,17 @@ class ResourcesScanner(Scanner):
## "SizeResource", # GetResourceSizeOnDisk ## "SizeResource", # GetResourceSizeOnDisk
## "MaxSizeRsrc", # GetMaxResourceSize ## "MaxSizeRsrc", # GetMaxResourceSize
] ]
def makegreylist(self):
return [
('#ifndef TARGET_API_MAC_CARBON', [
'RGetResource',
'OpenResFile',
'CreateResFile',
'RsrcZoneInit',
'InitResources',
'RsrcMapEntry',
])]
def makerepairinstructions(self): def makerepairinstructions(self):
return [ return [

View file

@ -78,10 +78,12 @@ WinObj_Convert(v, p_itself)
PyObject *v; PyObject *v;
WindowPtr *p_itself; WindowPtr *p_itself;
{ {
#ifndef TARGET_API_MAC_CARBON
if (DlgObj_Check(v)) { if (DlgObj_Check(v)) {
*p_itself = ((WindowObject *)v)->ob_itself; *p_itself = ((WindowObject *)v)->ob_itself;
return 1; return 1;
} }
#endif
if (v == Py_None) { *p_itself = NULL; return 1; } if (v == Py_None) { *p_itself = NULL; return 1; }
if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
@ -102,19 +104,6 @@ static void WinObj_dealloc(self)
PyMem_DEL(self); PyMem_DEL(self);
} }
static PyObject *WinObj_MacCloseWindow(_self, _args)
WindowObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
MacCloseWindow(_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *WinObj_GetWindowOwnerCount(_self, _args) static PyObject *WinObj_GetWindowOwnerCount(_self, _args)
WindowObject *_self; WindowObject *_self;
PyObject *_args; PyObject *_args;
@ -181,6 +170,8 @@ static PyObject *WinObj_GetWindowAttributes(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_SetWinColor(_self, _args) static PyObject *WinObj_SetWinColor(_self, _args)
WindowObject *_self; WindowObject *_self;
PyObject *_args; PyObject *_args;
@ -196,6 +187,7 @@ static PyObject *WinObj_SetWinColor(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *WinObj_SetWindowContentColor(_self, _args) static PyObject *WinObj_SetWindowContentColor(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -280,6 +272,8 @@ static PyObject *WinObj_ClipAbove(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_SaveOld(_self, _args) static PyObject *WinObj_SaveOld(_self, _args)
WindowObject *_self; WindowObject *_self;
PyObject *_args; PyObject *_args;
@ -292,6 +286,9 @@ static PyObject *WinObj_SaveOld(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_DrawNew(_self, _args) static PyObject *WinObj_DrawNew(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -308,6 +305,7 @@ static PyObject *WinObj_DrawNew(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *WinObj_PaintOne(_self, _args) static PyObject *WinObj_PaintOne(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -713,7 +711,7 @@ static PyObject *WinObj_GetWindowProxyFSSpec(_self, _args)
&outFile); &outFile);
if (_err != noErr) return PyMac_Error(_err); if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&", _res = Py_BuildValue("O&",
PyMac_BuildFSSpec, &outFile); PyMac_BuildFSSpec, outFile);
return _res; return _res;
} }
@ -1319,6 +1317,8 @@ static PyObject *WinObj_TrackGoAway(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_GetAuxWin(_self, _args) static PyObject *WinObj_GetAuxWin(_self, _args)
WindowObject *_self; WindowObject *_self;
PyObject *_args; PyObject *_args;
@ -1335,6 +1335,7 @@ static PyObject *WinObj_GetAuxWin(_self, _args)
ResObj_New, awHndl); ResObj_New, awHndl);
return _res; return _res;
} }
#endif
static PyObject *WinObj_GetWindowPort(_self, _args) static PyObject *WinObj_GetWindowPort(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1435,6 +1436,8 @@ static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_GetWindowZoomFlag(_self, _args) static PyObject *WinObj_GetWindowZoomFlag(_self, _args)
WindowObject *_self; WindowObject *_self;
PyObject *_args; PyObject *_args;
@ -1448,6 +1451,9 @@ static PyObject *WinObj_GetWindowZoomFlag(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_GetWindowStructureRgn(_self, _args) static PyObject *WinObj_GetWindowStructureRgn(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1464,6 +1470,9 @@ static PyObject *WinObj_GetWindowStructureRgn(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_GetWindowContentRgn(_self, _args) static PyObject *WinObj_GetWindowContentRgn(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1480,6 +1489,9 @@ static PyObject *WinObj_GetWindowContentRgn(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_GetWindowUpdateRgn(_self, _args) static PyObject *WinObj_GetWindowUpdateRgn(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1496,6 +1508,9 @@ static PyObject *WinObj_GetWindowUpdateRgn(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *WinObj_GetWindowTitleWidth(_self, _args) static PyObject *WinObj_GetWindowTitleWidth(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1510,6 +1525,7 @@ static PyObject *WinObj_GetWindowTitleWidth(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
static PyObject *WinObj_GetNextWindow(_self, _args) static PyObject *WinObj_GetNextWindow(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1587,35 +1603,7 @@ static PyObject *WinObj_SetWindowUserState(_self, _args)
return _res; return _res;
} }
static PyObject *WinObj_GetWindowDataHandle(_self, _args) #ifndef TARGET_API_MAC_CARBON
WindowObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Handle _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetWindowDataHandle(_self->ob_itself);
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
static PyObject *WinObj_SetWindowDataHandle(_self, _args)
WindowObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Handle data;
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &data))
return NULL;
SetWindowDataHandle(_self->ob_itself,
data);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *WinObj_CloseWindow(_self, _args) static PyObject *WinObj_CloseWindow(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1629,6 +1617,7 @@ static PyObject *WinObj_CloseWindow(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *WinObj_MoveWindow(_self, _args) static PyObject *WinObj_MoveWindow(_self, _args)
WindowObject *_self; WindowObject *_self;
@ -1666,8 +1655,6 @@ static PyObject *WinObj_ShowWindow(_self, _args)
} }
static PyMethodDef WinObj_methods[] = { static PyMethodDef WinObj_methods[] = {
{"MacCloseWindow", (PyCFunction)WinObj_MacCloseWindow, 1,
"() -> None"},
{"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1,
"() -> (UInt32 outCount)"}, "() -> (UInt32 outCount)"},
{"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1,
@ -1676,8 +1663,11 @@ static PyMethodDef WinObj_methods[] = {
"() -> (WindowClass outClass)"}, "() -> (WindowClass outClass)"},
{"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1,
"() -> (WindowAttributes outAttributes)"}, "() -> (WindowAttributes outAttributes)"},
#ifndef TARGET_API_MAC_CARBON
{"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1,
"(WCTabHandle newColorTable) -> None"}, "(WCTabHandle newColorTable) -> None"},
#endif
{"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1, {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1,
"() -> (RGBColor color)"}, "() -> (RGBColor color)"},
{"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1, {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1,
@ -1688,10 +1678,16 @@ static PyMethodDef WinObj_methods[] = {
"(PixPatHandle pixPat) -> None"}, "(PixPatHandle pixPat) -> None"},
{"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
"() -> None"}, "() -> None"},
#ifndef TARGET_API_MAC_CARBON
{"SaveOld", (PyCFunction)WinObj_SaveOld, 1, {"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
"() -> None"}, "() -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"DrawNew", (PyCFunction)WinObj_DrawNew, 1, {"DrawNew", (PyCFunction)WinObj_DrawNew, 1,
"(Boolean update) -> None"}, "(Boolean update) -> None"},
#endif
{"PaintOne", (PyCFunction)WinObj_PaintOne, 1, {"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
"(RgnHandle clobberedRgn) -> None"}, "(RgnHandle clobberedRgn) -> None"},
{"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1, {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
@ -1810,8 +1806,11 @@ static PyMethodDef WinObj_methods[] = {
"(Point thePt, short partCode) -> (Boolean _rv)"}, "(Point thePt, short partCode) -> (Boolean _rv)"},
{"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1, {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1,
"(Point thePt) -> (Boolean _rv)"}, "(Point thePt) -> (Boolean _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1, {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1,
"() -> (Boolean _rv, AuxWinHandle awHndl)"}, "() -> (Boolean _rv, AuxWinHandle awHndl)"},
#endif
{"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
"() -> (CGrafPtr _rv)"}, "() -> (CGrafPtr _rv)"},
{"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
@ -1826,16 +1825,31 @@ static PyMethodDef WinObj_methods[] = {
"() -> (Boolean _rv)"}, "() -> (Boolean _rv)"},
{"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1,
"() -> (Boolean _rv)"}, "() -> (Boolean _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1, {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
"() -> (Boolean _rv)"}, "() -> (Boolean _rv)"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1, {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
"(RgnHandle r) -> None"}, "(RgnHandle r) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1, {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
"(RgnHandle r) -> None"}, "(RgnHandle r) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1, {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
"(RgnHandle r) -> None"}, "(RgnHandle r) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1, {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
"() -> (short _rv)"}, "() -> (short _rv)"},
#endif
{"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1, {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
"() -> (WindowPtr _rv)"}, "() -> (WindowPtr _rv)"},
{"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1, {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
@ -1846,12 +1860,11 @@ static PyMethodDef WinObj_methods[] = {
"(Rect r) -> None"}, "(Rect r) -> None"},
{"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1, {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
"(Rect r) -> None"}, "(Rect r) -> None"},
{"GetWindowDataHandle", (PyCFunction)WinObj_GetWindowDataHandle, 1,
"() -> (Handle _rv)"}, #ifndef TARGET_API_MAC_CARBON
{"SetWindowDataHandle", (PyCFunction)WinObj_SetWindowDataHandle, 1,
"(Handle data) -> None"},
{"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1, {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1,
"() -> None"}, "() -> None"},
#endif
{"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1, {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
"(short hGlobal, short vGlobal, Boolean front) -> None"}, "(short hGlobal, short vGlobal, Boolean front) -> None"},
{"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
@ -2110,6 +2123,8 @@ static PyObject *Win_FrontNonFloatingWindow(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_SetDeskCPat(_self, _args) static PyObject *Win_SetDeskCPat(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -2124,6 +2139,7 @@ static PyObject *Win_SetDeskCPat(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Win_CheckUpdate(_self, _args) static PyObject *Win_CheckUpdate(_self, _args)
PyObject *_self; PyObject *_self;
@ -2174,6 +2190,8 @@ static PyObject *Win_FrontWindow(_self, _args)
return _res; return _res;
} }
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_InitWindows(_self, _args) static PyObject *Win_InitWindows(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -2186,6 +2204,9 @@ static PyObject *Win_InitWindows(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_GetWMgrPort(_self, _args) static PyObject *Win_GetWMgrPort(_self, _args)
PyObject *_self; PyObject *_self;
@ -2200,6 +2221,9 @@ static PyObject *Win_GetWMgrPort(_self, _args)
GrafObj_New, wPort); GrafObj_New, wPort);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_GetCWMgrPort(_self, _args) static PyObject *Win_GetCWMgrPort(_self, _args)
PyObject *_self; PyObject *_self;
@ -2214,6 +2238,9 @@ static PyObject *Win_GetCWMgrPort(_self, _args)
GrafObj_New, wMgrCPort); GrafObj_New, wMgrCPort);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON_NOTYET
static PyObject *Win_IsValidWindowPtr(_self, _args) static PyObject *Win_IsValidWindowPtr(_self, _args)
PyObject *_self; PyObject *_self;
@ -2230,6 +2257,9 @@ static PyObject *Win_IsValidWindowPtr(_self, _args)
_rv); _rv);
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_InitFloatingWindows(_self, _args) static PyObject *Win_InitFloatingWindows(_self, _args)
PyObject *_self; PyObject *_self;
@ -2245,6 +2275,9 @@ static PyObject *Win_InitFloatingWindows(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_InvalRect(_self, _args) static PyObject *Win_InvalRect(_self, _args)
PyObject *_self; PyObject *_self;
@ -2260,6 +2293,9 @@ static PyObject *Win_InvalRect(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_InvalRgn(_self, _args) static PyObject *Win_InvalRgn(_self, _args)
PyObject *_self; PyObject *_self;
@ -2275,6 +2311,9 @@ static PyObject *Win_InvalRgn(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_ValidRect(_self, _args) static PyObject *Win_ValidRect(_self, _args)
PyObject *_self; PyObject *_self;
@ -2290,6 +2329,9 @@ static PyObject *Win_ValidRect(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
#ifndef TARGET_API_MAC_CARBON
static PyObject *Win_ValidRgn(_self, _args) static PyObject *Win_ValidRgn(_self, _args)
PyObject *_self; PyObject *_self;
@ -2305,6 +2347,7 @@ static PyObject *Win_ValidRgn(_self, _args)
_res = Py_None; _res = Py_None;
return _res; return _res;
} }
#endif
static PyObject *Win_CollapseAllWindows(_self, _args) static PyObject *Win_CollapseAllWindows(_self, _args)
PyObject *_self; PyObject *_self;
@ -2410,32 +2453,62 @@ static PyMethodDef Win_methods[] = {
"() -> (Boolean _rv)"}, "() -> (Boolean _rv)"},
{"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1,
"() -> (WindowPtr _rv)"}, "() -> (WindowPtr _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1,
"(PixPatHandle deskPixPat) -> None"}, "(PixPatHandle deskPixPat) -> None"},
#endif
{"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
"() -> (Boolean _rv, EventRecord theEvent)"}, "() -> (Boolean _rv, EventRecord theEvent)"},
{"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1, {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1,
"(Point thePoint) -> (short _rv, WindowPtr window)"}, "(Point thePoint) -> (short _rv, WindowPtr window)"},
{"FrontWindow", (PyCFunction)Win_FrontWindow, 1, {"FrontWindow", (PyCFunction)Win_FrontWindow, 1,
"() -> (WindowPtr _rv)"}, "() -> (WindowPtr _rv)"},
#ifndef TARGET_API_MAC_CARBON
{"InitWindows", (PyCFunction)Win_InitWindows, 1, {"InitWindows", (PyCFunction)Win_InitWindows, 1,
"() -> None"}, "() -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1, {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
"() -> (GrafPtr wPort)"}, "() -> (GrafPtr wPort)"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1, {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
"() -> (CGrafPtr wMgrCPort)"}, "() -> (CGrafPtr wMgrCPort)"},
#endif
#ifndef TARGET_API_MAC_CARBON_NOTYET
{"IsValidWindowPtr", (PyCFunction)Win_IsValidWindowPtr, 1, {"IsValidWindowPtr", (PyCFunction)Win_IsValidWindowPtr, 1,
"(GrafPtr grafPort) -> (Boolean _rv)"}, "(GrafPtr grafPort) -> (Boolean _rv)"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1, {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1,
"() -> None"}, "() -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"InvalRect", (PyCFunction)Win_InvalRect, 1, {"InvalRect", (PyCFunction)Win_InvalRect, 1,
"(Rect badRect) -> None"}, "(Rect badRect) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"InvalRgn", (PyCFunction)Win_InvalRgn, 1, {"InvalRgn", (PyCFunction)Win_InvalRgn, 1,
"(RgnHandle badRgn) -> None"}, "(RgnHandle badRgn) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"ValidRect", (PyCFunction)Win_ValidRect, 1, {"ValidRect", (PyCFunction)Win_ValidRect, 1,
"(Rect goodRect) -> None"}, "(Rect goodRect) -> None"},
#endif
#ifndef TARGET_API_MAC_CARBON
{"ValidRgn", (PyCFunction)Win_ValidRgn, 1, {"ValidRgn", (PyCFunction)Win_ValidRgn, 1,
"(RgnHandle goodRgn) -> None"}, "(RgnHandle goodRgn) -> None"},
#endif
{"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1,
"(Boolean collapse) -> None"}, "(Boolean collapse) -> None"},
{"PinRect", (PyCFunction)Win_PinRect, 1, {"PinRect", (PyCFunction)Win_PinRect, 1,

View file

@ -40,29 +40,34 @@ methods.append(f)
f = Method(Boolean, 'GetWindowZoomFlag', f = Method(Boolean, 'GetWindowZoomFlag',
(WindowRef, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
methods.append(f) methods.append(f)
f = Method(void, 'GetWindowStructureRgn', f = Method(void, 'GetWindowStructureRgn',
(WindowRef, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
(RgnHandle, 'r', InMode), (RgnHandle, 'r', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
methods.append(f) methods.append(f)
f = Method(void, 'GetWindowContentRgn', f = Method(void, 'GetWindowContentRgn',
(WindowRef, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
(RgnHandle, 'r', InMode), (RgnHandle, 'r', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
methods.append(f) methods.append(f)
f = Method(void, 'GetWindowUpdateRgn', f = Method(void, 'GetWindowUpdateRgn',
(WindowRef, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
(RgnHandle, 'r', InMode), (RgnHandle, 'r', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
methods.append(f) methods.append(f)
f = Method(short, 'GetWindowTitleWidth', f = Method(short, 'GetWindowTitleWidth',
(WindowRef, 'theWindow', InMode), (WindowRef, 'theWindow', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
methods.append(f) methods.append(f)
@ -96,20 +101,11 @@ f = Method(void, 'SetWindowUserState',
) )
methods.append(f) methods.append(f)
f = Method(Handle, 'GetWindowDataHandle',
(WindowRef, 'theWindow', InMode),
)
methods.append(f)
f = Method(void, 'SetWindowDataHandle',
(WindowRef, 'theWindow', InMode),
(Handle, 'data', InMode),
)
methods.append(f)
# These have Mac prefixed to their name in the 3.1 universal headers, # These have Mac prefixed to their name in the 3.1 universal headers,
# so we add the old/real names by hand. # so we add the old/real names by hand.
f = Method(void, 'CloseWindow', f = Method(void, 'CloseWindow',
(WindowPtr, 'theWindow', InMode), (WindowPtr, 'theWindow', InMode),
condition='#ifndef TARGET_API_MAC_CARBON'
) )
methods.append(f) methods.append(f)

View file

@ -41,10 +41,33 @@ class MyScanner(Scanner):
'GetWindowProperty', 'GetWindowProperty',
'GetWindowPropertySize', 'GetWindowPropertySize',
'RemoveWindowProperty', 'RemoveWindowProperty',
'MacCloseWindow',
# Constants with funny definitions # Constants with funny definitions
'kMouseUpOutOfSlop', 'kMouseUpOutOfSlop',
] ]
def makegreylist(self):
return [
('#ifndef TARGET_API_MAC_CARBON', [
'GetAuxWin',
'GetWindowDataHandle',
'SaveOld',
'DrawNew',
'SetWinColor',
'SetDeskCPat',
'InitWindows',
'InitFloatingWindows',
'GetWMgrPort',
'GetCWMgrPort',
'ValidRgn', # Use versions with Window in their name
'ValidRect',
'InvalRgn',
'InvalRect',
]),
('#ifndef TARGET_API_MAC_CARBON_NOTYET', [
'IsValidWindowPtr',
])]
def makeblacklisttypes(self): def makeblacklisttypes(self):
return [ return [
'ProcPtr', 'ProcPtr',

View file

@ -87,10 +87,12 @@ class MyObjectDefinition(GlobalObjectDefinition):
GlobalObjectDefinition.outputInitStructMembers(self) GlobalObjectDefinition.outputInitStructMembers(self)
Output("SetWRefCon(itself, (long)it);") Output("SetWRefCon(itself, (long)it);")
def outputCheckConvertArg(self): def outputCheckConvertArg(self):
Output("#ifndef TARGET_API_MAC_CARBON")
OutLbrace("if (DlgObj_Check(v))") OutLbrace("if (DlgObj_Check(v))")
Output("*p_itself = ((WindowObject *)v)->ob_itself;") Output("*p_itself = ((WindowObject *)v)->ob_itself;")
Output("return 1;") Output("return 1;")
OutRbrace() OutRbrace()
Output("#endif")
Out(""" Out("""
if (v == Py_None) { *p_itself = NULL; return 1; } if (v == Py_None) { *p_itself = NULL; return 1; }
if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }