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:
parent
3305d2487d
commit
7107c1aff3
|
@ -23,7 +23,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include "Python.h"
|
||||
#include "macglue.h"
|
||||
#include "pymactoolbox.h"
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
|
|
@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
|||
******************************************************************/
|
||||
|
||||
#include "Python.h"
|
||||
#include "macglue.h"
|
||||
#include "pymactoolbox.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
** by a full interface to OpenScripting.
|
||||
*/
|
||||
#include "Python.h"
|
||||
#include "macglue.h"
|
||||
#include "pymactoolbox.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -84,7 +84,6 @@ class CarbonEvents_Scanner(Scanner_OSX):
|
|||
# Wrote by hand
|
||||
"InstallEventHandler",
|
||||
"RemoveEventHandler",
|
||||
"RunApplicationEventLoop",
|
||||
|
||||
# Write by hand?
|
||||
"GetEventParameter",
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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; \
|
||||
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);
|
||||
|
||||
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
#include "Python.h"
|
||||
#include "macglue.h"
|
||||
#include "pymactoolbox.h"
|
||||
#include "pycfbridge.h"
|
||||
|
||||
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 = """
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -5,15 +5,7 @@
|
|||
|
||||
|
||||
|
||||
#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 ) {\
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
|||
******************************************************************/
|
||||
|
||||
#include "Python.h"
|
||||
#include "macglue.h"
|
||||
#include "pymactoolbox.h"
|
||||
#include <Sound.h>
|
||||
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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 ) {\
|
||||
|
@ -23,9 +18,6 @@
|
|||
#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 *);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ) {\
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue