/*********************************************************** 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" #ifdef WITHOUT_FRAMEWORKS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #else #include #endif /* WITHOUT_FRAMEWORKS */ #ifdef __MWERKS__ #include #define USE_SIOUX extern int ccommand(char ***); #if __profile__ == 1 #include #endif /* __profile__ */ #endif /* __MWERKS__ */ #include #ifdef USE_MAC_SHARED_LIBRARY extern PyMac_AddLibResources(void); #endif #define STARTUP "PythonStartup" #define COPYRIGHT \ "Type \"copyright\", \"credits\" or \"license\" for more information." short PyMac_AppRefNum; /* RefNum of application resource fork */ /* For Py_GetArgcArgv(); set by main() */ static char **orig_argv; static int orig_argc; /* A flag which remembers whether the user has acknowledged all the console ** output (by typing something) */ #define STATE_UNKNOWN 0 #define STATE_LASTREAD 1 #define STATE_LASTWRITE 2 int console_output_state = STATE_UNKNOWN; PyMac_PrefRecord PyMac_options; static void PyMac_Main(int, char **, char *); /* Forward */ void PyMac_Exit(int); /* Forward */ /* Initialize the Mac toolbox world */ static void init_mac_world(void) { InitCursor(); } /* ** 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; /* ** If the preferences disallows interactive options we return, ** similarly of