[cig-commits] r4875 - in long/3D/Gale/trunk/src/StGermain: . Base/Automation/src

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:48:08 PDT 2006


Author: walter
Date: 2006-10-11 13:48:08 -0700 (Wed, 11 Oct 2006)
New Revision: 4875

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Base/Automation/src/Variable.h
Log:
 r2932 at earth:  boo | 2006-10-11 13:42:46 -0700
  r2848 at earth (orig r3836):  KathleenHumble | 2006-10-04 23:38:44 -0700
  Casting some of the pointers to ArithPointer
  to stop the annoying 'casting' warnings.
  Also changed the way the functions used Journal_Firewall
  so that the output will be NULL rather than int so that
  it can then be cast to the type needed.
  ie.
  from (ptr)Journal_Firewall(..)
  to (ptr)(Journal_Firewall(...), NULL)
  this should stop almost all the warnings relating to
  integers being cast as pointers 
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2931
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3835
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2932
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3836

Modified: long/3D/Gale/trunk/src/StGermain/Base/Automation/src/Variable.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Automation/src/Variable.h	2006-10-11 20:48:05 UTC (rev 4874)
+++ long/3D/Gale/trunk/src/StGermain/Base/Automation/src/Variable.h	2006-10-11 20:48:08 UTC (rev 4875)
@@ -249,21 +249,23 @@
 	*/
 	
 	/** Implementation of "get" the structure in an array, that the requested data member is in. Private (Do not directly
-	 *  use!) */
+	 *  use!)
+	 *  NB:- the array_I needs to be cast to an ArithPointer below - see __Variable_GetPtr() for reason. */
 	#define __Variable_GetStructPtr( self, array_I ) \
 		( ( (self)->offsetCount < 2 ) ? \
-			( (void*)((ArithPointer)(self)->arrayPtr + (array_I) * (self)->structSize + (self)->offsets[0] ) ) : \
-			( (void*)((ArithPointer)(self)->arrayPtr + (array_I) * (self)->structSize ) ) )
+			( (void*)( (ArithPointer)(self)->arrayPtr + (ArithPointer)(array_I) * (ArithPointer)( (self)->structSize) + (ArithPointer)( (self)->offsets[0] ) ))  : \
+			( (void*)((ArithPointer)(self)->arrayPtr + (ArithPointer)(array_I) * (ArithPointer)((self)->structSize)) ) )
 	#ifdef CAUTIOUS
 		/** Implementation of "get" the structure in an array that the requested data member is in if CAUTIOUS is defined.
 		 *  It ensures that array_I is within its bounds. Private (Do not directly use!) */
 		#define _Variable_GetStructPtr( self, array_I ) \
 			( (array_I) < (self)->arraySize ? \
 				__Variable_GetStructPtr( (self), (array_I) ) : \
-				(void*)Journal_Firewall( \
+				/*TODO : call J_Firewall, then return NULL. */ \
+				(void*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Array array_I %d out of range\n", array_I ) )
+					"Array array_I %d out of range\n", array_I ), NULL) )
 	#else
 		/** Implementation of "get" the structure in an array, that the requested data member is in if CAUTIOUS is NOT
 		 *  defined. It DOES NOT ensure that array_I is within its bounds. Private (Do not directly use!) */
@@ -273,19 +275,21 @@
 	
 /* BUG!:	( (void*)((ArithPointer)_Variable_GetStructPtr( (self), (array_I) ) + (self)->offsets[component_I]) ) */
 
-	/** Implementation of "get" the requested data member in a structure in an array. Private (Do not directly use!) */
+	/** Implementation of "get" the requested data member in a structure in an array. Private (Do not directly use!)
+		NB - we cast the array_I to an ArithPointer since its usually passed in as an Index (unsigned int), which on
+		some architectures such as the SGI Altix is of a different size to the ArithPointer (unsigned long) */
 	#define __Variable_GetPtr( self, array_I, component_I, vector_I ) \
-		( (void*)((ArithPointer)(self)->arrayPtr + (array_I) * (self)->structSize + (self)->offsets[component_I]) )
+		( (void*)((ArithPointer)(self)->arrayPtr + (ArithPointer)(array_I) * (self)->structSize + (self)->offsets[component_I]) )
 	#ifdef CAUTIOUS
 		/** Implementation of "get" the requested data member in a structure in an array if CAUTIOUS is defined.
 		 *  It ensures that component_I  and array_I are within its bounds. Private (Do not directly use!) */
 		#define _Variable_GetPtr( self, array_I, component_I, vector_I ) \
 			( (component_I) < (self)->offsetCount ? \
 				__Variable_GetPtr( (self), (array_I), (component_I), (vector_I) ) :\
-				(void*)Journal_Firewall( \
+				(void*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Offset array_I out of range\n" ) )
+					"Offset array_I out of range\n" ), NULL) )
 	#else
 		/** Implementation of "get" the requested data member in a structure in an array if CAUTIOUS is NOT
 		 *  defined. It DOES NOT ensure that component_I and array_I are within its bounds. Private (Do not directly
@@ -308,10 +312,10 @@
 		#define Variable_GetPtrChar( self, array_I ) \
 			( (self)->offsetCount == 1 && (self)->dataTypes[0] == Variable_DataType_Char ? \
 				_Variable_GetPtrChar( (self), (array_I) ) : \
-				(char*)Journal_Firewall( \
+				(char*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is not of a char or is complex, but this macro assumes so.\n" ) )
+					"Variable is not of a char or is complex, but this macro assumes so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of a "char" inbuilt type, return a pointer to that char (type casted to char*).
 		 *  It DOES NOT ensure the Variable is of a "char" and is not complex. */
@@ -412,10 +416,10 @@
 		#define Variable_GetPtrShort( self, array_I ) \
 			( (self)->offsetCount == 1 && (self)->dataTypes[0] == Variable_DataType_Short ? \
 				_Variable_GetPtrShort( (self), (array_I) ) : \
-				(short*)Journal_Firewall( \
+				(short*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is not of a short or is complex, but this macro assumes so.\n" ) )
+					"Variable is not of a short or is complex, but this macro assumes so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of a "short" inbuilt type, return a pointer to that short (type casted to short*).
 		 *  It DOES NOT ensure the Variable is of a "short" and is not complex. */
@@ -517,10 +521,10 @@
 		#define Variable_GetPtrInt( self, array_I ) \
 			( (self)->offsetCount == 1 && (self)->dataTypes[0] == Variable_DataType_Int ? \
 				_Variable_GetPtrInt( (self), (array_I) ) : \
-				(int*)Journal_Firewall( \
+				(int*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is not of a int or is complex, but this macro assumes so.\n" ) )
+					"Variable is not of a int or is complex, but this macro assumes so.\n" ),NULL) )
 	#else
 		/** Assuming this is a Variable of a "int" inbuilt type, return a pointer to that int (type casted to int*).
 		 *  It DOES NOT ensure the Variable is of a "int" and is not complex. */
@@ -620,10 +624,10 @@
 		#define Variable_GetPtrFloat( self, array_I ) \
 			( (self)->offsetCount == 1 && (self)->dataTypes[0] == Variable_DataType_Float ? \
 				_Variable_GetPtrFloat( (self), (array_I) ) : \
-				(float*)Journal_Firewall( \
+				(float*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is not of a float or is complex, but this macro assumes so.\n" ) )
+					"Variable is not of a float or is complex, but this macro assumes so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of a "float" inbuilt type, return a pointer to that float (type casted to float*).
 		 *  It DOES NOT ensure the Variable is of a "float" and is not complex. */
@@ -725,10 +729,10 @@
 		#define Variable_GetPtrDouble( self, array_I ) \
 			( (self)->offsetCount == 1 && (self)->dataTypes[0] == Variable_DataType_Double ? \
 				_Variable_GetPtrDouble( (self), (array_I) ) : \
-				(double*)Journal_Firewall( \
+				(double*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is not of a double or is complex, but this macro assumes so.\n" ) )
+					"Variable is not of a double or is complex, but this macro assumes so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of a "double" inbuilt type, return a pointer to that double (type casted to
 		 *   double*). It DOES NOT ensure the Variable is of a "double" and is not complex. */
@@ -738,7 +742,7 @@
 	
 	/** Assuming this is a Variable of a vector "double" inbuilt type, return that double. Private (Do not directly use!). */
 	#define _Variable_GetValueAtDouble( self, array_I, vector_I ) \
-		( Variable_GetPtrDouble( (self), (array_I) )[(vector_I)] )
+		( (Variable_GetPtrDouble( (self), (array_I) ))[(vector_I)] )
 	#ifdef CAUTIOUS
 		/** Assuming this is a Variable of a vector "double" inbuilt type, return that double. It ensures that vector_I is
 		 *  within range. */
@@ -838,10 +842,10 @@
 		#define Variable_GetPtrPointer( self, array_I ) \
 			( (self)->offsetCount == 1 && (self)->dataTypes[0] == Variable_DataType_Pointer ? \
 				_Variable_GetPtrPointer( (self), (array_I) ) : \
-				(void**)Journal_Firewall( \
+				(void**)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is not of a pointer or is complex, but this macro assumes so.\n" ) )
+					"Variable is not of a pointer or is complex, but this macro assumes so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of a "pointer" inbuilt type, return a pointer to that pointer (type casted to
 		 *  void**). It DOES NOT ensure the Variable is of a "pointer" and is not complex. */
@@ -858,10 +862,10 @@
 		#define Variable_GetValueAtPointer( self, array_I, vector_I ) \
 			( (vector_I) < (self)->dataTypeCounts[0] ? \
 				_Variable_GetValueAtPointer( (self), (array_I), (vector_I) ) : \
-				(void*)Journal_Firewall( \
+				(void*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Index into vector of inbuild type is out of range.\n" ) )
+					"Index into vector of inbuild type is out of range.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of a vector "pointer" inbuilt type, return that pointer. It DOES NOT ensure that
 		 *  vector_I is within range. */
@@ -1082,20 +1086,20 @@
 		  (self)->dataTypes[0] == Variable_DataType_Float ?	Variable_GetValueFloatAsPointer( (self), (array_I) ) : \
 		  (self)->dataTypes[0] == Variable_DataType_Double ?	Variable_GetValueDoubleAsPointer( (self), (array_I) ) : \
 		  (self)->dataTypes[0] == Variable_DataType_Pointer ?	Variable_GetValuePointer( (self), (array_I) ) : \
-		  (void*)Journal_Firewall( \
+		  (Journal_Firewall( \
 			0, \
 			Journal_Register( Error_Type, Variable_Type ), \
-			"Variable is not of any inbuilt type, but this macro assumes so.\n" ) )
+			"Variable is not of any inbuilt type, but this macro assumes so.\n" ), NULL) )
 	#ifdef CAUTIOUS
 		/** Assuming this is a Variable of any inbuilt type, return a pointer (type casted to void*). It ensures the Variable
 		 * is not complex. Resolution order: pointer, short, int, float, double, pointer. */
 		#define Variable_GetValueAsPointer( self, array_I ) \
 			( (self)->offsetCount == 1 ? \
 				_Variable_GetValueAsPointer( (self), (array_I) ) : \
-				(void*)Journal_Firewall( \
+				(void*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is complex, but this macro assumes not so.\n" ) )
+					"Variable is complex, but this macro assumes not so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of any inbuilt type, return a pointer (type casted to void*). It DOES NOT ensure the
 		 *  Variable is not complex. Resolution order: pointer, short, int, float, double, pointer. */
@@ -1112,20 +1116,20 @@
 		  (self)->dataTypes[0] == Variable_DataType_Float ?	Variable_SetValueFloat( (self), (array_I), (value) ) : \
 		  (self)->dataTypes[0] == Variable_DataType_Double ?	Variable_SetValueDouble( (self), (array_I), (value) ) : \
 		  (self)->dataTypes[0] == Variable_DataType_Pointer ?	Variable_SetValuePointer( (self), (array_I), (value) ) : \
-		  (void*)Journal_Firewall( \
+		  (Journal_Firewall( \
 			0, \
 			Journal_Register( Error_Type, Variable_Type ), \
-			"Variable is not of any inbuilt type, but this macro assumes so.\n" ) )
+			"Variable is not of any inbuilt type, but this macro assumes so.\n" ), NULL) )
 	#ifdef CAUTIOUS
 		/** Assuming this is a Variable of any inbuilt type, set the value. It ensures the Variable is not complex.
 		  * Resolution order: pointer, short, int, float, double, pointer. */
 		#define Variable_SetValueFromInbuilt( self, array_I, value ) \
 			( (self)->offsetCount == 1 ? \
 				_Variable_SetValueFromInbuilt( (self), (array_I), (value) ) : \
-				(void*)Journal_Firewall( \
+				(void*)(Journal_Firewall( \
 					0, \
 					Journal_Register( Error_Type, Variable_Type ), \
-					"Variable is complex, but this macro assumes not so.\n" ) )
+					"Variable is complex, but this macro assumes not so.\n" ), NULL) )
 	#else
 		/** Assuming this is a Variable of any inbuilt type, set the value. It DOES NOT ensure the Variable is not complex.
 		 *  Resolution order: pointer, short, int, float, double, pointer. */



More information about the cig-commits mailing list