mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
Getting rid of all the code inside #ifdef macintosh too.
This commit is contained in:
parent
4bae2d5e46
commit
eddc1449ba
19 changed files with 6 additions and 458 deletions
|
@ -7,13 +7,6 @@ extern "C" {
|
||||||
|
|
||||||
/* Operating system dependencies */
|
/* Operating system dependencies */
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#define SEP ':'
|
|
||||||
#define MAXPATHLEN 256
|
|
||||||
/* Mod by Jack: newline is less likely to occur in filenames than space */
|
|
||||||
#define DELIM '\n'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Mod by chrish: QNX has WATCOM, but isn't DOS */
|
/* Mod by chrish: QNX has WATCOM, but isn't DOS */
|
||||||
#if !defined(__QNX__)
|
#if !defined(__QNX__)
|
||||||
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)
|
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)
|
||||||
|
|
|
@ -63,10 +63,6 @@ typedef struct PyMemberDef {
|
||||||
|
|
||||||
/* Added by Jack: strings contained in the structure */
|
/* Added by Jack: strings contained in the structure */
|
||||||
#define T_STRING_INPLACE 13
|
#define T_STRING_INPLACE 13
|
||||||
#ifdef macintosh
|
|
||||||
#define T_PSTRING 14 /* macintosh pascal-style counted string */
|
|
||||||
#define T_PSTRING_INPLACE 15
|
|
||||||
#endif /* macintosh */
|
|
||||||
|
|
||||||
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
|
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
|
||||||
when the value is NULL, instead of
|
when the value is NULL, instead of
|
||||||
|
|
|
@ -31,56 +31,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Scheduler parameters */
|
|
||||||
typedef struct {
|
|
||||||
int check_interrupt; /* if true check for command-dot */
|
|
||||||
int process_events; /* if nonzero enable evt processing, this mask */
|
|
||||||
int besocial; /* Be social, give up CPU now and again */
|
|
||||||
double check_interval; /* how often to check */
|
|
||||||
double bg_yield; /* yield at most so long when in background */
|
|
||||||
} PyMacSchedParams;
|
|
||||||
|
|
||||||
unsigned char *Pstring(char *str); /* Convert c-string to pascal-string in static buffer */
|
|
||||||
|
|
||||||
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) */
|
|
||||||
extern OSErr PyMac_init_application_location(void); /* Init the above */
|
|
||||||
extern int PyMac_GetArgv(char ***, int); /* Get argc, argv (from macargv.c) */
|
|
||||||
|
|
||||||
extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
|
extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
|
||||||
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
|
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
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 */
|
|
||||||
PyObject * PyMac_LoadCodeResourceModule(char *, char *); /* Load 'PYD ' resource from file */
|
|
||||||
struct filedescr *PyMac_FindModuleExtension(char *, size_t *, char *); /* Look for module in single folder */
|
|
||||||
|
|
||||||
void PyMac_InitApplet(void); /* Initialize and run an Applet */
|
|
||||||
void PyMac_Initialize(void); /* Initialize function for embedding Python */
|
|
||||||
|
|
||||||
|
|
||||||
/* From macfiletype.c: */
|
|
||||||
|
|
||||||
long PyMac_getfiletype(char *); /* Get file type */
|
|
||||||
int PyMac_setfiletype(char *, long, long); /* Set file creator and type */
|
|
||||||
|
|
||||||
/* from macmain.c: */
|
|
||||||
void PyMac_Exit(int);
|
|
||||||
void PyMac_InitApplication(void);
|
|
||||||
void PyMac_OutputSeen(void);
|
|
||||||
void PyMac_OutputNotSeen(void);
|
|
||||||
int PyMac_GetDelayConsoleFlag(void);
|
|
||||||
|
|
||||||
/* from macgetargv: */
|
|
||||||
OSErr PyMac_init_process_location(void);
|
|
||||||
char * strdup(const char *str);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef __int64 hs_time;
|
||||||
#ifndef HAVE_GETTIMEOFDAY
|
#ifndef HAVE_GETTIMEOFDAY
|
||||||
#error "This module requires gettimeofday() on non-Windows platforms!"
|
#error "This module requires gettimeofday() on non-Windows platforms!"
|
||||||
#endif
|
#endif
|
||||||
#if defined(macintosh) || (defined(PYOS_OS2) && defined(PYCC_GCC))
|
#if (defined(PYOS_OS2) && defined(PYCC_GCC))
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
@ -47,10 +47,6 @@ typedef struct timeval hs_time;
|
||||||
|
|
||||||
#define BUFFERSIZE 10240
|
#define BUFFERSIZE 10240
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#define PATH_MAX 254
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
||||||
#define PATH_MAX 260
|
#define PATH_MAX 260
|
||||||
#endif
|
#endif
|
||||||
|
@ -940,7 +936,7 @@ calibrate(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined(MS_WINDOWS) || defined(macintosh) || defined(PYOS_OS2) || \
|
#if defined(MS_WINDOWS) || defined(PYOS_OS2) || \
|
||||||
defined(__VMS)
|
defined(__VMS)
|
||||||
rusage_diff = -1;
|
rusage_diff = -1;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -33,10 +33,6 @@ Copyright (C) 1994 Steen Lumholt.
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#define MAC_TCL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Allow using this code in Python 2.[12] */
|
/* Allow using this code in Python 2.[12] */
|
||||||
#ifndef PyDoc_STRVAR
|
#ifndef PyDoc_STRVAR
|
||||||
#define PyDoc_STRVAR(name,str) static char name[] = str
|
#define PyDoc_STRVAR(name,str) static char name[] = str
|
||||||
|
@ -96,15 +92,7 @@ Copyright (C) 1994 Steen Lumholt.
|
||||||
#error "unsupported Tcl configuration"
|
#error "unsupported Tcl configuration"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(macintosh)
|
#if !(defined(MS_WINDOWS) || defined(__CYGWIN__))
|
||||||
/* 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:-( */
|
|
||||||
#define HAVE_CREATEFILEHANDLER
|
#define HAVE_CREATEFILEHANDLER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -238,29 +226,6 @@ static PyThreadState *tcl_tstate = NULL;
|
||||||
|
|
||||||
#endif
|
#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
|
#ifndef FREECAST
|
||||||
#define FREECAST (char *)
|
#define FREECAST (char *)
|
||||||
#endif
|
#endif
|
||||||
|
@ -646,12 +611,6 @@ Tkapp_New(char *screenName, char *baseName, char *className,
|
||||||
v->ProcBodyType = Tcl_GetObjType("procbody");
|
v->ProcBodyType = Tcl_GetObjType("procbody");
|
||||||
v->StringType = Tcl_GetObjType("string");
|
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 */
|
/* Delete the 'exit' command, which can screw things up */
|
||||||
Tcl_DeleteCommand(v->interp, "exit");
|
Tcl_DeleteCommand(v->interp, "exit");
|
||||||
|
|
||||||
|
@ -3092,112 +3051,4 @@ init_tkinter(void)
|
||||||
Py_AtExit(Tcl_Finalize);
|
Py_AtExit(Tcl_Finalize);
|
||||||
#endif
|
#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 */
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#include "macbuildno.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DONT_HAVE_STDIO_H
|
#ifndef DONT_HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,10 +39,6 @@
|
||||||
#define NOTE(x)
|
#define NOTE(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
char *strdup(char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* String constants used to initialize module attributes.
|
/* String constants used to initialize module attributes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,12 +6,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#include <time.h>
|
|
||||||
#include <OSUtils.h>
|
|
||||||
#else
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef QUICKWIN
|
#ifdef QUICKWIN
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -89,37 +84,6 @@ static double floattime(void);
|
||||||
/* For Y2K check */
|
/* For Y2K check */
|
||||||
static PyObject *moddict;
|
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 *
|
static PyObject *
|
||||||
time_time(PyObject *self, PyObject *args)
|
time_time(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -636,17 +600,6 @@ void inittimezone(PyObject *m) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#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 */
|
#endif /* HAVE_STRUCT_TM_TM_ZONE */
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
tzset();
|
tzset();
|
||||||
|
@ -829,15 +782,6 @@ floatsleep(double secs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Py_END_ALLOW_THREADS
|
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__)
|
#elif defined(__WATCOMC__) && !defined(__QNX__)
|
||||||
/* XXX Can't interrupt this sleep */
|
/* XXX Can't interrupt this sleep */
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#if !defined(__STDC__) && !defined(macintosh)
|
#if !defined(__STDC__)
|
||||||
extern double fmod(double, double);
|
extern double fmod(double, double);
|
||||||
extern double pow(double, double);
|
extern double pow(double, double);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#include "macglue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Py_REF_DEBUG
|
#ifdef Py_REF_DEBUG
|
||||||
long _Py_RefTotal;
|
long _Py_RefTotal;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -92,14 +92,6 @@ PyOS_InterruptOccurred(void)
|
||||||
#endif /* MSDOS && !QUICKWIN */
|
#endif /* MSDOS && !QUICKWIN */
|
||||||
|
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
|
|
||||||
/* The Mac interrupt code has moved to macglue.c */
|
|
||||||
#define OK
|
|
||||||
|
|
||||||
#endif /* macintosh */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef OK
|
#ifndef OK
|
||||||
|
|
||||||
/* Default version -- for real operating systems and for Standard C */
|
/* Default version -- for real operating systems and for Standard C */
|
||||||
|
|
|
@ -153,15 +153,6 @@ Py_FatalError(const char *msg)
|
||||||
Py_Exit(1);
|
Py_Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
/* ARGSUSED */
|
|
||||||
int
|
|
||||||
guesstabsize(char *path)
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* No-nonsense my_readline() for tokenizer.c */
|
/* No-nonsense my_readline() for tokenizer.c */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -784,7 +784,6 @@ tok_nextc(register struct tok_state *tok)
|
||||||
done = tok->inp[-1] == '\n';
|
done = tok->inp[-1] == '\n';
|
||||||
}
|
}
|
||||||
tok->cur = tok->buf + cur;
|
tok->cur = tok->buf + cur;
|
||||||
#ifndef macintosh
|
|
||||||
/* replace "\r\n" with "\n" */
|
/* replace "\r\n" with "\n" */
|
||||||
/* For Mac we leave the \r, giving a syntax error */
|
/* For Mac we leave the \r, giving a syntax error */
|
||||||
pt = tok->inp - 2;
|
pt = tok->inp - 2;
|
||||||
|
@ -793,7 +792,6 @@ tok_nextc(register struct tok_state *tok)
|
||||||
*pt = '\0';
|
*pt = '\0';
|
||||||
tok->inp = pt;
|
tok->inp = pt;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (tok->done != E_OK) {
|
if (tok->done != E_OK) {
|
||||||
if (tok->prompt != NULL)
|
if (tok->prompt != NULL)
|
||||||
|
@ -1185,15 +1183,6 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
|
||||||
return NEWLINE;
|
return NEWLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
if (c == '\r') {
|
|
||||||
PySys_WriteStderr(
|
|
||||||
"File contains \\r characters (incorrect line endings?)\n");
|
|
||||||
tok->done = E_TOKEN;
|
|
||||||
tok->cur = tok->inp;
|
|
||||||
return ERRORTOKEN;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Period or number starting with period? */
|
/* Period or number starting with period? */
|
||||||
if (c == '.') {
|
if (c == '.') {
|
||||||
c = tok_nextc(tok);
|
c = tok_nextc(tok);
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
#include "opcode.h"
|
#include "opcode.h"
|
||||||
#include "structmember.h"
|
#include "structmember.h"
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#include "macglue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
/* Turn this on if your compiler chokes on the big switch: */
|
/* Turn this on if your compiler chokes on the big switch: */
|
||||||
|
@ -801,7 +797,7 @@ eval_frame(PyFrameObject *f)
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !defined(HAVE_SIGNAL_H) || defined(macintosh)
|
#if !defined(HAVE_SIGNAL_H)
|
||||||
/* If we have true signals, the signal handler
|
/* If we have true signals, the signal handler
|
||||||
will call Py_AddPendingCall() so we don't
|
will call Py_AddPendingCall() so we don't
|
||||||
have to call PyErr_CheckSignals(). On the
|
have to call PyErr_CheckSignals(). On the
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
extern char *PyMac_StrError(int);
|
|
||||||
#undef strerror
|
|
||||||
#define strerror PyMac_StrError
|
|
||||||
#endif /* macintosh */
|
|
||||||
|
|
||||||
#ifndef __STDC__
|
#ifndef __STDC__
|
||||||
#ifndef MS_WINDOWS
|
#ifndef MS_WINDOWS
|
||||||
extern char *strerror(int);
|
extern char *strerror(int);
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
#include "eval.h"
|
#include "eval.h"
|
||||||
#include "osdefs.h"
|
#include "osdefs.h"
|
||||||
#include "importdl.h"
|
#include "importdl.h"
|
||||||
#ifdef macintosh
|
|
||||||
#include "macglue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -835,9 +832,6 @@ write_compiled_module(PyCodeObject *co, char *cpathname, long mtime)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (Py_VerboseFlag)
|
if (Py_VerboseFlag)
|
||||||
PySys_WriteStderr("# wrote %s\n", cpathname);
|
PySys_WriteStderr("# wrote %s\n", cpathname);
|
||||||
#ifdef macintosh
|
|
||||||
PyMac_setfiletype(cpathname, 'Pyth', 'PYC ');
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1123,13 +1117,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
strcat(buf, ".");
|
strcat(buf, ".");
|
||||||
strcat(buf, name);
|
strcat(buf, name);
|
||||||
strcpy(name, buf);
|
strcpy(name, buf);
|
||||||
#ifdef macintosh
|
|
||||||
/* Freezing on the mac works different, and the modules are
|
|
||||||
** actually on sys.path. So we don't take the quick exit but
|
|
||||||
** continue with the normal flow.
|
|
||||||
*/
|
|
||||||
path = NULL;
|
|
||||||
#else
|
|
||||||
if (find_frozen(name) != NULL) {
|
if (find_frozen(name) != NULL) {
|
||||||
strcpy(buf, name);
|
strcpy(buf, name);
|
||||||
return &fd_frozen;
|
return &fd_frozen;
|
||||||
|
@ -1137,7 +1124,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
PyErr_Format(PyExc_ImportError,
|
PyErr_Format(PyExc_ImportError,
|
||||||
"No frozen submodule named %.200s", name);
|
"No frozen submodule named %.200s", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
if (is_builtin(name)) {
|
if (is_builtin(name)) {
|
||||||
|
@ -1233,33 +1219,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
/* no hook was successful, use builtin import */
|
/* no hook was successful, use builtin import */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
/*
|
|
||||||
** Speedup: each sys.path item is interned, and
|
|
||||||
** FindResourceModule remembers which items refer to
|
|
||||||
** folders (so we don't have to bother trying to look
|
|
||||||
** into them for resources). We only do this for string
|
|
||||||
** items.
|
|
||||||
*/
|
|
||||||
if (PyString_Check(PyList_GET_ITEM(path, i))) {
|
|
||||||
PyString_InternInPlace(&PyList_GET_ITEM(path, i));
|
|
||||||
v = PyList_GET_ITEM(path, i);
|
|
||||||
if (PyMac_FindResourceModule((PyStringObject *)v, name, buf)) {
|
|
||||||
static struct filedescr resfiledescr =
|
|
||||||
{"", "", PY_RESOURCE};
|
|
||||||
|
|
||||||
Py_XDECREF(copy);
|
|
||||||
return &resfiledescr;
|
|
||||||
}
|
|
||||||
if (PyMac_FindCodeResourceModule((PyStringObject *)v, name, buf)) {
|
|
||||||
static struct filedescr resfiledescr =
|
|
||||||
{"", "", PY_CODERESOURCE};
|
|
||||||
|
|
||||||
Py_XDECREF(copy);
|
|
||||||
return &resfiledescr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (len > 0 && buf[len-1] != SEP
|
if (len > 0 && buf[len-1] != SEP
|
||||||
#ifdef ALTSEP
|
#ifdef ALTSEP
|
||||||
&& buf[len-1] != ALTSEP
|
&& buf[len-1] != ALTSEP
|
||||||
|
@ -1290,10 +1249,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef macintosh
|
|
||||||
fdp = PyMac_FindModuleExtension(buf, &len, name);
|
|
||||||
if (fdp) {
|
|
||||||
#else
|
|
||||||
#if defined(PYOS_OS2)
|
#if defined(PYOS_OS2)
|
||||||
/* take a snapshot of the module spec for restoration
|
/* take a snapshot of the module spec for restoration
|
||||||
* after the 8 character DLL hackery
|
* after the 8 character DLL hackery
|
||||||
|
@ -1331,7 +1286,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
strcpy(buf+len, fdp->suffix);
|
strcpy(buf+len, fdp->suffix);
|
||||||
if (Py_VerboseFlag > 1)
|
if (Py_VerboseFlag > 1)
|
||||||
PySys_WriteStderr("# trying %s\n", buf);
|
PySys_WriteStderr("# trying %s\n", buf);
|
||||||
#endif /* !macintosh */
|
|
||||||
filemode = fdp->mode;
|
filemode = fdp->mode;
|
||||||
if (filemode[0] == 'U')
|
if (filemode[0] == 'U')
|
||||||
filemode = "r" PY_STDIOTEXTMODE;
|
filemode = "r" PY_STDIOTEXTMODE;
|
||||||
|
@ -1408,9 +1362,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
#elif defined(DJGPP)
|
#elif defined(DJGPP)
|
||||||
#include <dir.h>
|
#include <dir.h>
|
||||||
|
|
||||||
#elif defined(macintosh)
|
|
||||||
#include <TextUtils.h>
|
|
||||||
|
|
||||||
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
|
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -1475,24 +1426,6 @@ case_ok(char *buf, int len, int namelen, char *name)
|
||||||
}
|
}
|
||||||
return strncmp(ffblk.ff_name, name, namelen) == 0;
|
return strncmp(ffblk.ff_name, name, namelen) == 0;
|
||||||
|
|
||||||
/* macintosh */
|
|
||||||
#elif defined(macintosh)
|
|
||||||
FSSpec fss;
|
|
||||||
OSErr err;
|
|
||||||
|
|
||||||
if (Py_GETENV("PYTHONCASEOK") != NULL)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
err = FSMakeFSSpec(0, 0, Pstring(buf), &fss);
|
|
||||||
if (err) {
|
|
||||||
PyErr_Format(PyExc_NameError,
|
|
||||||
"Can't find file for module %.100s\n(filename %.300s)",
|
|
||||||
name, buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return fss.name[0] >= namelen &&
|
|
||||||
strncmp(name, (char *)fss.name+1, namelen) == 0;
|
|
||||||
|
|
||||||
/* new-fangled macintosh (macosx) */
|
/* new-fangled macintosh (macosx) */
|
||||||
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
|
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
|
@ -1709,15 +1642,6 @@ load_module(char *name, FILE *fp, char *buf, int type, PyObject *loader)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
case PY_RESOURCE:
|
|
||||||
m = PyMac_LoadResourceModule(name, buf);
|
|
||||||
break;
|
|
||||||
case PY_CODERESOURCE:
|
|
||||||
m = PyMac_LoadCodeResourceModule(name, buf);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case PKG_DIRECTORY:
|
case PKG_DIRECTORY:
|
||||||
m = load_package(name, buf);
|
m = load_package(name, buf);
|
||||||
break;
|
break;
|
||||||
|
@ -2678,21 +2602,6 @@ imp_load_source(PyObject *self, PyObject *args)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
static PyObject *
|
|
||||||
imp_load_resource(PyObject *self, PyObject *args)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
char *pathname;
|
|
||||||
PyObject *m;
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "ss:load_resource", &name, &pathname))
|
|
||||||
return NULL;
|
|
||||||
m = PyMac_LoadResourceModule(name, pathname);
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
#endif /* macintosh */
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
imp_load_module(PyObject *self, PyObject *args)
|
imp_load_module(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -2822,9 +2731,6 @@ static PyMethodDef imp_methods[] = {
|
||||||
{"load_dynamic", imp_load_dynamic, METH_VARARGS},
|
{"load_dynamic", imp_load_dynamic, METH_VARARGS},
|
||||||
#endif
|
#endif
|
||||||
{"load_package", imp_load_package, METH_VARARGS},
|
{"load_package", imp_load_package, METH_VARARGS},
|
||||||
#ifdef macintosh
|
|
||||||
{"load_resource", imp_load_resource, METH_VARARGS},
|
|
||||||
#endif
|
|
||||||
{"load_source", imp_load_source, METH_VARARGS},
|
{"load_source", imp_load_source, METH_VARARGS},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
#include "macglue.h"
|
|
||||||
#endif
|
|
||||||
extern char *Py_GetPath(void);
|
extern char *Py_GetPath(void);
|
||||||
|
|
||||||
extern grammar _PyParser_Grammar; /* From graminit.c */
|
extern grammar _PyParser_Grammar; /* From graminit.c */
|
||||||
|
@ -755,13 +752,6 @@ maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit)
|
||||||
if (strcmp(ext, ".pyc") == 0 || strcmp(ext, ".pyo") == 0)
|
if (strcmp(ext, ".pyc") == 0 || strcmp(ext, ".pyo") == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
/* On a mac, we also assume a pyc file for types 'PYC ' and 'APPL' */
|
|
||||||
if (PyMac_getfiletype((char *)filename) == 'PYC '
|
|
||||||
|| PyMac_getfiletype((char *)filename) == 'APPL')
|
|
||||||
return 1;
|
|
||||||
#endif /* macintosh */
|
|
||||||
|
|
||||||
/* Only look into the file if we are allowed to close it, since
|
/* Only look into the file if we are allowed to close it, since
|
||||||
it then should also be seekable. */
|
it then should also be seekable. */
|
||||||
if (closeit) {
|
if (closeit) {
|
||||||
|
@ -1542,11 +1532,7 @@ Py_Exit(int sts)
|
||||||
{
|
{
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
PyMac_Exit(sts);
|
|
||||||
#else
|
|
||||||
exit(sts);
|
exit(sts);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -17,8 +17,3 @@ strerror(int err)
|
||||||
PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
|
PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef macintosh
|
|
||||||
int sys_nerr = 0;
|
|
||||||
char *sys_errlist[1] = 0;
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -103,23 +103,6 @@ PyMember_GetOne(char *addr, PyMemberDef *l)
|
||||||
case T_STRING_INPLACE:
|
case T_STRING_INPLACE:
|
||||||
v = PyString_FromString((char*)addr);
|
v = PyString_FromString((char*)addr);
|
||||||
break;
|
break;
|
||||||
#ifdef macintosh
|
|
||||||
case T_PSTRING:
|
|
||||||
if (*(char**)addr == NULL) {
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
v = Py_None;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
v = PyString_FromStringAndSize(
|
|
||||||
(*(char**)addr)+1,
|
|
||||||
**(unsigned char**)addr);
|
|
||||||
break;
|
|
||||||
case T_PSTRING_INPLACE:
|
|
||||||
v = PyString_FromStringAndSize(
|
|
||||||
((char*)addr)+1,
|
|
||||||
*(unsigned char*)addr);
|
|
||||||
break;
|
|
||||||
#endif /* macintosh */
|
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
v = PyString_FromStringAndSize((char*)addr, 1);
|
v = PyString_FromStringAndSize((char*)addr, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -168,11 +151,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
||||||
{
|
{
|
||||||
PyObject *oldv;
|
PyObject *oldv;
|
||||||
|
|
||||||
if ((l->flags & READONLY) || l->type == T_STRING
|
if ((l->flags & READONLY) || l->type == T_STRING)
|
||||||
#ifdef macintosh
|
|
||||||
|| l->type == T_PSTRING
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue