Got rid of macglue.h, replacing it by pymactoolbox.h where relevant.

Cleaned up various things in the toolbox modules.
This commit is contained in:
Jack Jansen 2003-11-20 13:31:00 +00:00
parent 3305d2487d
commit 7107c1aff3
43 changed files with 51 additions and 303 deletions

View File

@ -23,7 +23,6 @@ PERFORMANCE OF THIS SOFTWARE.
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include "Python.h" #include "Python.h"
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
/* ----------------------------------------------------- */ /* ----------------------------------------------------- */

View File

@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
******************************************************************/ ******************************************************************/
#include "Python.h" #include "Python.h"
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>

View File

@ -7,7 +7,7 @@
** by a full interface to OpenScripting. ** by a full interface to OpenScripting.
*/ */
#include "Python.h" #include "Python.h"
#include "macglue.h" #include "pymactoolbox.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -84,7 +84,6 @@ class CarbonEvents_Scanner(Scanner_OSX):
# Wrote by hand # Wrote by hand
"InstallEventHandler", "InstallEventHandler",
"RemoveEventHandler", "RemoveEventHandler",
"RunApplicationEventLoop",
# Write by hand? # Write by hand?
"GetEventParameter", "GetEventParameter",

View File

@ -73,26 +73,9 @@ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
MouseTrackingResult = UInt16 MouseTrackingResult = UInt16
includestuff = r""" includestuff = includestuff + r"""
#include <Carbon/Carbon.h> #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_New(CFStringRef *);
extern int CFStringRef_Convert(PyObject *, CFStringRef *); extern int CFStringRef_Convert(PyObject *, CFStringRef *);
@ -168,11 +151,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
PyObject *retValue; PyObject *retValue;
int status; 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&", retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&",
EventHandlerCallRef_New, handlerRef, EventHandlerCallRef_New, handlerRef,
EventRef_New, event); EventRef_New, event);
@ -190,11 +168,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
Py_DECREF(retValue); Py_DECREF(retValue);
} }
#if USE_MAC_MP_MULTITHREADING
_save = PyEval_SaveThread();
MPExitCriticalRegion(reentrantLock);
#endif /* USE_MAC_MP_MULTITHREADING */
return status; return status;
} }
@ -203,7 +176,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
""" """
initstuff = initstuff + """ initstuff = initstuff + """
PyMac_PRECHECK(NewEventHandlerUPP); /* This can fail if CarbonLib is too old */
myEventHandlerUPP = NewEventHandlerUPP(myEventHandler); myEventHandlerUPP = NewEventHandlerUPP(myEventHandler);
""" """
module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, initstuff) module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, initstuff)
@ -335,32 +307,6 @@ f = ManualGenerator("GetEventParameter", geteventparameter);
f.docstring = lambda: "(EventParamName eventName, EventParamType eventType) -> (String eventParamData)" f.docstring = lambda: "(EventParamName eventName, EventParamType eventType) -> (String eventParamData)"
EventRefobject.add(f) 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') SetOutputFileName('_CarbonEvtmodule.c')
module.generate() module.generate()

View File

@ -5,24 +5,17 @@
#include <Carbon/Carbon.h> #include "pymactoolbox.h"
#include "macglue.h"
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \ PyErr_SetString(PyExc_NotImplementedError, \
"Not available in this shared library/OS version"); \ "Not available in this shared library/OS version"); \
return; \ return NULL; \
}} while(0) }} while(0)
#define USE_MAC_MP_MULTITHREADING 0 #include <Carbon/Carbon.h>
#if USE_MAC_MP_MULTITHREADING
static PyThreadState *_save;
static MPCriticalRegionID reentrantLock;
#endif /* USE_MAC_MP_MULTITHREADING */
extern int CFStringRef_New(CFStringRef *); extern int CFStringRef_New(CFStringRef *);
@ -99,11 +92,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
PyObject *retValue; PyObject *retValue;
int status; 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&", retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&",
EventHandlerCallRef_New, handlerRef, EventHandlerCallRef_New, handlerRef,
EventRef_New, event); EventRef_New, event);
@ -121,11 +109,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
Py_DECREF(retValue); Py_DECREF(retValue);
} }
#if USE_MAC_MP_MULTITHREADING
_save = PyEval_SaveThread();
MPExitCriticalRegion(reentrantLock);
#endif /* USE_MAC_MP_MULTITHREADING */
return status; return status;
} }
@ -1845,6 +1828,17 @@ static PyObject *CarbonEvents_GetEventDispatcherTarget(PyObject *_self, PyObject
return _res; 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) static PyObject *CarbonEvents_QuitApplicationEventLoop(PyObject *_self, PyObject *_args)
{ {
PyObject *_res = NULL; PyObject *_res = NULL;
@ -2042,32 +2036,6 @@ static PyObject *CarbonEvents_RegisterEventHotKey(PyObject *_self, PyObject *_ar
return _res; 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[] = { static PyMethodDef CarbonEvents_methods[] = {
{"GetCurrentEventLoop", (PyCFunction)CarbonEvents_GetCurrentEventLoop, 1, {"GetCurrentEventLoop", (PyCFunction)CarbonEvents_GetCurrentEventLoop, 1,
PyDoc_STR("() -> (EventLoopRef _rv)")}, PyDoc_STR("() -> (EventLoopRef _rv)")},
@ -2103,6 +2071,8 @@ static PyMethodDef CarbonEvents_methods[] = {
PyDoc_STR("() -> (EventTargetRef _rv)")}, PyDoc_STR("() -> (EventTargetRef _rv)")},
{"GetEventDispatcherTarget", (PyCFunction)CarbonEvents_GetEventDispatcherTarget, 1, {"GetEventDispatcherTarget", (PyCFunction)CarbonEvents_GetEventDispatcherTarget, 1,
PyDoc_STR("() -> (EventTargetRef _rv)")}, PyDoc_STR("() -> (EventTargetRef _rv)")},
{"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1,
PyDoc_STR("() -> None")},
{"QuitApplicationEventLoop", (PyCFunction)CarbonEvents_QuitApplicationEventLoop, 1, {"QuitApplicationEventLoop", (PyCFunction)CarbonEvents_QuitApplicationEventLoop, 1,
PyDoc_STR("() -> None")}, PyDoc_STR("() -> None")},
{"RunAppModalLoopForWindow", (PyCFunction)CarbonEvents_RunAppModalLoopForWindow, 1, {"RunAppModalLoopForWindow", (PyCFunction)CarbonEvents_RunAppModalLoopForWindow, 1,
@ -2127,8 +2097,6 @@ static PyMethodDef CarbonEvents_methods[] = {
PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")},
{"RegisterEventHotKey", (PyCFunction)CarbonEvents_RegisterEventHotKey, 1, {"RegisterEventHotKey", (PyCFunction)CarbonEvents_RegisterEventHotKey, 1,
PyDoc_STR("(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) -> (EventHotKeyRef outRef)")}, PyDoc_STR("(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) -> (EventHotKeyRef outRef)")},
{"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1,
PyDoc_STR("() -> ()")},
{NULL, NULL, 0} {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); myEventHandlerUPP = NewEventHandlerUPP(myEventHandler);

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,7 +5,7 @@
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#include "Python.h" #include "Python.h"
#include "macglue.h" #include "pymactoolbox.h"
#include "pycfbridge.h" #include "pycfbridge.h"

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -25,7 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Macintosh Gestalt interface */ /* Macintosh Gestalt interface */
#include "Python.h" #include "Python.h"
#include "macglue.h" #include "pymactoolbox.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -10,15 +10,12 @@ IBCarbonMethod = OSErrMethodGenerator
includestuff = """ includestuff = """
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include "macglue.h" #include "pymactoolbox.h"
#ifdef USE_TOOLBOX_OBJECT_GLUE #ifdef USE_TOOLBOX_OBJECT_GLUE
extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
//#define CFStringRefObj_Convert _CFStringRefObj_Convert
#endif #endif
//extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle
""" """
initstuff = """ initstuff = """

View File

@ -6,15 +6,12 @@
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include "macglue.h" #include "pymactoolbox.h"
#ifdef USE_TOOLBOX_OBJECT_GLUE #ifdef USE_TOOLBOX_OBJECT_GLUE
extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
//#define CFStringRefObj_Convert _CFStringRefObj_Convert
#endif #endif
//extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle
static PyObject *IBCarbon_Error; static PyObject *IBCarbon_Error;

View File

@ -30,7 +30,7 @@ PERFORMANCE OF THIS SOFTWARE.
******************************************************************/ ******************************************************************/
#include "Python.h" #include "Python.h"
#include "macglue.h" #include "pymactoolbox.h"
extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */ extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -25,8 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Macintosh OS-specific interface */ /* Macintosh OS-specific interface */
#include "Python.h" #include "Python.h"
#include "macglue.h" #include "pymactoolbox.h"
#include "pythonresources.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View 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" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \ PyErr_SetString(PyExc_NotImplementedError, \
"Not available in this shared library/OS version"); \ "Not available in this shared library/OS version"); \
return NULL; \ return NULL; \
}} while(0) }} while(0)
@ -31,7 +23,7 @@ static PyObject *Scrap_Error;
PyTypeObject Scrap_Type; 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 { typedef struct ScrapObject {
PyObject_HEAD PyObject_HEAD
@ -60,7 +52,7 @@ int ScrapObj_Convert(PyObject *v, ScrapRef *p_itself)
static void ScrapObj_dealloc(ScrapObject *self) static void ScrapObj_dealloc(ScrapObject *self)
{ {
/* Cleanup of self->ob_itself goes here */ /* 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) static PyObject *ScrapObj_GetScrapFlavorFlags(ScrapObject *_self, PyObject *_args)
@ -208,17 +200,17 @@ static PyObject *ScrapObj_GetScrapFlavorInfoList(ScrapObject *_self, PyObject *_
static PyMethodDef ScrapObj_methods[] = { static PyMethodDef ScrapObj_methods[] = {
{"GetScrapFlavorFlags", (PyCFunction)ScrapObj_GetScrapFlavorFlags, 1, {"GetScrapFlavorFlags", (PyCFunction)ScrapObj_GetScrapFlavorFlags, 1,
"(ScrapFlavorType flavorType) -> (ScrapFlavorFlags flavorFlags)"}, PyDoc_STR("(ScrapFlavorType flavorType) -> (ScrapFlavorFlags flavorFlags)")},
{"GetScrapFlavorSize", (PyCFunction)ScrapObj_GetScrapFlavorSize, 1, {"GetScrapFlavorSize", (PyCFunction)ScrapObj_GetScrapFlavorSize, 1,
"(ScrapFlavorType flavorType) -> (Size byteCount)"}, PyDoc_STR("(ScrapFlavorType flavorType) -> (Size byteCount)")},
{"GetScrapFlavorData", (PyCFunction)ScrapObj_GetScrapFlavorData, 1, {"GetScrapFlavorData", (PyCFunction)ScrapObj_GetScrapFlavorData, 1,
"(ScrapFlavorType flavorType) -> string"}, PyDoc_STR("(ScrapFlavorType flavorType, Buffer destination) -> (Size byteCount)")},
{"PutScrapFlavor", (PyCFunction)ScrapObj_PutScrapFlavor, 1, {"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, {"GetScrapFlavorCount", (PyCFunction)ScrapObj_GetScrapFlavorCount, 1,
"() -> (UInt32 infoCount)"}, PyDoc_STR("() -> (UInt32 infoCount)")},
{"GetScrapFlavorInfoList", (PyCFunction)ScrapObj_GetScrapFlavorInfoList, 1, {"GetScrapFlavorInfoList", (PyCFunction)ScrapObj_GetScrapFlavorInfoList, 1,
"() -> ([(ScrapFlavorType, ScrapFlavorInfo), ...])"}, PyDoc_STR("() -> ([(ScrapFlavorType, ScrapFlavorInfo), ...])")},
{NULL, NULL, 0} {NULL, NULL, 0}
}; };
@ -326,15 +318,15 @@ static PyObject *Scrap_CallInScrapPromises(PyObject *_self, PyObject *_args)
static PyMethodDef Scrap_methods[] = { static PyMethodDef Scrap_methods[] = {
{"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1, {"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1,
"() -> None"}, PyDoc_STR("() -> None")},
{"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1, {"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1,
"() -> None"}, PyDoc_STR("() -> None")},
{"GetCurrentScrap", (PyCFunction)Scrap_GetCurrentScrap, 1, {"GetCurrentScrap", (PyCFunction)Scrap_GetCurrentScrap, 1,
"() -> (ScrapRef scrap)"}, PyDoc_STR("() -> (ScrapRef scrap)")},
{"ClearCurrentScrap", (PyCFunction)Scrap_ClearCurrentScrap, 1, {"ClearCurrentScrap", (PyCFunction)Scrap_ClearCurrentScrap, 1,
"() -> None"}, PyDoc_STR("() -> None")},
{"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1, {"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1,
"() -> None"}, PyDoc_STR("() -> None")},
{NULL, NULL, 0} {NULL, NULL, 0}
}; };

View File

@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
******************************************************************/ ******************************************************************/
#include "Python.h" #include "Python.h"
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#include <Sound.h> #include <Sound.h>

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,27 +5,19 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \ PyErr_SetString(PyExc_NotImplementedError, \
"Not available in this shared library/OS version"); \ "Not available in this shared library/OS version"); \
return NULL; \ return NULL; \
}} while(0) }} while(0)
#include <WASTE.h> #include <WASTE.h>
#include <WEObjectHandlers.h> #include <WEObjectHandlers.h>
#include <WETabs.h> #include <WETabs.h>
#ifndef PyDoc_STR
#define PyDoc_STR(x) (x)
#endif
/* Exported by Qdmodule.c: */ /* Exported by Qdmodule.c: */
extern PyObject *QdRGB_New(RGBColor *); extern PyObject *QdRGB_New(RGBColor *);

View File

@ -6,7 +6,7 @@ from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR) sys.path.append(BGENDIR)
from scantools import Scanner 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): if not os.path.exists(WASTEDIR):
raise 'Error: not found: %s', WASTEDIR raise 'Error: not found: %s', WASTEDIR

View File

@ -5,12 +5,7 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -29,15 +29,15 @@ This software comes with no warranty. Use at your own risk.
#include <wchar.h> #include <wchar.h>
#endif #endif
#if defined(__APPLE__)
#include "pymactoolbox.h"
#endif
#if defined(MS_WINDOWS) #if defined(MS_WINDOWS)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(__APPLE__)
#include "macglue.h"
#endif
#ifdef RISCOS #ifdef RISCOS
char *strdup(const char *); char *strdup(const char *);
#endif #endif

View File

@ -142,12 +142,7 @@ UniChar_ptr = InputOnlyType("UniCharPtr", "u")
# Stuff added immediately after the system include files # Stuff added immediately after the system include files
includestuff = """ includestuff = """
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h" #include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */ /* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\\ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\\
@ -200,11 +195,3 @@ class MacModule(Module):
"Subclass which gets the exception initializer from macglue.c" "Subclass which gets the exception initializer from macglue.c"
def exceptionInitializer(self): def exceptionInitializer(self):
return "PyMac_GetOSErrException()" 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')