]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Got rid of macglue.h, replacing it by pymactoolbox.h where relevant.
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 20 Nov 2003 13:31:00 +0000 (13:31 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 20 Nov 2003 13:31:00 +0000 (13:31 +0000)
Cleaned up various things in the toolbox modules.

43 files changed:
Mac/Modules/ColorPickermodule.c
Mac/Modules/Nav.c
Mac/Modules/OSATerminology.c
Mac/Modules/ae/_AEmodule.c
Mac/Modules/ah/_AHmodule.c
Mac/Modules/app/_Appmodule.c
Mac/Modules/carbonevt/CarbonEvtscan.py
Mac/Modules/carbonevt/CarbonEvtsupport.py
Mac/Modules/carbonevt/_CarbonEvtmodule.c
Mac/Modules/cf/_CFmodule.c
Mac/Modules/cf/pycfbridge.c
Mac/Modules/cg/_CGmodule.c
Mac/Modules/cm/_Cmmodule.c
Mac/Modules/ctl/_Ctlmodule.c
Mac/Modules/dlg/_Dlgmodule.c
Mac/Modules/drag/_Dragmodule.c
Mac/Modules/evt/_Evtmodule.c
Mac/Modules/file/_Filemodule.c
Mac/Modules/fm/_Fmmodule.c
Mac/Modules/folder/_Foldermodule.c
Mac/Modules/gestaltmodule.c
Mac/Modules/help/_Helpmodule.c
Mac/Modules/ibcarbon/IBCarbonsupport.py
Mac/Modules/ibcarbon/_IBCarbon.c
Mac/Modules/icgluemodule.c
Mac/Modules/icn/_Icnmodule.c
Mac/Modules/list/_Listmodule.c
Mac/Modules/macosmodule.c
Mac/Modules/menu/_Menumodule.c
Mac/Modules/mlte/_Mltemodule.c
Mac/Modules/qd/_Qdmodule.c
Mac/Modules/qdoffs/_Qdoffsmodule.c
Mac/Modules/qt/_Qtmodule.c
Mac/Modules/res/_Resmodule.c
Mac/Modules/scrap/_Scrapmodule.c
Mac/Modules/snd/_Sndihooks.c
Mac/Modules/snd/_Sndmodule.c
Mac/Modules/te/_TEmodule.c
Mac/Modules/waste/wastemodule.c
Mac/Modules/waste/wastescan.py
Mac/Modules/win/_Winmodule.c
Modules/_localemodule.c
Tools/bgen/bgen/macsupport.py

index ec0afa74c5ce733453c931f43248da7fa3657399..62b4d5f6417417763eafb8f31dd9e659affb05cf 100644 (file)
@@ -23,7 +23,6 @@ PERFORMANCE OF THIS SOFTWARE.
 
 #include <Carbon/Carbon.h>
 #include "Python.h"
-#include "macglue.h"
 #include "pymactoolbox.h"
 
 /* ----------------------------------------------------- */
index 96c7c204395b7a94147d713efed12762e73ad5bc..0041f765aea95403e9fc4066b91762c56af16357 100644 (file)
@@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
 ******************************************************************/
 
 #include "Python.h"
-#include "macglue.h"
 #include "pymactoolbox.h"
 #include <Carbon/Carbon.h>
 
index a3ed4b4340a2d5328530863550f3813f22c6d020..9de087122e99f9c03ffa7d1a656ccf9ea5c08e03 100644 (file)
@@ -7,7 +7,7 @@
 ** by a full interface to OpenScripting.
 */
 #include "Python.h"
-#include "macglue.h"
+#include "pymactoolbox.h"
 
 #include <Carbon/Carbon.h>
 
index fd6582b74a08af7206e6238bbc4fe13c26cef6c8..01e4246b6541820d7da5ad77d77a5e7c746d1caf 100644 (file)
@@ -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 )  {\
index 9408e530836bc478217c2e17a2fc0f141a0898e3..160a845fe39b597aa5168e5ac8df51b9a2e287e5 100644 (file)
@@ -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 )  {\
index 2a743250c09a76c318e91783a694934930a0c44b..df91f8f2dbf8839ebecafae82d6d5dfbec9fa4f4 100644 (file)
@@ -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 )  {\
index d3088fd0f2300e328ca491ef66f2bd481f6165c2..c6bf93f1a24d029d49f8f51ba46ff59d21d202b1 100644 (file)
@@ -84,7 +84,6 @@ class CarbonEvents_Scanner(Scanner_OSX):
                        # Wrote by hand
                        "InstallEventHandler",
                        "RemoveEventHandler",
-                       "RunApplicationEventLoop",
                                                
                        # Write by hand?
                        "GetEventParameter",
index 19d7d6d6fd2f429686ccd9f22520d8e095899a5f..3cc1672fbb77ab02b813fd2a9887d526af6d48ac 100644 (file)
@@ -73,26 +73,9 @@ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
 MouseTrackingResult = UInt16
 
 
-includestuff = r"""
+includestuff = includestuff + r"""
 #include <Carbon/Carbon.h>
 
-#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()
 
index 46eb31e414b4f6a96e1c2429eda87d771c4ce556..097f11a6a2f25a4ce59258d0c91df9d5625e4ee4 100755 (executable)
@@ -5,24 +5,17 @@
 
 
 
-#include <Carbon/Carbon.h>
-
-#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 <Carbon/Carbon.h>
 
 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);
 
 
index 8a82d2bd79c3c2b497814d307785617a0bee1473..250e7acffce6d47a20b668cb75d2b791d864e49b 100644 (file)
@@ -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 )  {\
index 3e4b89a77d8a27256b706362add89ff9d74a2c93..30122dcdd06f4a2b18be85a53d91359873d15b59 100644 (file)
@@ -5,7 +5,7 @@
 #include <CoreServices/CoreServices.h>
 
 #include "Python.h"
-#include "macglue.h"
+#include "pymactoolbox.h"
 #include "pycfbridge.h"
 
 
index 39711858631cccede2cac66638b43256654c4a73..088976643ef0b8afbd614b1de53407fb63d4fdc2 100755 (executable)
@@ -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 )  {\
index f9b1bf7b959696ef72dd59b04341a92e6518838a..95a36c06f9927788cfc4a738a757805a32ca5b68 100644 (file)
@@ -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 )  {\
index 3f127788aaae7f53fcc07043f8285bc70fc63fcb..9f299a18e3e069ecc2491d00da000809e71ec498 100644 (file)
@@ -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 )  {\
index 966e1ff752545d8b0d3ab22aa99fb648251fe834..19ae1e9211eeae08b2d5550d02b81662f9ea6eb7 100644 (file)
@@ -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 )  {\
index 79f03849cf6a464bca35b598dacdc0fe2d25e06d..a1f743b4f3af863900b1a5b9000ad3191ab6c07a 100644 (file)
@@ -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 )  {\
index 9f62a2f7c9900f348c205508e122a624c65c11b7..6d86e510f805399624b80c7788fd6b8ab84fd1e9 100644 (file)
@@ -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 )  {\
index f5f48d2dce836bc0425198ae3ae8ace5d4fd6772..79929c59ce0c4a50569f8c73ef56f3c88510e029 100644 (file)
@@ -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 )  {\
index cba96e02fea64f34f793d2a5c1d26b791af29acc..816775d695258ec2db57d858fbc4ade5965e6a88 100644 (file)
@@ -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 )  {\
index 9c7afc666be4014d3426dd80fcc45265c2a19d5c..bd33b8e10dd8289fae40bfad2484fef5e772495d 100644 (file)
@@ -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 )  {\
index 8097de82dc87d9f48543813fd4e752533363ef35..f82687e2161028ac25c9ddb58da5db93cb068423 100644 (file)
@@ -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 <Carbon/Carbon.h>
 
index 8d016a5080b01829b9e9c1607c258ffe786e4b13..0da66cc0dd9e7d88559fa2840d6b52c897eb9412 100644 (file)
@@ -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 )  {\
index 04d4bc135ceee1f9bb0be0a1b28fbe6d5df20450..5d07be1239e5d74ab3f52c9b2a96ff6a12160c41 100644 (file)
@@ -10,15 +10,12 @@ IBCarbonMethod = OSErrMethodGenerator
 
 includestuff = """
 #include <Carbon/Carbon.h>
-#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 = """
index 1d50db2ba4280ca71b2f9c186c1dcc2ce9366960..ce120c3b9e60076b912ce7bbb75293048cddacc8 100644 (file)
@@ -6,15 +6,12 @@
 
 
 #include <Carbon/Carbon.h>
-#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;
 
index ee42c59fc047db3d2688e50937b6e3c418f72993..fa50f0d4631999d628966b6668951756dcb6e6e4 100644 (file)
@@ -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 */
 
index 7ed2064e0a3cd5674e51a4937cd41a6d4ff5edc9..bbd59ab18912b4d5de1ccec69bcb10501b13f6ef 100644 (file)
@@ -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 )  {\
index cf9480198d8b6ac576facca74f1d9bbc1557137c..bfea8a3591017ebbf07ffd7935cfd944367be1cf 100644 (file)
@@ -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 )  {\
index f5fc23e6dbc4a9ae7267be890c9518c73ddd51e7..271a5aa3d3910ff0b6f83084f7e437f0ceb55478 100644 (file)
@@ -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 <Carbon/Carbon.h>
 #include <ApplicationServices/ApplicationServices.h>
index c48edb140531b00b9bab16aed61c535d0962e4e2..feb9bd26cccd7d3ed7c54c39354ea2dbe4071e97 100644 (file)
@@ -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 )  {\
index 18fdd45bc6e228fd25a0684bc2eb0e2f736214d4..2c972e9f80baae9203d28db525796a7d6010662f 100644 (file)
@@ -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 )  {\
index e15f84870df21ac91fb90cb6fa3e84b3787358da..793c9721be2f863a9c7ffefcaa48e949a015a940 100644 (file)
@@ -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 )  {\
index 5bc0f968b2aa4b015a5d75d8a6e8255d57a8d6f2..1cb4564c5dd0ef87505a50080bb1d2d0225bda61 100644 (file)
@@ -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 )  {\
index fd5db6fa2ae673b897e86bc82355a722cd193e14..9fc9be2664cb0d294b7fcb43280e71b6fdbbe250 100644 (file)
@@ -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 )  {\
index 13a9c36ed866f0c658767a19a16e6bf34ddf9e5c..d554a99b508a6f96ab392920033733f5b30479b1 100644 (file)
@@ -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 )  {\
index db8e58be24bd420a914afc1fa77d6b054ad59c0e..5ee22eba3403193ea6befd6b0f7968f9d7759b4c 100644 (file)
@@ -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}
 };
 
index cf0d8e9cde342412f544f3e9c368aa31a4da1fbc..74cad9be56d7c3f3fdc985eab4a803bbae081b7e 100644 (file)
@@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
 ******************************************************************/
 
 #include "Python.h"
-#include "macglue.h"
 #include "pymactoolbox.h"
 #include <Sound.h>
 
index b8f5c33b241a23baec6ce6d625c10edee6989e79..581bf1e506db2b6a12c24f70c55e51828465328f 100644 (file)
@@ -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 )  {\
index c440640d17812f10fbbf28804fa84055020d3d25..0dd59c6d0dbe8ce210f68bc2ec3023b383b655c0 100644 (file)
@@ -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 )  {\
index f05e467b0b19fc0b72436d160f4c7a2b7dbcc71a..53aff83d2bfd303ab8c8020a71316f12f0b69fdc 100644 (file)
@@ -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 <WASTE.h>
 #include <WEObjectHandlers.h>
 #include <WETabs.h>
-#ifndef PyDoc_STR
-#define PyDoc_STR(x) (x)
-#endif
 
 /* Exported by Qdmodule.c: */
 extern PyObject *QdRGB_New(RGBColor *);
index 1d7bdcb1eae6a1cf9dd0bb9ca1cb808e427bd57e..8298f26d095b9c00690b450652e5e2a82523cd7d 100644 (file)
@@ -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
index 5bb0b5ddb0abc25826f4902f91b53bf9f3224de8..e971e31ab20969690b3252e1e33b1e9806b8e2cf 100644 (file)
@@ -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 )  {\
index 9f185be9abbd1a7c0c1d260b45f8085139d607e1..2cfda880f2c27e22750b5df1ff09884e9e4cf474 100644 (file)
@@ -29,15 +29,15 @@ This software comes with no warranty. Use at your own risk.
 #include <wchar.h>
 #endif
 
+#if defined(__APPLE__)
+#include "pymactoolbox.h"
+#endif
+
 #if defined(MS_WINDOWS)
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 
-#if defined(__APPLE__)
-#include "macglue.h"
-#endif
-
 #ifdef RISCOS
 char *strdup(const char *);
 #endif
index b4885ad45507014996323029833113e2c8a54502..eef6db8412d060231cc37f03b4e0665cc2726e4b 100644 (file)
@@ -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')