diff options
Diffstat (limited to 'Mac/Modules')
44 files changed, 152 insertions, 916 deletions
diff --git a/Mac/Modules/ColorPickermodule.c b/Mac/Modules/ColorPickermodule.c index d9370b5..3878093 100644 --- a/Mac/Modules/ColorPickermodule.c +++ b/Mac/Modules/ColorPickermodule.c @@ -24,12 +24,10 @@ PERFORMANCE OF THIS SOFTWARE. #include <ColorPicker.h> #include "Python.h" #include "macglue.h" +#include "pymactoolbox.h" /* ----------------------------------------------------- */ -extern QdRGB_Convert(PyObject *v, RGBColorPtr p_itself); -extern PyObject *QdRGB_New(RGBColorPtr itself); - static char cp_GetColor__doc__[] = "GetColor(prompt, (r, g, b)) -> (r, g, b), ok" ; diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index 85fae41..c86a5ef 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -31,16 +31,9 @@ PERFORMANCE OF THIS SOFTWARE. #include "Python.h" #include "macglue.h" +#include "pymactoolbox.h" #include <Navigation.h> -/* Exported by AEModule.c: */ -extern PyObject *AEDesc_New(AppleEvent *); -extern int AEDesc_Convert(PyObject *, AppleEvent *); -/* Exported by Resmodule.c */ -extern PyObject *ResObj_New(Handle); -extern PyObject *OptResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); - static PyObject *ErrorObject; static NavEventUPP my_eventProcUPP; diff --git a/Mac/Modules/Printingmodule.c b/Mac/Modules/Printingmodule.c index 94d05a6..5f1ac57 100644 --- a/Mac/Modules/Printingmodule.c +++ b/Mac/Modules/Printingmodule.c @@ -23,15 +23,9 @@ PERFORMANCE OF THIS SOFTWARE. #include "Python.h" #include "macglue.h" +#include "pymactoolbox.h" #include <Printing.h> -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *DlgObj_New(DialogPtr); -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); -extern PyObject *ResObj_New(Handle); - - static PyObject *ErrorObject; /* ----------------------------------------------------- */ diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c index d540197..aee36fa 100644 --- a/Mac/Modules/ae/AEmodule.c +++ b/Mac/Modules/ae/AEmodule.c @@ -5,42 +5,8 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <AppleEvents.h> @@ -1164,7 +1130,7 @@ GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long PyObject *handler = (PyObject *)refcon; AEDescObject *requestObject, *replyObject; PyObject *args, *res; - if ((requestObject = (AEDescObject *)AEDesc_New(request)) == NULL) { + if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) { return -1; } if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) { diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py index 953b490..5ca2c48 100644 --- a/Mac/Modules/ae/aesupport.py +++ b/Mac/Modules/ae/aesupport.py @@ -131,7 +131,7 @@ GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long PyObject *handler = (PyObject *)refcon; AEDescObject *requestObject, *replyObject; PyObject *args, *res; - if ((requestObject = (AEDescObject *)AEDesc_New(request)) == NULL) { + if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) { return -1; } if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) { diff --git a/Mac/Modules/app/Appmodule.c b/Mac/Modules/app/Appmodule.c index 06f573d..fd12135 100644 --- a/Mac/Modules/app/Appmodule.c +++ b/Mac/Modules/app/Appmodule.c @@ -5,51 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Appearance.h> -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - static PyObject *App_Error; static PyObject *App_RegisterAppearanceClient(_self, _args) diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py index 3bf5912..11b6d2f 100644 --- a/Mac/Modules/app/appsupport.py +++ b/Mac/Modules/app/appsupport.py @@ -69,12 +69,6 @@ RGBColor = OpaqueType("RGBColor", "QdRGB") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ - -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ """ ## class MyObjectDefinition(GlobalObjectDefinition): diff --git a/Mac/Modules/cm/Cmmodule.c b/Mac/Modules/cm/Cmmodule.c index de00241..b8a6216 100644 --- a/Mac/Modules/cm/Cmmodule.c +++ b/Mac/Modules/cm/Cmmodule.c @@ -5,49 +5,16 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Components.h> /* ** Parse/generate ComponentDescriptor records */ -PyObject *CmpDesc_New(itself) +static PyObject * +CmpDesc_New(itself) ComponentDescription *itself; { @@ -58,6 +25,7 @@ PyObject *CmpDesc_New(itself) itself->componentFlags, itself->componentFlagsMask); } +static int CmpDesc_Convert(v, p_itself) PyObject *v; ComponentDescription *p_itself; diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py index 0a1915f..598b51d 100644 --- a/Mac/Modules/cm/cmsupport.py +++ b/Mac/Modules/cm/cmsupport.py @@ -26,7 +26,8 @@ includestuff = includestuff + """ /* ** Parse/generate ComponentDescriptor records */ -PyObject *CmpDesc_New(itself) +static PyObject * +CmpDesc_New(itself) ComponentDescription *itself; { @@ -37,6 +38,7 @@ PyObject *CmpDesc_New(itself) itself->componentFlags, itself->componentFlagsMask); } +static int CmpDesc_Convert(v, p_itself) PyObject *v; ComponentDescription *p_itself; diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c index 8632767..6944fb3 100644 --- a/Mac/Modules/ctl/Ctlmodule.c +++ b/Mac/Modules/ctl/Ctlmodule.c @@ -5,45 +5,13 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Controls.h> +staticforward PyObject *CtlObj_WhichControl(ControlHandle); + #define as_Control(h) ((ControlHandle)h) #define as_Resource(ctl) ((Handle)ctl) #ifdef TARGET_API_MAC_CARBON @@ -51,17 +19,13 @@ extern PyObject *WinObj_WhichWindow(WindowPtr); #else #define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect)) #endif -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - -extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */ -extern PyObject *QdRGB_New(RGBColorPtr); -extern QdRGB_Convert(PyObject *, RGBColorPtr); /* ** Parse/generate ControlFontStyleRec records */ #if 0 /* Not needed */ -PyObject *ControlFontStyle_New(itself) +static PyObject * +ControlFontStyle_New(itself) ControlFontStyleRec *itself; { @@ -71,6 +35,7 @@ PyObject *ControlFontStyle_New(itself) } #endif +static int ControlFontStyle_Convert(v, itself) PyObject *v; ControlFontStyleRec *itself; @@ -854,6 +819,8 @@ static PyObject *CtlObj_SetControlColor(_self, _args) } #endif +#ifndef TARGET_API_MAC_CARBON + static PyObject *CtlObj_GetBevelButtonMenuValue(_self, _args) ControlObject *_self; PyObject *_args; @@ -870,6 +837,9 @@ static PyObject *CtlObj_GetBevelButtonMenuValue(_self, _args) outValue); return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_SetBevelButtonMenuValue(_self, _args) ControlObject *_self; @@ -888,6 +858,9 @@ static PyObject *CtlObj_SetBevelButtonMenuValue(_self, _args) _res = Py_None; return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_GetBevelButtonMenuHandle(_self, _args) ControlObject *_self; @@ -905,6 +878,9 @@ static PyObject *CtlObj_GetBevelButtonMenuHandle(_self, _args) MenuObj_New, outHandle); return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_SetBevelButtonTransform(_self, _args) ControlObject *_self; @@ -923,6 +899,9 @@ static PyObject *CtlObj_SetBevelButtonTransform(_self, _args) _res = Py_None; return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_SetImageWellTransform(_self, _args) ControlObject *_self; @@ -941,6 +920,9 @@ static PyObject *CtlObj_SetImageWellTransform(_self, _args) _res = Py_None; return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_GetTabContentRect(_self, _args) ControlObject *_self; @@ -958,6 +940,9 @@ static PyObject *CtlObj_GetTabContentRect(_self, _args) PyMac_BuildRect, &outContentRect); return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_SetTabEnabled(_self, _args) ControlObject *_self; @@ -979,6 +964,9 @@ static PyObject *CtlObj_SetTabEnabled(_self, _args) _res = Py_None; return _res; } +#endif + +#ifndef TARGET_API_MAC_CARBON static PyObject *CtlObj_SetDisclosureTriangleLastValue(_self, _args) ControlObject *_self; @@ -997,6 +985,7 @@ static PyObject *CtlObj_SetDisclosureTriangleLastValue(_self, _args) _res = Py_None; return _res; } +#endif static PyObject *CtlObj_SendControlMessage(_self, _args) ControlObject *_self; @@ -1611,22 +1600,46 @@ static PyMethodDef CtlObj_methods[] = { {"SetControlColor", (PyCFunction)CtlObj_SetControlColor, 1, "(CCTabHandle newColorTable) -> None"}, #endif + +#ifndef TARGET_API_MAC_CARBON {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1, "() -> (SInt16 outValue)"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1, "(SInt16 inValue) -> None"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1, "() -> (MenuHandle outHandle)"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1, "(IconTransformType transform) -> None"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1, "(IconTransformType inTransform) -> None"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1, "() -> (Rect outContentRect)"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1, "(SInt16 inTabToHilite, Boolean inEnabled) -> None"}, +#endif + +#ifndef TARGET_API_MAC_CARBON {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1, "(SInt16 inValue) -> None"}, +#endif {"SendControlMessage", (PyCFunction)CtlObj_SendControlMessage, 1, "(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"}, {"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1, @@ -2098,7 +2111,8 @@ static PyMethodDef Ctl_methods[] = { -PyObject *CtlObj_NewUnmanaged(itself) +static PyObject * +CtlObj_NewUnmanaged(itself) ControlHandle itself; { ControlObject *it; @@ -2110,7 +2124,7 @@ PyObject *CtlObj_NewUnmanaged(itself) return (PyObject *)it; } -PyObject * +static PyObject * CtlObj_WhichControl(ControlHandle c) { PyObject *it; diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py index 0f46c0e..dc7d760 100644 --- a/Mac/Modules/ctl/ctlscan.py +++ b/Mac/Modules/ctl/ctlscan.py @@ -84,6 +84,15 @@ class MyScanner(Scanner): ('#ifndef TARGET_API_MAC_CARBON', [ 'GetAuxiliaryControlRecord', 'SetControlColor', + # These have suddenly disappeared in UH 3.3.2... + 'GetBevelButtonMenuValue', + 'SetBevelButtonMenuValue', + 'GetBevelButtonMenuHandle', + 'SetBevelButtonTransform', + 'SetImageWellTransform', + 'GetTabContentRect', + 'SetTabEnabled', + 'SetDisclosureTriangleLastValue', ])] def makeblacklisttypes(self): diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py index 30c4491..25cd520 100644 --- a/Mac/Modules/ctl/ctlsupport.py +++ b/Mac/Modules/ctl/ctlsupport.py @@ -44,6 +44,8 @@ ControlFontStyleRec_ptr = ControlFontStyleRec includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ +staticforward PyObject *CtlObj_WhichControl(ControlHandle); + #define as_Control(h) ((ControlHandle)h) #define as_Resource(ctl) ((Handle)ctl) #ifdef TARGET_API_MAC_CARBON @@ -51,17 +53,13 @@ includestuff = includestuff + """ #else #define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect)) #endif -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - -extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */ -extern PyObject *QdRGB_New(RGBColorPtr); -extern QdRGB_Convert(PyObject *, RGBColorPtr); /* ** Parse/generate ControlFontStyleRec records */ #if 0 /* Not needed */ -PyObject *ControlFontStyle_New(itself) +static PyObject * +ControlFontStyle_New(itself) ControlFontStyleRec *itself; { @@ -71,6 +69,7 @@ PyObject *ControlFontStyle_New(itself) } #endif +static int ControlFontStyle_Convert(v, itself) PyObject *v; ControlFontStyleRec *itself; @@ -99,7 +98,8 @@ staticforward int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr * """ finalstuff = finalstuff + """ -PyObject *CtlObj_NewUnmanaged(itself) +static PyObject * +CtlObj_NewUnmanaged(itself) ControlHandle itself; { ControlObject *it; @@ -111,7 +111,7 @@ PyObject *CtlObj_NewUnmanaged(itself) return (PyObject *)it; } -PyObject * +static PyObject * CtlObj_WhichControl(ControlHandle c) { PyObject *it; diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c index 1b46cfc..eb9efab 100644 --- a/Mac/Modules/dlg/Dlgmodule.c +++ b/Mac/Modules/dlg/Dlgmodule.c @@ -5,42 +5,8 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Dialogs.h> @@ -48,13 +14,9 @@ extern PyObject *WinObj_WhichWindow(WindowPtr); #define NewModalFilterProc(x) (x) #endif -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - /* XXX Shouldn't this be a stack? */ static PyObject *Dlg_FilterProc_callback = NULL; -static PyObject *DlgObj_New(DialogPtr); /* Forward */ - static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, EventRecord *event, short *itemHit) diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py index e00b662..11873cf 100644 --- a/Mac/Modules/dlg/dlgsupport.py +++ b/Mac/Modules/dlg/dlgsupport.py @@ -35,13 +35,9 @@ includestuff = includestuff + """ #define NewModalFilterProc(x) (x) #endif -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - /* XXX Shouldn't this be a stack? */ static PyObject *Dlg_FilterProc_callback = NULL; -static PyObject *DlgObj_New(DialogPtr); /* Forward */ - static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, EventRecord *event, short *itemHit) diff --git a/Mac/Modules/drag/Dragmodule.c b/Mac/Modules/drag/Dragmodule.c index 9fcc125..716d2d5 100644 --- a/Mac/Modules/drag/Dragmodule.c +++ b/Mac/Modules/drag/Dragmodule.c @@ -5,55 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Drag.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - - -/* Exported by AEModule.c: */ -extern PyObject *AEDesc_New(AppleEvent *); -extern int AEDesc_Convert(PyObject *, AppleEvent *); - /* Callback glue routines */ DragTrackingHandlerUPP dragglue_TrackingHandlerUPP; DragReceiveHandlerUPP dragglue_ReceiveHandlerUPP; diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py index 64274a6..af8a255 100644 --- a/Mac/Modules/drag/dragsupport.py +++ b/Mac/Modules/drag/dragsupport.py @@ -56,16 +56,6 @@ DragTrackingMessage = Type("DragTrackingMessage", "h") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - - -/* Exported by AEModule.c: */ -extern PyObject *AEDesc_New(AppleEvent *); -extern int AEDesc_Convert(PyObject *, AppleEvent *); - /* Callback glue routines */ DragTrackingHandlerUPP dragglue_TrackingHandlerUPP; DragReceiveHandlerUPP dragglue_ReceiveHandlerUPP; diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c index 7d5d2f2..b825cbf 100644 --- a/Mac/Modules/evt/Evtmodule.c +++ b/Mac/Modules/evt/Evtmodule.c @@ -5,47 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Events.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - static PyObject *Evt_Error; static PyObject *Evt_GetMouse(_self, _args) diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py index 6021a29..d4fb595 100644 --- a/Mac/Modules/evt/evtsupport.py +++ b/Mac/Modules/evt/evtsupport.py @@ -36,8 +36,6 @@ EventKind = Type("EventKind", "H") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ """ class MyObjectDefinition(GlobalObjectDefinition): diff --git a/Mac/Modules/fm/Fmmodule.c b/Mac/Modules/fm/Fmmodule.c index 37d47e8..3b30218 100644 --- a/Mac/Modules/fm/Fmmodule.c +++ b/Mac/Modules/fm/Fmmodule.c @@ -5,49 +5,16 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Fonts.h> /* ** Parse/generate ComponentDescriptor records */ -PyObject *FMRec_New(itself) +static PyObject * +FMRec_New(itself) FMetricRec *itself; { @@ -61,6 +28,7 @@ PyObject *FMRec_New(itself) #if 0 /* Not needed... */ +static int FMRec_Convert(v, p_itself) PyObject *v; FMetricRec *p_itself; diff --git a/Mac/Modules/fm/fmsupport.py b/Mac/Modules/fm/fmsupport.py index f0b1e29..1afc8b8 100644 --- a/Mac/Modules/fm/fmsupport.py +++ b/Mac/Modules/fm/fmsupport.py @@ -24,7 +24,8 @@ includestuff = includestuff + """ /* ** Parse/generate ComponentDescriptor records */ -PyObject *FMRec_New(itself) +static PyObject * +FMRec_New(itself) FMetricRec *itself; { @@ -38,6 +39,7 @@ PyObject *FMRec_New(itself) #if 0 /* Not needed... */ +static int FMRec_Convert(v, p_itself) PyObject *v; FMetricRec *p_itself; diff --git a/Mac/Modules/help/Helpmodule.c b/Mac/Modules/help/Helpmodule.c index 6faf26f..fac21b6 100644 --- a/Mac/Modules/help/Helpmodule.c +++ b/Mac/Modules/help/Helpmodule.c @@ -5,47 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Balloons.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - static PyObject *Help_Error; static PyObject *Help_HMGetHelpMenuHandle(_self, _args) diff --git a/Mac/Modules/help/helpsupport.py b/Mac/Modules/help/helpsupport.py index ce09754..3eeb06a 100644 --- a/Mac/Modules/help/helpsupport.py +++ b/Mac/Modules/help/helpsupport.py @@ -38,8 +38,6 @@ EventKind = Type("EventKind", "H") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ """ class MyObjectDefinition(GlobalObjectDefinition): diff --git a/Mac/Modules/icn/Icnmodule.c b/Mac/Modules/icn/Icnmodule.c index 37aa6ff..6ed20dd 100644 --- a/Mac/Modules/icn/Icnmodule.c +++ b/Mac/Modules/icn/Icnmodule.c @@ -5,51 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Icons.h> -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - static PyObject *Icn_Error; static PyObject *Icn_GetCIcon(_self, _args) diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py index 4345d9d..5ea6a45 100644 --- a/Mac/Modules/icn/icnsupport.py +++ b/Mac/Modules/icn/icnsupport.py @@ -47,12 +47,6 @@ RGBColor = OpaqueType("RGBColor", "QdRGB") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ - -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ """ class MyObjectDefinition(GlobalObjectDefinition): diff --git a/Mac/Modules/list/Listmodule.c b/Mac/Modules/list/Listmodule.c index 0993ad9..f5360f2 100644 --- a/Mac/Modules/list/Listmodule.c +++ b/Mac/Modules/list/Listmodule.c @@ -5,42 +5,8 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Lists.h> diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index 048b243..fa832f3 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -854,6 +854,7 @@ mfs_RawAlias(self, args) return (PyObject *)newmfsaobject((AliasHandle)h); } +#ifndef TARGET_API_MAC_CARBON static PyObject * mfs_GetDirectory(self, args) PyObject *self; /* Not used */ @@ -869,6 +870,7 @@ mfs_GetDirectory(self, args) ok = PyMac_GetDirectory(&fsdir, prompt); return Py_BuildValue("(Oi)", newmfssobject(&fsdir), ok); } +#endif static PyObject * mfs_FindFolder(self, args) diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c index 11bc6c7..23803e8 100644 --- a/Mac/Modules/menu/Menumodule.c +++ b/Mac/Modules/menu/Menumodule.c @@ -5,48 +5,12 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Devices.h> /* Defines OpenDeskAcc in universal headers */ #include <Menus.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - #define as_Menu(h) ((MenuHandle)h) #define as_Resource(h) ((Handle)h) diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py index b706a36..1325e10 100644 --- a/Mac/Modules/menu/menusupport.py +++ b/Mac/Modules/menu/menusupport.py @@ -32,8 +32,6 @@ includestuff = includestuff + """ #include <Devices.h> /* Defines OpenDeskAcc in universal headers */ #include <%s>""" % MACHEADERFILE + """ -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - #define as_Menu(h) ((MenuHandle)h) #define as_Resource(h) ((Handle)h) """ diff --git a/Mac/Modules/qd/Qdmodule.c b/Mac/Modules/qd/Qdmodule.c index d4f91d4..9d844b8 100644 --- a/Mac/Modules/qd/Qdmodule.c +++ b/Mac/Modules/qd/Qdmodule.c @@ -5,47 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <QuickDraw.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - /* ** Parse/generate RGB records */ diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py index 3be0b0c..1c0f6c3 100644 --- a/Mac/Modules/qd/qdsupport.py +++ b/Mac/Modules/qd/qdsupport.py @@ -58,8 +58,6 @@ PenState_ptr = StructInputBufferType('PenState') includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - /* ** Parse/generate RGB records */ diff --git a/Mac/Modules/qdoffs/Qdoffsmodule.c b/Mac/Modules/qdoffs/Qdoffsmodule.c index 37c774e..c0e05cd 100644 --- a/Mac/Modules/qdoffs/Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/Qdoffsmodule.c @@ -5,49 +5,13 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <QDOffscreen.h> #define as_GrafPtr(gworld) ((GrafPtr)(gworld)) -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - static PyObject *Qdoffs_Error; diff --git a/Mac/Modules/qdoffs/qdoffssupport.py b/Mac/Modules/qdoffs/qdoffssupport.py index e569fea..7f4a043 100644 --- a/Mac/Modules/qdoffs/qdoffssupport.py +++ b/Mac/Modules/qdoffs/qdoffssupport.py @@ -38,8 +38,6 @@ includestuff = includestuff + """ #define as_GrafPtr(gworld) ((GrafPtr)(gworld)) -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - """ diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c index f382f9f..4899715 100644 --- a/Mac/Modules/qt/Qtmodule.c +++ b/Mac/Modules/qt/Qtmodule.c @@ -5,64 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Movies.h> -/* Exported by Cmmodule.c: */ -extern PyObject *CmpObj_New(Component); -extern int CmpObj_Convert(PyObject *, Component *); -extern PyObject *CmpInstObj_New(ComponentInstance); -extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); - -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -/* Our own, used before defined: */ -staticforward PyObject *TrackObj_New(Track); -staticforward int TrackObj_Convert(PyObject *, Track *); -staticforward PyObject *MovieObj_New(Movie); -staticforward int MovieObj_Convert(PyObject *, Movie *); -staticforward PyObject *MovieCtlObj_New(MovieController); -staticforward int MovieCtlObj_Convert(PyObject *, TimeBase *); -staticforward PyObject *TimeBaseObj_New(TimeBase); -staticforward int TimeBaseObj_Convert(PyObject *, TimeBase *); /* Macro to allow us to GetNextInterestingTime without duration */ #define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL) diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py index f7b8e2e..fd2169d 100644 --- a/Mac/Modules/qt/qtsupport.py +++ b/Mac/Modules/qt/qtsupport.py @@ -26,25 +26,6 @@ from macsupport import * includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ -/* Exported by Cmmodule.c: */ -extern PyObject *CmpObj_New(Component); -extern int CmpObj_Convert(PyObject *, Component *); -extern PyObject *CmpInstObj_New(ComponentInstance); -extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); - -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -/* Our own, used before defined: */ -staticforward PyObject *TrackObj_New(Track); -staticforward int TrackObj_Convert(PyObject *, Track *); -staticforward PyObject *MovieObj_New(Movie); -staticforward int MovieObj_Convert(PyObject *, Movie *); -staticforward PyObject *MovieCtlObj_New(MovieController); -staticforward int MovieCtlObj_Convert(PyObject *, TimeBase *); -staticforward PyObject *TimeBaseObj_New(TimeBase); -staticforward int TimeBaseObj_Convert(PyObject *, TimeBase *); /* Macro to allow us to GetNextInterestingTime without duration */ #define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \ diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c index 6db002f..95a82e2 100644 --- a/Mac/Modules/res/Resmodule.c +++ b/Mac/Modules/res/Resmodule.c @@ -5,48 +5,12 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Resources.h> #include <string.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - /* Function to dispose a resource, with a "normal" calling sequence */ static void PyMac_AutoDisposeHandle(Handle h) diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py index 10e2724..b19c10d 100644 --- a/Mac/Modules/res/ressupport.py +++ b/Mac/Modules/res/ressupport.py @@ -24,8 +24,6 @@ includestuff = includestuff + """ #include <Resources.h> #include <string.h> -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - /* Function to dispose a resource, with a "normal" calling sequence */ static void PyMac_AutoDisposeHandle(Handle h) diff --git a/Mac/Modules/scrap/Scrapmodule.c b/Mac/Modules/scrap/Scrapmodule.c index b44e7cd..5dd5c5a 100644 --- a/Mac/Modules/scrap/Scrapmodule.c +++ b/Mac/Modules/scrap/Scrapmodule.c @@ -13,44 +13,15 @@ #include <Menus.h> #include <Controls.h> -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *PMObj_New(PixMapHandle); -extern int PMObj_Convert(PyObject *, PixMapHandle *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Scrap.h> /* ** Generate ScrapInfo records */ -PyObject *SCRRec_New(itself) +static PyObject * +SCRRec_New(itself) ScrapStuff *itself; { diff --git a/Mac/Modules/snd/Sndihooks.c b/Mac/Modules/snd/Sndihooks.c index 5c152d7..a4aa609 100644 --- a/Mac/Modules/snd/Sndihooks.c +++ b/Mac/Modules/snd/Sndihooks.c @@ -31,6 +31,7 @@ PERFORMANCE OF THIS SOFTWARE. #include "Python.h" #include "macglue.h" +#include "pymactoolbox.h" #include <Sound.h> #pragma options align=mac68k @@ -46,8 +47,6 @@ struct SampleSizeAvailable_arg { #pragma options align=reset -extern PyObject *ResObj_New(Handle); - static PyObject *ErrorObject; diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c index 2e4eae5..bbd58cd 100644 --- a/Mac/Modules/snd/Sndmodule.c +++ b/Mac/Modules/snd/Sndmodule.c @@ -5,42 +5,8 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Sound.h> diff --git a/Mac/Modules/te/TEmodule.c b/Mac/Modules/te/TEmodule.c index 98b8de8..789b157 100644 --- a/Mac/Modules/te/TEmodule.c +++ b/Mac/Modules/te/TEmodule.c @@ -5,56 +5,19 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <TextEdit.h> #define as_TE(h) ((TEHandle)h) #define as_Resource(teh) ((Handle)teh) -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - /* ** Parse/generate TextStyle records */ -PyObject *TextStyle_New(itself) +static PyObject * +TextStyle_New(itself) TextStylePtr itself; { @@ -62,6 +25,7 @@ PyObject *TextStyle_New(itself) &itself->tsColor); } +static int TextStyle_Convert(v, p_itself) PyObject *v; TextStylePtr p_itself; diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py index b33d0bd..337ac2b 100644 --- a/Mac/Modules/te/tesupport.py +++ b/Mac/Modules/te/tesupport.py @@ -37,14 +37,11 @@ includestuff = includestuff + """ #define as_TE(h) ((TEHandle)h) #define as_Resource(teh) ((Handle)teh) -/* Exported by Qdmodule.c: */ -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - /* ** Parse/generate TextStyle records */ -PyObject *TextStyle_New(itself) +static PyObject * +TextStyle_New(itself) TextStylePtr itself; { @@ -52,6 +49,7 @@ PyObject *TextStyle_New(itself) &itself->tsColor); } +static int TextStyle_Convert(v, p_itself) PyObject *v; TextStylePtr p_itself; diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c index ffb39c3..14aac9c 100644 --- a/Mac/Modules/waste/wastemodule.c +++ b/Mac/Modules/waste/wastemodule.c @@ -5,42 +5,8 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <WASTE.h> #include <WEObjectHandlers.h> @@ -381,6 +347,12 @@ static PyObject *WEOObj_getattr(self, name) #define WEOObj_setattr NULL +#define WEOObj_compare NULL + +#define WEOObj_repr NULL + +#define WEOObj_hash NULL + PyTypeObject WEO_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -392,6 +364,12 @@ PyTypeObject WEO_Type = { 0, /*tp_print*/ (getattrfunc) WEOObj_getattr, /*tp_getattr*/ (setattrfunc) WEOObj_setattr, /*tp_setattr*/ + (cmpfunc) WEOObj_compare, /*tp_compare*/ + (reprfunc) WEOObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) WEOObj_hash, /*tp_hash*/ }; /* ---------------------- End object type WEO ----------------------- */ @@ -682,7 +660,7 @@ static PyObject *wasteObj_WEGetClickCount(_self, _args) if (!PyArg_ParseTuple(_args, "")) return NULL; _rv = WEGetClickCount(_self->ob_itself); - _res = Py_BuildValue("h", + _res = Py_BuildValue("H", _rv); return _res; } @@ -746,13 +724,13 @@ static PyObject *wasteObj_WEContinuousStyle(_self, _args) Boolean _rv; WEStyleMode mode; TextStyle ts; - if (!PyArg_ParseTuple(_args, "h", + if (!PyArg_ParseTuple(_args, "H", &mode)) return NULL; _rv = WEContinuousStyle(&mode, &ts, _self->ob_itself); - _res = Py_BuildValue("bhO&", + _res = Py_BuildValue("bHO&", _rv, mode, TextStyle_New, &ts); @@ -1096,7 +1074,7 @@ static PyObject *wasteObj_WEKey(_self, _args) PyObject *_res = NULL; SInt16 key; EventModifiers modifiers; - if (!PyArg_ParseTuple(_args, "hh", + if (!PyArg_ParseTuple(_args, "hH", &key, &modifiers)) return NULL; @@ -1116,7 +1094,7 @@ static PyObject *wasteObj_WEClick(_self, _args) Point hitPt; EventModifiers modifiers; UInt32 clickTime; - if (!PyArg_ParseTuple(_args, "O&hl", + if (!PyArg_ParseTuple(_args, "O&Hl", PyMac_GetPoint, &hitPt, &modifiers, &clickTime)) @@ -1216,7 +1194,7 @@ static PyObject *wasteObj_WESetStyle(_self, _args) OSErr _err; WEStyleMode mode; TextStyle ts; - if (!PyArg_ParseTuple(_args, "hO&", + if (!PyArg_ParseTuple(_args, "HO&", &mode, TextStyle_Convert, &ts)) return NULL; @@ -1889,6 +1867,12 @@ static PyObject *wasteObj_getattr(self, name) #define wasteObj_setattr NULL +#define wasteObj_compare NULL + +#define wasteObj_repr NULL + +#define wasteObj_hash NULL + PyTypeObject waste_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -1900,6 +1884,12 @@ PyTypeObject waste_Type = { 0, /*tp_print*/ (getattrfunc) wasteObj_getattr, /*tp_getattr*/ (setattrfunc) wasteObj_setattr, /*tp_setattr*/ + (cmpfunc) wasteObj_compare, /*tp_compare*/ + (reprfunc) wasteObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) wasteObj_hash, /*tp_hash*/ }; /* --------------------- End object type waste ---------------------- */ diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c index 2ad1d60..033dd4b 100644 --- a/Mac/Modules/win/Winmodule.c +++ b/Mac/Modules/win/Winmodule.c @@ -5,51 +5,11 @@ -#define SystemSevenOrLater 1 - #include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); +#include "pymactoolbox.h" #include <Windows.h> -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - - static PyObject *Win_Error; /* ----------------------- Object type Window ----------------------- */ diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py index 5ee6cf3..8737894 100644 --- a/Mac/Modules/win/winsupport.py +++ b/Mac/Modules/win/winsupport.py @@ -49,12 +49,6 @@ PropertyTag = OSTypeType("PropertyTag") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ - -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); - -#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ - """ finalstuff = finalstuff + """ |