Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a53f4eb

Browse files
committed
Getting rid of code conditional on TARGET_API_MAC_*.
1 parent 9588770 commit a53f4eb

18 files changed

Lines changed: 2 additions & 748 deletions

Mac/Include/macglue.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2323
******************************************************************/
2424
#ifndef Py_MACGLUE_H
2525
#define Py_MACGLUE_H
26-
#ifdef WITHOUT_FRAMEWORKS
27-
#include <Types.h>
28-
#include <Files.h>
29-
#include <Events.h>
30-
#include <StandardFile.h>
31-
#else
3226
#include <Carbon/Carbon.h>
33-
#endif
3427

3528
#include "pymactoolbox.h"
3629

@@ -49,11 +42,6 @@ typedef struct {
4942

5043
unsigned char *Pstring(char *str); /* Convert c-string to pascal-string in static buffer */
5144

52-
#ifdef USE_GUSI
53-
extern int PyMac_ConsoleIsDead; /* True when exiting */
54-
extern void PyMac_StopGUSISpin(void); /* Stop eventprocessing during exit() */
55-
#endif
56-
5745
extern short PyMac_AppRefNum; /* RefNum of application rsrcfork (from macmain.c) */
5846
extern FSSpec PyMac_ApplicationFSSpec; /* Application location (from macargv.c) */
5947
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) */
6351
extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
6452
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
6553

66-
#if !TARGET_API_MAC_OSX
67-
void PyMac_GetSchedParams(PyMacSchedParams *); /* Get schedulers params */
68-
void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */
69-
int PyMac_DoYield(int, int); /* Yield cpu. First arg is maxtime, second ok to call python */
70-
#endif
7154
int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */
7255
void PyMac_HandleEventIntern(EventRecord *); /* Handle one event internal only */
7356
int PyMac_SetEventHandler(PyObject *); /* set python-coded event handler */
7457

75-
#if !TARGET_API_MAC_OSX
76-
void PyMac_InitMenuBar(void); /* Setup menu bar as we want it */
77-
void PyMac_RestoreMenuBar(void); /* Restore menu bar for ease of exiting */
78-
void PyMac_RaiseConsoleWindow(); /* Bring console window to front, if it exists */
79-
#endif
8058
int PyMac_FindResourceModule(PyStringObject *, char *, char *); /* Test for 'PYC ' resource in a file */
8159
PyObject * PyMac_LoadResourceModule(char *, char *); /* Load 'PYC ' resource from file */
8260
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
8664
void PyMac_InitApplet(void); /* Initialize and run an Applet */
8765
void PyMac_Initialize(void); /* Initialize function for embedding Python */
8866

89-
#ifdef USE_GUSI2
90-
short PyMac_OpenPrefFile(void); /* From macgetpath.c, open and return preference file */
91-
#endif
92-
9367

9468
/* From macfiletype.c: */
9569

@@ -102,33 +76,11 @@ void PyMac_InitApplication(void);
10276
void PyMac_OutputSeen(void);
10377
void PyMac_OutputNotSeen(void);
10478
int PyMac_GetDelayConsoleFlag(void);
105-
#ifdef USE_MAC_APPLET_SUPPORT
106-
void PyMac_InitApplet(void);
107-
#endif
10879

10980
/* from macgetargv: */
11081
OSErr PyMac_init_process_location(void);
11182
char * strdup(const char *str);
11283

113-
#ifdef USE_GUSI2
114-
/* from pyGUSISIOUX.cp */
115-
typedef long (*PyWriteHandler)(char *buffer, long n);
116-
typedef long (*PyReadHandler)(char *buffer, long n);
117-
118-
/* Override routines that normally reads and writes to the
119-
** SIOUX console window. Intended for embedding applications
120-
** that want to forestall a Python console window ever showing up.
121-
*/
122-
void PyMac_SetConsoleHandler(PyReadHandler stdinH, PyWriteHandler stdoutH,
123-
PyWriteHandler stderrH);
124-
125-
/* Courtesy console handlers that drop all output and return
126-
** 0 on reads.
127-
*/
128-
long PyMac_DummyReadHandler(char *, long);
129-
long PyMac_DummyWriteHandler(char *, long);
130-
#endif /* USE_GUSI2 */
131-
13284
#ifdef __cplusplus
13385
}
13486
#endif

Mac/Modules/ae/_AEmodule.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
}} while(0)
2121

2222

23-
#ifndef PyDoc_STR
24-
#define PyDoc_STR(x) (x)
25-
#endif
2623
#include <Carbon/Carbon.h>
2724

2825
#ifdef USE_TOOLBOX_OBJECT_GLUE
@@ -44,12 +41,6 @@ static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHand
4441
{
4542
if ( PyOS_InterruptOccurred() )
4643
return 1;
47-
#if !TARGET_API_MAC_OSX
48-
if ( PyMac_HandleEvent(theEvent) < 0 ) {
49-
PySys_WriteStderr("Exception in user event handler during AE processing\n");
50-
PyErr_Clear();
51-
}
52-
#endif
5344
return 0;
5445
}
5546

Mac/Modules/ae/aesupport.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ def passInput(self, name):
103103
{
104104
if ( PyOS_InterruptOccurred() )
105105
return 1;
106-
#if !TARGET_API_MAC_OSX
107-
if ( PyMac_HandleEvent(theEvent) < 0 ) {
108-
PySys_WriteStderr("Exception in user event handler during AE processing\\n");
109-
PyErr_Clear();
110-
}
111-
#endif
112106
return 0;
113107
}
114108

Mac/Modules/cg/_CGmodule.c

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -22,113 +22,6 @@
2222

2323
#include <ApplicationServices/ApplicationServices.h>
2424

25-
#if !TARGET_API_MAC_OSX
26-
/* This code is adapted from the CallMachOFramework demo at:
27-
http://developer.apple.com/samplecode/Sample_Code/Runtime_Architecture/CallMachOFramework.htm
28-
It allows us to call Mach-O functions from CFM apps. */
29-
30-
#include <Folders.h>
31-
#include "CFMLateImport.h"
32-
33-
static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr)
34-
// This routine finds a the named framework and creates a CFBundle
35-
// object for it. It looks for the framework in the frameworks folder,
36-
// as defined by the Folder Manager. Currently this is
37-
// "/System/Library/Frameworks", but we recommend that you avoid hard coded
38-
// paths to ensure future compatibility.
39-
//
40-
// You might think that you could use CFBundleGetBundleWithIdentifier but
41-
// that only finds bundles that are already loaded into your context.
42-
// That would work in the case of the System framework but it wouldn't
43-
// work if you're using some other, less-obvious, framework.
44-
{
45-
OSStatus err;
46-
FSRef frameworksFolderRef;
47-
CFURLRef baseURL;
48-
CFURLRef bundleURL;
49-
50-
*bundlePtr = nil;
51-
52-
baseURL = nil;
53-
bundleURL = nil;
54-
55-
// Find the frameworks folder and create a URL for it.
56-
57-
err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef);
58-
if (err == noErr) {
59-
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
60-
if (baseURL == nil) {
61-
err = coreFoundationUnknownErr;
62-
}
63-
}
64-
65-
// Append the name of the framework to the URL.
66-
67-
if (err == noErr) {
68-
bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false);
69-
if (bundleURL == nil) {
70-
err = coreFoundationUnknownErr;
71-
}
72-
}
73-
74-
// Create a bundle based on that URL and load the bundle into memory.
75-
// We never unload the bundle, which is reasonable in this case because
76-
// the sample assumes that you'll be calling functions from this
77-
// framework throughout the life of your application.
78-
79-
if (err == noErr) {
80-
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
81-
if (*bundlePtr == nil) {
82-
err = coreFoundationUnknownErr;
83-
}
84-
}
85-
if (err == noErr) {
86-
if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
87-
err = coreFoundationUnknownErr;
88-
}
89-
}
90-
91-
// Clean up.
92-
93-
if (err != noErr && *bundlePtr != nil) {
94-
CFRelease(*bundlePtr);
95-
*bundlePtr = nil;
96-
}
97-
if (bundleURL != nil) {
98-
CFRelease(bundleURL);
99-
}
100-
if (baseURL != nil) {
101-
CFRelease(baseURL);
102-
}
103-
104-
return err;
105-
}
106-
107-
108-
109-
// The CFMLateImport approach requires that you define a fragment
110-
// initialisation routine that latches the fragment's connection
111-
// ID and locator. If your code already has a fragment initialiser
112-
// you will have to integrate the following into it.
113-
114-
static CFragConnectionID gFragToFixConnID;
115-
static FSSpec gFragToFixFile;
116-
static CFragSystem7DiskFlatLocator gFragToFixLocator;
117-
118-
extern OSErr FragmentInit(const CFragInitBlock *initBlock);
119-
extern OSErr FragmentInit(const CFragInitBlock *initBlock)
120-
{
121-
__initialize(initBlock); /* call the "original" initializer */
122-
gFragToFixConnID = (CFragConnectionID) initBlock->closureID;
123-
gFragToFixFile = *(initBlock->fragLocator.u.onDisk.fileSpec);
124-
gFragToFixLocator = initBlock->fragLocator.u.onDisk;
125-
gFragToFixLocator.fileSpec = &gFragToFixFile;
126-
127-
return noErr;
128-
}
129-
130-
#endif
131-
13225
extern int GrafObj_Convert(PyObject *, GrafPtr *);
13326

13427
/*
@@ -1369,23 +1262,6 @@ void init_CG(void)
13691262

13701263

13711264

1372-
#if !TARGET_API_MAC_OSX
1373-
CFBundleRef sysBundle;
1374-
OSStatus err;
1375-
1376-
if (&LoadFrameworkBundle == NULL) {
1377-
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
1378-
return;
1379-
}
1380-
err = LoadFrameworkBundle(CFSTR("ApplicationServices.framework"), &sysBundle);
1381-
if (err == noErr)
1382-
err = CFMLateImportBundle(&gFragToFixLocator, gFragToFixConnID, FragmentInit, "\pCGStubLib", sysBundle);
1383-
if (err != noErr) {
1384-
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
1385-
return;
1386-
};
1387-
#endif /* !TARGET_API_MAC_OSX */
1388-
13891265

13901266
m = Py_InitModule("_CG", CG_methods);
13911267
d = PyModule_GetDict(m);

0 commit comments

Comments
 (0)