summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/cg
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-11-19 16:34:04 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-11-19 16:34:04 (GMT)
commita53f4eba19856613a55ccbcfdb8c862d24a691b9 (patch)
tree55e8e3616059daa41c666e3b0abd92ed8a0efd43 /Mac/Modules/cg
parent9588770e25db99692f3ebb680235bc1a02b65017 (diff)
downloadcpython-a53f4eba19856613a55ccbcfdb8c862d24a691b9.zip
cpython-a53f4eba19856613a55ccbcfdb8c862d24a691b9.tar.gz
cpython-a53f4eba19856613a55ccbcfdb8c862d24a691b9.tar.bz2
Getting rid of code conditional on TARGET_API_MAC_*.
Diffstat (limited to 'Mac/Modules/cg')
-rwxr-xr-xMac/Modules/cg/_CGmodule.c124
-rwxr-xr-xMac/Modules/cg/cgsupport.py126
2 files changed, 0 insertions, 250 deletions
diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c
index 09b803c..3971185 100755
--- a/Mac/Modules/cg/_CGmodule.c
+++ b/Mac/Modules/cg/_CGmodule.c
@@ -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);
diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py
index a8372f2..1b667c0 100755
--- a/Mac/Modules/cg/cgsupport.py
+++ b/Mac/Modules/cg/cgsupport.py
@@ -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):