[cig-commits] commit: Rejigged Variable component.

Mercurial hg at geodynamics.org
Mon Feb 1 15:32:14 PST 2010


changeset:   702:ac3c2f072ad7
branch:      pcu_rejig
user:        JericoRevote
date:        Wed Dec 02 11:31:17 2009 +1100
files:       Base/Context/src/Init.c Base/Context/src/Variable.c Base/Context/src/Variable.h Base/Context/tests/LiveComponentRegisterSuite.c Base/Context/tests/SetVC_Suite.c Base/Context/tests/VariableAllVC_Suite.c Base/Context/tests/VariableDumpStreamSuite.c Base/Context/tests/VariableSuite.c Base/Context/tests/Variable_RegisterSuite.c
description:
Rejigged Variable component.


diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/src/Init.c
--- a/Base/Context/src/Init.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Init.c	Wed Dec 02 11:31:17 2009 +1100
@@ -72,7 +72,7 @@ Bool BaseContext_Init( int* argc, char**
 	Journal_RegisterTypedStream( typedStream );
 	
 	/** Adding default constructors of various components to the Stg_ComponentRegister */
-	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Variable_Type, "0", (Stg_Component_DefaultConstructorFunction*)Variable_DefaultNew );
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Variable_Type, "0", (Stg_Component_DefaultConstructorFunction*)_Variable_DefaultNew );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), CompositeVC_Type, "0", (Stg_Component_DefaultConstructorFunction*)_CompositeVC_DefaultNew );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), SetVC_Type, "0", (Stg_Component_DefaultConstructorFunction*)_SetVC_DefaultNew );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), VariableAllVC_Type, "0", (Stg_Component_DefaultConstructorFunction*)_VariableAllVC_DefaultNew );
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/src/Variable.c
--- a/Base/Context/src/Variable.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Variable.c	Wed Dec 02 11:31:17 2009 +1100
@@ -58,17 +58,18 @@ const Type Variable_Type = "Variable";
 */
 
 Variable* Variable_New(
-		Name						name,
-		Index						dataCount,
-		SizeT*						dataOffsets,
-		Variable_DataType*				dataTypes,
-		Index*						dataTypeCounts,
-		Name*						dataNames,
-		SizeT*						structSizePtr,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr )
+	Name								name,
+	AbstractContext*				context,
+	Index								dataCount,
+	SizeT*							dataOffsets,
+	Variable_DataType*			dataTypes,
+	Index*							dataTypeCounts,
+	Name*								dataNames,
+	SizeT*							structSizePtr,
+	Index*							arraySizePtr,
+	Variable_ArraySizeFunc*		arraySizeFunc,
+	void**							arrayPtrPtr,
+	Variable_Register*			vr )
 {
 	/* Variables set in this function */
 	SizeT                                              _sizeOfSelf = sizeof(Variable);
@@ -76,39 +77,37 @@ Variable* Variable_New(
 	Stg_Class_DeleteFunction*                              _delete = _Variable_Delete;
 	Stg_Class_PrintFunction*                                _print = _Variable_Print;
 	Stg_Class_CopyFunction*                                  _copy = _Variable_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)Variable_DefaultNew;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_Variable_DefaultNew;
 	Stg_Component_ConstructFunction*                    _construct = _Variable_AssignFromXML;
 	Stg_Component_BuildFunction*                            _build = _Variable_Build;
 	Stg_Component_InitialiseFunction*                  _initialise = _Variable_Initialise;
 	Stg_Component_ExecuteFunction*                        _execute = _Variable_Execute;
 	Stg_Component_DestroyFunction*                        _destroy = _Variable_Destroy;
-	Bool                                                  initFlag = True;
 
 	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
 	AllocationType  nameAllocationType = ZERO;
 
-	Variable*	self;
-	
-	self = _Variable_New(  VARIABLE_PASSARGS  );
+	Variable* self = _Variable_New(  VARIABLE_PASSARGS  );
+
+	self->isConstructed = True;
+	_Variable_Init( self, context, dataCount, dataOffsets, dataTypes, dataTypeCounts, dataNames, structSizePtr, arraySizePtr, arraySizeFunc, arrayPtrPtr, False, vr );
 	
 	return self;
 }
 
-Variable* Variable_DefaultNew( Name name )
-{
+Variable* _Variable_DefaultNew( Name name ) {
 	/* Variables set in this function */
 	SizeT                                              _sizeOfSelf = sizeof(Variable);
 	Type                                                      type = Variable_Type;
 	Stg_Class_DeleteFunction*                              _delete = _Variable_Delete;
 	Stg_Class_PrintFunction*                                _print = _Variable_Print;
 	Stg_Class_CopyFunction*                                  _copy = _Variable_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)Variable_DefaultNew;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_Variable_DefaultNew;
 	Stg_Component_ConstructFunction*                    _construct = _Variable_AssignFromXML;
 	Stg_Component_BuildFunction*                            _build = _Variable_Build;
 	Stg_Component_InitialiseFunction*                  _initialise = _Variable_Initialise;
 	Stg_Component_ExecuteFunction*                        _execute = _Variable_Execute;
 	Stg_Component_DestroyFunction*                        _destroy = _Variable_Destroy;
-	Bool                                                  initFlag = False;
 	Index                                                dataCount = 0;
 	SizeT*                                             dataOffsets = NULL;
 	Variable_DataType*                                   dataTypes = NULL;
@@ -123,20 +122,19 @@ Variable* Variable_DefaultNew( Name name
 	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
 	AllocationType  nameAllocationType = ZERO;
 
-	Variable*	self;
-	
-	self = _Variable_New(  VARIABLE_PASSARGS  );
+	Variable* self = _Variable_New(  VARIABLE_PASSARGS  );
 	
 	return self;
 }
 
 Variable* Variable_NewScalar( 
-		Name						name,
-		Variable_DataType				dataType,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr )
+	Name							name,
+	AbstractContext*			context,
+	Variable_DataType			dataType,
+	Index*						arraySizePtr,
+	Variable_ArraySizeFunc*	arraySizeFunc,
+	void**						arrayPtrPtr,
+	Variable_Register*		vr )
 {
 	/* Variables set in this function */
 	SizeT                                              _sizeOfSelf = sizeof(Variable);
@@ -144,13 +142,12 @@ Variable* Variable_NewScalar(
 	Stg_Class_DeleteFunction*                              _delete = _Variable_Delete;
 	Stg_Class_PrintFunction*                                _print = _Variable_Print;
 	Stg_Class_CopyFunction*                                  _copy = _Variable_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)Variable_DefaultNew;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_Variable_DefaultNew;
 	Stg_Component_ConstructFunction*                    _construct = _Variable_AssignFromXML;
 	Stg_Component_BuildFunction*                            _build = _Variable_Build;
 	Stg_Component_InitialiseFunction*                  _initialise = _Variable_Initialise;
 	Stg_Component_ExecuteFunction*                        _execute = _Variable_Execute;
 	Stg_Component_DestroyFunction*                        _destroy = _Variable_Destroy;
-	Bool                                                  initFlag = True;
 	Index                                                dataCount = 1;
 	Name*                                                dataNames = 0;
 	SizeT*                                           structSizePtr = 0;
@@ -158,27 +155,31 @@ Variable* Variable_NewScalar(
 	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
 	AllocationType  nameAllocationType = ZERO;
 
-	Variable*		self;
-	SizeT			dataOffsets[] = { 0 };
+	Variable*			self;
+	SizeT					dataOffsets[] = { 0 };
 	Variable_DataType	dataTypes[] = { 0 };		/* Init value later */
-	Index			dataTypeCounts[] = { 1 };
+	Index					dataTypeCounts[] = { 1 };
 	
 	dataTypes[0] = dataType;
 	
 	self = _Variable_New(  VARIABLE_PASSARGS  );
-	
+
+	self->isConstructed = True;
+	_Variable_Init( self, context, dataCount, dataOffsets, dataTypes, dataTypeCounts, dataNames, structSizePtr, arraySizePtr, arraySizeFunc, arrayPtrPtr, False, vr );
+
 	return self;
 }
 
 Variable* Variable_NewVector( 
-		Name						name,
-		Variable_DataType				dataType,
-		Index						dataTypeCount,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr,
-		... 						/* vector component names */ )
+	Name							name,
+	AbstractContext*			context,
+	Variable_DataType			dataType,
+	Index							dataTypeCount,
+	Index*						arraySizePtr,
+	Variable_ArraySizeFunc*	arraySizeFunc,
+	void**						arrayPtrPtr,
+	Variable_Register*		vr,
+	... 						/* vector component names */ )
 {
 	/* Variables set in this function */
 	SizeT                                              _sizeOfSelf = sizeof(Variable);
@@ -186,26 +187,25 @@ Variable* Variable_NewVector(
 	Stg_Class_DeleteFunction*                              _delete = _Variable_Delete;
 	Stg_Class_PrintFunction*                                _print = _Variable_Print;
 	Stg_Class_CopyFunction*                                  _copy = _Variable_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)Variable_DefaultNew;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_Variable_DefaultNew;
 	Stg_Component_ConstructFunction*                    _construct = _Variable_AssignFromXML;
 	Stg_Component_BuildFunction*                            _build = _Variable_Build;
 	Stg_Component_InitialiseFunction*                  _initialise = _Variable_Initialise;
 	Stg_Component_ExecuteFunction*                        _execute = _Variable_Execute;
 	Stg_Component_DestroyFunction*                        _destroy = _Variable_Destroy;
-	Bool                                                  initFlag = True;
 	Index                                                dataCount = 1;
 	SizeT*                                           structSizePtr = 0;
 
 	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
 	AllocationType  nameAllocationType = ZERO;
 
-	Variable*		self;
-	SizeT			dataOffsets[] = { 0 };
-	Variable_DataType	dataTypes[] = { 0 };				/* Init later... */
-	Index			dataTypeCounts[] = { 0 };			/* Init later... */
-	Name*			dataNames;
-	Index			vector_I;
-	va_list			ap;
+	Variable*			self;
+	SizeT					dataOffsets[] = { 0 };
+	Variable_DataType	dataTypes[] = { 0 }; /* Init later... */
+	Index					dataTypeCounts[] = { 0 }; /* Init later... */
+	Name*					dataNames;
+	Index					vector_I;
+	va_list				ap;
 
 	dataTypes[0] = dataType;
 	dataTypeCounts[0] = dataTypeCount;
@@ -220,20 +220,24 @@ Variable* Variable_NewVector(
 	
 	self = _Variable_New(  VARIABLE_PASSARGS  );
 
+	self->isConstructed = True;
+	_Variable_Init( self, context, dataCount, dataOffsets, dataTypes, dataTypeCounts, dataNames, structSizePtr, arraySizePtr, arraySizeFunc, arrayPtrPtr, False, vr );
+
 	Memory_Free( dataNames );
-	
+
 	return self;
 }
 
 Variable* Variable_NewVector2( 
-		Name						name,
-		Variable_DataType				dataType,
-		Index						dataTypeCount,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr,
-		char**						dataNames )
+	Name							name,
+	AbstractContext*			context,
+	Variable_DataType			dataType,
+	Index							dataTypeCount,
+	Index*						arraySizePtr,
+	Variable_ArraySizeFunc*	arraySizeFunc,
+	void**						arrayPtrPtr,
+	Variable_Register*		vr,
+	char**						dataNames )
 {
 	/* Variables set in this function */
 	SizeT                                              _sizeOfSelf = sizeof(Variable);
@@ -241,84 +245,36 @@ Variable* Variable_NewVector2(
 	Stg_Class_DeleteFunction*                              _delete = _Variable_Delete;
 	Stg_Class_PrintFunction*                                _print = _Variable_Print;
 	Stg_Class_CopyFunction*                                  _copy = _Variable_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (void*)Variable_DefaultNew;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (void*)_Variable_DefaultNew;
 	Stg_Component_ConstructFunction*                    _construct = _Variable_AssignFromXML;
 	Stg_Component_BuildFunction*                            _build = _Variable_Build;
 	Stg_Component_InitialiseFunction*                  _initialise = _Variable_Initialise;
 	Stg_Component_ExecuteFunction*                        _execute = _Variable_Execute;
 	Stg_Component_DestroyFunction*                        _destroy = _Variable_Destroy;
-	Bool                                                  initFlag = True;
 	Index                                                dataCount = 1;
 	SizeT*                                           structSizePtr = 0;
 
 	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
 	AllocationType  nameAllocationType = ZERO;
 
-	Variable*		self;
-	SizeT			dataOffsets[] = { 0 };
+	Variable*			self;
+	SizeT					dataOffsets[] = { 0 };
 	Variable_DataType	dataTypes[] = { 0 };
-	Index			dataTypeCounts[] = { 0 };
+	Index					dataTypeCounts[] = { 0 };
 
 	dataTypes[0] = dataType;
 	dataTypeCounts[0] = dataTypeCount;
 
 	self = _Variable_New(  VARIABLE_PASSARGS  );
 
+	self->isConstructed = True;
+	_Variable_Init( self, context, dataCount, dataOffsets, dataTypes, dataTypeCounts, dataNames, structSizePtr, arraySizePtr, arraySizeFunc, arrayPtrPtr, False, vr );
+
 	return self;
 }
 
-
-void Variable_Init(
-		Name						name,
-		Variable*					self,
-		Index						dataCount,
-		SizeT*						dataOffsets,
-		Variable_DataType*				dataTypes,
-		Index*						dataTypeCounts,
-		Name*						dataNames,
-		SizeT*						structSizePtr,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Bool						allocateSelf,
-		Variable_Register*				vr )
-{
-	/* General info */
-	self->type = Variable_Type;
-	self->_sizeOfSelf = sizeof(Variable);
-	self->_deleteSelf = False;
-		
-	/* Virtual info */
-	self->_delete = _Variable_Delete;
-	self->_print = _Variable_Print;
-	self->_copy = _Variable_Copy;
-	self->_build = _Variable_Build;
-	self->_initialise = _Variable_Initialise;
-	self->_execute = _Variable_Execute;
-	
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	_Stg_Component_Init( (Stg_Component*)self );
-	/* Variable info */
-	_Variable_Init( 
-		self, 
-		dataCount, 
-		dataOffsets, 
-		dataTypes, 
-		dataTypeCounts, 
-		dataNames, 
-		structSizePtr,
-		arraySizePtr,
-		arraySizeFunc,
-		arrayPtrPtr, 
-		allocateSelf,
-		vr );
-}
-
-
-Variable* _Variable_New(  VARIABLE_DEFARGS  )
-{
-	Variable*	self;
+Variable* _Variable_New(  VARIABLE_DEFARGS  ) {
+	Variable* self;
 	
 	/* Allocate memory */
 	assert( _sizeOfSelf >= sizeof(Variable) );
@@ -336,45 +292,31 @@ Variable* _Variable_New(  VARIABLE_DEFAR
 	self->_initialise = _initialise;
 	
 	/* Variable info */
-	if( initFlag ){
-		_Variable_Init( 
-			self, 
-			dataCount, 
-			dataOffsets, 
-			dataTypes, 
-			dataTypeCounts, 
-			dataNames, 
-			structSizePtr, 
-			arraySizePtr,
-			arraySizeFunc,
-			arrayPtrPtr, 
-			False,
-			vr );
-	}
 	
 	return self;
 }
 
 void _Variable_Init(
-		Variable*					self, 
-		Index						dataCount,
-		SizeT*						dataOffsets,
-		Variable_DataType*				dataTypes,
-		Index*						dataTypeCounts,
-		Name*						dataNames,
-		SizeT*						structSizePtr,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Bool                                            allocateSelf,
-		Variable_Register*				vr )
+	Variable*					self, 
+	AbstractContext*			context,
+	Index							dataCount,
+	SizeT*						dataOffsets,
+	Variable_DataType*		dataTypes,
+	Index*						dataTypeCounts,
+	Name*							dataNames,
+	SizeT*						structSizePtr,
+	Index*						arraySizePtr,
+	Variable_ArraySizeFunc*	arraySizeFunc,
+	void**						arrayPtrPtr,
+	Bool							allocateSelf,
+	Variable_Register*		vr )
 {
-	Stream*      errorStream = Journal_Register( Error_Type, self->type );
+	Stream* errorStream = Journal_Register( Error_Type, self->type );
 
 	/* General and Virtual info should already be set */
 	
 	/* Variable info */
-	self->isConstructed = True;
+	self->context = context;
 	self->allocateSelf  = allocateSelf;
 	self->offsetCount = dataCount;
 	self->structSizePtr = structSizePtr;
@@ -384,9 +326,9 @@ void _Variable_Init(
 	self->parent = NULL;
 
 	/* Checks */
-	Journal_Firewall( (self->arraySizePtr || self->arraySizeFunc) ,
+	/*Journal_Firewall( (self->arraySizePtr || self->arraySizeFunc) ,
 		errorStream, "Error: in %s(), for Variable %s - either arraySizePtr or arraySizeFunc "
-			"passed in must be non-NULL.\n", __func__, self->name );
+			"passed in must be non-NULL.\n", __func__, self->name );*/
 
 	/* Use of this class has increased... can't assume the info arrays are on persistant memory... copy by default. They will
 	   be deleted. */
@@ -398,10 +340,7 @@ void _Variable_Init(
 	self->dataTypes = Memory_Alloc_Array( Variable_DataType, self->offsetCount, "Variable->dataTypes" );
 	memcpy( self->dataTypes, dataTypes, sizeof(Variable_DataType) * self->offsetCount );
 	
-	Journal_Firewall( 
-		dataTypeCounts ? True : False , 
-		Journal_Register( Error_Type, Variable_Type ), 
-		"dataTypeCounts is null\n" );
+	Journal_Firewall( dataTypeCounts ? True : False , Journal_Register( Error_Type, Variable_Type ), "dataTypeCounts is null\n" );
 	self->dataTypeCounts = Memory_Alloc_Array( Index, self->offsetCount, "Variable->dataTypeCounts" );
 	memcpy( self->dataTypeCounts, dataTypeCounts, sizeof(Index) * self->offsetCount );
 	
@@ -428,13 +367,13 @@ void _Variable_Init(
 		
 		/* If we have component names, create the associated variables. Don't do if there is only one component. */
 		if( dataNames && self->offsetCount > 1 ) {
-			Index			component_I;
+			Index component_I;
 			
 			for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
 				if( dataNames[component_I] ) {
-					SizeT			componentOffsets[] = { 0 };
+					SizeT					componentOffsets[] = { 0 };
 					Variable_DataType	componentTypes[] = { 0 };
-					Index			componentTypeCounts[] = { 0 };
+					Index					componentTypeCounts[] = { 0 };
 
 					componentOffsets[0] = self->offsets[component_I];
 					componentTypes[0] = self->dataTypes[component_I];
@@ -443,6 +382,7 @@ void _Variable_Init(
 					/* Assumption: components are scalar or vector, but cannot be complex */
 					self->components[component_I] = Variable_New( 
 						dataNames[component_I], 
+						self->context,
 						1, 
 						componentOffsets, 
 						componentTypes, 
@@ -459,16 +399,16 @@ void _Variable_Init(
 		}
 		/* Else if we have vector-component names, create the associated variables. Do only if non-complex and a vector. */
 		else if( dataNames && self->offsetCount == 1 && self->dataTypeCounts[0] > 1 ) {
-			Index			vector_I;
+			Index vector_I;
 
 			for( vector_I = 0; vector_I < self->dataTypeCounts[0]; vector_I++ ) {
 				if( dataNames[vector_I] ) {
 					/* Unfortunately we cannot call any of our fancy macros here as the array is not resolved
 					 * yet. As a consequence we have to manually work out the vector's indecis offsets. Ouch
 					 * only from a code-maintenance point of view. */
-					SizeT			componentOffsets[] = { 0 };		/* Init later... */
-					Variable_DataType	componentTypes[] = { 0 };		/* Init later... */
-					Index			componentTypeCounts[] = { 1 };
+					SizeT					componentOffsets[] = { 0 }; /* Init later... */
+					Variable_DataType	componentTypes[] = { 0 }; /* Init later... */
+					Index					componentTypeCounts[] = { 1 };
 				
 					componentOffsets[0] = 
 						(ArithPointer)self->offsets[0] + 
@@ -484,10 +424,10 @@ void _Variable_Init(
 							"Vector is of a non-builtin type\n" ) );
 					componentTypes[0] = self->dataTypes[0];
 
-							
 					/* Assumption: vector-components are scalar, but cannot be complex */
 					self->components[vector_I] = Variable_New( 
 						dataNames[vector_I],
+						self->context,
 						1, 
 						componentOffsets, 
 						componentTypes, 
@@ -514,20 +454,8 @@ void _Variable_Init(
 */
 
 void _Variable_Delete( void* variable ) {
-	Variable*	self = (Variable*)variable;
+	Variable* self = (Variable*)variable;
 
-	if ( self->dataSizes ) {
-		Memory_Free( self->dataSizes );
-	}
-	if (self->allocateSelf) {
-		Memory_Free( self->arrayPtr );
-	}
-	
-	Memory_Free( self->dataTypeCounts );
-	Memory_Free( self->dataTypes );
-	Memory_Free( self->offsets );
-	Memory_Free( self->components );
-	
 	/* Stg_Class_Delete parent */
 	_Stg_Component_Delete( self );
 }
@@ -902,26 +830,27 @@ void _Variable_Execute( void* variable, 
 }
 
 void _Variable_AssignFromXML( void* variable, Stg_ComponentFactory* cf, void* data ) {
-	Variable*           self              = (Variable*) variable;
-	SizeT			    dataOffsets[]     = { 0 };
-	Variable_DataType	dataTypes[]       = { 0 };		/* Init value later */
-	Index			    dataTypeCounts[]  = { 1 };
-	Dictionary *        componentDict     = NULL;
-	Dictionary *        thisComponentDict = NULL;
-	Name                dataTypeName      = NULL;
-	Name                rankName          = NULL;
-	Name                countName         = NULL;
-	unsigned int*       count             = NULL;
-	void *              variableRegister  = NULL;
-	void *              pointerRegister   = NULL;
-	Name*               names             = NULL;
-	Stream*             error             = Journal_Register( Error_Type, self->type );
+	Variable*			self = (Variable*) variable;
+	SizeT					dataOffsets[] = { 0 };
+	Variable_DataType	dataTypes[] = { 0 };		/* Init value later */
+	Index					dataTypeCounts[] = { 1 };
+	Dictionary*			componentDict = NULL;
+	Dictionary*			thisComponentDict = NULL;
+	Name					dataTypeName = NULL;
+	Name					rankName = NULL;
+	Name					countName = NULL;
+	unsigned int*		count = NULL;
+	void*					variableRegister = NULL;
+	void*					pointerRegister = NULL;
+	Name*					names = NULL;
+	Stream*				error = Journal_Register( Error_Type, self->type );
+	AbstractContext*	context;	
 	
 	assert( self );
 
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Context", AbstractContext, False, data );
-	if( !self->context )
-		self->context = Stg_ComponentFactory_ConstructByName( cf, "context", AbstractContext, True, data );
+	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Context", AbstractContext, False, data );
+	if( !context )
+		context = Stg_ComponentFactory_ConstructByName( cf, "context", AbstractContext, True, data );
 
 	componentDict = cf->componentDict;
 	assert( componentDict );
@@ -929,9 +858,9 @@ void _Variable_AssignFromXML( void* vari
 	assert( thisComponentDict );
 	
 	/* Grab Registers */
-	variableRegister = self->context->variable_Register; 
+	variableRegister = context->variable_Register; 
 	assert( variableRegister );
-	pointerRegister = self->context->pointer_Register;
+	pointerRegister = context->pointer_Register;
 	assert( pointerRegister );
 	
 	Stg_ComponentFactory_ConstructByKey( cf, self->name, "Dependency", Stg_Component, False, data );
@@ -939,7 +868,7 @@ void _Variable_AssignFromXML( void* vari
 	/* Get Pointer to number of elements in array */
 	countName = Dictionary_GetString( thisComponentDict, "Count" );
 	count = Stg_ObjectList_Get( pointerRegister, countName );
-	assert( count );
+	//assert( count );
 	
 	/* Get Type of Variable */
 	dataTypeName = Dictionary_GetString( thisComponentDict, "DataType" );
@@ -977,35 +906,46 @@ void _Variable_AssignFromXML( void* vari
 		}
 		dataTypeCounts[0] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "VectorComponentCount", nameCount );
 
-		Journal_Firewall( nameCount >= dataTypeCounts[0], error,
-				"Variable '%s' has too few names in list for %d vector components.\n", self->name, dataTypeCounts[0] );
+		Journal_Firewall( nameCount >= dataTypeCounts[0], error, "Variable '%s' has too few names in list for %d vector components.\n", self->name, dataTypeCounts[0] );
 	}
 	else
 		Journal_Firewall( False, error, "Variable '%s' cannot understand rank '%s'\n", self->name, rankName );
 
 	_Variable_Init( 
-			self, 
-			1, 
-			dataOffsets,
-			dataTypes,
-			dataTypeCounts, 
-			names, 
-			0, 
-			count, 
-			NULL,	/* Note: don't support arraySize being calculated from a Func Ptr through
-			 Construct() Yet - PatrickSunter, 29 Jun 2007 */ 
-			(void**)&self->arrayPtr,
-			True,
-			variableRegister );
+		self, 
+		context,
+		1, 
+		dataOffsets,
+		dataTypes,
+		dataTypeCounts, 
+		names, 
+		0, 
+		count, 
+		NULL,	/* Note: don't support arraySize being calculated from a Func Ptr through
+		Construct() Yet - PatrickSunter, 29 Jun 2007 */ 
+		(void**)&self->arrayPtr,
+		True,
+		variableRegister );
 
 	/* Clean Up */
 	if (names)
 		Memory_Free(names);
 }
 	
-void _Variable_Destroy( void* variable, void* data )
-{
+void _Variable_Destroy( void* variable, void* data ) {
+	Variable* self = (Variable*)variable;
 	
+	if ( self->dataSizes ) {
+		Memory_Free( self->dataSizes );
+	}
+	if (self->allocateSelf) {
+		Memory_Free( self->arrayPtr );
+	}
+	
+	Memory_Free( self->dataTypeCounts );
+	Memory_Free( self->dataTypes );
+	Memory_Free( self->offsets );
+	Memory_Free( self->components );
 }
 
 Index _Variable_GetNewArraySize( Variable* self ) {
@@ -1039,9 +979,9 @@ Index _Variable_GetNewArraySize( Variabl
 */
 
 void Variable_SetValue( void* variable, Index array_I, void* value ) {
-	Variable*	self = (Variable*)variable;
+	Variable*		self = (Variable*)variable;
 	ArithPointer*	vPtr;
-	Index		component_I;
+	Index				component_I;
 	
 	vPtr = value;
 	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/src/Variable.h
--- a/Base/Context/src/Variable.h	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Variable.h	Wed Dec 02 11:31:17 2009 +1100
@@ -67,32 +67,32 @@
 
 	/* See Variable */
 	#define __Variable \
-		/* General info */ 					\
-		__Stg_Component						\
-									\
-		AbstractContext*		context;		\
-		/* Virtual info */ 					\
-									\
-		/* Variable info */ 					\
-		Index				offsetCount; 		/**< Number of fields in this variable. */ \
-		SizeT*				offsets; 		/**< The offset in bytes these fields are in the struct.*/ \
-		Variable_DataType*		dataTypes;		/**< A list of original data types. */ \
-		Index*				dataTypeCounts;		/**< A list of the number of data. */ \
-		SizeT*				structSizePtr; 		/**< A pointer to the size of the structure. */ \
-		void**				arrayPtrPtr; 		/**< A pointer to a pointer to the 1D array data. */ \
-		Index*				arraySizePtr; 		/**< A ptr to the size/count of the 1D array data. Note that if this is NULL, the arraySizeFunc will be used */ \
-		Variable_ArraySizeFunc*		arraySizeFunc; 		/**< A func ptr to the size/count of the 1D array data. */ \
-									\
-		SizeT*				dataSizes; 		/**< The size in bytes of each field in this variable. */ \
-		SizeT				structSize; 		/**< The size of the structure. */ \
-		void*				arrayPtr; 		/**< A pointer to the 1D array of structures. */ \
-		Index				arraySize; 		/**< The size/count of the 1D array of structures. */ \
-		Index                           subVariablesCount;      /**< The number of subvariables. Necessary since determined by whether user passes in names or not at init time. */ \
-		Variable**			components;		/**< For each component of this variable that we made a variable for, the pointer to the variable. */ \
-		Bool				allocateSelf;		\
-		Variable_Register*		vr;			\
-									\
-		Variable*			parent;
+		/* General info */ \
+		__Stg_Component \
+		\
+		AbstractContext*			context; \
+		/* Virtual info */ \
+		\
+		/* Variable info */ \
+		Index							offsetCount; /**< Number of fields in this variable. */ \
+		SizeT*						offsets; /**< The offset in bytes these fields are in the struct.*/ \
+		Variable_DataType*		dataTypes; /**< A list of original data types. */ \
+		Index*						dataTypeCounts; /**< A list of the number of data. */ \
+		SizeT*						structSizePtr; /**< A pointer to the size of the structure. */ \
+		void**						arrayPtrPtr; /**< A pointer to a pointer to the 1D array data. */ \
+		Index*						arraySizePtr; /**< A ptr to the size/count of the 1D array data. Note that if this is NULL, the arraySizeFunc will be used */ \
+		Variable_ArraySizeFunc*	arraySizeFunc; /**< A func ptr to the size/count of the 1D array data. */ \
+		\
+		SizeT*						dataSizes; /**< The size in bytes of each field in this variable. */ \
+		SizeT							structSize; /**< The size of the structure. */ \
+		void*							arrayPtr; /**< A pointer to the 1D array of structures. */ \
+		Index							arraySize; /**< The size/count of the 1D array of structures. */ \
+		Index							subVariablesCount; /**< The number of subvariables. Necessary since determined by whether user passes in names or not at init time. */ \
+		Variable**					components; /**< For each component of this variable that we made a variable for, the pointer to the variable. */ \
+		Bool							allocateSelf; \
+		Variable_Register*		vr; \
+		\
+		Variable*					parent;
 
 	struct _Variable { __Variable };
 
@@ -100,8 +100,6 @@
 	** Constructors
 	*/
 
-
-	
 	/** Creates a new Variable. A Variable holds the run-time information of a complex data type created by the programmer.
 	  * Essentially it associates a textual name to a variable in the program that the user can use to access or modify.
 	  *
@@ -120,20 +118,20 @@
 	  * size of the struct, the size of the array and the pointer to the array are provided as pointers to this information, of
 	  * which will get resolved/dereferenced at the build phase. */
 	Variable* Variable_New( 
-		Name						name,
-		Index						dataCount,
-		SizeT*						dataOffsets,
-		Variable_DataType*				dataTypes,
-		Index*						dataTypeCounts,
-		Name*						dataNames,
-		SizeT*						structSizePtr,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr );
+		Name								name,
+		AbstractContext*				context,
+		Index								dataCount,
+		SizeT*							dataOffsets,
+		Variable_DataType*			dataTypes,
+		Index*							dataTypeCounts,
+		Name*								dataNames,
+		SizeT*							structSizePtr,
+		Index*							arraySizePtr,
+		Variable_ArraySizeFunc*		arraySizeFunc,
+		void**							arrayPtrPtr,
+		Variable_Register*			vr );
 	
-	
-	Variable* Variable_DefaultNew( Name name );
+	Variable* _Variable_DefaultNew( Name name );
 	
 	/** Creates a new Variable. A Variable holds the run-time information of a complex data type created by the programmer.
 	  * Essentially it associates a textual name to a variable in the program that the user can use to access or modify.
@@ -143,12 +141,13 @@
 	  * This constructor is a shortcut to create a Variable of a scalar in an array. The stride/struct size is the size
 	  * of the dataType. There is no casting. */
 	Variable* Variable_NewScalar( 
-		Name						name,
+		Name								name,
+		AbstractContext*				context,
 		Variable_DataType				dataType,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr );
+		Index*							arraySizePtr,
+		Variable_ArraySizeFunc*		arraySizeFunc,
+		void**							arrayPtrPtr,
+		Variable_Register*			vr );
 	
 	/** Creates a new Variable. A Variable holds the run-time information of a complex data type created by the programmer.
 	  * Essentially it associates a textual name to a variable in the program that the user can use to access or modify.
@@ -159,24 +158,26 @@
 	  * optional and are specified via the variable arguement list at the end. A 0 value signifies no name for the associated
 	  * vector component. The stride/struct size is the size of the dataType. There is no casting.*/
 	Variable* Variable_NewVector( 
-		Name						name,
+		Name								name,
+		AbstractContext*				context,
 		Variable_DataType				dataType,
-		Index						dataTypeCount,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*			        arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr,
+		Index								dataTypeCount,
+		Index*							arraySizePtr,
+		Variable_ArraySizeFunc*		arraySizeFunc,
+		void**							arrayPtrPtr,
+		Variable_Register*			vr,
 		... 						/* vector component names */ );
 
 	Variable* Variable_NewVector2( 
-		Name						name,
+		Name								name,
+		AbstractContext*				context,
 		Variable_DataType				dataType,
-		Index						dataTypeCount,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Variable_Register*				vr,
-		char**						dataNames );
+		Index								dataTypeCount,
+		Index*							arraySizePtr,
+		Variable_ArraySizeFunc*		arraySizeFunc,
+		void**							arrayPtrPtr,
+		Variable_Register*			vr,
+		char**							dataNames );
 	
 	/** Constructor interface. */
 	
@@ -185,66 +186,48 @@
 	#endif
 
 	#define VARIABLE_DEFARGS \
-                STG_COMPONENT_DEFARGS, \
-                Bool                           initFlag, \
-                Index                         dataCount, \
-                SizeT*                      dataOffsets, \
-                Variable_DataType*            dataTypes, \
-                Index*                   dataTypeCounts, \
-                Name*                         dataNames, \
-                SizeT*                    structSizePtr, \
-                Index*                     arraySizePtr, \
-                Variable_ArraySizeFunc*   arraySizeFunc, \
-                void**                      arrayPtrPtr, \
-                Variable_Register*                   vr
+		STG_COMPONENT_DEFARGS, \
+			Index                         dataCount, \
+			SizeT*                      dataOffsets, \
+			Variable_DataType*            dataTypes, \
+			Index*                   dataTypeCounts, \
+			Name*                         dataNames, \
+			SizeT*                    structSizePtr, \
+			Index*                     arraySizePtr, \
+			Variable_ArraySizeFunc*   arraySizeFunc, \
+			void**                      arrayPtrPtr, \
+			Variable_Register*                   vr
 
 	#define VARIABLE_PASSARGS \
-                STG_COMPONENT_PASSARGS, \
-	        initFlag,       \
-	        dataCount,      \
-	        dataOffsets,    \
-	        dataTypes,      \
-	        dataTypeCounts, \
-	        dataNames,      \
-	        structSizePtr,  \
-	        arraySizePtr,   \
-	        arraySizeFunc,  \
-	        arrayPtrPtr,    \
-	        vr            
+		STG_COMPONENT_PASSARGS, \
+			dataCount, \
+			dataOffsets, \
+			dataTypes, \
+			dataTypeCounts, \
+			dataNames, \
+			structSizePtr, \
+			arraySizePtr, \
+			arraySizeFunc, \
+			arrayPtrPtr, \
+			vr            
 
 	Variable* _Variable_New(  VARIABLE_DEFARGS  );
-	
-	
-	/** Initialise a Variable */
-	void Variable_Init(
-		Name						name,
-		Variable*					self,
-		Index						dataCount,
-		SizeT*						dataOffsets,
-		Variable_DataType*				dataTypes,
-		Index*						dataTypeCounts,
-		Name*						dataNames,
-		SizeT*						structSizePtr,
-		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
-		void**						arrayPtrPtr,
-		Bool						allocateSelf,
-		Variable_Register*				vr );
 	
 	/** Init interface. */
 	void _Variable_Init(
 		Variable*					self, 
-		Index						dataCount,
+		AbstractContext*			context,
+		Index							dataCount,
 		SizeT*						dataOffsets,
-		Variable_DataType*				dataTypes,
+		Variable_DataType*		dataTypes,
 		Index*						dataTypeCounts,
-		Name*						dataNames,
+		Name*							dataNames,
 		SizeT*						structSizePtr,
 		Index*						arraySizePtr,
-		Variable_ArraySizeFunc*				arraySizeFunc,
+		Variable_ArraySizeFunc*	arraySizeFunc,
 		void**						arrayPtrPtr,
-		Bool						allocateSelf,
-		Variable_Register*				vr );
+		Bool							allocateSelf,
+		Variable_Register*		vr );
 	
 	
 	/*--------------------------------------------------------------------------------------------------------------------------
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/tests/LiveComponentRegisterSuite.c
--- a/Base/Context/tests/LiveComponentRegisterSuite.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/tests/LiveComponentRegisterSuite.c	Wed Dec 02 11:31:17 2009 +1100
@@ -76,6 +76,7 @@ void LiveComponentRegisterSuite_TestGet(
 
    var = Variable_NewScalar(
       "Scalar",
+		NULL,
       Variable_DataType_Float,
       &length,
       NULL,
@@ -84,6 +85,7 @@ void LiveComponentRegisterSuite_TestGet(
 
    vec = Variable_NewVector(
       "Three",
+		NULL,
       Variable_DataType_Float,
       3,
       &length,
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/tests/SetVC_Suite.c
--- a/Base/Context/tests/SetVC_Suite.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/tests/SetVC_Suite.c	Wed Dec 02 11:31:17 2009 +1100
@@ -110,13 +110,13 @@ void SetVC_Suite_Setup( SetVC_SuiteData*
    /* Create variables */
    for (ii = 0; ii < (TEMP_INDEX); ii++) {
       data->array[ii] = Memory_Alloc_Array( double, data->arraySize, "data->array[]" );
-      data->var[ii] = Variable_NewScalar( data->varNames[ii], Variable_DataType_Double, &data->arraySize, NULL,
+      data->var[ii] = Variable_NewScalar( data->varNames[ii], NULL, Variable_DataType_Double, &data->arraySize, NULL,
          (void**)&data->array[ii], 0 ); 
       Variable_Register_Add(data->vr, data->var[ii]);
    }
 
    data->array[TEMP_INDEX] = Memory_Alloc_Array( double , data->arraySize*TEMP_VAR_ARRAYSIZE, "data->array[TEMP_INDEX]" );
-   data->var[TEMP_INDEX] = Variable_NewVector( data->varNames[TEMP_INDEX], Variable_DataType_Double, TEMP_VAR_ARRAYSIZE,
+   data->var[TEMP_INDEX] = Variable_NewVector( data->varNames[TEMP_INDEX], NULL, Variable_DataType_Double, TEMP_VAR_ARRAYSIZE,
        &data->arraySize, NULL, (void**)&data->array[TEMP_INDEX], 0, "a", "b", "c", "d", "e" );
    Variable_Register_Add( data->vr, data->var[TEMP_INDEX] );
 
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/tests/VariableAllVC_Suite.c
--- a/Base/Context/tests/VariableAllVC_Suite.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/tests/VariableAllVC_Suite.c	Wed Dec 02 11:31:17 2009 +1100
@@ -88,7 +88,7 @@ void VariableAllVC_Suite_Setup( Variable
    Stg_asprintf( &data->vcKey, "VariableAllVC" );
    VariableAllVC_Suite_CreateDictEntries( data );
 
-   data->var = Variable_NewScalar( "test", Variable_DataType_Double, &data->arraySize, NULL, (void**)&data->testArray, data->vr );
+   data->var = Variable_NewScalar( "test", NULL, Variable_DataType_Double, &data->arraySize, NULL, (void**)&data->testArray, data->vr );
       
    Variable_Register_BuildAll(data->vr);
    
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/tests/VariableDumpStreamSuite.c
--- a/Base/Context/tests/VariableDumpStreamSuite.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/tests/VariableDumpStreamSuite.c	Wed Dec 02 11:31:17 2009 +1100
@@ -89,6 +89,7 @@ void VariableDumpStreamSuite_TestDump( V
 
    var = Variable_NewScalar(
       "Scalar",
+		NULL,
       Variable_DataType_Double,
       &length,
       NULL,
@@ -97,6 +98,7 @@ void VariableDumpStreamSuite_TestDump( V
 
    vec = Variable_NewVector(
       "Three",
+		NULL,
       Variable_DataType_Double,
       3,
       &length,
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/tests/VariableSuite.c
--- a/Base/Context/tests/VariableSuite.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/tests/VariableSuite.c	Wed Dec 02 11:31:17 2009 +1100
@@ -83,9 +83,9 @@ void VariableSuite_Setup( VariableSuiteD
 
    /* Construction phase --------------------------------------------------------------------------------------------*/
    data->vr = Variable_Register_New();
-   Variable_NewScalar( "temperature", Variable_DataType_Double, &data->aSize[0], NULL, (void**)&data->temperature, data->vr );
-   Variable_NewVector( "velocity", Variable_DataType_Double, 3, &data->aSize[1], NULL, (void**)&data->velocity, data->vr, "vx", "vy", "vz" );
-   Variable_New( "particle", 3, pOffsets, pDataTypes, pDtCounts, pNames, &pSize, &data->aSize[2], NULL, (void**)&data->particle, data->vr );
+   Variable_NewScalar( "temperature", NULL, Variable_DataType_Double, &data->aSize[0], NULL, (void**)&data->temperature, data->vr );
+   Variable_NewVector( "velocity", NULL, Variable_DataType_Double, 3, &data->aSize[1], NULL, (void**)&data->velocity, data->vr, "vx", "vy", "vz" );
+   Variable_New( "particle", NULL, 3, pOffsets, pDataTypes, pDtCounts, pNames, &pSize, &data->aSize[2], NULL, (void**)&data->particle, data->vr );
    
    /* Build phase ---------------------------------------------------------------------------------------------------*/
    data->temperature = Memory_Alloc_Array( double, data->aSize[0], "temperature" );
@@ -224,25 +224,9 @@ void VariableSuite_TestVariable_Char( Va
    array = Memory_Alloc_Array( char, length, "test" );
    structArray = Memory_Alloc_Array( Triple, length, "test" );
 
-   var = Variable_NewScalar(
-      "Char-Scalar",
-      Variable_DataType_Char,
-      &length,
-      NULL,
-      (void**)&array,
-      data->vr );
+   var = Variable_NewScalar( "Char-Scalar", NULL, Variable_DataType_Char, &length, NULL, (void**)&array, data->vr );
+   vec = Variable_NewVector( "Char-Three", NULL, Variable_DataType_Char, 3, &length, NULL, (void**)&structArray, data->vr, "a", "b", "c" );
 
-   vec = Variable_NewVector(
-      "Char-Three",
-      Variable_DataType_Char,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      data->vr,
-      "a",
-      "b",
-      "c" );
    vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
    vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
    vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
@@ -325,25 +309,9 @@ void VariableSuite_TestVariable_Double( 
    array = Memory_Alloc_Array( double, length, "test" );
    structArray = Memory_Alloc_Array( Triple, length, "test" );
 
-   var = Variable_NewScalar(
-      "Double-Scalar",
-      Variable_DataType_Double,
-      &length,
-      NULL,
-      (void**)&array,
-      data->vr );
+   var = Variable_NewScalar( "Double-Scalar", NULL, Variable_DataType_Double, &length, NULL, (void**)&array, data->vr ); 
+   vec = Variable_NewVector( "Double-Three", NULL, Variable_DataType_Double, 3, &length, NULL, (void**)&structArray, data->vr, "a", "b", "c" );
 
-   vec = Variable_NewVector(
-      "Double-Three",
-      Variable_DataType_Double,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      data->vr,
-      "a",
-      "b",
-      "c" );
    vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
    vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
    vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
@@ -427,25 +395,9 @@ void VariableSuite_TestVariable_Float( V
    array = Memory_Alloc_Array( float, length, "test" );
    structArray = Memory_Alloc_Array( Triple, length, "test" );
 
-   var = Variable_NewScalar(
-      "Float-Scalar",
-      Variable_DataType_Float,
-      &length,
-      NULL,
-      (void**)&array,
-      data->vr );
+   var = Variable_NewScalar( "Float-Scalar", NULL, Variable_DataType_Float, &length, NULL, (void**)&array, data->vr );
+   vec = Variable_NewVector( "Float-Three", NULL, Variable_DataType_Float, 3, &length, NULL, (void**)&structArray, data->vr, "a", "b", "c" );
 
-   vec = Variable_NewVector(
-      "Float-Three",
-      Variable_DataType_Float,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      data->vr,
-      "a",
-      "b",
-      "c" );
    vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
    vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
    vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
@@ -453,7 +405,6 @@ void VariableSuite_TestVariable_Float( V
    Variable_Register_BuildAll( data->vr );
 
    for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
-
       testValue = testValues[test_I];
 
       for ( i = 0; i < length; ++i ) {
@@ -532,25 +483,9 @@ void VariableSuite_TestVariable_Int( Var
    array = Memory_Alloc_Array( int, length, "test" );
    structArray = Memory_Alloc_Array( Triple, length, "test" );
 
-   var = Variable_NewScalar(
-      "Int-Scalar",
-      Variable_DataType_Int,
-      &length,
-      NULL,
-      (void**)&array,
-      data->vr );
+   var = Variable_NewScalar( "Int-Scalar", NULL, Variable_DataType_Int, &length, NULL, (void**)&array, data->vr );
+   vec = Variable_NewVector( "Int-Three", NULL, Variable_DataType_Int, 3, &length, NULL, (void**)&structArray, data->vr, "a", "b", "c" );
 
-   vec = Variable_NewVector(
-      "Int-Three",
-      Variable_DataType_Int,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      data->vr,
-      "a",
-      "b",
-      "c" );
    vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
    vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
    vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
@@ -637,25 +572,9 @@ void VariableSuite_TestVariable_Short( V
    array = Memory_Alloc_Array( short, length, "test" );
    structArray = Memory_Alloc_Array( Triple, length, "test" );
 
-   var = Variable_NewScalar(
-      "Short-Scalar",
-      Variable_DataType_Short,
-      &length,
-      NULL,
-      (void**)&array,
-      data->vr );
+   var = Variable_NewScalar( "Short-Scalar", NULL, Variable_DataType_Short, &length, NULL, (void**)&array, data->vr );
+   vec = Variable_NewVector( "Short-Three", NULL, Variable_DataType_Short, 3, &length, NULL, (void**)&structArray, data->vr, "a", "b", "c" );
 
-   vec = Variable_NewVector(
-      "Short-Three",
-      Variable_DataType_Short,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      data->vr,
-      "a",
-      "b",
-      "c" );
    vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
    vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
    vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
@@ -765,24 +684,9 @@ void VariableSuite_TestVariableCopy( Var
 
    ctx1->vr = Variable_Register_New();
 
-	Variable_NewScalar(
-		"Scalar",
-		Variable_DataType_Float,
-		&(ctx1->scalarCount),
-		NULL,
-		(void**)&(ctx1->scalars),
-		ctx1->vr );
-	Variable_NewVector(
-		"Vector",
-		Variable_DataType_Double,
-		VECTOR_DATA_COUNT,
-		&(ctx1->vectorCount),
-		NULL,
-		(void**)&(ctx1->vectors),
-		ctx1->vr,
-		"x",
-		"y",
-		"z" );
+	Variable_NewScalar( "Scalar", NULL, Variable_DataType_Float, &(ctx1->scalarCount), NULL, (void**)&(ctx1->scalars), ctx1->vr );
+	Variable_NewVector( "Vector", NULL, Variable_DataType_Double, VECTOR_DATA_COUNT, &(ctx1->vectorCount), NULL, (void**)&(ctx1->vectors), ctx1->vr, "x", "y", "z" );
+
 	{
 		ComplexStuff tmp;
 		SizeT dataOffsets[] = { 0, 0 };
@@ -793,18 +697,7 @@ void VariableSuite_TestVariableCopy( Var
 		dataOffsets[0] = (ArithPointer)&tmp.y - (ArithPointer)&tmp;
 		dataOffsets[1] = (ArithPointer)&tmp.z - (ArithPointer)&tmp;
 
-		Variable_New(
-			"Complex",
-			2,
-			dataOffsets,
-			dataTypes,
-			dataTypeCounts,
-			dataNames,
-			&(ctx1->complexStuffSize),
-			&(ctx1->stuffCount),
-			NULL,
-			(void**)&(ctx1->stuff),
-			ctx1->vr );
+		Variable_New( "Complex", NULL, 2, dataOffsets, dataTypes, dataTypeCounts, dataNames, &(ctx1->complexStuffSize), &(ctx1->stuffCount), NULL, (void**)&(ctx1->stuff), ctx1->vr );
 	}
 
 	Variable_Register_BuildAll( ctx1->vr );
@@ -899,30 +792,11 @@ void VariableSuite_TestVariableValueComp
       dataArray2[ index ] = dataArray[ index ] + amp * cos( index );
    }		
    
-   orig = Variable_NewVector( 
-         "orig", 
-         Variable_DataType_Double, 
-         componentCount,
-         &arrayCount,
-         NULL,
-         (void**)&dataArray,
-         data->vr,
-         "orig1",
-         "orig2",
-         "orig3",
-         "orig4" );
-   compare = Variable_NewVector( 
-         "compare", 
-         Variable_DataType_Double, 
-         componentCount,
-         &arrayCount,
-         NULL,
-         (void**)&dataArray2,
-         data->vr,
-         "compare1",
-         "compare2",
-         "compare3",
-         "compare4" );
+   orig = Variable_NewVector( "orig", NULL, Variable_DataType_Double, componentCount,
+		&arrayCount, NULL, (void**)&dataArray, data->vr, "orig1", "orig2", "orig3", "orig4" );
+   compare = Variable_NewVector( "compare", NULL, Variable_DataType_Double, componentCount,
+		&arrayCount, NULL, (void**)&dataArray2, data->vr, "compare1", "compare2", "compare3", "compare4" );
+
    Stg_Component_Build( orig, 0, False );
    Stg_Component_Build( compare, 0, False );
 
diff -r 476ea49b3bc7 -r ac3c2f072ad7 Base/Context/tests/Variable_RegisterSuite.c
--- a/Base/Context/tests/Variable_RegisterSuite.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/tests/Variable_RegisterSuite.c	Wed Dec 02 11:31:17 2009 +1100
@@ -67,7 +67,7 @@ void Variable_RegisterSuite_TestAddGet( 
    Index		   	i;
 
    for (i = 0; i < 10; i++) {
-      var[i] = Variable_NewVector( name[i], Variable_DataType_Double, 4, &arraySize, NULL, (void**)&array, 0 );
+      var[i] = Variable_NewVector( name[i], NULL, Variable_DataType_Double, 4, &arraySize, NULL, (void**)&array, 0 );
    }
 
    for (i = 0; i < 10; i++)



More information about the CIG-COMMITS mailing list