[cig-commits] commit: merge
Mercurial
hg at geodynamics.org
Mon Feb 1 15:32:17 PST 2010
changeset: 705:9a070c9a4b8f
branch: pcu_rejig
parent: 704:886f2b713d39
parent: 702:ac3c2f072ad7
user: JulianGiordani
date: Wed Dec 02 14:17:25 2009 +1100
description:
merge
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/CompositeVC.c
--- a/Base/Context/src/CompositeVC.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/CompositeVC.c Wed Dec 02 14:17:25 2009 +1100
@@ -58,16 +58,18 @@ const Name defaultCompositeVCName = "def
*/
VariableCondition* CompositeVC_Factory(
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
void* data )
{
- return (VariableCondition*)CompositeVC_New( defaultCompositeVCName, variable_Register, conFunc_Register, dictionary, data );
+ return (VariableCondition*)CompositeVC_New( defaultCompositeVCName, context, variable_Register, conFunc_Register, dictionary, data );
}
CompositeVC* CompositeVC_New(
Name name,
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
@@ -76,7 +78,7 @@ CompositeVC* CompositeVC_New(
CompositeVC* self = _CompositeVC_DefaultNew( name );
self->isConstructed = True;
- _VariableCondition_Init( self, variable_Register, conFunc_Register, dictionary );
+ _VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
_CompositeVC_Init( self, data );
return self;
@@ -172,7 +174,7 @@ void _CompositeVC_ReadDictionary( void*
vcEntry = Dictionary_Entry_Value_GetElement(vcList, entry_I);
type = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcEntry, "type"));
dictionary = Dictionary_Entry_Value_AsDictionary(vcEntry);
- vc = VariableCondition_Register_CreateNew(variableCondition_Register, self->variable_Register,
+ vc = VariableCondition_Register_CreateNew( self->context, variableCondition_Register, self->variable_Register,
self->conFunc_Register, type, dictionary, self->data );
vc->cf = self->cf;
vc->_readDictionary( vc, dictionary );
@@ -187,6 +189,7 @@ void _CompositeVC_ReadDictionary( void*
}
}
vcList = Dictionary_Get( dictionary, "vcList" );
+
if( vcList ) {
Index count;
Index entry_I;
@@ -202,7 +205,7 @@ void _CompositeVC_ReadDictionary( void*
vcEntry = Dictionary_Entry_Value_GetElement(vcList, entry_I);
type = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcEntry, "type"));
dictionary = Dictionary_Entry_Value_AsDictionary(vcEntry);
- vc = VariableCondition_Register_CreateNew(variableCondition_Register, self->variable_Register,
+ vc = VariableCondition_Register_CreateNew( self->context, variableCondition_Register, self->variable_Register,
self->conFunc_Register, type, dictionary, self->data );
vc->_readDictionary( vc, dictionary );
CompositeVC_Add(self, vc, True);
@@ -213,39 +216,35 @@ void _CompositeVC_ReadDictionary( void*
}
void _CompositeVC_AssignFromXML( void* compositeVC, Stg_ComponentFactory* cf, void* data ) {
- CompositeVC* self = (CompositeVC*)compositeVC;
- void* variableRegister = NULL;
- void* conditionFunctionRegister = NULL;
- void* initData = NULL;
- Dictionary* vcDict = NULL;
- Name vcName;
+ CompositeVC* self = (CompositeVC*)compositeVC;
+ void* variableRegister = NULL;
+ void* conditionFunctionRegister = NULL;
+ void* initData = NULL;
+ Dictionary* vcDict = NULL;
+ Name vcName;
+ AbstractContext* context;
- self->dictionary = cf->rootDict;
-
/* Need to store this so we can get at components
later on when using the fucked up 'ReadDictionary' function. */
self->cf = cf;
- 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 );
- variableRegister = self->context->variable_Register;
+ variableRegister = context->variable_Register;
assert( variableRegister );
conditionFunctionRegister = condFunc_Register;
assert( conditionFunctionRegister );
vcName = Stg_ComponentFactory_GetString( cf, self->name, "vcName", self->name );
+
if ( cf->rootDict )
vcDict = Dictionary_GetDictionary( cf->rootDict, vcName );
-/* Journal_Firewall( */
-/* vcDict != NULL, */
-/* Journal_Register( Error_Type, self->type ), */
-/* "For %s '%s' - Cannont find variable condition dictionary '%s'\n", self->type, self->name, vcName ); */
-
+
initData = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Data", Stg_Component, False, data );
- _VariableCondition_Init( self, variableRegister, conditionFunctionRegister, vcDict );
+ _VariableCondition_Init( self, context, variableRegister, conditionFunctionRegister, vcDict );
_CompositeVC_Init( self, initData );
}
@@ -283,10 +282,9 @@ void _CompositeVC_Destroy(void* composit
_VariableCondition_Destroy( self, data );
}
-void _CompositeVC_Print(void* compositeVC, Stream* stream)
-{
+void _CompositeVC_Print(void* compositeVC, Stream* stream) {
CompositeVC* self = (CompositeVC*)compositeVC;
- Index item_I;
+ Index item_I;
/* Set the Journal for printing informations */
Stream* info = stream;
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/CompositeVC.h
--- a/Base/Context/src/CompositeVC.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/CompositeVC.h Wed Dec 02 14:17:25 2009 +1100
@@ -60,13 +60,12 @@
struct _CompositeVC { __CompositeVC };
-
-
/*--------------------------------------------------------------------------------------------------------------------------
** Constructor
*/
VariableCondition* CompositeVC_Factory(
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
@@ -74,6 +73,7 @@
CompositeVC* CompositeVC_New(
Name name,
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/DynamicVC.c
--- a/Base/Context/src/DynamicVC.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/DynamicVC.c Wed Dec 02 14:17:25 2009 +1100
@@ -54,16 +54,19 @@ const Name defaultDynamicVCName = "defau
** Constructor
*/
-VariableCondition* DynamicVC_Factory( Variable_Register* varReg,
- ConditionFunction_Register* conFuncReg,
- Dictionary* dict,
- void* data )
+VariableCondition* DynamicVC_Factory(
+ AbstractContext* context,
+ Variable_Register* varReg,
+ ConditionFunction_Register* conFuncReg,
+ Dictionary* dict,
+ void* data )
{
- return (VariableCondition*)DynamicVC_New( defaultDynamicVCName, varReg, conFuncReg, dict );
+ return (VariableCondition*)DynamicVC_New( defaultDynamicVCName, context, varReg, conFuncReg, dict );
}
DynamicVC* DynamicVC_New(
Name name,
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary )
@@ -71,7 +74,7 @@ DynamicVC* DynamicVC_New(
DynamicVC* self = _DynamicVC_DefaultNew( name );
self->isConstructed = True;
- _VariableCondition_Init( self, variable_Register, conFunc_Register, dictionary );
+ _VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
_DynamicVC_Init( self );
return self;
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/DynamicVC.h
--- a/Base/Context/src/DynamicVC.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/DynamicVC.h Wed Dec 02 14:17:25 2009 +1100
@@ -51,18 +51,20 @@ extern const Type DynamicVC_Type;
struct DynamicVC { __DynamicVC };
-
-
/*--------------------------------------------------------------------------------------------------------------------------
** Constructor
*/
- VariableCondition* DynamicVC_Factory( Variable_Register* varReg,
+ VariableCondition* DynamicVC_Factory(
+ AbstractContext* context,
+ Variable_Register* varReg,
ConditionFunction_Register* conFuncReg,
Dictionary* dict,
void* data );
- DynamicVC* DynamicVC_New( Name name,
+ DynamicVC* DynamicVC_New(
+ Name name,
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dict );
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/Init.c
--- a/Base/Context/src/Init.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/Init.c Wed Dec 02 14:17:25 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 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/SetVC.c
--- a/Base/Context/src/SetVC.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/SetVC.c Wed Dec 02 14:17:25 2009 +1100
@@ -56,16 +56,18 @@ const Name defaultSetVCName = "defaultSe
*/
VariableCondition* SetVC_Factory(
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
void* data )
{
- return (VariableCondition*)SetVC_New( defaultSetVCName, NULL, variable_Register, conFunc_Register, dictionary );
+ return (VariableCondition*)SetVC_New( defaultSetVCName, context, NULL, variable_Register, conFunc_Register, dictionary );
}
SetVC* SetVC_New(
Name name,
+ AbstractContext* context,
Name _dictionaryEntryName,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
@@ -74,7 +76,7 @@ SetVC* SetVC_New(
SetVC* self = _SetVC_DefaultNew( name );
self->isConstructed = True;
- _VariableCondition_Init( self, variable_Register, conFunc_Register, dictionary );
+ _VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
_SetVC_Init( self, _dictionaryEntryName );
return self;
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/SetVC.h
--- a/Base/Context/src/SetVC.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/SetVC.h Wed Dec 02 14:17:25 2009 +1100
@@ -59,13 +59,12 @@
struct _SetVC { __SetVC };
-
-
/*--------------------------------------------------------------------------------------------------------------------------
** Constructor
*/
VariableCondition* SetVC_Factory(
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
@@ -73,6 +72,7 @@
SetVC* SetVC_New(
Name name,
+ AbstractContext* context,
Name _dictionaryEntryName,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/Variable.c
--- a/Base/Context/src/Variable.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/Variable.c Wed Dec 02 14:17:25 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 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/Variable.h
--- a/Base/Context/src/Variable.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/Variable.h Wed Dec 02 14:17:25 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 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/VariableAllVC.c
--- a/Base/Context/src/VariableAllVC.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/VariableAllVC.c Wed Dec 02 14:17:25 2009 +1100
@@ -55,17 +55,19 @@ const Name defaultVariableAllVCName = "d
*/
VariableCondition* VariableAllVC_Factory(
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
void* data )
{
- return (VariableCondition*)VariableAllVC_New( defaultVariableAllVCName, NULL, variable_Register, conFunc_Register, dictionary, data );
+ return (VariableCondition*)VariableAllVC_New( defaultVariableAllVCName, context, NULL, variable_Register, conFunc_Register, dictionary, data );
}
VariableAllVC* VariableAllVC_New(
Name name,
+ AbstractContext* context,
Name _dictionaryEntryName,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
@@ -75,7 +77,7 @@ VariableAllVC* VariableAllVC_New(
VariableAllVC* self = _VariableAllVC_DefaultNew( name );
self->isConstructed = True;
- _VariableCondition_Init( self, variable_Register, conFunc_Register, dictionary );
+ _VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
_VariableAllVC_Init( self, _dictionaryEntryName, data );
return self;
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/VariableAllVC.h
--- a/Base/Context/src/VariableAllVC.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/VariableAllVC.h Wed Dec 02 14:17:25 2009 +1100
@@ -64,13 +64,12 @@
struct _VariableAllVC { __VariableAllVC };
-
-
/*--------------------------------------------------------------------------------------------------------------------------
** Constructor
*/
VariableCondition* VariableAllVC_Factory(
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary,
@@ -78,6 +77,7 @@
VariableAllVC* VariableAllVC_New(
Name name,
+ AbstractContext* context,
Name _dictionaryEntryName,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/VariableCondition.c
--- a/Base/Context/src/VariableCondition.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/VariableCondition.c Wed Dec 02 14:17:25 2009 +1100
@@ -78,13 +78,14 @@ VariableCondition* _VariableCondition_Ne
void _VariableCondition_Init(
void* variableCondition,
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary )
{
VariableCondition* self = (VariableCondition*)variableCondition;
- self->isConstructed = True;
+ self->context = context;
self->variable_Register = variable_Register;
self->conFunc_Register = conFunc_Register;
self->dictionary = dictionary;
@@ -103,19 +104,18 @@ void _VariableCondition_Init(
*/
void _VariableCondition_Delete(void* variableCondition) {
- VariableCondition* self = (VariableCondition*)variableCondition;
+ VariableCondition* self = (VariableCondition*)variableCondition;
/* Stg_Class_Delete parent */
_Stg_Component_Delete( self );
}
-void _VariableCondition_Print(void* variableCondition)
-{
- VariableCondition* self = (VariableCondition*)variableCondition;
+void _VariableCondition_Print(void* variableCondition) {
+ VariableCondition* self = (VariableCondition*)variableCondition;
VariableCondition_VariableIndex vcVar_I;
- VariableCondition_ValueIndex val_I;
- Index i;
+ VariableCondition_ValueIndex val_I;
+ Index i;
/* Set the Journal for printing informations */
Stream* variableConditionStream = Journal_Register( InfoStream_Type, "VariableConditionStream");
@@ -140,6 +140,7 @@ void _VariableCondition_Print(void* vari
Journal_Printf( variableConditionStream, "\t_set (ptr): %p\n", self->_set);
Journal_Printf( variableConditionStream, "\tindexCount: %u\n", self->indexCount);
Journal_Printf( variableConditionStream, "\tindexTbl (ptr): %p\n", self->indexTbl);
+
if (self->indexTbl)
for (i = 0; i < self->indexCount; i++)
Journal_Printf( variableConditionStream, "\t\tindexTbl[%u]: %u\n", i, self->indexTbl[i]);
@@ -301,13 +302,12 @@ void* _VariableCondition_Copy( void* var
*/
void _VariableCondition_AssignFromXML( void* variableCondition, Stg_ComponentFactory* cf, void* data ) {
- VariableCondition* self = (VariableCondition*)variableCondition;
}
void _VariableCondition_Build( void* variableCondition, void* data ) {
- VariableCondition* self = (VariableCondition*)variableCondition;
+ VariableCondition* self = (VariableCondition*)variableCondition;
VariableCondition_ValueIndex val_I;
- Index i;
+ Index i;
/* Read the dictionary */
self->_readDictionary( self, self->dictionary );
@@ -316,8 +316,7 @@ void _VariableCondition_Build( void* var
self->_set = self->_getSet(self);
if (self->_set)
IndexSet_GetMembers(self->_set, &self->indexCount, &self->indexTbl);
- else
- {
+ else {
self->indexCount = 0;
self->indexTbl = NULL;
}
@@ -327,19 +326,16 @@ void _VariableCondition_Build( void* var
/* Build the variable to condition table */
self->vcVarCountTbl = Memory_Alloc_Array( VariableCondition_VariableIndex, self->indexCount, "VC->vcVarCountTbl" );
- for (i = 0; i < self->indexCount; i++)
- {
+ for (i = 0; i < self->indexCount; i++) {
/* For the index, get the number of "variables" that have been assigned conditions */
self->vcVarCountTbl[i] = self->_getVariableCount(self, self->indexTbl[i]);
}
self->vcTbl = Memory_Alloc_2DComplex( VariableCondition_Tuple, self->indexCount, self->vcVarCountTbl, "VC->vcTbl" );
- for ( i = 0; i < self->indexCount; i++ )
- {
+ for ( i = 0; i < self->indexCount; i++ ) {
VariableCondition_VariableIndex vcVar_I;
- for ( vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++ )
- {
+ for ( vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++ ) {
Variable* var;
/* For the index's variable, get the variable i.d. and value i.d. */
@@ -365,8 +361,8 @@ void _VariableCondition_Build( void* var
}
void _VariableCondition_Initialise( void* variableCondition, void* data ) {
- VariableCondition* self = (VariableCondition*)variableCondition;
- Index i;
+ VariableCondition* self = (VariableCondition*)variableCondition;
+ Index i;
for( i = 0; i < self->indexCount; i++ ) {
VariableCondition_VariableIndex vcVar_I;
@@ -388,7 +384,7 @@ void _VariableCondition_Execute( void* v
}
void _VariableCondition_Destroy( void* variableCondition, void* data ) {
- VariableCondition* self = (VariableCondition*)variableCondition;
+ VariableCondition* self = (VariableCondition*)variableCondition;
if (self->_set) Stg_Class_Delete(self->_set);
if (self->indexTbl) Memory_Free(self->indexTbl);
@@ -398,7 +394,7 @@ void _VariableCondition_Destroy( void* v
void _VariableCondition_Apply( void* variableCondition, void* context ) {
VariableCondition* self = (VariableCondition*)variableCondition;
- Index i;
+ Index i;
for (i = 0; i < self->indexCount; i++)
VariableCondition_ApplyToIndex(variableCondition, self->indexTbl[i], context);
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/VariableCondition.h
--- a/Base/Context/src/VariableCondition.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/VariableCondition.h Wed Dec 02 14:17:25 2009 +1100
@@ -88,51 +88,49 @@
/* General info */ \
__Stg_Component \
\
- AbstractContext* context; \
+ AbstractContext* context; \
/* Virtual info */ \
- VariableCondition_BuildSelfFunc* _buildSelf; \
- VariableCondition_PrintConciseFunc* _printConcise; \
+ VariableCondition_BuildSelfFunc* _buildSelf; \
+ VariableCondition_PrintConciseFunc* _printConcise; \
VariableCondition_ReadDictionaryFunc* _readDictionary; \
- VariableCondition_GetSetFunc* _getSet; \
- VariableCondition_GetVariableCountFunc* _getVariableCount; \
- VariableCondition_GetVariableIndexFunc* _getVariableIndex; \
+ VariableCondition_GetSetFunc* _getSet; \
+ VariableCondition_GetVariableCountFunc* _getVariableCount; \
+ VariableCondition_GetVariableIndexFunc* _getVariableIndex; \
VariableCondition_GetValueIndexFunc* _getValueIndex; \
VariableCondition_GetValueCountFunc* _getValueCount; \
- VariableCondition_GetValueFunc* _getValue; \
- VariableCondition_ApplyFunc* _apply; \
+ VariableCondition_GetValueFunc* _getValue; \
+ VariableCondition_ApplyFunc* _apply; \
\
/* Stg_Class info */ \
/** Register of Variables that may be operated on. */ \
- Variable_Register* variable_Register; \
+ Variable_Register* variable_Register; \
/** Register of Condition functions that may be applied. */ \
- ConditionFunction_Register* conFunc_Register; \
- Dictionary* dictionary; \
+ ConditionFunction_Register* conFunc_Register; \
+ Dictionary* dictionary; \
\
/** Set specifying which indexes in the client structure are being controlled by this VC. */ \
- IndexSet* _set; \
+ IndexSet* _set; \
/** the number of indexes this VC applies to. */ \
- Index indexCount; \
+ Index indexCount; \
/** Array, of size indexCount, containing the indexes this VC applies to. */ \
- Index* indexTbl; \
+ Index* indexTbl; \
/** Array containing the number of variables at each index that are controlled by this VC */ \
- VariableCondition_VariableIndex* vcVarCountTbl; \
+ VariableCondition_VariableIndex* vcVarCountTbl; \
/** 2d Array, which for each index this VC controls, stores the VariableCondition_Tuple that relates
what condition is being applied to which Variable */ \
- VariableCondition_Tuple** vcTbl; \
+ VariableCondition_Tuple** vcTbl; \
/** Number of values in the valueTbl which will be applied somewhere using this VC */ \
- VariableCondition_ValueIndex valueCount; \
+ VariableCondition_ValueIndex valueCount; \
/** Array of values which are available to apply (which index/var pairs they apply to is determined
by VariableCondition::vcTbl). */ \
- VariableCondition_Value* valueTbl; \
- \
- UIntMap* mapping; \
- Stg_ComponentFactory* cf;
+ VariableCondition_Value* valueTbl; \
+ \
+ UIntMap* mapping; \
+ Stg_ComponentFactory* cf;
/** Abstract class for specifying (1 or more) conditions that apply to (1 or more) variables in an array -
see VariableCondition.h for details */
struct _VariableCondition { __VariableCondition };
-
-
/*--------------------------------------------------------------------------------------------------------------------------
** Constructor
@@ -173,6 +171,7 @@
void _VariableCondition_Init(
void* variableCondition,
+ AbstractContext* context,
Variable_Register* variable_Register,
ConditionFunction_Register* conFunc_Register,
Dictionary* dictionary );
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/VariableCondition_Register.c
--- a/Base/Context/src/VariableCondition_Register.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/VariableCondition_Register.c Wed Dec 02 14:17:25 2009 +1100
@@ -210,16 +210,18 @@ VariableCondition_Register_Entry* _Varia
}
VariableCondition* VariableCondition_Register_CreateNew(
- void* variableCondition_Register,
- void* variable_Register,
- void* conFunc_Register,
- Type type,
- void* dictionary,
- void* data )
+ void* context,
+ void* variableCondition_Register,
+ void* variable_Register,
+ void* conFunc_Register,
+ Type type,
+ void* dictionary,
+ void* data )
{
VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
return VariableCondition_Register_At( self, VariableCondition_Register_GetIndex( self, type ) )->factory(
+ (AbstractContext*)context,
(Variable_Register*)variable_Register,
(ConditionFunction_Register*)conFunc_Register,
(Dictionary*)dictionary,
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/src/VariableCondition_Register.h
--- a/Base/Context/src/VariableCondition_Register.h Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/src/VariableCondition_Register.h Wed Dec 02 14:17:25 2009 +1100
@@ -42,7 +42,7 @@
/* Child classes must define these factories */
- typedef VariableCondition* (VariableCondition_Register_FactoryFunc) ( Variable_Register* variable_Register, ConditionFunction_Register* conFunc_Register, Dictionary* dictionary, void* data );
+ typedef VariableCondition* (VariableCondition_Register_FactoryFunc) ( AbstractContext* context, Variable_Register* variable_Register, ConditionFunction_Register* conFunc_Register, Dictionary* dictionary, void* data );
/** Textual name of this class */
@@ -125,12 +125,13 @@
/* Create a new instance of a type */
VariableCondition* VariableCondition_Register_CreateNew(
- void* variableCondition_Register,
- void* variable_Register,
- void* conFunc_Register,
- Type type,
- void* dictionary,
- void* data );
+ void* context,
+ void* variableCondition_Register,
+ void* variable_Register,
+ void* conFunc_Register,
+ Type type,
+ void* dictionary,
+ void* data );
#endif /* __Base_Automation_VariableCondition_Register_h__ */
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/tests/LiveComponentRegisterSuite.c
--- a/Base/Context/tests/LiveComponentRegisterSuite.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/tests/LiveComponentRegisterSuite.c Wed Dec 02 14:17:25 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 886f2b713d39 -r 9a070c9a4b8f Base/Context/tests/SetVC_Suite.c
--- a/Base/Context/tests/SetVC_Suite.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/tests/SetVC_Suite.c Wed Dec 02 14:17:25 2009 +1100
@@ -110,20 +110,20 @@ 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] );
Variable_Register_BuildAll( data->vr );
/* Create the VC */
- data->vc = (VariableCondition*)SetVC_New( "setVC", "setVC", data->vr, data->conFunc_Register, data->dict );
+ data->vc = (VariableCondition*)SetVC_New( "setVC", NULL, "setVC", data->vr, data->conFunc_Register, data->dict );
Stg_Component_Build( data->vc, 0, False );
/* Blank the memory to be applied to before the test */
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/tests/VariableAllVC_Suite.c
--- a/Base/Context/tests/VariableAllVC_Suite.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/tests/VariableAllVC_Suite.c Wed Dec 02 14:17:25 2009 +1100
@@ -88,18 +88,11 @@ 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);
- data->vc = (VariableCondition*) VariableAllVC_New( "variableAllVC", "VariableAllVC", data->vr, data->conFunc_Register,
- data->dict, NULL );
+ data->vc = (VariableCondition*) VariableAllVC_New( "variableAllVC", NULL, "VariableAllVC", data->vr, data->conFunc_Register, data->dict, NULL );
Stg_Component_Build( data->vc, 0, False );
}
diff -r 886f2b713d39 -r 9a070c9a4b8f Base/Context/tests/VariableDumpStreamSuite.c
--- a/Base/Context/tests/VariableDumpStreamSuite.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/tests/VariableDumpStreamSuite.c Wed Dec 02 14:17:25 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 886f2b713d39 -r 9a070c9a4b8f Base/Context/tests/VariableSuite.c
--- a/Base/Context/tests/VariableSuite.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/tests/VariableSuite.c Wed Dec 02 14:17:25 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 886f2b713d39 -r 9a070c9a4b8f Base/Context/tests/Variable_RegisterSuite.c
--- a/Base/Context/tests/Variable_RegisterSuite.c Tue Dec 01 11:35:46 2009 +1100
+++ b/Base/Context/tests/Variable_RegisterSuite.c Wed Dec 02 14:17:25 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