2 * Generated with the GUSIConfig application and then hand-modified by jack.
6 #include <GUSIConfig.h>
12 #include "pythonresources.h"
15 PyMac_GUSISpin(bool wait
)
17 static Boolean inForeground
= true;
18 int maxsleep
= 6; /* 6 ticks is "normal" sleeptime */
20 if (PyMac_ConsoleIsDead
) return;
25 PyMac_DoYield(maxsleep
, 0); /* XXXX or is it safe to call python here? */
29 /* Declarations of Socket Factories */
32 void GUSIwithInetSockets();
33 void GUSIwithLocalSockets();
34 void GUSIwithMTInetSockets();
35 void GUSIwithMTTcpSockets();
36 void GUSIwithMTUdpSockets();
37 void GUSIwithOTInetSockets();
38 void GUSIwithOTTcpSockets();
39 void GUSIwithOTUdpSockets();
40 void GUSIwithPPCSockets();
41 void GUSISetupFactories();
44 /* Configure Socket Factories */
46 void GUSISetupFactories()
48 #ifdef GUSISetupFactories_BeginHook
49 GUSISetupFactories_BeginHook
51 #if 1 || TARGET_API_MAC_CARBON
52 GUSIwithInetSockets();
54 GUSIwithMTInetSockets();
56 #ifdef GUSISetupFactories_EndHook
57 GUSISetupFactories_EndHook
61 /* Declarations of File Devices */
64 void GUSIwithDConSockets();
65 void GUSIwithNullSockets();
66 void GUSISetupDevices();
69 /* Configure File Devices */
71 void GUSISetupDevices()
73 #ifdef GUSISetupDevices_BeginHook
74 GUSISetupDevices_BeginHook
76 #ifdef GUSISetupDevices_EndHook
77 GUSISetupDevices_EndHook
82 #error GUSISetupConfig() needs to be written in C++
85 GUSIConfiguration::FileSuffix sSuffices
[] = {
88 extern "C" void GUSISetupConfig()
91 short oldrh
, prefrh
= -1;
92 short resource_id
= GUSIConfiguration::kNoResource
;
96 /* Try override from the application resource fork */
97 UseResFile(PyMac_AppRefNum
);
98 h
= Get1Resource('GU\267I', GUSIOPTIONSOVERRIDE_ID
);
100 resource_id
= GUSIOPTIONSOVERRIDE_ID
;
102 /* Next try normal resource from preference file */
103 prefrh
= PyMac_OpenPrefFile();
104 h
= Get1Resource('GU\267I', GUSIOPTIONS_ID
);
106 resource_id
= GUSIOPTIONS_ID
;
108 /* Finally try normal resource from application */
109 if ( prefrh
!= -1 ) {
110 CloseResFile(prefrh
);
113 resource_id
= GUSIOPTIONS_ID
;
117 /* Now we have the right resource file topmost and the id. Init GUSI. */
118 GUSIConfiguration
* config
=
119 GUSIConfiguration::CreateInstance(resource_id
);
121 /* Finally restore the old resource file */
122 if ( prefrh
!= -1) CloseResFile(prefrh
);
125 config
->ConfigureDefaultTypeCreator('TEXT', 'R*ch');
127 config
->ConfigureSuffices(
128 sizeof(sSuffices
)/sizeof(GUSIConfiguration::FileSuffix
)-1, sSuffices
);
130 config
->ConfigureAutoInitGraf(false);
131 config
->ConfigureAutoSpin(false);
132 config
->ConfigureHandleAppleEvents(false);
133 config
->ConfigureSigInt(false);
134 config
->ConfigureSigPipe(true);
136 GUSISetHook(GUSI_SpinHook
, (GUSIHook
)PyMac_GUSISpin
);
140 /**************** END GUSI CONFIGURATION *************************/