diff options
Diffstat (limited to 'Mac/Python')
-rw-r--r-- | Mac/Python/macgetpath.c | 34 | ||||
-rw-r--r-- | Mac/Python/macglue.c | 91 | ||||
-rw-r--r-- | Mac/Python/macimport.c | 41 | ||||
-rw-r--r-- | Mac/Python/macmain.c | 31 |
4 files changed, 0 insertions, 197 deletions
diff --git a/Mac/Python/macgetpath.c b/Mac/Python/macgetpath.c index b79e90b..dfb689e 100644 --- a/Mac/Python/macgetpath.c +++ b/Mac/Python/macgetpath.c @@ -63,10 +63,6 @@ PERFORMANCE OF THIS SOFTWARE. #include <TextUtils.h> #include <Dialogs.h> -#ifdef USE_GUSI1 -#include <GUSI.h> -#endif - #ifndef USE_BUILTIN_PATH staticforward char *PyMac_GetPythonPath(); #endif @@ -211,11 +207,6 @@ PyMac_OpenPrefFile() return -1; prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); if ( prefrh < 0 ) { -#if 0 - action = CautionAlert(NOPREFFILE_ID, NULL); - if ( action == NOPREFFILE_NO ) - exit(1); -#endif FSpCreateResFile(&dirspec, 'Pyth', 'pref', 0); prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); if ( prefrh == -1 ) { @@ -453,28 +444,3 @@ PyMac_PreferenceOptions(PyMac_PrefRecord *pr) if ( prefrh != -1) CloseResFile(prefrh); UseResFile(oldrh); } - -#ifdef USE_GUSI1 -void -PyMac_SetGUSIOptions() -{ - Handle h; - short oldrh, prefrh = -1; - - oldrh = CurResFile(); - - /* Try override from the application resource fork */ - UseResFile(PyMac_AppRefNum); - h = Get1Resource('GU\267I', GUSIOPTIONSOVERRIDE_ID); - UseResFile(oldrh); - - /* If that didn't work try nonoverride from anywhere */ - if ( h == NULL ) { - prefrh = PyMac_OpenPrefFile(); - h = GetResource('GU\267I', GUSIOPTIONS_ID); - } - if ( h ) GUSILoadConfiguration(h); - if ( prefrh != -1) CloseResFile(prefrh); - UseResFile(oldrh); -} -#endif /* USE_GUSI1 */ diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index f78f97f..feb148f 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -71,11 +71,6 @@ extern pascal unsigned char *PLstrrchr(unsigned char *, unsigned char); #endif -#ifdef USE_GUSI1 -#include <TFileSpec.h> /* For Path2FSSpec */ -#include <GUSI.h> -#endif - /* The ID of the Sioux apple menu */ #define SIOUX_APPLEID 32000 @@ -174,11 +169,6 @@ static int upp_inited = 0; */ static PyObject *python_event_handler; -/* -** Set to true if we're appearance-compliant -*/ -int PyMac_AppearanceCompliant; - /* Given an FSSpec, return the FSSpec of the parent folder */ static OSErr @@ -250,29 +240,6 @@ PyMac_GetFullPathname (FSSpec *fss, char *buf, int length) return 0; } -#ifdef USE_GUSI1 -/* -** GUSI (1.6.0 and earlier, at the least) do not set the MacOS idea of -** the working directory. Hence, we call this routine after each call -** to chdir() to rectify things. -*/ -void -PyMac_FixGUSIcd() -{ - WDPBRec pb; - FSSpec curdirfss; - - if ( Path2FSSpec(":x", &curdirfss) != noErr ) - return; - - /* Set MacOS "working directory" */ - pb.ioNamePtr= "\p"; - pb.ioVRefNum= curdirfss.vRefNum; - pb.ioWDDirID= curdirfss.parID; - if (PBHSetVolSync(&pb) != noErr) - return; -} -#endif #ifdef USE_GUSI /* @@ -282,48 +249,6 @@ PyMac_FixGUSIcd() void SpinCursor(short x) { /* Dummy */ } void RotateCursor(short x) { /* Dummy */ } -/* -** Replacement GUSI Spin function -*/ -#ifdef USE_GUSI1 -static int -PyMac_GUSISpin(spin_msg msg, long arg) -{ - static Boolean inForeground = true; - int maxsleep = 6; /* 6 ticks is "normal" sleeptime */ - - if (PyMac_ConsoleIsDead) return 0; -#if 0 - if (inForeground) - SpinCursor(msg == SP_AUTO_SPIN ? short(arg) : 1); -#endif - - - if ( msg == SP_AUTO_SPIN ) - maxsleep = 0; - if ( msg==SP_SLEEP||msg==SP_SELECT ) { - maxsleep = arg; - /* - ** We force-scan for interrupts. Not pretty, but otherwise - ** a program may hang in select or sleep forever. - */ - scan_event_queue(1); - } - if (interrupted) { - interrupted = 0; - return -1; - } - - PyMac_DoYield(maxsleep, 0); /* XXXX or is it safe to call python here? */ - - return 0; -} - -void -PyMac_SetGUSISpin() { - GUSISetHook(GUSI_SpinHook, (GUSIHook)PyMac_GUSISpin); -} -#endif /* Called at exit() time thru atexit(), to stop event processing */ void @@ -440,11 +365,6 @@ PyOS_CheckStack() if ( &here < sentinel ) { if (thread_for_sentinel == PyThreadState_Get()) { return -1; -#if 0 - } else { - /* Else we are unsure... */ - fprintf(stderr, "Stackcheck in other thread (was %x now %x)\n", thread_for_sentinel,PyThreadState_Get()); -#endif } } return 0; @@ -735,15 +655,7 @@ PyMac_InitMenuBar() static unsigned char about_sioux[] = "\pAbout SIOUX"; if ( sioux_mbar ) return; -#if 0 - /* This code does not seem to work anymore: apparently - ** we now always have a menubar (since MacOS9?). - ** So we simply always setup the Sioux menus here. - */ - if ( (sioux_mbar=GetMenuBar()) == NULL ) { -#else if ( (sioux_mbar=GetMenuBar()) == NULL || GetMenuHandle(SIOUX_APPLEID) == NULL) { -#endif /* Sioux menu not installed yet. Do so */ SIOUXSetupMenus(); if ( (sioux_mbar=GetMenuBar()) == NULL ) @@ -762,8 +674,6 @@ PyMac_InitMenuBar() void PyMac_RestoreMenuBar() { -#if 1 - /* This doesn't seem to work anymore? Or only for Carbon? */ MenuBarHandle curmenubar; curmenubar = GetMenuBar(); @@ -774,7 +684,6 @@ PyMac_RestoreMenuBar() PyMac_InitMenuBar(); DrawMenuBar(); } -#endif } void diff --git a/Mac/Python/macimport.c b/Mac/Python/macimport.c index 49d1b14..cc562f1 100644 --- a/Mac/Python/macimport.c +++ b/Mac/Python/macimport.c @@ -35,24 +35,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <Types.h> #include <Files.h> #include <Resources.h> -#if 0 -#include <OSUtils.h> /* for Set(Current)A5 */ -#include <StandardFile.h> -#include <Memory.h> -#include <Windows.h> -#include <Traps.h> -#include <Processes.h> -#include <Fonts.h> -#include <Menus.h> -#include <TextUtils.h> -#endif #include <CodeFragments.h> #include <StringCompare.h> -#ifdef USE_GUSI1 -#include "TFileSpec.h" /* for Path2FSSpec() */ -#endif - typedef void (*dl_funcptr)(); #define FUNCNAME_PATTERN "init%.200s" @@ -82,7 +67,6 @@ findnamedresource( int ok; Handle h; -#ifdef INTERN_STRINGS /* ** If we have interning find_module takes care of interning all ** sys.path components. We then keep a record of all sys.path @@ -100,16 +84,9 @@ findnamedresource( if ( obj == not_a_file[i] ) return 0; } -#endif /* INTERN_STRINGS */ -#ifdef USE_GUSI1 - if ( Path2FSSpec(filename, &fss) != noErr ) { -#else if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { -#endif -#ifdef INTERN_STRINGS if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) not_a_file[max_not_a_file++] = obj; -#endif /* INTERN_STRINGS */ /* doesn't exist or is folder */ return 0; } @@ -123,14 +100,12 @@ findnamedresource( UseResFile(PyMac_AppRefNum); filerh = -1; } else { -#ifdef INTERN_STRINGS if ( FSpGetFInfo(&fss, &finfo) != noErr ) { if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) not_a_file[max_not_a_file++] = obj; /* doesn't exist or is folder */ return 0; } -#endif /* INTERN_STRINGS */ oldrh = CurResFile(); filerh = FSpOpenResFile(&fss, fsRdPerm); if ( filerh == -1 ) @@ -270,14 +245,12 @@ PyMac_LoadCodeResourceModule(name, pathname) "dynamic module not initialized properly"); return NULL; } -#if 1 /* Remember the filename as the __file__ attribute */ d = PyModule_GetDict(m); s = PyString_FromString(pathname); if (s == NULL || PyDict_SetItemString(d, "__file__", s) != 0) PyErr_Clear(); /* Not important enough to report */ Py_XDECREF(s); -#endif if (Py_VerboseFlag) PySys_WriteStderr("import %s # pyd fragment %#s loaded from %s\n", name, fragmentname, pathname); @@ -301,12 +274,7 @@ char *filename; PyObject *m, *co; long num, size; -#ifdef USE_GUSI1 - if ( (err=Path2FSSpec(filename, &fss)) != noErr || - FSpGetFInfo(&fss, &finfo) != noErr ) -#else if ( (err=FSMakeFSSpec(0, 0, Pstring(filename), &fss)) != noErr ) -#endif goto error; if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) { /* @@ -423,9 +391,6 @@ PyMac_FindModuleExtension(char *buf, size_t *lenp, char *module) unsigned char fnbuf[64]; int modnamelen = strlen(module); FSSpec fss; -#ifdef USE_GUSI1 - FInfo finfo; -#endif short refnum; long dirid; @@ -438,14 +403,8 @@ PyMac_FindModuleExtension(char *buf, size_t *lenp, char *module) return 0; strcpy(buf+*lenp, _PyImport_Filetab[0].suffix); -#ifdef USE_GUSI1 - if ( Path2FSSpec(buf, &fss) == noErr && - FSpGetFInfo(&fss, &finfo) == noErr) - return _PyImport_Filetab; -#else if ( FSMakeFSSpec(0, 0, Pstring(buf), &fss) == noErr ) return _PyImport_Filetab; -#endif /* ** We cannot check for fnfErr (unfortunately), it can mean either that ** the file doesn't exist (fine, we try others) or the path leading to it. diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index cb6b331..8b38a2c 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -45,10 +45,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <CFBase.h> #include <CFArray.h> #endif /* TARGET_API_MAC_CARBON */ -#ifdef USE_APPEARANCE #include <Gestalt.h> #include <Appearance.h> -#endif /* USE_APPEARANCE */ #else #include <Carbon/Carbon.h> #endif /* WITHOUT_FRAMEWORKS */ @@ -91,21 +89,6 @@ PyMac_PrefRecord PyMac_options; static void Py_Main(int, char **, char *); /* Forward */ void PyMac_Exit(int); /* Forward */ -static void init_appearance(void) -{ -#ifdef USE_APPEARANCE - OSErr err; - SInt32 response; - - err = Gestalt(gestaltAppearanceAttr,&response); - if ( err ) goto no_appearance; - if ( !(response&(1<<gestaltAppearanceExists)) ) goto no_appearance; - /* XXXX Should we check the version? Compat-mode? */ - PyMac_AppearanceCompliant = 1; -no_appearance: - return; -#endif /* USE_APPEARANCE */ -} /* Initialize the Mac toolbox world */ static void @@ -122,7 +105,6 @@ init_mac_world(void) InitMenus(); #endif InitCursor(); - init_appearance(); } /* @@ -283,21 +265,12 @@ init_common(int *argcp, char ***argvp, int embedded) PyMac_AddLibResources(); #endif -#if defined(USE_GUSI1) - /* Setup GUSI */ - GUSIDefaultSetup(); - PyMac_SetGUSISpin(); - PyMac_SetGUSIOptions(); -#endif #if defined(USE_GUSI) atexit(PyMac_StopGUSISpin); #endif #ifdef USE_SIOUX /* Set various SIOUX flags. Some are changed later based on options */ -#if 0 - SIOUXSettings.standalone = 0; /* XXXX Attempting to keep sioux from eating events */ -#endif SIOUXSettings.asktosaveonclose = 0; SIOUXSettings.showstatusline = 0; SIOUXSettings.tabspaces = 4; @@ -598,10 +571,6 @@ PyMac_InitApplication(void) *endp = '\0'; chdir(curwd); -#ifdef USE_GUSI1 - /* Change MacOS's idea of wd too */ - PyMac_FixGUSIcd(); -#endif } /* Check that the first argument is a text file */ if ( PyMac_getfiletype(argv[1]) != 'TEXT' ) { |