diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-11-20 01:44:59 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-11-20 01:44:59 (GMT) |
commit | eddc1449bae39414aaf7a4f63ccd3b69c4fb069e (patch) | |
tree | caaeed5da8c9755c4cc1d8ebf8da2f0608262c56 /Modules | |
parent | 4bae2d5e46b5135dba523616fd0960fc915eb120 (diff) | |
download | cpython-eddc1449bae39414aaf7a4f63ccd3b69c4fb069e.zip cpython-eddc1449bae39414aaf7a4f63ccd3b69c4fb069e.tar.gz cpython-eddc1449bae39414aaf7a4f63ccd3b69c4fb069e.tar.bz2 |
Getting rid of all the code inside #ifdef macintosh too.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_hotshot.c | 8 | ||||
-rw-r--r-- | Modules/_tkinter.c | 151 | ||||
-rw-r--r-- | Modules/getbuildinfo.c | 4 | ||||
-rw-r--r-- | Modules/parsermodule.c | 4 | ||||
-rw-r--r-- | Modules/timemodule.c | 56 |
5 files changed, 3 insertions, 220 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index da68970..a04494f 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -26,7 +26,7 @@ typedef __int64 hs_time; #ifndef HAVE_GETTIMEOFDAY #error "This module requires gettimeofday() on non-Windows platforms!" #endif -#if defined(macintosh) || (defined(PYOS_OS2) && defined(PYCC_GCC)) +#if (defined(PYOS_OS2) && defined(PYCC_GCC)) #include <sys/time.h> #else #include <sys/resource.h> @@ -47,10 +47,6 @@ typedef struct timeval hs_time; #define BUFFERSIZE 10240 -#ifdef macintosh -#define PATH_MAX 254 -#endif - #if defined(PYOS_OS2) && defined(PYCC_GCC) #define PATH_MAX 260 #endif @@ -940,7 +936,7 @@ calibrate(void) } #endif } -#if defined(MS_WINDOWS) || defined(macintosh) || defined(PYOS_OS2) || \ +#if defined(MS_WINDOWS) || defined(PYOS_OS2) || \ defined(__VMS) rusage_diff = -1; #else diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 02e4feb..e6f8953 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -33,10 +33,6 @@ Copyright (C) 1994 Steen Lumholt. #include <windows.h> #endif -#ifdef macintosh -#define MAC_TCL -#endif - /* Allow using this code in Python 2.[12] */ #ifndef PyDoc_STRVAR #define PyDoc_STRVAR(name,str) static char name[] = str @@ -96,15 +92,7 @@ Copyright (C) 1994 Steen Lumholt. #error "unsupported Tcl configuration" #endif -#if defined(macintosh) -/* Sigh, we have to include this to get at the tcl qd pointer */ -#include <tkMac.h> -/* And this one we need to clear the menu bar */ -#include <Menus.h> -#endif - -#if !(defined(MS_WINDOWS) || defined(__CYGWIN__) || defined(macintosh)) -/* Mac has it, but it doesn't really work:-( */ +#if !(defined(MS_WINDOWS) || defined(__CYGWIN__)) #define HAVE_CREATEFILEHANDLER #endif @@ -238,29 +226,6 @@ static PyThreadState *tcl_tstate = NULL; #endif -#ifdef macintosh - -/* -** Additional cruft needed by Tcl/Tk on the Mac. -** This is for Tcl 7.5 and Tk 4.1 (patch release 1). -*/ - -/* ckfree() expects a char* */ -#define FREECAST (char *) - -#include <Events.h> /* For EventRecord */ - -typedef int (*TclMacConvertEventPtr) (EventRecord *eventPtr); -void Tcl_MacSetEventProc(TclMacConvertEventPtr procPtr); -int TkMacConvertEvent(EventRecord *eventPtr); - -static int PyMacConvertEvent(EventRecord *eventPtr); - -#include <SIOUX.h> -extern int SIOUXIsAppWindow(WindowPtr); - -#endif /* macintosh */ - #ifndef FREECAST #define FREECAST (char *) #endif @@ -646,12 +611,6 @@ Tkapp_New(char *screenName, char *baseName, char *className, v->ProcBodyType = Tcl_GetObjType("procbody"); v->StringType = Tcl_GetObjType("string"); -#if defined(macintosh) - /* This seems to be needed */ - ClearMenuBar(); - TkMacInitMenus(v->interp); -#endif - /* Delete the 'exit' command, which can screw things up */ Tcl_DeleteCommand(v->interp, "exit"); @@ -3092,112 +3051,4 @@ init_tkinter(void) Py_AtExit(Tcl_Finalize); #endif -#ifdef macintosh - /* - ** Part of this code is stolen from MacintoshInit in tkMacAppInit. - ** Most of the initializations in that routine (toolbox init calls and - ** such) have already been done for us, so we only need these. - */ - tcl_macQdPtr = &qd; - - Tcl_MacSetEventProc(PyMacConvertEvent); -#if GENERATINGCFM - mac_addlibresources(); -#endif /* GENERATINGCFM */ -#endif /* macintosh */ } - - - -#ifdef macintosh - -/* -** Anyone who embeds Tcl/Tk on the Mac must define panic(). -*/ - -void -panic(char * format, ...) -{ - va_list varg; - - va_start(varg, format); - - vfprintf(stderr, format, varg); - (void) fflush(stderr); - - va_end(varg); - - Py_FatalError("Tcl/Tk panic"); -} - -/* -** Pass events to SIOUX before passing them to Tk. -*/ - -static int -PyMacConvertEvent(EventRecord *eventPtr) -{ - WindowPtr frontwin; - /* - ** Sioux eats too many events, so we don't pass it everything. We - ** always pass update events to Sioux, and we only pass other events if - ** the Sioux window is frontmost. This means that Tk menus don't work - ** in that case, but at least we can scroll the sioux window. - ** Note that the SIOUXIsAppWindow() routine we use here is not really - ** part of the external interface of Sioux... - */ - frontwin = FrontWindow(); - if ( eventPtr->what == updateEvt || SIOUXIsAppWindow(frontwin) ) { - if (SIOUXHandleOneEvent(eventPtr)) - return 0; /* Nothing happened to the Tcl event queue */ - } - return TkMacConvertEvent(eventPtr); -} - -#if GENERATINGCFM - -/* -** Additional Mac specific code for dealing with shared libraries. -*/ - -#include <Resources.h> -#include <CodeFragments.h> - -static int loaded_from_shlib = 0; -static FSSpec library_fss; - -/* -** If this module is dynamically loaded the following routine should -** be the init routine. It takes care of adding the shared library to -** the resource-file chain, so that the tk routines can find their -** resources. -*/ -OSErr pascal -init_tkinter_shlib(CFragInitBlockPtr data) -{ - __initialize(); - if ( data == nil ) return noErr; - if ( data->fragLocator.where == kDataForkCFragLocator ) { - library_fss = *data->fragLocator.u.onDisk.fileSpec; - loaded_from_shlib = 1; - } else if ( data->fragLocator.where == kResourceCFragLocator ) { - library_fss = *data->fragLocator.u.inSegs.fileSpec; - loaded_from_shlib = 1; - } - return noErr; -} - -/* -** Insert the library resources into the search path. Put them after -** the resources from the application. Again, we ignore errors. -*/ -static -mac_addlibresources(void) -{ - if ( !loaded_from_shlib ) - return; - (void)FSpOpenResFile(&library_fss, fsRdPerm); -} - -#endif /* GENERATINGCFM */ -#endif /* macintosh */ diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c index ef444bf..b541bb6 100644 --- a/Modules/getbuildinfo.c +++ b/Modules/getbuildinfo.c @@ -1,9 +1,5 @@ #include "Python.h" -#ifdef macintosh -#include "macbuildno.h" -#endif - #ifndef DONT_HAVE_STDIO_H #include <stdio.h> #endif diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 4a795ed..bf6a360 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -39,10 +39,6 @@ #define NOTE(x) #endif -#ifdef macintosh -char *strdup(char *); -#endif - /* String constants used to initialize module attributes. * */ diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 0f7b143..d60f320 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -6,12 +6,7 @@ #include <ctype.h> -#ifdef macintosh -#include <time.h> -#include <OSUtils.h> -#else #include <sys/types.h> -#endif #ifdef QUICKWIN #include <io.h> @@ -89,37 +84,6 @@ static double floattime(void); /* For Y2K check */ static PyObject *moddict; -#ifdef macintosh -/* Our own timezone. We have enough information to deduce whether -** DST is on currently, but unfortunately we cannot put it to good -** use because we don't know the rules (and that is needed to have -** localtime() return correct tm_isdst values for times other than -** the current time. So, we cop out and only tell the user the current -** timezone. -*/ -static long timezone; - -static void -initmactimezone(void) -{ - MachineLocation loc; - long delta; - - ReadLocation(&loc); - - if (loc.latitude == 0 && loc.longitude == 0 && loc.u.gmtDelta == 0) - return; - - delta = loc.u.gmtDelta & 0x00FFFFFF; - - if (delta & 0x00800000) - delta |= 0xFF000000; - - timezone = -delta; -} -#endif /* macintosh */ - - static PyObject * time_time(PyObject *self, PyObject *args) { @@ -636,17 +600,6 @@ void inittimezone(PyObject *m) { } } #else -#ifdef macintosh - /* The only thing we can obtain is the current timezone - ** (and whether dst is currently _active_, but that is not what - ** we're looking for:-( ) - */ - initmactimezone(); - PyModule_AddIntConstant(m, "timezone", timezone); - PyModule_AddIntConstant(m, "altzone", timezone); - PyModule_AddIntConstant(m, "daylight", 0); - PyModule_AddObject(m, "tzname", Py_BuildValue("(zz)", "", "")); -#endif /* macintosh */ #endif /* HAVE_STRUCT_TM_TM_ZONE */ #ifdef __CYGWIN__ tzset(); @@ -829,15 +782,6 @@ floatsleep(double secs) } } Py_END_ALLOW_THREADS -#elif defined(macintosh) -#define MacTicks (* (long *)0x16A) - long deadline; - deadline = MacTicks + (long)(secs * 60.0); - while (MacTicks < deadline) { - /* XXX Should call some yielding function here */ - if (PyErr_CheckSignals()) - return -1; - } #elif defined(__WATCOMC__) && !defined(__QNX__) /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS |