@@ -68,6 +68,54 @@ static int orig_argc;
6868static int keep_normal ;
6969static int keep_error = 1 ;
7070
71+ /* Initialize the Mac toolbox world */
72+
73+ static void
74+ init_mac_world ()
75+ {
76+ #ifdef THINK_C
77+ printf ("\n" );
78+ #else
79+ MaxApplZone ();
80+ InitGraf (& qd .thePort );
81+ InitFonts ();
82+ InitWindows ();
83+ TEInit ();
84+ InitDialogs ((long )0 );
85+ InitMenus ();
86+ InitCursor ();
87+ #endif
88+ }
89+
90+ /* Initialization code shared by interpreter and applets */
91+
92+ static void
93+ init_common ()
94+ {
95+
96+ /* Initialize toolboxes */
97+ init_mac_world ();
98+
99+ #ifdef USE_MAC_SHARED_LIBRARY
100+ /* Add the shared library to the stack of resource files */
101+ PyMac_AddLibResources ();
102+ #endif
103+
104+ #if defined(USE_GUSI )
105+ /* Setup GUSI */
106+ GUSIDefaultSetup ();
107+ #endif
108+
109+ #ifdef USE_SIOUX
110+ /* Set various SIOUX flags. Some are changed later based on options */
111+ SIOUXSettings .asktosaveonclose = 0 ;
112+ SIOUXSettings .showstatusline = 0 ;
113+ SIOUXSettings .tabspaces = 4 ;
114+ #endif
115+
116+ }
117+
118+
71119#ifdef USE_MAC_APPLET_SUPPORT
72120/* Applet support */
73121
@@ -112,14 +160,7 @@ PyMac_InitApplet()
112160 char * * argv ;
113161 int err ;
114162
115- #ifdef USE_MAC_SHARED_LIBRARY
116- PyMac_AddLibResources ();
117- #endif
118- #ifdef USE_SIOUX
119- SIOUXSettings .asktosaveonclose = 0 ;
120- SIOUXSettings .showstatusline = 0 ;
121- SIOUXSettings .tabspaces = 4 ;
122- #endif
163+ init_common ();
123164 argc = PyMac_GetArgv (& argv );
124165 Py_Initialize ();
125166 PySys_SetArgv (argc , argv );
@@ -139,14 +180,7 @@ PyMac_InitApplication()
139180 int argc ;
140181 char * * argv ;
141182
142- #ifdef USE_MAC_SHARED_LIBRARY
143- PyMac_AddLibResources ();
144- #endif
145- #ifdef USE_SIOUX
146- SIOUXSettings .asktosaveonclose = 0 ;
147- SIOUXSettings .showstatusline = 0 ;
148- SIOUXSettings .tabspaces = 4 ;
149- #endif
183+ init_common ();
150184 argc = PyMac_GetArgv (& argv );
151185 if ( argc > 1 ) {
152186 /* We're running a script. Attempt to change current directory */
@@ -181,8 +215,8 @@ PyMac_InteractiveOptions(int *inspect, int *verbose, int *suppress_print,
181215 /* Default-defaults: */
182216 * keep_error = 1 ;
183217 /* Get default settings from our preference file */
184- PyMac_PreferenceOptions (& inspect , & Py_VerboseFlag , & Py_SuppressPrintingFlag ,
185- & unbuffered , & Py_DebugFlag , & keep_normal , & keep_error );
218+ PyMac_PreferenceOptions (inspect , verbose , suppress_print ,
219+ unbuffered , debugging , keep_normal , keep_error );
186220 /* If option is pressed override these */
187221 GetKeys (rmap );
188222 map = (unsigned char * )rmap ;
0 commit comments