summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Mac/Modules/ColorPickermodule.c1
-rw-r--r--Mac/Modules/Nav.c1
-rw-r--r--Mac/Modules/OSATerminology.c2
-rw-r--r--Mac/Modules/ae/_AEmodule.c5
-rw-r--r--Mac/Modules/ah/_AHmodule.c5
-rw-r--r--Mac/Modules/app/_Appmodule.c5
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtscan.py1
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtsupport.py56
-rwxr-xr-xMac/Modules/carbonevt/_CarbonEvtmodule.c71
-rw-r--r--Mac/Modules/cf/_CFmodule.c5
-rw-r--r--Mac/Modules/cf/pycfbridge.c2
-rwxr-xr-xMac/Modules/cg/_CGmodule.c5
-rw-r--r--Mac/Modules/cm/_Cmmodule.c5
-rw-r--r--Mac/Modules/ctl/_Ctlmodule.c5
-rw-r--r--Mac/Modules/dlg/_Dlgmodule.c5
-rw-r--r--Mac/Modules/drag/_Dragmodule.c5
-rw-r--r--Mac/Modules/evt/_Evtmodule.c5
-rw-r--r--Mac/Modules/file/_Filemodule.c5
-rw-r--r--Mac/Modules/fm/_Fmmodule.c5
-rw-r--r--Mac/Modules/folder/_Foldermodule.c5
-rw-r--r--Mac/Modules/gestaltmodule.c2
-rw-r--r--Mac/Modules/help/_Helpmodule.c5
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonsupport.py5
-rw-r--r--Mac/Modules/ibcarbon/_IBCarbon.c5
-rw-r--r--Mac/Modules/icgluemodule.c2
-rw-r--r--Mac/Modules/icn/_Icnmodule.c5
-rw-r--r--Mac/Modules/list/_Listmodule.c5
-rw-r--r--Mac/Modules/macosmodule.c3
-rw-r--r--Mac/Modules/menu/_Menumodule.c5
-rw-r--r--Mac/Modules/mlte/_Mltemodule.c5
-rw-r--r--Mac/Modules/qd/_Qdmodule.c5
-rw-r--r--Mac/Modules/qdoffs/_Qdoffsmodule.c5
-rw-r--r--Mac/Modules/qt/_Qtmodule.c5
-rw-r--r--Mac/Modules/res/_Resmodule.c5
-rw-r--r--Mac/Modules/scrap/_Scrapmodule.c40
-rw-r--r--Mac/Modules/snd/_Sndihooks.c1
-rw-r--r--Mac/Modules/snd/_Sndmodule.c5
-rw-r--r--Mac/Modules/te/_TEmodule.c5
-rw-r--r--Mac/Modules/waste/wastemodule.c14
-rw-r--r--Mac/Modules/waste/wastescan.py2
-rw-r--r--Mac/Modules/win/_Winmodule.c5
-rw-r--r--Modules/_localemodule.c8
-rw-r--r--Tools/bgen/bgen/macsupport.py13
43 files changed, 51 insertions, 303 deletions
diff --git a/Mac/Modules/ColorPickermodule.c b/Mac/Modules/ColorPickermodule.c
index ec0afa7..62b4d5f 100644
--- a/Mac/Modules/ColorPickermodule.c
+++ b/Mac/Modules/ColorPickermodule.c
@@ -23,7 +23,6 @@ PERFORMANCE OF THIS SOFTWARE.
#include <Carbon/Carbon.h>
#include "Python.h"
-#include "macglue.h"
#include "pymactoolbox.h"
/* ----------------------------------------------------- */
diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c
index 96c7c20..0041f76 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 <Carbon/Carbon.h>
diff --git a/Mac/Modules/OSATerminology.c b/Mac/Modules/OSATerminology.c
index a3ed4b4..9de0871 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 <Carbon/Carbon.h>
diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c
index fd6582b..01e4246 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 9408e53..160a845 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 2a74325..df91f8f 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 d3088fd..c6bf93f 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 19d7d6d..3cc1672 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 <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()
diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
index 46eb31e..097f11a 100755
--- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c
+++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
@@ -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);
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c
index 8a82d2b..250e7ac 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 3e4b89a..30122dc 100644
--- a/Mac/Modules/cf/pycfbridge.c
+++ b/Mac/Modules/cf/pycfbridge.c
@@ -5,7 +5,7 @@
#include <CoreServices/CoreServices.h>
#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 3971185..0889766 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 f9b1bf7..95a36c0 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 3f12778..9f299a1 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 966e1ff..19ae1e9 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 79f0384..a1f743b 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 9f62a2f..6d86e51 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 f5f48d2..79929c5 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 cba96e0..816775d 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 9c7afc6..bd33b8e 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 8097de8..f82687e 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 <Carbon/Carbon.h>
diff --git a/Mac/Modules/help/_Helpmodule.c b/Mac/Modules/help/_Helpmodule.c
index 8d016a5..0da66cc 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 04d4bc1..5d07be1 100644
--- a/Mac/Modules/ibcarbon/IBCarbonsupport.py
+++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py
@@ -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 = """
diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c
index 1d50db2..ce120c3 100644
--- a/Mac/Modules/ibcarbon/_IBCarbon.c
+++ b/Mac/Modules/ibcarbon/_IBCarbon.c
@@ -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;
diff --git a/Mac/Modules/icgluemodule.c b/Mac/Modules/icgluemodule.c
index ee42c59..fa50f0d 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 7ed2064..bbd59ab 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 cf94801..bfea8a3 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 f5fc23e..271a5aa 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 <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c
index c48edb1..feb9bd2 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 18fdd45..2c972e9f 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 e15f848..793c972 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 5bc0f96..1cb4564 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 fd5db6f..9fc9be2 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 13a9c36..d554a99 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 db8e58b..5ee22eb 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 cf0d8e9..74cad9b 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 <Sound.h>
diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c
index b8f5c33..581bf1e 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 c440640..0dd59c6 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 f05e467..53aff83 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 <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 *);
diff --git a/Mac/Modules/waste/wastescan.py b/Mac/Modules/waste/wastescan.py
index 1d7bdcb..8298f26 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 5bb0b5d..e971e31 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 9f185be..2cfda88 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 <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
diff --git a/Tools/bgen/bgen/macsupport.py b/Tools/bgen/bgen/macsupport.py
index b4885ad..eef6db8 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')