[Gridflow-cvs] [svn] commit: r5793 - in /trunk/src: gem.cxx gridflow.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Tue Jul 27 18:50:07 EDT 2010


Author: matju
Date: Tue Jul 27 18:50:05 2010
New Revision: 5793

Log:
move GEM version detection code to the GridFlow loader

Modified:
    trunk/src/gem.cxx
    trunk/src/gridflow.cxx

Modified: trunk/src/gem.cxx
==============================================================================
--- trunk/src/gem.cxx (original)
+++ trunk/src/gem.cxx Tue Jul 27 18:50:05 2010
@@ -315,26 +315,6 @@
 
 void startup_gem () {
 	\startall
-	//post("GF sizeof(imageStruct)=%d sizeof(pixBlock)=%d sizeof(GemState)=%d",sizeof(imageStruct),sizeof(pixBlock),sizeof(GemState));
-	//int major,minor; sscanf(GemVersion::versionString(),"%d.%d",&major,&minor); gem = major*1000+minor;
-	gem = -1;
- 	GemState *dummy = new GemState();
-	float *stupide = (float *)dummy;
-	int i;
-	for (i=0; i<16; i++) if (stupide[i]==50.f) break;
-	if (i==16) error("GridFlow: can't find GemState::tickTime");
-	else {
-		int j = i-2-2*sizeof(void*)/sizeof(float);
-		//post("GemState::tickTime found at [%d], so pixBlock is probably at [%d]",i,j);	
-		if      (j==3        ) {gem = 93;}
-		else if (j==5 || j==6) {gem = 92;}
-		else error("GridFlow: can't detect this version of GEM: i=%d j=%d",i,j);
-	}
-	//post("GridFlow/GEM bridge : GEM version is detected to be %d",gem);
-	//delete dummy;
-	/* note that j==6 is because in 64-bit mode you have one int of padding in GemState92 just before the pixBlock* */
-	imageStruct_has_virtual = !!*(long *)new imageStruct();
-	post("imageStruct_has_virtual=%d",imageStruct_has_virtual);
 }
 
 /*

Modified: trunk/src/gridflow.cxx
==============================================================================
--- trunk/src/gridflow.cxx (original)
+++ trunk/src/gridflow.cxx Tue Jul 27 18:50:05 2010
@@ -1059,6 +1059,32 @@
 	startup_flow_objects2();
 	startup_format();
 	STARTUP_LIST()
+
+#ifdef HAVE_GEM
+	//post("GF sizeof(imageStruct)=%d sizeof(pixBlock)=%d sizeof(GemState)=%d",sizeof(imageStruct),sizeof(pixBlock),sizeof(GemState));
+	//int major,minor; sscanf(GemVersion::versionString(),"%d.%d",&major,&minor); gem = major*1000+minor;
+	int gem = -1;
+	struct GemState   {GemState(); char trabant[666];};
+	struct imageStruct {imageStruct(); char lada[666];};
+ 	GemState *dummy = new GemState();
+	float *stupide = (float *)dummy;
+	int i;
+	for (i=0; i<16; i++) if (stupide[i]==50.f) break;
+	if (i==16) error("GridFlow: can't find GemState::tickTime");
+	else {
+		int j = i-2-2*sizeof(void*)/sizeof(float);
+		//post("GemState::tickTime found at [%d], so pixBlock is probably at [%d]",i,j);	
+		if      (j==3        ) {gem = 93;}
+		else if (j==5 || j==6) {gem = 92;}
+		else error("GridFlow: can't detect this version of GEM: i=%d j=%d",i,j);
+	}
+	//post("GridFlow/GEM bridge : GEM version is detected to be %d",gem);
+	//delete dummy;
+	/* note that j==6 is because in 64-bit mode you have one int of padding in GemState92 just before the pixBlock* */
+	bool imageStruct_has_virtual = !!*(long *)new imageStruct();
+	post("imageStruct_has_virtual=%d",imageStruct_has_virtual);
+#endif
+
 	//sys_gui("bind . <Motion> {puts %W}\n");
 	sys_gui("catch {rename pdtk_canvas_sendkey pdtk_canvas_sendqui\n"
 	  "proc pdtk_canvas_sendkey {name state key iso shift} {\n"



More information about the Gridflow-cvs mailing list