/*********************************************************** Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Python interpreter main program */ #include "Python.h" #include "pythonresources.h" #include "import.h" #include "marshal.h" #include "macglue.h" #include #include #include #include #include #include #include #ifdef __MWERKS__ #include #define USE_SIOUX #if __profile__ == 1 #include #endif #endif #ifdef THINK_C #include #endif #define STARTUP "PythonStartup" extern int Py_DebugFlag; /* For parser.c, declared in pythonrun.c */ extern int Py_VerboseFlag; /* For import.c, declared in pythonrun.c */ short PyMac_AppRefNum; /* RefNum of application resource fork */ /* For Py_GetArgcArgv(); set by main() */ static char **orig_argv; static int orig_argc; PyMac_PrefRecord options; static void Py_Main Py_PROTO((int, char **)); /* Forward */ void PyMac_Exit Py_PROTO((int)); /* Forward */ /* Initialize the Mac toolbox world */ static void init_mac_world() { #ifdef THINK_C printf("\n"); #else MaxApplZone(); InitGraf(&qd.thePort); InitFonts(); InitWindows(); TEInit(); InitDialogs((long)0); InitMenus(); InitCursor(); #endif } /* ** PyMac_InteractiveOptions - Allow user to set options if option key is pressed */ static void PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp) { KeyMap rmap; unsigned char *map; short item, type; ControlHandle handle; DialogPtr dialog; Rect rect; int old_argc = *argcp; int i; /* ** If the preferences disallows interactive options we return, ** similarly of