5 void display_init(
struct tdisplay* d);
6 void internalc_init(
struct tinternalc* ic);
7 void resources_init(
struct tresources* t);
8 void resources_clear(
struct tresources* t);
9 void threads_init(
struct tthreads* t);
11 #if !defined(FRONTEND_DOES_SNAPSHOTS)
12 void Snapshot_init(
struct tSnapshot *);
15 void EAI_C_CommonFunctions_init(
struct tEAI_C_CommonFunctions*);
16 void EAIEventsIn_init(
struct tEAIEventsIn* t);
17 void EAIHelpers_init(
struct tEAIHelpers* t);
19 #if !defined(EXCLUDE_EAI)
20 void EAICore_init(
struct tEAICore* t);
23 void SensInterps_init(
struct tSensInterps *t);
24 void ConsoleMessage_init(
struct tConsoleMessage *t);
25 void Mainloop_init(
struct tMainloop *t);
26 void Mainloop_clear(
struct tMainloop *t);
27 void ProdCon_init(
struct tProdCon *t);
28 void ProdCon_clear(
struct tProdCon *t);
30 #if defined (INCLUDE_NON_WEB3D_FORMATS)
31 void ColladaParser_init(
struct tColladaParser *t);
32 #endif //INCLUDE_NON_WEB3D_FORMATS
34 #if defined (INCLUDE_STL_FILES)
35 void STL_Handler_init (
struct tSTLHandler *t);
36 #endif // INCLUDE_STL_FILES
40 void Frustum_init(
struct tFrustum *t);
41 void LoadTextures_init(
struct tLoadTextures *t);
42 void OpenGL_Utils_init(
struct tOpenGL_Utils *t);
43 void OpenGL_Utils_clear(
struct tOpenGL_Utils *t);
45 void OpenCL_Utils_init(
struct tOpenCL_Utils *t);
48 void RenderTextures_init(
struct tRenderTextures *t);
49 void Textures_init(
struct tTextures *t);
50 void Textures_clear(
struct tTextures *t);
51 void PluginSocket_init(
struct tPluginSocket *t);
52 void pluginUtils_init(
struct tpluginUtils *t);
53 void collision_init(
struct tcollision *t);
54 void collision_clear(
struct tcollision *t);
55 void Component_CubeMapTexturing_init(
struct tComponent_CubeMapTexturing *t);
56 void Component_CubeMapTexturing_clear(
struct tComponent_CubeMapTexturing *t);
57 void Component_EnvironSensor_init(
struct tComponent_EnvironSensor *t);
58 void Component_Geometry3D_init(
struct tComponent_Geometry3D *t);
59 void Component_Geometry3D_clear(
struct tComponent_Geometry3D *t);
60 void Component_Geospatial_init(
struct tComponent_Geospatial *t);
61 void Component_HAnim_init(
struct tComponent_HAnim *t);
62 void Component_HAnim_clear(
struct tComponent_HAnim *t);
63 void Component_Layering_init(
struct tComponent_Layering *t);
64 void Component_Layout_init(
struct tComponent_Layout *t);
65 void Component_NURBS_init(
struct tComponent_NURBS *t);
66 void Component_ParticleSystems_init(
struct tComponent_ParticleSystems *t);
67 void Component_ParticleSystems_clear(
struct tComponent_ParticleSystems *t);
68 void Component_ProgrammableShaders_init(
struct tComponent_ProgrammableShaders *t);
69 void Component_ProgrammableShaders_clear(
struct tComponent_ProgrammableShaders *t);
70 void Component_RigidBodyPhysics_init(
struct tComponent_RigidBodyPhysics *t);
71 void Component_RigidBodyPhysics_clear(
struct tComponent_RigidBodyPhysics *t);
72 void Component_Followers_init(
struct tComponent_Followers *t);
73 void Component_Followers_clear(
struct tComponent_Followers *t);
75 void Component_KeyDevice_init(
struct tComponent_KeyDevice *t);
78 OLDCODEvoid Component_Networking_init(
struct tComponent_Networking *t);
81 void Component_Picking_init(
struct tComponent_Picking *t);
82 void Component_Rendering_init(
struct tComponent_Rendering *t);
83 void Component_Rendering_clear(
struct tComponent_Rendering *t);
84 void Component_Shape_init(
struct tComponent_Shape *t);
85 void Component_Sound_init(
struct tComponent_Sound *t);
86 void Component_Text_init(
struct tComponent_Text *t);
87 void Component_Text_clear(
struct tComponent_Text *t);
88 void Component_Layering_clear(
struct tComponent_Layering *t);
89 void Component_Layout_clear(
struct tComponent_Layout *t);
90 void Component_VolumeRendering_init(
struct tComponent_VolumeRendering *t);
91 void Component_VolumeRendering_clear(
struct tComponent_VolumeRendering *t);
93 void RenderFuncs_init(
struct tRenderFuncs *t);
94 void RenderFuncs_clear(
struct tRenderFuncs *t);
95 void StreamPoly_init(
struct tStreamPoly *t);
96 void Tess_init(
struct tTess *t);
97 void Viewer_init(
struct tViewer *t);
99 #if defined(STATUSBAR_HUD)
100 void statusbar_init(
struct tstatusbar *t);
101 void statusbar_clear(
struct tstatusbar *t);
104 void CParse_init(
struct tCParse *t);
105 void CParse_clear(
struct tCParse *t);
106 void CParseParser_init(
struct tCParseParser *t);
107 void CRoutes_init(
struct tCRoutes *t);
108 void CRoutes_clear(
struct tCRoutes *t);
109 void CScripts_init(
struct tCScripts *t);
110 void JScript_init(
struct tJScript *t);
113 void jsUtils_init(
struct tjsUtils *t);
114 void jsVRMLBrowser_init(
struct tjsVRMLBrowser *t);
115 void jsVRMLClasses_init(
struct tjsVRMLClasses *t);
117 void Bindable_init(
struct tBindable *t);
118 void Bindable_clear(
struct tBindable *t);
120 void X3DParser_init(
struct tX3DParser *t);
121 void X3DParser_clear(
struct tX3DParser *t);
123 void common_init(
struct tcommon *t);
124 void common_clear(
struct tcommon *t);
125 void CursorDraw_init(
struct tCursorDraw *t);
128 static int done_main_UI_thread_once = 0;
129 pthread_key_t threadSpecificKey;
145 memset(iglobal,0,
sizeof(
struct iiglobal));
147 if(!done_main_UI_thread_once){
148 pthread_key_create(&threadSpecificKey, NULL);
149 done_main_UI_thread_once = 1;
151 fwl_setCurrentHandle(iglobal,__FILE__,__LINE__);
153 #if defined(WRAP_MALLOC) || defined(DEBUG_MALLOC)
154 iglobal->__memTable_ShouldRegisterAllocation = TRUE;
155 freewrlInitMemTable();
159 display_init(&iglobal->display);
160 internalc_init(&iglobal->internalc);
161 resources_init(&iglobal->resources);
162 threads_init(&iglobal->threads);
165 #if !defined(FRONTEND_DOES_SNAPSHOTS)
166 Snapshot_init(&iglobal->Snapshot);
169 EAI_C_CommonFunctions_init(&iglobal->EAI_C_CommonFunctions);
170 #if !defined(EXCLUDE_EAI)
171 EAIEventsIn_init(&iglobal->EAIEventsIn);
172 EAIHelpers_init(&iglobal->EAIHelpers);
173 EAICore_init(&iglobal->EAICore);
176 SensInterps_init(&iglobal->SensInterps);
177 ConsoleMessage_init(&iglobal->ConsoleMessage);
178 Mainloop_init(&iglobal->Mainloop);
179 ProdCon_init(&iglobal->ProdCon);
181 #if defined (INCLUDE_NON_WEB3D_FORMATS)
182 ColladaParser_init(&iglobal->ColladaParser);
183 #endif //INCLUDE_NON_WEB3D_FORMATS
185 #if defined (INCLUDE_STL_FILES)
186 STL_Handler_init (&iglobal->STLHandler);
187 #endif // INCLUDE_STL_FILES
189 Frustum_init(&iglobal->Frustum);
190 LoadTextures_init(&iglobal->LoadTextures);
191 OpenGL_Utils_init(&iglobal->OpenGL_Utils);
193 OpenCL_Utils_init(&iglobal->OpenCL_Utils);
197 RenderTextures_init(&iglobal->RenderTextures);
198 Textures_init(&iglobal->Textures);
200 #ifndef NO_PLUGINSOCKET
201 PluginSocket_init(&iglobal->PluginSocket);
203 pluginUtils_init(&iglobal->pluginUtils);
205 collision_init(&iglobal->collision);
206 Component_CubeMapTexturing_init(&iglobal->Component_CubeMapTexturing);
207 Component_EnvironSensor_init(&iglobal->Component_EnvironSensor);
208 Component_Geometry3D_init(&iglobal->Component_Geometry3D);
209 Component_Geospatial_init(&iglobal->Component_Geospatial);
210 Component_HAnim_init(&iglobal->Component_HAnim);
211 Component_Layering_init(&iglobal->Component_Layering);
212 Component_Layout_init(&iglobal->Component_Layout);
213 Component_NURBS_init(&iglobal->Component_NURBS);
214 Component_ProgrammableShaders_init(&iglobal->Component_ProgrammableShaders);
215 Component_ParticleSystems_init(&iglobal->Component_ParticleSystems);
216 Component_RigidBodyPhysics_init(&iglobal->Component_RigidBodyPhysics);
217 Component_Followers_init(&iglobal->Component_Followers);
218 Component_KeyDevice_init(&iglobal->Component_KeyDevice);
220 OLDCODE Component_Networking_init(&iglobal->Component_Networking);
222 Component_Picking_init(&iglobal->Component_Picking);
223 Component_Rendering_init(&iglobal->Component_Rendering);
224 Component_Shape_init(&iglobal->Component_Shape);
225 Component_Sound_init(&iglobal->Component_Sound);
226 Component_Text_init(&iglobal->Component_Text);
227 Component_VolumeRendering_init(&iglobal->Component_VolumeRendering);
228 RenderFuncs_init(&iglobal->RenderFuncs);
229 StreamPoly_init(&iglobal->StreamPoly);
230 Tess_init(&iglobal->Tess);
231 Viewer_init(&iglobal->Viewer);
232 #if defined(STATUSBAR_HUD)
233 statusbar_init(&iglobal->statusbar);
235 CParse_init(&iglobal->CParse);
236 CParseParser_init(&iglobal->CParseParser);
237 CRoutes_init(&iglobal->CRoutes);
238 CScripts_init(&iglobal->CScripts);
239 JScript_init(&iglobal->JScript);
242 jsUtils_init(&iglobal->jsUtils);
243 jsVRMLBrowser_init(&iglobal->jsVRMLBrowser);
244 jsVRMLClasses_init(&iglobal->jsVRMLClasses);
246 Bindable_init(&iglobal->Bindable);
247 X3DParser_init(&iglobal->X3DParser);
248 common_init(&iglobal->common);
250 CursorDraw_init(&iglobal->CursorDraw);
255 if(!done_main_UI_thread_once){
256 pthread_key_create(&threadSpecificKey, NULL);
257 done_main_UI_thread_once = 1;
259 fwl_setCurrentHandle(iglobal,__FILE__,__LINE__);
264 void __iglobal_fields_destructor(
ttglobal tg);
265 void remove_iglobal_from_table(
ttglobal tg);
266 void __iglobal_destructor(
ttglobal tg);
268 void iglobal_destructor(
ttglobal tg)
270 __iglobal_fields_destructor(tg);
271 __iglobal_destructor(tg);
274 void __iglobal_fields_destructor(
ttglobal tg)
278 FREE_IF_NZ(tg->CursorDraw.prv);
279 common_clear(&tg->common); FREE_IF_NZ(tg->common.prv);
280 X3DParser_clear(&tg->X3DParser); FREE_IF_NZ(tg->X3DParser.prv);
281 Bindable_clear(&tg->Bindable); FREE_IF_NZ(tg->Bindable.prv);
283 FREE_IF_NZ(tg->jsVRMLClasses.prv);
284 FREE_IF_NZ(tg->jsVRMLBrowser.prv);
285 FREE_IF_NZ(tg->jsUtils.prv);
287 FREE_IF_NZ(tg->JScript.prv);
288 FREE_IF_NZ(tg->CScripts.prv);
289 CRoutes_clear(&tg->CRoutes); FREE_IF_NZ(tg->CRoutes.prv);
290 FREE_IF_NZ(tg->CParseParser.prv);
291 CParse_clear(&tg->CParse); FREE_IF_NZ(tg->CParse.prv);
292 #if defined(STATUSBAR_HUD)
293 statusbar_clear(&tg->statusbar);
295 FREE_IF_NZ(tg->statusbar.prv);
296 FREE_IF_NZ(tg->Viewer.prv);
297 FREE_IF_NZ(tg->Tess.prv);
298 Component_VolumeRendering_clear(&tg->Component_VolumeRendering); FREE_IF_NZ(tg->Component_VolumeRendering.prv);
299 FREE_IF_NZ(tg->StreamPoly.prv);
300 FREE_IF_NZ(tg->Component_Sound.prv);
301 RenderFuncs_clear(&tg->RenderFuncs); FREE_IF_NZ(tg->RenderFuncs.prv);
302 Component_Text_clear(&tg->Component_Text); FREE_IF_NZ(tg->Component_Text.prv);
303 FREE_IF_NZ(tg->Component_Shape.prv);
304 Component_Rendering_clear(&tg->Component_Rendering); FREE_IF_NZ(tg->Component_Rendering.prv);
305 FREE_IF_NZ(tg->Component_Picking.prv);
307 OLDCODE FREE_IF_NZ(tg->Component_Networking.prv);
309 FREE_IF_NZ(tg->Component_KeyDevice.prv);
310 Component_Followers_clear(&tg->Component_Followers); FREE_IF_NZ(tg->Component_Followers.prv);
311 Component_RigidBodyPhysics_clear(&tg->Component_RigidBodyPhysics); FREE_IF_NZ(tg->Component_RigidBodyPhysics.prv);
312 Component_ProgrammableShaders_clear(&tg->Component_ProgrammableShaders); FREE_IF_NZ(tg->Component_ProgrammableShaders.prv);
313 Component_ParticleSystems_clear(&tg->Component_ParticleSystems); FREE_IF_NZ(tg->Component_ParticleSystems.prv);
314 FREE_IF_NZ(tg->Component_NURBS.prv);
315 Component_Layering_clear(&tg->Component_Layering); FREE_IF_NZ(tg->Component_Layering.prv);
316 Component_Layout_clear(&tg->Component_Layout); FREE_IF_NZ(tg->Component_Layout.prv);
317 Component_HAnim_clear(&tg->Component_HAnim); FREE_IF_NZ(tg->Component_HAnim.prv);
318 FREE_IF_NZ(tg->Component_Geospatial.prv);
319 Component_Geometry3D_clear(&tg->Component_Geometry3D); FREE_IF_NZ(tg->Component_Geometry3D.prv);
320 FREE_IF_NZ(tg->Component_EnvironSensor.prv);
321 Component_CubeMapTexturing_clear(&tg->Component_CubeMapTexturing); FREE_IF_NZ(tg->Component_CubeMapTexturing.prv);
322 collision_clear(&tg->collision); FREE_IF_NZ(tg->collision.prv);
323 FREE_IF_NZ(tg->pluginUtils.prv);
324 FREE_IF_NZ(tg->PluginSocket.prv);
325 Textures_clear(&tg->Textures); FREE_IF_NZ(tg->Textures.prv);
326 FREE_IF_NZ(tg->RenderTextures.prv);
328 OpenGL_Utils_clear(&tg->OpenGL_Utils); FREE_IF_NZ(tg->OpenGL_Utils.prv);
329 FREE_IF_NZ(tg->LoadTextures.prv);
330 FREE_IF_NZ(tg->Frustum.prv);
332 #if defined (INCLUDE_NON_WEB3D_FORMATS)
333 FREE_IF_NZ(tg->ColladaParser.prv);
334 #endif //INCLUDE_NON_WEB3D_FORMATS
336 #if defined (INCLUDE_STL_FILES)
337 FREE_IF_NZ(tg->STLHandler.prv);
338 #endif // INCLUDE_STL_FILES
340 ProdCon_clear(&tg->ProdCon); FREE_IF_NZ(tg->ProdCon.prv);
341 Mainloop_clear(&tg->Mainloop); FREE_IF_NZ(tg->Mainloop.prv);
342 FREE_IF_NZ(tg->ConsoleMessage.prv);
343 FREE_IF_NZ(tg->SensInterps.prv);
344 FREE_IF_NZ(tg->EAICore.prv);
345 FREE_IF_NZ(tg->EAIHelpers.prv);
346 FREE_IF_NZ(tg->EAIEventsIn.prv);
347 FREE_IF_NZ(tg->EAI_C_CommonFunctions.prv);
348 FREE_IF_NZ(tg->Snapshot.prv);
350 FREE_IF_NZ(tg->threads.prv);
351 resources_clear(&tg->resources); FREE_IF_NZ(tg->resources.prv);
352 FREE_IF_NZ(tg->internalc.prv);
353 FREE_IF_NZ(tg->display.prv);
356 void __iglobal_destructor(
ttglobal tg)
365 fwl_clearCurrentHandle(__FILE__,__LINE__);
371 void *fwl_getCurrentHandle(
char *fi,
int li){
374 return (
void*)currentHandle;
376 int fwl_setCurrentHandle(
void *handle,
char *fi,
int li)
380 pthread_setspecific(threadSpecificKey,handle);
383 void fwl_clearCurrentHandle(
char *fi,
int li)
385 void *currentHandle = NULL;
387 pthread_setspecific(threadSpecificKey,currentHandle);
390 ttglobal gglobal(
char *fi,
int *li){
393 if (done_main_UI_thread_once)
395 tg = (
ttglobal)pthread_getspecific(threadSpecificKey);
398 printf(
"Ouch - no state for this thread -- hit a key to exit\n");
400 printf (
"more info - thread %p\n\n",(
void *)pthread_self().p);
402 printf (
"more info - thread %p\n\n",(
void *)pthread_self());
413 if (!done_main_UI_thread_once)
418 return (
ttglobal)pthread_getspecific(threadSpecificKey);