diff --git a/Mac/Modules/ColorPickermodule.c b/Mac/Modules/ColorPickermodule.c index ec0afa74c5c..62b4d5f6417 100644 --- a/Mac/Modules/ColorPickermodule.c +++ b/Mac/Modules/ColorPickermodule.c @@ -23,7 +23,6 @@ PERFORMANCE OF THIS SOFTWARE. #include #include "Python.h" -#include "macglue.h" #include "pymactoolbox.h" /* ----------------------------------------------------- */ diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index 96c7c204395..0041f765aea 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "Python.h" -#include "macglue.h" #include "pymactoolbox.h" #include diff --git a/Mac/Modules/OSATerminology.c b/Mac/Modules/OSATerminology.c index a3ed4b4340a..9de087122e9 100644 --- a/Mac/Modules/OSATerminology.c +++ b/Mac/Modules/OSATerminology.c @@ -7,7 +7,7 @@ ** by a full interface to OpenScripting. */ #include "Python.h" -#include "macglue.h" +#include "pymactoolbox.h" #include diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c index fd6582b74a0..01e4246b654 100644 --- a/Mac/Modules/ae/_AEmodule.c +++ b/Mac/Modules/ae/_AEmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/ah/_AHmodule.c b/Mac/Modules/ah/_AHmodule.c index 9408e530836..160a845fe39 100644 --- a/Mac/Modules/ah/_AHmodule.c +++ b/Mac/Modules/ah/_AHmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c index 2a743250c09..df91f8f2dbf 100644 --- a/Mac/Modules/app/_Appmodule.c +++ b/Mac/Modules/app/_Appmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/carbonevt/CarbonEvtscan.py b/Mac/Modules/carbonevt/CarbonEvtscan.py index d3088fd0f23..c6bf93f1a24 100644 --- a/Mac/Modules/carbonevt/CarbonEvtscan.py +++ b/Mac/Modules/carbonevt/CarbonEvtscan.py @@ -84,7 +84,6 @@ class CarbonEvents_Scanner(Scanner_OSX): # Wrote by hand "InstallEventHandler", "RemoveEventHandler", - "RunApplicationEventLoop", # Write by hand? "GetEventParameter", diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py index 19d7d6d6fd2..3cc1672fbb7 100644 --- a/Mac/Modules/carbonevt/CarbonEvtsupport.py +++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py @@ -73,26 +73,9 @@ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") MouseTrackingResult = UInt16 -includestuff = r""" +includestuff = includestuff + r""" #include -#include "macglue.h" - -/* Macro to test whether a weak-loaded CFM function exists */ -#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ - PyErr_SetString(PyExc_NotImplementedError, \ - "Not available in this shared library/OS version"); \ - return; \ - }} while(0) - - -#define USE_MAC_MP_MULTITHREADING 0 - -#if USE_MAC_MP_MULTITHREADING -static PyThreadState *_save; -static MPCriticalRegionID reentrantLock; -#endif /* USE_MAC_MP_MULTITHREADING */ - extern int CFStringRef_New(CFStringRef *); extern int CFStringRef_Convert(PyObject *, CFStringRef *); @@ -168,11 +151,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject PyObject *retValue; int status; -#if USE_MAC_MP_MULTITHREADING - MPEnterCriticalRegion(reentrantLock, kDurationForever); - PyEval_RestoreThread(_save); -#endif /* USE_MAC_MP_MULTITHREADING */ - retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&", EventHandlerCallRef_New, handlerRef, EventRef_New, event); @@ -190,11 +168,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject Py_DECREF(retValue); } -#if USE_MAC_MP_MULTITHREADING - _save = PyEval_SaveThread(); - MPExitCriticalRegion(reentrantLock); -#endif /* USE_MAC_MP_MULTITHREADING */ - return status; } @@ -203,7 +176,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject """ initstuff = initstuff + """ -PyMac_PRECHECK(NewEventHandlerUPP); /* This can fail if CarbonLib is too old */ myEventHandlerUPP = NewEventHandlerUPP(myEventHandler); """ module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, initstuff) @@ -335,32 +307,6 @@ f = ManualGenerator("GetEventParameter", geteventparameter); f.docstring = lambda: "(EventParamName eventName, EventParamType eventType) -> (String eventParamData)" EventRefobject.add(f) -runappeventloop = """ -#if USE_MAC_MP_MULTITHREADING -if (MPCreateCriticalRegion(&reentrantLock) != noErr) { - PySys_WriteStderr("lock failure\\n"); - return NULL; -} -_save = PyEval_SaveThread(); -#endif /* USE_MAC_MP_MULTITHREADING */ - -RunApplicationEventLoop(); - -#if USE_MAC_MP_MULTITHREADING -PyEval_RestoreThread(_save); - -MPDeleteCriticalRegion(reentrantLock); -#endif /* USE_MAC_MP_MULTITHREADING */ - -Py_INCREF(Py_None); -_res = Py_None; -return _res; -""" - -f = ManualGenerator("RunApplicationEventLoop", runappeventloop); -f.docstring = lambda: "() -> ()" -module.add(f) - SetOutputFileName('_CarbonEvtmodule.c') module.generate() diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c index 46eb31e414b..097f11a6a2f 100755 --- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c +++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c @@ -5,24 +5,17 @@ -#include - -#include "macglue.h" +#include "pymactoolbox.h" /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ - PyErr_SetString(PyExc_NotImplementedError, \ - "Not available in this shared library/OS version"); \ - return; \ - }} while(0) + PyErr_SetString(PyExc_NotImplementedError, \ + "Not available in this shared library/OS version"); \ + return NULL; \ + }} while(0) -#define USE_MAC_MP_MULTITHREADING 0 - -#if USE_MAC_MP_MULTITHREADING -static PyThreadState *_save; -static MPCriticalRegionID reentrantLock; -#endif /* USE_MAC_MP_MULTITHREADING */ +#include extern int CFStringRef_New(CFStringRef *); @@ -99,11 +92,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject PyObject *retValue; int status; -#if USE_MAC_MP_MULTITHREADING - MPEnterCriticalRegion(reentrantLock, kDurationForever); - PyEval_RestoreThread(_save); -#endif /* USE_MAC_MP_MULTITHREADING */ - retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&", EventHandlerCallRef_New, handlerRef, EventRef_New, event); @@ -121,11 +109,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject Py_DECREF(retValue); } -#if USE_MAC_MP_MULTITHREADING - _save = PyEval_SaveThread(); - MPExitCriticalRegion(reentrantLock); -#endif /* USE_MAC_MP_MULTITHREADING */ - return status; } @@ -1845,6 +1828,17 @@ static PyObject *CarbonEvents_GetEventDispatcherTarget(PyObject *_self, PyObject return _res; } +static PyObject *CarbonEvents_RunApplicationEventLoop(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + RunApplicationEventLoop(); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *CarbonEvents_QuitApplicationEventLoop(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -2042,32 +2036,6 @@ static PyObject *CarbonEvents_RegisterEventHotKey(PyObject *_self, PyObject *_ar return _res; } -static PyObject *CarbonEvents_RunApplicationEventLoop(PyObject *_self, PyObject *_args) -{ - PyObject *_res = NULL; - -#if USE_MAC_MP_MULTITHREADING - if (MPCreateCriticalRegion(&reentrantLock) != noErr) { - PySys_WriteStderr("lock failure\n"); - return NULL; - } - _save = PyEval_SaveThread(); -#endif /* USE_MAC_MP_MULTITHREADING */ - - RunApplicationEventLoop(); - -#if USE_MAC_MP_MULTITHREADING - PyEval_RestoreThread(_save); - - MPDeleteCriticalRegion(reentrantLock); -#endif /* USE_MAC_MP_MULTITHREADING */ - - Py_INCREF(Py_None); - _res = Py_None; - return _res; - -} - static PyMethodDef CarbonEvents_methods[] = { {"GetCurrentEventLoop", (PyCFunction)CarbonEvents_GetCurrentEventLoop, 1, PyDoc_STR("() -> (EventLoopRef _rv)")}, @@ -2103,6 +2071,8 @@ static PyMethodDef CarbonEvents_methods[] = { PyDoc_STR("() -> (EventTargetRef _rv)")}, {"GetEventDispatcherTarget", (PyCFunction)CarbonEvents_GetEventDispatcherTarget, 1, PyDoc_STR("() -> (EventTargetRef _rv)")}, + {"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1, + PyDoc_STR("() -> None")}, {"QuitApplicationEventLoop", (PyCFunction)CarbonEvents_QuitApplicationEventLoop, 1, PyDoc_STR("() -> None")}, {"RunAppModalLoopForWindow", (PyCFunction)CarbonEvents_RunAppModalLoopForWindow, 1, @@ -2127,8 +2097,6 @@ static PyMethodDef CarbonEvents_methods[] = { PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, {"RegisterEventHotKey", (PyCFunction)CarbonEvents_RegisterEventHotKey, 1, PyDoc_STR("(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) -> (EventHotKeyRef outRef)")}, - {"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1, - PyDoc_STR("() -> ()")}, {NULL, NULL, 0} }; @@ -2142,7 +2110,6 @@ void init_CarbonEvt(void) - PyMac_PRECHECK(NewEventHandlerUPP); /* This can fail if CarbonLib is too old */ myEventHandlerUPP = NewEventHandlerUPP(myEventHandler); diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index 8a82d2bd79c..250e7acffce 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c index 3e4b89a77d8..30122dcdd06 100644 --- a/Mac/Modules/cf/pycfbridge.c +++ b/Mac/Modules/cf/pycfbridge.c @@ -5,7 +5,7 @@ #include #include "Python.h" -#include "macglue.h" +#include "pymactoolbox.h" #include "pycfbridge.h" diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c index 39711858631..088976643ef 100755 --- a/Mac/Modules/cg/_CGmodule.c +++ b/Mac/Modules/cg/_CGmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c index f9b1bf7b959..95a36c06f99 100644 --- a/Mac/Modules/cm/_Cmmodule.c +++ b/Mac/Modules/cm/_Cmmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c index 3f127788aaa..9f299a18e3e 100644 --- a/Mac/Modules/ctl/_Ctlmodule.c +++ b/Mac/Modules/ctl/_Ctlmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c index 966e1ff7525..19ae1e9211e 100644 --- a/Mac/Modules/dlg/_Dlgmodule.c +++ b/Mac/Modules/dlg/_Dlgmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c index 79f03849cf6..a1f743b4f3a 100644 --- a/Mac/Modules/drag/_Dragmodule.c +++ b/Mac/Modules/drag/_Dragmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/evt/_Evtmodule.c b/Mac/Modules/evt/_Evtmodule.c index 9f62a2f7c99..6d86e510f80 100644 --- a/Mac/Modules/evt/_Evtmodule.c +++ b/Mac/Modules/evt/_Evtmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c index f5f48d2dce8..79929c59ce0 100644 --- a/Mac/Modules/file/_Filemodule.c +++ b/Mac/Modules/file/_Filemodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/fm/_Fmmodule.c b/Mac/Modules/fm/_Fmmodule.c index cba96e02fea..816775d6952 100644 --- a/Mac/Modules/fm/_Fmmodule.c +++ b/Mac/Modules/fm/_Fmmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/folder/_Foldermodule.c b/Mac/Modules/folder/_Foldermodule.c index 9c7afc666be..bd33b8e10dd 100644 --- a/Mac/Modules/folder/_Foldermodule.c +++ b/Mac/Modules/folder/_Foldermodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/gestaltmodule.c b/Mac/Modules/gestaltmodule.c index 8097de82dc8..f82687e2161 100644 --- a/Mac/Modules/gestaltmodule.c +++ b/Mac/Modules/gestaltmodule.c @@ -25,7 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Macintosh Gestalt interface */ #include "Python.h" -#include "macglue.h" +#include "pymactoolbox.h" #include diff --git a/Mac/Modules/help/_Helpmodule.c b/Mac/Modules/help/_Helpmodule.c index 8d016a5080b..0da66cc0dd9 100644 --- a/Mac/Modules/help/_Helpmodule.c +++ b/Mac/Modules/help/_Helpmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/ibcarbon/IBCarbonsupport.py b/Mac/Modules/ibcarbon/IBCarbonsupport.py index 04d4bc135ce..5d07be1239e 100644 --- a/Mac/Modules/ibcarbon/IBCarbonsupport.py +++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py @@ -10,15 +10,12 @@ IBCarbonMethod = OSErrMethodGenerator includestuff = """ #include -#include "macglue.h" +#include "pymactoolbox.h" #ifdef USE_TOOLBOX_OBJECT_GLUE extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); -//#define CFStringRefObj_Convert _CFStringRefObj_Convert #endif -//extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle - """ initstuff = """ diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c index 1d50db2ba42..ce120c3b9e6 100644 --- a/Mac/Modules/ibcarbon/_IBCarbon.c +++ b/Mac/Modules/ibcarbon/_IBCarbon.c @@ -6,15 +6,12 @@ #include -#include "macglue.h" +#include "pymactoolbox.h" #ifdef USE_TOOLBOX_OBJECT_GLUE extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); -//#define CFStringRefObj_Convert _CFStringRefObj_Convert #endif -//extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle - static PyObject *IBCarbon_Error; diff --git a/Mac/Modules/icgluemodule.c b/Mac/Modules/icgluemodule.c index ee42c59fc04..fa50f0d4631 100644 --- a/Mac/Modules/icgluemodule.c +++ b/Mac/Modules/icgluemodule.c @@ -30,7 +30,7 @@ PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "Python.h" -#include "macglue.h" +#include "pymactoolbox.h" extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */ diff --git a/Mac/Modules/icn/_Icnmodule.c b/Mac/Modules/icn/_Icnmodule.c index 7ed2064e0a3..bbd59ab1891 100644 --- a/Mac/Modules/icn/_Icnmodule.c +++ b/Mac/Modules/icn/_Icnmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c index cf9480198d8..bfea8a35910 100644 --- a/Mac/Modules/list/_Listmodule.c +++ b/Mac/Modules/list/_Listmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index f5fc23e6dbc..271a5aa3d39 100644 --- a/Mac/Modules/macosmodule.c +++ b/Mac/Modules/macosmodule.c @@ -25,8 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Macintosh OS-specific interface */ #include "Python.h" -#include "macglue.h" -#include "pythonresources.h" +#include "pymactoolbox.h" #include #include diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c index c48edb14053..feb9bd26ccc 100644 --- a/Mac/Modules/menu/_Menumodule.c +++ b/Mac/Modules/menu/_Menumodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c index 18fdd45bc6e..2c972e9f80b 100644 --- a/Mac/Modules/mlte/_Mltemodule.c +++ b/Mac/Modules/mlte/_Mltemodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index e15f84870df..793c9721be2 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c index 5bc0f968b2a..1cb4564c5dd 100644 --- a/Mac/Modules/qdoffs/_Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c index fd5db6fa2ae..9fc9be2664c 100644 --- a/Mac/Modules/qt/_Qtmodule.c +++ b/Mac/Modules/qt/_Qtmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c index 13a9c36ed86..d554a99b508 100644 --- a/Mac/Modules/res/_Resmodule.c +++ b/Mac/Modules/res/_Resmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/scrap/_Scrapmodule.c b/Mac/Modules/scrap/_Scrapmodule.c index db8e58be24b..5ee22eba340 100644 --- a/Mac/Modules/scrap/_Scrapmodule.c +++ b/Mac/Modules/scrap/_Scrapmodule.c @@ -5,21 +5,13 @@ -#ifndef PyDoc_STR -#define PyDoc_STR(x) (x) -#endif -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ - PyErr_SetString(PyExc_NotImplementedError, \ - "Not available in this shared library/OS version"); \ - return NULL; \ + PyErr_SetString(PyExc_NotImplementedError, \ + "Not available in this shared library/OS version"); \ + return NULL; \ }} while(0) @@ -31,7 +23,7 @@ static PyObject *Scrap_Error; PyTypeObject Scrap_Type; -#define ScrapObj_Check(x) ((x)->ob_type == &Scrap_Type) +#define ScrapObj_Check(x) ((x)->ob_type == &Scrap_Type || PyObject_TypeCheck((x), &Scrap_Type)) typedef struct ScrapObject { PyObject_HEAD @@ -60,7 +52,7 @@ int ScrapObj_Convert(PyObject *v, ScrapRef *p_itself) static void ScrapObj_dealloc(ScrapObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_DEL(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *ScrapObj_GetScrapFlavorFlags(ScrapObject *_self, PyObject *_args) @@ -208,17 +200,17 @@ static PyObject *ScrapObj_GetScrapFlavorInfoList(ScrapObject *_self, PyObject *_ static PyMethodDef ScrapObj_methods[] = { {"GetScrapFlavorFlags", (PyCFunction)ScrapObj_GetScrapFlavorFlags, 1, - "(ScrapFlavorType flavorType) -> (ScrapFlavorFlags flavorFlags)"}, + PyDoc_STR("(ScrapFlavorType flavorType) -> (ScrapFlavorFlags flavorFlags)")}, {"GetScrapFlavorSize", (PyCFunction)ScrapObj_GetScrapFlavorSize, 1, - "(ScrapFlavorType flavorType) -> (Size byteCount)"}, + PyDoc_STR("(ScrapFlavorType flavorType) -> (Size byteCount)")}, {"GetScrapFlavorData", (PyCFunction)ScrapObj_GetScrapFlavorData, 1, - "(ScrapFlavorType flavorType) -> string"}, + PyDoc_STR("(ScrapFlavorType flavorType, Buffer destination) -> (Size byteCount)")}, {"PutScrapFlavor", (PyCFunction)ScrapObj_PutScrapFlavor, 1, - "(ScrapFlavorType flavorType, ScrapFlavorFlags flavorFlags, Buffer flavorData) -> None"}, + PyDoc_STR("(ScrapFlavorType flavorType, ScrapFlavorFlags flavorFlags, Size flavorSize, Buffer flavorData) -> None")}, {"GetScrapFlavorCount", (PyCFunction)ScrapObj_GetScrapFlavorCount, 1, - "() -> (UInt32 infoCount)"}, + PyDoc_STR("() -> (UInt32 infoCount)")}, {"GetScrapFlavorInfoList", (PyCFunction)ScrapObj_GetScrapFlavorInfoList, 1, - "() -> ([(ScrapFlavorType, ScrapFlavorInfo), ...])"}, + PyDoc_STR("() -> ([(ScrapFlavorType, ScrapFlavorInfo), ...])")}, {NULL, NULL, 0} }; @@ -326,15 +318,15 @@ static PyObject *Scrap_CallInScrapPromises(PyObject *_self, PyObject *_args) static PyMethodDef Scrap_methods[] = { {"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1, - "() -> None"}, + PyDoc_STR("() -> None")}, {"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1, - "() -> None"}, + PyDoc_STR("() -> None")}, {"GetCurrentScrap", (PyCFunction)Scrap_GetCurrentScrap, 1, - "() -> (ScrapRef scrap)"}, + PyDoc_STR("() -> (ScrapRef scrap)")}, {"ClearCurrentScrap", (PyCFunction)Scrap_ClearCurrentScrap, 1, - "() -> None"}, + PyDoc_STR("() -> None")}, {"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1, - "() -> None"}, + PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/snd/_Sndihooks.c b/Mac/Modules/snd/_Sndihooks.c index cf0d8e9cde3..74cad9be56d 100644 --- a/Mac/Modules/snd/_Sndihooks.c +++ b/Mac/Modules/snd/_Sndihooks.c @@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "Python.h" -#include "macglue.h" #include "pymactoolbox.h" #include diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c index b8f5c33b241..581bf1e506d 100644 --- a/Mac/Modules/snd/_Sndmodule.c +++ b/Mac/Modules/snd/_Sndmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c index c440640d178..0dd59c6d0db 100644 --- a/Mac/Modules/te/_TEmodule.c +++ b/Mac/Modules/te/_TEmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c index f05e467b0b1..53aff83d2bf 100644 --- a/Mac/Modules/waste/wastemodule.c +++ b/Mac/Modules/waste/wastemodule.c @@ -5,27 +5,19 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ - PyErr_SetString(PyExc_NotImplementedError, \ - "Not available in this shared library/OS version"); \ - return NULL; \ + PyErr_SetString(PyExc_NotImplementedError, \ + "Not available in this shared library/OS version"); \ + return NULL; \ }} while(0) #include #include #include -#ifndef PyDoc_STR -#define PyDoc_STR(x) (x) -#endif /* Exported by Qdmodule.c: */ extern PyObject *QdRGB_New(RGBColor *); diff --git a/Mac/Modules/waste/wastescan.py b/Mac/Modules/waste/wastescan.py index 1d7bdcb1eae..8298f26d095 100644 --- a/Mac/Modules/waste/wastescan.py +++ b/Mac/Modules/waste/wastescan.py @@ -6,7 +6,7 @@ from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner -WASTEDIR='/Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/MacOS Support/(Third Party Support)/Waste 2.0 Distribution/C_C++ Headers/' +WASTEDIR='/Users/jack/src/waste/C_C++ Headers/' if not os.path.exists(WASTEDIR): raise 'Error: not found: %s', WASTEDIR diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c index 5bb0b5ddb0a..e971e31ab20 100644 --- a/Mac/Modules/win/_Winmodule.c +++ b/Mac/Modules/win/_Winmodule.c @@ -5,12 +5,7 @@ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 9f185be9abb..2cfda880f2c 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -29,15 +29,15 @@ This software comes with no warranty. Use at your own risk. #include #endif +#if defined(__APPLE__) +#include "pymactoolbox.h" +#endif + #if defined(MS_WINDOWS) #define WIN32_LEAN_AND_MEAN #include #endif -#if defined(__APPLE__) -#include "macglue.h" -#endif - #ifdef RISCOS char *strdup(const char *); #endif diff --git a/Tools/bgen/bgen/macsupport.py b/Tools/bgen/bgen/macsupport.py index b4885ad4550..eef6db8412d 100644 --- a/Tools/bgen/bgen/macsupport.py +++ b/Tools/bgen/bgen/macsupport.py @@ -142,12 +142,7 @@ UniChar_ptr = InputOnlyType("UniCharPtr", "u") # Stuff added immediately after the system include files includestuff = """ -#ifdef _WIN32 -#include "pywintoolbox.h" -#else -#include "macglue.h" #include "pymactoolbox.h" -#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\\ @@ -200,11 +195,3 @@ class MacModule(Module): "Subclass which gets the exception initializer from macglue.c" def exceptionInitializer(self): return "PyMac_GetOSErrException()" - -_SetOutputFileName = SetOutputFileName # Save original -def SetOutputFileName(file = None): - "Set the output file name and set its creator&type to CWIE&TEXT" - _SetOutputFileName(file) - if file: - import MacOS - MacOS.SetCreatorAndType(file, 'CWIE', 'TEXT')