Getting rid of code conditional on TARGET_API_MAC_*.
This commit is contained in:
parent
9588770e25
commit
a53f4eba19
|
@ -23,14 +23,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
******************************************************************/
|
||||
#ifndef Py_MACGLUE_H
|
||||
#define Py_MACGLUE_H
|
||||
#ifdef WITHOUT_FRAMEWORKS
|
||||
#include <Types.h>
|
||||
#include <Files.h>
|
||||
#include <Events.h>
|
||||
#include <StandardFile.h>
|
||||
#else
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#include "pymactoolbox.h"
|
||||
|
||||
|
@ -49,11 +42,6 @@ typedef struct {
|
|||
|
||||
unsigned char *Pstring(char *str); /* Convert c-string to pascal-string in static buffer */
|
||||
|
||||
#ifdef USE_GUSI
|
||||
extern int PyMac_ConsoleIsDead; /* True when exiting */
|
||||
extern void PyMac_StopGUSISpin(void); /* Stop eventprocessing during exit() */
|
||||
#endif
|
||||
|
||||
extern short PyMac_AppRefNum; /* RefNum of application rsrcfork (from macmain.c) */
|
||||
extern FSSpec PyMac_ApplicationFSSpec; /* Application location (from macargv.c) */
|
||||
extern char PyMac_ApplicationPath[]; /* Application location (from macargv.c) */
|
||||
|
@ -63,20 +51,10 @@ extern int PyMac_GetArgv(char ***, int); /* Get argc, argv (from macargv.c) */
|
|||
extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
|
||||
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
void PyMac_GetSchedParams(PyMacSchedParams *); /* Get schedulers params */
|
||||
void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */
|
||||
int PyMac_DoYield(int, int); /* Yield cpu. First arg is maxtime, second ok to call python */
|
||||
#endif
|
||||
int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */
|
||||
void PyMac_HandleEventIntern(EventRecord *); /* Handle one event internal only */
|
||||
int PyMac_SetEventHandler(PyObject *); /* set python-coded event handler */
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
void PyMac_InitMenuBar(void); /* Setup menu bar as we want it */
|
||||
void PyMac_RestoreMenuBar(void); /* Restore menu bar for ease of exiting */
|
||||
void PyMac_RaiseConsoleWindow(); /* Bring console window to front, if it exists */
|
||||
#endif
|
||||
int PyMac_FindResourceModule(PyStringObject *, char *, char *); /* Test for 'PYC ' resource in a file */
|
||||
PyObject * PyMac_LoadResourceModule(char *, char *); /* Load 'PYC ' resource from file */
|
||||
int PyMac_FindCodeResourceModule(PyStringObject *, char *, char *); /* Test for 'PYD ' resource in a file */
|
||||
|
@ -86,10 +64,6 @@ struct filedescr *PyMac_FindModuleExtension(char *, size_t *, char *); /* Look f
|
|||
void PyMac_InitApplet(void); /* Initialize and run an Applet */
|
||||
void PyMac_Initialize(void); /* Initialize function for embedding Python */
|
||||
|
||||
#ifdef USE_GUSI2
|
||||
short PyMac_OpenPrefFile(void); /* From macgetpath.c, open and return preference file */
|
||||
#endif
|
||||
|
||||
|
||||
/* From macfiletype.c: */
|
||||
|
||||
|
@ -102,33 +76,11 @@ void PyMac_InitApplication(void);
|
|||
void PyMac_OutputSeen(void);
|
||||
void PyMac_OutputNotSeen(void);
|
||||
int PyMac_GetDelayConsoleFlag(void);
|
||||
#ifdef USE_MAC_APPLET_SUPPORT
|
||||
void PyMac_InitApplet(void);
|
||||
#endif
|
||||
|
||||
/* from macgetargv: */
|
||||
OSErr PyMac_init_process_location(void);
|
||||
char * strdup(const char *str);
|
||||
|
||||
#ifdef USE_GUSI2
|
||||
/* from pyGUSISIOUX.cp */
|
||||
typedef long (*PyWriteHandler)(char *buffer, long n);
|
||||
typedef long (*PyReadHandler)(char *buffer, long n);
|
||||
|
||||
/* Override routines that normally reads and writes to the
|
||||
** SIOUX console window. Intended for embedding applications
|
||||
** that want to forestall a Python console window ever showing up.
|
||||
*/
|
||||
void PyMac_SetConsoleHandler(PyReadHandler stdinH, PyWriteHandler stdoutH,
|
||||
PyWriteHandler stderrH);
|
||||
|
||||
/* Courtesy console handlers that drop all output and return
|
||||
** 0 on reads.
|
||||
*/
|
||||
long PyMac_DummyReadHandler(char *, long);
|
||||
long PyMac_DummyWriteHandler(char *, long);
|
||||
#endif /* USE_GUSI2 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
}} while(0)
|
||||
|
||||
|
||||
#ifndef PyDoc_STR
|
||||
#define PyDoc_STR(x) (x)
|
||||
#endif
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#ifdef USE_TOOLBOX_OBJECT_GLUE
|
||||
|
@ -44,12 +41,6 @@ static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHand
|
|||
{
|
||||
if ( PyOS_InterruptOccurred() )
|
||||
return 1;
|
||||
#if !TARGET_API_MAC_OSX
|
||||
if ( PyMac_HandleEvent(theEvent) < 0 ) {
|
||||
PySys_WriteStderr("Exception in user event handler during AE processing\n");
|
||||
PyErr_Clear();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,12 +103,6 @@ static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHand
|
|||
{
|
||||
if ( PyOS_InterruptOccurred() )
|
||||
return 1;
|
||||
#if !TARGET_API_MAC_OSX
|
||||
if ( PyMac_HandleEvent(theEvent) < 0 ) {
|
||||
PySys_WriteStderr("Exception in user event handler during AE processing\\n");
|
||||
PyErr_Clear();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,113 +22,6 @@
|
|||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
/* This code is adapted from the CallMachOFramework demo at:
|
||||
http://developer.apple.com/samplecode/Sample_Code/Runtime_Architecture/CallMachOFramework.htm
|
||||
It allows us to call Mach-O functions from CFM apps. */
|
||||
|
||||
#include <Folders.h>
|
||||
#include "CFMLateImport.h"
|
||||
|
||||
static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr)
|
||||
// This routine finds a the named framework and creates a CFBundle
|
||||
// object for it. It looks for the framework in the frameworks folder,
|
||||
// as defined by the Folder Manager. Currently this is
|
||||
// "/System/Library/Frameworks", but we recommend that you avoid hard coded
|
||||
// paths to ensure future compatibility.
|
||||
//
|
||||
// You might think that you could use CFBundleGetBundleWithIdentifier but
|
||||
// that only finds bundles that are already loaded into your context.
|
||||
// That would work in the case of the System framework but it wouldn't
|
||||
// work if you're using some other, less-obvious, framework.
|
||||
{
|
||||
OSStatus err;
|
||||
FSRef frameworksFolderRef;
|
||||
CFURLRef baseURL;
|
||||
CFURLRef bundleURL;
|
||||
|
||||
*bundlePtr = nil;
|
||||
|
||||
baseURL = nil;
|
||||
bundleURL = nil;
|
||||
|
||||
// Find the frameworks folder and create a URL for it.
|
||||
|
||||
err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef);
|
||||
if (err == noErr) {
|
||||
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
|
||||
if (baseURL == nil) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the name of the framework to the URL.
|
||||
|
||||
if (err == noErr) {
|
||||
bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false);
|
||||
if (bundleURL == nil) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a bundle based on that URL and load the bundle into memory.
|
||||
// We never unload the bundle, which is reasonable in this case because
|
||||
// the sample assumes that you'll be calling functions from this
|
||||
// framework throughout the life of your application.
|
||||
|
||||
if (err == noErr) {
|
||||
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
|
||||
if (*bundlePtr == nil) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
if (err == noErr) {
|
||||
if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up.
|
||||
|
||||
if (err != noErr && *bundlePtr != nil) {
|
||||
CFRelease(*bundlePtr);
|
||||
*bundlePtr = nil;
|
||||
}
|
||||
if (bundleURL != nil) {
|
||||
CFRelease(bundleURL);
|
||||
}
|
||||
if (baseURL != nil) {
|
||||
CFRelease(baseURL);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// The CFMLateImport approach requires that you define a fragment
|
||||
// initialisation routine that latches the fragment's connection
|
||||
// ID and locator. If your code already has a fragment initialiser
|
||||
// you will have to integrate the following into it.
|
||||
|
||||
static CFragConnectionID gFragToFixConnID;
|
||||
static FSSpec gFragToFixFile;
|
||||
static CFragSystem7DiskFlatLocator gFragToFixLocator;
|
||||
|
||||
extern OSErr FragmentInit(const CFragInitBlock *initBlock);
|
||||
extern OSErr FragmentInit(const CFragInitBlock *initBlock)
|
||||
{
|
||||
__initialize(initBlock); /* call the "original" initializer */
|
||||
gFragToFixConnID = (CFragConnectionID) initBlock->closureID;
|
||||
gFragToFixFile = *(initBlock->fragLocator.u.onDisk.fileSpec);
|
||||
gFragToFixLocator = initBlock->fragLocator.u.onDisk;
|
||||
gFragToFixLocator.fileSpec = &gFragToFixFile;
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extern int GrafObj_Convert(PyObject *, GrafPtr *);
|
||||
|
||||
/*
|
||||
|
@ -1369,23 +1262,6 @@ void init_CG(void)
|
|||
|
||||
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
CFBundleRef sysBundle;
|
||||
OSStatus err;
|
||||
|
||||
if (&LoadFrameworkBundle == NULL) {
|
||||
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
|
||||
return;
|
||||
}
|
||||
err = LoadFrameworkBundle(CFSTR("ApplicationServices.framework"), &sysBundle);
|
||||
if (err == noErr)
|
||||
err = CFMLateImportBundle(&gFragToFixLocator, gFragToFixConnID, FragmentInit, "\pCGStubLib", sysBundle);
|
||||
if (err != noErr) {
|
||||
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
|
||||
return;
|
||||
};
|
||||
#endif /* !TARGET_API_MAC_OSX */
|
||||
|
||||
|
||||
m = Py_InitModule("_CG", CG_methods);
|
||||
d = PyModule_GetDict(m);
|
||||
|
|
|
@ -25,113 +25,6 @@ RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
|
|||
includestuff = includestuff + """
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
/* This code is adapted from the CallMachOFramework demo at:
|
||||
http://developer.apple.com/samplecode/Sample_Code/Runtime_Architecture/CallMachOFramework.htm
|
||||
It allows us to call Mach-O functions from CFM apps. */
|
||||
|
||||
#include <Folders.h>
|
||||
#include "CFMLateImport.h"
|
||||
|
||||
static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr)
|
||||
// This routine finds a the named framework and creates a CFBundle
|
||||
// object for it. It looks for the framework in the frameworks folder,
|
||||
// as defined by the Folder Manager. Currently this is
|
||||
// "/System/Library/Frameworks", but we recommend that you avoid hard coded
|
||||
// paths to ensure future compatibility.
|
||||
//
|
||||
// You might think that you could use CFBundleGetBundleWithIdentifier but
|
||||
// that only finds bundles that are already loaded into your context.
|
||||
// That would work in the case of the System framework but it wouldn't
|
||||
// work if you're using some other, less-obvious, framework.
|
||||
{
|
||||
OSStatus err;
|
||||
FSRef frameworksFolderRef;
|
||||
CFURLRef baseURL;
|
||||
CFURLRef bundleURL;
|
||||
|
||||
*bundlePtr = nil;
|
||||
|
||||
baseURL = nil;
|
||||
bundleURL = nil;
|
||||
|
||||
// Find the frameworks folder and create a URL for it.
|
||||
|
||||
err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef);
|
||||
if (err == noErr) {
|
||||
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
|
||||
if (baseURL == nil) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the name of the framework to the URL.
|
||||
|
||||
if (err == noErr) {
|
||||
bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false);
|
||||
if (bundleURL == nil) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a bundle based on that URL and load the bundle into memory.
|
||||
// We never unload the bundle, which is reasonable in this case because
|
||||
// the sample assumes that you'll be calling functions from this
|
||||
// framework throughout the life of your application.
|
||||
|
||||
if (err == noErr) {
|
||||
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
|
||||
if (*bundlePtr == nil) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
if (err == noErr) {
|
||||
if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
|
||||
err = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up.
|
||||
|
||||
if (err != noErr && *bundlePtr != nil) {
|
||||
CFRelease(*bundlePtr);
|
||||
*bundlePtr = nil;
|
||||
}
|
||||
if (bundleURL != nil) {
|
||||
CFRelease(bundleURL);
|
||||
}
|
||||
if (baseURL != nil) {
|
||||
CFRelease(baseURL);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// The CFMLateImport approach requires that you define a fragment
|
||||
// initialisation routine that latches the fragment's connection
|
||||
// ID and locator. If your code already has a fragment initialiser
|
||||
// you will have to integrate the following into it.
|
||||
|
||||
static CFragConnectionID gFragToFixConnID;
|
||||
static FSSpec gFragToFixFile;
|
||||
static CFragSystem7DiskFlatLocator gFragToFixLocator;
|
||||
|
||||
extern OSErr FragmentInit(const CFragInitBlock *initBlock);
|
||||
extern OSErr FragmentInit(const CFragInitBlock *initBlock)
|
||||
{
|
||||
__initialize(initBlock); /* call the "original" initializer */
|
||||
gFragToFixConnID = (CFragConnectionID) initBlock->closureID;
|
||||
gFragToFixFile = *(initBlock->fragLocator.u.onDisk.fileSpec);
|
||||
gFragToFixLocator = initBlock->fragLocator.u.onDisk;
|
||||
gFragToFixLocator.fileSpec = &gFragToFixFile;
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extern int GrafObj_Convert(PyObject *, GrafPtr *);
|
||||
|
||||
/*
|
||||
|
@ -205,25 +98,6 @@ CGAffineTransform_Convert(PyObject *v, CGAffineTransform *p_itself)
|
|||
}
|
||||
"""
|
||||
|
||||
initstuff = initstuff + """
|
||||
#if !TARGET_API_MAC_OSX
|
||||
CFBundleRef sysBundle;
|
||||
OSStatus err;
|
||||
|
||||
if (&LoadFrameworkBundle == NULL) {
|
||||
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
|
||||
return;
|
||||
}
|
||||
err = LoadFrameworkBundle(CFSTR("ApplicationServices.framework"), &sysBundle);
|
||||
if (err == noErr)
|
||||
err = CFMLateImportBundle(&gFragToFixLocator, gFragToFixConnID, FragmentInit, "\pCGStubLib", sysBundle);
|
||||
if (err != noErr) {
|
||||
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
|
||||
return;
|
||||
};
|
||||
#endif /* !TARGET_API_MAC_OSX */
|
||||
"""
|
||||
|
||||
class MyOpaqueByValueType(OpaqueByValueType):
|
||||
"""Sort of a mix between OpaqueByValueType and OpaqueType."""
|
||||
def mkvalueArgs(self, name):
|
||||
|
|
|
@ -306,8 +306,6 @@ static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_ar
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -322,9 +320,6 @@ static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args)
|
|||
_rv);
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -341,9 +336,6 @@ static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args)
|
|||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -360,7 +352,6 @@ static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args)
|
|||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -2461,8 +2452,6 @@ static PyObject *CtlObj_SetDataBrowserEditText(ControlObject *_self, PyObject *_
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -2480,7 +2469,6 @@ static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *
|
|||
CFStringRefObj_New, text);
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *CtlObj_GetDataBrowserEditText(ControlObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -3508,21 +3496,12 @@ static PyMethodDef CtlObj_methods[] = {
|
|||
PyDoc_STR("() -> None")},
|
||||
{"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1,
|
||||
PyDoc_STR("(Boolean inIsVisible, Boolean inDoDraw) -> None")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"IsControlEnabled", (PyCFunction)CtlObj_IsControlEnabled, 1,
|
||||
PyDoc_STR("() -> (Boolean _rv)")},
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"EnableControl", (PyCFunction)CtlObj_EnableControl, 1,
|
||||
PyDoc_STR("() -> None")},
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"DisableControl", (PyCFunction)CtlObj_DisableControl, 1,
|
||||
PyDoc_STR("() -> None")},
|
||||
#endif
|
||||
{"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1,
|
||||
PyDoc_STR("() -> None")},
|
||||
{"GetBestControlRect", (PyCFunction)CtlObj_GetBestControlRect, 1,
|
||||
|
@ -3745,11 +3724,8 @@ static PyMethodDef CtlObj_methods[] = {
|
|||
PyDoc_STR("(UInt32 property) -> (UInt32 flags)")},
|
||||
{"SetDataBrowserEditText", (PyCFunction)CtlObj_SetDataBrowserEditText, 1,
|
||||
PyDoc_STR("(CFStringRef text) -> None")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"CopyDataBrowserEditText", (PyCFunction)CtlObj_CopyDataBrowserEditText, 1,
|
||||
PyDoc_STR("() -> (CFStringRef text)")},
|
||||
#endif
|
||||
{"GetDataBrowserEditText", (PyCFunction)CtlObj_GetDataBrowserEditText, 1,
|
||||
PyDoc_STR("(CFMutableStringRef text) -> None")},
|
||||
{"SetDataBrowserEditItem", (PyCFunction)CtlObj_SetDataBrowserEditItem, 1,
|
||||
|
@ -4460,8 +4436,6 @@ static PyObject *Ctl_CreateProgressBarControl(PyObject *_self, PyObject *_args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -4493,7 +4467,6 @@ static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args)
|
|||
CtlObj_New, outControl);
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Ctl_CreateLittleArrowsControl(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -5232,8 +5205,6 @@ static PyObject *Ctl_CreateScrollingTextBoxControl(PyObject *_self, PyObject *_a
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -5262,9 +5233,6 @@ static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_a
|
|||
CtlObj_New, outControl);
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -5294,7 +5262,6 @@ static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args)
|
|||
CtlObj_New, outControl);
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -5322,8 +5289,6 @@ static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -5355,7 +5320,6 @@ static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_ar
|
|||
CtlObj_New, outControl);
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -5498,11 +5462,8 @@ static PyMethodDef Ctl_methods[] = {
|
|||
PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 orientation, CFStringRef title, SInt32 initialValue, Boolean drawTitle, Boolean autoToggles) -> (ControlHandle outControl)")},
|
||||
{"CreateProgressBarControl", (PyCFunction)Ctl_CreateProgressBarControl, 1,
|
||||
PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"CreateRelevanceBarControl", (PyCFunction)Ctl_CreateRelevanceBarControl, 1,
|
||||
PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum) -> (ControlHandle outControl)")},
|
||||
#endif
|
||||
{"CreateLittleArrowsControl", (PyCFunction)Ctl_CreateLittleArrowsControl, 1,
|
||||
PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 increment) -> (ControlHandle outControl)")},
|
||||
{"CreateChasingArrowsControl", (PyCFunction)Ctl_CreateChasingArrowsControl, 1,
|
||||
|
@ -5551,23 +5512,14 @@ static PyMethodDef Ctl_methods[] = {
|
|||
PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")},
|
||||
{"CreateScrollingTextBoxControl", (PyCFunction)Ctl_CreateScrollingTextBoxControl, 1,
|
||||
PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt16 contentResID, Boolean autoScroll, UInt32 delayBeforeAutoScroll, UInt32 delayBetweenAutoScroll, UInt16 autoScrollAmount) -> (ControlHandle outControl)")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"CreateDisclosureButtonControl", (PyCFunction)Ctl_CreateDisclosureButtonControl, 1,
|
||||
PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt32 inValue, Boolean inAutoToggles) -> (ControlHandle outControl)")},
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"CreateRoundButtonControl", (PyCFunction)Ctl_CreateRoundButtonControl, 1,
|
||||
PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt16 inSize, ControlButtonContentInfo inContent) -> (ControlHandle outControl)")},
|
||||
#endif
|
||||
{"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1,
|
||||
PyDoc_STR("(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1,
|
||||
PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)")},
|
||||
#endif
|
||||
{"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,
|
||||
PyDoc_STR("(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)")},
|
||||
{"as_Control", (PyCFunction)Ctl_as_Control, 1,
|
||||
|
|
|
@ -99,20 +99,6 @@ class MyScanner(Scanner):
|
|||
'SetControlColor',
|
||||
]
|
||||
|
||||
def makegreylist(self):
|
||||
return [
|
||||
('#if TARGET_API_MAC_OSX', [
|
||||
'CreateRoundButtonControl',
|
||||
'CreateDisclosureButtonControl',
|
||||
'CreateRelevanceBarControl',
|
||||
'DisableControl',
|
||||
'EnableControl',
|
||||
'IsControlEnabled',
|
||||
'CreateEditUnicodeTextControl',
|
||||
'CopyDataBrowserEditText',
|
||||
]),
|
||||
]
|
||||
|
||||
def makeblacklisttypes(self):
|
||||
return [
|
||||
'ProcPtr',
|
||||
|
|
|
@ -1757,8 +1757,6 @@ static PyObject *FSRef_FSOpenFork(FSRefObject *_self, PyObject *_args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *FSRef_FNNotify(FSRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -1777,7 +1775,6 @@ static PyObject *FSRef_FNNotify(FSRefObject *_self, PyObject *_args)
|
|||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *FSRef_FSNewAliasMinimal(FSRefObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -1836,26 +1833,9 @@ static PyObject *FSRef_as_pathname(FSRefObject *_self, PyObject *_args)
|
|||
{
|
||||
PyObject *_res = NULL;
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
_res = FSRef_FSRefMakePath(_self, _args);
|
||||
#else
|
||||
char strbuf[1024];
|
||||
OSErr err;
|
||||
FSSpec fss;
|
||||
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
if ( !PyMac_GetFSSpec((PyObject *)_self, &fss))
|
||||
return NULL;
|
||||
err = PyMac_GetFullPathname(&fss, strbuf, sizeof(strbuf));
|
||||
if ( err ) {
|
||||
PyMac_Error(err);
|
||||
return NULL;
|
||||
}
|
||||
_res = PyString_FromString(strbuf);
|
||||
#endif
|
||||
return _res;
|
||||
|
||||
}
|
||||
|
@ -1887,11 +1867,8 @@ static PyMethodDef FSRef_methods[] = {
|
|||
PyDoc_STR("(Buffer forkNameLength) -> None")},
|
||||
{"FSOpenFork", (PyCFunction)FSRef_FSOpenFork, 1,
|
||||
PyDoc_STR("(Buffer forkNameLength, SInt8 permissions) -> (SInt16 forkRefNum)")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"FNNotify", (PyCFunction)FSRef_FNNotify, 1,
|
||||
PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
|
||||
#endif
|
||||
{"FSNewAliasMinimal", (PyCFunction)FSRef_FSNewAliasMinimal, 1,
|
||||
PyDoc_STR("() -> (AliasHandle inAlias)")},
|
||||
{"FSIsAliasFile", (PyCFunction)FSRef_FSIsAliasFile, 1,
|
||||
|
@ -2726,8 +2703,6 @@ static PyObject *File_FSPathMakeRef(PyObject *_self, PyObject *_args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -2748,9 +2723,6 @@ static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args)
|
|||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -2769,7 +2741,6 @@ static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args)
|
|||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *File_NewAlias(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -3106,16 +3077,10 @@ static PyMethodDef File_methods[] = {
|
|||
PyDoc_STR("() -> (HFSUniStr255 resourceForkName)")},
|
||||
{"FSPathMakeRef", (PyCFunction)File_FSPathMakeRef, 1,
|
||||
PyDoc_STR("(UInt8 * path) -> (FSRef ref, Boolean isDirectory)")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"FNNotifyByPath", (PyCFunction)File_FNNotifyByPath, 1,
|
||||
PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")},
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1,
|
||||
PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
|
||||
#endif
|
||||
{"NewAlias", (PyCFunction)File_NewAlias, 1,
|
||||
PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")},
|
||||
{"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1,
|
||||
|
@ -3167,32 +3132,10 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
|
|||
return 1;
|
||||
}
|
||||
PyErr_Clear();
|
||||
#if !TARGET_API_MAC_OSX
|
||||
/* On OS9 we now try a pathname */
|
||||
if ( PyString_Check(v) ) {
|
||||
/* It's a pathname */
|
||||
if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
|
||||
return 0;
|
||||
refnum = 0; /* XXXX Should get CurWD here?? */
|
||||
parid = 0;
|
||||
err = FSMakeFSSpec(refnum, parid, path, spec);
|
||||
if ( err && err != fnfErr ) {
|
||||
PyMac_Error(err);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
PyErr_Clear();
|
||||
#endif
|
||||
/* Otherwise we try to go via an FSRef. On OSX we go all the way,
|
||||
** on OS9 we accept only a real FSRef object
|
||||
*/
|
||||
#if TARGET_API_MAC_OSX
|
||||
if ( PyMac_GetFSRef(v, &fsr) ) {
|
||||
#else
|
||||
if (FSRef_Check(v)) {
|
||||
fsr = ((FSRefObject *)v)->ob_itself;
|
||||
#endif
|
||||
err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
|
||||
if (err != noErr) {
|
||||
PyMac_Error(err);
|
||||
|
@ -3200,9 +3143,6 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#if !TARGET_API_MAC_OSX
|
||||
PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3217,7 +3157,6 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
/* On OSX we now try a pathname */
|
||||
if ( PyString_Check(v) || PyUnicode_Check(v)) {
|
||||
char *path = NULL;
|
||||
|
@ -3230,14 +3169,9 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
|
|||
return 1;
|
||||
}
|
||||
/* XXXX Should try unicode here too */
|
||||
#endif
|
||||
/* Otherwise we try to go via an FSSpec */
|
||||
#if TARGET_API_MAC_OSX
|
||||
if (FSSpec_Check(v)) {
|
||||
fss = ((FSSpecObject *)v)->ob_itself;
|
||||
#else
|
||||
if (PyMac_GetFSSpec(v, &fss)) {
|
||||
#endif
|
||||
if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
|
||||
return 1;
|
||||
PyMac_Error(err);
|
||||
|
|
|
@ -105,14 +105,6 @@ class MyScanner(Scanner_OSX):
|
|||
|
||||
]
|
||||
|
||||
def makegreylist(self):
|
||||
return [
|
||||
('#if TARGET_API_MAC_OSX', [
|
||||
'FNNotifyAll',
|
||||
'FNNotifyByPath',
|
||||
'FNNotify',
|
||||
])]
|
||||
|
||||
def makeblacklisttypes(self):
|
||||
return [
|
||||
"CInfoPBPtr", # Old stuff
|
||||
|
|
|
@ -225,32 +225,10 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
|
|||
return 1;
|
||||
}
|
||||
PyErr_Clear();
|
||||
#if !TARGET_API_MAC_OSX
|
||||
/* On OS9 we now try a pathname */
|
||||
if ( PyString_Check(v) ) {
|
||||
/* It's a pathname */
|
||||
if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
|
||||
return 0;
|
||||
refnum = 0; /* XXXX Should get CurWD here?? */
|
||||
parid = 0;
|
||||
err = FSMakeFSSpec(refnum, parid, path, spec);
|
||||
if ( err && err != fnfErr ) {
|
||||
PyMac_Error(err);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
PyErr_Clear();
|
||||
#endif
|
||||
/* Otherwise we try to go via an FSRef. On OSX we go all the way,
|
||||
** on OS9 we accept only a real FSRef object
|
||||
*/
|
||||
#if TARGET_API_MAC_OSX
|
||||
if ( PyMac_GetFSRef(v, &fsr) ) {
|
||||
#else
|
||||
if (FSRef_Check(v)) {
|
||||
fsr = ((FSRefObject *)v)->ob_itself;
|
||||
#endif
|
||||
err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
|
||||
if (err != noErr) {
|
||||
PyMac_Error(err);
|
||||
|
@ -258,9 +236,6 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#if !TARGET_API_MAC_OSX
|
||||
PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -275,7 +250,6 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
/* On OSX we now try a pathname */
|
||||
if ( PyString_Check(v) || PyUnicode_Check(v)) {
|
||||
char *path = NULL;
|
||||
|
@ -288,14 +262,9 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
|
|||
return 1;
|
||||
}
|
||||
/* XXXX Should try unicode here too */
|
||||
#endif
|
||||
/* Otherwise we try to go via an FSSpec */
|
||||
#if TARGET_API_MAC_OSX
|
||||
if (FSSpec_Check(v)) {
|
||||
fss = ((FSSpecObject *)v)->ob_itself;
|
||||
#else
|
||||
if (PyMac_GetFSSpec(v, &fss)) {
|
||||
#endif
|
||||
if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
|
||||
return 1;
|
||||
PyMac_Error(err);
|
||||
|
@ -814,26 +783,9 @@ f.docstring = lambda: "() -> string"
|
|||
fsref_methods.append(f)
|
||||
|
||||
FSRef_as_pathname_body = """
|
||||
#if TARGET_API_MAC_OSX
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
_res = FSRef_FSRefMakePath(_self, _args);
|
||||
#else
|
||||
char strbuf[1024];
|
||||
OSErr err;
|
||||
FSSpec fss;
|
||||
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
if ( !PyMac_GetFSSpec((PyObject *)_self, &fss))
|
||||
return NULL;
|
||||
err = PyMac_GetFullPathname(&fss, strbuf, sizeof(strbuf));
|
||||
if ( err ) {
|
||||
PyMac_Error(err);
|
||||
return NULL;
|
||||
}
|
||||
_res = PyString_FromString(strbuf);
|
||||
#endif
|
||||
return _res;
|
||||
"""
|
||||
f = ManualGenerator("as_pathname", FSRef_as_pathname_body)
|
||||
|
|
|
@ -48,10 +48,6 @@ class MyScanner(Scanner):
|
|||
'FlushFonts',
|
||||
]
|
||||
|
||||
def makegreylist(self):
|
||||
return [
|
||||
('#if !TARGET_API_MAC_CARBON', [
|
||||
])]
|
||||
def makeblacklisttypes(self):
|
||||
return [
|
||||
"FMInput_ptr", # Not needed for now
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
}} while(0)
|
||||
|
||||
|
||||
#ifndef PyDoc_STR
|
||||
#define PyDoc_STR(x) (x)
|
||||
#endif
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
static PyObject *Help_Error;
|
||||
|
|
|
@ -33,11 +33,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
static PyObject *MacOS_Error; /* Exception MacOS.Error */
|
||||
|
||||
#ifdef TARGET_API_MAC_OSX
|
||||
#define PATHNAMELEN 1024
|
||||
#else
|
||||
#define PATHNAMELEN 256
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
|
@ -337,94 +333,6 @@ MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
|
|||
return Py_None;
|
||||
}
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
static char schedparams_doc[] = "Set/return mainloop interrupt check flag, etc";
|
||||
|
||||
/*
|
||||
** Set scheduler parameters
|
||||
*/
|
||||
static PyObject *
|
||||
MacOS_SchedParams(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyMacSchedParams old, new;
|
||||
|
||||
PyMac_GetSchedParams(&old);
|
||||
new = old;
|
||||
if (!PyArg_ParseTuple(args, "|iiidd", &new.check_interrupt, &new.process_events,
|
||||
&new.besocial, &new.check_interval, &new.bg_yield))
|
||||
return NULL;
|
||||
PyMac_SetSchedParams(&new);
|
||||
return Py_BuildValue("iiidd", old.check_interrupt, old.process_events,
|
||||
old.besocial, old.check_interval, old.bg_yield);
|
||||
}
|
||||
|
||||
static char appswitch_doc[] = "Obsolete, use SchedParams";
|
||||
|
||||
/* Obsolete, for backward compatability */
|
||||
static PyObject *
|
||||
MacOS_EnableAppswitch(PyObject *self, PyObject *args)
|
||||
{
|
||||
int new, old;
|
||||
PyMacSchedParams schp;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &new))
|
||||
return NULL;
|
||||
PyMac_GetSchedParams(&schp);
|
||||
if ( schp.process_events )
|
||||
old = 1;
|
||||
else if ( schp.check_interrupt )
|
||||
old = 0;
|
||||
else
|
||||
old = -1;
|
||||
if ( new > 0 ) {
|
||||
schp.process_events = mDownMask|keyDownMask|osMask;
|
||||
schp.check_interrupt = 1;
|
||||
} else if ( new == 0 ) {
|
||||
schp.process_events = 0;
|
||||
schp.check_interrupt = 1;
|
||||
} else {
|
||||
schp.process_events = 0;
|
||||
schp.check_interrupt = 0;
|
||||
}
|
||||
PyMac_SetSchedParams(&schp);
|
||||
return Py_BuildValue("i", old);
|
||||
}
|
||||
|
||||
static char setevh_doc[] = "Set python event handler to be called in mainloop";
|
||||
|
||||
static PyObject *
|
||||
MacOS_SetEventHandler(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *evh = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O", &evh))
|
||||
return NULL;
|
||||
if (evh == Py_None)
|
||||
evh = NULL;
|
||||
if ( evh && !PyCallable_Check(evh) ) {
|
||||
PyErr_SetString(PyExc_ValueError, "SetEventHandler argument must be callable");
|
||||
return NULL;
|
||||
}
|
||||
if ( !PyMac_SetEventHandler(evh) )
|
||||
return NULL;
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static char handleev_doc[] = "Pass event to other interested parties like sioux";
|
||||
|
||||
static PyObject *
|
||||
MacOS_HandleEvent(PyObject *self, PyObject *args)
|
||||
{
|
||||
EventRecord ev;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O&", PyMac_GetEventRecord, &ev))
|
||||
return NULL;
|
||||
PyMac_HandleEventIntern(&ev);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
#endif /* !TARGET_API_MAC_OSX */
|
||||
|
||||
static char geterr_doc[] = "Convert OSErr number to string";
|
||||
|
||||
|
@ -523,7 +431,6 @@ MacOS_WMAvailable(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
if (!rv) {
|
||||
#if TARGET_API_MAC_OSX
|
||||
ProcessSerialNumber psn;
|
||||
|
||||
/*
|
||||
|
@ -543,9 +450,6 @@ MacOS_WMAvailable(PyObject *self, PyObject *args)
|
|||
rv = Py_True;
|
||||
}
|
||||
}
|
||||
#else
|
||||
rv = Py_True;
|
||||
#endif
|
||||
}
|
||||
Py_INCREF(rv);
|
||||
return rv;
|
||||
|
@ -619,83 +523,10 @@ MacOS_openrf(PyObject *self, PyObject *args)
|
|||
return (PyObject *)fp;
|
||||
}
|
||||
|
||||
#if !TARGET_API_MAC_OSX
|
||||
static char FreeMem_doc[] = "Return the total amount of free space in the heap";
|
||||
|
||||
static PyObject *
|
||||
MacOS_FreeMem(PyObject *self, PyObject *args)
|
||||
{
|
||||
long rv;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
rv = FreeMem();
|
||||
return Py_BuildValue("l", rv);
|
||||
}
|
||||
|
||||
static char MaxBlock_doc[] = "Return the largest contiguous block of free space in the heap";
|
||||
|
||||
static PyObject *
|
||||
MacOS_MaxBlock(PyObject *self, PyObject *args)
|
||||
{
|
||||
long rv;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
rv = MaxBlock();
|
||||
return Py_BuildValue("l", rv);
|
||||
}
|
||||
|
||||
static char CompactMem_doc[] = "(wanted size)->actual largest block after compacting";
|
||||
|
||||
static PyObject *
|
||||
MacOS_CompactMem(PyObject *self, PyObject *args)
|
||||
{
|
||||
long value;
|
||||
long rv;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "l", &value))
|
||||
return NULL;
|
||||
rv = CompactMem(value);
|
||||
return Py_BuildValue("l", rv);
|
||||
}
|
||||
|
||||
static char KeepConsole_doc[] = "(flag) Keep console open 0:never, 1:on output 2:on error, 3:always";
|
||||
|
||||
static PyObject *
|
||||
MacOS_KeepConsole(PyObject *self, PyObject *args)
|
||||
{
|
||||
int value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &value))
|
||||
return NULL;
|
||||
PyMac_options.keep_console = value;
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static char OutputSeen_doc[] = "Call to reset the 'unseen output' flag for the keep-console-open option";
|
||||
|
||||
static PyObject *
|
||||
MacOS_OutputSeen(PyObject *self, PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
PyMac_OutputSeen();
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
#endif /* !TARGET_API_MAC_OSX */
|
||||
|
||||
static PyMethodDef MacOS_Methods[] = {
|
||||
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
|
||||
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
|
||||
#if !TARGET_API_MAC_OSX
|
||||
{"SchedParams", MacOS_SchedParams, 1, schedparams_doc},
|
||||
{"EnableAppswitch", MacOS_EnableAppswitch, 1, appswitch_doc},
|
||||
{"SetEventHandler", MacOS_SetEventHandler, 1, setevh_doc},
|
||||
{"HandleEvent", MacOS_HandleEvent, 1, handleev_doc},
|
||||
#endif
|
||||
{"GetErrorString", MacOS_GetErrorString, 1, geterr_doc},
|
||||
{"openrf", MacOS_openrf, 1, openrf_doc},
|
||||
{"splash", MacOS_splash, 1, splash_doc},
|
||||
|
@ -703,13 +534,6 @@ static PyMethodDef MacOS_Methods[] = {
|
|||
{"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
|
||||
{"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
|
||||
{"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
|
||||
#if !TARGET_API_MAC_OSX
|
||||
{"FreeMem", MacOS_FreeMem, 1, FreeMem_doc},
|
||||
{"MaxBlock", MacOS_MaxBlock, 1, MaxBlock_doc},
|
||||
{"CompactMem", MacOS_CompactMem, 1, CompactMem_doc},
|
||||
{"KeepConsole", MacOS_KeepConsole, 1, KeepConsole_doc},
|
||||
{"OutputSeen", MacOS_OutputSeen, 1, OutputSeen_doc},
|
||||
#endif
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
@ -742,19 +566,11 @@ initMacOS(void)
|
|||
if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0)
|
||||
return;
|
||||
}
|
||||
#if TARGET_API_MAC_OSX
|
||||
#define PY_RUNTIMEMODEL "macho"
|
||||
#elif TARGET_API_MAC_CARBON
|
||||
#define PY_RUNTIMEMODEL "carbon"
|
||||
#else
|
||||
#error "None of the TARGET_API_MAC_XXX I know about is set"
|
||||
#endif
|
||||
if (PyDict_SetItemString(d, "runtimemodel",
|
||||
Py_BuildValue("s", PY_RUNTIMEMODEL)) != 0)
|
||||
return;
|
||||
#if !TARGET_API_MAC_OSX
|
||||
#define PY_LINKMODEL "cfm"
|
||||
#elif defined(WITH_NEXT_FRAMEWORK)
|
||||
#if defined(WITH_NEXT_FRAMEWORK)
|
||||
#define PY_LINKMODEL "framework"
|
||||
#elif defined(Py_ENABLE_SHARED)
|
||||
#define PY_LINKMODEL "shared"
|
||||
|
|
|
@ -81,12 +81,6 @@ kTXNFontSizeAttributeSize = 4
|
|||
'TXNTSMCheck', # OS8
|
||||
]
|
||||
|
||||
def makegreylist(self):
|
||||
return [
|
||||
('#if TARGET_API_MAC_OS8', [
|
||||
])]
|
||||
|
||||
|
||||
def makeblacklisttypes(self):
|
||||
return [
|
||||
"TXNTab", # TBD
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
}} while(0)
|
||||
|
||||
|
||||
#ifndef PyDoc_STR
|
||||
#define PyDoc_STR(x) (x)
|
||||
#endif
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#ifdef USE_TOOLBOX_OBJECT_GLUE
|
||||
|
|
|
@ -1358,8 +1358,6 @@ static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
|
||||
static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
|
@ -1387,7 +1385,6 @@ static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject
|
|||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args)
|
||||
{
|
||||
|
@ -2451,11 +2448,8 @@ static PyMethodDef WinObj_methods[] = {
|
|||
PyDoc_STR("(Boolean hilited) -> None")},
|
||||
{"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1,
|
||||
PyDoc_STR("(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None")},
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
{"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1,
|
||||
PyDoc_STR("(WindowPtr parentWindow, WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None")},
|
||||
#endif
|
||||
{"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1,
|
||||
PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")},
|
||||
{"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
|
||||
|
|
|
@ -71,12 +71,6 @@ class MyScanner(Scanner):
|
|||
'GetWindowSpareFlag',
|
||||
]
|
||||
|
||||
def makegreylist(self):
|
||||
return [
|
||||
('#if TARGET_API_MAC_OSX', [
|
||||
'TransitionWindowAndParent',
|
||||
])]
|
||||
|
||||
def makeblacklisttypes(self):
|
||||
return [
|
||||
'ProcPtr',
|
||||
|
|
|
@ -33,7 +33,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
*/
|
||||
char *PyMac_getscript()
|
||||
{
|
||||
#if TARGET_API_MAC_OSX
|
||||
CFStringEncoding enc = CFStringGetSystemEncoding();
|
||||
static CFStringRef name = NULL;
|
||||
/* Return the code name for the encodings for which we have codecs. */
|
||||
|
@ -50,36 +49,6 @@ char *PyMac_getscript()
|
|||
name = CFStringConvertEncodingToIANACharSetName(enc);
|
||||
}
|
||||
return (char *)CFStringGetCStringPtr(name, 0);
|
||||
#else
|
||||
int font, script, lang;
|
||||
font = 0;
|
||||
font = GetSysFont();
|
||||
script = FontToScript(font);
|
||||
switch (script) {
|
||||
case smRoman:
|
||||
lang = GetScriptVariable(script, smScriptLang);
|
||||
if (lang == langIcelandic)
|
||||
return "mac-iceland";
|
||||
else if (lang == langTurkish)
|
||||
return "mac-turkish";
|
||||
else if (lang == langGreek)
|
||||
return "mac-greek";
|
||||
else
|
||||
return "mac-roman";
|
||||
break;
|
||||
#if 0
|
||||
/* We don't have a codec for this, so don't return it */
|
||||
case smJapanese:
|
||||
return "mac-japan";
|
||||
#endif
|
||||
case smGreek:
|
||||
return "mac-greek";
|
||||
case smCyrillic:
|
||||
return "mac-cyrillic";
|
||||
default:
|
||||
return "ascii"; /* better than nothing */
|
||||
}
|
||||
#endif /* TARGET_API_MAC_OSX */
|
||||
}
|
||||
|
||||
/* Like strerror() but for Mac OS error numbers */
|
||||
|
@ -177,7 +146,6 @@ PyMac_Error(OSErr err)
|
|||
}
|
||||
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
OSErr
|
||||
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
|
||||
{
|
||||
|
@ -215,7 +183,6 @@ PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif /* TARGET_API_MAC_OSX */
|
||||
|
||||
#ifdef WITH_NEXT_FRAMEWORK
|
||||
/*
|
||||
|
@ -232,11 +199,7 @@ locateResourcePy(CFStringRef resourceType, CFStringRef resourceName, char *resou
|
|||
CFArrayRef arrayRef = NULL;
|
||||
int success = 0;
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
CFURLPathStyle thePathStyle = kCFURLPOSIXPathStyle;
|
||||
#else
|
||||
CFURLPathStyle thePathStyle = kCFURLHFSPathStyle;
|
||||
#endif
|
||||
|
||||
/* Get a reference to our main bundle */
|
||||
mainBundle = CFBundleGetMainBundle();
|
||||
|
|
Loading…
Reference in New Issue