[cig-commits] commit: Rename .c -> .cxx and make configure automatically use c++

Mercurial hg at geodynamics.org
Thu May 12 11:23:04 PDT 2011


changeset:   799:f9c376288955
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Thu May 12 11:18:29 2011 -0700
files:       Base/Automation/src/CallGraph.c Base/Automation/src/CallGraph.cxx Base/Automation/src/Comm.c Base/Automation/src/Comm.cxx Base/Automation/src/Component.c Base/Automation/src/Component.cxx Base/Automation/src/DocumentationComponentFactory.c Base/Automation/src/DocumentationComponentFactory.cxx Base/Automation/src/Finalise.c Base/Automation/src/Finalise.cxx Base/Automation/src/HierarchyTable.c Base/Automation/src/HierarchyTable.cxx Base/Automation/src/Init.c Base/Automation/src/Init.cxx Base/Automation/src/LiveComponentRegister.c Base/Automation/src/LiveComponentRegister.cxx Base/Automation/src/Meta.c Base/Automation/src/Meta.cxx Base/Automation/src/Stg_Component.c Base/Automation/src/Stg_Component.cxx Base/Automation/src/Stg_ComponentFactory.c Base/Automation/src/Stg_ComponentFactory.cxx Base/Automation/src/Stg_ComponentRegister.c Base/Automation/src/Stg_ComponentRegister.cxx Base/Automation/tests/CallGraphSuite.c Base/Automation/tests/CallGraphSuite.cxx Base/Automation/tests/CommSuite.c Base/Automation/tests/CommSuite.cxx Base/Automation/tests/ComponentCopySuite.c Base/Automation/tests/ComponentCopySuite.cxx Base/Automation/tests/HierarchyTableSuite.c Base/Automation/tests/HierarchyTableSuite.cxx Base/Container/src/AbsArray.c Base/Container/src/AbsArray.cxx Base/Container/src/BTree.c Base/Container/src/BTree.cxx Base/Container/src/BTreeIterator.c Base/Container/src/BTreeIterator.cxx Base/Container/src/BTreeNode.c Base/Container/src/BTreeNode.cxx Base/Container/src/ChunkArray.c Base/Container/src/ChunkArray.cxx Base/Container/src/Finalise.c Base/Container/src/Finalise.cxx Base/Container/src/HashTable.c Base/Container/src/HashTable.cxx Base/Container/src/Heap.c Base/Container/src/Heap.cxx Base/Container/src/IArray.c Base/Container/src/IArray.cxx Base/Container/src/IMap.c Base/Container/src/IMap.cxx Base/Container/src/IMapIter.c Base/Container/src/IMapIter.cxx Base/Container/src/ISet.c Base/Container/src/ISet.cxx Base/Container/src/ISetIter.c Base/Container/src/ISetIter.cxx Base/Container/src/IndexMap.c Base/Container/src/IndexMap.cxx Base/Container/src/IndexSet.c Base/Container/src/IndexSet.cxx Base/Container/src/Init.c Base/Container/src/Init.cxx Base/Container/src/Iter.c Base/Container/src/Iter.cxx Base/Container/src/LinkedList.c Base/Container/src/LinkedList.cxx Base/Container/src/LinkedListIterator.c Base/Container/src/LinkedListIterator.cxx Base/Container/src/LinkedListNode.c Base/Container/src/LinkedListNode.cxx Base/Container/src/List.c Base/Container/src/List.cxx Base/Container/src/MPIRoutines.c Base/Container/src/MPIRoutines.cxx Base/Container/src/MaxHeap.c Base/Container/src/MaxHeap.cxx Base/Container/src/MemoryPool.c Base/Container/src/MemoryPool.cxx Base/Container/src/PtrMap.c Base/Container/src/PtrMap.cxx Base/Container/src/PtrSet.c Base/Container/src/PtrSet.cxx Base/Container/src/RangeSet.c Base/Container/src/RangeSet.cxx Base/Container/src/STree.c Base/Container/src/STree.cxx Base/Container/src/STreeMap.c Base/Container/src/STreeMap.cxx Base/Container/src/Set.c Base/Container/src/Set.cxx Base/Container/src/UIntMap.c Base/Container/src/UIntMap.cxx Base/Container/tests/BTreeSuite.c Base/Container/tests/BTreeSuite.cxx Base/Container/tests/HashTableSuite.c Base/Container/tests/HashTableSuite.cxx Base/Container/tests/IArraySuite.c Base/Container/tests/IArraySuite.cxx Base/Container/tests/IMapSuite.c Base/Container/tests/IMapSuite.cxx Base/Container/tests/ISetSuite.c Base/Container/tests/ISetSuite.cxx Base/Container/tests/IndexMapSuite.c Base/Container/tests/IndexMapSuite.cxx Base/Container/tests/IndexSetSuite.c Base/Container/tests/IndexSetSuite.cxx Base/Container/tests/LinkedListIteratorSuite.c Base/Container/tests/LinkedListIteratorSuite.cxx Base/Container/tests/LinkedListSuite.c Base/Container/tests/LinkedListSuite.cxx Base/Container/tests/ListSuite.c Base/Container/tests/ListSuite.cxx Base/Container/tests/MPIRoutinesSuite.c Base/Container/tests/MPIRoutinesSuite.cxx Base/Container/tests/MaxHeapSuite.c Base/Container/tests/MaxHeapSuite.cxx Base/Container/tests/MemoryPoolSuite.c Base/Container/tests/MemoryPoolSuite.cxx Base/Container/tests/PtrMapSuite.c Base/Container/tests/PtrMapSuite.cxx Base/Container/tests/PtrSetSuite.c Base/Container/tests/PtrSetSuite.cxx Base/Container/tests/RangeSetSuite.c Base/Container/tests/RangeSetSuite.cxx Base/Container/tests/STreeMapSuite.c Base/Container/tests/STreeMapSuite.cxx Base/Container/tests/STreeSuite.c Base/Container/tests/STreeSuite.cxx Base/Container/tests/SetSuite.c Base/Container/tests/SetSuite.cxx Base/Container/tests/UIntMapSuite.c Base/Container/tests/UIntMapSuite.cxx Base/Context/src/AbstractContext.c Base/Context/src/AbstractContext.cxx Base/Context/src/Codelet.c Base/Context/src/Codelet.cxx Base/Context/src/CompositeVC.c Base/Context/src/CompositeVC.cxx Base/Context/src/ConditionFunction.c Base/Context/src/ConditionFunction.cxx Base/Context/src/ConditionFunction_Register.c Base/Context/src/ConditionFunction_Register.cxx Base/Context/src/ContextEntryPoint.c Base/Context/src/ContextEntryPoint.cxx Base/Context/src/DictionaryCheck.c Base/Context/src/DictionaryCheck.cxx Base/Context/src/DynamicVC.c Base/Context/src/DynamicVC.cxx Base/Context/src/Finalise.c Base/Context/src/Finalise.cxx Base/Context/src/Init.c Base/Context/src/Init.cxx Base/Context/src/SetVC.c Base/Context/src/SetVC.cxx Base/Context/src/Variable.c Base/Context/src/Variable.cxx Base/Context/src/VariableAllVC.c Base/Context/src/VariableAllVC.cxx Base/Context/src/VariableCondition.c Base/Context/src/VariableCondition.cxx Base/Context/src/VariableCondition_Register.c Base/Context/src/VariableCondition_Register.cxx Base/Context/src/VariableDumpStream.c Base/Context/src/VariableDumpStream.cxx Base/Context/src/Variable_Register.c Base/Context/src/Variable_Register.cxx Base/Context/tests/AbstractContextSuite.c Base/Context/tests/AbstractContextSuite.cxx Base/Context/tests/ConditionFunctionSuite.c Base/Context/tests/ConditionFunctionSuite.cxx Base/Context/tests/DictionaryCheckSuite.c Base/Context/tests/DictionaryCheckSuite.cxx Base/Context/tests/LiveComponentRegisterSuite.c Base/Context/tests/LiveComponentRegisterSuite.cxx Base/Context/tests/SetVC_Suite.c Base/Context/tests/SetVC_Suite.cxx Base/Context/tests/Stg_MetaSuite.c Base/Context/tests/Stg_MetaSuite.cxx Base/Context/tests/VariableAllVC_Suite.c Base/Context/tests/VariableAllVC_Suite.cxx Base/Context/tests/VariableDumpStreamSuite.c Base/Context/tests/VariableDumpStreamSuite.cxx Base/Context/tests/VariableSuite.c Base/Context/tests/VariableSuite.cxx Base/Context/tests/Variable_RegisterSuite.c Base/Context/tests/Variable_RegisterSuite.cxx Base/Extensibility/distributedtests/MockContext.c Base/Extensibility/distributedtests/MockContext.cxx Base/Extensibility/distributedtests/testDistributedPlugin.c Base/Extensibility/distributedtests/testDistributedPlugin.cxx Base/Extensibility/distributedtests/testPlugin.c Base/Extensibility/distributedtests/testPlugin.cxx Base/Extensibility/distributedtests/testplugins/LocalPlugin/LocalPlugin.c Base/Extensibility/distributedtests/testplugins/LocalPlugin/LocalPlugin.cxx Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin1.c Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin1.cxx Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin2.c Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin2.cxx Base/Extensibility/distributedtests/testplugins/RemotePlugin1.c Base/Extensibility/distributedtests/testplugins/RemotePlugin1.cxx Base/Extensibility/src/ClassHook.c Base/Extensibility/src/ClassHook.cxx Base/Extensibility/src/ClassPtrExtensionInfo.c Base/Extensibility/src/ClassPtrExtensionInfo.cxx Base/Extensibility/src/EntryPoint.c Base/Extensibility/src/EntryPoint.cxx Base/Extensibility/src/EntryPoint_Register.c Base/Extensibility/src/EntryPoint_Register.cxx Base/Extensibility/src/ExtensionInfo.c Base/Extensibility/src/ExtensionInfo.cxx Base/Extensibility/src/ExtensionManager.c Base/Extensibility/src/ExtensionManager.cxx Base/Extensibility/src/ExtensionManager_Register.c Base/Extensibility/src/ExtensionManager_Register.cxx Base/Extensibility/src/Finalise.c Base/Extensibility/src/Finalise.cxx Base/Extensibility/src/Hook.c Base/Extensibility/src/Hook.cxx Base/Extensibility/src/Init.c Base/Extensibility/src/Init.cxx Base/Extensibility/src/Module.c Base/Extensibility/src/Module.cxx Base/Extensibility/src/ModulesManager.c Base/Extensibility/src/ModulesManager.cxx Base/Extensibility/src/Plugin.c Base/Extensibility/src/Plugin.cxx Base/Extensibility/src/PluginsManager.c Base/Extensibility/src/PluginsManager.cxx Base/Extensibility/src/SimpleExtensionInfo.c Base/Extensibility/src/SimpleExtensionInfo.cxx Base/Extensibility/src/Toolbox.c Base/Extensibility/src/Toolbox.cxx Base/Extensibility/src/ToolboxesManager.c Base/Extensibility/src/ToolboxesManager.cxx Base/Extensibility/tests/EntryPointSuite.c Base/Extensibility/tests/EntryPointSuite.cxx Base/Extensibility/tests/ExtensionSuite.c Base/Extensibility/tests/ExtensionSuite.cxx Base/FlattenXML/src/main.c Base/FlattenXML/src/main.cxx Base/Foundation/src/Class.c Base/Foundation/src/Class.cxx Base/Foundation/src/CommonRoutines.c Base/Foundation/src/CommonRoutines.cxx Base/Foundation/src/Finalise.c Base/Foundation/src/Finalise.cxx Base/Foundation/src/Init.c Base/Foundation/src/Init.cxx Base/Foundation/src/Log.c Base/Foundation/src/Log.cxx Base/Foundation/src/MemMonitor.c Base/Foundation/src/MemMonitor.cxx Base/Foundation/src/Memory.c Base/Foundation/src/Memory.cxx Base/Foundation/src/MemoryField.c Base/Foundation/src/MemoryField.cxx Base/Foundation/src/MemoryPointer.c Base/Foundation/src/MemoryPointer.cxx Base/Foundation/src/MemoryReport.c Base/Foundation/src/MemoryReport.cxx Base/Foundation/src/NamedObject_Register.c Base/Foundation/src/NamedObject_Register.cxx Base/Foundation/src/NewClass.c Base/Foundation/src/NewClass.cxx Base/Foundation/src/NewObject.c Base/Foundation/src/NewObject.cxx Base/Foundation/src/Numerics.c Base/Foundation/src/Numerics.cxx Base/Foundation/src/Object.c Base/Foundation/src/Object.cxx Base/Foundation/src/ObjectAdaptor.c Base/Foundation/src/ObjectAdaptor.cxx Base/Foundation/src/ObjectList.c Base/Foundation/src/ObjectList.cxx Base/Foundation/src/PrimitiveObject.c Base/Foundation/src/PrimitiveObject.cxx Base/Foundation/src/TestSuite.c Base/Foundation/src/TestSuite.cxx Base/Foundation/src/TimeMonitor.c Base/Foundation/src/TimeMonitor.cxx Base/Foundation/src/debug.c Base/Foundation/src/debug.cxx Base/Foundation/tests/CommonRoutinesSuite.c Base/Foundation/tests/CommonRoutinesSuite.cxx Base/Foundation/tests/MemMonitorSuite.c Base/Foundation/tests/MemMonitorSuite.cxx Base/Foundation/tests/MemoryReportSuite.c Base/Foundation/tests/MemoryReportSuite.cxx Base/Foundation/tests/MemorySuite.c Base/Foundation/tests/MemorySuite.cxx Base/Foundation/tests/NamedObject_Register2Suite.c Base/Foundation/tests/NamedObject_Register2Suite.cxx Base/Foundation/tests/NamedObject_RegisterSuite.c Base/Foundation/tests/NamedObject_RegisterSuite.cxx Base/Foundation/tests/ObjectListSuite.c Base/Foundation/tests/ObjectListSuite.cxx Base/Foundation/tests/PrimitiveObjectSuite.c Base/Foundation/tests/PrimitiveObjectSuite.cxx Base/Foundation/tests/Stg_asprintfSuite.c Base/Foundation/tests/Stg_asprintfSuite.cxx Base/Foundation/tests/TimeMonitorSuite.c Base/Foundation/tests/TimeMonitorSuite.cxx Base/IO/src/BinaryStream.c Base/IO/src/BinaryStream.cxx Base/IO/src/CFile.c Base/IO/src/CFile.cxx Base/IO/src/CStream.c Base/IO/src/CStream.cxx Base/IO/src/CmdLineArgs.c Base/IO/src/CmdLineArgs.cxx Base/IO/src/Dictionary.c Base/IO/src/Dictionary.cxx Base/IO/src/Dictionary_Entry.c Base/IO/src/Dictionary_Entry.cxx Base/IO/src/Dictionary_Entry_Value.c Base/IO/src/Dictionary_Entry_Value.cxx Base/IO/src/Finalise.c Base/IO/src/Finalise.cxx Base/IO/src/IO_Handler.c Base/IO/src/IO_Handler.cxx Base/IO/src/IndentFormatter.c Base/IO/src/IndentFormatter.cxx Base/IO/src/Init.c Base/IO/src/Init.cxx Base/IO/src/Journal.c Base/IO/src/Journal.cxx Base/IO/src/JournalFile.c Base/IO/src/JournalFile.cxx Base/IO/src/LineFormatter.c Base/IO/src/LineFormatter.cxx Base/IO/src/MPIFile.c Base/IO/src/MPIFile.cxx Base/IO/src/MPIStream.c Base/IO/src/MPIStream.cxx Base/IO/src/PathUtils.c Base/IO/src/PathUtils.cxx Base/IO/src/RankFormatter.c Base/IO/src/RankFormatter.cxx Base/IO/src/Stream.c Base/IO/src/Stream.cxx Base/IO/src/StreamFormatter.c Base/IO/src/StreamFormatter.cxx Base/IO/src/XML_IO_Handler.c Base/IO/src/XML_IO_Handler.cxx Base/IO/src/shortcuts.c Base/IO/src/shortcuts.cxx Base/IO/src/stgmessaging.c Base/IO/src/stgmessaging.cxx Base/IO/tests/DictionarySuite.c Base/IO/tests/DictionarySuite.cxx Base/IO/tests/IO_HandlerSuite.c Base/IO/tests/IO_HandlerSuite.cxx Base/IO/tests/JournalSuite.c Base/IO/tests/JournalSuite.cxx Base/IO/tests/MPIStreamSuite.c Base/IO/tests/MPIStreamSuite.cxx Base/IO/tests/PathUtilsSuite.c Base/IO/tests/PathUtilsSuite.cxx Base/IO/tests/RankFormatterSuite.c Base/IO/tests/RankFormatterSuite.cxx Base/ListPlugins/src/main.c Base/ListPlugins/src/main.cxx Base/Python/Bindings/Context/bindings.c Base/Python/Bindings/Context/bindings.cxx Base/Python/Bindings/Context/init.c Base/Python/Bindings/Context/init.cxx Base/Python/Bindings/Context/misc.c Base/Python/Bindings/Context/misc.cxx Base/Python/Bindings/Dictionary/bindings.c Base/Python/Bindings/Dictionary/bindings.cxx Base/Python/Bindings/Dictionary/init.c Base/Python/Bindings/Dictionary/init.cxx Base/Python/Bindings/Dictionary/misc.c Base/Python/Bindings/Dictionary/misc.cxx Base/src/Finalise.c Base/src/Finalise.cxx Base/src/Init.c Base/src/Init.cxx Base/tests/testLibBase.c Base/tests/testLibBase.cxx Regresstor/ClientPrograms/checkDiff/main.c Regresstor/ClientPrograms/checkDiff/main.cxx Regresstor/ClientPrograms/checkExecution/main.c Regresstor/ClientPrograms/checkExecution/main.cxx Regresstor/ClientPrograms/endRun/main.c Regresstor/ClientPrograms/endRun/main.cxx Regresstor/ClientPrograms/startRun/main.c Regresstor/ClientPrograms/startRun/main.cxx Regresstor/ClientPrograms/submitBuild/main.c Regresstor/ClientPrograms/submitBuild/main.cxx Regresstor/libRegresstor/src/FailedSubTest.c Regresstor/libRegresstor/src/FailedSubTest.cxx Regresstor/libRegresstor/src/RegressionTest.c Regresstor/libRegresstor/src/RegressionTest.cxx Regresstor/libRegresstor/src/UnitTest.c Regresstor/libRegresstor/src/UnitTest.cxx SConscript StgSCons Utils/src/Progress.c Utils/src/Progress.cxx Utils/tests/ProgressSuite.c Utils/tests/ProgressSuite.cxx compatibility/mpipython/main.c compatibility/mpipython/main.cxx libStGermain/Python/Bindings/General/bindings.c libStGermain/Python/Bindings/General/bindings.cxx libStGermain/Python/Bindings/General/init.c libStGermain/Python/Bindings/General/init.cxx libStGermain/Python/Bindings/General/misc.c libStGermain/Python/Bindings/General/misc.cxx libStGermain/Python/Bindings/MPI/bindings.c libStGermain/Python/Bindings/MPI/bindings.cxx libStGermain/Python/Bindings/MPI/init.c libStGermain/Python/Bindings/MPI/init.cxx libStGermain/Python/Bindings/MPI/misc.c libStGermain/Python/Bindings/MPI/misc.cxx libStGermain/dynamic/dummy.c libStGermain/dynamic/dummy.cxx libStGermain/src/Finalise.c libStGermain/src/Finalise.cxx libStGermain/src/Init.c libStGermain/src/Init.cxx libStGermain/src/main.c libStGermain/src/main.cxx libStGermain/src/stg_static_modules.c.tmpl libStGermain/src/stg_static_modules.cxx.tmpl libStGermain/static/dummy.c libStGermain/static/dummy.cxx libStGermain/tests/LibStGermainSuite.c libStGermain/tests/LibStGermainSuite.cxx pcu/SConscript pcu/script/pcutest.py pcu/src/checks.c pcu/src/checks.cxx pcu/src/filename.c pcu/src/filename.cxx pcu/src/pcuassert.c pcu/src/pcuassert.cxx pcu/src/runner.c pcu/src/runner.cxx pcu/src/source.c pcu/src/source.cxx pcu/src/suite.c pcu/src/suite.cxx pcu/src/test.c pcu/src/test.cxx pcu/src/textoutput.c pcu/src/textoutput.cxx pcu/src/utils.c pcu/src/utils.cxx script/createDoxygen.py script/scons.py script/stg.py src/SConscript src/main.c src/main.cxx
description:
Rename .c -> .cxx and make configure automatically use c++


diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/CallGraph.c
--- a/Base/Automation/src/CallGraph.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,355 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Stg_Component.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "CallGraph.h"
-
-#include <string.h>
-
-
-/* Textual name of this class */
-const Type Stg_CallGraph_Type = "Stg_CallGraph";
-
-static const Type _Stg_CallGraph_Stack_Type = "_Stg_CallGraph_Stack";
-static const Type _Stg_CallGraph_Entry_Type = "_Stg_CallGraph_Entry";
-static const Index _Stg_CallGraph_Table_Delta = 256; /* TODO: ascertain whether this is a good for an initial & delta size */
-
-/* Call graph singleton. The code in this file (this class) shouldn't use this global variable. It is a global variable ONLY
-    because adding it to the context and making the appropriate changes to EntryPoints and Components (and where ever else
-    push and pop may end up, is a big deal. */
-Stg_CallGraph* stgCallGraph = 0;
-
-
-Stg_CallGraph* Stg_CallGraph_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(Stg_CallGraph);
-	Type                              type = Stg_CallGraph_Type;
-	Stg_Class_DeleteFunction*      _delete = _Stg_CallGraph_Delete;
-	Stg_Class_PrintFunction*        _print = _Stg_CallGraph_Print;
-	Stg_Class_CopyFunction*          _copy = _Stg_CallGraph_Copy;
-
-	return _Stg_CallGraph_New(  STG_CALLGRAPH_PASSARGS  );
-}
-
-void Stg_CallGraph_Init( void* callGraph ) {
-	Stg_CallGraph* self = (Stg_CallGraph*)callGraph;
-	
-	/* General info */
-	self->type = Stg_CallGraph_Type;
-	self->_sizeOfSelf = sizeof(Stg_CallGraph);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _Stg_CallGraph_Delete;
-	self->_print = _Stg_CallGraph_Print;
-	self->_copy = _Stg_CallGraph_Copy;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* Stg_CallGraph info */
-	_Stg_CallGraph_Init( self );
-};
-
-Stg_CallGraph* _Stg_CallGraph_New(  STG_CALLGRAPH_DEFARGS  )
-{
-	Stg_CallGraph* self;
-	
-	/* Allocate memory */
-	Journal_Firewall( 
-		_sizeOfSelf >= sizeof(Stg_CallGraph), 
-		Journal_Register( Error_Type, Stg_CallGraph_Type ), 
-		"Attempting to construct an object that is smaller than this class" );
-	self = (Stg_CallGraph*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	
-	/* Stg_CallGraph info */
-	_Stg_CallGraph_Init( self );
-	
-	return self;
-}
-
-
-void _Stg_CallGraph_Init( Stg_CallGraph* self ) {
-	/* General and Virtual info should already be set */
-	
-	/* Stg_CallGraph info */
-	self->_stack = 0;
-	self->_tableSize = _Stg_CallGraph_Table_Delta; 
-	self->_tableCount = 0;
-	self->table = Memory_Alloc_Array( _Stg_CallGraph_Entry, self->_tableSize, _Stg_CallGraph_Entry_Type );
-}
-
-
-static void _Stg_CallGraph_Delete_Stack( _Stg_CallGraph_Stack* stack ) {
-	if( stack ) {
-		_Stg_CallGraph_Delete_Stack( stack->pop );
-		Memory_Free( stack );
-	}
-}
-
-void _Stg_CallGraph_Delete( void* callGraph ) {
-	Stg_CallGraph* self = (Stg_CallGraph*)callGraph;
-	
-	/* Stg_CallGraph info */
-	_Stg_CallGraph_Delete_Stack( self->_stack );
-	if( self->table ) {
-		Memory_Free( self->table );
-	}
-	self->_tableCount = self->_tableSize = 0;
-	
-	/* Delete parent class */
-	_Stg_Class_Delete( self );
-}
-
-
-static void _Stg_CallGraph_Print_Stack( _Stg_CallGraph_Stack* stack, Stream* stream ) {
-	if( stack ) {
-		Journal_Printf( (void*) stream, "\t\tfunction pointer (ptr): %p\n", stack->functionPtr );
-		Journal_Printf( (void*) stream, "\t\tfunction name: \"%s\"\n", stack->name );
-		Journal_Printf( (void*) stream, "\t\tfunction started timestamp: %g\n", stack->time );
-		Journal_Printf( (void*) stream, "\t\tfunction memory stamp at start: %u\n", stack->memory );
-		Journal_Printf( (void*) stream, "\t\tfunction table entry: %u\n", stack->entry_I );
-		_Stg_CallGraph_Print_Stack( stack->pop, stream );
-	}
-}
-
-void _Stg_CallGraph_Print( void* callGraph, Stream* stream ) {
-	Stg_CallGraph*	self = (Stg_CallGraph*)callGraph;
-	Index		i;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Stg_CallGraph (ptr): %p\n", self );
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-	
-	/* Virtual info */
-	
-	/* Stg_CallGraph */
-	Journal_Printf( (void*) stream, "\t_stack (ptr): %p\n", self->_stack );
-	_Stg_CallGraph_Print_Stack( self->_stack, stream );
-	
-	Journal_Printf( (void*) stream, "\t_tableSize: %u\n", self->_tableSize );
-	Journal_Printf( (void*) stream, "\t_tableCount: %u\n", self->_tableCount );
-	Journal_Printf( (void*) stream, "\ttable (ptr): %p\n", self->table );
-	for( i = 0; i < self->_tableCount; i++ ) {
-		Journal_Printf( (void*) stream, 
-			"\t\tfunction (ptr): %p, parent (ptr): %p, name: \"%s\", parent name: \"%s\", time: %g, memory: %u, called: %u, returned: %u\n",
-			self->table[i].functionPtr, 
-			self->table[i].parentPtr, 
-			self->table[i].name,
-			self->table[i].parentName,
-			self->table[i].time, 
-			self->table[i].memory,
-			self->table[i].called,
-			self->table[i].returned );
-	}
-}
-
-
-static void _Stg_CallGraph_Copy_Table( _Stg_CallGraph_Entry* dst, _Stg_CallGraph_Entry* src, Index size, Index count ) {
-	memcpy( dst, src, sizeof(_Stg_CallGraph_Entry) * count );
-}
-
-static void _Stg_CallGraph_Copy_Stack_Deep( _Stg_CallGraph_Stack** dst, _Stg_CallGraph_Stack* src, PtrMap* map ) {
-	if( dst && !src ) {
-		*dst = src;
-	}
-	else if( dst && (*dst = (_Stg_CallGraph_Stack*)PtrMap_Find( map, src )) == NULL ) {
-		*dst = Memory_Alloc( _Stg_CallGraph_Stack, "Stg_CallGraph->_stack" );
-		(*dst)->functionPtr = src->functionPtr;
-		(*dst)->name = src->name;
-		(*dst)->time = src->time;
-		(*dst)->memory = src->memory;
-		(*dst)->entry_I = src->entry_I;
-		(*dst)->pop = 0;
-		_Stg_CallGraph_Copy_Stack_Deep( &((*dst)->pop), src->pop, map );
-		PtrMap_Append( map, *dst, src );
-	}
-	
-}
-
-static void _Stg_CallGraph_Copy_Stack_ShallowIncr( _Stg_CallGraph_Stack* stack ) {
-	_Stg_CallGraph_Copy_Stack_ShallowIncr( stack->pop );
-	Memory_CountInc( stack );
-}
-
-static void _Stg_CallGraph_Copy_Stack_Shallow( _Stg_CallGraph_Stack** dst, _Stg_CallGraph_Stack* src ) {
-	*dst = src;
-	_Stg_CallGraph_Copy_Stack_ShallowIncr( *dst );
-}
-
-void* _Stg_CallGraph_Copy( const void* callGraph, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_CallGraph*	self = (Stg_CallGraph*)callGraph;
-	Stg_CallGraph*	newCallGraph;
-	PtrMap*		map = ptrMap;
-	Bool		ownMap= False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newCallGraph = (Stg_CallGraph*)_Stg_Class_Copy( callGraph, dest, deep, nameExt, ptrMap );
-	
-	/* Virtual methods */
-	newCallGraph->_tableSize = self->_tableSize;
-	newCallGraph->_tableCount = self->_tableCount;
-
-	if( deep ) {
-          if( self->table && (newCallGraph->table = (_Stg_CallGraph_Entry*)PtrMap_Find( map, self->table )) == NULL ) {
-			newCallGraph->table = Memory_Alloc_Array( _Stg_CallGraph_Entry, newCallGraph->_tableSize, 
-				"Stg_CallGraph->table" );
-			_Stg_CallGraph_Copy_Table( newCallGraph->table, self->table, newCallGraph->_tableSize, 
-				newCallGraph->_tableCount );
-			PtrMap_Append( map, newCallGraph->table, self->table );
-		}
-		
-		_Stg_CallGraph_Copy_Stack_Deep( &newCallGraph->_stack, self->_stack, map );
-	}
-	else {
-		newCallGraph->table = self->table;
-		Memory_CountInc( newCallGraph->table );
-		_Stg_CallGraph_Copy_Stack_Shallow( &newCallGraph->_stack, self->_stack );
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-
-	return newCallGraph;
-}
-
-
-
-void Stg_CallGraph_Push( void* callGraph, void* functionPtr, Type name ) {
-	Stg_CallGraph*		self = (Stg_CallGraph*)callGraph;
-	_Stg_CallGraph_Stack*	newStack;
-	Bool			found;
-	void*			parentPtr;
-	Type			parentName;
-	
-	/* Push onto the stack */
-	parentPtr = self->_stack ? self->_stack->functionPtr : 0;
-	parentName = self->_stack ? self->_stack->name : 0;
-	newStack = Memory_Alloc( _Stg_CallGraph_Stack, _Stg_CallGraph_Stack_Type );
-	newStack->functionPtr = functionPtr;
-	newStack->name = name;
-	newStack->time = 0.0f; /* TODO: Actual time stamp */
-	newStack->memory = 0; /* TODO: Actual memory stamp */
-	newStack->pop = self->_stack;
-	self->_stack = newStack;
-	
-	/* Search for the function in the table */
-	found = False;
-	for( newStack->entry_I = 0; newStack->entry_I < self->_tableCount; newStack->entry_I++ ) {
-		/* Each function/parent-pointer - function/parent name, is treated as a distinct call graph entry. This way, if a
-		    function is called by more than one distinct function, we have that information (the user can combine this
-		    info if they see fit. And in the case of entry points, the same function pointer is used for all entry points,
-		    as the name is the distinquisher */
-		if( 
-			self->table[newStack->entry_I].functionPtr == functionPtr &&
-			self->table[newStack->entry_I].parentPtr == parentPtr &&
-			self->table[newStack->entry_I].name == name && 
-			self->table[newStack->entry_I].parentName == parentName ) 
-		{
-			found = True;
-			break;
-		}
-	}
-	
-	if( found ) {
-		self->table[newStack->entry_I].called += 1;
-	}
-	/* else, add to the table */
-	else {
-		/* We may need to allocate some more memory */
-		if( self->_tableCount >= self->_tableSize ) {
-			_Stg_CallGraph_Entry* newTable;
-			SizeT newSize;
-			
-			Journal_Firewall( 
-				self->_tableCount == self->_tableSize, 
-				Journal_Register( Error_Type, Stg_CallGraph_Type ), 
-				"Somehow the table entry counter is greater than the memory allocation" );
-
-			
-			newSize = self->_tableSize + _Stg_CallGraph_Table_Delta;
-			newTable = Memory_Alloc_Array( _Stg_CallGraph_Entry, newSize, _Stg_CallGraph_Entry_Type );
-			/* safe to do, we want to copy ptr values */
-			memcpy( newTable, self->table, self->_tableSize * sizeof(_Stg_CallGraph_Entry) ); 
-			Memory_Free( self->table );
-			self->table = newTable;
-			self->_tableSize = newSize;
-		}
-		
-		newStack->entry_I = self->_tableCount;
-		self->_tableCount += 1;
-		
-		self->table[newStack->entry_I].functionPtr = functionPtr;
-		self->table[newStack->entry_I].name = name;
-		self->table[newStack->entry_I].parentPtr = parentPtr;
-		self->table[newStack->entry_I].parentName = parentName;
-		self->table[newStack->entry_I].time = 0.0f;
-		self->table[newStack->entry_I].memory = 0;
-		self->table[newStack->entry_I].called = 1;
-		self->table[newStack->entry_I].returned = 0;
-	}
-}
-
-void Stg_CallGraph_Pop( void* callGraph ) {
-	Stg_CallGraph*		self = (Stg_CallGraph*)callGraph;
-	_Stg_CallGraph_Stack*	oldStack;
-	
-	Journal_Firewall( 
-		self->_stack != 0, 
-		Journal_Register( Error_Type, Stg_CallGraph_Type ), 
-		"Attempting to pop and empty stack" );
-	
-	/* Record the accumulative delta time & memory */
-	self->table[self->_stack->entry_I].time += 0 /* TODO: Actual time stamp */ - self->_stack->time;
-	self->table[self->_stack->entry_I].memory += 0 /* TODO: Actual memory stamp */ - self->_stack->memory;
-	self->table[self->_stack->entry_I].returned += 1;
-	
-	/* Pop the stack */
-	oldStack = self->_stack;
-	self->_stack = oldStack->pop;
-	Memory_Free( oldStack );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/CallGraph.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/CallGraph.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,355 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Stg_Component.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "CallGraph.h"
+
+#include <string.h>
+
+
+/* Textual name of this class */
+const Type Stg_CallGraph_Type = "Stg_CallGraph";
+
+static const Type _Stg_CallGraph_Stack_Type = "_Stg_CallGraph_Stack";
+static const Type _Stg_CallGraph_Entry_Type = "_Stg_CallGraph_Entry";
+static const Index _Stg_CallGraph_Table_Delta = 256; /* TODO: ascertain whether this is a good for an initial & delta size */
+
+/* Call graph singleton. The code in this file (this class) shouldn't use this global variable. It is a global variable ONLY
+    because adding it to the context and making the appropriate changes to EntryPoints and Components (and where ever else
+    push and pop may end up, is a big deal. */
+Stg_CallGraph* stgCallGraph = 0;
+
+
+Stg_CallGraph* Stg_CallGraph_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(Stg_CallGraph);
+	Type                              type = Stg_CallGraph_Type;
+	Stg_Class_DeleteFunction*      _delete = _Stg_CallGraph_Delete;
+	Stg_Class_PrintFunction*        _print = _Stg_CallGraph_Print;
+	Stg_Class_CopyFunction*          _copy = _Stg_CallGraph_Copy;
+
+	return _Stg_CallGraph_New(  STG_CALLGRAPH_PASSARGS  );
+}
+
+void Stg_CallGraph_Init( void* callGraph ) {
+	Stg_CallGraph* self = (Stg_CallGraph*)callGraph;
+	
+	/* General info */
+	self->type = Stg_CallGraph_Type;
+	self->_sizeOfSelf = sizeof(Stg_CallGraph);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _Stg_CallGraph_Delete;
+	self->_print = _Stg_CallGraph_Print;
+	self->_copy = _Stg_CallGraph_Copy;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* Stg_CallGraph info */
+	_Stg_CallGraph_Init( self );
+};
+
+Stg_CallGraph* _Stg_CallGraph_New(  STG_CALLGRAPH_DEFARGS  )
+{
+	Stg_CallGraph* self;
+	
+	/* Allocate memory */
+	Journal_Firewall( 
+		_sizeOfSelf >= sizeof(Stg_CallGraph), 
+		Journal_Register( Error_Type, Stg_CallGraph_Type ), 
+		"Attempting to construct an object that is smaller than this class" );
+	self = (Stg_CallGraph*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	
+	/* Stg_CallGraph info */
+	_Stg_CallGraph_Init( self );
+	
+	return self;
+}
+
+
+void _Stg_CallGraph_Init( Stg_CallGraph* self ) {
+	/* General and Virtual info should already be set */
+	
+	/* Stg_CallGraph info */
+	self->_stack = 0;
+	self->_tableSize = _Stg_CallGraph_Table_Delta; 
+	self->_tableCount = 0;
+	self->table = Memory_Alloc_Array( _Stg_CallGraph_Entry, self->_tableSize, _Stg_CallGraph_Entry_Type );
+}
+
+
+static void _Stg_CallGraph_Delete_Stack( _Stg_CallGraph_Stack* stack ) {
+	if( stack ) {
+		_Stg_CallGraph_Delete_Stack( stack->pop );
+		Memory_Free( stack );
+	}
+}
+
+void _Stg_CallGraph_Delete( void* callGraph ) {
+	Stg_CallGraph* self = (Stg_CallGraph*)callGraph;
+	
+	/* Stg_CallGraph info */
+	_Stg_CallGraph_Delete_Stack( self->_stack );
+	if( self->table ) {
+		Memory_Free( self->table );
+	}
+	self->_tableCount = self->_tableSize = 0;
+	
+	/* Delete parent class */
+	_Stg_Class_Delete( self );
+}
+
+
+static void _Stg_CallGraph_Print_Stack( _Stg_CallGraph_Stack* stack, Stream* stream ) {
+	if( stack ) {
+		Journal_Printf( (void*) stream, "\t\tfunction pointer (ptr): %p\n", stack->functionPtr );
+		Journal_Printf( (void*) stream, "\t\tfunction name: \"%s\"\n", stack->name );
+		Journal_Printf( (void*) stream, "\t\tfunction started timestamp: %g\n", stack->time );
+		Journal_Printf( (void*) stream, "\t\tfunction memory stamp at start: %u\n", stack->memory );
+		Journal_Printf( (void*) stream, "\t\tfunction table entry: %u\n", stack->entry_I );
+		_Stg_CallGraph_Print_Stack( stack->pop, stream );
+	}
+}
+
+void _Stg_CallGraph_Print( void* callGraph, Stream* stream ) {
+	Stg_CallGraph*	self = (Stg_CallGraph*)callGraph;
+	Index		i;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Stg_CallGraph (ptr): %p\n", self );
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+	
+	/* Virtual info */
+	
+	/* Stg_CallGraph */
+	Journal_Printf( (void*) stream, "\t_stack (ptr): %p\n", self->_stack );
+	_Stg_CallGraph_Print_Stack( self->_stack, stream );
+	
+	Journal_Printf( (void*) stream, "\t_tableSize: %u\n", self->_tableSize );
+	Journal_Printf( (void*) stream, "\t_tableCount: %u\n", self->_tableCount );
+	Journal_Printf( (void*) stream, "\ttable (ptr): %p\n", self->table );
+	for( i = 0; i < self->_tableCount; i++ ) {
+		Journal_Printf( (void*) stream, 
+			"\t\tfunction (ptr): %p, parent (ptr): %p, name: \"%s\", parent name: \"%s\", time: %g, memory: %u, called: %u, returned: %u\n",
+			self->table[i].functionPtr, 
+			self->table[i].parentPtr, 
+			self->table[i].name,
+			self->table[i].parentName,
+			self->table[i].time, 
+			self->table[i].memory,
+			self->table[i].called,
+			self->table[i].returned );
+	}
+}
+
+
+static void _Stg_CallGraph_Copy_Table( _Stg_CallGraph_Entry* dst, _Stg_CallGraph_Entry* src, Index size, Index count ) {
+	memcpy( dst, src, sizeof(_Stg_CallGraph_Entry) * count );
+}
+
+static void _Stg_CallGraph_Copy_Stack_Deep( _Stg_CallGraph_Stack** dst, _Stg_CallGraph_Stack* src, PtrMap* map ) {
+	if( dst && !src ) {
+		*dst = src;
+	}
+	else if( dst && (*dst = (_Stg_CallGraph_Stack*)PtrMap_Find( map, src )) == NULL ) {
+		*dst = Memory_Alloc( _Stg_CallGraph_Stack, "Stg_CallGraph->_stack" );
+		(*dst)->functionPtr = src->functionPtr;
+		(*dst)->name = src->name;
+		(*dst)->time = src->time;
+		(*dst)->memory = src->memory;
+		(*dst)->entry_I = src->entry_I;
+		(*dst)->pop = 0;
+		_Stg_CallGraph_Copy_Stack_Deep( &((*dst)->pop), src->pop, map );
+		PtrMap_Append( map, *dst, src );
+	}
+	
+}
+
+static void _Stg_CallGraph_Copy_Stack_ShallowIncr( _Stg_CallGraph_Stack* stack ) {
+	_Stg_CallGraph_Copy_Stack_ShallowIncr( stack->pop );
+	Memory_CountInc( stack );
+}
+
+static void _Stg_CallGraph_Copy_Stack_Shallow( _Stg_CallGraph_Stack** dst, _Stg_CallGraph_Stack* src ) {
+	*dst = src;
+	_Stg_CallGraph_Copy_Stack_ShallowIncr( *dst );
+}
+
+void* _Stg_CallGraph_Copy( const void* callGraph, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_CallGraph*	self = (Stg_CallGraph*)callGraph;
+	Stg_CallGraph*	newCallGraph;
+	PtrMap*		map = ptrMap;
+	Bool		ownMap= False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newCallGraph = (Stg_CallGraph*)_Stg_Class_Copy( callGraph, dest, deep, nameExt, ptrMap );
+	
+	/* Virtual methods */
+	newCallGraph->_tableSize = self->_tableSize;
+	newCallGraph->_tableCount = self->_tableCount;
+
+	if( deep ) {
+          if( self->table && (newCallGraph->table = (_Stg_CallGraph_Entry*)PtrMap_Find( map, self->table )) == NULL ) {
+			newCallGraph->table = Memory_Alloc_Array( _Stg_CallGraph_Entry, newCallGraph->_tableSize, 
+				"Stg_CallGraph->table" );
+			_Stg_CallGraph_Copy_Table( newCallGraph->table, self->table, newCallGraph->_tableSize, 
+				newCallGraph->_tableCount );
+			PtrMap_Append( map, newCallGraph->table, self->table );
+		}
+		
+		_Stg_CallGraph_Copy_Stack_Deep( &newCallGraph->_stack, self->_stack, map );
+	}
+	else {
+		newCallGraph->table = self->table;
+		Memory_CountInc( newCallGraph->table );
+		_Stg_CallGraph_Copy_Stack_Shallow( &newCallGraph->_stack, self->_stack );
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+
+	return newCallGraph;
+}
+
+
+
+void Stg_CallGraph_Push( void* callGraph, void* functionPtr, Type name ) {
+	Stg_CallGraph*		self = (Stg_CallGraph*)callGraph;
+	_Stg_CallGraph_Stack*	newStack;
+	Bool			found;
+	void*			parentPtr;
+	Type			parentName;
+	
+	/* Push onto the stack */
+	parentPtr = self->_stack ? self->_stack->functionPtr : 0;
+	parentName = self->_stack ? self->_stack->name : 0;
+	newStack = Memory_Alloc( _Stg_CallGraph_Stack, _Stg_CallGraph_Stack_Type );
+	newStack->functionPtr = functionPtr;
+	newStack->name = name;
+	newStack->time = 0.0f; /* TODO: Actual time stamp */
+	newStack->memory = 0; /* TODO: Actual memory stamp */
+	newStack->pop = self->_stack;
+	self->_stack = newStack;
+	
+	/* Search for the function in the table */
+	found = False;
+	for( newStack->entry_I = 0; newStack->entry_I < self->_tableCount; newStack->entry_I++ ) {
+		/* Each function/parent-pointer - function/parent name, is treated as a distinct call graph entry. This way, if a
+		    function is called by more than one distinct function, we have that information (the user can combine this
+		    info if they see fit. And in the case of entry points, the same function pointer is used for all entry points,
+		    as the name is the distinquisher */
+		if( 
+			self->table[newStack->entry_I].functionPtr == functionPtr &&
+			self->table[newStack->entry_I].parentPtr == parentPtr &&
+			self->table[newStack->entry_I].name == name && 
+			self->table[newStack->entry_I].parentName == parentName ) 
+		{
+			found = True;
+			break;
+		}
+	}
+	
+	if( found ) {
+		self->table[newStack->entry_I].called += 1;
+	}
+	/* else, add to the table */
+	else {
+		/* We may need to allocate some more memory */
+		if( self->_tableCount >= self->_tableSize ) {
+			_Stg_CallGraph_Entry* newTable;
+			SizeT newSize;
+			
+			Journal_Firewall( 
+				self->_tableCount == self->_tableSize, 
+				Journal_Register( Error_Type, Stg_CallGraph_Type ), 
+				"Somehow the table entry counter is greater than the memory allocation" );
+
+			
+			newSize = self->_tableSize + _Stg_CallGraph_Table_Delta;
+			newTable = Memory_Alloc_Array( _Stg_CallGraph_Entry, newSize, _Stg_CallGraph_Entry_Type );
+			/* safe to do, we want to copy ptr values */
+			memcpy( newTable, self->table, self->_tableSize * sizeof(_Stg_CallGraph_Entry) ); 
+			Memory_Free( self->table );
+			self->table = newTable;
+			self->_tableSize = newSize;
+		}
+		
+		newStack->entry_I = self->_tableCount;
+		self->_tableCount += 1;
+		
+		self->table[newStack->entry_I].functionPtr = functionPtr;
+		self->table[newStack->entry_I].name = name;
+		self->table[newStack->entry_I].parentPtr = parentPtr;
+		self->table[newStack->entry_I].parentName = parentName;
+		self->table[newStack->entry_I].time = 0.0f;
+		self->table[newStack->entry_I].memory = 0;
+		self->table[newStack->entry_I].called = 1;
+		self->table[newStack->entry_I].returned = 0;
+	}
+}
+
+void Stg_CallGraph_Pop( void* callGraph ) {
+	Stg_CallGraph*		self = (Stg_CallGraph*)callGraph;
+	_Stg_CallGraph_Stack*	oldStack;
+	
+	Journal_Firewall( 
+		self->_stack != 0, 
+		Journal_Register( Error_Type, Stg_CallGraph_Type ), 
+		"Attempting to pop and empty stack" );
+	
+	/* Record the accumulative delta time & memory */
+	self->table[self->_stack->entry_I].time += 0 /* TODO: Actual time stamp */ - self->_stack->time;
+	self->table[self->_stack->entry_I].memory += 0 /* TODO: Actual memory stamp */ - self->_stack->memory;
+	self->table[self->_stack->entry_I].returned += 1;
+	
+	/* Pop the stack */
+	oldStack = self->_stack;
+	self->_stack = oldStack->pop;
+	Memory_Free( oldStack );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Comm.c
--- a/Base/Automation/src/Comm.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Comm.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <assert.h>
-#include <mpi.h>
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "types.h"
-#include "Comm.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-void _Comm_Init( void* _self ) {
-   Comm* self = Class_Cast( _self, Comm );
-
-   _NewClass_Init( self );
-   self->mpiComm = MPI_COMM_WORLD;
-   IArray_Construct( &self->nbrs );
-   IMap_Construct( &self->inv );
-   self->recvs = NULL;
-   self->sends = NULL;
-   self->stats = NULL;
-   self->recvSizes = NULL;
-   self->itmSize = 0;
-   self->srcSize = 0;
-   self->srcSizes = NULL;
-}
-
-void _Comm_Destruct( void* _self ) {
-   Comm* self = Class_Cast( _self, Comm );
-
-   IArray_Destruct( &self->nbrs );
-   IMap_Destruct( &self->inv );
-   Class_Free( self, self->recvs );
-   Class_Free( self, self->sends );
-   Class_Free( self, self->stats );
-   _NewClass_Destruct( self );
-}
-
-void _Comm_Copy( void* _self, const void* _op ) {
-   Comm* self = Class_Cast( _self, Comm );
-   const Comm* op = Class_ConstCast( _op, Comm );
-   int nNbrs;
-
-   _NewClass_Copy( self, op );
-   self->mpiComm = op->mpiComm;
-   IArray_Copy( &self->nbrs, &op->nbrs );
-   IMap_Copy( &self->inv, &op->inv );
-   nNbrs = IArray_GetSize( &self->nbrs );
-   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, nNbrs );
-   self->sends = Class_Rearray( self, self->sends, MPI_Request, nNbrs );
-   self->stats = Class_Rearray( self, self->stats, MPI_Status, nNbrs );
-}
-
-SizeT _Comm_CalcMem( const void* _self, PtrMap* ptrs ) {
-   const Comm* self = Class_ConstCast( _self, Comm );
-   SizeT mem;
-
-   if( PtrMap_Find( ptrs, (void*)self ) )
-      return 0;
-   mem = _NewClass_CalcMem( self, ptrs );
-   mem += NewClass_CalcMem( &self->nbrs, ptrs );
-   mem += NewClass_CalcMem( &self->inv, ptrs );
-   return mem;
-}
-
-void Comm_SetMPIComm( void* _self, MPI_Comm mpiComm ) {
-   Comm* self = Class_Cast( _self, Comm );
-
-   self->mpiComm = mpiComm;
-   IArray_Set( &self->nbrs, 0, NULL );
-   IMap_Clear( &self->inv );
-   Class_Free( self, self->recvs );
-   self->recvs = NULL;
-   Class_Free( self, self->sends );
-   self->sends = NULL;
-   Class_Free( self, self->stats );
-   self->stats = NULL;
-}
-
-void Comm_SetNeighbours( void* _self, int nNbrs, const int* nbrs ) {
-   Comm* self = Class_Cast( _self, Comm );
-   int n_i;
-
-   IArray_Set( &self->nbrs, nNbrs, nbrs );
-   IMap_Clear( &self->inv );
-   IMap_SetMaxSize( &self->inv, nNbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      IMap_Insert( &self->inv, nbrs[n_i], n_i );
-   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, nNbrs );
-   self->sends = Class_Rearray( self, self->sends, MPI_Request, nNbrs );
-   self->stats = Class_Rearray( self, self->stats, MPI_Status, nNbrs );
-}
-
-void Comm_AddNeighbours( void* _self, int nNbrs, const int* nbrs ) {
-   Comm* self = Class_Cast( _self, Comm );
-   int netNbrs;
-   int n_i;
-
-   IArray_Add( &self->nbrs, nNbrs, nbrs );
-   netNbrs = IArray_GetSize( &self->nbrs );
-   IMap_SetMaxSize( &self->inv, netNbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      IMap_Insert( &self->inv, nbrs[n_i], netNbrs + n_i );
-   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, netNbrs );
-   self->sends = Class_Rearray( self, self->sends, MPI_Request, netNbrs );
-   self->stats = Class_Rearray( self, self->stats, MPI_Status, netNbrs );
-}
-
-
-/** Note: nbrLocalIndices is _not_ the ranks of neighbours to remove, but local indices of local
- * neighbours in the nbrs array */
-void Comm_RemoveNeighbours( void* _self, int nNbrs, const int* nbrLocalIndices, IMap* map ) {
-   Comm* self = Class_Cast( _self, Comm );
-   int netNbrs;
-   int n_i;
-   int globalIndex;
-
-   /* First, we need to map the local index to a global, so we know what to remove from the inverse
-    * mapping array next */
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      globalIndex = Comm_RankLocalToGlobal( self, nbrLocalIndices[n_i] );
-      IMap_Remove( &self->inv, globalIndex );
-   }
-   /* Now remove the local to global listings */
-   IArray_Remove( &self->nbrs, nNbrs, nbrLocalIndices, map );
-   /* Finally, update sizes */
-   netNbrs = IArray_GetSize( &self->nbrs );
-   IMap_SetMaxSize( &self->inv, netNbrs );
-   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, netNbrs );
-   self->sends = Class_Rearray( self, self->sends, MPI_Request, netNbrs );
-   self->stats = Class_Rearray( self, self->stats, MPI_Status, netNbrs );
-}
-
-MPI_Comm Comm_GetMPIComm( const void* self ) {
-   assert( Class_IsSuper( self, Comm ) );
-   return ((Comm*)self)->mpiComm;
-}
-
-int Comm_GetNumNeighbours( const void* self ) {
-   assert( Class_IsSuper( self, Comm ) );
-   return IArray_GetSize( &((Comm*)self)->nbrs );
-}
-
-void Comm_GetNeighbours( const void* self, int* nNbrs, const int** nbrs ) {
-   assert( Class_IsSuper( self, Comm ) );
-   IArray_GetArray( &((Comm*)self)->nbrs, nNbrs, nbrs );
-}
-
-int Comm_RankLocalToGlobal( const void* self, int local ) {
-   assert( Class_IsSuper( self, Comm ) );
-   assert( local < IArray_GetSize( &((Comm*)self)->nbrs ) );
-   return IArray_GetPtr( &((Comm*)self)->nbrs )[local];
-}
-
-Bool Comm_RankGlobalToLocal( const void* self, int global, int* local ) {
-   assert( Class_IsSuper( self, Comm ) );
-   return IMap_TryMap( &((Comm*)self)->inv, global, local );
-}
-
-void Comm_AllgatherInit( const void* _self, int srcSize, 
-			 int* dstSizes, int itmSize )
-{
-   Comm* self = Class_Cast( _self, Comm );
-   const int sizeTag = 1001;
-   int nNbrs;
-   const int* nbrs;
-   int n_i;
-
-   assert( itmSize );
-   assert( !self->srcSize && !self->recvSizes );
-
-   nNbrs = IArray_GetSize( &self->nbrs );
-   nbrs = IArray_GetPtr( &self->nbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Irecv( dstSizes + n_i, 1, MPI_INT, nbrs[n_i], sizeTag, 
-			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
-   }
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Isend( &srcSize, 1, MPI_INT, nbrs[n_i], sizeTag, 
-			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
-   }
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
-
-   self->recvSizes = dstSizes;
-   self->itmSize = itmSize;
-   self->srcSize = srcSize;
-}
-
-void Comm_AllgatherBegin( const void* _self, const void* srcArray, 
-			  void** dstArrays )
-{
-   Comm* self = Class_Cast( _self, Comm );
-   const int dataTag = 2002;
-   int nNbrs;
-   const int* nbrs;
-   int n_i;
-
-   nNbrs = IArray_GetSize( &self->nbrs );
-   nbrs = IArray_GetPtr( &self->nbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Irecv( dstArrays[n_i], self->recvSizes[n_i] * self->itmSize, 
-			 MPI_BYTE, nbrs[n_i], dataTag, 
-			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
-   }
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Isend( (void*)srcArray, self->srcSize * self->itmSize, 
-			 MPI_BYTE, nbrs[n_i], dataTag, 
-			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
-   }
-}
-
-void Comm_AllgatherEnd( const void* _self ) {
-   Comm* self = Class_Cast( _self, Comm );
-   int nNbrs;
-   int n_i;
-
-   nNbrs = IArray_GetSize( &self->nbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
-
-   self->recvSizes = NULL;
-   self->itmSize = 0;
-   self->srcSize = 0;
-}
-
-void Comm_AlltoallInit( const void* _self, const int* srcSizes, 
-			int* dstSizes, int itmSize )
-{
-   Comm* self = (Comm*)_self;
-   const int sizeTag = 1001;
-   int nNbrs;
-   const int* nbrs;
-   int n_i;
-
-   assert( self && itmSize );
-   assert( !self->srcSizes && !self->recvSizes );
-   nNbrs = IArray_GetSize( &self->nbrs );
-   nbrs = IArray_GetPtr( &self->nbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Irecv( dstSizes + n_i, 1, MPI_INT, nbrs[n_i], sizeTag, 
-			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
-   }
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Isend( (void*)(srcSizes + n_i), 1, MPI_INT, nbrs[n_i], sizeTag, 
-			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
-   }
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
-
-   self->recvSizes = dstSizes;
-   self->itmSize = itmSize;
-   self->srcSizes = (int*)srcSizes;
-}
-
-void Comm_AlltoallBegin( const void* _self, const void** srcArrays, 
-			 void** dstArrays )
-{
-   Comm* self = (Comm*)_self;
-   const int dataTag = 2002;
-   int nNbrs;
-   const int* nbrs;
-   int n_i;
-
-   assert( self );
-   nNbrs = IArray_GetSize( &self->nbrs );
-   nbrs = IArray_GetPtr( &self->nbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Irecv( dstArrays[n_i], self->recvSizes[n_i] * self->itmSize, 
-			 MPI_BYTE, nbrs[n_i], dataTag, 
-			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
-   }
-   for( n_i = 0; n_i < nNbrs; n_i++ ) {
-      insist( MPI_Isend( (void*)(srcArrays[n_i]), self->srcSizes[n_i] * self->itmSize, 
-			 MPI_BYTE, nbrs[n_i], dataTag, 
-			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
-   }
-}
-
-void Comm_AlltoallEnd( const void* _self ) {
-   Comm* self = (Comm*)_self;
-   int nNbrs;
-   int n_i;
-
-   assert( self );
-   nNbrs = IArray_GetSize( &self->nbrs );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
-   for( n_i = 0; n_i < nNbrs; n_i++ )
-      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
-
-   self->recvSizes = NULL;
-   self->itmSize = 0;
-   self->srcSizes = NULL;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Comm.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Comm.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,334 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Comm.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <assert.h>
+#include <mpi.h>
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "types.h"
+#include "Comm.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+void _Comm_Init( void* _self ) {
+   Comm* self = Class_Cast( _self, Comm );
+
+   _NewClass_Init( self );
+   self->mpiComm = MPI_COMM_WORLD;
+   IArray_Construct( &self->nbrs );
+   IMap_Construct( &self->inv );
+   self->recvs = NULL;
+   self->sends = NULL;
+   self->stats = NULL;
+   self->recvSizes = NULL;
+   self->itmSize = 0;
+   self->srcSize = 0;
+   self->srcSizes = NULL;
+}
+
+void _Comm_Destruct( void* _self ) {
+   Comm* self = Class_Cast( _self, Comm );
+
+   IArray_Destruct( &self->nbrs );
+   IMap_Destruct( &self->inv );
+   Class_Free( self, self->recvs );
+   Class_Free( self, self->sends );
+   Class_Free( self, self->stats );
+   _NewClass_Destruct( self );
+}
+
+void _Comm_Copy( void* _self, const void* _op ) {
+   Comm* self = Class_Cast( _self, Comm );
+   const Comm* op = Class_ConstCast( _op, Comm );
+   int nNbrs;
+
+   _NewClass_Copy( self, op );
+   self->mpiComm = op->mpiComm;
+   IArray_Copy( &self->nbrs, &op->nbrs );
+   IMap_Copy( &self->inv, &op->inv );
+   nNbrs = IArray_GetSize( &self->nbrs );
+   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, nNbrs );
+   self->sends = Class_Rearray( self, self->sends, MPI_Request, nNbrs );
+   self->stats = Class_Rearray( self, self->stats, MPI_Status, nNbrs );
+}
+
+SizeT _Comm_CalcMem( const void* _self, PtrMap* ptrs ) {
+   const Comm* self = Class_ConstCast( _self, Comm );
+   SizeT mem;
+
+   if( PtrMap_Find( ptrs, (void*)self ) )
+      return 0;
+   mem = _NewClass_CalcMem( self, ptrs );
+   mem += NewClass_CalcMem( &self->nbrs, ptrs );
+   mem += NewClass_CalcMem( &self->inv, ptrs );
+   return mem;
+}
+
+void Comm_SetMPIComm( void* _self, MPI_Comm mpiComm ) {
+   Comm* self = Class_Cast( _self, Comm );
+
+   self->mpiComm = mpiComm;
+   IArray_Set( &self->nbrs, 0, NULL );
+   IMap_Clear( &self->inv );
+   Class_Free( self, self->recvs );
+   self->recvs = NULL;
+   Class_Free( self, self->sends );
+   self->sends = NULL;
+   Class_Free( self, self->stats );
+   self->stats = NULL;
+}
+
+void Comm_SetNeighbours( void* _self, int nNbrs, const int* nbrs ) {
+   Comm* self = Class_Cast( _self, Comm );
+   int n_i;
+
+   IArray_Set( &self->nbrs, nNbrs, nbrs );
+   IMap_Clear( &self->inv );
+   IMap_SetMaxSize( &self->inv, nNbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      IMap_Insert( &self->inv, nbrs[n_i], n_i );
+   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, nNbrs );
+   self->sends = Class_Rearray( self, self->sends, MPI_Request, nNbrs );
+   self->stats = Class_Rearray( self, self->stats, MPI_Status, nNbrs );
+}
+
+void Comm_AddNeighbours( void* _self, int nNbrs, const int* nbrs ) {
+   Comm* self = Class_Cast( _self, Comm );
+   int netNbrs;
+   int n_i;
+
+   IArray_Add( &self->nbrs, nNbrs, nbrs );
+   netNbrs = IArray_GetSize( &self->nbrs );
+   IMap_SetMaxSize( &self->inv, netNbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      IMap_Insert( &self->inv, nbrs[n_i], netNbrs + n_i );
+   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, netNbrs );
+   self->sends = Class_Rearray( self, self->sends, MPI_Request, netNbrs );
+   self->stats = Class_Rearray( self, self->stats, MPI_Status, netNbrs );
+}
+
+
+/** Note: nbrLocalIndices is _not_ the ranks of neighbours to remove, but local indices of local
+ * neighbours in the nbrs array */
+void Comm_RemoveNeighbours( void* _self, int nNbrs, const int* nbrLocalIndices, IMap* map ) {
+   Comm* self = Class_Cast( _self, Comm );
+   int netNbrs;
+   int n_i;
+   int globalIndex;
+
+   /* First, we need to map the local index to a global, so we know what to remove from the inverse
+    * mapping array next */
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      globalIndex = Comm_RankLocalToGlobal( self, nbrLocalIndices[n_i] );
+      IMap_Remove( &self->inv, globalIndex );
+   }
+   /* Now remove the local to global listings */
+   IArray_Remove( &self->nbrs, nNbrs, nbrLocalIndices, map );
+   /* Finally, update sizes */
+   netNbrs = IArray_GetSize( &self->nbrs );
+   IMap_SetMaxSize( &self->inv, netNbrs );
+   self->recvs = Class_Rearray( self, self->recvs, MPI_Request, netNbrs );
+   self->sends = Class_Rearray( self, self->sends, MPI_Request, netNbrs );
+   self->stats = Class_Rearray( self, self->stats, MPI_Status, netNbrs );
+}
+
+MPI_Comm Comm_GetMPIComm( const void* self ) {
+   assert( Class_IsSuper( self, Comm ) );
+   return ((Comm*)self)->mpiComm;
+}
+
+int Comm_GetNumNeighbours( const void* self ) {
+   assert( Class_IsSuper( self, Comm ) );
+   return IArray_GetSize( &((Comm*)self)->nbrs );
+}
+
+void Comm_GetNeighbours( const void* self, int* nNbrs, const int** nbrs ) {
+   assert( Class_IsSuper( self, Comm ) );
+   IArray_GetArray( &((Comm*)self)->nbrs, nNbrs, nbrs );
+}
+
+int Comm_RankLocalToGlobal( const void* self, int local ) {
+   assert( Class_IsSuper( self, Comm ) );
+   assert( local < IArray_GetSize( &((Comm*)self)->nbrs ) );
+   return IArray_GetPtr( &((Comm*)self)->nbrs )[local];
+}
+
+Bool Comm_RankGlobalToLocal( const void* self, int global, int* local ) {
+   assert( Class_IsSuper( self, Comm ) );
+   return IMap_TryMap( &((Comm*)self)->inv, global, local );
+}
+
+void Comm_AllgatherInit( const void* _self, int srcSize, 
+			 int* dstSizes, int itmSize )
+{
+   Comm* self = Class_Cast( _self, Comm );
+   const int sizeTag = 1001;
+   int nNbrs;
+   const int* nbrs;
+   int n_i;
+
+   assert( itmSize );
+   assert( !self->srcSize && !self->recvSizes );
+
+   nNbrs = IArray_GetSize( &self->nbrs );
+   nbrs = IArray_GetPtr( &self->nbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Irecv( dstSizes + n_i, 1, MPI_INT, nbrs[n_i], sizeTag, 
+			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
+   }
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Isend( &srcSize, 1, MPI_INT, nbrs[n_i], sizeTag, 
+			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
+   }
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
+
+   self->recvSizes = dstSizes;
+   self->itmSize = itmSize;
+   self->srcSize = srcSize;
+}
+
+void Comm_AllgatherBegin( const void* _self, const void* srcArray, 
+			  void** dstArrays )
+{
+   Comm* self = Class_Cast( _self, Comm );
+   const int dataTag = 2002;
+   int nNbrs;
+   const int* nbrs;
+   int n_i;
+
+   nNbrs = IArray_GetSize( &self->nbrs );
+   nbrs = IArray_GetPtr( &self->nbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Irecv( dstArrays[n_i], self->recvSizes[n_i] * self->itmSize, 
+			 MPI_BYTE, nbrs[n_i], dataTag, 
+			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
+   }
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Isend( (void*)srcArray, self->srcSize * self->itmSize, 
+			 MPI_BYTE, nbrs[n_i], dataTag, 
+			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
+   }
+}
+
+void Comm_AllgatherEnd( const void* _self ) {
+   Comm* self = Class_Cast( _self, Comm );
+   int nNbrs;
+   int n_i;
+
+   nNbrs = IArray_GetSize( &self->nbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
+
+   self->recvSizes = NULL;
+   self->itmSize = 0;
+   self->srcSize = 0;
+}
+
+void Comm_AlltoallInit( const void* _self, const int* srcSizes, 
+			int* dstSizes, int itmSize )
+{
+   Comm* self = (Comm*)_self;
+   const int sizeTag = 1001;
+   int nNbrs;
+   const int* nbrs;
+   int n_i;
+
+   assert( self && itmSize );
+   assert( !self->srcSizes && !self->recvSizes );
+   nNbrs = IArray_GetSize( &self->nbrs );
+   nbrs = IArray_GetPtr( &self->nbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Irecv( dstSizes + n_i, 1, MPI_INT, nbrs[n_i], sizeTag, 
+			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
+   }
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Isend( (void*)(srcSizes + n_i), 1, MPI_INT, nbrs[n_i], sizeTag, 
+			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
+   }
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
+
+   self->recvSizes = dstSizes;
+   self->itmSize = itmSize;
+   self->srcSizes = (int*)srcSizes;
+}
+
+void Comm_AlltoallBegin( const void* _self, const void** srcArrays, 
+			 void** dstArrays )
+{
+   Comm* self = (Comm*)_self;
+   const int dataTag = 2002;
+   int nNbrs;
+   const int* nbrs;
+   int n_i;
+
+   assert( self );
+   nNbrs = IArray_GetSize( &self->nbrs );
+   nbrs = IArray_GetPtr( &self->nbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Irecv( dstArrays[n_i], self->recvSizes[n_i] * self->itmSize, 
+			 MPI_BYTE, nbrs[n_i], dataTag, 
+			 self->mpiComm, self->recvs + n_i ), == MPI_SUCCESS );
+   }
+   for( n_i = 0; n_i < nNbrs; n_i++ ) {
+      insist( MPI_Isend( (void*)(srcArrays[n_i]), self->srcSizes[n_i] * self->itmSize, 
+			 MPI_BYTE, nbrs[n_i], dataTag, 
+			 self->mpiComm, self->sends + n_i ), == MPI_SUCCESS );
+   }
+}
+
+void Comm_AlltoallEnd( const void* _self ) {
+   Comm* self = (Comm*)_self;
+   int nNbrs;
+   int n_i;
+
+   assert( self );
+   nNbrs = IArray_GetSize( &self->nbrs );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->sends + n_i, self->stats + n_i ), == MPI_SUCCESS );
+   for( n_i = 0; n_i < nNbrs; n_i++ )
+      insist( MPI_Wait( self->recvs + n_i, self->stats + n_i ), == MPI_SUCCESS );
+
+   self->recvSizes = NULL;
+   self->itmSize = 0;
+   self->srcSizes = NULL;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Component.c
--- a/Base/Automation/src/Component.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-** 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Component.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "types.h"
-#include "Stg_ComponentFactory.h"
-#include "Component.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-void _stgComponent_Init( void* _self ) {
-   stgComponent* self = Class_Cast( _self, stgComponent );
-
-   _NewObject_Init( self );
-   self->isInstantiated = False;
-   self->isBuilt = False;
-   self->isInitialised = False;
-   self->hasExecuted = False;
-}
-
-void _stgComponent_Copy( void* _self, const void* _op ) {
-   stgComponent* self = Class_Cast( _self, stgComponent );
-   stgComponent* op = Class_Cast( _self, stgComponent );
-
-   _NewObject_Copy( self, op );
-   self->isInstantiated = op->isInstantiated;
-   self->isBuilt = op->isBuilt;
-   self->isInitialised = op->isInitialised;
-   self->hasExecuted = op->hasExecuted;
-}
-
-void stgComponent_Instantiate( void* _self, Stg_ComponentFactory* cf, 
-				void* data, Bool force )
-{
-   stgComponent* self = Class_Cast( _self, stgComponent );
-
-   if( force || !self->isInstantiated ) {
-      self->isInstantiated = True;
-      stgComponent_InstantiateSelf( self, cf, data );
-   }
-}
-
-void stgComponent_Build( void* _self, void* data, Bool force ) {
-   stgComponent* self = Class_Cast( _self, stgComponent );
-
-   if( force || !self->isBuilt ) {
-      self->isBuilt = True;
-      stgComponent_BuildSelf( self, data );
-   }
-}
-
-void stgComponent_Initialise( void* _self, void* data, Bool force ) {
-   stgComponent* self = Class_Cast( _self, stgComponent );
-
-   if( force || !self->isInitialised ) {
-      self->isInitialised = True;
-      stgComponent_InitialiseSelf( self, data );
-   }
-}
-
-void stgComponent_Execute( void* _self, void* data, Bool force ) {
-   stgComponent* self = Class_Cast( _self, stgComponent );
-
-   if( force || !self->hasExecuted ) {
-      self->hasExecuted = True;
-      stgComponent_ExecuteSelf( self, data );
-   }
-}
-
-Bool stgComponent_IsInstantiated( const void* self ) {
-   assert( Class_IsSuper( self, stgComponent ) );
-   return ((stgComponent*)self)->isInstantiated;
-}
-
-Bool Component_IsBuilt( const void* self ) {
-   assert( Class_IsSuper( self, stgComponent ) );
-   return ((stgComponent*)self)->isBuilt;
-}
-
-Bool Component_IsInitialised( const void* self ) {
-   assert( Class_IsSuper( self, stgComponent ) );
-   return ((stgComponent*)self)->isInitialised;
-}
-
-Bool Component_HasExecuted( void* self ) {
-   assert( Class_IsSuper( self, stgComponent ) );
-   return ((stgComponent*)self)->hasExecuted;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Component.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Component.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,120 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+** 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Component.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "types.h"
+#include "Stg_ComponentFactory.h"
+#include "Component.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+void _stgComponent_Init( void* _self ) {
+   stgComponent* self = Class_Cast( _self, stgComponent );
+
+   _NewObject_Init( self );
+   self->isInstantiated = False;
+   self->isBuilt = False;
+   self->isInitialised = False;
+   self->hasExecuted = False;
+}
+
+void _stgComponent_Copy( void* _self, const void* _op ) {
+   stgComponent* self = Class_Cast( _self, stgComponent );
+   stgComponent* op = Class_Cast( _self, stgComponent );
+
+   _NewObject_Copy( self, op );
+   self->isInstantiated = op->isInstantiated;
+   self->isBuilt = op->isBuilt;
+   self->isInitialised = op->isInitialised;
+   self->hasExecuted = op->hasExecuted;
+}
+
+void stgComponent_Instantiate( void* _self, Stg_ComponentFactory* cf, 
+				void* data, Bool force )
+{
+   stgComponent* self = Class_Cast( _self, stgComponent );
+
+   if( force || !self->isInstantiated ) {
+      self->isInstantiated = True;
+      stgComponent_InstantiateSelf( self, cf, data );
+   }
+}
+
+void stgComponent_Build( void* _self, void* data, Bool force ) {
+   stgComponent* self = Class_Cast( _self, stgComponent );
+
+   if( force || !self->isBuilt ) {
+      self->isBuilt = True;
+      stgComponent_BuildSelf( self, data );
+   }
+}
+
+void stgComponent_Initialise( void* _self, void* data, Bool force ) {
+   stgComponent* self = Class_Cast( _self, stgComponent );
+
+   if( force || !self->isInitialised ) {
+      self->isInitialised = True;
+      stgComponent_InitialiseSelf( self, data );
+   }
+}
+
+void stgComponent_Execute( void* _self, void* data, Bool force ) {
+   stgComponent* self = Class_Cast( _self, stgComponent );
+
+   if( force || !self->hasExecuted ) {
+      self->hasExecuted = True;
+      stgComponent_ExecuteSelf( self, data );
+   }
+}
+
+Bool stgComponent_IsInstantiated( const void* self ) {
+   assert( Class_IsSuper( self, stgComponent ) );
+   return ((stgComponent*)self)->isInstantiated;
+}
+
+Bool Component_IsBuilt( const void* self ) {
+   assert( Class_IsSuper( self, stgComponent ) );
+   return ((stgComponent*)self)->isBuilt;
+}
+
+Bool Component_IsInitialised( const void* self ) {
+   assert( Class_IsSuper( self, stgComponent ) );
+   return ((stgComponent*)self)->isInitialised;
+}
+
+Bool Component_HasExecuted( void* self ) {
+   assert( Class_IsSuper( self, stgComponent ) );
+   return ((stgComponent*)self)->hasExecuted;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/DocumentationComponentFactory.c
--- a/Base/Automation/src/DocumentationComponentFactory.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: DocumentationComponentFactory.c 3851 2006-10-12 08:57:22Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Stg_Component.h"
-#include "LiveComponentRegister.h"
-#include "Stg_ComponentFactory.h"
-#include "DocumentationComponentFactory.h"
-#include "HierarchyTable.h"
-#include "Stg_ComponentRegister.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#define COMPONENT_TYPE_STRING_LENGTH 30
-
-/* Textual name of this class */
-const Type DocumentationComponentFactory_Type = "DocumentationComponentFactory";
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-	
-DocumentationComponentFactory* DocumentationComponentFactory_New( ) {
-	/* Variables set in this function */
-	SizeT                                                                        _sizeOfSelf = sizeof( DocumentationComponentFactory );
-	Type                                                                                type = DocumentationComponentFactory_Type;
-	Stg_Class_DeleteFunction*                                                        _delete = _DocumentationComponentFactory_Delete;
-	Stg_Class_PrintFunction*                                                          _print = _DocumentationComponentFactory_Print;
-	Stg_ComponentFactory_GetDoubleFunc*                                            getDouble = _DocumentationComponentFactory_GetDouble;
-	Stg_ComponentFactory_GetIntFunc*                                                  getInt = _DocumentationComponentFactory_GetInt;
-	Stg_ComponentFactory_GetUnsignedIntFunc*                                  getUnsignedInt = _DocumentationComponentFactory_GetUnsignedInt;
-	Stg_ComponentFactory_GetBoolFunc*                                                getBool = _DocumentationComponentFactory_GetBool;
-	Stg_ComponentFactory_GetStringFunc*                                            getString = _DocumentationComponentFactory_GetString;
-	Stg_ComponentFactory_GetRootDictDoubleFunc*                            getRootDictDouble = _DocumentationComponentFactory_GetRootDictDouble;
-	Stg_ComponentFactory_GetRootDictIntFunc*                                  getRootDictInt = _DocumentationComponentFactory_GetRootDictInt;
-	Stg_ComponentFactory_GetRootDictUnsignedIntFunc*                  getRootDictUnsignedInt = _DocumentationComponentFactory_GetRootDictUnsignedInt;
-	Stg_ComponentFactory_GetRootDictBoolFunc*                                getRootDictBool = _DocumentationComponentFactory_GetRootDictBool;
-	Stg_ComponentFactory_GetRootDictStringFunc*                            getRootDictString = _DocumentationComponentFactory_GetRootDictString;
-	Stg_ComponentFactory_ConstructByNameFunc*                                constructByName = _DocumentationComponentFactory_ConstructByName;
-	Stg_ComponentFactory_ConstructByKeyFunc*                                  constructByKey = _DocumentationComponentFactory_ConstructByKey;
-	Stg_ComponentFactory_ConstructByNameWithKeyFallbackFunc*  constructByNameWithKeyFallback = _DocumentationComponentFactory_ConstructByNameWithKeyFallback;
-	Stg_ComponentFactory_ConstructByListFunc*                                constructByList = _DocumentationComponentFactory_ConstructByList;
-
-	/* 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 */
-	Dictionary*       rootDict = ZERO;
-	Dictionary*  componentDict = ZERO;
-
-	DocumentationComponentFactory *self = NULL;
-
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_Class_CopyFunction*  _copy = NULL;
-
-	self = _DocumentationComponentFactory_New(  DOCUMENTATIONCOMPONENTFACTORY_PASSARGS  );
-
-	return self;
-}
-
-/* Creation implementation */
-DocumentationComponentFactory* _DocumentationComponentFactory_New(  DOCUMENTATIONCOMPONENTFACTORY_DEFARGS  )
-{
-	DocumentationComponentFactory *self = NULL;
-
-	assert( _sizeOfSelf >= sizeof( DocumentationComponentFactory ) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	rootDict      = NULL;
-	componentDict = NULL;
-
-	self = (DocumentationComponentFactory*) _Stg_ComponentFactory_New(  STG_COMPONENTFACTORY_PASSARGS  );
-
-	return self;
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _DocumentationComponentFactory_Delete( void* componentFactory ) {
-	DocumentationComponentFactory *self = (DocumentationComponentFactory *) componentFactory;
-
-	_Stg_ComponentFactory_Delete( self );
-}
-	
-void _DocumentationComponentFactory_Print( void* componentFactory, Stream* stream ) {
-	DocumentationComponentFactory *self = (DocumentationComponentFactory*) componentFactory;
-
-	assert( self );
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "DocumentationComponentFactory (ptr): %p\n", self );
-	
-	/* Print parent class */
-	_Stg_ComponentFactory_Print( self, stream );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-double _DocumentationComponentFactory_GetDouble( void* cf, Name componentName, Dictionary_Entry_Key key, const double Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'double' - ", key );
-	Journal_PrintValue( self->infoStream, Default );
-	return Default;
-}
-
-int _DocumentationComponentFactory_GetInt( void* cf, Name componentName, Dictionary_Entry_Key key, const int Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'int' - ", key );
-	Journal_PrintValue( self->infoStream, Default );
-	return Default;
-}	
-
-unsigned int _DocumentationComponentFactory_GetUnsignedInt( void* cf, Name componentName, Dictionary_Entry_Key key, const unsigned int Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'unsigned int' - ", key );
-	Journal_PrintValue( self->infoStream, Default );
-	return Default;
-}	
-
-Bool _DocumentationComponentFactory_GetBool( void* cf, Name componentName, Dictionary_Entry_Key key, const Bool Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'Bool' - ", key );
-	Journal_PrintBool( self->infoStream, Default );
-	return Default;
-}	
-
-char* _DocumentationComponentFactory_GetString( void* cf, Name componentName, Dictionary_Entry_Key key, const char* Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'string' - ", key );
-	Journal_PrintString( self->infoStream, Default );
-	return (char*)Default;
-}
-
-double _DocumentationComponentFactory_GetRootDictDouble( void* cf, Dictionary_Entry_Key key, const double Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'double' - ", key );
-	Journal_PrintValue( self->infoStream, Default );
-	return Default;
-}
-
-int _DocumentationComponentFactory_GetRootDictInt( void* cf, Dictionary_Entry_Key key, const int Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'int' - ", key );
-	Journal_PrintValue( self->infoStream, Default );
-	return Default;
-}	
-
-unsigned int _DocumentationComponentFactory_GetRootDictUnsignedInt( void* cf, Dictionary_Entry_Key key, const unsigned int Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'unsigned int' - ", key );
-	Journal_PrintValue( self->infoStream, Default );
-	return Default;
-}	
-
-Bool _DocumentationComponentFactory_GetRootDictBool( void* cf, Dictionary_Entry_Key key, const Bool Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'Bool' - ", key );
-	Journal_PrintBool( self->infoStream, Default );
-	return Default;
-}	
-
-char* _DocumentationComponentFactory_GetRootDictString( void* cf, Dictionary_Entry_Key key, Name const Default ) {
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'string' - ", key );
-	Journal_PrintString( self->infoStream, Default );
-	return (char*)Default;
-}
-
-
-Stg_Component* _DocumentationComponentFactory_ConstructByName( 
-		void*			cf, 
-		Name			componentName, 
-		Type			type, 
-		Bool			isEssential, 
-		void*			data )
-{
-	DocumentationComponentFactory*    self              = (DocumentationComponentFactory*) cf;
-
-	Journal_Printf( self->infoStream, "%sEssential Component - Type '%s' - Name = '%s'\n", 
-			( isEssential ? "" : "Non-" ), type, componentName );
-
-	return NULL;
-}
-
-Stg_Component* _DocumentationComponentFactory_ConstructByKey( 
-		void*			cf, 
-		Name			parentComponentName, 
-		Dictionary_Entry_Key	componentKey, 
-		Type			type, 
-		Bool			isEssential,
-		void*			data ) 
-{
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	
-	Journal_Printf( self->infoStream, "%sEssential Component - Type '%s' - Key = '%s'\n", 
-			( isEssential ? "" : "Non-" ), type, componentKey );
-
-	return NULL;
-}
-
-Stg_Component* _DocumentationComponentFactory_ConstructByNameWithKeyFallback( 
-		void*			cf, 
-		Name			parentComponentName, 
-		Name			componentTrialName, 
-		Dictionary_Entry_Key	fallbackKey, 
-		Type			type, 
-		Bool			isEssential,
-		void*			data ) 
-{
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
-	
-	Journal_Printf( self->infoStream, "%sEssential Component - Type '%s' - Trial Name = '%s' - Fall back key = '%s'\n", 
-			( isEssential ? "" : "Non-" ), type, componentTrialName, fallbackKey );
-
-	return NULL;
-}
-
-Stg_Component** _DocumentationComponentFactory_ConstructByList( 
-		void*			componentFactory, 
-		Name			parentComponentName, 
-		Name			listName, 
-		unsigned int		maxComponents,
-		Type			type,
-		Bool			isEssential,
-		unsigned int*		componentCount,
-		void*			data )
-{
-	DocumentationComponentFactory* self = (DocumentationComponentFactory*)componentFactory;
-
-	Journal_Printf( self->infoStream, "%sEssential Components of type '%s' in list named '%s'\n", 
-			( isEssential ? "" : "Non-" ), type, listName );
-
-	return NULL;
-}
-
-void DocumentationComponentFactory_DocumentType( void* cf, Name typeName ) {
-	DocumentationComponentFactory*             self              = (DocumentationComponentFactory*) cf;
-	Stg_Component_DefaultConstructorFunction*  defaultConstructor;
-	Stg_Component*                             component;
-	Stream*                                    stream            = self->infoStream;
-	Type                                       type;
-
-	type = HierarchyTable_GetTypePtrFromName( HierarchyTable_GetHierarchyTable(), typeName );
-			
-	Stream_Enable( stream, False );
-
-	defaultConstructor = Stg_ComponentRegister_AssertGet( 
-			Stg_ComponentRegister_Get_ComponentRegister(), type, "0" );
-
-	component = (Stg_Component*) defaultConstructor( "componentName" );
-
-	Stream_Enable( stream, True );
-	Journal_Printf( stream, "Class '%s'\n", type );
-	Stream_Indent( stream );
-
-	Journal_Printf( stream, "Parent - %s\n", GetParent( type ) );
-
-	Stg_Component_AssignFromXML( component, (Stg_ComponentFactory*)self, 0 /* dummy */, True );
-
-	Stg_Class_Delete( component );
-	Stream_UnIndent( self->infoStream );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/DocumentationComponentFactory.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/DocumentationComponentFactory.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,307 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: DocumentationComponentFactory.c 3851 2006-10-12 08:57:22Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Stg_Component.h"
+#include "LiveComponentRegister.h"
+#include "Stg_ComponentFactory.h"
+#include "DocumentationComponentFactory.h"
+#include "HierarchyTable.h"
+#include "Stg_ComponentRegister.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#define COMPONENT_TYPE_STRING_LENGTH 30
+
+/* Textual name of this class */
+const Type DocumentationComponentFactory_Type = "DocumentationComponentFactory";
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+	
+DocumentationComponentFactory* DocumentationComponentFactory_New( ) {
+	/* Variables set in this function */
+	SizeT                                                                        _sizeOfSelf = sizeof( DocumentationComponentFactory );
+	Type                                                                                type = DocumentationComponentFactory_Type;
+	Stg_Class_DeleteFunction*                                                        _delete = _DocumentationComponentFactory_Delete;
+	Stg_Class_PrintFunction*                                                          _print = _DocumentationComponentFactory_Print;
+	Stg_ComponentFactory_GetDoubleFunc*                                            getDouble = _DocumentationComponentFactory_GetDouble;
+	Stg_ComponentFactory_GetIntFunc*                                                  getInt = _DocumentationComponentFactory_GetInt;
+	Stg_ComponentFactory_GetUnsignedIntFunc*                                  getUnsignedInt = _DocumentationComponentFactory_GetUnsignedInt;
+	Stg_ComponentFactory_GetBoolFunc*                                                getBool = _DocumentationComponentFactory_GetBool;
+	Stg_ComponentFactory_GetStringFunc*                                            getString = _DocumentationComponentFactory_GetString;
+	Stg_ComponentFactory_GetRootDictDoubleFunc*                            getRootDictDouble = _DocumentationComponentFactory_GetRootDictDouble;
+	Stg_ComponentFactory_GetRootDictIntFunc*                                  getRootDictInt = _DocumentationComponentFactory_GetRootDictInt;
+	Stg_ComponentFactory_GetRootDictUnsignedIntFunc*                  getRootDictUnsignedInt = _DocumentationComponentFactory_GetRootDictUnsignedInt;
+	Stg_ComponentFactory_GetRootDictBoolFunc*                                getRootDictBool = _DocumentationComponentFactory_GetRootDictBool;
+	Stg_ComponentFactory_GetRootDictStringFunc*                            getRootDictString = _DocumentationComponentFactory_GetRootDictString;
+	Stg_ComponentFactory_ConstructByNameFunc*                                constructByName = _DocumentationComponentFactory_ConstructByName;
+	Stg_ComponentFactory_ConstructByKeyFunc*                                  constructByKey = _DocumentationComponentFactory_ConstructByKey;
+	Stg_ComponentFactory_ConstructByNameWithKeyFallbackFunc*  constructByNameWithKeyFallback = _DocumentationComponentFactory_ConstructByNameWithKeyFallback;
+	Stg_ComponentFactory_ConstructByListFunc*                                constructByList = _DocumentationComponentFactory_ConstructByList;
+
+	/* 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 */
+	Dictionary*       rootDict = ZERO;
+	Dictionary*  componentDict = ZERO;
+
+	DocumentationComponentFactory *self = NULL;
+
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_Class_CopyFunction*  _copy = NULL;
+
+	self = _DocumentationComponentFactory_New(  DOCUMENTATIONCOMPONENTFACTORY_PASSARGS  );
+
+	return self;
+}
+
+/* Creation implementation */
+DocumentationComponentFactory* _DocumentationComponentFactory_New(  DOCUMENTATIONCOMPONENTFACTORY_DEFARGS  )
+{
+	DocumentationComponentFactory *self = NULL;
+
+	assert( _sizeOfSelf >= sizeof( DocumentationComponentFactory ) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	rootDict      = NULL;
+	componentDict = NULL;
+
+	self = (DocumentationComponentFactory*) _Stg_ComponentFactory_New(  STG_COMPONENTFACTORY_PASSARGS  );
+
+	return self;
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _DocumentationComponentFactory_Delete( void* componentFactory ) {
+	DocumentationComponentFactory *self = (DocumentationComponentFactory *) componentFactory;
+
+	_Stg_ComponentFactory_Delete( self );
+}
+	
+void _DocumentationComponentFactory_Print( void* componentFactory, Stream* stream ) {
+	DocumentationComponentFactory *self = (DocumentationComponentFactory*) componentFactory;
+
+	assert( self );
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "DocumentationComponentFactory (ptr): %p\n", self );
+	
+	/* Print parent class */
+	_Stg_ComponentFactory_Print( self, stream );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+double _DocumentationComponentFactory_GetDouble( void* cf, Name componentName, Dictionary_Entry_Key key, const double Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'double' - ", key );
+	Journal_PrintValue( self->infoStream, Default );
+	return Default;
+}
+
+int _DocumentationComponentFactory_GetInt( void* cf, Name componentName, Dictionary_Entry_Key key, const int Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'int' - ", key );
+	Journal_PrintValue( self->infoStream, Default );
+	return Default;
+}	
+
+unsigned int _DocumentationComponentFactory_GetUnsignedInt( void* cf, Name componentName, Dictionary_Entry_Key key, const unsigned int Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'unsigned int' - ", key );
+	Journal_PrintValue( self->infoStream, Default );
+	return Default;
+}	
+
+Bool _DocumentationComponentFactory_GetBool( void* cf, Name componentName, Dictionary_Entry_Key key, const Bool Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'Bool' - ", key );
+	Journal_PrintBool( self->infoStream, Default );
+	return Default;
+}	
+
+char* _DocumentationComponentFactory_GetString( void* cf, Name componentName, Dictionary_Entry_Key key, const char* Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Parameter - Key '%s' - Type 'string' - ", key );
+	Journal_PrintString( self->infoStream, Default );
+	return (char*)Default;
+}
+
+double _DocumentationComponentFactory_GetRootDictDouble( void* cf, Dictionary_Entry_Key key, const double Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'double' - ", key );
+	Journal_PrintValue( self->infoStream, Default );
+	return Default;
+}
+
+int _DocumentationComponentFactory_GetRootDictInt( void* cf, Dictionary_Entry_Key key, const int Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'int' - ", key );
+	Journal_PrintValue( self->infoStream, Default );
+	return Default;
+}	
+
+unsigned int _DocumentationComponentFactory_GetRootDictUnsignedInt( void* cf, Dictionary_Entry_Key key, const unsigned int Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'unsigned int' - ", key );
+	Journal_PrintValue( self->infoStream, Default );
+	return Default;
+}	
+
+Bool _DocumentationComponentFactory_GetRootDictBool( void* cf, Dictionary_Entry_Key key, const Bool Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'Bool' - ", key );
+	Journal_PrintBool( self->infoStream, Default );
+	return Default;
+}	
+
+char* _DocumentationComponentFactory_GetRootDictString( void* cf, Dictionary_Entry_Key key, Name const Default ) {
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	Journal_Printf( self->infoStream, "Root Dictionary Parameter - Key '%s' - Type 'string' - ", key );
+	Journal_PrintString( self->infoStream, Default );
+	return (char*)Default;
+}
+
+
+Stg_Component* _DocumentationComponentFactory_ConstructByName( 
+		void*			cf, 
+		Name			componentName, 
+		Type			type, 
+		Bool			isEssential, 
+		void*			data )
+{
+	DocumentationComponentFactory*    self              = (DocumentationComponentFactory*) cf;
+
+	Journal_Printf( self->infoStream, "%sEssential Component - Type '%s' - Name = '%s'\n", 
+			( isEssential ? "" : "Non-" ), type, componentName );
+
+	return NULL;
+}
+
+Stg_Component* _DocumentationComponentFactory_ConstructByKey( 
+		void*			cf, 
+		Name			parentComponentName, 
+		Dictionary_Entry_Key	componentKey, 
+		Type			type, 
+		Bool			isEssential,
+		void*			data ) 
+{
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	
+	Journal_Printf( self->infoStream, "%sEssential Component - Type '%s' - Key = '%s'\n", 
+			( isEssential ? "" : "Non-" ), type, componentKey );
+
+	return NULL;
+}
+
+Stg_Component* _DocumentationComponentFactory_ConstructByNameWithKeyFallback( 
+		void*			cf, 
+		Name			parentComponentName, 
+		Name			componentTrialName, 
+		Dictionary_Entry_Key	fallbackKey, 
+		Type			type, 
+		Bool			isEssential,
+		void*			data ) 
+{
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*) cf;
+	
+	Journal_Printf( self->infoStream, "%sEssential Component - Type '%s' - Trial Name = '%s' - Fall back key = '%s'\n", 
+			( isEssential ? "" : "Non-" ), type, componentTrialName, fallbackKey );
+
+	return NULL;
+}
+
+Stg_Component** _DocumentationComponentFactory_ConstructByList( 
+		void*			componentFactory, 
+		Name			parentComponentName, 
+		Name			listName, 
+		unsigned int		maxComponents,
+		Type			type,
+		Bool			isEssential,
+		unsigned int*		componentCount,
+		void*			data )
+{
+	DocumentationComponentFactory* self = (DocumentationComponentFactory*)componentFactory;
+
+	Journal_Printf( self->infoStream, "%sEssential Components of type '%s' in list named '%s'\n", 
+			( isEssential ? "" : "Non-" ), type, listName );
+
+	return NULL;
+}
+
+void DocumentationComponentFactory_DocumentType( void* cf, Name typeName ) {
+	DocumentationComponentFactory*             self              = (DocumentationComponentFactory*) cf;
+	Stg_Component_DefaultConstructorFunction*  defaultConstructor;
+	Stg_Component*                             component;
+	Stream*                                    stream            = self->infoStream;
+	Type                                       type;
+
+	type = HierarchyTable_GetTypePtrFromName( HierarchyTable_GetHierarchyTable(), typeName );
+			
+	Stream_Enable( stream, False );
+
+	defaultConstructor = Stg_ComponentRegister_AssertGet( 
+			Stg_ComponentRegister_Get_ComponentRegister(), type, "0" );
+
+	component = (Stg_Component*) defaultConstructor( "componentName" );
+
+	Stream_Enable( stream, True );
+	Journal_Printf( stream, "Class '%s'\n", type );
+	Stream_Indent( stream );
+
+	Journal_Printf( stream, "Parent - %s\n", GetParent( type ) );
+
+	Stg_Component_AssignFromXML( component, (Stg_ComponentFactory*)self, 0 /* dummy */, True );
+
+	Stg_Class_Delete( component );
+	Stream_UnIndent( self->infoStream );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Finalise.c
--- a/Base/Automation/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 3645 2006-06-19 06:31:44Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Finalise.h"
-
-#include "Stg_Component.h"
-#include "Stg_ComponentRegister.h"
-#include "HierarchyTable.h"
-#include "CallGraph.h"
-#include <stdio.h>
-
-Bool BaseAutomation_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	/* Clean up global variable */
-	Stg_Class_Delete( stgComponentRegister );
-	Stg_Class_Delete( stgHierarchyTable );
-	Stg_Class_Delete( stgCallGraph );
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,57 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 3645 2006-06-19 06:31:44Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Finalise.h"
+
+#include "Stg_Component.h"
+#include "Stg_ComponentRegister.h"
+#include "HierarchyTable.h"
+#include "CallGraph.h"
+#include <stdio.h>
+
+Bool BaseAutomation_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	/* Clean up global variable */
+	Stg_Class_Delete( stgComponentRegister );
+	Stg_Class_Delete( stgHierarchyTable );
+	Stg_Class_Delete( stgCallGraph );
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/HierarchyTable.c
--- a/Base/Automation/src/HierarchyTable.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: HierarchyTable.c 4098 2007-05-16 01:00:35Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Stg_Component.h"
-#include "Stg_ComponentRegister.h"
-#include "HierarchyTable.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type HierarchyTable_Type = "HierarchyTable";
-
-/* Global pointer to singleton */
-HierarchyTable* stgHierarchyTable = NULL;
-
-HierarchyTable* HierarchyTable_New( void ) {
-	HierarchyTable* self = NULL;
-
-	if( stgHierarchyTable == NULL ){
-		self = (HierarchyTable*) HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY );
-	}
-	else{
-		self = stgHierarchyTable;
-	}
-
-	return self;
-}
-	
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-int HierarchyTable_RegisterParent( void* hierarchyTable, Type childType, Type parentType ) {
-	HierarchyTable *self = (HierarchyTable*) hierarchyTable;
-
-	return HashTable_InsertEntry( (HashTable*) self, childType, sizeof(const Type), parentType, sizeof(const Type) );
-}
-
-Bool HierarchyTable_IsChild( void* hierarchyTable, Type childType, Type possibleParentType ) {
-	HierarchyTable* self     = (HierarchyTable*) hierarchyTable;
-	Type            currType;
-	
-	/* Starting from 'childType', sweep through Hierarchy Table, going from parent to parent.
-	 * Keep going until the Hierarchy Table produces a NULL - this means that we've reached the end of the table */
-	for ( currType = childType ; currType != NULL ; currType = HierarchyTable_GetParent( self, currType ) ) {
-		/* Test if this parent is the same as the one being tested for */
-		if ( currType == possibleParentType )
-			return True;
-	}
-
-	/* If we've gone through every parent in the table and reached the end - 
-	 * then 'childType' cannot be a child of 'possibleParentType' */
-	return False;
-}
-
-void HierarchyTable_PrintParents( void* hierarchyTable, Type childType, Stream* stream ) {
-	HierarchyTable* self     = (HierarchyTable*) hierarchyTable;
-	Type            parentType;
-
-	Journal_Printf( stream, "Type '%s' inherits from:\n", childType );
-
-	parentType = HierarchyTable_GetParent( self, childType );
-	for ( ; parentType != NULL ; parentType = HierarchyTable_GetParent( self, parentType ) ) {
-		Journal_Printf( stream, "\t%s\n", parentType );
-	}
-}
-
-void HierarchyTable_PrintChildren( void* hierarchyTable, Type parentType, Stream* stream ) {
-	HierarchyTable*    self     = (HierarchyTable*) hierarchyTable;
-	HashTable_Entry*   hashTableEntry;
-	Index              entry_I;
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( stream, "%s \t\t\t (%s Class)\n", 
-			parentType, ( Stg_ComponentRegister_Get( componentRegister, parentType, "0" ) ? "Concrete" : "Abstract" ) );
-	Stream_Flush( stream );
-	Stream_Indent( stream );
-
-   /* increasing terminating limit by 1 - seems to be right due to comments in HashTable.c ~line 154 */
-	for ( entry_I = 0 ; entry_I < self->max+1 ; entry_I++ ) {
-		hashTableEntry = self->entries[ entry_I ];
-
-		while( hashTableEntry ){
-			if ( (Type) hashTableEntry->data == parentType ) {
-				HierarchyTable_PrintChildren( self, (Type)hashTableEntry->key, stream );
-			}
-			hashTableEntry = hashTableEntry->next;
-		}
-
-	}
-	Stream_UnIndent( stream );
-}
-
-Bool Stg_Class_CompareType( const void* classPtr, Type possibleParentType ) {
-	Stg_Class* self = (Stg_Class*) classPtr;
-	/* Check if the pointer is null */
-	Journal_Firewall(
-		self != NULL,
-		Journal_Register( Error_Type, HierarchyTable_Type ),
-		"Error doing type checking against possibleParentType %s - pointer is NULL.\n",
-		possibleParentType );
-
-	return( Stg_Class_IsInstance( self, possibleParentType ) );
-}
-
-Stg_Class* Stg_Class_CheckType( const void* classPtr, Type possibleParentType ) {
-	Stg_Class* self = (Stg_Class*) classPtr;
-	/* Check if the pointer is null */
-	Journal_Firewall(
-		self != NULL,
-		Journal_Register( Error_Type, HierarchyTable_Type ),
-		"Error doing type checking against possibleParentType %s - pointer is NULL.\n",
-		possibleParentType );
-	
-	if ( ! Stg_Class_IsInstance( self, possibleParentType ) ) {
-		Stream* stream = Journal_Register( Error_Type, HierarchyTable_Type );
-		
-		Journal_Printf( stream, "Error doing type checking:\nTrying to cast " );
-
-		/* Give the user the name of the object if you can */
-		if ( Stg_Class_IsInstance( classPtr, Stg_Object_Type ) ) 
-			Journal_Printf( stream, "'%s' ", ((Stg_Object*)classPtr)->name );
-		else 		
-			Journal_Printf( stream, "pointer '%p' ", classPtr );
-
-		Journal_Printf( stream, 
-				"as '%s' when it is actually of type '%s'.\n",
-				possibleParentType, self->type );
-		
-		PrintParents( possibleParentType, stream );
-		
-		Journal_Firewall( 
-			0,
-			stream, 
-			"Either the HierarchyTable for this class is incorrect or this object has been cast incorrectly.\n" );
-	}
-	return self;
-}
-
-Type HierarchyTable_GetTypePtrFromName( void* hierarchyTable, Name typeName ) {
-	HierarchyTable*    self     = (HierarchyTable*) hierarchyTable;
-	HashTable_Entry*   hashTableEntry;
-	Index              entry_I;
-
-	for ( entry_I = 0 ; entry_I < self->max ; entry_I++ ) {
-		hashTableEntry = self->entries[ entry_I ];
-
-		while( hashTableEntry ){
-			if ( strcmp( (Type) hashTableEntry->key, typeName ) == 0 )
-				return (Type) hashTableEntry->key;
-		
-			hashTableEntry = hashTableEntry->next;
-		}
-
-	}
-	return NULL;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/HierarchyTable.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/HierarchyTable.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,195 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: HierarchyTable.c 4098 2007-05-16 01:00:35Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Stg_Component.h"
+#include "Stg_ComponentRegister.h"
+#include "HierarchyTable.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type HierarchyTable_Type = "HierarchyTable";
+
+/* Global pointer to singleton */
+HierarchyTable* stgHierarchyTable = NULL;
+
+HierarchyTable* HierarchyTable_New( void ) {
+	HierarchyTable* self = NULL;
+
+	if( stgHierarchyTable == NULL ){
+		self = (HierarchyTable*) HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY );
+	}
+	else{
+		self = stgHierarchyTable;
+	}
+
+	return self;
+}
+	
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+int HierarchyTable_RegisterParent( void* hierarchyTable, Type childType, Type parentType ) {
+	HierarchyTable *self = (HierarchyTable*) hierarchyTable;
+
+	return HashTable_InsertEntry( (HashTable*) self, childType, sizeof(const Type), parentType, sizeof(const Type) );
+}
+
+Bool HierarchyTable_IsChild( void* hierarchyTable, Type childType, Type possibleParentType ) {
+	HierarchyTable* self     = (HierarchyTable*) hierarchyTable;
+	Type            currType;
+	
+	/* Starting from 'childType', sweep through Hierarchy Table, going from parent to parent.
+	 * Keep going until the Hierarchy Table produces a NULL - this means that we've reached the end of the table */
+	for ( currType = childType ; currType != NULL ; currType = HierarchyTable_GetParent( self, currType ) ) {
+		/* Test if this parent is the same as the one being tested for */
+		if ( currType == possibleParentType )
+			return True;
+	}
+
+	/* If we've gone through every parent in the table and reached the end - 
+	 * then 'childType' cannot be a child of 'possibleParentType' */
+	return False;
+}
+
+void HierarchyTable_PrintParents( void* hierarchyTable, Type childType, Stream* stream ) {
+	HierarchyTable* self     = (HierarchyTable*) hierarchyTable;
+	Type            parentType;
+
+	Journal_Printf( stream, "Type '%s' inherits from:\n", childType );
+
+	parentType = HierarchyTable_GetParent( self, childType );
+	for ( ; parentType != NULL ; parentType = HierarchyTable_GetParent( self, parentType ) ) {
+		Journal_Printf( stream, "\t%s\n", parentType );
+	}
+}
+
+void HierarchyTable_PrintChildren( void* hierarchyTable, Type parentType, Stream* stream ) {
+	HierarchyTable*    self     = (HierarchyTable*) hierarchyTable;
+	HashTable_Entry*   hashTableEntry;
+	Index              entry_I;
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( stream, "%s \t\t\t (%s Class)\n", 
+			parentType, ( Stg_ComponentRegister_Get( componentRegister, parentType, "0" ) ? "Concrete" : "Abstract" ) );
+	Stream_Flush( stream );
+	Stream_Indent( stream );
+
+   /* increasing terminating limit by 1 - seems to be right due to comments in HashTable.c ~line 154 */
+	for ( entry_I = 0 ; entry_I < self->max+1 ; entry_I++ ) {
+		hashTableEntry = self->entries[ entry_I ];
+
+		while( hashTableEntry ){
+			if ( (Type) hashTableEntry->data == parentType ) {
+				HierarchyTable_PrintChildren( self, (Type)hashTableEntry->key, stream );
+			}
+			hashTableEntry = hashTableEntry->next;
+		}
+
+	}
+	Stream_UnIndent( stream );
+}
+
+Bool Stg_Class_CompareType( const void* classPtr, Type possibleParentType ) {
+	Stg_Class* self = (Stg_Class*) classPtr;
+	/* Check if the pointer is null */
+	Journal_Firewall(
+		self != NULL,
+		Journal_Register( Error_Type, HierarchyTable_Type ),
+		"Error doing type checking against possibleParentType %s - pointer is NULL.\n",
+		possibleParentType );
+
+	return( Stg_Class_IsInstance( self, possibleParentType ) );
+}
+
+Stg_Class* Stg_Class_CheckType( const void* classPtr, Type possibleParentType ) {
+	Stg_Class* self = (Stg_Class*) classPtr;
+	/* Check if the pointer is null */
+	Journal_Firewall(
+		self != NULL,
+		Journal_Register( Error_Type, HierarchyTable_Type ),
+		"Error doing type checking against possibleParentType %s - pointer is NULL.\n",
+		possibleParentType );
+	
+	if ( ! Stg_Class_IsInstance( self, possibleParentType ) ) {
+		Stream* stream = Journal_Register( Error_Type, HierarchyTable_Type );
+		
+		Journal_Printf( stream, "Error doing type checking:\nTrying to cast " );
+
+		/* Give the user the name of the object if you can */
+		if ( Stg_Class_IsInstance( classPtr, Stg_Object_Type ) ) 
+			Journal_Printf( stream, "'%s' ", ((Stg_Object*)classPtr)->name );
+		else 		
+			Journal_Printf( stream, "pointer '%p' ", classPtr );
+
+		Journal_Printf( stream, 
+				"as '%s' when it is actually of type '%s'.\n",
+				possibleParentType, self->type );
+		
+		PrintParents( possibleParentType, stream );
+		
+		Journal_Firewall( 
+			0,
+			stream, 
+			"Either the HierarchyTable for this class is incorrect or this object has been cast incorrectly.\n" );
+	}
+	return self;
+}
+
+Type HierarchyTable_GetTypePtrFromName( void* hierarchyTable, Name typeName ) {
+	HierarchyTable*    self     = (HierarchyTable*) hierarchyTable;
+	HashTable_Entry*   hashTableEntry;
+	Index              entry_I;
+
+	for ( entry_I = 0 ; entry_I < self->max ; entry_I++ ) {
+		hashTableEntry = self->entries[ entry_I ];
+
+		while( hashTableEntry ){
+			if ( strcmp( (Type) hashTableEntry->key, typeName ) == 0 )
+				return (Type) hashTableEntry->key;
+		
+			hashTableEntry = hashTableEntry->next;
+		}
+
+	}
+	return NULL;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Init.c
--- a/Base/Automation/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 4153 2007-07-26 02:25:22Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Init.h"
-#include "Stg_Component.h"
-#include "Stg_ComponentRegister.h"
-#include "Stg_ComponentFactory.h"
-#include "HierarchyTable.h"
-#include "CallGraph.h"
-
-#include <stdio.h>
-
-Bool BaseAutomation_Init( int* argc, char** argv[] ) 
-{
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-	/** Initializing the Component Register singleton */
-	stgComponentRegister = Stg_ComponentRegister_New( );
-	
-	/** Initializing the Hierarchy Table singleton */
-	stgHierarchyTable = HierarchyTable_New();
-
-	/** Initializing the Call Graph singleton */
-	stgCallGraph = Stg_CallGraph_New();
-
-	/** Initializing the ComponentRegister singleton */
-	
-	/** Register Parents for All Classes */
-	RegisterParent( Stg_ComponentFactory_Type,           Stg_Class_Type );
-	RegisterParent( Stg_ComponentRegister_Type,          Stg_Class_Type );
-	RegisterParent( Stg_Component_Type,                  Stg_Object_Type );
-	RegisterParent( HierarchyTable_Type,             HashTable_Type );
-	RegisterParent( Stg_CallGraph_Type,              Stg_Class_Type );
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,73 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 4153 2007-07-26 02:25:22Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Init.h"
+#include "Stg_Component.h"
+#include "Stg_ComponentRegister.h"
+#include "Stg_ComponentFactory.h"
+#include "HierarchyTable.h"
+#include "CallGraph.h"
+
+#include <stdio.h>
+
+Bool BaseAutomation_Init( int* argc, char** argv[] ) 
+{
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+	/** Initializing the Component Register singleton */
+	stgComponentRegister = Stg_ComponentRegister_New( );
+	
+	/** Initializing the Hierarchy Table singleton */
+	stgHierarchyTable = HierarchyTable_New();
+
+	/** Initializing the Call Graph singleton */
+	stgCallGraph = Stg_CallGraph_New();
+
+	/** Initializing the ComponentRegister singleton */
+	
+	/** Register Parents for All Classes */
+	RegisterParent( Stg_ComponentFactory_Type,           Stg_Class_Type );
+	RegisterParent( Stg_ComponentRegister_Type,          Stg_Class_Type );
+	RegisterParent( Stg_Component_Type,                  Stg_Object_Type );
+	RegisterParent( HierarchyTable_Type,             HashTable_Type );
+	RegisterParent( Stg_CallGraph_Type,              Stg_Class_Type );
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/LiveComponentRegister.c
--- a/Base/Automation/src/LiveComponentRegister.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: LiveComponentRegister.c 2745 2005-05-10 08:12:18Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Stg_Component.h"
-#include "LiveComponentRegister.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Textual name of this class */
-const Type LiveComponentRegister_Type = "LiveComponentRegister";
-LiveComponentRegister* stgLiveComponentRegister = NULL;
-
-LiveComponentRegister* _LiveComponentRegister_New(  LIVECOMPONENTREGISTER_DEFARGS  )
-{
-	LiveComponentRegister *self = NULL;
-
-	assert( _sizeOfSelf >= sizeof( LiveComponentRegister ) );
-	self = (LiveComponentRegister*) _Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	return self;
-}
-	
-LiveComponentRegister* LiveComponentRegister_New(  )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof( LiveComponentRegister );
-	Type                              type = LiveComponentRegister_Type;
-	Stg_Class_DeleteFunction*      _delete = _LiveComponentRegister_Delete;
-	Stg_Class_PrintFunction*        _print = _LiveComponentRegister_Print;
-
-	LiveComponentRegister *self = NULL;
-
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_Class_CopyFunction*  _copy = NULL;
-
-	self = _LiveComponentRegister_New(  LIVECOMPONENTREGISTER_PASSARGS  );
-
-	LiveComponentRegister_Init( self );
-
-	if ( !stgLiveComponentRegister ) {
-		stgLiveComponentRegister = self;
-	}
-	return self;
-}
-
-void _LiveComponentRegister_Init( LiveComponentRegister *self )
-{
-}
-	
-void LiveComponentRegister_Init( LiveComponentRegister *self )
-{
-	assert( self );
-
-	self->componentList = Stg_ObjectList_New( );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _LiveComponentRegister_Delete( void* liveComponentRegister )
-{
-	LiveComponentRegister *self = (LiveComponentRegister *) liveComponentRegister;
-
-	assert( self );
-
-/* 	 TODO: add some debug printing about this... */
-	LiveComponentRegister_DeleteAll( self );
-	Stg_Class_Delete( self->componentList );
-
-	/* Note: this has to come after the LCRegister delete all, in case any of the
-	components need to refer to it as part of their delete phase */
-	if ( stgLiveComponentRegister == self ) {
-		stgLiveComponentRegister = NULL;
-	}
-
-	_Stg_Class_Delete( self );
-}
-
-void _LiveComponentRegister_Print( void* liveComponentRegister, Stream* stream )
-{
-	LiveComponentRegister *self = (LiveComponentRegister *) liveComponentRegister;
-
-	assert( self );
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "LiveComponentRegister (ptr): %p\n", self );
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-	
-	Journal_Printf( (void*) stream, "componentList (ptr): %p\n", self->componentList );
-	Stg_Class_Print( self->componentList, stream );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-Index LiveComponentRegister_Add( LiveComponentRegister *self, Stg_Component *component )
-{
-	assert( self );
-	return Stg_ObjectList_Append( self->componentList, component );
-}
-	
-Stg_Component *LiveComponentRegister_Get( LiveComponentRegister *self, Name name )
-{
-	assert( self );
-	
-	return ( Stg_Component* ) Stg_ObjectList_Get( self->componentList, name );
-}
-
-Stg_Component *LiveComponentRegister_At( void* liveComponentRegister, Index index ) {
-	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
-	assert( self );
-
-	return ( Stg_Component* ) Stg_ObjectList_At( self->componentList, index );
-}
-
-
-Index LiveComponentRegister_RemoveOneComponentsEntry( void* liveComponentRegister, Name name ) {
-	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
-	assert( self );
-
-	/* Note: as specified in the header, we don't want to actually delete the component, just
-	the entry */
-	return Stg_ObjectList_Remove( self->componentList, name, KEEP );
-}
-
-	
-unsigned int LiveComponentRegister_GetCount( LiveComponentRegister *self )
-{
-	assert( self );
-
-	return self->componentList->count;
-}
-
-
-void LiveComponentRegister_BuildAll( void* liveComponentRegister, void* data ) {
-	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
-	Stg_Component*             component;
-	Index                  index;
-	Index                  count     = LiveComponentRegister_GetCount( self );
-	
-	for ( index = 0 ; index < count ; index++ ) {
-		component = LiveComponentRegister_At( self, index );
-		Stg_Component_Build( component, data, False );
-	}
-}
-
-
-void LiveComponentRegister_InitialiseAll( void* liveComponentRegister, void* data ) {
-	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
-	Stg_Component*             component;
-	Index                  index;
-	Index                  count     = LiveComponentRegister_GetCount( self );
-	
-	for ( index = 0 ; index < count ; index++ ) {
-		component = LiveComponentRegister_At( self, index );
-		Stg_Component_Initialise( component, data, False );
-	}
-}
-
-
-void LiveComponentRegister_DeleteAll( void* liveComponentRegister ) {
-	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
-	Stg_Component*             component;
-	Index                  index;
-	
-	/* Note: have to recompute count dynamically each loop in case a component deletes
-	some other components */
-	for ( index = 0 ; index < LiveComponentRegister_GetCount( self ) ; index++ ) {
-		component = LiveComponentRegister_At( self, index );
-/* 		printf( "Freeing component \"%s\" (type %s)\n", component->name, component->type ); */
-		Stg_Class_Delete( component );
-	}
-	self->componentList->count = 0;
-}
-
-
-LiveComponentRegister* LiveComponentRegister_GetLiveComponentRegister() {
-	return stgLiveComponentRegister;
-}
-
-void LiveComponentRegister_PrintSimilar( void* liveComponentRegister, Name name, Stream* stream, unsigned int number ) {
-	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
-
-	Stg_ObjectList_PrintSimilar( self->componentList, name, stream, number );
-}
-
-void LiveComponentRegister_DestroyAll( void* lcReg ) {
-   LiveComponentRegister* self = (LiveComponentRegister *) lcReg;
-	Stg_Component* component;
-	unsigned index;
-	
-	/* Note, if a Component is already Destroyed the, isDestroyed flag should protect the
-      code from running the _Destroy function again */
-	for ( index = 0 ; index < LiveComponentRegister_GetCount( self ) ; index++ ) {
-		component = LiveComponentRegister_At( self, index );
-		Stg_Component_Destroy( component, NULL, False );
-	}
-
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/LiveComponentRegister.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/LiveComponentRegister.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,249 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: LiveComponentRegister.c 2745 2005-05-10 08:12:18Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Stg_Component.h"
+#include "LiveComponentRegister.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Textual name of this class */
+const Type LiveComponentRegister_Type = "LiveComponentRegister";
+LiveComponentRegister* stgLiveComponentRegister = NULL;
+
+LiveComponentRegister* _LiveComponentRegister_New(  LIVECOMPONENTREGISTER_DEFARGS  )
+{
+	LiveComponentRegister *self = NULL;
+
+	assert( _sizeOfSelf >= sizeof( LiveComponentRegister ) );
+	self = (LiveComponentRegister*) _Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	return self;
+}
+	
+LiveComponentRegister* LiveComponentRegister_New(  )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof( LiveComponentRegister );
+	Type                              type = LiveComponentRegister_Type;
+	Stg_Class_DeleteFunction*      _delete = _LiveComponentRegister_Delete;
+	Stg_Class_PrintFunction*        _print = _LiveComponentRegister_Print;
+
+	LiveComponentRegister *self = NULL;
+
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_Class_CopyFunction*  _copy = NULL;
+
+	self = _LiveComponentRegister_New(  LIVECOMPONENTREGISTER_PASSARGS  );
+
+	LiveComponentRegister_Init( self );
+
+	if ( !stgLiveComponentRegister ) {
+		stgLiveComponentRegister = self;
+	}
+	return self;
+}
+
+void _LiveComponentRegister_Init( LiveComponentRegister *self )
+{
+}
+	
+void LiveComponentRegister_Init( LiveComponentRegister *self )
+{
+	assert( self );
+
+	self->componentList = Stg_ObjectList_New( );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _LiveComponentRegister_Delete( void* liveComponentRegister )
+{
+	LiveComponentRegister *self = (LiveComponentRegister *) liveComponentRegister;
+
+	assert( self );
+
+/* 	 TODO: add some debug printing about this... */
+	LiveComponentRegister_DeleteAll( self );
+	Stg_Class_Delete( self->componentList );
+
+	/* Note: this has to come after the LCRegister delete all, in case any of the
+	components need to refer to it as part of their delete phase */
+	if ( stgLiveComponentRegister == self ) {
+		stgLiveComponentRegister = NULL;
+	}
+
+	_Stg_Class_Delete( self );
+}
+
+void _LiveComponentRegister_Print( void* liveComponentRegister, Stream* stream )
+{
+	LiveComponentRegister *self = (LiveComponentRegister *) liveComponentRegister;
+
+	assert( self );
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "LiveComponentRegister (ptr): %p\n", self );
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+	
+	Journal_Printf( (void*) stream, "componentList (ptr): %p\n", self->componentList );
+	Stg_Class_Print( self->componentList, stream );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+Index LiveComponentRegister_Add( LiveComponentRegister *self, Stg_Component *component )
+{
+	assert( self );
+	return Stg_ObjectList_Append( self->componentList, component );
+}
+	
+Stg_Component *LiveComponentRegister_Get( LiveComponentRegister *self, Name name )
+{
+	assert( self );
+	
+	return ( Stg_Component* ) Stg_ObjectList_Get( self->componentList, name );
+}
+
+Stg_Component *LiveComponentRegister_At( void* liveComponentRegister, Index index ) {
+	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
+	assert( self );
+
+	return ( Stg_Component* ) Stg_ObjectList_At( self->componentList, index );
+}
+
+
+Index LiveComponentRegister_RemoveOneComponentsEntry( void* liveComponentRegister, Name name ) {
+	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
+	assert( self );
+
+	/* Note: as specified in the header, we don't want to actually delete the component, just
+	the entry */
+	return Stg_ObjectList_Remove( self->componentList, name, KEEP );
+}
+
+	
+unsigned int LiveComponentRegister_GetCount( LiveComponentRegister *self )
+{
+	assert( self );
+
+	return self->componentList->count;
+}
+
+
+void LiveComponentRegister_BuildAll( void* liveComponentRegister, void* data ) {
+	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
+	Stg_Component*             component;
+	Index                  index;
+	Index                  count     = LiveComponentRegister_GetCount( self );
+	
+	for ( index = 0 ; index < count ; index++ ) {
+		component = LiveComponentRegister_At( self, index );
+		Stg_Component_Build( component, data, False );
+	}
+}
+
+
+void LiveComponentRegister_InitialiseAll( void* liveComponentRegister, void* data ) {
+	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
+	Stg_Component*             component;
+	Index                  index;
+	Index                  count     = LiveComponentRegister_GetCount( self );
+	
+	for ( index = 0 ; index < count ; index++ ) {
+		component = LiveComponentRegister_At( self, index );
+		Stg_Component_Initialise( component, data, False );
+	}
+}
+
+
+void LiveComponentRegister_DeleteAll( void* liveComponentRegister ) {
+	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
+	Stg_Component*             component;
+	Index                  index;
+	
+	/* Note: have to recompute count dynamically each loop in case a component deletes
+	some other components */
+	for ( index = 0 ; index < LiveComponentRegister_GetCount( self ) ; index++ ) {
+		component = LiveComponentRegister_At( self, index );
+/* 		printf( "Freeing component \"%s\" (type %s)\n", component->name, component->type ); */
+		Stg_Class_Delete( component );
+	}
+	self->componentList->count = 0;
+}
+
+
+LiveComponentRegister* LiveComponentRegister_GetLiveComponentRegister() {
+	return stgLiveComponentRegister;
+}
+
+void LiveComponentRegister_PrintSimilar( void* liveComponentRegister, Name name, Stream* stream, unsigned int number ) {
+	LiveComponentRegister* self      = (LiveComponentRegister *) liveComponentRegister;
+
+	Stg_ObjectList_PrintSimilar( self->componentList, name, stream, number );
+}
+
+void LiveComponentRegister_DestroyAll( void* lcReg ) {
+   LiveComponentRegister* self = (LiveComponentRegister *) lcReg;
+	Stg_Component* component;
+	unsigned index;
+	
+	/* Note, if a Component is already Destroyed the, isDestroyed flag should protect the
+      code from running the _Destroy function again */
+	for ( index = 0 ; index < LiveComponentRegister_GetCount( self ) ; index++ ) {
+		component = LiveComponentRegister_At( self, index );
+		Stg_Component_Destroy( component, NULL, False );
+	}
+
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Meta.c
--- a/Base/Automation/src/Meta.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-*/
-/** \file
-**  Role:
-**	Funtions to obtain a components meta information from a dictionary
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: Stg_ComponentMeta.h 3367 2005-12-09 07:39:53Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "Automation.h"
-
-/* Info parts --------------------------------------------------------------------------------------------------------------------*/
-
-char* Stg_Meta_GetType( Dictionary* dictionary ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"title" ) );
-}
-
-char* Stg_Meta_GetCreator( Dictionary* dictionary  ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"creator" ) );
-}
-
-char* Stg_Meta_GetPublisher( Dictionary* dictionary  ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"publisher" ) );
-}
-
-char* Stg_Meta_GetRights( Dictionary* dictionary  ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"rights" ) );
-}
-
-char* Stg_Meta_GetSource( Dictionary* dictionary  ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"source" ) );
-}
-
-char* Stg_Meta_GetSubject( Dictionary* dictionary  ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"subject" ) );
-}
-
-char* Stg_Meta_GetDescription( Dictionary* dictionary  ) {
-	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"description" ) );
-}
-
-
-/* Code parts --------------------------------------------------------------------------------------------------------------------*/
-
-char* Stg_Meta_GetExampleDocumentation( Dictionary* dictionary  ) {
-	Dictionary* code = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"code" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( code, (Dictionary_Entry_Key)"example-documentation" ) );
-}
-
-char* Stg_Meta_GetExampleCode( Dictionary* dictionary  ) {
-	Dictionary* code = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"code" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( code, (Dictionary_Entry_Key)"example-code" ) );
-}
-
-char* Stg_Meta_GetInherits( Dictionary* dictionary  ) {
-	Dictionary* code = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"code" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( code, (Dictionary_Entry_Key)"inherits" ) );
-}
-
-
-/* Implements parts --------------------------------------------------------------------------------------------------------------*/
-
-char* Stg_Meta_GetReference( Dictionary* dictionary  ) {
-	Dictionary* implements = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"implements" )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( implements, (Dictionary_Entry_Key)"reference" ) );
-}
-
-char* Stg_Meta_GetEquation( Dictionary* dictionary  ) {
-	Dictionary* implements = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"implements"  )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( implements, (Dictionary_Entry_Key)"equation" ) );
-}
-
-
-/* Parameter parts ---------------------------------------------------------------------------------------------------------------*/
-
-Index Stg_Meta_GetParameterCount( Dictionary* dictionary  ) {
-	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" ) );
-	return Dictionary_GetCount( parameters  );
-}
-
-char* Stg_Meta_GetParameterName( Dictionary* dictionary, Index i ) {
-	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
-	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"name" )  );
-}
-
-char* Stg_Meta_GetParameterType( Dictionary* dictionary, Index i ) {
-	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
-	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"type" )  );
-}
-
-char* Stg_Meta_GetParameterDefault( Dictionary* dictionary, Index i ) {
-	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
-	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"default" )  );
-}
-
-char* Stg_Meta_GetParameterDocumentation( Dictionary* dictionary, Index i ) {
-	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
-	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"documentation" ) );
-}
-
-
-/* Association parts -------------------------------------------------------------------------------------------------------------*/
-
-Index Stg_Meta_GetAssociationCount( Dictionary* dictionary  ) {
-	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" ) );
-	return Dictionary_GetCount( associations  );
-}
-
-char* Stg_Meta_GetAssociationName( Dictionary* dictionary, Index i ) {
-	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
-	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"name" )  );
-}
-
-char* Stg_Meta_GetAssociationType( Dictionary* dictionary, Index i ) {
-	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
-	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"type" )  );
-}
-
-char* Stg_Meta_GetAssociationNillable( Dictionary* dictionary, Index i ) {
-	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
-	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"nillable" )  );
-}
-
-char* Stg_Meta_GetAssociationDocumentation( Dictionary* dictionary, Index i ) {
-	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
-	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
-	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"documentation" )  );
-}
-
-/* Print function ----------------------------------------------------------------------------------------------------------------*/
-void Stg_Meta_Print( Dictionary* dictionary, Stream* stream ) {
-	Index i;
-	char* str;
-
-	/* Info parts */
-	Journal_Printf( stream, "Type: %s\n", (str = Stg_Meta_GetType( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Creator: %s\n", (str = Stg_Meta_GetCreator( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Publisher: %s\n", (str = Stg_Meta_GetPublisher( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Rights: %s\n", (str = Stg_Meta_GetRights( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Source: %s\n", (str = Stg_Meta_GetSource( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Subject: %s\n", (str = Stg_Meta_GetSubject( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Description: %s\n", (str = Stg_Meta_GetDescription( dictionary )) ? str : "(not provided)" );
-
-	/* Code parts */
-	Journal_Printf( stream, "Example documentation: %s\n", (str = Stg_Meta_GetExampleDocumentation( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Example code: %s\n", (str = Stg_Meta_GetExampleCode( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Inherits: %s\n", (str = Stg_Meta_GetInherits( dictionary )) ? str : "Stg_Component (assumed)" );
-
-	/* Implements parts */
-	Journal_Printf( stream, "Reference: %s\n", (str = Stg_Meta_GetReference( dictionary )) ? str : "(not provided)" );
-	Journal_Printf( stream, "Equation: %s\n", (str = Stg_Meta_GetEquation( dictionary )) ? str : "(not provided)" );
-
-	/* Parameter parts */
-	Journal_Printf( stream, "Parameters:\n" );
-	Stream_Indent( stream );
-	for ( i = 0; i < Stg_Meta_GetParameterCount( dictionary ); i++ ) {
-		Journal_Printf( stream, "{\n" );
-		Stream_Indent( stream );
-		Journal_Printf( stream, "Type: %s\n", (str = Stg_Meta_GetParameterType( dictionary, i )) ? str : "(not provided)" );
-		Journal_Printf( stream, "Name: %s\n", (str = Stg_Meta_GetParameterName( dictionary, i )) ? str : "(not provided)" );
-		Journal_Printf( stream, "Default: %s\n", (str = Stg_Meta_GetParameterDefault( dictionary, i )) ? str : "(not provided)" );
-		Journal_Printf( stream, "Documentation: %s\n", (str = Stg_Meta_GetParameterDocumentation( dictionary, i )) ? str : "(not provided)" );
-		Stream_UnIndent( stream );
-		Journal_Printf( stream, "}\n" );
-	}
-	Stream_UnIndent( stream );
-	
-	/* Association parts */
-	Journal_Printf( stream, "Associations:\n" );
-	Stream_Indent( stream );
-	for ( i = 0; i < Stg_Meta_GetAssociationCount( dictionary ); i++ ) {
-		Journal_Printf( stream, "{\n" );
-		Stream_Indent( stream );
-		Journal_Printf( stream, "Type: %s\n", (str = Stg_Meta_GetAssociationType( dictionary, i )) ? str : "(not provided)" );
-		Journal_Printf( stream, "Name: %s\n", (str = Stg_Meta_GetAssociationName( dictionary, i )) ? str : "(not provided)" );
-		Journal_Printf( stream, "Nillable: %s\n", (str = Stg_Meta_GetAssociationNillable( dictionary, i )) ? str : "(not provided)" );
-		Journal_Printf( stream, "Documentation: %s\n", (str = Stg_Meta_GetAssociationDocumentation( dictionary, i )) ? str : "(not provided)" );
-		Stream_UnIndent( stream );
-		Journal_Printf( stream, "}\n" );
-	}
-	Stream_UnIndent( stream );
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Meta.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Meta.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,234 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role:
+**	Funtions to obtain a components meta information from a dictionary
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Stg_ComponentMeta.h 3367 2005-12-09 07:39:53Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "Automation.h"
+
+/* Info parts --------------------------------------------------------------------------------------------------------------------*/
+
+char* Stg_Meta_GetType( Dictionary* dictionary ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"title" ) );
+}
+
+char* Stg_Meta_GetCreator( Dictionary* dictionary  ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"creator" ) );
+}
+
+char* Stg_Meta_GetPublisher( Dictionary* dictionary  ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"publisher" ) );
+}
+
+char* Stg_Meta_GetRights( Dictionary* dictionary  ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"rights" ) );
+}
+
+char* Stg_Meta_GetSource( Dictionary* dictionary  ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"source" ) );
+}
+
+char* Stg_Meta_GetSubject( Dictionary* dictionary  ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"subject" ) );
+}
+
+char* Stg_Meta_GetDescription( Dictionary* dictionary  ) {
+	Dictionary* info = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"info" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( info, (Dictionary_Entry_Key)"description" ) );
+}
+
+
+/* Code parts --------------------------------------------------------------------------------------------------------------------*/
+
+char* Stg_Meta_GetExampleDocumentation( Dictionary* dictionary  ) {
+	Dictionary* code = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"code" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( code, (Dictionary_Entry_Key)"example-documentation" ) );
+}
+
+char* Stg_Meta_GetExampleCode( Dictionary* dictionary  ) {
+	Dictionary* code = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"code" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( code, (Dictionary_Entry_Key)"example-code" ) );
+}
+
+char* Stg_Meta_GetInherits( Dictionary* dictionary  ) {
+	Dictionary* code = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"code" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( code, (Dictionary_Entry_Key)"inherits" ) );
+}
+
+
+/* Implements parts --------------------------------------------------------------------------------------------------------------*/
+
+char* Stg_Meta_GetReference( Dictionary* dictionary  ) {
+	Dictionary* implements = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"implements" )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( implements, (Dictionary_Entry_Key)"reference" ) );
+}
+
+char* Stg_Meta_GetEquation( Dictionary* dictionary  ) {
+	Dictionary* implements = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"implements"  )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( implements, (Dictionary_Entry_Key)"equation" ) );
+}
+
+
+/* Parameter parts ---------------------------------------------------------------------------------------------------------------*/
+
+Index Stg_Meta_GetParameterCount( Dictionary* dictionary  ) {
+	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" ) );
+	return Dictionary_GetCount( parameters  );
+}
+
+char* Stg_Meta_GetParameterName( Dictionary* dictionary, Index i ) {
+	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
+	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"name" )  );
+}
+
+char* Stg_Meta_GetParameterType( Dictionary* dictionary, Index i ) {
+	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
+	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"type" )  );
+}
+
+char* Stg_Meta_GetParameterDefault( Dictionary* dictionary, Index i ) {
+	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
+	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"default" )  );
+}
+
+char* Stg_Meta_GetParameterDocumentation( Dictionary* dictionary, Index i ) {
+	Dictionary* parameters = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"parameters" )  );
+	Dictionary* parameter = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( parameters, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( parameter, (Dictionary_Entry_Key)"documentation" ) );
+}
+
+
+/* Association parts -------------------------------------------------------------------------------------------------------------*/
+
+Index Stg_Meta_GetAssociationCount( Dictionary* dictionary  ) {
+	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" ) );
+	return Dictionary_GetCount( associations  );
+}
+
+char* Stg_Meta_GetAssociationName( Dictionary* dictionary, Index i ) {
+	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
+	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"name" )  );
+}
+
+char* Stg_Meta_GetAssociationType( Dictionary* dictionary, Index i ) {
+	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
+	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"type" )  );
+}
+
+char* Stg_Meta_GetAssociationNillable( Dictionary* dictionary, Index i ) {
+	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
+	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"nillable" )  );
+}
+
+char* Stg_Meta_GetAssociationDocumentation( Dictionary* dictionary, Index i ) {
+	Dictionary* associations = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, (Dictionary_Entry_Key)"associations" )  );
+	Dictionary* association = Dictionary_Entry_Value_AsDictionary( Dictionary_GetByIndex( associations, i )  );
+	return Dictionary_Entry_Value_AsString( Dictionary_Get( association, (Dictionary_Entry_Key)"documentation" )  );
+}
+
+/* Print function ----------------------------------------------------------------------------------------------------------------*/
+void Stg_Meta_Print( Dictionary* dictionary, Stream* stream ) {
+	Index i;
+	char* str;
+
+	/* Info parts */
+	Journal_Printf( stream, "Type: %s\n", (str = Stg_Meta_GetType( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Creator: %s\n", (str = Stg_Meta_GetCreator( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Publisher: %s\n", (str = Stg_Meta_GetPublisher( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Rights: %s\n", (str = Stg_Meta_GetRights( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Source: %s\n", (str = Stg_Meta_GetSource( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Subject: %s\n", (str = Stg_Meta_GetSubject( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Description: %s\n", (str = Stg_Meta_GetDescription( dictionary )) ? str : "(not provided)" );
+
+	/* Code parts */
+	Journal_Printf( stream, "Example documentation: %s\n", (str = Stg_Meta_GetExampleDocumentation( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Example code: %s\n", (str = Stg_Meta_GetExampleCode( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Inherits: %s\n", (str = Stg_Meta_GetInherits( dictionary )) ? str : "Stg_Component (assumed)" );
+
+	/* Implements parts */
+	Journal_Printf( stream, "Reference: %s\n", (str = Stg_Meta_GetReference( dictionary )) ? str : "(not provided)" );
+	Journal_Printf( stream, "Equation: %s\n", (str = Stg_Meta_GetEquation( dictionary )) ? str : "(not provided)" );
+
+	/* Parameter parts */
+	Journal_Printf( stream, "Parameters:\n" );
+	Stream_Indent( stream );
+	for ( i = 0; i < Stg_Meta_GetParameterCount( dictionary ); i++ ) {
+		Journal_Printf( stream, "{\n" );
+		Stream_Indent( stream );
+		Journal_Printf( stream, "Type: %s\n", (str = Stg_Meta_GetParameterType( dictionary, i )) ? str : "(not provided)" );
+		Journal_Printf( stream, "Name: %s\n", (str = Stg_Meta_GetParameterName( dictionary, i )) ? str : "(not provided)" );
+		Journal_Printf( stream, "Default: %s\n", (str = Stg_Meta_GetParameterDefault( dictionary, i )) ? str : "(not provided)" );
+		Journal_Printf( stream, "Documentation: %s\n", (str = Stg_Meta_GetParameterDocumentation( dictionary, i )) ? str : "(not provided)" );
+		Stream_UnIndent( stream );
+		Journal_Printf( stream, "}\n" );
+	}
+	Stream_UnIndent( stream );
+	
+	/* Association parts */
+	Journal_Printf( stream, "Associations:\n" );
+	Stream_Indent( stream );
+	for ( i = 0; i < Stg_Meta_GetAssociationCount( dictionary ); i++ ) {
+		Journal_Printf( stream, "{\n" );
+		Stream_Indent( stream );
+		Journal_Printf( stream, "Type: %s\n", (str = Stg_Meta_GetAssociationType( dictionary, i )) ? str : "(not provided)" );
+		Journal_Printf( stream, "Name: %s\n", (str = Stg_Meta_GetAssociationName( dictionary, i )) ? str : "(not provided)" );
+		Journal_Printf( stream, "Nillable: %s\n", (str = Stg_Meta_GetAssociationNillable( dictionary, i )) ? str : "(not provided)" );
+		Journal_Printf( stream, "Documentation: %s\n", (str = Stg_Meta_GetAssociationDocumentation( dictionary, i )) ? str : "(not provided)" );
+		Stream_UnIndent( stream );
+		Journal_Printf( stream, "}\n" );
+	}
+	Stream_UnIndent( stream );
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Stg_Component.c
--- a/Base/Automation/src/Stg_Component.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,486 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Stg_Component.c 4288 2008-07-24 05:32:42Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Meta.h"
-#include "Stg_Component.h"
-#include "Stg_ComponentFactory.h"
-#include "LiveComponentRegister.h"
-#include "CallGraph.h"
-
-#include "Stg_ComponentRegister.h"
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/* Textual name of this class */
-const Type Stg_Component_Type = "Stg_Component";
-
-
-Stg_Component* _Stg_Component_New(  STG_COMPONENT_DEFARGS  )
-{
-	Stg_Component* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stg_Component) );
-	self = (Stg_Component*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	self->_defaultConstructor = _defaultConstructor;
-	self->_construct = _construct;
-	self->_build = _build;
-	self->_initialise =  _initialise;
-	self->_execute = _execute;
-	self->_destroy = _destroy;
-	
-	/* Stg_Component info */
-	_Stg_Component_Init( self );
-	
-	return self;
-}
-
-
-void _Stg_Component_Init( Stg_Component* self ) {
-	/* General and Virtual info should already be set */
-	
-	/* Stg_Component info */
-	self->isConstructed = False;
-	self->isBuilt = False;
-	self->isInitialised = False;
-	self->hasExecuted = False;
-	self->isDestroyed = False;
-	self->constructType = Stg_Object_AppendSuffix( self, "Construct" );
-	self->buildType = Stg_Object_AppendSuffix( self, "Build" );
-	self->initialiseType = Stg_Object_AppendSuffix( self, "Initialise" );
-	self->executeType = Stg_Object_AppendSuffix( self, "Execute" );
-	self->destroyType = Stg_Object_AppendSuffix( self, "Destroy" );
-}
-
-
-void _Stg_Component_Delete( void* component ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-   /* just make sure the component is destroyed */
- 	Stg_Component_Destroy( self, NULL, False );
-	
-	Memory_Free( self->destroyType );
-	Memory_Free( self->executeType );
-	Memory_Free( self->initialiseType );
-	Memory_Free( self->buildType );
-	Memory_Free( self->constructType );
-
-	/* Stg_Class_Delete parent class */
-	_Stg_Object_Delete( self );
-}
-
-
-void _Stg_Component_Print( void* component, Stream* stream ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Stg_Component (ptr): %p\n", self );
-	
-	/* Print parent class */
-	_Stg_Object_Print( self, stream );
-	
-	/* Virtual info */
-	Journal_Printf( (void*) stream, "\t_defaultConstructor (func ptr): %p\n", self->_defaultConstructor );
-	Journal_Printf( (void*) stream, "\t_construct (func ptr): %p\n", self->_construct );
-	
-	Journal_Printf( (void*) stream, "\t_initialise (func ptr): %p\n", self->_initialise );
-	Journal_Printf( (void*) stream, "\t_execute (func ptr): %p\n", self->_execute );
-	Journal_Printf( (void*) stream, "\t_destroy (func ptr): %p\n", self->_destroy );
-	
-	/* Stg_Component */
-	Journal_Printf( (void*) stream, "\tisConstructed: %s\n", self->isConstructed ? "True" : "False" );
-	Journal_Printf( (void*) stream, "\tisBuilt: %s\n", self->isBuilt ? "True" : "False" );
-	Journal_Printf( (void*) stream, "\tisInitialised: %s\n", self->isInitialised ? "True" : "False" );
-	Journal_Printf( (void*) stream, "\thasExecuted: %s\n", self->hasExecuted ? "True" : "False" );
-	Journal_Printf( (void*) stream, "\tisDestroyed: %s\n", self->isDestroyed ? "True" : "False" );
-
-	Journal_Printf( (void*) stream, "\tconstructor function name: %s\n", self->constructType );
-	Journal_Printf( (void*) stream, "\tbuild function name: %s\n", self->buildType );
-	Journal_Printf( (void*) stream, "\tinitialise function name: %s\n", self->initialiseType );
-	Journal_Printf( (void*) stream, "\texecute function name: %s\n", self->executeType );
-	Journal_Printf( (void*) stream, "\tdestroy function name: %s\n", self->destroyType );
-}
-
-void* _Stg_Component_Copy( const void* component, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_Component*	self = (Stg_Component*)component;
-	Stg_Component*	newComponent;
-	
-	newComponent = (Stg_Component*)_Stg_Object_Copy( component, dest, deep, nameExt, ptrMap );
-	
-	/* Virtual methods */
-	newComponent->_defaultConstructor = self->_defaultConstructor;
-	newComponent->_construct = self->_construct;
-	newComponent->_build = self->_build;
-	newComponent->_initialise = self->_initialise;
-	newComponent->_execute = self->_execute;
-	newComponent->_destroy = self->_destroy;
-	
-	newComponent->isConstructed = self->isConstructed;
-	newComponent->isBuilt = self->isBuilt;
-	newComponent->isInitialised = self->isInitialised;
-	newComponent->hasExecuted = self->hasExecuted;
-	newComponent->isDestroyed = self->isDestroyed;
-	
-	newComponent->constructType = StG_Strdup( self->constructType );
-	newComponent->buildType = StG_Strdup( self->buildType );
-	newComponent->initialiseType = StG_Strdup( self->initialiseType );
-	newComponent->executeType = StG_Strdup( self->executeType );
-	newComponent->destroyType = StG_Strdup( self->destroyType );
-
-	if ( LiveComponentRegister_GetLiveComponentRegister() ) {
-		LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), newComponent );
-		Memory_CountInc( newComponent );	/* Live register now has a refernce to it */
-	}
-
-	return newComponent;
-}
-
-void Stg_Component_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data, Bool force ) {
-	Stg_Component* self   = (Stg_Component*)component;
-
-	assert( self );
-	
-	if( force || !self->isConstructed ) {
-		/*Stg_TimeMonitor* tm;
-		Stg_MemMonitor*  mm;
-		char*            buf;*/
-		
-		Stream* stream = Journal_Register( Info_Type, "Stg_ComponentFactory" );
-
-		Journal_RPrintf( stream, "Constructing %s..\n", self->name );
-		Stream_Indent( stream );
-		
-		/*buf = Stg_Object_AppendSuffix( self, "Construct" );
-		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
-		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
-	
-		Stg_MemMonitor_Begin( mm );
-		Stg_TimeMonitor_Begin( tm );*/
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Push( stgCallGraph, self->_construct, self->constructType );
-		#endif
-		
-		if ( !self->isConstructed ) {
-			Stg_Component_SetupStreamFromDictionary( 
-				self, 
-				Dictionary_GetDictionary( cf->componentDict, self->name ) );
-		}
-		
-		self->isConstructed = True;
-		self->_construct( self, cf, data );
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Pop( stgCallGraph );
-		#endif
-		
-		/*Stg_TimeMonitor_End( tm );
-		Stg_MemMonitor_End( mm );
-	
-		Stg_TimeMonitor_Delete( tm );
-		Stg_MemMonitor_Delete( mm );
-
-		Memory_Free( buf );*/
-		
-		Stream_UnIndent( stream );
-	}
-}
-
-void Stg_Component_Build( void* component, void* data, Bool force ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	if( force || !self->isBuilt ) {
-		/*Stg_TimeMonitor* tm;
-		Stg_MemMonitor*  mm;
-		char*            buf;
-		
-		buf = Stg_Object_AppendSuffix( self, "Build" );
-		
-		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
-		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
-	
-		Stg_MemMonitor_Begin( mm );
-		Stg_TimeMonitor_Begin( tm );*/
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Push( stgCallGraph, self->_build, self->buildType );
-		#endif
-		
-		self->_build( self, data );
-		self->isBuilt = True;
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Pop( stgCallGraph );
-		#endif
-		
-		/*Stg_TimeMonitor_End( tm );
-		Stg_MemMonitor_End( mm );
-	
-		Stg_TimeMonitor_Delete( tm );
-		Stg_MemMonitor_Delete( mm );
-
-		Memory_Free( buf );*/
-	}
-}
-
-void Stg_Component_Initialise( void* component, void* data, Bool force ) {
-	Stg_Component* self = (Stg_Component*)component;
-
-	if( force || !self->isInitialised ) {
-		/*Stg_TimeMonitor* tm;
-		Stg_MemMonitor*  mm;
-		char*            buf;
-		
-		buf = Stg_Object_AppendSuffix( self, "Initialise" );
-		
-		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
-		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
-	
-		Stg_MemMonitor_Begin( mm );
-		Stg_TimeMonitor_Begin( tm );*/
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Push( stgCallGraph, self->_initialise, self->initialiseType );
-		#endif
-		
-		self->isInitialised = True;
-		self->_initialise( self, data );
-		
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Pop( stgCallGraph );
-		#endif
-		
-		/*Stg_TimeMonitor_End( tm );
-		Stg_MemMonitor_End( mm );
-	
-		Stg_TimeMonitor_Delete( tm );
-		Stg_MemMonitor_Delete( mm );
-		
-		Memory_Free( buf );*/
-	}
-}
-
-void Stg_Component_Execute( void* component, void* data, Bool force ) {
-	Stg_Component* self = (Stg_Component*)component;
-	if( force || !self->hasExecuted ) {
-		/*Stg_TimeMonitor* tm;
-		Stg_MemMonitor*  mm;
-		char*            buf;
-		
-		buf = Stg_Object_AppendSuffix( self, "Execute" );
-		
-		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
-		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
-	
-		Stg_MemMonitor_Begin( mm );
-		Stg_TimeMonitor_Begin( tm );*/
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Push( stgCallGraph, self->_execute, self->executeType );
-		#endif
-		
-		self->_execute( self, data );
-		self->hasExecuted = True;
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Pop( stgCallGraph );
-		#endif
-		
-		/*Stg_TimeMonitor_End( tm );
-		Stg_MemMonitor_End( mm );
-	
-		Stg_TimeMonitor_Delete( tm );
-		Stg_MemMonitor_Delete( mm );	
-		
-		Memory_Free( buf );*/
-	}
-}
-
-void Stg_Component_Destroy( void* component, void* data, Bool force ) {
-	Stg_Component* self = (Stg_Component*)component;
-
-	if( /* TODO: once the refCounters are implemented there is no longeer a need to check self|| */ self && !self->isDestroyed ) {
-		/*Stg_TimeMonitor*	tm;
-		Stg_MemMonitor*		mm;
-		char*						buf;
-		
-		buf = Stg_Object_AppendSuffix( self, "Destroy" );
-		
-		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
-		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
-	
-		Stg_MemMonitor_Begin( mm );
-		Stg_TimeMonitor_Begin( tm );*/
-		
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Push( stgCallGraph, self->_destroy, self->destroyType );
-		#endif
-		
-		self->isDestroyed = True;
-
-      if( self->_destroy )
-         self->_destroy( self, data );
-
-		#ifdef USE_PROFILE
-			Stg_CallGraph_Pop( stgCallGraph );
-		#endif
-		
-		/*Stg_TimeMonitor_End( tm );
-		Stg_MemMonitor_End( mm );
-	
-		Stg_TimeMonitor_Delete( tm );
-		Stg_MemMonitor_Delete( mm );
-		Memory_Free( buf );*/
-	}
-}
-
-/* TODO: UPT TO HERE */
-
-Bool Stg_Component_IsConstructed( void* component ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	return self->isConstructed;
-}
-
-Bool Stg_Component_IsBuilt( void* component ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	return self->isBuilt;
-}
-
-Bool Stg_Component_IsInitialised( void* component ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	return self->isInitialised;
-}
-
-Bool Stg_Component_HasExecuted( void* component ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	return self->hasExecuted;
-}
-
-Bool Stg_Component_IsDestroyed( void* component ) {
-	Stg_Component* self = (Stg_Component*)component;
-	
-	return self->isDestroyed;
-}
-
-
-void Stg_Component_SetupStreamFromDictionary( void* component, Dictionary* dictionary ) {
-	Stg_Component* self = (Stg_Component*)component;
-
-	Index index;
-	Bool valid;
-
-	char* keyCopy;
-	char* operation;
-	char* streamType;
-
-	Stream* stream;
-
-	if ( dictionary == NULL ) {
-		return;
-	}
-	
-	/* Iterate through the whole dictionary, checking for journal related commands */
-	for ( index = 0; index < dictionary->count; ++index ) {
-		/* Check to see if it is a journal operation by searching for the JOURNAL_KEY. */
-		if ( (strncasecmp( dictionary->entryPtr[index]->key, JOURNAL_KEY, strlen(JOURNAL_KEY))) == 0 ) {
-			
-			keyCopy = StG_Strdup( dictionary->entryPtr[index]->key );
-
-			operation = strtok( keyCopy, JOURNAL_DELIMITER );
-			streamType = strtok( NULL, JOURNAL_DELIMITER );
-
-			if ( streamType == NULL ) {
-                          stream = Journal_MyStream( Info_Type, self );
-			}
-                        else {
-                          stream = Journal_MyStream( streamType, self );
-                        }
-
-			valid = True;
-			if ( strcmp( operation, JOURNAL_ENABLE_KEY ) == 0 ) {
-				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
-				Stream_Enable( stream, enable );
-			}
-			else if ( strcmp( operation, JOURNAL_ENABLE_BRANCH_KEY ) == 0 ) {
-				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
-				Stream_EnableBranch( stream, enable );
-			}
-			else if ( strcmp( operation, JOURNAL_LEVEL_KEY ) == 0 ) {
-				JournalLevel level = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
-				Stream_SetLevelBranch( stream, level );
-			}
-			else if ( strcmp( operation, JOURNAL_RANK_KEY ) == 0 ) {
-				int rank = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
-				Stream_SetPrintingRank( stream, rank );
-			}
-			else if ( strcmp( operation, JOURNAL_FLUSH_KEY ) == 0 ) {
-				Bool flush = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
-				Stream_SetAutoFlush( stream, flush );
-			}
-			else {
-				valid = False;
-			}
-
-			if ( !valid ) {
-				Journal_Printf(
-					Journal_Register( Info_Type, "Journal" ),
-					"Warning - unknown journal operation %s for component %s\n",
-					dictionary->entryPtr[index]->key,
-					self->name );
-			}
-						
-			Memory_Free( keyCopy );
-		}
-	}
-											
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Stg_Component.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Stg_Component.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,486 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Stg_Component.c 4288 2008-07-24 05:32:42Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Meta.h"
+#include "Stg_Component.h"
+#include "Stg_ComponentFactory.h"
+#include "LiveComponentRegister.h"
+#include "CallGraph.h"
+
+#include "Stg_ComponentRegister.h"
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+/* Textual name of this class */
+const Type Stg_Component_Type = "Stg_Component";
+
+
+Stg_Component* _Stg_Component_New(  STG_COMPONENT_DEFARGS  )
+{
+	Stg_Component* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stg_Component) );
+	self = (Stg_Component*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	self->_defaultConstructor = _defaultConstructor;
+	self->_construct = _construct;
+	self->_build = _build;
+	self->_initialise =  _initialise;
+	self->_execute = _execute;
+	self->_destroy = _destroy;
+	
+	/* Stg_Component info */
+	_Stg_Component_Init( self );
+	
+	return self;
+}
+
+
+void _Stg_Component_Init( Stg_Component* self ) {
+	/* General and Virtual info should already be set */
+	
+	/* Stg_Component info */
+	self->isConstructed = False;
+	self->isBuilt = False;
+	self->isInitialised = False;
+	self->hasExecuted = False;
+	self->isDestroyed = False;
+	self->constructType = Stg_Object_AppendSuffix( self, "Construct" );
+	self->buildType = Stg_Object_AppendSuffix( self, "Build" );
+	self->initialiseType = Stg_Object_AppendSuffix( self, "Initialise" );
+	self->executeType = Stg_Object_AppendSuffix( self, "Execute" );
+	self->destroyType = Stg_Object_AppendSuffix( self, "Destroy" );
+}
+
+
+void _Stg_Component_Delete( void* component ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+   /* just make sure the component is destroyed */
+ 	Stg_Component_Destroy( self, NULL, False );
+	
+	Memory_Free( self->destroyType );
+	Memory_Free( self->executeType );
+	Memory_Free( self->initialiseType );
+	Memory_Free( self->buildType );
+	Memory_Free( self->constructType );
+
+	/* Stg_Class_Delete parent class */
+	_Stg_Object_Delete( self );
+}
+
+
+void _Stg_Component_Print( void* component, Stream* stream ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Stg_Component (ptr): %p\n", self );
+	
+	/* Print parent class */
+	_Stg_Object_Print( self, stream );
+	
+	/* Virtual info */
+	Journal_Printf( (void*) stream, "\t_defaultConstructor (func ptr): %p\n", self->_defaultConstructor );
+	Journal_Printf( (void*) stream, "\t_construct (func ptr): %p\n", self->_construct );
+	
+	Journal_Printf( (void*) stream, "\t_initialise (func ptr): %p\n", self->_initialise );
+	Journal_Printf( (void*) stream, "\t_execute (func ptr): %p\n", self->_execute );
+	Journal_Printf( (void*) stream, "\t_destroy (func ptr): %p\n", self->_destroy );
+	
+	/* Stg_Component */
+	Journal_Printf( (void*) stream, "\tisConstructed: %s\n", self->isConstructed ? "True" : "False" );
+	Journal_Printf( (void*) stream, "\tisBuilt: %s\n", self->isBuilt ? "True" : "False" );
+	Journal_Printf( (void*) stream, "\tisInitialised: %s\n", self->isInitialised ? "True" : "False" );
+	Journal_Printf( (void*) stream, "\thasExecuted: %s\n", self->hasExecuted ? "True" : "False" );
+	Journal_Printf( (void*) stream, "\tisDestroyed: %s\n", self->isDestroyed ? "True" : "False" );
+
+	Journal_Printf( (void*) stream, "\tconstructor function name: %s\n", self->constructType );
+	Journal_Printf( (void*) stream, "\tbuild function name: %s\n", self->buildType );
+	Journal_Printf( (void*) stream, "\tinitialise function name: %s\n", self->initialiseType );
+	Journal_Printf( (void*) stream, "\texecute function name: %s\n", self->executeType );
+	Journal_Printf( (void*) stream, "\tdestroy function name: %s\n", self->destroyType );
+}
+
+void* _Stg_Component_Copy( const void* component, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_Component*	self = (Stg_Component*)component;
+	Stg_Component*	newComponent;
+	
+	newComponent = (Stg_Component*)_Stg_Object_Copy( component, dest, deep, nameExt, ptrMap );
+	
+	/* Virtual methods */
+	newComponent->_defaultConstructor = self->_defaultConstructor;
+	newComponent->_construct = self->_construct;
+	newComponent->_build = self->_build;
+	newComponent->_initialise = self->_initialise;
+	newComponent->_execute = self->_execute;
+	newComponent->_destroy = self->_destroy;
+	
+	newComponent->isConstructed = self->isConstructed;
+	newComponent->isBuilt = self->isBuilt;
+	newComponent->isInitialised = self->isInitialised;
+	newComponent->hasExecuted = self->hasExecuted;
+	newComponent->isDestroyed = self->isDestroyed;
+	
+	newComponent->constructType = StG_Strdup( self->constructType );
+	newComponent->buildType = StG_Strdup( self->buildType );
+	newComponent->initialiseType = StG_Strdup( self->initialiseType );
+	newComponent->executeType = StG_Strdup( self->executeType );
+	newComponent->destroyType = StG_Strdup( self->destroyType );
+
+	if ( LiveComponentRegister_GetLiveComponentRegister() ) {
+		LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), newComponent );
+		Memory_CountInc( newComponent );	/* Live register now has a refernce to it */
+	}
+
+	return newComponent;
+}
+
+void Stg_Component_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data, Bool force ) {
+	Stg_Component* self   = (Stg_Component*)component;
+
+	assert( self );
+	
+	if( force || !self->isConstructed ) {
+		/*Stg_TimeMonitor* tm;
+		Stg_MemMonitor*  mm;
+		char*            buf;*/
+		
+		Stream* stream = Journal_Register( Info_Type, "Stg_ComponentFactory" );
+
+		Journal_RPrintf( stream, "Constructing %s..\n", self->name );
+		Stream_Indent( stream );
+		
+		/*buf = Stg_Object_AppendSuffix( self, "Construct" );
+		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
+		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
+	
+		Stg_MemMonitor_Begin( mm );
+		Stg_TimeMonitor_Begin( tm );*/
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Push( stgCallGraph, self->_construct, self->constructType );
+		#endif
+		
+		if ( !self->isConstructed ) {
+			Stg_Component_SetupStreamFromDictionary( 
+				self, 
+				Dictionary_GetDictionary( cf->componentDict, self->name ) );
+		}
+		
+		self->isConstructed = True;
+		self->_construct( self, cf, data );
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Pop( stgCallGraph );
+		#endif
+		
+		/*Stg_TimeMonitor_End( tm );
+		Stg_MemMonitor_End( mm );
+	
+		Stg_TimeMonitor_Delete( tm );
+		Stg_MemMonitor_Delete( mm );
+
+		Memory_Free( buf );*/
+		
+		Stream_UnIndent( stream );
+	}
+}
+
+void Stg_Component_Build( void* component, void* data, Bool force ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	if( force || !self->isBuilt ) {
+		/*Stg_TimeMonitor* tm;
+		Stg_MemMonitor*  mm;
+		char*            buf;
+		
+		buf = Stg_Object_AppendSuffix( self, "Build" );
+		
+		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
+		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
+	
+		Stg_MemMonitor_Begin( mm );
+		Stg_TimeMonitor_Begin( tm );*/
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Push( stgCallGraph, self->_build, self->buildType );
+		#endif
+		
+		self->_build( self, data );
+		self->isBuilt = True;
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Pop( stgCallGraph );
+		#endif
+		
+		/*Stg_TimeMonitor_End( tm );
+		Stg_MemMonitor_End( mm );
+	
+		Stg_TimeMonitor_Delete( tm );
+		Stg_MemMonitor_Delete( mm );
+
+		Memory_Free( buf );*/
+	}
+}
+
+void Stg_Component_Initialise( void* component, void* data, Bool force ) {
+	Stg_Component* self = (Stg_Component*)component;
+
+	if( force || !self->isInitialised ) {
+		/*Stg_TimeMonitor* tm;
+		Stg_MemMonitor*  mm;
+		char*            buf;
+		
+		buf = Stg_Object_AppendSuffix( self, "Initialise" );
+		
+		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
+		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
+	
+		Stg_MemMonitor_Begin( mm );
+		Stg_TimeMonitor_Begin( tm );*/
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Push( stgCallGraph, self->_initialise, self->initialiseType );
+		#endif
+		
+		self->isInitialised = True;
+		self->_initialise( self, data );
+		
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Pop( stgCallGraph );
+		#endif
+		
+		/*Stg_TimeMonitor_End( tm );
+		Stg_MemMonitor_End( mm );
+	
+		Stg_TimeMonitor_Delete( tm );
+		Stg_MemMonitor_Delete( mm );
+		
+		Memory_Free( buf );*/
+	}
+}
+
+void Stg_Component_Execute( void* component, void* data, Bool force ) {
+	Stg_Component* self = (Stg_Component*)component;
+	if( force || !self->hasExecuted ) {
+		/*Stg_TimeMonitor* tm;
+		Stg_MemMonitor*  mm;
+		char*            buf;
+		
+		buf = Stg_Object_AppendSuffix( self, "Execute" );
+		
+		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
+		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
+	
+		Stg_MemMonitor_Begin( mm );
+		Stg_TimeMonitor_Begin( tm );*/
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Push( stgCallGraph, self->_execute, self->executeType );
+		#endif
+		
+		self->_execute( self, data );
+		self->hasExecuted = True;
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Pop( stgCallGraph );
+		#endif
+		
+		/*Stg_TimeMonitor_End( tm );
+		Stg_MemMonitor_End( mm );
+	
+		Stg_TimeMonitor_Delete( tm );
+		Stg_MemMonitor_Delete( mm );	
+		
+		Memory_Free( buf );*/
+	}
+}
+
+void Stg_Component_Destroy( void* component, void* data, Bool force ) {
+	Stg_Component* self = (Stg_Component*)component;
+
+	if( /* TODO: once the refCounters are implemented there is no longeer a need to check self|| */ self && !self->isDestroyed ) {
+		/*Stg_TimeMonitor*	tm;
+		Stg_MemMonitor*		mm;
+		char*						buf;
+		
+		buf = Stg_Object_AppendSuffix( self, "Destroy" );
+		
+		tm = Stg_TimeMonitor_New( buf, True, True, MPI_COMM_WORLD );
+		mm = Stg_MemMonitor_New( buf, True, True, MPI_COMM_WORLD );
+	
+		Stg_MemMonitor_Begin( mm );
+		Stg_TimeMonitor_Begin( tm );*/
+		
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Push( stgCallGraph, self->_destroy, self->destroyType );
+		#endif
+		
+		self->isDestroyed = True;
+
+      if( self->_destroy )
+         self->_destroy( self, data );
+
+		#ifdef USE_PROFILE
+			Stg_CallGraph_Pop( stgCallGraph );
+		#endif
+		
+		/*Stg_TimeMonitor_End( tm );
+		Stg_MemMonitor_End( mm );
+	
+		Stg_TimeMonitor_Delete( tm );
+		Stg_MemMonitor_Delete( mm );
+		Memory_Free( buf );*/
+	}
+}
+
+/* TODO: UPT TO HERE */
+
+Bool Stg_Component_IsConstructed( void* component ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	return self->isConstructed;
+}
+
+Bool Stg_Component_IsBuilt( void* component ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	return self->isBuilt;
+}
+
+Bool Stg_Component_IsInitialised( void* component ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	return self->isInitialised;
+}
+
+Bool Stg_Component_HasExecuted( void* component ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	return self->hasExecuted;
+}
+
+Bool Stg_Component_IsDestroyed( void* component ) {
+	Stg_Component* self = (Stg_Component*)component;
+	
+	return self->isDestroyed;
+}
+
+
+void Stg_Component_SetupStreamFromDictionary( void* component, Dictionary* dictionary ) {
+	Stg_Component* self = (Stg_Component*)component;
+
+	Index index;
+	Bool valid;
+
+	char* keyCopy;
+	char* operation;
+	char* streamType;
+
+	Stream* stream;
+
+	if ( dictionary == NULL ) {
+		return;
+	}
+	
+	/* Iterate through the whole dictionary, checking for journal related commands */
+	for ( index = 0; index < dictionary->count; ++index ) {
+		/* Check to see if it is a journal operation by searching for the JOURNAL_KEY. */
+		if ( (strncasecmp( dictionary->entryPtr[index]->key, JOURNAL_KEY, strlen(JOURNAL_KEY))) == 0 ) {
+			
+			keyCopy = StG_Strdup( dictionary->entryPtr[index]->key );
+
+			operation = strtok( keyCopy, JOURNAL_DELIMITER );
+			streamType = strtok( NULL, JOURNAL_DELIMITER );
+
+			if ( streamType == NULL ) {
+                          stream = Journal_MyStream( Info_Type, self );
+			}
+                        else {
+                          stream = Journal_MyStream( streamType, self );
+                        }
+
+			valid = True;
+			if ( strcmp( operation, JOURNAL_ENABLE_KEY ) == 0 ) {
+				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
+				Stream_Enable( stream, enable );
+			}
+			else if ( strcmp( operation, JOURNAL_ENABLE_BRANCH_KEY ) == 0 ) {
+				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
+				Stream_EnableBranch( stream, enable );
+			}
+			else if ( strcmp( operation, JOURNAL_LEVEL_KEY ) == 0 ) {
+				JournalLevel level = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
+				Stream_SetLevelBranch( stream, level );
+			}
+			else if ( strcmp( operation, JOURNAL_RANK_KEY ) == 0 ) {
+				int rank = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
+				Stream_SetPrintingRank( stream, rank );
+			}
+			else if ( strcmp( operation, JOURNAL_FLUSH_KEY ) == 0 ) {
+				Bool flush = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
+				Stream_SetAutoFlush( stream, flush );
+			}
+			else {
+				valid = False;
+			}
+
+			if ( !valid ) {
+				Journal_Printf(
+					Journal_Register( Info_Type, "Journal" ),
+					"Warning - unknown journal operation %s for component %s\n",
+					dictionary->entryPtr[index]->key,
+					self->name );
+			}
+						
+			Memory_Free( keyCopy );
+		}
+	}
+											
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Stg_ComponentFactory.c
--- a/Base/Automation/src/Stg_ComponentFactory.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1014 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: Stg_ComponentFactory.c 4137 2007-06-07 05:46:46Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Stg_Component.h"
-#include "LiveComponentRegister.h"
-#include "Stg_ComponentFactory.h"
-#include "Stg_ComponentRegister.h"
-#include "HierarchyTable.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type Stg_ComponentFactory_Type = "Stg_ComponentFactory";
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-/* Creation implementation */
-Stg_ComponentFactory* _Stg_ComponentFactory_New(  STG_COMPONENTFACTORY_DEFARGS  )
-{
-	Stg_ComponentFactory *self = NULL;
-
-	assert( _sizeOfSelf >= sizeof( Stg_ComponentFactory ) );
-	self = (Stg_ComponentFactory*) _Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	self->getDouble = getDouble;
-	self->getInt = getInt;
-	self->getUnsignedInt = getUnsignedInt;
-	self->getBool = getBool;
-	self->getString = getString;
-
-	self->getRootDictDouble = getRootDictDouble;
-	self->getRootDictInt = getRootDictInt;
-	self->getRootDictUnsignedInt = getRootDictUnsignedInt;
-	self->getRootDictBool = getRootDictBool;
-	self->getRootDictString = getRootDictString;
-	
-	self->constructByName = constructByName;
-	self->constructByKey = constructByKey;
-	self->constructByNameWithKeyFallback  = constructByNameWithKeyFallback;
-	self->constructByList = constructByList;
-
-	self->rootDict = rootDict;
-	self->componentDict = componentDict;
-	self->infoStream = Journal_Register( InfoStream_Type, self->type );
-	Stream_SetPrintingRank( self->infoStream, 0 );
-	Stream_SetAutoFlush( self->infoStream, True );
-		
-	_Stg_ComponentFactory_Init( self );
-	
-	return self;
-}
-	
-Stg_ComponentFactory* Stg_ComponentFactory_New( Dictionary* rootDict, Dictionary* componentDict ) {
-	/* Variables set in this function */
-	SizeT                                                                        _sizeOfSelf = sizeof( Stg_ComponentFactory );
-	Type                                                                                type = Stg_ComponentFactory_Type;
-	Stg_Class_DeleteFunction*                                                        _delete = _Stg_ComponentFactory_Delete;
-	Stg_Class_PrintFunction*                                                          _print = _Stg_ComponentFactory_Print;
-	Stg_ComponentFactory_GetDoubleFunc*                                            getDouble = _Stg_ComponentFactory_GetDouble;
-	Stg_ComponentFactory_GetIntFunc*                                                  getInt = _Stg_ComponentFactory_GetInt;
-	Stg_ComponentFactory_GetUnsignedIntFunc*                                  getUnsignedInt = _Stg_ComponentFactory_GetUnsignedInt;
-	Stg_ComponentFactory_GetBoolFunc*                                                getBool = _Stg_ComponentFactory_GetBool;
-	Stg_ComponentFactory_GetStringFunc*                                            getString = _Stg_ComponentFactory_GetString;
-	Stg_ComponentFactory_GetRootDictDoubleFunc*                            getRootDictDouble = _Stg_ComponentFactory_GetRootDictDouble;
-	Stg_ComponentFactory_GetRootDictIntFunc*                                  getRootDictInt = _Stg_ComponentFactory_GetRootDictInt;
-	Stg_ComponentFactory_GetRootDictUnsignedIntFunc*                  getRootDictUnsignedInt = _Stg_ComponentFactory_GetRootDictUnsignedInt;
-	Stg_ComponentFactory_GetRootDictBoolFunc*                                getRootDictBool = _Stg_ComponentFactory_GetRootDictBool;
-	Stg_ComponentFactory_GetRootDictStringFunc*                            getRootDictString = _Stg_ComponentFactory_GetRootDictString;
-	Stg_ComponentFactory_ConstructByNameFunc*                                constructByName = _Stg_ComponentFactory_ConstructByName;
-	Stg_ComponentFactory_ConstructByKeyFunc*                                  constructByKey = _Stg_ComponentFactory_ConstructByKey;
-	Stg_ComponentFactory_ConstructByNameWithKeyFallbackFunc*  constructByNameWithKeyFallback = _Stg_ComponentFactory_ConstructByNameWithKeyFallback;
-	Stg_ComponentFactory_ConstructByListFunc*                                constructByList = _Stg_ComponentFactory_ConstructByList;
-
-	Stg_ComponentFactory *self = NULL;
-
-	assert( rootDict );
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_Class_CopyFunction*  _copy = NULL;
-
-	self = _Stg_ComponentFactory_New(  STG_COMPONENTFACTORY_PASSARGS  );
-
-	return self;
-}
-
-void _Stg_ComponentFactory_Init( Stg_ComponentFactory *self )
-{
-	assert( self );
-	
-	self->LCRegister = LiveComponentRegister_New( );
-}
-
-void Stg_ComponentFactory_Init( Stg_ComponentFactory *self )
-{
-	assert( self );
-	_Stg_ComponentFactory_Init( self );
-}
-	
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _Stg_ComponentFactory_Delete( void* cf )
-{
-	Stg_ComponentFactory *self = (Stg_ComponentFactory *) cf;
-
-	assert( self );
-
-	Stg_Class_Delete( self->LCRegister ); /* this deletes all the components on the LCRegister */
-	_Stg_Class_Delete( self );
-}
-	
-void _Stg_ComponentFactory_Print( void* cf, Stream* stream )
-{
-	Stg_ComponentFactory *self = (Stg_ComponentFactory*) cf;
-
-	assert( self );
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Stg_ComponentFactory (ptr): %p\n", self );
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-	
-	Journal_Printf( (void*) stream, "LiveComponentRegister (ptr): %p\n", self->LCRegister );
-	Stg_Class_Print( self->LCRegister, stream );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-void Stg_ComponentFactory_SetComponentDictionary( Stg_ComponentFactory *self, Dictionary *dict )
-{
-	assert( self );
-	assert( dict );
-
-	self->componentDict = dict;
-}
-
-void Stg_ComponentFactory_CreateComponents( Stg_ComponentFactory *self ) {
-	Dictionary_Entry*                      componentDictEntry           = NULL;
-	Dictionary*                            currComponentDict            = NULL;
-	Type                                   componentType                = NULL;
-	char*                                  componentName                = NULL;
-	Stg_Component_DefaultConstructorFunction*  componentConstructorFunction;
-	Index                                  component_I;
-	Stream*                                stream;
-	
-	assert( self );
-	
-	stream = self->infoStream;
-	if( self->componentDict ){
-		Journal_Printf( stream, "\nCreating Stg_Components from the component-list\n\n" );
-		Stream_Indent( stream );
-
-		/* add the contexts to the live component register first (so these get constructed/built/initialised first) */	
-		for( component_I = 0; component_I < Dictionary_GetCount( self->componentDict ) ; component_I++ ){
-			componentDictEntry = self->componentDict->entryPtr[ component_I ];
-
-			currComponentDict  = Dictionary_Entry_Value_AsDictionary( componentDictEntry->value );
-			componentType      = Dictionary_GetString( currComponentDict, "Type" );
-			componentName      = componentDictEntry->key;
-
-			if( strcmp( componentType, "DomainContext" ) && 
-			    strcmp( componentType, "FiniteElementContext" ) &&
-			    strcmp( componentType, "PICelleratorContext" ) &&
-			    strcmp( componentType, "UnderworldContext" ) )
-				continue;
-
-			Journal_Firewall( 
-					LiveComponentRegister_Get( self->LCRegister, componentName ) == NULL,
-					Journal_Register( Error_Type, self->type ),
-					"Error in func %s: Trying to instantiate two components with the name of '%s'\n"
-					"Each component's name must be unique.\n",
-					__func__, componentName );
-
-			/* Print Message */
-			Journal_Printf( stream, "Instantiating %s as %s\n", componentType, componentName );
-			
-			/* Get Default Constructor for this type */
-			componentConstructorFunction = Stg_ComponentRegister_AssertGet( 
-					Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" );
-
-			/* Add to register */
-			LiveComponentRegister_Add( self->LCRegister, (Stg_Component*)componentConstructorFunction( componentName ) );
-		}
-
-		/* now add the rest of the components */	
-		for( component_I = 0; component_I < Dictionary_GetCount( self->componentDict ) ; component_I++ ){
-			componentDictEntry = self->componentDict->entryPtr[ component_I ];
-
-			currComponentDict  = Dictionary_Entry_Value_AsDictionary( componentDictEntry->value );
-			componentType      = Dictionary_GetString( currComponentDict, "Type" );
-			componentName      = componentDictEntry->key;
-
-			if( !strcmp( componentType, "DomainContext" ) ||
-			    !strcmp( componentType, "FiniteElementContext" ) ||
-			    !strcmp( componentType, "PICelleratorContext" ) ||
-			    !strcmp( componentType, "UnderworldContext" ) )
-				continue;
-
-			Journal_Firewall( 
-					LiveComponentRegister_Get( self->LCRegister, componentName ) == NULL,
-					Journal_Register( Error_Type, self->type ),
-					"Error in func %s: Trying to instantiate two components with the name of '%s'\n"
-					"Each component's name must be unique.\n",
-					__func__, componentName );
-
-			/* Print Message */
-			Journal_Printf( stream, "Instantiating %s as %s\n", componentType, componentName );
-			
-			/* Get Default Constructor for this type */
-			componentConstructorFunction = Stg_ComponentRegister_AssertGet( 
-					Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" );
-
-			/* Add to register */
-			LiveComponentRegister_Add( self->LCRegister, (Stg_Component*)componentConstructorFunction( componentName ) );
-		}
-
-		Stream_UnIndent( stream );
-	}
-	else{
-		Journal_Printf( stream, "No Stg_Component List found..!\n" );
-	}
-}
-
-void Stg_ComponentFactory_ConstructComponents( Stg_ComponentFactory* self, void* data ) {
-	Stg_Component*                         component                    = NULL;
-	Index                                  component_I;
-	Stream*                                stream;
-	
-	assert( self );
-	
-	stream = self->infoStream;
-
-	if( self->componentDict ){
-		Journal_Printf( stream, "\nConstructing Stg_Components from the live-component register\n\n" );
-		Stream_Indent( stream );
-	
-		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
-			/* Grab component from register */
-			component = LiveComponentRegister_At( self->LCRegister, component_I );
-			if( component && !component->isConstructed ){
-				Stg_Component_AssignFromXML( component, self, data, True );
-			}
-		}
-		Stream_UnIndent( stream );
-	}
-	else{
-		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
-	}
-}
-
-void Stg_ComponentFactory_BuildComponents( Stg_ComponentFactory* self, void* data ) {
-	Stg_Component*                         component                    = NULL;
-	Index                                  component_I;
-	Stream*                                stream;
-	
-	assert( self );
-	
-	stream = self->infoStream;
-
-	if( self->componentDict ){
-		Journal_Printf( stream, "\nBuilding Stg_Components from the live-component register\n\n" );
-		Stream_Indent( stream );
-	
-		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
-			/* Grab component from register */
-			component = LiveComponentRegister_At( self->LCRegister, component_I );
-			if( component && !component->isBuilt ){
-				Stg_Component_Build( component, data, True );
-			}
-		}
-		Stream_UnIndent( stream );
-	}
-	else{
-		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
-	}
-}
-
-void Stg_ComponentFactory_InitialiseComponents( Stg_ComponentFactory* self, void* data ) {
-	Stg_Component*                         component                    = NULL;
-	Index                                  component_I;
-	Stream*                                stream;
-	
-	assert( self );
-	
-	stream = self->infoStream;
-
-	if( self->componentDict ){
-		Journal_Printf( stream, "\nInitialising Stg_Components from the live-component register\n\n" );
-		Stream_Indent( stream );
-	
-		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
-			/* Grab component from register */
-			component = LiveComponentRegister_At( self->LCRegister, component_I );
-			if( component && !component->isInitialised ){
-				Stg_Component_Initialise( component, data, True );
-			}
-		}
-		Stream_UnIndent( stream );
-	}
-	else{
-		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
-	}
-}
-
-void Stg_ComponentFactory_ExecuteComponents( Stg_ComponentFactory* self, void* data ) {
-	Stg_Component*                         component                    = NULL;
-	Index                                  component_I;
-	Stream*                                stream;
-	
-	assert( self );
-	
-	stream = self->infoStream;
-
-	if( self->componentDict ){
-		Journal_Printf( stream, "\nExecuting Stg_Components from the live-component register\n\n" );
-		Stream_Indent( stream );
-	
-		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
-			/* Grab component from register */
-			component = LiveComponentRegister_At( self->LCRegister, component_I );
-			if( component && !component->hasExecuted ){
-				Stg_Component_Execute( component, data, True );
-			}
-		}
-		Stream_UnIndent( stream );
-	}
-	else{
-		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
-	}
-}
-
-void Stg_ComponentFactory_DestroyComponents( Stg_ComponentFactory* self, void* data ) {
-	Stg_Component*                         component                    = NULL;
-	Index                                  component_I;
-	Stream*                                stream;
-	
-	assert( self );
-	
-	stream = self->infoStream;
-
-	if( self->componentDict ){
-		Journal_Printf( stream, "\nDestroying Stg_Components from the live-component register\n\n" );
-		Stream_Indent( stream );
-	
-		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
-			/* Grab component from register */
-			component = LiveComponentRegister_At( self->LCRegister, component_I );
-			if( component && !component->isDestroyed ){
-				Stg_Component_Destroy( component, data, True );
-			}
-		}
-		Stream_UnIndent( stream );
-	}
-	else{
-		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
-	}
-}
-
-Dictionary_Entry_Value* _Stg_ComponentFactory_GetDictionaryValue( void* cf, Name componentName, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
-	Stg_ComponentFactory*       self              = (Stg_ComponentFactory*) cf;
-	Dictionary*             componentDict     = NULL;
-	Dictionary*             thisComponentDict = NULL;
-	Dictionary_Entry_Value* returnVal;
-	Bool                    usedDefault       = False;
-	Stream*                 errorStream       = Journal_Register( Error_Type, Stg_Component_Type );
-	Stream*                 stream            = self->infoStream;
-
-	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_ComponentFactory is NULL.\n", __func__ );
-
-	Journal_PrintfL( stream, 2, "Getting parameter '%s': ", key );
-
-	/* Get this Stg_Component's Dictionary */
-	componentDict = self->componentDict;
-	Journal_Firewall( componentDict != NULL, errorStream, 
-			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
-	thisComponentDict = Dictionary_GetDictionary( componentDict, componentName );
-	Journal_Firewall( thisComponentDict != NULL, errorStream,
-			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, componentName );
-
-	/* Get Value from dictionary */
-	returnVal = Dictionary_Get( thisComponentDict, key );
-	if ( !returnVal && defaultVal ) {
-		returnVal = Dictionary_GetDefault( thisComponentDict, key, defaultVal );
-		usedDefault = True;
-	}
-
-	/* Print Stuff */
-	if ( usedDefault ) {
-		Journal_PrintfL( stream, 2, "Using default value = " );
-		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-			Dictionary_Entry_Value_Print( returnVal, stream );
-		Journal_PrintfL( stream, 2, "\n" );
-
-		return returnVal;
-	}
-	else if ( returnVal ) {
-		Journal_PrintfL( stream, 2, "Found - Value = " );
-		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-			Dictionary_Entry_Value_Print( returnVal, stream );
-		Journal_PrintfL( stream, 2, "\n" );
-	}
-	else 
-		Journal_PrintfL( stream, 2, "Not found.\n" );
-
-	return returnVal;
-}
-
-Dictionary_Entry_Value* _Stg_ComponentFactory_GetNumericalValue( void* cf, Name componentName, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
-	Stg_ComponentFactory*       self              = (Stg_ComponentFactory*) cf;
-	Dictionary_Entry_Value* returnVal;
-	Bool                    usedDefault       = False;
-	Stream*                 errorStream       = Journal_Register( Error_Type, Stg_Component_Type );
-	Stream*                 stream            = self->infoStream;
-
-	returnVal = _Stg_ComponentFactory_GetDictionaryValue( self, componentName, key, defaultVal );
-
-	/* Check to see whether the type is a string -
-	 * if it is then assume that this is a dictionary key linking to the root dictionary */
-	if ( returnVal ) {
-		Dictionary_Entry_Key rootDictKey = Dictionary_Entry_Value_AsString( returnVal );
-		Dictionary*          rootDict    = self->rootDict;
-
-		/* Check if the number really is a string or not */
-		if ( Stg_StringIsNumeric( rootDictKey ) )
-			return returnVal;
-		
-		Journal_PrintfL( stream, 2, "Key '%s' points to key '%s' in the root dictionary: ", key, rootDictKey );
-
-		Journal_Firewall( rootDict != NULL, errorStream, "Root Dictionary NULL in component factory.\n" );
-
-		/* Get Value from dictionary */
-		returnVal = Dictionary_Get( rootDict, rootDictKey );
-		if ( !returnVal && defaultVal ) {
-			returnVal = Dictionary_GetDefault( rootDict, rootDictKey, defaultVal );
-			usedDefault = True;
-		}
-
-		/* Print Stuff */
-		if ( usedDefault ) {
-			Journal_PrintfL( stream, 2, "Using default value = " );
-			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-				Dictionary_Entry_Value_Print( returnVal, stream );
-			Journal_PrintfL( stream, 2, "\n" );
-			return returnVal;
-		}
-		else if ( returnVal ) {
-			Journal_PrintfL( stream, 2, "Found - Value = " );
-			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-				Dictionary_Entry_Value_Print( returnVal, stream );
-			Journal_PrintfL( stream, 2, "\n" );
-		}
-		else 
-			Journal_PrintfL( stream, 2, "Not found.\n" );
-	}
-
-	return returnVal;
-}
-
-double Stg_ComponentFactory_GetDouble( void* cf, Name componentName, Dictionary_Entry_Key key, double defaultVal ) {
-        Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
-        return self->getDouble( cf, componentName, key, defaultVal );
-}
-double _Stg_ComponentFactory_GetDouble( void* cf, Name componentName, Dictionary_Entry_Key key, double defaultVal ) {
-	return Dictionary_Entry_Value_AsDouble( 
-			_Stg_ComponentFactory_GetNumericalValue( cf, componentName, key, 
-				Dictionary_Entry_Value_FromDouble( defaultVal )));
-}
-int Stg_ComponentFactory_GetInt( void* cf, Name componentName, Dictionary_Entry_Key key, int defaultVal ) {
-	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
-	return self->getInt( cf, componentName, key, defaultVal );
-}
-int _Stg_ComponentFactory_GetInt( void* cf, Name componentName, Dictionary_Entry_Key key, int defaultVal ) {
-	return Dictionary_Entry_Value_AsInt( 
-			_Stg_ComponentFactory_GetNumericalValue( cf, componentName, key, 
-				Dictionary_Entry_Value_FromInt( defaultVal ) ) );
-}	
-unsigned int Stg_ComponentFactory_GetUnsignedInt( void* cf, Name componentName, Dictionary_Entry_Key key, unsigned int defaultVal ) {
-	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
-	return self->getUnsignedInt( cf, componentName, key, defaultVal );
-}
-unsigned int _Stg_ComponentFactory_GetUnsignedInt( void* cf, Name componentName, Dictionary_Entry_Key key, unsigned int defaultVal ) {
-	unsigned int retVal;
-	retVal = Dictionary_Entry_Value_AsUnsignedInt( 
-			_Stg_ComponentFactory_GetNumericalValue( cf, componentName, key, 
-				Dictionary_Entry_Value_FromUnsignedInt( defaultVal )));
-/* 	 TODO : Possible memory leak if defaultVal not added to the dictionary */
-	return retVal;
-}	
-Bool Stg_ComponentFactory_GetBool( void* cf, Name componentName, Dictionary_Entry_Key key, Bool defaultVal ) {
-	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
-	return self->getBool( cf, componentName, key, defaultVal );
-}
-Bool _Stg_ComponentFactory_GetBool( void* cf, Name componentName, Dictionary_Entry_Key key, Bool defaultVal ) {
-	return Dictionary_Entry_Value_AsBool( 
-			_Stg_ComponentFactory_GetDictionaryValue( cf, componentName, key, 
-				Dictionary_Entry_Value_FromBool( defaultVal ) ) );
-}	
-char* Stg_ComponentFactory_GetString( void* cf, Name componentName, Dictionary_Entry_Key key, const char* const defaultVal ) {
-	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
-	return self->getString( cf, componentName, key, defaultVal );
-}
-char* _Stg_ComponentFactory_GetString( void* cf, Name componentName, Dictionary_Entry_Key key, const char* const defaultVal ) {
-	return Dictionary_Entry_Value_AsString( 
-			_Stg_ComponentFactory_GetDictionaryValue( cf, componentName, key, 
-				Dictionary_Entry_Value_FromString( defaultVal ) ) );
-}
-
-
-double Stg_ComponentFactory_GetRootDictDouble( void* cf, Dictionary_Entry_Key key, const double defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	return self->getRootDictDouble( self, key, defaultVal );
-}
-double _Stg_ComponentFactory_GetRootDictDouble( void* cf, Dictionary_Entry_Key key, const double defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	
-	Journal_PrintfL( self->infoStream, 2, "Getting double from root dictionary with key '%s' and default value '%g'\n",
-			key, defaultVal );
-
-	assert( self->rootDict );
-	return Dictionary_GetDouble_WithDefault( self->rootDict, key, defaultVal );
-}
-int Stg_ComponentFactory_GetRootDictInt( void* cf, Dictionary_Entry_Key key, const int defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	return self->getRootDictInt( self, key, defaultVal );
-}
-int _Stg_ComponentFactory_GetRootDictInt( void* cf, Dictionary_Entry_Key key, const int defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	
-	Journal_PrintfL( self->infoStream, 2, "Getting int from root dictionary with key '%s' and default value '%d'\n",
-			key, defaultVal );
-
-	assert( self->rootDict );
-	return Dictionary_GetInt_WithDefault( self->rootDict, key, defaultVal );
-}	
-unsigned int Stg_ComponentFactory_GetRootDictUnsignedInt( void* cf, Dictionary_Entry_Key key, const unsigned int defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	return self->getRootDictUnsignedInt( self, key, defaultVal );
-}
-unsigned int _Stg_ComponentFactory_GetRootDictUnsignedInt( void* cf, Dictionary_Entry_Key key, const unsigned int defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	
-	Journal_PrintfL( self->infoStream,2, "Getting unsigned int from root dictionary with key '%s' and default value '%u'\n",
-			key, defaultVal );
-
-	assert( self->rootDict );
-	return Dictionary_GetUnsignedInt_WithDefault( self->rootDict, key, defaultVal );
-}	
-Bool Stg_ComponentFactory_GetRootDictBool( void* cf, Dictionary_Entry_Key key, const Bool defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	return self->getRootDictBool( self, key, defaultVal );
-}
-Bool _Stg_ComponentFactory_GetRootDictBool( void* cf, Dictionary_Entry_Key key, const Bool defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	
-	Journal_PrintfL( self->infoStream, 2, "Getting Bool from root dictionary with key '%s' and default value '%s'\n",
-			key, defaultVal ? "True" : "False" );
-
-	assert( self->rootDict );
-	return Dictionary_GetBool_WithDefault( self->rootDict, key, defaultVal );
-}	
-char* Stg_ComponentFactory_GetRootDictString( void* cf, Dictionary_Entry_Key key, Name const defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-	return self->getRootDictString( self, key, defaultVal );
-}
-char* _Stg_ComponentFactory_GetRootDictString( void* cf, Dictionary_Entry_Key key, Name const defaultVal ) {
-	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
-
-	Journal_PrintfL( self->infoStream, 2, "Getting string from root dictionary with key '%s' and default value '%s'\n",
-			key, defaultVal );
-
-	assert( self->rootDict );
-	return Dictionary_GetString_WithDefault( self->rootDict, key, defaultVal );
-}
-
-
-Stg_Component* _Stg_ComponentFactory_ConstructByName( void* cf, Name componentName, Type type, Bool isEssential, void* data ) {
-	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
-	Stg_Component*		component;
-	Stream*			stream            = self->infoStream;
-
-	Journal_PrintfL( stream, 2, "Looking for %sessential component '%s': ", (isEssential ? "" : "non-"), componentName );
-
-	component = LiveComponentRegister_Get( self->LCRegister, componentName );
-
-	/* Checking */
-	if (component) {
-		Journal_PrintfL( stream, 2, "Found.\n" );
-
-		if ( !component->isConstructed ) {
-			Journal_Printf( stream, "%s has not been constructed yet. Constructing now.\n", componentName );
-			Stream_Indent( stream );
-			Stg_Component_AssignFromXML( component, self, data, True );
-			Stream_UnIndent( stream );
-		}
-
-		Stg_Class_CheckType( component, type );
-
-		/* Note: I think we should disable the line below here since this function is only providing a reference
-		to an existing object, not creating a brand new one, and it was thus stuffing up the count so the
-		original object never got deleted. If we are going to do reference counting we need to adapt it across
-		the board so whenever you request access to memory you delete your own reference.
-		-- Main.PatrickSunter 18 May 2006 */
-		Memory_CountInc( component );
-	}
-	else {
-		Name			redirect;
-
-		/* If we can find the component's name in the root dictionary, use that value instead. */
-		if( self->rootDict ) {
-			redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
-			if( strcmp( redirect, "" ) ) {
-				componentName = redirect;
-				return self->constructByName( self, componentName, type, isEssential, data );
-			}
-		}
-
-		Journal_PrintfL( stream, 2, "Not found.\n" );
-
-		if ( isEssential ) {
-			Stream* errorStream = Journal_Register( Error_Type, self->type );
-
-			Journal_Printf( errorStream, "In func %s: Cannot find essential component '%s'.\n", __func__, componentName );
-
-			Journal_Printf( errorStream, "Could you have meant one of these?\n" );
-
-			Stream_Indent( errorStream );
-			LiveComponentRegister_PrintSimilar( self->LCRegister, componentName, errorStream, 5 );
-			abort();
-		}
-	}
-	
-	return component;
-}
-
-Stg_Component* _Stg_ComponentFactory_ConstructByKey( 
-		void*			cf, 
-		Name		parentComponentName, 
-		Dictionary_Entry_Key	componentKey,
-		Type			type, 
-		Bool 			isEssential,
-		void* 			data ) 
-{
-	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
-	Dictionary*		thisComponentDict = NULL;
-	Dictionary*		componentDict     = NULL;
-	Name			componentName, redirect;
-	Dictionary_Entry_Value*	componentEntryVal;
-	Stream*			errorStream       = Journal_Register( Error_Type, self->type );
-
-	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
-
-	/* Get this Stg_Component's Dictionary */
-	componentDict = self->componentDict;
-	Journal_Firewall( componentDict != NULL, errorStream, 
-			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
-	thisComponentDict = Dictionary_GetDictionary( componentDict, parentComponentName );
-	Journal_Firewall( thisComponentDict != NULL, errorStream,
-			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, parentComponentName );
-
-	/* Get Dependency's Name */
-	componentEntryVal = Dictionary_Get( thisComponentDict, componentKey );
-	if ( componentEntryVal == NULL ) {
-		Journal_Firewall( !isEssential, errorStream,
-				"Stg_Component '%s' cannot find essential component with key '%s'.\n", parentComponentName, componentKey );
-		Journal_PrintfL( self->infoStream, 2, "Stg_Component '%s' cannot find non-essential component with key '%s'.\n", parentComponentName, componentKey );
-		return NULL;
-	}
-		
-	componentName = Dictionary_Entry_Value_AsString( componentEntryVal );
-
-	/* If we can find the component's name in the root dictionary, use that value instead. */
-	if( self->rootDict ) {
-		redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
-		if( strcmp( redirect, "" ) )
-			componentName = redirect;
-	}
-
-	return self->constructByName( self, componentName, type, isEssential, data );
-}
-
-Stg_Component* _Stg_ComponentFactory_PluginConstructByKey( 
-	void*						cf, 
-	void*						codelet, 
-	Dictionary_Entry_Key	componentKey,
-	Type						type, 
-	Bool						isEssential,
-	void*						data ) 
-{
-	Stg_ComponentFactory*	self = (Stg_ComponentFactory*)cf;
-	Stg_Component*				plugin = (Stg_Component*)codelet;
-	Dictionary*					thisPluginDict = NULL;
-	Dictionary*					pluginDict = (Dictionary*)Dictionary_Get( self->rootDict, "plugins" );
-	char							*componentName, *redirect, *pluginType;
-	Dictionary_Entry_Value*	componentEntryVal;
-	Index							pluginIndex;
-	Stream*						errorStream = Journal_Register( Error_Type, self->type );
-
-	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
-
-	/* Get this plugins Dictionary */
-	for( pluginIndex = 0; pluginIndex < Dictionary_Entry_Value_GetCount( (Dictionary_Entry_Value*)pluginDict ); pluginIndex++ ) {
-		thisPluginDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value_GetElement( (Dictionary_Entry_Value*)pluginDict, pluginIndex ) );
-		pluginType = StG_Strdup( Dictionary_GetString( thisPluginDict, "Type" ) );
-
-		if( !strcmp( plugin->type, pluginType ) ){
-		   Memory_Free( pluginType );
-			break;
-		}
-      Memory_Free( pluginType );
-	}
-	
-	/* Get Dependency's Name */
-	componentEntryVal = Dictionary_Get( thisPluginDict, componentKey );
-	if ( componentEntryVal == NULL ) {
-		Journal_Firewall( !isEssential, errorStream,
-				"plugin '%s' cannot find essential component with key '%s'.\n", plugin->type, componentKey );
-		Journal_PrintfL( self->infoStream, 2, "plugin '%s' cannot find non-essential component with key '%s'.\n", plugin->type, componentKey );
-		return NULL;
-	}
-		
-	componentName = Dictionary_Entry_Value_AsString( componentEntryVal );
-
-	/* If we can find the component's name in the root dictionary, use that value instead. */
-	if( self->rootDict ) {
-		redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
-		if( strcmp( redirect, "" ) )
-			componentName = redirect;
-	}
-
-	return self->constructByName( self, componentName, type, isEssential, data );
-}
-
-Dictionary_Entry_Value* _Stg_ComponentFactory_PluginGetDictionaryValue( void* cf, void *codelet, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
-	Stg_ComponentFactory*       self              = (Stg_ComponentFactory*) cf;
-	Stg_Component*	          plugin	       = (Stg_Component*)codelet;
-	Dictionary*		          thisPluginDict = NULL;
-	Dictionary*		          pluginDict     = (Dictionary*)Dictionary_Get( self->rootDict, "plugins" );
-	char*			             pluginType;
-	Index		pluginIndex;
-	Dictionary_Entry_Value* returnVal;
-	Bool                    usedDefault       = False;
-	Stream*                 errorStream       = Journal_Register( Error_Type, Stg_Component_Type );
-	Stream*                 stream            = self->infoStream;
-
-	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_ComponentFactory is NULL.\n", __func__ );
-
-	Journal_PrintfL( stream, 2, "Getting parameter '%s': ", key );
-
-	Journal_Firewall( pluginDict != NULL, errorStream, 
-			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
-
-	/* Get this plugins Dictionary */
-	for( pluginIndex = 0; pluginIndex < Dictionary_Entry_Value_GetCount( (Dictionary_Entry_Value*)pluginDict ); pluginIndex++ ) {
-		thisPluginDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value_GetElement( (Dictionary_Entry_Value*)pluginDict, pluginIndex ) );
-		pluginType = StG_Strdup( Dictionary_GetString( thisPluginDict, "Type" ) );
-		if( !strcmp( plugin->type, pluginType ) ){
-		   Memory_Free( pluginType );
-			break;
-		}
-                Memory_Free( pluginType );
-	}
-
-	/* Get this Stg_Component's Dictionary */
-	Journal_Firewall( thisPluginDict != NULL, errorStream,
-			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, plugin->name );
-
-	/* Get Value from dictionary */
-	returnVal = Dictionary_Get( thisPluginDict, key );
-	if ( !returnVal && defaultVal ) {
-		returnVal = Dictionary_GetDefault( thisPluginDict, key, defaultVal );
-		usedDefault = True;
-	}
-
-	/* Print Stuff */
-	if ( usedDefault ) {
-		Journal_PrintfL( stream, 2, "Using default value = " );
-		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-			Dictionary_Entry_Value_Print( returnVal, stream );
-		Journal_PrintfL( stream, 2, "\n" );
-
-		return returnVal;
-	}
-	else if ( returnVal ) {
-		Journal_PrintfL( stream, 2, "Found - Value = " );
-		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-			Dictionary_Entry_Value_Print( returnVal, stream );
-		Journal_PrintfL( stream, 2, "\n" );
-	}
-	else 
-		Journal_PrintfL( stream, 2, "Not found.\n" );
-
-	return returnVal;
-}
-
-Dictionary_Entry_Value* _Stg_ComponentFactory_PluginGetNumericalValue( void* cf, void *codelet, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
-	Stg_ComponentFactory*    self           = (Stg_ComponentFactory*)cf;
-	Dictionary_Entry_Value* returnVal;
-	Bool                    usedDefault       = False;
-	Stream*                 stream            = self->infoStream;
-	Stream*			errorStream       = Journal_Register( Error_Type, self->type );
-
-	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
-
-	returnVal = _Stg_ComponentFactory_PluginGetDictionaryValue( self, codelet, key, defaultVal );
-
-	/* Check to see whether the type is a string -
-	 * if it is then assume that this is a dictionary key linking to the root dictionary */
-	if ( returnVal ) {
-		Dictionary_Entry_Key rootDictKey = Dictionary_Entry_Value_AsString( returnVal );
-		Dictionary*          rootDict    = self->rootDict;
-
-		/* Check if the number really is a string or not */
-		if ( Stg_StringIsNumeric( rootDictKey ) )
-			return returnVal;
-		
-		Journal_PrintfL( stream, 2, "Key '%s' points to key '%s' in the root dictionary: ", key, rootDictKey );
-
-		Journal_Firewall( rootDict != NULL, errorStream, "Root Dictionary NULL in component factory.\n" );
-
-		/* Get Value from dictionary */
-		returnVal = Dictionary_Get( rootDict, rootDictKey );
-		if ( !returnVal && defaultVal ) {
-			returnVal = Dictionary_GetDefault( rootDict, rootDictKey, defaultVal );
-			usedDefault = True;
-		}
-
-		/* Print Stuff */
-		if ( usedDefault ) {
-			Journal_PrintfL( stream, 2, "Using default value = " );
-			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-				Dictionary_Entry_Value_Print( returnVal, stream );
-			Journal_PrintfL( stream, 2, "\n" );
-			return returnVal;
-		}
-		else if ( returnVal ) {
-			Journal_PrintfL( stream, 2, "Found - Value = " );
-			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
-				Dictionary_Entry_Value_Print( returnVal, stream );
-			Journal_PrintfL( stream, 2, "\n" );
-		}
-		else 
-			Journal_PrintfL( stream, 2, "Not found.\n" );
-	}
-
-	return returnVal;
-}
-
-
-double Stg_ComponentFactory_PluginGetDouble( void* cf, void *codelet, Dictionary_Entry_Key key, double defaultVal ) {
-	return Dictionary_Entry_Value_AsDouble( 
-                _Stg_ComponentFactory_PluginGetNumericalValue( cf, codelet, key, 
-                                                               Dictionary_Entry_Value_FromDouble( defaultVal )));
-}
-
-int Stg_ComponentFactory_PluginGetInt( void* cf, void *codelet, Dictionary_Entry_Key key, int defaultVal ) {
-	return Dictionary_Entry_Value_AsInt( 
-                _Stg_ComponentFactory_PluginGetNumericalValue( cf, codelet, key, 
-                                                               Dictionary_Entry_Value_FromInt( defaultVal )));
-}
-
-Bool Stg_ComponentFactory_PluginGetBool( void* cf, void *codelet, Dictionary_Entry_Key key, Bool defaultVal ) {
-        return Dictionary_Entry_Value_AsBool( 
-                _Stg_ComponentFactory_PluginGetDictionaryValue( cf, codelet, key,
-                                                                Dictionary_Entry_Value_FromBool( defaultVal ) ) );
-}
-
-char* Stg_ComponentFactory_PluginGetString( void* cf, void* codelet, Dictionary_Entry_Key key, Name const defaultVal ) {
-	return Dictionary_Entry_Value_AsString( 
-            _Stg_ComponentFactory_PluginGetDictionaryValue( cf, codelet, key,
-                                                            Dictionary_Entry_Value_FromString( defaultVal ) ) );
-}
-
-Stg_Component* _Stg_ComponentFactory_ConstructByNameWithKeyFallback( 
-		void*			cf, 
-		Name 			parentComponentName, 
-		Name			componentTrialName, 
-		Dictionary_Entry_Key	fallbackKey, 
-		Type			type, 
-		Bool			isEssential,
-		void*			data ) 
-{
-	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
-	Stg_Component*		component;
-	Stream*			stream            = self->infoStream;
-
-	Journal_PrintfL( stream, 2, "First Trying to find component by name '%s': ", componentTrialName );
-	component = LiveComponentRegister_Get( self->LCRegister, componentTrialName );
-	
-	if (component) {
-		Journal_PrintfL( stream, 2, "Found.\n" );
-
-		if ( !component->isConstructed ) {
-			Journal_Printf( stream, "%s has not been constructed yet. Constructing now.\n", componentTrialName );
-			Stream_Indent( stream );
-			Stg_Component_AssignFromXML( component, self, data, True );
-			Stream_UnIndent( stream );
-		}
-	}
-	else {
-		Journal_PrintfL( stream, 2, "Not found.\n" );
-		Journal_PrintfL( stream, 2, "Fallback - Trying to find component by key '%s'.\n", fallbackKey );
-
-		component = self->constructByKey( self, parentComponentName, fallbackKey, type, isEssential, data );
-	}
-		
-	return component;
-}
-
-Stg_Component** _Stg_ComponentFactory_ConstructByList( 
-		void*			cf, 
-		Name			parentComponentName, 
-		Name			listName, 
-		unsigned int		maxComponents,
-		Type			type,
-		Bool			isEssential,
-		unsigned int*		componentCount,
-		void*			data )
-{
-	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
-	Dictionary*		thisComponentDict = NULL;
-	Dictionary*		componentDict     = NULL;
-	Name			componentName;
-	Dictionary_Entry_Value*	list;
-	Stg_Component**		componentList;
-	Index			component_I;
-	Stream*			errorStream       = Journal_Register( Error_Type, self->type );
-
-	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
-
-	/* Get this Stg_Component's Dictionary */
-	componentDict = self->componentDict;
-	Journal_Firewall( componentDict != NULL, errorStream, 
-			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
-	thisComponentDict = Dictionary_GetDictionary( componentDict, parentComponentName );
-	Journal_Firewall( thisComponentDict != NULL, errorStream,
-			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, parentComponentName );
-	
-	Journal_PrintfL( self->infoStream, 2, "Looking for list '%s': ", listName );
-	if (( list = Dictionary_Get( thisComponentDict, listName ) )) {
-		Journal_PrintfL( self->infoStream, 2, "Found.\n" );
-
-		*componentCount = MIN( Dictionary_Entry_Value_GetCount( list ), maxComponents );
-
-		componentList = Memory_Alloc_Array( Stg_Component*, *componentCount, "componentList" );
-	
-		Stream_Indent( self->infoStream );
-		for ( component_I = 0 ; component_I < *componentCount ; component_I++ ) {
-			componentName = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( list, component_I ) );
-
-			componentList[ component_I ] = self->constructByName( self, componentName, type, isEssential, data );
-		}
-		Stream_UnIndent( self->infoStream );
-	}
-	else {
-		Journal_PrintfL( self->infoStream, 2, "Not Found.\n" );
-
-		Journal_Firewall( !isEssential, errorStream, "Stg_Component '%s' cannot find list '%s'.\n", 
-				parentComponentName, listName );
-
-		*componentCount = 0;
-		componentList   = NULL;
-	}
-
-	return componentList;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Stg_ComponentFactory.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Stg_ComponentFactory.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,1014 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Stg_ComponentFactory.c 4137 2007-06-07 05:46:46Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Stg_Component.h"
+#include "LiveComponentRegister.h"
+#include "Stg_ComponentFactory.h"
+#include "Stg_ComponentRegister.h"
+#include "HierarchyTable.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type Stg_ComponentFactory_Type = "Stg_ComponentFactory";
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+/* Creation implementation */
+Stg_ComponentFactory* _Stg_ComponentFactory_New(  STG_COMPONENTFACTORY_DEFARGS  )
+{
+	Stg_ComponentFactory *self = NULL;
+
+	assert( _sizeOfSelf >= sizeof( Stg_ComponentFactory ) );
+	self = (Stg_ComponentFactory*) _Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	self->getDouble = getDouble;
+	self->getInt = getInt;
+	self->getUnsignedInt = getUnsignedInt;
+	self->getBool = getBool;
+	self->getString = getString;
+
+	self->getRootDictDouble = getRootDictDouble;
+	self->getRootDictInt = getRootDictInt;
+	self->getRootDictUnsignedInt = getRootDictUnsignedInt;
+	self->getRootDictBool = getRootDictBool;
+	self->getRootDictString = getRootDictString;
+	
+	self->constructByName = constructByName;
+	self->constructByKey = constructByKey;
+	self->constructByNameWithKeyFallback  = constructByNameWithKeyFallback;
+	self->constructByList = constructByList;
+
+	self->rootDict = rootDict;
+	self->componentDict = componentDict;
+	self->infoStream = Journal_Register( InfoStream_Type, self->type );
+	Stream_SetPrintingRank( self->infoStream, 0 );
+	Stream_SetAutoFlush( self->infoStream, True );
+		
+	_Stg_ComponentFactory_Init( self );
+	
+	return self;
+}
+	
+Stg_ComponentFactory* Stg_ComponentFactory_New( Dictionary* rootDict, Dictionary* componentDict ) {
+	/* Variables set in this function */
+	SizeT                                                                        _sizeOfSelf = sizeof( Stg_ComponentFactory );
+	Type                                                                                type = Stg_ComponentFactory_Type;
+	Stg_Class_DeleteFunction*                                                        _delete = _Stg_ComponentFactory_Delete;
+	Stg_Class_PrintFunction*                                                          _print = _Stg_ComponentFactory_Print;
+	Stg_ComponentFactory_GetDoubleFunc*                                            getDouble = _Stg_ComponentFactory_GetDouble;
+	Stg_ComponentFactory_GetIntFunc*                                                  getInt = _Stg_ComponentFactory_GetInt;
+	Stg_ComponentFactory_GetUnsignedIntFunc*                                  getUnsignedInt = _Stg_ComponentFactory_GetUnsignedInt;
+	Stg_ComponentFactory_GetBoolFunc*                                                getBool = _Stg_ComponentFactory_GetBool;
+	Stg_ComponentFactory_GetStringFunc*                                            getString = _Stg_ComponentFactory_GetString;
+	Stg_ComponentFactory_GetRootDictDoubleFunc*                            getRootDictDouble = _Stg_ComponentFactory_GetRootDictDouble;
+	Stg_ComponentFactory_GetRootDictIntFunc*                                  getRootDictInt = _Stg_ComponentFactory_GetRootDictInt;
+	Stg_ComponentFactory_GetRootDictUnsignedIntFunc*                  getRootDictUnsignedInt = _Stg_ComponentFactory_GetRootDictUnsignedInt;
+	Stg_ComponentFactory_GetRootDictBoolFunc*                                getRootDictBool = _Stg_ComponentFactory_GetRootDictBool;
+	Stg_ComponentFactory_GetRootDictStringFunc*                            getRootDictString = _Stg_ComponentFactory_GetRootDictString;
+	Stg_ComponentFactory_ConstructByNameFunc*                                constructByName = _Stg_ComponentFactory_ConstructByName;
+	Stg_ComponentFactory_ConstructByKeyFunc*                                  constructByKey = _Stg_ComponentFactory_ConstructByKey;
+	Stg_ComponentFactory_ConstructByNameWithKeyFallbackFunc*  constructByNameWithKeyFallback = _Stg_ComponentFactory_ConstructByNameWithKeyFallback;
+	Stg_ComponentFactory_ConstructByListFunc*                                constructByList = _Stg_ComponentFactory_ConstructByList;
+
+	Stg_ComponentFactory *self = NULL;
+
+	assert( rootDict );
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_Class_CopyFunction*  _copy = NULL;
+
+	self = _Stg_ComponentFactory_New(  STG_COMPONENTFACTORY_PASSARGS  );
+
+	return self;
+}
+
+void _Stg_ComponentFactory_Init( Stg_ComponentFactory *self )
+{
+	assert( self );
+	
+	self->LCRegister = LiveComponentRegister_New( );
+}
+
+void Stg_ComponentFactory_Init( Stg_ComponentFactory *self )
+{
+	assert( self );
+	_Stg_ComponentFactory_Init( self );
+}
+	
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _Stg_ComponentFactory_Delete( void* cf )
+{
+	Stg_ComponentFactory *self = (Stg_ComponentFactory *) cf;
+
+	assert( self );
+
+	Stg_Class_Delete( self->LCRegister ); /* this deletes all the components on the LCRegister */
+	_Stg_Class_Delete( self );
+}
+	
+void _Stg_ComponentFactory_Print( void* cf, Stream* stream )
+{
+	Stg_ComponentFactory *self = (Stg_ComponentFactory*) cf;
+
+	assert( self );
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Stg_ComponentFactory (ptr): %p\n", self );
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+	
+	Journal_Printf( (void*) stream, "LiveComponentRegister (ptr): %p\n", self->LCRegister );
+	Stg_Class_Print( self->LCRegister, stream );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+void Stg_ComponentFactory_SetComponentDictionary( Stg_ComponentFactory *self, Dictionary *dict )
+{
+	assert( self );
+	assert( dict );
+
+	self->componentDict = dict;
+}
+
+void Stg_ComponentFactory_CreateComponents( Stg_ComponentFactory *self ) {
+	Dictionary_Entry*                      componentDictEntry           = NULL;
+	Dictionary*                            currComponentDict            = NULL;
+	Type                                   componentType                = NULL;
+	char*                                  componentName                = NULL;
+	Stg_Component_DefaultConstructorFunction*  componentConstructorFunction;
+	Index                                  component_I;
+	Stream*                                stream;
+	
+	assert( self );
+	
+	stream = self->infoStream;
+	if( self->componentDict ){
+		Journal_Printf( stream, "\nCreating Stg_Components from the component-list\n\n" );
+		Stream_Indent( stream );
+
+		/* add the contexts to the live component register first (so these get constructed/built/initialised first) */	
+		for( component_I = 0; component_I < Dictionary_GetCount( self->componentDict ) ; component_I++ ){
+			componentDictEntry = self->componentDict->entryPtr[ component_I ];
+
+			currComponentDict  = Dictionary_Entry_Value_AsDictionary( componentDictEntry->value );
+			componentType      = Dictionary_GetString( currComponentDict, "Type" );
+			componentName      = componentDictEntry->key;
+
+			if( strcmp( componentType, "DomainContext" ) && 
+			    strcmp( componentType, "FiniteElementContext" ) &&
+			    strcmp( componentType, "PICelleratorContext" ) &&
+			    strcmp( componentType, "UnderworldContext" ) )
+				continue;
+
+			Journal_Firewall( 
+					LiveComponentRegister_Get( self->LCRegister, componentName ) == NULL,
+					Journal_Register( Error_Type, self->type ),
+					"Error in func %s: Trying to instantiate two components with the name of '%s'\n"
+					"Each component's name must be unique.\n",
+					__func__, componentName );
+
+			/* Print Message */
+			Journal_Printf( stream, "Instantiating %s as %s\n", componentType, componentName );
+			
+			/* Get Default Constructor for this type */
+			componentConstructorFunction = Stg_ComponentRegister_AssertGet( 
+					Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" );
+
+			/* Add to register */
+			LiveComponentRegister_Add( self->LCRegister, (Stg_Component*)componentConstructorFunction( componentName ) );
+		}
+
+		/* now add the rest of the components */	
+		for( component_I = 0; component_I < Dictionary_GetCount( self->componentDict ) ; component_I++ ){
+			componentDictEntry = self->componentDict->entryPtr[ component_I ];
+
+			currComponentDict  = Dictionary_Entry_Value_AsDictionary( componentDictEntry->value );
+			componentType      = Dictionary_GetString( currComponentDict, "Type" );
+			componentName      = componentDictEntry->key;
+
+			if( !strcmp( componentType, "DomainContext" ) ||
+			    !strcmp( componentType, "FiniteElementContext" ) ||
+			    !strcmp( componentType, "PICelleratorContext" ) ||
+			    !strcmp( componentType, "UnderworldContext" ) )
+				continue;
+
+			Journal_Firewall( 
+					LiveComponentRegister_Get( self->LCRegister, componentName ) == NULL,
+					Journal_Register( Error_Type, self->type ),
+					"Error in func %s: Trying to instantiate two components with the name of '%s'\n"
+					"Each component's name must be unique.\n",
+					__func__, componentName );
+
+			/* Print Message */
+			Journal_Printf( stream, "Instantiating %s as %s\n", componentType, componentName );
+			
+			/* Get Default Constructor for this type */
+			componentConstructorFunction = Stg_ComponentRegister_AssertGet( 
+					Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" );
+
+			/* Add to register */
+			LiveComponentRegister_Add( self->LCRegister, (Stg_Component*)componentConstructorFunction( componentName ) );
+		}
+
+		Stream_UnIndent( stream );
+	}
+	else{
+		Journal_Printf( stream, "No Stg_Component List found..!\n" );
+	}
+}
+
+void Stg_ComponentFactory_ConstructComponents( Stg_ComponentFactory* self, void* data ) {
+	Stg_Component*                         component                    = NULL;
+	Index                                  component_I;
+	Stream*                                stream;
+	
+	assert( self );
+	
+	stream = self->infoStream;
+
+	if( self->componentDict ){
+		Journal_Printf( stream, "\nConstructing Stg_Components from the live-component register\n\n" );
+		Stream_Indent( stream );
+	
+		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
+			/* Grab component from register */
+			component = LiveComponentRegister_At( self->LCRegister, component_I );
+			if( component && !component->isConstructed ){
+				Stg_Component_AssignFromXML( component, self, data, True );
+			}
+		}
+		Stream_UnIndent( stream );
+	}
+	else{
+		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
+	}
+}
+
+void Stg_ComponentFactory_BuildComponents( Stg_ComponentFactory* self, void* data ) {
+	Stg_Component*                         component                    = NULL;
+	Index                                  component_I;
+	Stream*                                stream;
+	
+	assert( self );
+	
+	stream = self->infoStream;
+
+	if( self->componentDict ){
+		Journal_Printf( stream, "\nBuilding Stg_Components from the live-component register\n\n" );
+		Stream_Indent( stream );
+	
+		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
+			/* Grab component from register */
+			component = LiveComponentRegister_At( self->LCRegister, component_I );
+			if( component && !component->isBuilt ){
+				Stg_Component_Build( component, data, True );
+			}
+		}
+		Stream_UnIndent( stream );
+	}
+	else{
+		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
+	}
+}
+
+void Stg_ComponentFactory_InitialiseComponents( Stg_ComponentFactory* self, void* data ) {
+	Stg_Component*                         component                    = NULL;
+	Index                                  component_I;
+	Stream*                                stream;
+	
+	assert( self );
+	
+	stream = self->infoStream;
+
+	if( self->componentDict ){
+		Journal_Printf( stream, "\nInitialising Stg_Components from the live-component register\n\n" );
+		Stream_Indent( stream );
+	
+		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
+			/* Grab component from register */
+			component = LiveComponentRegister_At( self->LCRegister, component_I );
+			if( component && !component->isInitialised ){
+				Stg_Component_Initialise( component, data, True );
+			}
+		}
+		Stream_UnIndent( stream );
+	}
+	else{
+		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
+	}
+}
+
+void Stg_ComponentFactory_ExecuteComponents( Stg_ComponentFactory* self, void* data ) {
+	Stg_Component*                         component                    = NULL;
+	Index                                  component_I;
+	Stream*                                stream;
+	
+	assert( self );
+	
+	stream = self->infoStream;
+
+	if( self->componentDict ){
+		Journal_Printf( stream, "\nExecuting Stg_Components from the live-component register\n\n" );
+		Stream_Indent( stream );
+	
+		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
+			/* Grab component from register */
+			component = LiveComponentRegister_At( self->LCRegister, component_I );
+			if( component && !component->hasExecuted ){
+				Stg_Component_Execute( component, data, True );
+			}
+		}
+		Stream_UnIndent( stream );
+	}
+	else{
+		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
+	}
+}
+
+void Stg_ComponentFactory_DestroyComponents( Stg_ComponentFactory* self, void* data ) {
+	Stg_Component*                         component                    = NULL;
+	Index                                  component_I;
+	Stream*                                stream;
+	
+	assert( self );
+	
+	stream = self->infoStream;
+
+	if( self->componentDict ){
+		Journal_Printf( stream, "\nDestroying Stg_Components from the live-component register\n\n" );
+		Stream_Indent( stream );
+	
+		for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){
+			/* Grab component from register */
+			component = LiveComponentRegister_At( self->LCRegister, component_I );
+			if( component && !component->isDestroyed ){
+				Stg_Component_Destroy( component, data, True );
+			}
+		}
+		Stream_UnIndent( stream );
+	}
+	else{
+		Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
+	}
+}
+
+Dictionary_Entry_Value* _Stg_ComponentFactory_GetDictionaryValue( void* cf, Name componentName, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
+	Stg_ComponentFactory*       self              = (Stg_ComponentFactory*) cf;
+	Dictionary*             componentDict     = NULL;
+	Dictionary*             thisComponentDict = NULL;
+	Dictionary_Entry_Value* returnVal;
+	Bool                    usedDefault       = False;
+	Stream*                 errorStream       = Journal_Register( Error_Type, Stg_Component_Type );
+	Stream*                 stream            = self->infoStream;
+
+	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_ComponentFactory is NULL.\n", __func__ );
+
+	Journal_PrintfL( stream, 2, "Getting parameter '%s': ", key );
+
+	/* Get this Stg_Component's Dictionary */
+	componentDict = self->componentDict;
+	Journal_Firewall( componentDict != NULL, errorStream, 
+			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
+	thisComponentDict = Dictionary_GetDictionary( componentDict, componentName );
+	Journal_Firewall( thisComponentDict != NULL, errorStream,
+			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, componentName );
+
+	/* Get Value from dictionary */
+	returnVal = Dictionary_Get( thisComponentDict, key );
+	if ( !returnVal && defaultVal ) {
+		returnVal = Dictionary_GetDefault( thisComponentDict, key, defaultVal );
+		usedDefault = True;
+	}
+
+	/* Print Stuff */
+	if ( usedDefault ) {
+		Journal_PrintfL( stream, 2, "Using default value = " );
+		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+			Dictionary_Entry_Value_Print( returnVal, stream );
+		Journal_PrintfL( stream, 2, "\n" );
+
+		return returnVal;
+	}
+	else if ( returnVal ) {
+		Journal_PrintfL( stream, 2, "Found - Value = " );
+		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+			Dictionary_Entry_Value_Print( returnVal, stream );
+		Journal_PrintfL( stream, 2, "\n" );
+	}
+	else 
+		Journal_PrintfL( stream, 2, "Not found.\n" );
+
+	return returnVal;
+}
+
+Dictionary_Entry_Value* _Stg_ComponentFactory_GetNumericalValue( void* cf, Name componentName, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
+	Stg_ComponentFactory*       self              = (Stg_ComponentFactory*) cf;
+	Dictionary_Entry_Value* returnVal;
+	Bool                    usedDefault       = False;
+	Stream*                 errorStream       = Journal_Register( Error_Type, Stg_Component_Type );
+	Stream*                 stream            = self->infoStream;
+
+	returnVal = _Stg_ComponentFactory_GetDictionaryValue( self, componentName, key, defaultVal );
+
+	/* Check to see whether the type is a string -
+	 * if it is then assume that this is a dictionary key linking to the root dictionary */
+	if ( returnVal ) {
+		Dictionary_Entry_Key rootDictKey = Dictionary_Entry_Value_AsString( returnVal );
+		Dictionary*          rootDict    = self->rootDict;
+
+		/* Check if the number really is a string or not */
+		if ( Stg_StringIsNumeric( rootDictKey ) )
+			return returnVal;
+		
+		Journal_PrintfL( stream, 2, "Key '%s' points to key '%s' in the root dictionary: ", key, rootDictKey );
+
+		Journal_Firewall( rootDict != NULL, errorStream, "Root Dictionary NULL in component factory.\n" );
+
+		/* Get Value from dictionary */
+		returnVal = Dictionary_Get( rootDict, rootDictKey );
+		if ( !returnVal && defaultVal ) {
+			returnVal = Dictionary_GetDefault( rootDict, rootDictKey, defaultVal );
+			usedDefault = True;
+		}
+
+		/* Print Stuff */
+		if ( usedDefault ) {
+			Journal_PrintfL( stream, 2, "Using default value = " );
+			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+				Dictionary_Entry_Value_Print( returnVal, stream );
+			Journal_PrintfL( stream, 2, "\n" );
+			return returnVal;
+		}
+		else if ( returnVal ) {
+			Journal_PrintfL( stream, 2, "Found - Value = " );
+			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+				Dictionary_Entry_Value_Print( returnVal, stream );
+			Journal_PrintfL( stream, 2, "\n" );
+		}
+		else 
+			Journal_PrintfL( stream, 2, "Not found.\n" );
+	}
+
+	return returnVal;
+}
+
+double Stg_ComponentFactory_GetDouble( void* cf, Name componentName, Dictionary_Entry_Key key, double defaultVal ) {
+        Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
+        return self->getDouble( cf, componentName, key, defaultVal );
+}
+double _Stg_ComponentFactory_GetDouble( void* cf, Name componentName, Dictionary_Entry_Key key, double defaultVal ) {
+	return Dictionary_Entry_Value_AsDouble( 
+			_Stg_ComponentFactory_GetNumericalValue( cf, componentName, key, 
+				Dictionary_Entry_Value_FromDouble( defaultVal )));
+}
+int Stg_ComponentFactory_GetInt( void* cf, Name componentName, Dictionary_Entry_Key key, int defaultVal ) {
+	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
+	return self->getInt( cf, componentName, key, defaultVal );
+}
+int _Stg_ComponentFactory_GetInt( void* cf, Name componentName, Dictionary_Entry_Key key, int defaultVal ) {
+	return Dictionary_Entry_Value_AsInt( 
+			_Stg_ComponentFactory_GetNumericalValue( cf, componentName, key, 
+				Dictionary_Entry_Value_FromInt( defaultVal ) ) );
+}	
+unsigned int Stg_ComponentFactory_GetUnsignedInt( void* cf, Name componentName, Dictionary_Entry_Key key, unsigned int defaultVal ) {
+	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
+	return self->getUnsignedInt( cf, componentName, key, defaultVal );
+}
+unsigned int _Stg_ComponentFactory_GetUnsignedInt( void* cf, Name componentName, Dictionary_Entry_Key key, unsigned int defaultVal ) {
+	unsigned int retVal;
+	retVal = Dictionary_Entry_Value_AsUnsignedInt( 
+			_Stg_ComponentFactory_GetNumericalValue( cf, componentName, key, 
+				Dictionary_Entry_Value_FromUnsignedInt( defaultVal )));
+/* 	 TODO : Possible memory leak if defaultVal not added to the dictionary */
+	return retVal;
+}	
+Bool Stg_ComponentFactory_GetBool( void* cf, Name componentName, Dictionary_Entry_Key key, Bool defaultVal ) {
+	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
+	return self->getBool( cf, componentName, key, defaultVal );
+}
+Bool _Stg_ComponentFactory_GetBool( void* cf, Name componentName, Dictionary_Entry_Key key, Bool defaultVal ) {
+	return Dictionary_Entry_Value_AsBool( 
+			_Stg_ComponentFactory_GetDictionaryValue( cf, componentName, key, 
+				Dictionary_Entry_Value_FromBool( defaultVal ) ) );
+}	
+char* Stg_ComponentFactory_GetString( void* cf, Name componentName, Dictionary_Entry_Key key, const char* const defaultVal ) {
+	Stg_ComponentFactory* self = (Stg_ComponentFactory*)cf;
+	return self->getString( cf, componentName, key, defaultVal );
+}
+char* _Stg_ComponentFactory_GetString( void* cf, Name componentName, Dictionary_Entry_Key key, const char* const defaultVal ) {
+	return Dictionary_Entry_Value_AsString( 
+			_Stg_ComponentFactory_GetDictionaryValue( cf, componentName, key, 
+				Dictionary_Entry_Value_FromString( defaultVal ) ) );
+}
+
+
+double Stg_ComponentFactory_GetRootDictDouble( void* cf, Dictionary_Entry_Key key, const double defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	return self->getRootDictDouble( self, key, defaultVal );
+}
+double _Stg_ComponentFactory_GetRootDictDouble( void* cf, Dictionary_Entry_Key key, const double defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	
+	Journal_PrintfL( self->infoStream, 2, "Getting double from root dictionary with key '%s' and default value '%g'\n",
+			key, defaultVal );
+
+	assert( self->rootDict );
+	return Dictionary_GetDouble_WithDefault( self->rootDict, key, defaultVal );
+}
+int Stg_ComponentFactory_GetRootDictInt( void* cf, Dictionary_Entry_Key key, const int defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	return self->getRootDictInt( self, key, defaultVal );
+}
+int _Stg_ComponentFactory_GetRootDictInt( void* cf, Dictionary_Entry_Key key, const int defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	
+	Journal_PrintfL( self->infoStream, 2, "Getting int from root dictionary with key '%s' and default value '%d'\n",
+			key, defaultVal );
+
+	assert( self->rootDict );
+	return Dictionary_GetInt_WithDefault( self->rootDict, key, defaultVal );
+}	
+unsigned int Stg_ComponentFactory_GetRootDictUnsignedInt( void* cf, Dictionary_Entry_Key key, const unsigned int defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	return self->getRootDictUnsignedInt( self, key, defaultVal );
+}
+unsigned int _Stg_ComponentFactory_GetRootDictUnsignedInt( void* cf, Dictionary_Entry_Key key, const unsigned int defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	
+	Journal_PrintfL( self->infoStream,2, "Getting unsigned int from root dictionary with key '%s' and default value '%u'\n",
+			key, defaultVal );
+
+	assert( self->rootDict );
+	return Dictionary_GetUnsignedInt_WithDefault( self->rootDict, key, defaultVal );
+}	
+Bool Stg_ComponentFactory_GetRootDictBool( void* cf, Dictionary_Entry_Key key, const Bool defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	return self->getRootDictBool( self, key, defaultVal );
+}
+Bool _Stg_ComponentFactory_GetRootDictBool( void* cf, Dictionary_Entry_Key key, const Bool defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	
+	Journal_PrintfL( self->infoStream, 2, "Getting Bool from root dictionary with key '%s' and default value '%s'\n",
+			key, defaultVal ? "True" : "False" );
+
+	assert( self->rootDict );
+	return Dictionary_GetBool_WithDefault( self->rootDict, key, defaultVal );
+}	
+char* Stg_ComponentFactory_GetRootDictString( void* cf, Dictionary_Entry_Key key, Name const defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+	return self->getRootDictString( self, key, defaultVal );
+}
+char* _Stg_ComponentFactory_GetRootDictString( void* cf, Dictionary_Entry_Key key, Name const defaultVal ) {
+	Stg_ComponentFactory*    self              = (Stg_ComponentFactory*)cf;
+
+	Journal_PrintfL( self->infoStream, 2, "Getting string from root dictionary with key '%s' and default value '%s'\n",
+			key, defaultVal );
+
+	assert( self->rootDict );
+	return Dictionary_GetString_WithDefault( self->rootDict, key, defaultVal );
+}
+
+
+Stg_Component* _Stg_ComponentFactory_ConstructByName( void* cf, Name componentName, Type type, Bool isEssential, void* data ) {
+	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
+	Stg_Component*		component;
+	Stream*			stream            = self->infoStream;
+
+	Journal_PrintfL( stream, 2, "Looking for %sessential component '%s': ", (isEssential ? "" : "non-"), componentName );
+
+	component = LiveComponentRegister_Get( self->LCRegister, componentName );
+
+	/* Checking */
+	if (component) {
+		Journal_PrintfL( stream, 2, "Found.\n" );
+
+		if ( !component->isConstructed ) {
+			Journal_Printf( stream, "%s has not been constructed yet. Constructing now.\n", componentName );
+			Stream_Indent( stream );
+			Stg_Component_AssignFromXML( component, self, data, True );
+			Stream_UnIndent( stream );
+		}
+
+		Stg_Class_CheckType( component, type );
+
+		/* Note: I think we should disable the line below here since this function is only providing a reference
+		to an existing object, not creating a brand new one, and it was thus stuffing up the count so the
+		original object never got deleted. If we are going to do reference counting we need to adapt it across
+		the board so whenever you request access to memory you delete your own reference.
+		-- Main.PatrickSunter 18 May 2006 */
+		Memory_CountInc( component );
+	}
+	else {
+		Name			redirect;
+
+		/* If we can find the component's name in the root dictionary, use that value instead. */
+		if( self->rootDict ) {
+			redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
+			if( strcmp( redirect, "" ) ) {
+				componentName = redirect;
+				return self->constructByName( self, componentName, type, isEssential, data );
+			}
+		}
+
+		Journal_PrintfL( stream, 2, "Not found.\n" );
+
+		if ( isEssential ) {
+			Stream* errorStream = Journal_Register( Error_Type, self->type );
+
+			Journal_Printf( errorStream, "In func %s: Cannot find essential component '%s'.\n", __func__, componentName );
+
+			Journal_Printf( errorStream, "Could you have meant one of these?\n" );
+
+			Stream_Indent( errorStream );
+			LiveComponentRegister_PrintSimilar( self->LCRegister, componentName, errorStream, 5 );
+			abort();
+		}
+	}
+	
+	return component;
+}
+
+Stg_Component* _Stg_ComponentFactory_ConstructByKey( 
+		void*			cf, 
+		Name		parentComponentName, 
+		Dictionary_Entry_Key	componentKey,
+		Type			type, 
+		Bool 			isEssential,
+		void* 			data ) 
+{
+	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
+	Dictionary*		thisComponentDict = NULL;
+	Dictionary*		componentDict     = NULL;
+	Name			componentName, redirect;
+	Dictionary_Entry_Value*	componentEntryVal;
+	Stream*			errorStream       = Journal_Register( Error_Type, self->type );
+
+	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
+
+	/* Get this Stg_Component's Dictionary */
+	componentDict = self->componentDict;
+	Journal_Firewall( componentDict != NULL, errorStream, 
+			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
+	thisComponentDict = Dictionary_GetDictionary( componentDict, parentComponentName );
+	Journal_Firewall( thisComponentDict != NULL, errorStream,
+			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, parentComponentName );
+
+	/* Get Dependency's Name */
+	componentEntryVal = Dictionary_Get( thisComponentDict, componentKey );
+	if ( componentEntryVal == NULL ) {
+		Journal_Firewall( !isEssential, errorStream,
+				"Stg_Component '%s' cannot find essential component with key '%s'.\n", parentComponentName, componentKey );
+		Journal_PrintfL( self->infoStream, 2, "Stg_Component '%s' cannot find non-essential component with key '%s'.\n", parentComponentName, componentKey );
+		return NULL;
+	}
+		
+	componentName = Dictionary_Entry_Value_AsString( componentEntryVal );
+
+	/* If we can find the component's name in the root dictionary, use that value instead. */
+	if( self->rootDict ) {
+		redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
+		if( strcmp( redirect, "" ) )
+			componentName = redirect;
+	}
+
+	return self->constructByName( self, componentName, type, isEssential, data );
+}
+
+Stg_Component* _Stg_ComponentFactory_PluginConstructByKey( 
+	void*						cf, 
+	void*						codelet, 
+	Dictionary_Entry_Key	componentKey,
+	Type						type, 
+	Bool						isEssential,
+	void*						data ) 
+{
+	Stg_ComponentFactory*	self = (Stg_ComponentFactory*)cf;
+	Stg_Component*				plugin = (Stg_Component*)codelet;
+	Dictionary*					thisPluginDict = NULL;
+	Dictionary*					pluginDict = (Dictionary*)Dictionary_Get( self->rootDict, "plugins" );
+	char							*componentName, *redirect, *pluginType;
+	Dictionary_Entry_Value*	componentEntryVal;
+	Index							pluginIndex;
+	Stream*						errorStream = Journal_Register( Error_Type, self->type );
+
+	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
+
+	/* Get this plugins Dictionary */
+	for( pluginIndex = 0; pluginIndex < Dictionary_Entry_Value_GetCount( (Dictionary_Entry_Value*)pluginDict ); pluginIndex++ ) {
+		thisPluginDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value_GetElement( (Dictionary_Entry_Value*)pluginDict, pluginIndex ) );
+		pluginType = StG_Strdup( Dictionary_GetString( thisPluginDict, "Type" ) );
+
+		if( !strcmp( plugin->type, pluginType ) ){
+		   Memory_Free( pluginType );
+			break;
+		}
+      Memory_Free( pluginType );
+	}
+	
+	/* Get Dependency's Name */
+	componentEntryVal = Dictionary_Get( thisPluginDict, componentKey );
+	if ( componentEntryVal == NULL ) {
+		Journal_Firewall( !isEssential, errorStream,
+				"plugin '%s' cannot find essential component with key '%s'.\n", plugin->type, componentKey );
+		Journal_PrintfL( self->infoStream, 2, "plugin '%s' cannot find non-essential component with key '%s'.\n", plugin->type, componentKey );
+		return NULL;
+	}
+		
+	componentName = Dictionary_Entry_Value_AsString( componentEntryVal );
+
+	/* If we can find the component's name in the root dictionary, use that value instead. */
+	if( self->rootDict ) {
+		redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
+		if( strcmp( redirect, "" ) )
+			componentName = redirect;
+	}
+
+	return self->constructByName( self, componentName, type, isEssential, data );
+}
+
+Dictionary_Entry_Value* _Stg_ComponentFactory_PluginGetDictionaryValue( void* cf, void *codelet, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
+	Stg_ComponentFactory*       self              = (Stg_ComponentFactory*) cf;
+	Stg_Component*	          plugin	       = (Stg_Component*)codelet;
+	Dictionary*		          thisPluginDict = NULL;
+	Dictionary*		          pluginDict     = (Dictionary*)Dictionary_Get( self->rootDict, "plugins" );
+	char*			             pluginType;
+	Index		pluginIndex;
+	Dictionary_Entry_Value* returnVal;
+	Bool                    usedDefault       = False;
+	Stream*                 errorStream       = Journal_Register( Error_Type, Stg_Component_Type );
+	Stream*                 stream            = self->infoStream;
+
+	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_ComponentFactory is NULL.\n", __func__ );
+
+	Journal_PrintfL( stream, 2, "Getting parameter '%s': ", key );
+
+	Journal_Firewall( pluginDict != NULL, errorStream, 
+			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
+
+	/* Get this plugins Dictionary */
+	for( pluginIndex = 0; pluginIndex < Dictionary_Entry_Value_GetCount( (Dictionary_Entry_Value*)pluginDict ); pluginIndex++ ) {
+		thisPluginDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value_GetElement( (Dictionary_Entry_Value*)pluginDict, pluginIndex ) );
+		pluginType = StG_Strdup( Dictionary_GetString( thisPluginDict, "Type" ) );
+		if( !strcmp( plugin->type, pluginType ) ){
+		   Memory_Free( pluginType );
+			break;
+		}
+                Memory_Free( pluginType );
+	}
+
+	/* Get this Stg_Component's Dictionary */
+	Journal_Firewall( thisPluginDict != NULL, errorStream,
+			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, plugin->name );
+
+	/* Get Value from dictionary */
+	returnVal = Dictionary_Get( thisPluginDict, key );
+	if ( !returnVal && defaultVal ) {
+		returnVal = Dictionary_GetDefault( thisPluginDict, key, defaultVal );
+		usedDefault = True;
+	}
+
+	/* Print Stuff */
+	if ( usedDefault ) {
+		Journal_PrintfL( stream, 2, "Using default value = " );
+		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+			Dictionary_Entry_Value_Print( returnVal, stream );
+		Journal_PrintfL( stream, 2, "\n" );
+
+		return returnVal;
+	}
+	else if ( returnVal ) {
+		Journal_PrintfL( stream, 2, "Found - Value = " );
+		if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+			Dictionary_Entry_Value_Print( returnVal, stream );
+		Journal_PrintfL( stream, 2, "\n" );
+	}
+	else 
+		Journal_PrintfL( stream, 2, "Not found.\n" );
+
+	return returnVal;
+}
+
+Dictionary_Entry_Value* _Stg_ComponentFactory_PluginGetNumericalValue( void* cf, void *codelet, Dictionary_Entry_Key key, Dictionary_Entry_Value* defaultVal ) {
+	Stg_ComponentFactory*    self           = (Stg_ComponentFactory*)cf;
+	Dictionary_Entry_Value* returnVal;
+	Bool                    usedDefault       = False;
+	Stream*                 stream            = self->infoStream;
+	Stream*			errorStream       = Journal_Register( Error_Type, self->type );
+
+	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
+
+	returnVal = _Stg_ComponentFactory_PluginGetDictionaryValue( self, codelet, key, defaultVal );
+
+	/* Check to see whether the type is a string -
+	 * if it is then assume that this is a dictionary key linking to the root dictionary */
+	if ( returnVal ) {
+		Dictionary_Entry_Key rootDictKey = Dictionary_Entry_Value_AsString( returnVal );
+		Dictionary*          rootDict    = self->rootDict;
+
+		/* Check if the number really is a string or not */
+		if ( Stg_StringIsNumeric( rootDictKey ) )
+			return returnVal;
+		
+		Journal_PrintfL( stream, 2, "Key '%s' points to key '%s' in the root dictionary: ", key, rootDictKey );
+
+		Journal_Firewall( rootDict != NULL, errorStream, "Root Dictionary NULL in component factory.\n" );
+
+		/* Get Value from dictionary */
+		returnVal = Dictionary_Get( rootDict, rootDictKey );
+		if ( !returnVal && defaultVal ) {
+			returnVal = Dictionary_GetDefault( rootDict, rootDictKey, defaultVal );
+			usedDefault = True;
+		}
+
+		/* Print Stuff */
+		if ( usedDefault ) {
+			Journal_PrintfL( stream, 2, "Using default value = " );
+			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+				Dictionary_Entry_Value_Print( returnVal, stream );
+			Journal_PrintfL( stream, 2, "\n" );
+			return returnVal;
+		}
+		else if ( returnVal ) {
+			Journal_PrintfL( stream, 2, "Found - Value = " );
+			if ( Stream_IsPrintableLevel( stream, 2 ) ) 
+				Dictionary_Entry_Value_Print( returnVal, stream );
+			Journal_PrintfL( stream, 2, "\n" );
+		}
+		else 
+			Journal_PrintfL( stream, 2, "Not found.\n" );
+	}
+
+	return returnVal;
+}
+
+
+double Stg_ComponentFactory_PluginGetDouble( void* cf, void *codelet, Dictionary_Entry_Key key, double defaultVal ) {
+	return Dictionary_Entry_Value_AsDouble( 
+                _Stg_ComponentFactory_PluginGetNumericalValue( cf, codelet, key, 
+                                                               Dictionary_Entry_Value_FromDouble( defaultVal )));
+}
+
+int Stg_ComponentFactory_PluginGetInt( void* cf, void *codelet, Dictionary_Entry_Key key, int defaultVal ) {
+	return Dictionary_Entry_Value_AsInt( 
+                _Stg_ComponentFactory_PluginGetNumericalValue( cf, codelet, key, 
+                                                               Dictionary_Entry_Value_FromInt( defaultVal )));
+}
+
+Bool Stg_ComponentFactory_PluginGetBool( void* cf, void *codelet, Dictionary_Entry_Key key, Bool defaultVal ) {
+        return Dictionary_Entry_Value_AsBool( 
+                _Stg_ComponentFactory_PluginGetDictionaryValue( cf, codelet, key,
+                                                                Dictionary_Entry_Value_FromBool( defaultVal ) ) );
+}
+
+char* Stg_ComponentFactory_PluginGetString( void* cf, void* codelet, Dictionary_Entry_Key key, Name const defaultVal ) {
+	return Dictionary_Entry_Value_AsString( 
+            _Stg_ComponentFactory_PluginGetDictionaryValue( cf, codelet, key,
+                                                            Dictionary_Entry_Value_FromString( defaultVal ) ) );
+}
+
+Stg_Component* _Stg_ComponentFactory_ConstructByNameWithKeyFallback( 
+		void*			cf, 
+		Name 			parentComponentName, 
+		Name			componentTrialName, 
+		Dictionary_Entry_Key	fallbackKey, 
+		Type			type, 
+		Bool			isEssential,
+		void*			data ) 
+{
+	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
+	Stg_Component*		component;
+	Stream*			stream            = self->infoStream;
+
+	Journal_PrintfL( stream, 2, "First Trying to find component by name '%s': ", componentTrialName );
+	component = LiveComponentRegister_Get( self->LCRegister, componentTrialName );
+	
+	if (component) {
+		Journal_PrintfL( stream, 2, "Found.\n" );
+
+		if ( !component->isConstructed ) {
+			Journal_Printf( stream, "%s has not been constructed yet. Constructing now.\n", componentTrialName );
+			Stream_Indent( stream );
+			Stg_Component_AssignFromXML( component, self, data, True );
+			Stream_UnIndent( stream );
+		}
+	}
+	else {
+		Journal_PrintfL( stream, 2, "Not found.\n" );
+		Journal_PrintfL( stream, 2, "Fallback - Trying to find component by key '%s'.\n", fallbackKey );
+
+		component = self->constructByKey( self, parentComponentName, fallbackKey, type, isEssential, data );
+	}
+		
+	return component;
+}
+
+Stg_Component** _Stg_ComponentFactory_ConstructByList( 
+		void*			cf, 
+		Name			parentComponentName, 
+		Name			listName, 
+		unsigned int		maxComponents,
+		Type			type,
+		Bool			isEssential,
+		unsigned int*		componentCount,
+		void*			data )
+{
+	Stg_ComponentFactory*	self              = (Stg_ComponentFactory*)cf;
+	Dictionary*		thisComponentDict = NULL;
+	Dictionary*		componentDict     = NULL;
+	Name			componentName;
+	Dictionary_Entry_Value*	list;
+	Stg_Component**		componentList;
+	Index			component_I;
+	Stream*			errorStream       = Journal_Register( Error_Type, self->type );
+
+	Journal_Firewall( self != NULL, errorStream, "In func %s: Stg_Component is NULL.\n", __func__ );
+
+	/* Get this Stg_Component's Dictionary */
+	componentDict = self->componentDict;
+	Journal_Firewall( componentDict != NULL, errorStream, 
+			"In func %s: Stg_Component Factory's dictionary is NULL.\n", __func__ );
+	thisComponentDict = Dictionary_GetDictionary( componentDict, parentComponentName );
+	Journal_Firewall( thisComponentDict != NULL, errorStream,
+			"In func %s: Can't find sub-dictionary for component '%s'.\n", __func__, parentComponentName );
+	
+	Journal_PrintfL( self->infoStream, 2, "Looking for list '%s': ", listName );
+	if (( list = Dictionary_Get( thisComponentDict, listName ) )) {
+		Journal_PrintfL( self->infoStream, 2, "Found.\n" );
+
+		*componentCount = MIN( Dictionary_Entry_Value_GetCount( list ), maxComponents );
+
+		componentList = Memory_Alloc_Array( Stg_Component*, *componentCount, "componentList" );
+	
+		Stream_Indent( self->infoStream );
+		for ( component_I = 0 ; component_I < *componentCount ; component_I++ ) {
+			componentName = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( list, component_I ) );
+
+			componentList[ component_I ] = self->constructByName( self, componentName, type, isEssential, data );
+		}
+		Stream_UnIndent( self->infoStream );
+	}
+	else {
+		Journal_PrintfL( self->infoStream, 2, "Not Found.\n" );
+
+		Journal_Firewall( !isEssential, errorStream, "Stg_Component '%s' cannot find list '%s'.\n", 
+				parentComponentName, listName );
+
+		*componentCount = 0;
+		componentList   = NULL;
+	}
+
+	return componentList;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Stg_ComponentRegister.c
--- a/Base/Automation/src/Stg_ComponentRegister.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,327 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Stg_ComponentRegister.c 2745 2005-05-1 08:12:18Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Stg_Component.h"
-#include "Stg_ComponentRegister.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Textual name of this class */
-const Type Stg_ComponentRegister_Type = "Stg_ComponentRegister";
-const Type Stg_ComponentRegisterElement_Type = "Stg_ComponentRegisterElement";
-
-const Name Version = "0";
-Stg_ComponentRegister *stgComponentRegister = NULL;
-
-Stg_ComponentRegister *_Stg_ComponentRegister_New(  STG_COMPONENTREGISTER_DEFARGS  )
-{
-	Stg_ComponentRegister *self = NULL;
-
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stg_ComponentRegister) );
-	self = (Stg_ComponentRegister*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	return self;
-}
-	
-Stg_ComponentRegister *Stg_ComponentRegister_New(  )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof( Stg_ComponentRegister );
-	Type                              type = Stg_ComponentRegister_Type;
-	Stg_Class_DeleteFunction*      _delete = _Stg_ComponentRegister_Delete;
-	Stg_Class_PrintFunction*        _print = _Stg_ComponentRegister_Print;
-
-	Stg_ComponentRegister *self = NULL;
-
-	if( stgComponentRegister == NULL ){
-		
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_Class_CopyFunction*  _copy = NULL;
-
-		self = _Stg_ComponentRegister_New(  STG_COMPONENTREGISTER_PASSARGS  );
-		Stg_ComponentRegister_Init( self );
-	}
-	else{
-		self = stgComponentRegister;
-	}
-
-	return self;
-}
-	
-/* Initialisation implementation */
-void _Stg_ComponentRegister_Init( Stg_ComponentRegister* self )
-{
-	assert( self );
-	
-	self->constructors = Stg_ObjectList_New();
-   self->debugStream = Journal_Register( Debug_Type, "ComponentRegisterDebug" );
-}
-	
-void Stg_ComponentRegister_Init( Stg_ComponentRegister* self )
-{
-	assert( self );
-	_Stg_ComponentRegister_Init( self );
-}
-	
-/* Delete boundary condition layout implementation */
-void _Stg_ComponentRegister_Delete( void* componentRegister )
-{
-	Stg_ComponentRegister *self = NULL;
-
-	self = (Stg_ComponentRegister*) componentRegister;
-	assert( self );
-
-   Stg_ObjectList_DeleteAllObjects( self->constructors );
-	Stg_Class_Delete( self->constructors );
-	_Stg_Class_Delete( self );
-}
-	
-void _Stg_ComponentRegister_Print( void* componentRegister, Stream* stream )
-{
-	Stg_ComponentRegister *self = NULL;
-
-	self = ( Stg_ComponentRegister* ) componentRegister;
-
-	assert( self );
-	
-		/* General info */
-	Journal_Printf( (void*) stream, "Stg_ComponentRegister (ptr): %p\n", self );
-	_Stg_Class_Print( self, stream );
-	Journal_Printf( stream, "Constructors:\n" );
-	Stg_Class_Print( self->constructors, stream );
-}
-	
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-int Stg_ComponentRegister_AddFunc( 
-		Stg_ComponentRegister *self,
-		Name componentType,
-		Name version,
-		Stg_Component_DefaultConstructorFunction *func,
-		Stg_Component_MetaAsDictionaryFunction* metadata )
-{
-	Stg_ComponentRegisterElement *element = NULL;
-
-	assert( self );
-
-   element = Stg_ComponentRegisterElement_New(Stg_ComponentRegisterElement_Type,
-                                              _Stg_ComponentRegisterElement_Delete,
-                                              _Stg_ComponentRegisterElement_Print,
-                                              componentType,
-                                              func,
-                                              metadata,
-                                              version
-      );
-
-   Journal_Printf( self->debugStream, "Adding [%s] to ComponentRegister\n", componentType);
-
-   /* Copy component type into name field - used as key in objectList */
-   element->name = StG_Strdup(componentType);   
-
-   /* search object list to avoid duplicates... */
-	Journal_Firewall( Stg_ObjectList_Get(self->constructors, element->name ) == NULL,
-			Journal_Register( Error_Type, Stg_ComponentRegister_Type ), 
-			"Error in func %s: Attempting to enter duplicate constructors for type '%s' (version '%s').\n"
-			"This should only be done once per type.\n",
-			__func__, componentType, version );
-
-   /* Append element to list */
- 	Stg_ObjectList_Append(self->constructors, element );
-	return 1;
-}
-
-Bool Stg_ComponentRegister_RemoveEntry(
-		Stg_ComponentRegister* self,
-		Name                   componentType,
-		Name                   version ) 
-{
-	assert( self );
-   Stg_ObjectList_Remove( self->constructors, componentType, DELETE);
-	return True;
-}
-
-Stg_Component_DefaultConstructorFunction* Stg_ComponentRegister_Get( 
-		Stg_ComponentRegister* self,
-		Name                   componentType,
-		Name                   version ) 
-{
-	assert( self );
-   /* Get the element object */
-	Stg_ComponentRegisterElement *element = (Stg_ComponentRegisterElement*)Stg_ObjectList_Get(self->constructors, componentType); 
-	if ( element )
-      /* Return the constructor function pointer */
-	   return element->defaultConstructor;
-   else
-      return NULL;
-}
-
-Stg_Component_DefaultConstructorFunction* Stg_ComponentRegister_AssertGet( 
-		Stg_ComponentRegister* self,
-		Name                   componentType,
-		Name                   version ) 
-{
-	Stg_Component_DefaultConstructorFunction* componentConstructorFunction;
-	
-	componentConstructorFunction = Stg_ComponentRegister_Get( self, componentType, version );
-
-	/* If we cannot find the default construct for this componentType - then abort() with a nice message */
-	if ( !componentConstructorFunction ) {
-		Stream* errorStream = Journal_Register( Error_Type, self->type );
-
-		Journal_Printf( errorStream, "Cannot find default constructor function for type '%s'\n", componentType );
-		Journal_Printf( errorStream, "Could you have meant one of these?\n" );
-
-		Stream_Indent( errorStream );
-		Stg_ComponentRegister_PrintSimilar( self, componentType, errorStream, 5 );
-		abort();
-	}	
-
-	return componentConstructorFunction;
-}
-
-Dictionary* Stg_ComponentRegister_GetMetadata(
-		Stg_ComponentRegister* self,
-		Name                   componentType,
-		Name                   version ) 
-{
-	Stg_ComponentRegisterElement *element = NULL;
-	assert( self );
-	element = (Stg_ComponentRegisterElement*)Stg_ObjectList_Get(self->constructors, componentType); 
-	if( element ){
-		return (Dictionary*) element->metadata();
-	}
-
-	return NULL;
-}
-
-Stg_ComponentRegister *Stg_ComponentRegister_Get_ComponentRegister() {
-	return stgComponentRegister;
-}
-
-int Stg_ComponentRegister_GetCount( void* componentRegister ) {
-	Stg_ComponentRegister* self = (Stg_ComponentRegister*)componentRegister;
-	return self->constructors->count;
-}
-
-/** Stg_ComponentRegisterElement methods: 
- * Constructor interface... */
-Stg_ComponentRegisterElement* Stg_ComponentRegisterElement_New(
-		Type			type,
-		Stg_Class_DeleteFunction*	_delete,
-		Stg_Class_PrintFunction*	_print,
-      Type        componentType,
-		Stg_Component_DefaultConstructorFunction*		defaultConstructor,
-		Stg_Component_MetaAsDictionaryFunction*      metadata,
-		Name								version
-      )
-{
-   Stg_ComponentRegisterElement* self = ( Stg_ComponentRegisterElement*)_Stg_Class_New( 
-                                          sizeof(Stg_ComponentRegisterElement),
-                                          type, _delete, _print, _Stg_Class_Copy);
-
-   self->componentType = StG_Strdup(componentType);
-   self->defaultConstructor = defaultConstructor;
-   self->metadata = metadata;
-   self->version = StG_Strdup(version);
-   return self;   /* How in the hell this worked previously without returning anything I have no idea */ 
-}
-
-void _Stg_ComponentRegisterElement_Delete( void* self )
-{
-   Stg_ComponentRegisterElement* element = (Stg_ComponentRegisterElement*)self; 
-	if( element ){
-		if (element->componentType) Memory_Free( element->componentType );
-		if (element->version) Memory_Free( element->version );
-		if (element->name) Memory_Free( element->name);
-      _Stg_Class_Delete( element ); /* element's parent is a class so delete it */
-	}
-}
-Stg_ComponentRegisterElement* Stg_ComponentRegister_GetByIndex( void* componentRegister, Index index ) {
-	Stg_ComponentRegister* self = (Stg_ComponentRegister*)componentRegister;
-   assert(index < self->constructors->count);
-	return (Stg_ComponentRegisterElement*)self->constructors->data[index]; 
-}
-
-Type Stg_ComponentRegisterElement_GetType( Stg_ComponentRegisterElement* element ) {
-	return element->componentType;
-}
-
-Name Stg_ComponentRegisterElement_GetVersion( Stg_ComponentRegisterElement* element ) {
-	return element->version;
-}
-
-Stg_Component_DefaultConstructorFunction* Stg_ComponentRegisterElement_GetConstructor( Stg_ComponentRegisterElement* element ) {
-	return element->defaultConstructor;
-}
-
-Dictionary* Stg_ComponentRegisterElement_GetMetadata( Stg_ComponentRegisterElement* element ) {
-	return element->metadata();
-}
-
-void _Stg_ComponentRegisterElement_Print( void* self, Stream* printStream )	
-{
-   Stg_ComponentRegisterElement* element = (Stg_ComponentRegisterElement*)self; 
-	Journal_Printf( printStream, "Constructor Information\n");
-	Journal_Printf( printStream, "\tStg_ComponentType                : %s\n", element->componentType );
-	Journal_Printf( printStream, "\tStg_Component Default Constructor: %p\n", element->defaultConstructor );
-	Journal_Printf( printStream, "\tVersion                      : %s\n", element->version );
-}
-
-
-
-void Stg_ComponentRegister_PrintSimilar( void* componentRegister, Name name, void* _stream, unsigned int number ) {
-	Stg_ComponentRegister*                  self               = (Stg_ComponentRegister*) componentRegister;
-   Stg_ObjectList_PrintSimilar( self->constructors, name, _stream, number );
-}
-
-void Stg_ComponentRegister_PrintAllTypes( void* componentRegister, void* stream ) {
-	Stg_ComponentRegister*                  self               = (Stg_ComponentRegister*) componentRegister;
-
-	/* Parse the list, printing all the names */
-   int i;
-	Stg_ComponentRegisterElement* element;
-	for(i = 0; i < Stg_ComponentRegister_GetCount(self); i++) {
-      element = Stg_ComponentRegister_GetByIndex(self, i);
-	   Journal_Printf( stream, "%s\n", element->componentType );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/src/Stg_ComponentRegister.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/src/Stg_ComponentRegister.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,327 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Stg_ComponentRegister.c 2745 2005-05-1 08:12:18Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Stg_Component.h"
+#include "Stg_ComponentRegister.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Textual name of this class */
+const Type Stg_ComponentRegister_Type = "Stg_ComponentRegister";
+const Type Stg_ComponentRegisterElement_Type = "Stg_ComponentRegisterElement";
+
+const Name Version = "0";
+Stg_ComponentRegister *stgComponentRegister = NULL;
+
+Stg_ComponentRegister *_Stg_ComponentRegister_New(  STG_COMPONENTREGISTER_DEFARGS  )
+{
+	Stg_ComponentRegister *self = NULL;
+
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stg_ComponentRegister) );
+	self = (Stg_ComponentRegister*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	return self;
+}
+	
+Stg_ComponentRegister *Stg_ComponentRegister_New(  )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof( Stg_ComponentRegister );
+	Type                              type = Stg_ComponentRegister_Type;
+	Stg_Class_DeleteFunction*      _delete = _Stg_ComponentRegister_Delete;
+	Stg_Class_PrintFunction*        _print = _Stg_ComponentRegister_Print;
+
+	Stg_ComponentRegister *self = NULL;
+
+	if( stgComponentRegister == NULL ){
+		
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_Class_CopyFunction*  _copy = NULL;
+
+		self = _Stg_ComponentRegister_New(  STG_COMPONENTREGISTER_PASSARGS  );
+		Stg_ComponentRegister_Init( self );
+	}
+	else{
+		self = stgComponentRegister;
+	}
+
+	return self;
+}
+	
+/* Initialisation implementation */
+void _Stg_ComponentRegister_Init( Stg_ComponentRegister* self )
+{
+	assert( self );
+	
+	self->constructors = Stg_ObjectList_New();
+   self->debugStream = Journal_Register( Debug_Type, "ComponentRegisterDebug" );
+}
+	
+void Stg_ComponentRegister_Init( Stg_ComponentRegister* self )
+{
+	assert( self );
+	_Stg_ComponentRegister_Init( self );
+}
+	
+/* Delete boundary condition layout implementation */
+void _Stg_ComponentRegister_Delete( void* componentRegister )
+{
+	Stg_ComponentRegister *self = NULL;
+
+	self = (Stg_ComponentRegister*) componentRegister;
+	assert( self );
+
+   Stg_ObjectList_DeleteAllObjects( self->constructors );
+	Stg_Class_Delete( self->constructors );
+	_Stg_Class_Delete( self );
+}
+	
+void _Stg_ComponentRegister_Print( void* componentRegister, Stream* stream )
+{
+	Stg_ComponentRegister *self = NULL;
+
+	self = ( Stg_ComponentRegister* ) componentRegister;
+
+	assert( self );
+	
+		/* General info */
+	Journal_Printf( (void*) stream, "Stg_ComponentRegister (ptr): %p\n", self );
+	_Stg_Class_Print( self, stream );
+	Journal_Printf( stream, "Constructors:\n" );
+	Stg_Class_Print( self->constructors, stream );
+}
+	
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+int Stg_ComponentRegister_AddFunc( 
+		Stg_ComponentRegister *self,
+		Name componentType,
+		Name version,
+		Stg_Component_DefaultConstructorFunction *func,
+		Stg_Component_MetaAsDictionaryFunction* metadata )
+{
+	Stg_ComponentRegisterElement *element = NULL;
+
+	assert( self );
+
+   element = Stg_ComponentRegisterElement_New(Stg_ComponentRegisterElement_Type,
+                                              _Stg_ComponentRegisterElement_Delete,
+                                              _Stg_ComponentRegisterElement_Print,
+                                              componentType,
+                                              func,
+                                              metadata,
+                                              version
+      );
+
+   Journal_Printf( self->debugStream, "Adding [%s] to ComponentRegister\n", componentType);
+
+   /* Copy component type into name field - used as key in objectList */
+   element->name = StG_Strdup(componentType);   
+
+   /* search object list to avoid duplicates... */
+	Journal_Firewall( Stg_ObjectList_Get(self->constructors, element->name ) == NULL,
+			Journal_Register( Error_Type, Stg_ComponentRegister_Type ), 
+			"Error in func %s: Attempting to enter duplicate constructors for type '%s' (version '%s').\n"
+			"This should only be done once per type.\n",
+			__func__, componentType, version );
+
+   /* Append element to list */
+ 	Stg_ObjectList_Append(self->constructors, element );
+	return 1;
+}
+
+Bool Stg_ComponentRegister_RemoveEntry(
+		Stg_ComponentRegister* self,
+		Name                   componentType,
+		Name                   version ) 
+{
+	assert( self );
+   Stg_ObjectList_Remove( self->constructors, componentType, DELETE);
+	return True;
+}
+
+Stg_Component_DefaultConstructorFunction* Stg_ComponentRegister_Get( 
+		Stg_ComponentRegister* self,
+		Name                   componentType,
+		Name                   version ) 
+{
+	assert( self );
+   /* Get the element object */
+	Stg_ComponentRegisterElement *element = (Stg_ComponentRegisterElement*)Stg_ObjectList_Get(self->constructors, componentType); 
+	if ( element )
+      /* Return the constructor function pointer */
+	   return element->defaultConstructor;
+   else
+      return NULL;
+}
+
+Stg_Component_DefaultConstructorFunction* Stg_ComponentRegister_AssertGet( 
+		Stg_ComponentRegister* self,
+		Name                   componentType,
+		Name                   version ) 
+{
+	Stg_Component_DefaultConstructorFunction* componentConstructorFunction;
+	
+	componentConstructorFunction = Stg_ComponentRegister_Get( self, componentType, version );
+
+	/* If we cannot find the default construct for this componentType - then abort() with a nice message */
+	if ( !componentConstructorFunction ) {
+		Stream* errorStream = Journal_Register( Error_Type, self->type );
+
+		Journal_Printf( errorStream, "Cannot find default constructor function for type '%s'\n", componentType );
+		Journal_Printf( errorStream, "Could you have meant one of these?\n" );
+
+		Stream_Indent( errorStream );
+		Stg_ComponentRegister_PrintSimilar( self, componentType, errorStream, 5 );
+		abort();
+	}	
+
+	return componentConstructorFunction;
+}
+
+Dictionary* Stg_ComponentRegister_GetMetadata(
+		Stg_ComponentRegister* self,
+		Name                   componentType,
+		Name                   version ) 
+{
+	Stg_ComponentRegisterElement *element = NULL;
+	assert( self );
+	element = (Stg_ComponentRegisterElement*)Stg_ObjectList_Get(self->constructors, componentType); 
+	if( element ){
+		return (Dictionary*) element->metadata();
+	}
+
+	return NULL;
+}
+
+Stg_ComponentRegister *Stg_ComponentRegister_Get_ComponentRegister() {
+	return stgComponentRegister;
+}
+
+int Stg_ComponentRegister_GetCount( void* componentRegister ) {
+	Stg_ComponentRegister* self = (Stg_ComponentRegister*)componentRegister;
+	return self->constructors->count;
+}
+
+/** Stg_ComponentRegisterElement methods: 
+ * Constructor interface... */
+Stg_ComponentRegisterElement* Stg_ComponentRegisterElement_New(
+		Type			type,
+		Stg_Class_DeleteFunction*	_delete,
+		Stg_Class_PrintFunction*	_print,
+      Type        componentType,
+		Stg_Component_DefaultConstructorFunction*		defaultConstructor,
+		Stg_Component_MetaAsDictionaryFunction*      metadata,
+		Name								version
+      )
+{
+   Stg_ComponentRegisterElement* self = ( Stg_ComponentRegisterElement*)_Stg_Class_New( 
+                                          sizeof(Stg_ComponentRegisterElement),
+                                          type, _delete, _print, _Stg_Class_Copy);
+
+   self->componentType = StG_Strdup(componentType);
+   self->defaultConstructor = defaultConstructor;
+   self->metadata = metadata;
+   self->version = StG_Strdup(version);
+   return self;   /* How in the hell this worked previously without returning anything I have no idea */ 
+}
+
+void _Stg_ComponentRegisterElement_Delete( void* self )
+{
+   Stg_ComponentRegisterElement* element = (Stg_ComponentRegisterElement*)self; 
+	if( element ){
+		if (element->componentType) Memory_Free( element->componentType );
+		if (element->version) Memory_Free( element->version );
+		if (element->name) Memory_Free( element->name);
+      _Stg_Class_Delete( element ); /* element's parent is a class so delete it */
+	}
+}
+Stg_ComponentRegisterElement* Stg_ComponentRegister_GetByIndex( void* componentRegister, Index index ) {
+	Stg_ComponentRegister* self = (Stg_ComponentRegister*)componentRegister;
+   assert(index < self->constructors->count);
+	return (Stg_ComponentRegisterElement*)self->constructors->data[index]; 
+}
+
+Type Stg_ComponentRegisterElement_GetType( Stg_ComponentRegisterElement* element ) {
+	return element->componentType;
+}
+
+Name Stg_ComponentRegisterElement_GetVersion( Stg_ComponentRegisterElement* element ) {
+	return element->version;
+}
+
+Stg_Component_DefaultConstructorFunction* Stg_ComponentRegisterElement_GetConstructor( Stg_ComponentRegisterElement* element ) {
+	return element->defaultConstructor;
+}
+
+Dictionary* Stg_ComponentRegisterElement_GetMetadata( Stg_ComponentRegisterElement* element ) {
+	return element->metadata();
+}
+
+void _Stg_ComponentRegisterElement_Print( void* self, Stream* printStream )	
+{
+   Stg_ComponentRegisterElement* element = (Stg_ComponentRegisterElement*)self; 
+	Journal_Printf( printStream, "Constructor Information\n");
+	Journal_Printf( printStream, "\tStg_ComponentType                : %s\n", element->componentType );
+	Journal_Printf( printStream, "\tStg_Component Default Constructor: %p\n", element->defaultConstructor );
+	Journal_Printf( printStream, "\tVersion                      : %s\n", element->version );
+}
+
+
+
+void Stg_ComponentRegister_PrintSimilar( void* componentRegister, Name name, void* _stream, unsigned int number ) {
+	Stg_ComponentRegister*                  self               = (Stg_ComponentRegister*) componentRegister;
+   Stg_ObjectList_PrintSimilar( self->constructors, name, _stream, number );
+}
+
+void Stg_ComponentRegister_PrintAllTypes( void* componentRegister, void* stream ) {
+	Stg_ComponentRegister*                  self               = (Stg_ComponentRegister*) componentRegister;
+
+	/* Parse the list, printing all the names */
+   int i;
+	Stg_ComponentRegisterElement* element;
+	for(i = 0; i < Stg_ComponentRegister_GetCount(self); i++) {
+      element = Stg_ComponentRegister_GetByIndex(self, i);
+	   Journal_Printf( stream, "%s\n", element->componentType );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/CallGraphSuite.c
--- a/Base/Automation/tests/CallGraphSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "CallGraphSuite.h"
-
-typedef struct {
-} CallGraphSuiteData;
-
-const Type TestFunc1_Type = "TestFunc1";
-void TestFunc1( void ) {}
-
-const Type TestFunc2_Type = "TestFunc2";
-void TestFunc2( void ) {}
-
-
-void CallGraphSuite_Setup( CallGraphSuiteData* data ) {
-}
-
-void CallGraphSuite_Teardown( CallGraphSuiteData* data ) {
-}
-   
-
-void CallGraphSuite_TestPushPopBasics( CallGraphSuiteData* data ) {
-   Stg_CallGraph*	cg0;
-   Stg_CallGraph 	cg1;
-   
-   cg0 = Stg_CallGraph_New();
-   Stg_CallGraph_Init( &cg1 );
-   
-   /* Test 2: Can we push the first call on the stack? */
-   Stg_CallGraph_Push( cg0, (void*)TestFunc1, TestFunc1_Type );
-   Stg_CallGraph_Push( &cg1, (void*)TestFunc1, TestFunc1_Type );
-   pcu_check_true( 
-      cg0->_stack && 
-      !cg0->_stack->pop && 
-      cg0->_stack->entry_I == 0 && 
-      cg0->_stack->functionPtr == TestFunc1 &&
-      cg0->_tableCount == 1 && 
-      cg0->table[0].name == TestFunc1_Type &&
-      cg0->table[0].functionPtr == TestFunc1 &&
-      cg0->table[0].parentPtr == 0 &&
-      cg0->table[0].returned == 0 &&
-      cg0->table[0].called == 1 &&
-      cg1._stack && 
-      !cg1._stack->pop && 
-      cg1._stack->entry_I == 0 && 
-      cg1._stack->functionPtr == TestFunc1 &&
-      cg1._tableCount == 1 && 
-      cg1.table[0].name == TestFunc1_Type &&
-      cg1.table[0].functionPtr == TestFunc1 &&
-      cg1.table[0].parentPtr == 0 &&
-      cg1.table[0].returned == 0 &&
-      cg1.table[0].called == 1 );
-   
-   
-   /* Test 3: Can we pop the first call on the stack? */
-   Stg_CallGraph_Pop( cg0 );
-   Stg_CallGraph_Pop( &cg1 );
-
-   pcu_check_true( 
-      !cg0->_stack && 
-      cg0->table[0].name == TestFunc1_Type &&
-      cg0->table[0].functionPtr == TestFunc1 &&
-      cg0->table[0].parentPtr == 0 &&
-      cg0->table[0].returned == 1 &&
-      cg0->table[0].called == 1 &&
-      !cg1._stack && 
-      cg1.table[0].name == TestFunc1_Type &&
-      cg1.table[0].functionPtr == TestFunc1 &&
-      cg1.table[0].parentPtr == 0 &&
-      cg1.table[0].returned == 1 &&
-      cg1.table[0].called == 1 );
-
-   Stg_Class_Delete( &cg1 );
-   Stg_Class_Delete(  cg0 );
-}
-
-
-void CallGraphSuite_TestFuncParentNameHandling( CallGraphSuiteData* data ) {
-   Stg_CallGraph*	cg2;
-   cg2 = Stg_CallGraph_New();
-   
-   /* Test 4: Ensure that each function pointer - parent pointer - name is a unique entry */
-   Stg_CallGraph_Push( cg2, (void*)TestFunc1, TestFunc1_Type ); /* p0: f:1 n:1  Should add */
-   Stg_CallGraph_Push( cg2, (void*)TestFunc2, TestFunc2_Type ); /* p1: f:2 n:2  Should add */
-   Stg_CallGraph_Pop( cg2 );
-   Stg_CallGraph_Push( cg2, (void*)TestFunc2, TestFunc2_Type ); /* p1: f:2 n:2  Should increment */
-   Stg_CallGraph_Pop( cg2 );
-   Stg_CallGraph_Push( cg2, (void*)TestFunc1, TestFunc2_Type ); /* p1: f:1 n:2  Should add (recursive case) */
-   Stg_CallGraph_Pop( cg2 );
-   Stg_CallGraph_Push( cg2, (void*)TestFunc2, TestFunc1_Type ); /* p1: f:2 n:1  Should add */
-   Stg_CallGraph_Push( cg2, (void*)TestFunc1, TestFunc1_Type ); /* p2: f:1 n:1  Should add */
-   Stg_CallGraph_Pop( cg2 );
-   Stg_CallGraph_Pop( cg2 );
-   Stg_CallGraph_Pop( cg2 );
-   pcu_check_true( 
-      !cg2->_stack && 
-      cg2->_tableCount == 5 && 
-      cg2->table[0].returned == 1 &&
-      cg2->table[0].called == 1 &&
-      cg2->table[1].returned == 2 &&
-      cg2->table[1].called == 2 &&
-      cg2->table[2].returned == 1 &&
-      cg2->table[2].called == 1 &&
-      cg2->table[3].returned == 1 &&
-      cg2->table[3].called == 1 &&
-      cg2->table[4].returned == 1 &&
-      cg2->table[4].called == 1 );
-
-   Stg_Class_Delete(  cg2 );
-}
-   
-
-void CallGraphSuite_TestTableRealloc( CallGraphSuiteData* data ) {
-   Stg_CallGraph*	cg3;
-   Index  		count=0;
-   Index		size=0;
-   Index  		ii=0;
-
-   cg3 = Stg_CallGraph_New();
-   /* Test 5: Force a realloc of the table */
-   count = (int)((double)1.5 * cg3->_tableSize);
-   size = cg3->_tableSize;
-   for( ii = 0; ii < count; ii++ ) {
-      /* Use "i" as a unique string (unique pointer value)... don't try to print! */
-     Stg_CallGraph_Push( cg3, (void*)TestFunc1, NULL);
-   }
-   pcu_check_true( cg3->_tableCount == count && cg3->_tableSize == (size * 2) ); 
-
-   Stg_Class_Delete(  cg3 );
-}
-
-
-void CallGraphSuite_TestCopy( CallGraphSuiteData* data ) {
-   Stg_CallGraph*	cg3;
-   Stg_CallGraph*	cg3deep;
-   int		        count=0;
-   int		        ii=0;
-
-   cg3 = Stg_CallGraph_New();
-   count = (int)((double)1.5 * cg3->_tableSize);
-   for( ii = 0; ii < count; ii++ ) {
-      /* Use "i" as a unique string (unique pointer value)... don't try to print! */
-     Stg_CallGraph_Push( cg3, (void*)TestFunc1, NULL);
-   }
-
-   /* Shallow copying not yet implemented */
-   cg3deep = (Stg_CallGraph*)Stg_Class_Copy( cg3, 0, True, 0, 0 );
-   pcu_check_true(
-      cg3->_tableCount == cg3deep->_tableCount &&
-      cg3->_tableSize == cg3deep->_tableSize &&
-      /* TODO: check not just the table, but the stack too */
-      memcmp( cg3->table, cg3deep->table, sizeof(_Stg_CallGraph_Entry) * cg3->_tableCount ) == 0 );
-   
-   Stg_Class_Delete(  cg3 );
-   Stg_Class_Delete(  cg3deep );
-}
-
-
-void CallGraphSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, CallGraphSuiteData );
-   pcu_suite_setFixtures( suite, CallGraphSuite_Setup, CallGraphSuite_Teardown );
-   pcu_suite_addTest( suite, CallGraphSuite_TestPushPopBasics );
-   pcu_suite_addTest( suite, CallGraphSuite_TestFuncParentNameHandling );
-   pcu_suite_addTest( suite, CallGraphSuite_TestTableRealloc );
-   pcu_suite_addTest( suite, CallGraphSuite_TestCopy );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/CallGraphSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/tests/CallGraphSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,205 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "CallGraphSuite.h"
+
+typedef struct {
+} CallGraphSuiteData;
+
+const Type TestFunc1_Type = "TestFunc1";
+void TestFunc1( void ) {}
+
+const Type TestFunc2_Type = "TestFunc2";
+void TestFunc2( void ) {}
+
+
+void CallGraphSuite_Setup( CallGraphSuiteData* data ) {
+}
+
+void CallGraphSuite_Teardown( CallGraphSuiteData* data ) {
+}
+   
+
+void CallGraphSuite_TestPushPopBasics( CallGraphSuiteData* data ) {
+   Stg_CallGraph*	cg0;
+   Stg_CallGraph 	cg1;
+   
+   cg0 = Stg_CallGraph_New();
+   Stg_CallGraph_Init( &cg1 );
+   
+   /* Test 2: Can we push the first call on the stack? */
+   Stg_CallGraph_Push( cg0, (void*)TestFunc1, TestFunc1_Type );
+   Stg_CallGraph_Push( &cg1, (void*)TestFunc1, TestFunc1_Type );
+   pcu_check_true( 
+      cg0->_stack && 
+      !cg0->_stack->pop && 
+      cg0->_stack->entry_I == 0 && 
+      cg0->_stack->functionPtr == TestFunc1 &&
+      cg0->_tableCount == 1 && 
+      cg0->table[0].name == TestFunc1_Type &&
+      cg0->table[0].functionPtr == TestFunc1 &&
+      cg0->table[0].parentPtr == 0 &&
+      cg0->table[0].returned == 0 &&
+      cg0->table[0].called == 1 &&
+      cg1._stack && 
+      !cg1._stack->pop && 
+      cg1._stack->entry_I == 0 && 
+      cg1._stack->functionPtr == TestFunc1 &&
+      cg1._tableCount == 1 && 
+      cg1.table[0].name == TestFunc1_Type &&
+      cg1.table[0].functionPtr == TestFunc1 &&
+      cg1.table[0].parentPtr == 0 &&
+      cg1.table[0].returned == 0 &&
+      cg1.table[0].called == 1 );
+   
+   
+   /* Test 3: Can we pop the first call on the stack? */
+   Stg_CallGraph_Pop( cg0 );
+   Stg_CallGraph_Pop( &cg1 );
+
+   pcu_check_true( 
+      !cg0->_stack && 
+      cg0->table[0].name == TestFunc1_Type &&
+      cg0->table[0].functionPtr == TestFunc1 &&
+      cg0->table[0].parentPtr == 0 &&
+      cg0->table[0].returned == 1 &&
+      cg0->table[0].called == 1 &&
+      !cg1._stack && 
+      cg1.table[0].name == TestFunc1_Type &&
+      cg1.table[0].functionPtr == TestFunc1 &&
+      cg1.table[0].parentPtr == 0 &&
+      cg1.table[0].returned == 1 &&
+      cg1.table[0].called == 1 );
+
+   Stg_Class_Delete( &cg1 );
+   Stg_Class_Delete(  cg0 );
+}
+
+
+void CallGraphSuite_TestFuncParentNameHandling( CallGraphSuiteData* data ) {
+   Stg_CallGraph*	cg2;
+   cg2 = Stg_CallGraph_New();
+   
+   /* Test 4: Ensure that each function pointer - parent pointer - name is a unique entry */
+   Stg_CallGraph_Push( cg2, (void*)TestFunc1, TestFunc1_Type ); /* p0: f:1 n:1  Should add */
+   Stg_CallGraph_Push( cg2, (void*)TestFunc2, TestFunc2_Type ); /* p1: f:2 n:2  Should add */
+   Stg_CallGraph_Pop( cg2 );
+   Stg_CallGraph_Push( cg2, (void*)TestFunc2, TestFunc2_Type ); /* p1: f:2 n:2  Should increment */
+   Stg_CallGraph_Pop( cg2 );
+   Stg_CallGraph_Push( cg2, (void*)TestFunc1, TestFunc2_Type ); /* p1: f:1 n:2  Should add (recursive case) */
+   Stg_CallGraph_Pop( cg2 );
+   Stg_CallGraph_Push( cg2, (void*)TestFunc2, TestFunc1_Type ); /* p1: f:2 n:1  Should add */
+   Stg_CallGraph_Push( cg2, (void*)TestFunc1, TestFunc1_Type ); /* p2: f:1 n:1  Should add */
+   Stg_CallGraph_Pop( cg2 );
+   Stg_CallGraph_Pop( cg2 );
+   Stg_CallGraph_Pop( cg2 );
+   pcu_check_true( 
+      !cg2->_stack && 
+      cg2->_tableCount == 5 && 
+      cg2->table[0].returned == 1 &&
+      cg2->table[0].called == 1 &&
+      cg2->table[1].returned == 2 &&
+      cg2->table[1].called == 2 &&
+      cg2->table[2].returned == 1 &&
+      cg2->table[2].called == 1 &&
+      cg2->table[3].returned == 1 &&
+      cg2->table[3].called == 1 &&
+      cg2->table[4].returned == 1 &&
+      cg2->table[4].called == 1 );
+
+   Stg_Class_Delete(  cg2 );
+}
+   
+
+void CallGraphSuite_TestTableRealloc( CallGraphSuiteData* data ) {
+   Stg_CallGraph*	cg3;
+   Index  		count=0;
+   Index		size=0;
+   Index  		ii=0;
+
+   cg3 = Stg_CallGraph_New();
+   /* Test 5: Force a realloc of the table */
+   count = (int)((double)1.5 * cg3->_tableSize);
+   size = cg3->_tableSize;
+   for( ii = 0; ii < count; ii++ ) {
+      /* Use "i" as a unique string (unique pointer value)... don't try to print! */
+     Stg_CallGraph_Push( cg3, (void*)TestFunc1, NULL);
+   }
+   pcu_check_true( cg3->_tableCount == count && cg3->_tableSize == (size * 2) ); 
+
+   Stg_Class_Delete(  cg3 );
+}
+
+
+void CallGraphSuite_TestCopy( CallGraphSuiteData* data ) {
+   Stg_CallGraph*	cg3;
+   Stg_CallGraph*	cg3deep;
+   int		        count=0;
+   int		        ii=0;
+
+   cg3 = Stg_CallGraph_New();
+   count = (int)((double)1.5 * cg3->_tableSize);
+   for( ii = 0; ii < count; ii++ ) {
+      /* Use "i" as a unique string (unique pointer value)... don't try to print! */
+     Stg_CallGraph_Push( cg3, (void*)TestFunc1, NULL);
+   }
+
+   /* Shallow copying not yet implemented */
+   cg3deep = (Stg_CallGraph*)Stg_Class_Copy( cg3, 0, True, 0, 0 );
+   pcu_check_true(
+      cg3->_tableCount == cg3deep->_tableCount &&
+      cg3->_tableSize == cg3deep->_tableSize &&
+      /* TODO: check not just the table, but the stack too */
+      memcmp( cg3->table, cg3deep->table, sizeof(_Stg_CallGraph_Entry) * cg3->_tableCount ) == 0 );
+   
+   Stg_Class_Delete(  cg3 );
+   Stg_Class_Delete(  cg3deep );
+}
+
+
+void CallGraphSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, CallGraphSuiteData );
+   pcu_suite_setFixtures( suite, CallGraphSuite_Setup, CallGraphSuite_Teardown );
+   pcu_suite_addTest( suite, CallGraphSuite_TestPushPopBasics );
+   pcu_suite_addTest( suite, CallGraphSuite_TestFuncParentNameHandling );
+   pcu_suite_addTest( suite, CallGraphSuite_TestTableRealloc );
+   pcu_suite_addTest( suite, CallGraphSuite_TestCopy );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/CommSuite.c
--- a/Base/Automation/tests/CommSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,303 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "CommSuite.h"
-
-typedef struct {
-   Comm*    comm;
-} CommSuiteData;
-
-
-void CommSuite_Setup( CommSuiteData* data ) {
-   data->comm = Comm_New();
-}
-
-void CommSuite_Teardown( CommSuiteData* data ) {
-   NewClass_Delete( data->comm );
-}
-
-   
-void CommSuite_TestConstruct( CommSuiteData* data ) {
-   pcu_check_true( data->comm );
-   pcu_check_true( data->comm->mpiComm == MPI_COMM_WORLD );
-   pcu_check_true( data->comm->recvs == NULL );
-   pcu_check_true( data->comm->sends == NULL );
-   pcu_check_true( data->comm->stats == NULL );
-
-}
-
-
-void CommSuite_TestSetMPIComm( CommSuiteData* data ) {
-   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
-   pcu_check_true( data->comm->mpiComm == MPI_COMM_WORLD );
-}
-
-
-void CommSuite_TestSetNbrs( CommSuiteData* data ) {
-   int nRanks, rank;
-   int nNbrs, nbrs[2];
-
-   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank + 1;
-      }
-      else if( rank == nRanks - 1 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank - 1;
-      }
-      else {
-	 nNbrs = 2;
-	 nbrs[0] = rank - 1;
-	 nbrs[1] = rank + 1;
-      }
-   }
-   else
-      nNbrs = 0;
-
-   data->comm = Comm_New();
-   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
-   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
-
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank + 1 );
-	 pcu_check_true( 1 );
-      }
-      else if( rank == nRanks - 1 ) {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
-	 pcu_check_true( 1 );
-      }
-      else {
-	 pcu_check_true( data->comm->nbrs.size == 2 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[1] == rank + 1 );
-      }
-      pcu_check_true( data->comm->recvs != NULL );
-      pcu_check_true( data->comm->sends != NULL );
-      pcu_check_true( data->comm->stats != NULL );
-   }
-   else {
-      pcu_check_true( data->comm->nbrs.size == 0 );
-      pcu_check_true( data->comm->nbrs.ptr == NULL );
-      pcu_check_true( data->comm->recvs == NULL );
-      pcu_check_true( data->comm->sends == NULL );
-      pcu_check_true( data->comm->stats == NULL );
-   }
-}
-
-
-void CommSuite_TestAddNbrs( CommSuiteData* data ) {
-   int nRanks, rank;
-   int nNbrs, nbrs[2];
-
-   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank + 1;
-      }
-      else if( rank == nRanks - 1 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank - 1;
-      }
-      else {
-	 nNbrs = 1;
-	 nbrs[0] = rank - 1;
-      }
-   }
-   else
-      nNbrs = 0;
-
-   data->comm = Comm_New();
-   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
-   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
-   if( rank > 0 && rank < nRanks - 1 ) {
-      nNbrs = 1;
-      nbrs[0] = rank + 1;
-   }
-   else
-      nNbrs = 0;
-   Comm_AddNeighbours( data->comm, nNbrs, nbrs );
-
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank + 1 );
-	 pcu_check_true( 1 );
-      }
-      else if( rank == nRanks - 1 ) {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
-	 pcu_check_true( 1 );
-      }
-      else {
-	 pcu_check_true( data->comm->nbrs.size == 2 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[1] == rank + 1 );
-      }
-      pcu_check_true( data->comm->recvs != NULL );
-      pcu_check_true( data->comm->sends != NULL );
-      pcu_check_true( data->comm->stats != NULL );
-   }
-   else {
-      pcu_check_true( data->comm->nbrs.size == 0 );
-      pcu_check_true( data->comm->nbrs.ptr == NULL );
-      pcu_check_true( data->comm->recvs == NULL );
-      pcu_check_true( data->comm->sends == NULL );
-      pcu_check_true( data->comm->stats == NULL );
-   }
-}
-
-
-void CommSuite_TestRemNbrs( CommSuiteData* data ) {
-   int nRanks, rank;
-   int nNbrs, nbrs[2];
-   IMap mapObj, *map = &mapObj;
-
-   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank + 1;
-      }
-      else if( rank == nRanks - 1 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank - 1;
-      }
-      else {
-	 nNbrs = 2;
-	 nbrs[0] = rank - 1;
-	 nbrs[1] = rank + 1;
-      }
-   }
-   else
-      nNbrs = 0;
-
-   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
-   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
-   if( rank > 0 && rank < nRanks - 1 ) {
-      nNbrs = 1;
-      nbrs[0] = 0; /* Local index of nbrs to remove - i.e. this should map to rank -1 */
-   }
-   else
-      nNbrs = 0;
-
-   IMap_Construct( map );
-   Comm_RemoveNeighbours( data->comm, nNbrs, nbrs, map );
-
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == 0 + 1 );
-      }
-      else if( rank == nRanks - 1 ) {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
-      }
-      else {
-	 pcu_check_true( data->comm->nbrs.size == 1 );
-	 pcu_check_true( data->comm->nbrs.ptr[0] == rank + 1 );
-      }
-      pcu_check_true( data->comm->recvs != NULL );
-      pcu_check_true( data->comm->sends != NULL );
-      pcu_check_true( data->comm->stats != NULL );
-   }
-   else {
-      pcu_check_true( data->comm->nbrs.size == 0 );
-      pcu_check_true( data->comm->nbrs.ptr == NULL );
-      pcu_check_true( data->comm->recvs == NULL );
-      pcu_check_true( data->comm->sends == NULL );
-      pcu_check_true( data->comm->stats == NULL );
-   }
-
-   IMap_Destruct( map );
-}
-
-
-void CommSuite_TestAllgather( CommSuiteData* data ) {
-   int nRanks, rank;
-   int nNbrs, nbrs[2];
-
-   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-   if( nRanks > 1 ) {
-      if( rank == 0 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank + 1;
-      }
-      else if( rank == nRanks - 1 ) {
-	 nNbrs = 1;
-	 nbrs[0] = rank - 1;
-      }
-      else {
-	 nNbrs = 2;
-	 nbrs[0] = rank - 1;
-	 nbrs[1] = rank + 1;
-      }
-   }
-   else
-      nNbrs = 0;
-
-   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
-   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
-
-   /* TODO - yet to be written */
-}
-
-
-void CommSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, CommSuiteData );
-   pcu_suite_setFixtures( suite, CommSuite_Setup, CommSuite_Teardown );
-   pcu_suite_addTest( suite, CommSuite_TestConstruct );
-   pcu_suite_addTest( suite, CommSuite_TestSetMPIComm );
-   pcu_suite_addTest( suite, CommSuite_TestSetNbrs );
-   pcu_suite_addTest( suite, CommSuite_TestAddNbrs );
-   pcu_suite_addTest( suite, CommSuite_TestRemNbrs );
-   /* Test below not yet completed */
-   /* pcu_suite_addTest( suite, CommSuite_TestAllgather ); */
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/CommSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/tests/CommSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,303 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "CommSuite.h"
+
+typedef struct {
+   Comm*    comm;
+} CommSuiteData;
+
+
+void CommSuite_Setup( CommSuiteData* data ) {
+   data->comm = Comm_New();
+}
+
+void CommSuite_Teardown( CommSuiteData* data ) {
+   NewClass_Delete( data->comm );
+}
+
+   
+void CommSuite_TestConstruct( CommSuiteData* data ) {
+   pcu_check_true( data->comm );
+   pcu_check_true( data->comm->mpiComm == MPI_COMM_WORLD );
+   pcu_check_true( data->comm->recvs == NULL );
+   pcu_check_true( data->comm->sends == NULL );
+   pcu_check_true( data->comm->stats == NULL );
+
+}
+
+
+void CommSuite_TestSetMPIComm( CommSuiteData* data ) {
+   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
+   pcu_check_true( data->comm->mpiComm == MPI_COMM_WORLD );
+}
+
+
+void CommSuite_TestSetNbrs( CommSuiteData* data ) {
+   int nRanks, rank;
+   int nNbrs, nbrs[2];
+
+   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank + 1;
+      }
+      else if( rank == nRanks - 1 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank - 1;
+      }
+      else {
+	 nNbrs = 2;
+	 nbrs[0] = rank - 1;
+	 nbrs[1] = rank + 1;
+      }
+   }
+   else
+      nNbrs = 0;
+
+   data->comm = Comm_New();
+   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
+   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
+
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank + 1 );
+	 pcu_check_true( 1 );
+      }
+      else if( rank == nRanks - 1 ) {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
+	 pcu_check_true( 1 );
+      }
+      else {
+	 pcu_check_true( data->comm->nbrs.size == 2 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[1] == rank + 1 );
+      }
+      pcu_check_true( data->comm->recvs != NULL );
+      pcu_check_true( data->comm->sends != NULL );
+      pcu_check_true( data->comm->stats != NULL );
+   }
+   else {
+      pcu_check_true( data->comm->nbrs.size == 0 );
+      pcu_check_true( data->comm->nbrs.ptr == NULL );
+      pcu_check_true( data->comm->recvs == NULL );
+      pcu_check_true( data->comm->sends == NULL );
+      pcu_check_true( data->comm->stats == NULL );
+   }
+}
+
+
+void CommSuite_TestAddNbrs( CommSuiteData* data ) {
+   int nRanks, rank;
+   int nNbrs, nbrs[2];
+
+   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank + 1;
+      }
+      else if( rank == nRanks - 1 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank - 1;
+      }
+      else {
+	 nNbrs = 1;
+	 nbrs[0] = rank - 1;
+      }
+   }
+   else
+      nNbrs = 0;
+
+   data->comm = Comm_New();
+   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
+   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
+   if( rank > 0 && rank < nRanks - 1 ) {
+      nNbrs = 1;
+      nbrs[0] = rank + 1;
+   }
+   else
+      nNbrs = 0;
+   Comm_AddNeighbours( data->comm, nNbrs, nbrs );
+
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank + 1 );
+	 pcu_check_true( 1 );
+      }
+      else if( rank == nRanks - 1 ) {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
+	 pcu_check_true( 1 );
+      }
+      else {
+	 pcu_check_true( data->comm->nbrs.size == 2 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[1] == rank + 1 );
+      }
+      pcu_check_true( data->comm->recvs != NULL );
+      pcu_check_true( data->comm->sends != NULL );
+      pcu_check_true( data->comm->stats != NULL );
+   }
+   else {
+      pcu_check_true( data->comm->nbrs.size == 0 );
+      pcu_check_true( data->comm->nbrs.ptr == NULL );
+      pcu_check_true( data->comm->recvs == NULL );
+      pcu_check_true( data->comm->sends == NULL );
+      pcu_check_true( data->comm->stats == NULL );
+   }
+}
+
+
+void CommSuite_TestRemNbrs( CommSuiteData* data ) {
+   int nRanks, rank;
+   int nNbrs, nbrs[2];
+   IMap mapObj, *map = &mapObj;
+
+   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank + 1;
+      }
+      else if( rank == nRanks - 1 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank - 1;
+      }
+      else {
+	 nNbrs = 2;
+	 nbrs[0] = rank - 1;
+	 nbrs[1] = rank + 1;
+      }
+   }
+   else
+      nNbrs = 0;
+
+   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
+   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
+   if( rank > 0 && rank < nRanks - 1 ) {
+      nNbrs = 1;
+      nbrs[0] = 0; /* Local index of nbrs to remove - i.e. this should map to rank -1 */
+   }
+   else
+      nNbrs = 0;
+
+   IMap_Construct( map );
+   Comm_RemoveNeighbours( data->comm, nNbrs, nbrs, map );
+
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == 0 + 1 );
+      }
+      else if( rank == nRanks - 1 ) {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank - 1 );
+      }
+      else {
+	 pcu_check_true( data->comm->nbrs.size == 1 );
+	 pcu_check_true( data->comm->nbrs.ptr[0] == rank + 1 );
+      }
+      pcu_check_true( data->comm->recvs != NULL );
+      pcu_check_true( data->comm->sends != NULL );
+      pcu_check_true( data->comm->stats != NULL );
+   }
+   else {
+      pcu_check_true( data->comm->nbrs.size == 0 );
+      pcu_check_true( data->comm->nbrs.ptr == NULL );
+      pcu_check_true( data->comm->recvs == NULL );
+      pcu_check_true( data->comm->sends == NULL );
+      pcu_check_true( data->comm->stats == NULL );
+   }
+
+   IMap_Destruct( map );
+}
+
+
+void CommSuite_TestAllgather( CommSuiteData* data ) {
+   int nRanks, rank;
+   int nNbrs, nbrs[2];
+
+   MPI_Comm_size( MPI_COMM_WORLD, &nRanks );
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+   if( nRanks > 1 ) {
+      if( rank == 0 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank + 1;
+      }
+      else if( rank == nRanks - 1 ) {
+	 nNbrs = 1;
+	 nbrs[0] = rank - 1;
+      }
+      else {
+	 nNbrs = 2;
+	 nbrs[0] = rank - 1;
+	 nbrs[1] = rank + 1;
+      }
+   }
+   else
+      nNbrs = 0;
+
+   Comm_SetMPIComm( data->comm, MPI_COMM_WORLD );
+   Comm_SetNeighbours( data->comm, nNbrs, nbrs );
+
+   /* TODO - yet to be written */
+}
+
+
+void CommSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, CommSuiteData );
+   pcu_suite_setFixtures( suite, CommSuite_Setup, CommSuite_Teardown );
+   pcu_suite_addTest( suite, CommSuite_TestConstruct );
+   pcu_suite_addTest( suite, CommSuite_TestSetMPIComm );
+   pcu_suite_addTest( suite, CommSuite_TestSetNbrs );
+   pcu_suite_addTest( suite, CommSuite_TestAddNbrs );
+   pcu_suite_addTest( suite, CommSuite_TestRemNbrs );
+   /* Test below not yet completed */
+   /* pcu_suite_addTest( suite, CommSuite_TestAllgather ); */
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/ComponentCopySuite.c
--- a/Base/Automation/tests/ComponentCopySuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,400 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "ComponentCopySuite.h"
-
-/****************************************************************************/
-
-/*
- * A
- * |
- * +------>C
- * |       |
- * +-->B<--+
- */
-
-struct Stg_ComponentA;
-struct Stg_ComponentB;
-struct Stg_ComponentC;
-
-typedef struct Stg_ComponentA Stg_ComponentA;
-typedef struct Stg_ComponentB Stg_ComponentB;
-typedef struct Stg_ComponentC Stg_ComponentC;
-
-Type Stg_ComponentA_Type = "Stg_ComponentA";
-Type Stg_ComponentB_Type = "Stg_ComponentB";
-Type Stg_ComponentC_Type = "Stg_ComponentC";
-
-Name Stg_ComponentA_Type_GetMetadata() { return  ""; }
-Name Stg_ComponentB_Type_GetMetadata() { return  ""; }
-Name Stg_ComponentC_Type_GetMetadata() { return  ""; }
-
-
-#define __Stg_ComponentA \
-	__Stg_Component \
-	Stg_ComponentB* b; \
-	Stg_ComponentC* c;
-struct Stg_ComponentA { __Stg_ComponentA };
-
-void* Stg_ComponentA_NewDefault( Name name );
-void Stg_ComponentA_Delete( void*  );
-void Stg_ComponentA_Print( void* , Stream* s );
-void* Stg_ComponentA_Copy( const void* self, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
-void Stg_ComponentA_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data );
-void Stg_ComponentA_Build( void* component, void* data );
-void Stg_ComponentA_Initialise( void* component, void* data );
-void Stg_ComponentA_Execute( void* component, void* data );
-void Stg_ComponentA_Destroy( void* component, void* data );
-
-void* Stg_ComponentA_NewDefault( Name name )
-{
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(Stg_ComponentA);
-	Type                                                      type = "Stg_ComponentA";
-	Stg_Class_DeleteFunction*                              _delete = Stg_ComponentA_Delete;
-	Stg_Class_PrintFunction*                                _print = Stg_ComponentA_Print;
-	Stg_Class_CopyFunction*                                  _copy = Stg_ComponentA_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = Stg_ComponentA_NewDefault;
-	Stg_Component_ConstructFunction*                    _construct = Stg_ComponentA_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = Stg_ComponentA_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = Stg_ComponentA_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = Stg_ComponentA_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = Stg_ComponentA_Destroy;
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-
-	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-}
-void Stg_ComponentA_Delete( void* clss ) {
-	Stg_ComponentA* self = (Stg_ComponentA*)clss;
-	
-	Stg_Class_Delete( self->c );
-	Stg_Class_Delete( self->b );
-
-	_Stg_Component_Delete( self );
-}
-void Stg_ComponentA_Print( void* clss, Stream* s ) {
-	Stg_ComponentA* self = (Stg_ComponentA*)clss;
-
-	Journal_Printf(
-		s,
-		"%s %s %d,\n", self->name, self->type, Memory_CountGet( self ) );
-	Stg_Class_Print( self->b, s );
-	Stg_Class_Print( self->c, s );
-}
-void* Stg_ComponentA_Copy( const void* clss, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	Stg_ComponentA* self = (Stg_ComponentA*)clss;
-	Stg_ComponentA* newCopy;
-	
-	newCopy = (Stg_ComponentA*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-	PtrMap_Append( ptrMap, self, newCopy );
-	
-	newCopy->b = (Stg_ComponentB*)Stg_Class_Copy( self->b, dest, deep, nameExt, ptrMap );
-	newCopy->c = (Stg_ComponentC*)Stg_Class_Copy( self->c, dest, deep, nameExt, ptrMap );
-	
-	return newCopy;
-}
-void Stg_ComponentA_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	Stg_ComponentA* self = (Stg_ComponentA*)component;
-
-	self->b =  Stg_ComponentFactory_ConstructByName( cf, (Name)"b", Stg_ComponentB, True, data   ) ;
-	self->c =  Stg_ComponentFactory_ConstructByName( cf, (Name)"c", Stg_ComponentC, True, data   ) ;
-}
-void Stg_ComponentA_Build( void* component, void* data ) {
-	Stg_ComponentA* self = (Stg_ComponentA*)component;
-	
-	Stg_Component_Build( self->b, data, False );
-	Stg_Component_Build( self->c, data, False );
-}
-void Stg_ComponentA_Initialise( void* component, void* data ) {
-
-}
-void Stg_ComponentA_Execute( void* component, void* data ) {
-
-}
-void Stg_ComponentA_Destroy( void* component, void* data ) {
-
-}
-Dictionary* Stg_ComponentA_Type_MetaAsDictionary() {
-   return NULL;
-}
-
-#define __Stg_ComponentB \
-	__Stg_Component
-struct Stg_ComponentB { __Stg_ComponentB };
-
-void* Stg_ComponentB_NewDefault( Name name );
-void Stg_ComponentB_Delete( void* );
-void Stg_ComponentB_Print( void* , Stream* s );
-void* Stg_ComponentB_Copy( const void* self, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
-void Stg_ComponentB_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data );
-void Stg_ComponentB_Build( void* component, void* data );
-void Stg_ComponentB_Initialise( void* component, void* data );
-void Stg_ComponentB_Execute( void* component, void* data );
-void Stg_ComponentB_Destroy( void* component, void* data );
-
-void* Stg_ComponentB_NewDefault( Name name )
-{
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(Stg_ComponentB);
-	Type                                                      type = "Stg_ComponentB";
-	Stg_Class_DeleteFunction*                              _delete = Stg_ComponentB_Delete;
-	Stg_Class_PrintFunction*                                _print = Stg_ComponentB_Print;
-	Stg_Class_CopyFunction*                                  _copy = Stg_ComponentB_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = Stg_ComponentB_NewDefault;
-	Stg_Component_ConstructFunction*                    _construct = Stg_ComponentB_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = Stg_ComponentB_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = Stg_ComponentB_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = Stg_ComponentB_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = Stg_ComponentB_Destroy;
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-
-	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-}
-void Stg_ComponentB_Delete( void* clss ) {
-	Stg_ComponentB* self = (Stg_ComponentB*)clss;
-	
-	_Stg_Component_Delete( self );
-}
-void Stg_ComponentB_Print( void* clss, Stream* s ) {
-	Stg_ComponentB* self = (Stg_ComponentB*)clss;
-
-	Journal_Printf(
-		s,
-		"%s %s %d,\n", self->name, self->type, Memory_CountGet( self ) );
-}
-void* Stg_ComponentB_Copy( const void* clss, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	Stg_ComponentB* self = (Stg_ComponentB*)clss;
-	Stg_ComponentB* newCopy;
-	
-	newCopy = (Stg_ComponentB*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-	PtrMap_Append( ptrMap, self, newCopy );
-	
-	return newCopy;
-}
-void Stg_ComponentB_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-}
-void Stg_ComponentB_Build( void* component, void* data ) {
-}
-void Stg_ComponentB_Initialise( void* component, void* data ) {
-}
-void Stg_ComponentB_Execute( void* component, void* data ) {
-}
-void Stg_ComponentB_Destroy( void* component, void* data ) {
-}
-
-Dictionary* Stg_ComponentB_Type_MetaAsDictionary() {
-   return NULL;
-}
-
-
-#define __Stg_ComponentC \
-	__Stg_Component \
-	Stg_ComponentB* b;
-struct Stg_ComponentC { __Stg_ComponentC };
-
-void* Stg_ComponentC_NewDefault( Name name );
-void Stg_ComponentC_Delete( void* clss );
-void Stg_ComponentC_Print( void* clss, Stream* s );
-void* Stg_ComponentC_Copy( const void* self, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
-void Stg_ComponentC_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data );
-void Stg_ComponentC_Build( void* component, void* data );
-void Stg_ComponentC_Initialise( void* component, void* data );
-void Stg_ComponentC_Execute( void* component, void* data );
-void Stg_ComponentC_Destroy( void* component, void* data );
-
-void* Stg_ComponentC_NewDefault( Name name )
-{
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(Stg_ComponentC);
-	Type                                                      type = "Stg_ComponentC";
-	Stg_Class_DeleteFunction*                              _delete = Stg_ComponentC_Delete;
-	Stg_Class_PrintFunction*                                _print = Stg_ComponentC_Print;
-	Stg_Class_CopyFunction*                                  _copy = Stg_ComponentC_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = Stg_ComponentC_NewDefault;
-	Stg_Component_ConstructFunction*                    _construct = Stg_ComponentC_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = Stg_ComponentC_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = Stg_ComponentC_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = Stg_ComponentC_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = Stg_ComponentC_Destroy;
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-
-	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-}
-void Stg_ComponentC_Delete( void* clss ) {
-	Stg_ComponentC* self = (Stg_ComponentC*)clss;
-	
-	Stg_Class_Delete( self->b );
-
-	_Stg_Component_Delete( self );
-}
-void Stg_ComponentC_Print( void* clss, Stream* s ) {
-	Stg_ComponentC* self = (Stg_ComponentC*)clss;
-
-	Journal_Printf(
-		s,
-		"%s %s %d,\n", self->name, self->type, Memory_CountGet( self ) );
-	Stg_Class_Print( self->b, s );
-}
-void* Stg_ComponentC_Copy( const void* clss, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	Stg_ComponentC* self = (Stg_ComponentC*)clss;
-	Stg_ComponentC* newCopy;
-	
-	newCopy = (Stg_ComponentC*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-	PtrMap_Append( ptrMap, self, newCopy );
-
-	newCopy->b = (Stg_ComponentB*)Stg_Class_Copy( self->b, dest, deep, nameExt, ptrMap );
-
-	return newCopy;
-}
-void Stg_ComponentC_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	Stg_ComponentC* self = (Stg_ComponentC*)component;
-
-	self->b =  Stg_ComponentFactory_ConstructByName( cf, (Name)"b", Stg_ComponentB, True, data   ) ;
-}
-void Stg_ComponentC_Build( void* component, void* data ) {
-	Stg_ComponentC* self = (Stg_ComponentC*)component;
-	
-	Stg_Component_Build( self->b, data, False );
-}
-void Stg_ComponentC_Initialise( void* component, void* data ) {
-
-}
-void Stg_ComponentC_Execute( void* component, void* data ) {
-
-}
-void Stg_ComponentC_Destroy( void* component, void* data ) {
-
-}
-Dictionary* Stg_ComponentC_Type_MetaAsDictionary() {
-   return NULL;
-}
-
-/****************************************************************************/
-
-typedef struct {
-   Dictionary*    dict;
-} ComponentCopySuiteData;
-
-
-void ComponentCopySuite_Setup( ComponentCopySuiteData* data ) {
-   data->dict = Dictionary_New();
-}
-
-
-void ComponentCopySuite_Teardown( ComponentCopySuiteData* data ) {
-   Stg_Class_Delete( data->dict );
-}
-   
-
-void ComponentCopySuite_TestCopy( ComponentCopySuiteData* data ) {
-   Stg_ComponentA* a=NULL;
-   Stg_ComponentA* aCopy=NULL;
-   Dictionary* componentsDictionary=NULL;
-   Dictionary* componentDict=NULL;
-
-   Stg_ComponentFactory* cf;
-
-   Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Stg_ComponentA_Type, (Name)"0", (Stg_Component_DefaultConstructorFunction*)Stg_ComponentA_NewDefault );
-
-   Stg_ComponentRegister_Add( 
-      Stg_ComponentRegister_Get_ComponentRegister( ), 
-      Stg_ComponentB_Type,
-      "0",
-      (Stg_Component_DefaultConstructorFunction*)Stg_ComponentB_NewDefault );
-
-   Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Stg_ComponentC_Type, (Name)"0", (Stg_Component_DefaultConstructorFunction*)Stg_ComponentC_NewDefault );
-
-   /* Creating a dictionary of components */
-   componentsDictionary = Dictionary_New();
-   componentDict = Dictionary_New( );
-   Dictionary_AddFromString( componentDict, "Type", "Stg_ComponentA" );
-   Dictionary_AddFromDictionary( componentsDictionary, "a", componentDict );
-   componentDict = Dictionary_New();
-   Dictionary_AddFromString( componentDict, "Type", "Stg_ComponentB" );
-   Dictionary_AddFromDictionary( componentsDictionary, "b", componentDict );
-   componentDict = Dictionary_New();
-   Dictionary_AddFromString( componentDict, "Type", "Stg_ComponentC" );
-   Dictionary_AddFromDictionary( componentsDictionary, "c", componentDict );
-
-   Dictionary_AddFromDictionary( data->dict, "components", componentsDictionary );
-
-   cf = Stg_ComponentFactory_New( data->dict, componentsDictionary );
-   Stream_Enable( cf->infoStream, False );
-
-   Stg_ComponentFactory_CreateComponents( cf );
-   Stg_ComponentFactory_ConstructComponents( cf, 0 /* dummy */ );
-
-   a = (Stg_ComponentA*)LiveComponentRegister_Get( cf->LCRegister, (Name)"a" );
-   
-   /* "Stg_Components creation" */
-   pcu_check_true(
-      a != NULL &&
-      a->b != NULL &&
-      a->c != NULL &&
-      a->b == a->c->b  );
-
-   aCopy = (Stg_ComponentA*)Stg_Class_Copy( a, NULL, True, "_dup", NULL );
-
-   /* Disown the copy. Why? Because main() doesn't own the original neither.
-    * The instance counting then matches up.
-    */
-   Stg_Component_Disown( aCopy );
-
-   /*   "Can we copy the components and subcomponents correctly" */
-   pcu_check_true(
-      aCopy != NULL &&
-      aCopy->b != NULL &&
-      aCopy->c != NULL &&
-      aCopy->b == aCopy->c->b );
-
-   /*   "Are the instance counters correct" */
-   pcu_check_true(
-      Memory_CountGet( a ) == Memory_CountGet( aCopy ) &&
-      Memory_CountGet( a->b ) == Memory_CountGet( aCopy->b ) &&
-      Memory_CountGet( a->c ) == Memory_CountGet( aCopy->c ) );
-}
-
-
-void ComponentCopySuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ComponentCopySuiteData );
-   pcu_suite_setFixtures( suite, ComponentCopySuite_Setup, ComponentCopySuite_Teardown );
-   pcu_suite_addTest( suite, ComponentCopySuite_TestCopy );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/ComponentCopySuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/tests/ComponentCopySuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,400 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "ComponentCopySuite.h"
+
+/****************************************************************************/
+
+/*
+ * A
+ * |
+ * +------>C
+ * |       |
+ * +-->B<--+
+ */
+
+struct Stg_ComponentA;
+struct Stg_ComponentB;
+struct Stg_ComponentC;
+
+typedef struct Stg_ComponentA Stg_ComponentA;
+typedef struct Stg_ComponentB Stg_ComponentB;
+typedef struct Stg_ComponentC Stg_ComponentC;
+
+Type Stg_ComponentA_Type = "Stg_ComponentA";
+Type Stg_ComponentB_Type = "Stg_ComponentB";
+Type Stg_ComponentC_Type = "Stg_ComponentC";
+
+Name Stg_ComponentA_Type_GetMetadata() { return  ""; }
+Name Stg_ComponentB_Type_GetMetadata() { return  ""; }
+Name Stg_ComponentC_Type_GetMetadata() { return  ""; }
+
+
+#define __Stg_ComponentA \
+	__Stg_Component \
+	Stg_ComponentB* b; \
+	Stg_ComponentC* c;
+struct Stg_ComponentA { __Stg_ComponentA };
+
+void* Stg_ComponentA_NewDefault( Name name );
+void Stg_ComponentA_Delete( void*  );
+void Stg_ComponentA_Print( void* , Stream* s );
+void* Stg_ComponentA_Copy( const void* self, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
+void Stg_ComponentA_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data );
+void Stg_ComponentA_Build( void* component, void* data );
+void Stg_ComponentA_Initialise( void* component, void* data );
+void Stg_ComponentA_Execute( void* component, void* data );
+void Stg_ComponentA_Destroy( void* component, void* data );
+
+void* Stg_ComponentA_NewDefault( Name name )
+{
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(Stg_ComponentA);
+	Type                                                      type = "Stg_ComponentA";
+	Stg_Class_DeleteFunction*                              _delete = Stg_ComponentA_Delete;
+	Stg_Class_PrintFunction*                                _print = Stg_ComponentA_Print;
+	Stg_Class_CopyFunction*                                  _copy = Stg_ComponentA_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = Stg_ComponentA_NewDefault;
+	Stg_Component_ConstructFunction*                    _construct = Stg_ComponentA_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = Stg_ComponentA_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = Stg_ComponentA_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = Stg_ComponentA_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = Stg_ComponentA_Destroy;
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+
+	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+}
+void Stg_ComponentA_Delete( void* clss ) {
+	Stg_ComponentA* self = (Stg_ComponentA*)clss;
+	
+	Stg_Class_Delete( self->c );
+	Stg_Class_Delete( self->b );
+
+	_Stg_Component_Delete( self );
+}
+void Stg_ComponentA_Print( void* clss, Stream* s ) {
+	Stg_ComponentA* self = (Stg_ComponentA*)clss;
+
+	Journal_Printf(
+		s,
+		"%s %s %d,\n", self->name, self->type, Memory_CountGet( self ) );
+	Stg_Class_Print( self->b, s );
+	Stg_Class_Print( self->c, s );
+}
+void* Stg_ComponentA_Copy( const void* clss, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	Stg_ComponentA* self = (Stg_ComponentA*)clss;
+	Stg_ComponentA* newCopy;
+	
+	newCopy = (Stg_ComponentA*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+	PtrMap_Append( ptrMap, self, newCopy );
+	
+	newCopy->b = (Stg_ComponentB*)Stg_Class_Copy( self->b, dest, deep, nameExt, ptrMap );
+	newCopy->c = (Stg_ComponentC*)Stg_Class_Copy( self->c, dest, deep, nameExt, ptrMap );
+	
+	return newCopy;
+}
+void Stg_ComponentA_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	Stg_ComponentA* self = (Stg_ComponentA*)component;
+
+	self->b =  Stg_ComponentFactory_ConstructByName( cf, (Name)"b", Stg_ComponentB, True, data   ) ;
+	self->c =  Stg_ComponentFactory_ConstructByName( cf, (Name)"c", Stg_ComponentC, True, data   ) ;
+}
+void Stg_ComponentA_Build( void* component, void* data ) {
+	Stg_ComponentA* self = (Stg_ComponentA*)component;
+	
+	Stg_Component_Build( self->b, data, False );
+	Stg_Component_Build( self->c, data, False );
+}
+void Stg_ComponentA_Initialise( void* component, void* data ) {
+
+}
+void Stg_ComponentA_Execute( void* component, void* data ) {
+
+}
+void Stg_ComponentA_Destroy( void* component, void* data ) {
+
+}
+Dictionary* Stg_ComponentA_Type_MetaAsDictionary() {
+   return NULL;
+}
+
+#define __Stg_ComponentB \
+	__Stg_Component
+struct Stg_ComponentB { __Stg_ComponentB };
+
+void* Stg_ComponentB_NewDefault( Name name );
+void Stg_ComponentB_Delete( void* );
+void Stg_ComponentB_Print( void* , Stream* s );
+void* Stg_ComponentB_Copy( const void* self, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
+void Stg_ComponentB_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data );
+void Stg_ComponentB_Build( void* component, void* data );
+void Stg_ComponentB_Initialise( void* component, void* data );
+void Stg_ComponentB_Execute( void* component, void* data );
+void Stg_ComponentB_Destroy( void* component, void* data );
+
+void* Stg_ComponentB_NewDefault( Name name )
+{
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(Stg_ComponentB);
+	Type                                                      type = "Stg_ComponentB";
+	Stg_Class_DeleteFunction*                              _delete = Stg_ComponentB_Delete;
+	Stg_Class_PrintFunction*                                _print = Stg_ComponentB_Print;
+	Stg_Class_CopyFunction*                                  _copy = Stg_ComponentB_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = Stg_ComponentB_NewDefault;
+	Stg_Component_ConstructFunction*                    _construct = Stg_ComponentB_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = Stg_ComponentB_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = Stg_ComponentB_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = Stg_ComponentB_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = Stg_ComponentB_Destroy;
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+
+	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+}
+void Stg_ComponentB_Delete( void* clss ) {
+	Stg_ComponentB* self = (Stg_ComponentB*)clss;
+	
+	_Stg_Component_Delete( self );
+}
+void Stg_ComponentB_Print( void* clss, Stream* s ) {
+	Stg_ComponentB* self = (Stg_ComponentB*)clss;
+
+	Journal_Printf(
+		s,
+		"%s %s %d,\n", self->name, self->type, Memory_CountGet( self ) );
+}
+void* Stg_ComponentB_Copy( const void* clss, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	Stg_ComponentB* self = (Stg_ComponentB*)clss;
+	Stg_ComponentB* newCopy;
+	
+	newCopy = (Stg_ComponentB*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+	PtrMap_Append( ptrMap, self, newCopy );
+	
+	return newCopy;
+}
+void Stg_ComponentB_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+}
+void Stg_ComponentB_Build( void* component, void* data ) {
+}
+void Stg_ComponentB_Initialise( void* component, void* data ) {
+}
+void Stg_ComponentB_Execute( void* component, void* data ) {
+}
+void Stg_ComponentB_Destroy( void* component, void* data ) {
+}
+
+Dictionary* Stg_ComponentB_Type_MetaAsDictionary() {
+   return NULL;
+}
+
+
+#define __Stg_ComponentC \
+	__Stg_Component \
+	Stg_ComponentB* b;
+struct Stg_ComponentC { __Stg_ComponentC };
+
+void* Stg_ComponentC_NewDefault( Name name );
+void Stg_ComponentC_Delete( void* clss );
+void Stg_ComponentC_Print( void* clss, Stream* s );
+void* Stg_ComponentC_Copy( const void* self, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
+void Stg_ComponentC_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data );
+void Stg_ComponentC_Build( void* component, void* data );
+void Stg_ComponentC_Initialise( void* component, void* data );
+void Stg_ComponentC_Execute( void* component, void* data );
+void Stg_ComponentC_Destroy( void* component, void* data );
+
+void* Stg_ComponentC_NewDefault( Name name )
+{
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(Stg_ComponentC);
+	Type                                                      type = "Stg_ComponentC";
+	Stg_Class_DeleteFunction*                              _delete = Stg_ComponentC_Delete;
+	Stg_Class_PrintFunction*                                _print = Stg_ComponentC_Print;
+	Stg_Class_CopyFunction*                                  _copy = Stg_ComponentC_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = Stg_ComponentC_NewDefault;
+	Stg_Component_ConstructFunction*                    _construct = Stg_ComponentC_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = Stg_ComponentC_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = Stg_ComponentC_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = Stg_ComponentC_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = Stg_ComponentC_Destroy;
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+
+	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+}
+void Stg_ComponentC_Delete( void* clss ) {
+	Stg_ComponentC* self = (Stg_ComponentC*)clss;
+	
+	Stg_Class_Delete( self->b );
+
+	_Stg_Component_Delete( self );
+}
+void Stg_ComponentC_Print( void* clss, Stream* s ) {
+	Stg_ComponentC* self = (Stg_ComponentC*)clss;
+
+	Journal_Printf(
+		s,
+		"%s %s %d,\n", self->name, self->type, Memory_CountGet( self ) );
+	Stg_Class_Print( self->b, s );
+}
+void* Stg_ComponentC_Copy( const void* clss, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	Stg_ComponentC* self = (Stg_ComponentC*)clss;
+	Stg_ComponentC* newCopy;
+	
+	newCopy = (Stg_ComponentC*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+	PtrMap_Append( ptrMap, self, newCopy );
+
+	newCopy->b = (Stg_ComponentB*)Stg_Class_Copy( self->b, dest, deep, nameExt, ptrMap );
+
+	return newCopy;
+}
+void Stg_ComponentC_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	Stg_ComponentC* self = (Stg_ComponentC*)component;
+
+	self->b =  Stg_ComponentFactory_ConstructByName( cf, (Name)"b", Stg_ComponentB, True, data   ) ;
+}
+void Stg_ComponentC_Build( void* component, void* data ) {
+	Stg_ComponentC* self = (Stg_ComponentC*)component;
+	
+	Stg_Component_Build( self->b, data, False );
+}
+void Stg_ComponentC_Initialise( void* component, void* data ) {
+
+}
+void Stg_ComponentC_Execute( void* component, void* data ) {
+
+}
+void Stg_ComponentC_Destroy( void* component, void* data ) {
+
+}
+Dictionary* Stg_ComponentC_Type_MetaAsDictionary() {
+   return NULL;
+}
+
+/****************************************************************************/
+
+typedef struct {
+   Dictionary*    dict;
+} ComponentCopySuiteData;
+
+
+void ComponentCopySuite_Setup( ComponentCopySuiteData* data ) {
+   data->dict = Dictionary_New();
+}
+
+
+void ComponentCopySuite_Teardown( ComponentCopySuiteData* data ) {
+   Stg_Class_Delete( data->dict );
+}
+   
+
+void ComponentCopySuite_TestCopy( ComponentCopySuiteData* data ) {
+   Stg_ComponentA* a=NULL;
+   Stg_ComponentA* aCopy=NULL;
+   Dictionary* componentsDictionary=NULL;
+   Dictionary* componentDict=NULL;
+
+   Stg_ComponentFactory* cf;
+
+   Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Stg_ComponentA_Type, (Name)"0", (Stg_Component_DefaultConstructorFunction*)Stg_ComponentA_NewDefault );
+
+   Stg_ComponentRegister_Add( 
+      Stg_ComponentRegister_Get_ComponentRegister( ), 
+      Stg_ComponentB_Type,
+      "0",
+      (Stg_Component_DefaultConstructorFunction*)Stg_ComponentB_NewDefault );
+
+   Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Stg_ComponentC_Type, (Name)"0", (Stg_Component_DefaultConstructorFunction*)Stg_ComponentC_NewDefault );
+
+   /* Creating a dictionary of components */
+   componentsDictionary = Dictionary_New();
+   componentDict = Dictionary_New( );
+   Dictionary_AddFromString( componentDict, "Type", "Stg_ComponentA" );
+   Dictionary_AddFromDictionary( componentsDictionary, "a", componentDict );
+   componentDict = Dictionary_New();
+   Dictionary_AddFromString( componentDict, "Type", "Stg_ComponentB" );
+   Dictionary_AddFromDictionary( componentsDictionary, "b", componentDict );
+   componentDict = Dictionary_New();
+   Dictionary_AddFromString( componentDict, "Type", "Stg_ComponentC" );
+   Dictionary_AddFromDictionary( componentsDictionary, "c", componentDict );
+
+   Dictionary_AddFromDictionary( data->dict, "components", componentsDictionary );
+
+   cf = Stg_ComponentFactory_New( data->dict, componentsDictionary );
+   Stream_Enable( cf->infoStream, False );
+
+   Stg_ComponentFactory_CreateComponents( cf );
+   Stg_ComponentFactory_ConstructComponents( cf, 0 /* dummy */ );
+
+   a = (Stg_ComponentA*)LiveComponentRegister_Get( cf->LCRegister, (Name)"a" );
+   
+   /* "Stg_Components creation" */
+   pcu_check_true(
+      a != NULL &&
+      a->b != NULL &&
+      a->c != NULL &&
+      a->b == a->c->b  );
+
+   aCopy = (Stg_ComponentA*)Stg_Class_Copy( a, NULL, True, "_dup", NULL );
+
+   /* Disown the copy. Why? Because main() doesn't own the original neither.
+    * The instance counting then matches up.
+    */
+   Stg_Component_Disown( aCopy );
+
+   /*   "Can we copy the components and subcomponents correctly" */
+   pcu_check_true(
+      aCopy != NULL &&
+      aCopy->b != NULL &&
+      aCopy->c != NULL &&
+      aCopy->b == aCopy->c->b );
+
+   /*   "Are the instance counters correct" */
+   pcu_check_true(
+      Memory_CountGet( a ) == Memory_CountGet( aCopy ) &&
+      Memory_CountGet( a->b ) == Memory_CountGet( aCopy->b ) &&
+      Memory_CountGet( a->c ) == Memory_CountGet( aCopy->c ) );
+}
+
+
+void ComponentCopySuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ComponentCopySuiteData );
+   pcu_suite_setFixtures( suite, ComponentCopySuite_Setup, ComponentCopySuite_Teardown );
+   pcu_suite_addTest( suite, ComponentCopySuite_TestCopy );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/HierarchyTableSuite.c
--- a/Base/Automation/tests/HierarchyTableSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "HierarchyTableSuite.h"
-
-typedef struct {
-   HierarchyTable*   hTable;
-   HierarchyTable*   savedHierarchyTable;
-   int					rank;
-} HierarchyTableSuiteData;
-
-
-const Type A_Type = "A";
-const Type B_Type = "B";
-const Type C_Type = "C";
-const Type D_Type = "D";
-const Type AA_Type = "AA";
-const Type BB_Type = "BB";
-
-
-void HierarchyTableSuite_Setup( HierarchyTableSuiteData* data ) {
-   /* We need to operate on the stgHierarchyTable ptr, since HierarchyTable_New() even uses this */
-   data->savedHierarchyTable = stgHierarchyTable;
-   stgHierarchyTable = NULL;
-   data->hTable = HierarchyTable_New();
-   stgHierarchyTable = data->savedHierarchyTable;
-   HierarchyTable_RegisterParent( data->hTable, B_Type, A_Type );
-   HierarchyTable_RegisterParent( data->hTable, C_Type, B_Type );
-   HierarchyTable_RegisterParent( data->hTable, D_Type, C_Type );
-   HierarchyTable_RegisterParent( data->hTable, BB_Type, AA_Type );
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-}
-
-void HierarchyTableSuite_Teardown( HierarchyTableSuiteData* data ) {
-   Stg_Class_Delete( data->hTable );
-}
-   
-
-void HierarchyTableSuite_TestIsChild( HierarchyTableSuiteData* data ) {
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, A_Type, A_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, B_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, C_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, D_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, AA_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, BB_Type ) );
-
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, B_Type, A_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, B_Type, B_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, C_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, D_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, AA_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, BB_Type ) );
-   
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, C_Type, A_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, C_Type, B_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, C_Type, C_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, C_Type, D_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, C_Type, AA_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, C_Type, BB_Type ) ); 
-
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, A_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, B_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, C_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, D_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, D_Type, AA_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, D_Type, BB_Type ) );
-
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, A_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, B_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, C_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, D_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, AA_Type, AA_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, BB_Type ) ); 
-
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, A_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, B_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, C_Type ) );
-   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, D_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, BB_Type, AA_Type ) );
-   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, BB_Type, BB_Type ) ); 
-}
-
-
-void HierarchyTableSuite_TestPrintParents( HierarchyTableSuiteData* data ) {
-  Stream*           stream = Journal_Register( Info_Type, (Name)"testStream" );
-   const Name testFilename = "testHTable-PrintParents.txt";
-
-   if (data->rank==0 ) {
-      Stream_RedirectFile( stream, testFilename );
-   }
-
-   HierarchyTable_PrintParents( data->hTable, A_Type, stream );
-   HierarchyTable_PrintParents( data->hTable, B_Type, stream );
-   HierarchyTable_PrintParents( data->hTable, C_Type, stream );
-   HierarchyTable_PrintParents( data->hTable, D_Type, stream );
-   HierarchyTable_PrintParents( data->hTable, AA_Type, stream );
-   HierarchyTable_PrintParents( data->hTable, BB_Type, stream );
-
-   /* Just do these print tests with rank 0, to avoid I/O problems */
-   if (data->rank==0) {
-      char  expectedFilename[PCU_PATH_MAX];
-
-      pcu_filename_expected( testFilename, expectedFilename );
-      pcu_check_fileEq( testFilename, expectedFilename );
-      remove( testFilename );
-   }
-}
-   
-
-void HierarchyTableSuite_TestPrintChildren( HierarchyTableSuiteData* data ) {
-  Stream*     stream = Journal_Register( Info_Type, (Name)"testStream" );
-   const Name testFilename = "testHTable-PrintChildren.txt";
-
-   if (data->rank==0 ) {
-      Stream_RedirectFile( stream, testFilename );
-   }
-
-   HierarchyTable_PrintChildren( data->hTable, A_Type, stream );
-   HierarchyTable_PrintChildren( data->hTable, B_Type, stream );
-   HierarchyTable_PrintChildren( data->hTable, C_Type, stream );
-   HierarchyTable_PrintChildren( data->hTable, D_Type, stream );
-   HierarchyTable_PrintChildren( data->hTable, AA_Type, stream );
-   HierarchyTable_PrintChildren( data->hTable, BB_Type, stream );
-
-   /* Just do these print tests with rank 0, to avoid I/O problems */
-   if (data->rank==0) {
-      char  expectedFilename[PCU_PATH_MAX];
-
-      pcu_filename_expected( testFilename, expectedFilename );
-      pcu_check_fileEq( testFilename, expectedFilename );
-      remove( testFilename );
-   }
-}
-
-
-void HierarchyTableSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, HierarchyTableSuiteData );
-   pcu_suite_setFixtures( suite, HierarchyTableSuite_Setup, HierarchyTableSuite_Teardown );
-   pcu_suite_addTest( suite, HierarchyTableSuite_TestIsChild );
-   pcu_suite_addTest( suite, HierarchyTableSuite_TestPrintParents );
-   pcu_suite_addTest( suite, HierarchyTableSuite_TestPrintChildren );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Automation/tests/HierarchyTableSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Automation/tests/HierarchyTableSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,180 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "HierarchyTableSuite.h"
+
+typedef struct {
+   HierarchyTable*   hTable;
+   HierarchyTable*   savedHierarchyTable;
+   int					rank;
+} HierarchyTableSuiteData;
+
+
+const Type A_Type = "A";
+const Type B_Type = "B";
+const Type C_Type = "C";
+const Type D_Type = "D";
+const Type AA_Type = "AA";
+const Type BB_Type = "BB";
+
+
+void HierarchyTableSuite_Setup( HierarchyTableSuiteData* data ) {
+   /* We need to operate on the stgHierarchyTable ptr, since HierarchyTable_New() even uses this */
+   data->savedHierarchyTable = stgHierarchyTable;
+   stgHierarchyTable = NULL;
+   data->hTable = HierarchyTable_New();
+   stgHierarchyTable = data->savedHierarchyTable;
+   HierarchyTable_RegisterParent( data->hTable, B_Type, A_Type );
+   HierarchyTable_RegisterParent( data->hTable, C_Type, B_Type );
+   HierarchyTable_RegisterParent( data->hTable, D_Type, C_Type );
+   HierarchyTable_RegisterParent( data->hTable, BB_Type, AA_Type );
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+}
+
+void HierarchyTableSuite_Teardown( HierarchyTableSuiteData* data ) {
+   Stg_Class_Delete( data->hTable );
+}
+   
+
+void HierarchyTableSuite_TestIsChild( HierarchyTableSuiteData* data ) {
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, A_Type, A_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, B_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, C_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, D_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, AA_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, A_Type, BB_Type ) );
+
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, B_Type, A_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, B_Type, B_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, C_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, D_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, AA_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, B_Type, BB_Type ) );
+   
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, C_Type, A_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, C_Type, B_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, C_Type, C_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, C_Type, D_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, C_Type, AA_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, C_Type, BB_Type ) ); 
+
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, A_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, B_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, C_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, D_Type, D_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, D_Type, AA_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, D_Type, BB_Type ) );
+
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, A_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, B_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, C_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, D_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, AA_Type, AA_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, AA_Type, BB_Type ) ); 
+
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, A_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, B_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, C_Type ) );
+   pcu_check_true( False == HierarchyTable_IsChild( data->hTable, BB_Type, D_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, BB_Type, AA_Type ) );
+   pcu_check_true( True == HierarchyTable_IsChild( data->hTable, BB_Type, BB_Type ) ); 
+}
+
+
+void HierarchyTableSuite_TestPrintParents( HierarchyTableSuiteData* data ) {
+  Stream*           stream = Journal_Register( Info_Type, (Name)"testStream" );
+   const Name testFilename = "testHTable-PrintParents.txt";
+
+   if (data->rank==0 ) {
+      Stream_RedirectFile( stream, testFilename );
+   }
+
+   HierarchyTable_PrintParents( data->hTable, A_Type, stream );
+   HierarchyTable_PrintParents( data->hTable, B_Type, stream );
+   HierarchyTable_PrintParents( data->hTable, C_Type, stream );
+   HierarchyTable_PrintParents( data->hTable, D_Type, stream );
+   HierarchyTable_PrintParents( data->hTable, AA_Type, stream );
+   HierarchyTable_PrintParents( data->hTable, BB_Type, stream );
+
+   /* Just do these print tests with rank 0, to avoid I/O problems */
+   if (data->rank==0) {
+      char  expectedFilename[PCU_PATH_MAX];
+
+      pcu_filename_expected( testFilename, expectedFilename );
+      pcu_check_fileEq( testFilename, expectedFilename );
+      remove( testFilename );
+   }
+}
+   
+
+void HierarchyTableSuite_TestPrintChildren( HierarchyTableSuiteData* data ) {
+  Stream*     stream = Journal_Register( Info_Type, (Name)"testStream" );
+   const Name testFilename = "testHTable-PrintChildren.txt";
+
+   if (data->rank==0 ) {
+      Stream_RedirectFile( stream, testFilename );
+   }
+
+   HierarchyTable_PrintChildren( data->hTable, A_Type, stream );
+   HierarchyTable_PrintChildren( data->hTable, B_Type, stream );
+   HierarchyTable_PrintChildren( data->hTable, C_Type, stream );
+   HierarchyTable_PrintChildren( data->hTable, D_Type, stream );
+   HierarchyTable_PrintChildren( data->hTable, AA_Type, stream );
+   HierarchyTable_PrintChildren( data->hTable, BB_Type, stream );
+
+   /* Just do these print tests with rank 0, to avoid I/O problems */
+   if (data->rank==0) {
+      char  expectedFilename[PCU_PATH_MAX];
+
+      pcu_filename_expected( testFilename, expectedFilename );
+      pcu_check_fileEq( testFilename, expectedFilename );
+      remove( testFilename );
+   }
+}
+
+
+void HierarchyTableSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, HierarchyTableSuiteData );
+   pcu_suite_setFixtures( suite, HierarchyTableSuite_Setup, HierarchyTableSuite_Teardown );
+   pcu_suite_addTest( suite, HierarchyTableSuite_TestIsChild );
+   pcu_suite_addTest( suite, HierarchyTableSuite_TestPrintParents );
+   pcu_suite_addTest( suite, HierarchyTableSuite_TestPrintChildren );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/AbsArray.c
--- a/Base/Container/src/AbsArray.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: AbsArray.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <StGermain/Base/Foundation/Foundation.h>
-
-#include "types.h"
-#include "AbsArray.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-void _AbsArray_Init( void* _self ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   _NewClass_Init( self );
-   self->itmSize = 0;
-   self->delta = 100;
-   self->maxSize = 0;
-   self->size = 0;
-   self->ptr = NULL;
-}
-
-void _AbsArray_Destruct( void* self ) {
-   AbsArray_Clear( self );
-   _NewClass_Destruct( self );
-}
-
-void _AbsArray_Copy( void* _self, const void* _op ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-   const AbsArray* op = Class_ConstCast( _op, AbsArray );
-
-   self->itmSize = op->itmSize;
-   self->delta = op->delta;
-   self->maxSize = op->maxSize;
-   self->size = op->size;
-   self->ptr = Class_Array( self, stgByte, self->size * self->itmSize );
-   memcpy( self->ptr, op->ptr, self->itmSize * self->size );
-}
-
-void AbsArray_SetItemSize( void* _self, int itmSize ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   AbsArray_Clear( self );
-   self->itmSize = itmSize;
-}
-
-void AbsArray_SetDelta( void* _self, int delta ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   self->delta = delta;
-}
-
-void AbsArray_Resize( void* _self, int size ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   assert( self->delta );
-   self->maxSize = size / self->delta + ((size % self->delta) ? 1 : 0);
-   self->maxSize *= self->delta;
-   self->size = size;
-   self->ptr = Class_Rearray( self, self->ptr, stgByte, self->maxSize * self->itmSize );
-}
-
-void AbsArray_SoftResize( void* _self, int size ) {
-   AbsArray* self = (AbsArray*)_self;
-
-   assert( self && self->delta );
-   if( size > self->maxSize )
-      AbsArray_Resize( self, size );
-   else
-      self->size = size;
-}
-
-void AbsArray_Offset( void* _self, int delta ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   if ( delta > 0 ) {
-      if (( self->size + delta ) >= self->maxSize ) {
-	 self->maxSize += self->delta;
-	 self->ptr = Class_Rearray( self, self->ptr, stgByte, self->maxSize * self->itmSize );
-      }
-      self->size += delta;
-   }
-   else if( delta < 0 ) {
-      assert( self->size >= -delta );
-      if( self->size == self->maxSize - 2 * self->delta )
-	 self->ptr = Class_Rearray( self, self->ptr, stgByte, (self->maxSize - self->delta ) * self->itmSize );
-   }
-}
-
-void AbsArray_Push( void* _self, void* itm ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   if( self->size == self->maxSize )
-      AbsArray_Resize( self, self->size + 1 );
-   else
-      self->size++;
-   memcpy( self->ptr + self->size - 1, itm, self->itmSize );
-}
-
-void AbsArray_Set( void* _self, void* itm ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-   int i_i;
-
-   for( i_i = 0; i_i < self->size; i_i++ )
-      memcpy( self->ptr + i_i, itm, self->itmSize );
-}
-
-void AbsArray_Clear( void* _self ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   AbsArray_Resize( self, 0 );
-}
-
-int AbsArray_GetSize( const void* _self ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   return self->size;
-}
-
-const int* AbsArray_GetPtr( const void* _self ) {
-   AbsArray* self = Class_Cast( _self, AbsArray );
-
-   return (const int*)(self->ptr);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/AbsArray.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/AbsArray.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,157 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: AbsArray.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include <StGermain/Base/Foundation/Foundation.h>
+
+#include "types.h"
+#include "AbsArray.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+void _AbsArray_Init( void* _self ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   _NewClass_Init( self );
+   self->itmSize = 0;
+   self->delta = 100;
+   self->maxSize = 0;
+   self->size = 0;
+   self->ptr = NULL;
+}
+
+void _AbsArray_Destruct( void* self ) {
+   AbsArray_Clear( self );
+   _NewClass_Destruct( self );
+}
+
+void _AbsArray_Copy( void* _self, const void* _op ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+   const AbsArray* op = Class_ConstCast( _op, AbsArray );
+
+   self->itmSize = op->itmSize;
+   self->delta = op->delta;
+   self->maxSize = op->maxSize;
+   self->size = op->size;
+   self->ptr = Class_Array( self, stgByte, self->size * self->itmSize );
+   memcpy( self->ptr, op->ptr, self->itmSize * self->size );
+}
+
+void AbsArray_SetItemSize( void* _self, int itmSize ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   AbsArray_Clear( self );
+   self->itmSize = itmSize;
+}
+
+void AbsArray_SetDelta( void* _self, int delta ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   self->delta = delta;
+}
+
+void AbsArray_Resize( void* _self, int size ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   assert( self->delta );
+   self->maxSize = size / self->delta + ((size % self->delta) ? 1 : 0);
+   self->maxSize *= self->delta;
+   self->size = size;
+   self->ptr = Class_Rearray( self, self->ptr, stgByte, self->maxSize * self->itmSize );
+}
+
+void AbsArray_SoftResize( void* _self, int size ) {
+   AbsArray* self = (AbsArray*)_self;
+
+   assert( self && self->delta );
+   if( size > self->maxSize )
+      AbsArray_Resize( self, size );
+   else
+      self->size = size;
+}
+
+void AbsArray_Offset( void* _self, int delta ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   if ( delta > 0 ) {
+      if (( self->size + delta ) >= self->maxSize ) {
+	 self->maxSize += self->delta;
+	 self->ptr = Class_Rearray( self, self->ptr, stgByte, self->maxSize * self->itmSize );
+      }
+      self->size += delta;
+   }
+   else if( delta < 0 ) {
+      assert( self->size >= -delta );
+      if( self->size == self->maxSize - 2 * self->delta )
+	 self->ptr = Class_Rearray( self, self->ptr, stgByte, (self->maxSize - self->delta ) * self->itmSize );
+   }
+}
+
+void AbsArray_Push( void* _self, void* itm ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   if( self->size == self->maxSize )
+      AbsArray_Resize( self, self->size + 1 );
+   else
+      self->size++;
+   memcpy( self->ptr + self->size - 1, itm, self->itmSize );
+}
+
+void AbsArray_Set( void* _self, void* itm ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+   int i_i;
+
+   for( i_i = 0; i_i < self->size; i_i++ )
+      memcpy( self->ptr + i_i, itm, self->itmSize );
+}
+
+void AbsArray_Clear( void* _self ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   AbsArray_Resize( self, 0 );
+}
+
+int AbsArray_GetSize( const void* _self ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   return self->size;
+}
+
+const int* AbsArray_GetPtr( const void* _self ) {
+   AbsArray* self = Class_Cast( _self, AbsArray );
+
+   return (const int*)(self->ptr);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/BTree.c
--- a/Base/Container/src/BTree.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,735 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: BTreeNode.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "BTreeNode.h"
-#include "BTree.h"
-#include "ChunkArray.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#define  POOL_SIZE 1000
-#define  POOL_DELTA 1000
-
-const Type BTree_Type = "BTree";
-
-BTree *_BTree_New(
-		SizeT					_sizeOfSelf,
-		Type					type,
-		Stg_Class_DeleteFunction*	_delete,
-		Stg_Class_PrintFunction*	_print,
-		Stg_Class_CopyFunction*		_copy
-		)
-{
-	BTree *self = NULL;
-
-	/** BTree has to be malloced instead of using Class_New, because Class_New uses Memory_Alloc, but the Memory module will not have been
-	 *  initialized at this stage */
-	
-	self = (BTree*)malloc( _sizeOfSelf );
-	memset( self, 0, _sizeOfSelf );
-	
-	self->_sizeOfSelf = _sizeOfSelf;
-	self->_deleteSelf = True;
-	self->type = type;
-	self->_delete = _delete;
-	self->_print = _print;
-	self->_copy = _copy;
-	
-	return self;
-}
-
-BTree *BTree_New( 
-		BTree_compareFunction*		compareFunction,
-		BTree_dataCopyFunction*		dataCopyFunction,
-		BTree_dataDeleteFunction*	dataDeleteFunction,
-		BTree_dataPrintFunction*	dataPrintFunction,
-		BTreeProperty				property )
-{
-	
-	BTree* self;
-	
-	/* Allocate memory */
-	assert ( compareFunction );
-	
-	self = _BTree_New(
-			sizeof(BTree),
-			BTree_Type,
-			_BTree_DeleteFunc,
-			_BTree_PrintFunc,
-			NULL
-			);
-	/* General info */
-	
-	/* Virtual functions */
-	
-	self->compareFunction = compareFunction;
-	self->dataCopyFunction = dataCopyFunction;
-	self->dataDeleteFunction = dataDeleteFunction;
-	self->dataPrintFunction = dataPrintFunction;
-	self->property = property;
-
-	self->pool = NULL;
-
-	_BTree_Init( self );	
-	return self;
-}
-
-void _BTree_Init( BTree* self )
-{
-
-	assert(self);
-	self->root = NIL;
-
-	self->pool = ChunkArray_New( BTreeNode, POOL_SIZE );
-}
-
-void BTree_Init( BTree *self )
-{
-	_BTree_Init( self );
-}
-
-void BTree_LeftRotate( BTree *tree, BTreeNode *x ) 
-{
- 
-	BTreeNode *root;
-	BTreeNode *y;
-	 
-	assert( tree );
-	assert( x );
-	
-	y = x->right;
-	root = tree->root;
- 
- 
-	if (x == NIL){
-	}
-	
-	/* establish x->right link */
-	x->right = y->left;
-	if ( y->left != NIL ) y->left->parent = x;
- 
-	/* establish y->parent link */
-	if (y != NIL) {
-		y->parent = x->parent;
-	}
-	
-	if ( x->parent ) {
-		if (x == x->parent->left)
-		{
-             x->parent->left = y;
-		}
-		else{
-             x->parent->right = y;
-		}
-	} 
-	else{
-		tree->root = y;
-	}
- 
-	/* link x and y */
-	y->left = x;
-	if (x != NIL){
-		x->parent = y;
-	}
- }
- 
-void BTree_RightRotate( BTree *tree, BTreeNode *x ) {
- 
-	BTreeNode *root;
-	BTreeNode *y;
-	
-	assert( tree );
-	assert( x );
-	
-	y = x->left;
-	root = tree->root;
- 
- 
-	if( x == NIL ){
-	}
-
-	/* establish x->left link */
-	x->left = y->right;
-	if (y->right != NIL){
-		y->right->parent = x;
-	}
-		
-	/* establish y->parent link */
-	if (y != NIL) {
-		y->parent = x->parent;
-	}
-	
-	if( x->parent ){
-		if (x == x->parent->right){
-			x->parent->right = y;
-		}
-        else{
-             x->parent->left = y;
-		}
-	}
-	else{
-		tree->root = y;
-	}
- 
-	/* link x and y */
-	y->right = x;
-	if (x != NIL){
-		x->parent = y;
-	}
-}
-
-void BTree_InsertFix (BTree *tree, BTreeNode *x){
-	
-	BTreeNode *y = NIL, *root;
-
-	assert ( tree );
-	assert ( x );
-
-	root = tree->root;
-	
-	while ( ( x != root ) && ( x->parent->color == BTREE_NODE_RED ) ){
-    	if ( x->parent == x->parent->parent->left ) {
-			/* If x's parent is a left, y is x's right 'uncle' */
-			y = x->parent->parent->right;
-			
-			if ( y->color == BTREE_NODE_RED ) {
-				/* case 1 - change the colours */
-				x->parent->color = BTREE_NODE_BLACK;
-				y->color = BTREE_NODE_BLACK;
-				x->parent->parent->color = BTREE_NODE_RED;
-				/* Move x up the tree */
-				x = x->parent->parent;
-			}
-			else{
-				/* y is a BTREE_NODE_BLACK node */
-				if ( x == x->parent->right ) {
-					/* and x is to the right  */
-					/* case 2 - move x up and rotate */
-					x = x->parent;
-					BTree_LeftRotate( tree, x );
-				}
-				/* case 3 */
-				x->parent->color = BTREE_NODE_BLACK;
-				x->parent->parent->color = BTREE_NODE_RED;
-				BTree_RightRotate( tree, x->parent->parent );
-			}
-		}
-		else if ( x->parent == x->parent->parent->right ){
-			
-			/* If x's parent is a right, y is x's right 'uncle' */ 
-			y = x->parent->parent->left;
-			
-				if ( y->color == BTREE_NODE_RED ) {
-					/* case 1 - change the colours */
-					x->parent->color = BTREE_NODE_BLACK;
-					y->color = BTREE_NODE_BLACK;
-					x->parent->parent->color = BTREE_NODE_RED;
-					/* Move x up the tree */
-					x = x->parent->parent;
-				}
-				else{
-					/* y is a BTREE_NODE_BLACK node */
-					if ( x == x->parent->left ) {
-						/* and x is to the right  */
-						/* case 2 - move x up and rotate */ 
-						x = x->parent;
-						BTree_RightRotate( tree, x );
-					}
-					/* case 3 */
-					x->parent->color = BTREE_NODE_BLACK;
-					x->parent->parent->color = BTREE_NODE_RED;
-					BTree_LeftRotate( tree, x->parent->parent );
-				}
-		}
-		else{
-
-		}
-	}
-
-	/* Colour the root BTREE_NODE_BLACK */
-	tree->root->color = BTREE_NODE_BLACK;
-}
-/* The BTree_Insert function assumes that the compare function accepts two void pointers to NodeData as arguments */
-int BTree_InsertNode ( BTree *tree, void *newNodeData, SizeT sizeOfData ){
-	
-	BTreeNode *curr, *spot, *newNode;
-
-	assert ( tree );
-	assert ( newNodeData );
-	/*assert ( sizeOfData > 0 ); removed for PtrSet - Luke */
-	
-	curr = tree->root;
-	
-	newNode = BTreeNode_New( tree->pool );
-	newNode->sizeOfData = sizeOfData;
-	
-	if ( tree->dataCopyFunction ){
-		tree->dataCopyFunction ( &newNode->data, newNodeData, newNode->sizeOfData);
-	}
-	else{
-		newNode->data = newNodeData;
-	}
-	
-	spot = NULL;
-	while ( curr != NIL ){
-		spot = curr;
-		if ( tree->compareFunction( newNode->data, curr->data ) > 0 ){
-			curr = curr->right;
-		}
-		else if( tree->compareFunction( newNode->data, curr->data ) == 0 ){
-			if( tree->property == BTREE_ALLOW_DUPLICATES ){
-				curr = curr->right;
-			}
-			else{
-				if( tree->dataDeleteFunction )
-					tree->dataDeleteFunction( newNode->data );
-				
-				if( tree->pool ){
-					ChunkArray_DeleteObjectID( tree->pool, newNode->id );
-				}
-				else{
-					free ( newNode );
-				}
-
-				return 0;
-			}
-		}
-		else
-		{
-			curr = curr->left;
-		}
-	}
-
-	if (spot){
-		
-		newNode->parent = spot;
-		if ( tree->compareFunction( newNode->data, spot->data ) < 0 ){
-			spot->left = newNode;
-		}
-		else{
-			spot->right = newNode;
-		}
-	}
-	else{
-		tree->root = newNode;
-	}
-
-	BTree_InsertFix ( tree, newNode );
-	++tree->nodeCount;
-#if	0
-	printf ("nodeCount from insert%d\n", tree->nodeCount);
-#endif
-	return 1;
-}
-
-void BTree_SetCompareFunction ( BTree *tree, BTree_compareFunction *compareFunction )
-{
-	assert( tree );
-	assert( compareFunction );
-	
-	tree->compareFunction = compareFunction;
-}
-
-BTreeNode *BTree_FindNode( BTree *tree, void *data ){
-	BTreeNode *curr = NIL;
-	int result;
-
-	assert ( tree );
-
-	if ( data == NULL ){
-		return NULL;
-	}
-	
-	curr = tree->root;
-
-#if 0
-	printf ( "[Finding Node---------\n" );
-#endif
-	
-	while (curr != NIL){
-		result = tree->compareFunction ( (void*) curr->data, (void*) data );
-		if ( result == 0 ){
-			
-#if 0
-			printf ( "\tFound node after %d hops\n\n", hops );
-#endif			
-
-#if 0
-	printf ( "Finding Node---------]\n" );
-#endif
-
-			return curr;
-		}
-		else{
-			if ( result > 0 ){
-				curr = curr->left;
-			}
-			else{
-				curr = curr->right;
-			}
-		}
-	}
-#if 0
-	printf ( "Finding Node---------]\n" );
-#endif
-	return NULL;
-}
-
-BTreeNode *BTree_FindNodeAndHops( BTree *tree, void *data, int *hops ){
-	BTreeNode *curr = NIL;
-	int result;
-
-	assert ( tree );
-	assert( hops );
-
-	if ( data == NULL ){
-		return NULL;
-	}
-	
-	curr = tree->root;
-	*hops = 0;
-
-#if 0
-	printf ( "[Finding Node---------\n" );
-#endif
-	
-	while (curr != NIL){
-		result = tree->compareFunction ( (void*) curr->data, (void*) data );
-		if ( result == 0 ){
-			
-#if 0
-			printf ( "\tFound node after %d hops\n\n", hops );
-#endif			
-
-#if 0
-	printf ( "Finding Node---------]\n" );
-#endif
-
-			return curr;
-		}
-		else{
-			(*hops)++;
-			
-			if ( result > 0 ){
-				curr = curr->left;
-			}
-			else{
-				curr = curr->right;
-			}
-		}
-	}
-#if 0
-	printf ( "\tFailed to find node after %d hops\n\n", hops );
-#endif
-#if 0
-	printf ( "Finding Node---------]\n" );
-#endif
-	return NULL;
-}
-
-void BTree_DeleteFixup( BTree *tree, BTreeNode *x ) {
- 
-	BTreeNode *root, *w;
-
-	assert( tree );
-	assert ( x );
-	
-	root = tree->root;
-	while ( x != root && x->color == BTREE_NODE_BLACK ) {
-		if ( x == x->parent->left ) {
-			w = x->parent->right;
-			if ( w->color == BTREE_NODE_RED ) {
-				w->color = BTREE_NODE_BLACK;
-				x->parent->color = BTREE_NODE_RED;
-				BTree_LeftRotate ( tree, x->parent );
-				w = x->parent->right;
-			}
-			if ( w->left->color == BTREE_NODE_BLACK && w->right->color == BTREE_NODE_BLACK ) {
-				w->color = BTREE_NODE_RED;
-				x = x->parent;
-			} else {
-				if ( w->right->color == BTREE_NODE_BLACK ) {
-					w->left->color = BTREE_NODE_BLACK;
-					w->color = BTREE_NODE_RED;
-					BTree_RightRotate ( tree, w );
-					w = x->parent->right;
-				}
-				w->color = x->parent->color;
-				x->parent->color = BTREE_NODE_BLACK;
-				w->right->color = BTREE_NODE_BLACK;
-				BTree_LeftRotate ( tree, x->parent );
-				x = root;
-			}
-		} else {
-			w = x->parent->left;
-			if ( w->color == BTREE_NODE_RED ) {
-				w->color = BTREE_NODE_BLACK;
-				x->parent->color = BTREE_NODE_RED;
-				BTree_RightRotate ( tree, x->parent );
-				w = x->parent->left;
-			}
-			if ( w->right->color == BTREE_NODE_BLACK && w->left->color == BTREE_NODE_BLACK ) {
-				w->color = BTREE_NODE_RED;
-				x = x->parent;
-			} else {
-				if ( w->left->color == BTREE_NODE_BLACK ) {
-					w->right->color = BTREE_NODE_BLACK;
-					w->color = BTREE_NODE_RED;
-					BTree_LeftRotate ( tree, w );
-					w = x->parent->left;
-				}
-				w->color = x->parent->color;
-				x->parent->color = BTREE_NODE_BLACK;
-				w->left->color = BTREE_NODE_BLACK;
-				BTree_RightRotate ( tree, x->parent );
-				x = root;
-			}
-		}
-	}
-	x->color = BTREE_NODE_BLACK;
-}
- 
-void BTree_DeleteNode( BTree *tree, BTreeNode *z ) {
-	BTreeNode *x, *y;
- 
-	assert( tree );
-	
-	if ( !z || z == NIL ) return;
- 
-	assert ( z );
-	
-	if ( z->left == NIL || z->right == NIL ) {
-		/* y has a NIL node as a child */
-		y = z;
-	} else {
-		/* find tree successor with a NIL node as a child */
-		y = z->right;
-		while ( y->left != NIL ) y = y->left;
-	}
- 
-	/* x is y's only child */
-	if ( y->left != NIL )
-		x = y->left;
-	else
-		x = y->right;
- 
-	/* remove y from the parent chain */
-	x->parent = y->parent;
-	
-	if ( y->parent ){
-		if ( y == y->parent->left ){
-			y->parent->left = x;
-		}
-		else{
-			y->parent->right = x;
-		}
-	}
-	else{
-		tree->root = x;
-	}
- 
-	if ( y != z ){
-		if ( tree->dataCopyFunction ){
-		   	tree->dataCopyFunction ( &z->data, y->data, y->sizeOfData );
-		}
-		else{
-			z->data = y->data;
-		}
-	}
- 
- 
-	if ( y->color == BTREE_NODE_BLACK ){
-		BTree_DeleteFixup ( tree, x );
-	}
- 
-	if ( tree->dataDeleteFunction ){
-		tree->dataDeleteFunction( (void*) y->data );
-	}
-
-	if( tree->pool ){
-		ChunkArray_DeleteObjectID( tree->pool, y->id );
-	}
-	else{
-		free ( y );
-	}
-	--tree->nodeCount;
-#if	0
-	printf ("nodeCount from delete %d\n", tree->nodeCount);
-#endif
-}
-
-void BTree_ParseTreeNode( BTreeNode *root, BTree_parseFunction *parseFunction, void *args ){
-
-	assert ( root );
-	assert ( parseFunction );
-	
-	if ( root == NIL ){
-		return;
-	}
-	
-	BTree_ParseTreeNode( root->left, parseFunction, args );
-	
-	assert ( root->data );
-	parseFunction ( root->data, args );
-	
-	BTree_ParseTreeNode( root->right, parseFunction, args );
-}
-
-void BTree_ParseTree( BTree *tree, BTree_parseFunction *parseFunction, void *args ){
-
-	assert ( tree );
-	assert ( parseFunction );
-	
-	if ( tree->root == NIL ){
-		return;
-	}
-	
-	BTree_ParseTreeNode(tree->root, parseFunction, args);
-}
-
-void* BTree_GetData( BTreeNode *node )
-{
-	if ( node == NULL ){
-		return NULL;
-	}
-	else{
-		return (void*) node->data;
-	}
-}
-
-void _BTree_DeleteFunc_Helper( BTreeNode *node, BTree_dataDeleteFunction *nodeDataDeleteFunc, ChunkArray *pool )
-{
-	BTreeNode *left = NULL;
-	BTreeNode *right = NULL;
-	
-	if( node != NULL ){
-		if ( node == NIL ){
-			return;
-		}
-	
-		left = node->left;
-		right = node->right;
-		
-		_BTree_DeleteFunc_Helper( left, nodeDataDeleteFunc, pool );
-		
-		if( node->data != NULL ){
-			if( nodeDataDeleteFunc != NULL ){
-				nodeDataDeleteFunc( node->data );
-			}
-			/** The BTree_Delete function will not attempt to delete any NodeData unless a nodeDataDeleteFunction is explicitly specified by the user */
-#if 0
-			else{
-				free( node->data );
-			}
-#endif
-		}
-
-		if( pool ){
-			ChunkArray_DeleteObjectID( pool, node->id );
-		}
-		else{
-			free( node );
-		}
-
-		_BTree_DeleteFunc_Helper( right, nodeDataDeleteFunc, pool );
-	}
-}
-
-void _BTree_DeleteFunc( void *self )
-{
-	BTree *tree = NULL;
-	
-	tree = (BTree*) self;
-	assert( tree );
-
-	_BTree_DeleteFunc_Helper( tree->root, tree->dataDeleteFunction, tree->pool );
-	tree->nodeCount = 0;
-	/* freeing the tree instead of using class_delete, because it was initially malloced */
-
-	if( tree->pool ){
-		Stg_Class_Delete( tree->pool );
-	}
-
-	free( tree );
-}
-
-void _BTree_PrintFunc_Helper( BTreeNode *node, BTree_dataPrintFunction *nodeDataPrintFunc, Stream *myStream )
-{
-	if( node != NULL ){
-		if ( node == NIL ){
-			return;
-		}
-		assert( myStream );
-
-		_BTree_PrintFunc_Helper( node->left, nodeDataPrintFunc, myStream );
-		if( node->data != NULL ){
-			if( nodeDataPrintFunc != NULL ){
-				nodeDataPrintFunc( node->data, myStream );
-			}
-			else{
-				Journal_Printf( myStream, "\tData - (ptr): (%p)\n", node->data );
-			}
-		}
-		_BTree_PrintFunc_Helper( node->right, nodeDataPrintFunc, myStream );
-	}
-}
-
-void _BTree_PrintFunc( void *self, Stream *myStream )
-{
-	BTree *tree = NULL;
-
-	tree = (BTree*) self;
-	assert( tree );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) tree, myStream );
-
-	/* general info */
-	Journal_Printf( myStream, "BTree (ptr): (%p)\n", tree );
-	
-	_BTree_PrintFunc_Helper( tree->root, tree->dataPrintFunction, myStream );
-	/* Virtual Info */
-
-	/* BTree Info */
-	
-}
-
-void BTree_Delete( void* tree ) {
-	Stg_Class_Delete( tree );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/BTree.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/BTree.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,735 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: BTreeNode.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "BTreeNode.h"
+#include "BTree.h"
+#include "ChunkArray.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#define  POOL_SIZE 1000
+#define  POOL_DELTA 1000
+
+const Type BTree_Type = "BTree";
+
+BTree *_BTree_New(
+		SizeT					_sizeOfSelf,
+		Type					type,
+		Stg_Class_DeleteFunction*	_delete,
+		Stg_Class_PrintFunction*	_print,
+		Stg_Class_CopyFunction*		_copy
+		)
+{
+	BTree *self = NULL;
+
+	/** BTree has to be malloced instead of using Class_New, because Class_New uses Memory_Alloc, but the Memory module will not have been
+	 *  initialized at this stage */
+	
+	self = (BTree*)malloc( _sizeOfSelf );
+	memset( self, 0, _sizeOfSelf );
+	
+	self->_sizeOfSelf = _sizeOfSelf;
+	self->_deleteSelf = True;
+	self->type = type;
+	self->_delete = _delete;
+	self->_print = _print;
+	self->_copy = _copy;
+	
+	return self;
+}
+
+BTree *BTree_New( 
+		BTree_compareFunction*		compareFunction,
+		BTree_dataCopyFunction*		dataCopyFunction,
+		BTree_dataDeleteFunction*	dataDeleteFunction,
+		BTree_dataPrintFunction*	dataPrintFunction,
+		BTreeProperty				property )
+{
+	
+	BTree* self;
+	
+	/* Allocate memory */
+	assert ( compareFunction );
+	
+	self = _BTree_New(
+			sizeof(BTree),
+			BTree_Type,
+			_BTree_DeleteFunc,
+			_BTree_PrintFunc,
+			NULL
+			);
+	/* General info */
+	
+	/* Virtual functions */
+	
+	self->compareFunction = compareFunction;
+	self->dataCopyFunction = dataCopyFunction;
+	self->dataDeleteFunction = dataDeleteFunction;
+	self->dataPrintFunction = dataPrintFunction;
+	self->property = property;
+
+	self->pool = NULL;
+
+	_BTree_Init( self );	
+	return self;
+}
+
+void _BTree_Init( BTree* self )
+{
+
+	assert(self);
+	self->root = NIL;
+
+	self->pool = ChunkArray_New( BTreeNode, POOL_SIZE );
+}
+
+void BTree_Init( BTree *self )
+{
+	_BTree_Init( self );
+}
+
+void BTree_LeftRotate( BTree *tree, BTreeNode *x ) 
+{
+ 
+	BTreeNode *root;
+	BTreeNode *y;
+	 
+	assert( tree );
+	assert( x );
+	
+	y = x->right;
+	root = tree->root;
+ 
+ 
+	if (x == NIL){
+	}
+	
+	/* establish x->right link */
+	x->right = y->left;
+	if ( y->left != NIL ) y->left->parent = x;
+ 
+	/* establish y->parent link */
+	if (y != NIL) {
+		y->parent = x->parent;
+	}
+	
+	if ( x->parent ) {
+		if (x == x->parent->left)
+		{
+             x->parent->left = y;
+		}
+		else{
+             x->parent->right = y;
+		}
+	} 
+	else{
+		tree->root = y;
+	}
+ 
+	/* link x and y */
+	y->left = x;
+	if (x != NIL){
+		x->parent = y;
+	}
+ }
+ 
+void BTree_RightRotate( BTree *tree, BTreeNode *x ) {
+ 
+	BTreeNode *root;
+	BTreeNode *y;
+	
+	assert( tree );
+	assert( x );
+	
+	y = x->left;
+	root = tree->root;
+ 
+ 
+	if( x == NIL ){
+	}
+
+	/* establish x->left link */
+	x->left = y->right;
+	if (y->right != NIL){
+		y->right->parent = x;
+	}
+		
+	/* establish y->parent link */
+	if (y != NIL) {
+		y->parent = x->parent;
+	}
+	
+	if( x->parent ){
+		if (x == x->parent->right){
+			x->parent->right = y;
+		}
+        else{
+             x->parent->left = y;
+		}
+	}
+	else{
+		tree->root = y;
+	}
+ 
+	/* link x and y */
+	y->right = x;
+	if (x != NIL){
+		x->parent = y;
+	}
+}
+
+void BTree_InsertFix (BTree *tree, BTreeNode *x){
+	
+	BTreeNode *y = NIL, *root;
+
+	assert ( tree );
+	assert ( x );
+
+	root = tree->root;
+	
+	while ( ( x != root ) && ( x->parent->color == BTREE_NODE_RED ) ){
+    	if ( x->parent == x->parent->parent->left ) {
+			/* If x's parent is a left, y is x's right 'uncle' */
+			y = x->parent->parent->right;
+			
+			if ( y->color == BTREE_NODE_RED ) {
+				/* case 1 - change the colours */
+				x->parent->color = BTREE_NODE_BLACK;
+				y->color = BTREE_NODE_BLACK;
+				x->parent->parent->color = BTREE_NODE_RED;
+				/* Move x up the tree */
+				x = x->parent->parent;
+			}
+			else{
+				/* y is a BTREE_NODE_BLACK node */
+				if ( x == x->parent->right ) {
+					/* and x is to the right  */
+					/* case 2 - move x up and rotate */
+					x = x->parent;
+					BTree_LeftRotate( tree, x );
+				}
+				/* case 3 */
+				x->parent->color = BTREE_NODE_BLACK;
+				x->parent->parent->color = BTREE_NODE_RED;
+				BTree_RightRotate( tree, x->parent->parent );
+			}
+		}
+		else if ( x->parent == x->parent->parent->right ){
+			
+			/* If x's parent is a right, y is x's right 'uncle' */ 
+			y = x->parent->parent->left;
+			
+				if ( y->color == BTREE_NODE_RED ) {
+					/* case 1 - change the colours */
+					x->parent->color = BTREE_NODE_BLACK;
+					y->color = BTREE_NODE_BLACK;
+					x->parent->parent->color = BTREE_NODE_RED;
+					/* Move x up the tree */
+					x = x->parent->parent;
+				}
+				else{
+					/* y is a BTREE_NODE_BLACK node */
+					if ( x == x->parent->left ) {
+						/* and x is to the right  */
+						/* case 2 - move x up and rotate */ 
+						x = x->parent;
+						BTree_RightRotate( tree, x );
+					}
+					/* case 3 */
+					x->parent->color = BTREE_NODE_BLACK;
+					x->parent->parent->color = BTREE_NODE_RED;
+					BTree_LeftRotate( tree, x->parent->parent );
+				}
+		}
+		else{
+
+		}
+	}
+
+	/* Colour the root BTREE_NODE_BLACK */
+	tree->root->color = BTREE_NODE_BLACK;
+}
+/* The BTree_Insert function assumes that the compare function accepts two void pointers to NodeData as arguments */
+int BTree_InsertNode ( BTree *tree, void *newNodeData, SizeT sizeOfData ){
+	
+	BTreeNode *curr, *spot, *newNode;
+
+	assert ( tree );
+	assert ( newNodeData );
+	/*assert ( sizeOfData > 0 ); removed for PtrSet - Luke */
+	
+	curr = tree->root;
+	
+	newNode = BTreeNode_New( tree->pool );
+	newNode->sizeOfData = sizeOfData;
+	
+	if ( tree->dataCopyFunction ){
+		tree->dataCopyFunction ( &newNode->data, newNodeData, newNode->sizeOfData);
+	}
+	else{
+		newNode->data = newNodeData;
+	}
+	
+	spot = NULL;
+	while ( curr != NIL ){
+		spot = curr;
+		if ( tree->compareFunction( newNode->data, curr->data ) > 0 ){
+			curr = curr->right;
+		}
+		else if( tree->compareFunction( newNode->data, curr->data ) == 0 ){
+			if( tree->property == BTREE_ALLOW_DUPLICATES ){
+				curr = curr->right;
+			}
+			else{
+				if( tree->dataDeleteFunction )
+					tree->dataDeleteFunction( newNode->data );
+				
+				if( tree->pool ){
+					ChunkArray_DeleteObjectID( tree->pool, newNode->id );
+				}
+				else{
+					free ( newNode );
+				}
+
+				return 0;
+			}
+		}
+		else
+		{
+			curr = curr->left;
+		}
+	}
+
+	if (spot){
+		
+		newNode->parent = spot;
+		if ( tree->compareFunction( newNode->data, spot->data ) < 0 ){
+			spot->left = newNode;
+		}
+		else{
+			spot->right = newNode;
+		}
+	}
+	else{
+		tree->root = newNode;
+	}
+
+	BTree_InsertFix ( tree, newNode );
+	++tree->nodeCount;
+#if	0
+	printf ("nodeCount from insert%d\n", tree->nodeCount);
+#endif
+	return 1;
+}
+
+void BTree_SetCompareFunction ( BTree *tree, BTree_compareFunction *compareFunction )
+{
+	assert( tree );
+	assert( compareFunction );
+	
+	tree->compareFunction = compareFunction;
+}
+
+BTreeNode *BTree_FindNode( BTree *tree, void *data ){
+	BTreeNode *curr = NIL;
+	int result;
+
+	assert ( tree );
+
+	if ( data == NULL ){
+		return NULL;
+	}
+	
+	curr = tree->root;
+
+#if 0
+	printf ( "[Finding Node---------\n" );
+#endif
+	
+	while (curr != NIL){
+		result = tree->compareFunction ( (void*) curr->data, (void*) data );
+		if ( result == 0 ){
+			
+#if 0
+			printf ( "\tFound node after %d hops\n\n", hops );
+#endif			
+
+#if 0
+	printf ( "Finding Node---------]\n" );
+#endif
+
+			return curr;
+		}
+		else{
+			if ( result > 0 ){
+				curr = curr->left;
+			}
+			else{
+				curr = curr->right;
+			}
+		}
+	}
+#if 0
+	printf ( "Finding Node---------]\n" );
+#endif
+	return NULL;
+}
+
+BTreeNode *BTree_FindNodeAndHops( BTree *tree, void *data, int *hops ){
+	BTreeNode *curr = NIL;
+	int result;
+
+	assert ( tree );
+	assert( hops );
+
+	if ( data == NULL ){
+		return NULL;
+	}
+	
+	curr = tree->root;
+	*hops = 0;
+
+#if 0
+	printf ( "[Finding Node---------\n" );
+#endif
+	
+	while (curr != NIL){
+		result = tree->compareFunction ( (void*) curr->data, (void*) data );
+		if ( result == 0 ){
+			
+#if 0
+			printf ( "\tFound node after %d hops\n\n", hops );
+#endif			
+
+#if 0
+	printf ( "Finding Node---------]\n" );
+#endif
+
+			return curr;
+		}
+		else{
+			(*hops)++;
+			
+			if ( result > 0 ){
+				curr = curr->left;
+			}
+			else{
+				curr = curr->right;
+			}
+		}
+	}
+#if 0
+	printf ( "\tFailed to find node after %d hops\n\n", hops );
+#endif
+#if 0
+	printf ( "Finding Node---------]\n" );
+#endif
+	return NULL;
+}
+
+void BTree_DeleteFixup( BTree *tree, BTreeNode *x ) {
+ 
+	BTreeNode *root, *w;
+
+	assert( tree );
+	assert ( x );
+	
+	root = tree->root;
+	while ( x != root && x->color == BTREE_NODE_BLACK ) {
+		if ( x == x->parent->left ) {
+			w = x->parent->right;
+			if ( w->color == BTREE_NODE_RED ) {
+				w->color = BTREE_NODE_BLACK;
+				x->parent->color = BTREE_NODE_RED;
+				BTree_LeftRotate ( tree, x->parent );
+				w = x->parent->right;
+			}
+			if ( w->left->color == BTREE_NODE_BLACK && w->right->color == BTREE_NODE_BLACK ) {
+				w->color = BTREE_NODE_RED;
+				x = x->parent;
+			} else {
+				if ( w->right->color == BTREE_NODE_BLACK ) {
+					w->left->color = BTREE_NODE_BLACK;
+					w->color = BTREE_NODE_RED;
+					BTree_RightRotate ( tree, w );
+					w = x->parent->right;
+				}
+				w->color = x->parent->color;
+				x->parent->color = BTREE_NODE_BLACK;
+				w->right->color = BTREE_NODE_BLACK;
+				BTree_LeftRotate ( tree, x->parent );
+				x = root;
+			}
+		} else {
+			w = x->parent->left;
+			if ( w->color == BTREE_NODE_RED ) {
+				w->color = BTREE_NODE_BLACK;
+				x->parent->color = BTREE_NODE_RED;
+				BTree_RightRotate ( tree, x->parent );
+				w = x->parent->left;
+			}
+			if ( w->right->color == BTREE_NODE_BLACK && w->left->color == BTREE_NODE_BLACK ) {
+				w->color = BTREE_NODE_RED;
+				x = x->parent;
+			} else {
+				if ( w->left->color == BTREE_NODE_BLACK ) {
+					w->right->color = BTREE_NODE_BLACK;
+					w->color = BTREE_NODE_RED;
+					BTree_LeftRotate ( tree, w );
+					w = x->parent->left;
+				}
+				w->color = x->parent->color;
+				x->parent->color = BTREE_NODE_BLACK;
+				w->left->color = BTREE_NODE_BLACK;
+				BTree_RightRotate ( tree, x->parent );
+				x = root;
+			}
+		}
+	}
+	x->color = BTREE_NODE_BLACK;
+}
+ 
+void BTree_DeleteNode( BTree *tree, BTreeNode *z ) {
+	BTreeNode *x, *y;
+ 
+	assert( tree );
+	
+	if ( !z || z == NIL ) return;
+ 
+	assert ( z );
+	
+	if ( z->left == NIL || z->right == NIL ) {
+		/* y has a NIL node as a child */
+		y = z;
+	} else {
+		/* find tree successor with a NIL node as a child */
+		y = z->right;
+		while ( y->left != NIL ) y = y->left;
+	}
+ 
+	/* x is y's only child */
+	if ( y->left != NIL )
+		x = y->left;
+	else
+		x = y->right;
+ 
+	/* remove y from the parent chain */
+	x->parent = y->parent;
+	
+	if ( y->parent ){
+		if ( y == y->parent->left ){
+			y->parent->left = x;
+		}
+		else{
+			y->parent->right = x;
+		}
+	}
+	else{
+		tree->root = x;
+	}
+ 
+	if ( y != z ){
+		if ( tree->dataCopyFunction ){
+		   	tree->dataCopyFunction ( &z->data, y->data, y->sizeOfData );
+		}
+		else{
+			z->data = y->data;
+		}
+	}
+ 
+ 
+	if ( y->color == BTREE_NODE_BLACK ){
+		BTree_DeleteFixup ( tree, x );
+	}
+ 
+	if ( tree->dataDeleteFunction ){
+		tree->dataDeleteFunction( (void*) y->data );
+	}
+
+	if( tree->pool ){
+		ChunkArray_DeleteObjectID( tree->pool, y->id );
+	}
+	else{
+		free ( y );
+	}
+	--tree->nodeCount;
+#if	0
+	printf ("nodeCount from delete %d\n", tree->nodeCount);
+#endif
+}
+
+void BTree_ParseTreeNode( BTreeNode *root, BTree_parseFunction *parseFunction, void *args ){
+
+	assert ( root );
+	assert ( parseFunction );
+	
+	if ( root == NIL ){
+		return;
+	}
+	
+	BTree_ParseTreeNode( root->left, parseFunction, args );
+	
+	assert ( root->data );
+	parseFunction ( root->data, args );
+	
+	BTree_ParseTreeNode( root->right, parseFunction, args );
+}
+
+void BTree_ParseTree( BTree *tree, BTree_parseFunction *parseFunction, void *args ){
+
+	assert ( tree );
+	assert ( parseFunction );
+	
+	if ( tree->root == NIL ){
+		return;
+	}
+	
+	BTree_ParseTreeNode(tree->root, parseFunction, args);
+}
+
+void* BTree_GetData( BTreeNode *node )
+{
+	if ( node == NULL ){
+		return NULL;
+	}
+	else{
+		return (void*) node->data;
+	}
+}
+
+void _BTree_DeleteFunc_Helper( BTreeNode *node, BTree_dataDeleteFunction *nodeDataDeleteFunc, ChunkArray *pool )
+{
+	BTreeNode *left = NULL;
+	BTreeNode *right = NULL;
+	
+	if( node != NULL ){
+		if ( node == NIL ){
+			return;
+		}
+	
+		left = node->left;
+		right = node->right;
+		
+		_BTree_DeleteFunc_Helper( left, nodeDataDeleteFunc, pool );
+		
+		if( node->data != NULL ){
+			if( nodeDataDeleteFunc != NULL ){
+				nodeDataDeleteFunc( node->data );
+			}
+			/** The BTree_Delete function will not attempt to delete any NodeData unless a nodeDataDeleteFunction is explicitly specified by the user */
+#if 0
+			else{
+				free( node->data );
+			}
+#endif
+		}
+
+		if( pool ){
+			ChunkArray_DeleteObjectID( pool, node->id );
+		}
+		else{
+			free( node );
+		}
+
+		_BTree_DeleteFunc_Helper( right, nodeDataDeleteFunc, pool );
+	}
+}
+
+void _BTree_DeleteFunc( void *self )
+{
+	BTree *tree = NULL;
+	
+	tree = (BTree*) self;
+	assert( tree );
+
+	_BTree_DeleteFunc_Helper( tree->root, tree->dataDeleteFunction, tree->pool );
+	tree->nodeCount = 0;
+	/* freeing the tree instead of using class_delete, because it was initially malloced */
+
+	if( tree->pool ){
+		Stg_Class_Delete( tree->pool );
+	}
+
+	free( tree );
+}
+
+void _BTree_PrintFunc_Helper( BTreeNode *node, BTree_dataPrintFunction *nodeDataPrintFunc, Stream *myStream )
+{
+	if( node != NULL ){
+		if ( node == NIL ){
+			return;
+		}
+		assert( myStream );
+
+		_BTree_PrintFunc_Helper( node->left, nodeDataPrintFunc, myStream );
+		if( node->data != NULL ){
+			if( nodeDataPrintFunc != NULL ){
+				nodeDataPrintFunc( node->data, myStream );
+			}
+			else{
+				Journal_Printf( myStream, "\tData - (ptr): (%p)\n", node->data );
+			}
+		}
+		_BTree_PrintFunc_Helper( node->right, nodeDataPrintFunc, myStream );
+	}
+}
+
+void _BTree_PrintFunc( void *self, Stream *myStream )
+{
+	BTree *tree = NULL;
+
+	tree = (BTree*) self;
+	assert( tree );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) tree, myStream );
+
+	/* general info */
+	Journal_Printf( myStream, "BTree (ptr): (%p)\n", tree );
+	
+	_BTree_PrintFunc_Helper( tree->root, tree->dataPrintFunction, myStream );
+	/* Virtual Info */
+
+	/* BTree Info */
+	
+}
+
+void BTree_Delete( void* tree ) {
+	Stg_Class_Delete( tree );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/BTreeIterator.c
--- a/Base/Container/src/BTreeIterator.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: BTreeIterator.c 2038 2005-04-16 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "BTreeNode.h"
-#include "BTree.h"
-#include "BTreeIterator.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type BTreeIterator_Type = "BTreeIterator";
-
-BTreeIterator *_BTreeIterator_New(
-		SizeT					_sizeOfSelf,
-		Type					type,
-		Stg_Class_DeleteFunction*	_delete,
-		Stg_Class_PrintFunction*	_print,
-		Stg_Class_CopyFunction*		_copy
-		)
-{
-	BTreeIterator *self = NULL;
-
-	/** BTreeIterator has to be malloced instead of using Class_New, because Class_New uses Memory_Alloc, 
-	 *  but the Memory module will not have been initialized at this stage */
-	
-	self = (BTreeIterator*)malloc( _sizeOfSelf );
-	memset( self, 0, _sizeOfSelf );
-	
-	self->_sizeOfSelf = _sizeOfSelf;
-	self->_deleteSelf = True;
-	self->type = type;
-	self->_delete = _delete;
-	self->_print = _print;
-	self->_copy = _copy;
-	
-	return self;
-}
-
-BTreeIterator *BTreeIterator_New( BTree *tree )
-{
-	
-	BTreeIterator* self;
-	
-	assert( tree );
-	self = _BTreeIterator_New(
-			sizeof(BTreeIterator),
-			BTreeIterator_Type,
-			_BTreeIterator_DeleteFunc,
-			_BTreeIterator_PrintFunc,
-			NULL
-			);
-	/* General info */
-	
-	/* Virtual functions */
-	
-	self->tree = tree;
-	
-	BTreeIterator_Init( self );	
-	return self;
-}
-
-void _BTreeIterator_Init( BTreeIterator* self )
-{
-
-	assert(self);
-	self->depth = 0;
-}
-
-void BTreeIterator_Init( BTreeIterator *self )
-{
-	_BTreeIterator_Init( self );
-}
-
-void *BTreeIterator_First( BTreeIterator *self  )
-{
-	BTreeNode *node = NULL;
-	assert( self );
-	assert( self->tree );
-
-	self->depth = -1;
-
-	node = self->tree->root;
-	while( node != NIL ){
-		self->depth++;
-		self->stack[self->depth] = node;
-		node = node->left;
-	}
-	
-	if( self->depth < 0 ){
-		return NULL;
-	}
-	return self->stack[self->depth]->data;
-}
-
-void *BTreeIterator_Next( BTreeIterator *self )
-{
-	BTreeNode *node = NULL;
-	
-	assert( self );
-	assert( self->tree );
-
-	if( self->depth < 0 ){
-		return NULL;
-	}
-	
-	node = self->stack[self->depth];
-	self->depth--;
-	node = node->right;
-	
-	while( node != NIL ){
-		self->depth ++;
-		self->stack[self->depth] = node;
-		node = node->left;
-	}
-
-	if( self->depth < 0 ){
-		return NULL;
-	}
-	else{
-		return self->stack[self->depth]->data;
-	}
-}
-
-void _BTreeIterator_DeleteFunc( void *self )
-{
-	if( self ){
-		free( self );
-		/* freeing the Iterator instead of using class_delete, because it was initially malloced */
-	}
-}
-
-void _BTreeIterator_PrintFunc( void *self, Stream *myStream )
-{
-	BTreeIterator *iterator = NULL;
-
-	iterator = (BTreeIterator*) self;
-	assert( iterator );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) iterator, myStream );
-
-	/* general info */
-	Journal_Printf( myStream, "BTreeIterator (ptr): (%p)\n", iterator );
-	Journal_Printf( myStream, "\tTree (ptr): (%p)\n", iterator->tree );
-	Journal_Printf( myStream, "\tDepth : %d\n", iterator->depth );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/BTreeIterator.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/BTreeIterator.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,180 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: BTreeIterator.c 2038 2005-04-16 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "BTreeNode.h"
+#include "BTree.h"
+#include "BTreeIterator.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type BTreeIterator_Type = "BTreeIterator";
+
+BTreeIterator *_BTreeIterator_New(
+		SizeT					_sizeOfSelf,
+		Type					type,
+		Stg_Class_DeleteFunction*	_delete,
+		Stg_Class_PrintFunction*	_print,
+		Stg_Class_CopyFunction*		_copy
+		)
+{
+	BTreeIterator *self = NULL;
+
+	/** BTreeIterator has to be malloced instead of using Class_New, because Class_New uses Memory_Alloc, 
+	 *  but the Memory module will not have been initialized at this stage */
+	
+	self = (BTreeIterator*)malloc( _sizeOfSelf );
+	memset( self, 0, _sizeOfSelf );
+	
+	self->_sizeOfSelf = _sizeOfSelf;
+	self->_deleteSelf = True;
+	self->type = type;
+	self->_delete = _delete;
+	self->_print = _print;
+	self->_copy = _copy;
+	
+	return self;
+}
+
+BTreeIterator *BTreeIterator_New( BTree *tree )
+{
+	
+	BTreeIterator* self;
+	
+	assert( tree );
+	self = _BTreeIterator_New(
+			sizeof(BTreeIterator),
+			BTreeIterator_Type,
+			_BTreeIterator_DeleteFunc,
+			_BTreeIterator_PrintFunc,
+			NULL
+			);
+	/* General info */
+	
+	/* Virtual functions */
+	
+	self->tree = tree;
+	
+	BTreeIterator_Init( self );	
+	return self;
+}
+
+void _BTreeIterator_Init( BTreeIterator* self )
+{
+
+	assert(self);
+	self->depth = 0;
+}
+
+void BTreeIterator_Init( BTreeIterator *self )
+{
+	_BTreeIterator_Init( self );
+}
+
+void *BTreeIterator_First( BTreeIterator *self  )
+{
+	BTreeNode *node = NULL;
+	assert( self );
+	assert( self->tree );
+
+	self->depth = -1;
+
+	node = self->tree->root;
+	while( node != NIL ){
+		self->depth++;
+		self->stack[self->depth] = node;
+		node = node->left;
+	}
+	
+	if( self->depth < 0 ){
+		return NULL;
+	}
+	return self->stack[self->depth]->data;
+}
+
+void *BTreeIterator_Next( BTreeIterator *self )
+{
+	BTreeNode *node = NULL;
+	
+	assert( self );
+	assert( self->tree );
+
+	if( self->depth < 0 ){
+		return NULL;
+	}
+	
+	node = self->stack[self->depth];
+	self->depth--;
+	node = node->right;
+	
+	while( node != NIL ){
+		self->depth ++;
+		self->stack[self->depth] = node;
+		node = node->left;
+	}
+
+	if( self->depth < 0 ){
+		return NULL;
+	}
+	else{
+		return self->stack[self->depth]->data;
+	}
+}
+
+void _BTreeIterator_DeleteFunc( void *self )
+{
+	if( self ){
+		free( self );
+		/* freeing the Iterator instead of using class_delete, because it was initially malloced */
+	}
+}
+
+void _BTreeIterator_PrintFunc( void *self, Stream *myStream )
+{
+	BTreeIterator *iterator = NULL;
+
+	iterator = (BTreeIterator*) self;
+	assert( iterator );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) iterator, myStream );
+
+	/* general info */
+	Journal_Printf( myStream, "BTreeIterator (ptr): (%p)\n", iterator );
+	Journal_Printf( myStream, "\tTree (ptr): (%p)\n", iterator->tree );
+	Journal_Printf( myStream, "\tDepth : %d\n", iterator->depth );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/BTreeNode.c
--- a/Base/Container/src/BTreeNode.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: BTreeNode.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "ChunkArray.h"
-#include "BTreeNode.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type BTreeNode_Type = "BTreeNode";
-
-BTreeNode terminal = { BTREE_NODE_BLACK, NULL, 0, 0, NULL, NULL };
-
-BTreeNode* BTreeNode_New( ChunkArray *pool )
-{
-	BTreeNode* self;
-	
-	/* Allocate memory */
-
-	if( pool ){
-		unsigned int objID = -1;
-		assert( sizeof( BTreeNode ) == pool->elementSize );
-		objID = ChunkArray_NewObjectID( BTreeNode, pool );
-		
-		self = ( BTreeNode* ) ChunkArray_ObjectAt(pool, objID);
-		memset ( self, 0, sizeof ( BTreeNode ) );
-		
-		self->id = objID;
-	}
-	else{
-		self = ( BTreeNode* ) malloc ( sizeof( BTreeNode ) );
-		memset ( self, 0, sizeof ( BTreeNode ) );
-	}
-
-	assert ( self );
-	/* General info */
-	
-	/* Virtual functions */
-	
-	/* NamedObject info */
-	self->parent = NULL;
-	self->left = NIL;
-	self->right = NIL;
-	self->color = BTREE_NODE_RED;
-	_BTreeNode_Init( self );
-	
-	return self;
-}
-
-void _BTreeNode_Init( BTreeNode* self ){
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* BTreeNode info */
-	assert ( self );
-	self->data = NULL;
-	self->sizeOfData = 0;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/BTreeNode.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/BTreeNode.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,96 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: BTreeNode.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "ChunkArray.h"
+#include "BTreeNode.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type BTreeNode_Type = "BTreeNode";
+
+BTreeNode terminal = { BTREE_NODE_BLACK, NULL, 0, 0, NULL, NULL };
+
+BTreeNode* BTreeNode_New( ChunkArray *pool )
+{
+	BTreeNode* self;
+	
+	/* Allocate memory */
+
+	if( pool ){
+		unsigned int objID = -1;
+		assert( sizeof( BTreeNode ) == pool->elementSize );
+		objID = ChunkArray_NewObjectID( BTreeNode, pool );
+		
+		self = ( BTreeNode* ) ChunkArray_ObjectAt(pool, objID);
+		memset ( self, 0, sizeof ( BTreeNode ) );
+		
+		self->id = objID;
+	}
+	else{
+		self = ( BTreeNode* ) malloc ( sizeof( BTreeNode ) );
+		memset ( self, 0, sizeof ( BTreeNode ) );
+	}
+
+	assert ( self );
+	/* General info */
+	
+	/* Virtual functions */
+	
+	/* NamedObject info */
+	self->parent = NULL;
+	self->left = NIL;
+	self->right = NIL;
+	self->color = BTREE_NODE_RED;
+	_BTreeNode_Init( self );
+	
+	return self;
+}
+
+void _BTreeNode_Init( BTreeNode* self ){
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* BTreeNode info */
+	assert ( self );
+	self->data = NULL;
+	self->sizeOfData = 0;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/ChunkArray.c
--- a/Base/Container/src/ChunkArray.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,506 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ChunkArray.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "ChunkArray.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type ChunkArray_Type = "ChunkArray";
-
-ChunkArray *_ChunkArray_New(
-		SizeT					_sizeOfSelf,
-		Type					type,
-		Stg_Class_DeleteFunction*	_delete,
-		Stg_Class_PrintFunction*	_print,
-		Stg_Class_CopyFunction*		_copy
-		)
-{
-	ChunkArray *self = NULL;
-	
-	self = (ChunkArray*)malloc( _sizeOfSelf );
-	memset( self, 0, _sizeOfSelf );
-	
-	self->_sizeOfSelf = _sizeOfSelf;
-	self->_deleteSelf = True;
-	self->type = type;
-	self->_delete = _delete;
-	self->_print = _print;
-	self->_copy = _copy;
-	
-	return self;
-}
-
-void _ChunkArray_Init( ChunkArray* self )
-{
-    int i = 0;
-    
-    assert(self);
-
-    self->maxChunkEntries = CHUNK_ARRAY_DELTA;
-    self->chunkToUse = INVALID;
-    
-    self->chunks = (Chunk*)NULL;
-    self->chunks = (Chunk*)malloc( sizeof(Chunk)*self->maxChunkEntries );
-    memset(self->chunks, 0, sizeof(Chunk)*self->maxChunkEntries);
-    for(i=0; i<self->maxChunkEntries; i++){
-        self->chunks[i].chunkId = INVALID;
-        self->chunks[i].numFree = INVALID;
-    }
-    
-    assert(self->chunks);
-}
-	
-ChunkArray*
-ChunkArray_NewFunc
-(
-    int         elementSize,
-    int         numElementsPerChunk
-)
-{
-    ChunkArray      *self     = NULL;
-
-    self = _ChunkArray_New(
-		sizeof(ChunkArray),
-		ChunkArray_Type,
-		_ChunkArray_Delete,
-		_ChunkArray_Print,
-		NULL);
-		
-
-    assert(self);
-    assert(elementSize > 0);
-    assert(numElementsPerChunk > 0);
-
-    self->numChunks = 0;
-    self->elementSize = elementSize;
-
-    if(numElementsPerChunk < 65535){
-        self->numElementsPerChunk = numElementsPerChunk;
-    }
-    else{
-        return NULL;
-    }
-
-    _ChunkArray_Init(self);
-    return self;
-}
-
-
-void _ChunkArray_Print( void *self, Stream *myStream )
-{
-	ChunkArray *chArray = NULL;
-
-	chArray = (ChunkArray*) self;
-	assert( chArray );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) chArray, myStream );
-
-	/* general info */
-	Journal_Printf( myStream, "CHunkArray (ptr): (%p)\n", chArray );
-}
-
-void
-_ChunkArray_Delete
-(
-    void    *chunkArray
-)
-{
-    int        i       = 0;
-    ChunkArray          *self   = NULL;
-    
-    self = (ChunkArray*)chunkArray;
-    assert (self);
-    
-    for( i=0; i<self->maxChunkEntries; i++ ){
-        if( self->chunks[i].numFree != INVALID ){
-            free( self->chunks[i].memory );
-            free( self->chunks[i].freeList );
-        }
-    }
-
-    free ( self->chunks );
-    free( self );
-}
-
-int
-ChunkArray_CreateChunk
-(
-    ChunkArray      *chunkArray,
-    int         pos
-)
-{
-    assert( chunkArray );
-
-    //printf("creating chunk at %d\n", pos);
-    if((pos) < chunkArray->maxChunkEntries){
-    }
-    else{
-        int  i = 0;
-
-        chunkArray->maxChunkEntries += CHUNK_ARRAY_DELTA;
-          chunkArray->chunks = (Chunk*)realloc(chunkArray->chunks, sizeof(Chunk)*chunkArray->maxChunkEntries );
-
-        assert(chunkArray->chunks);
-    	memset(&chunkArray->chunks[chunkArray->maxChunkEntries-CHUNK_ARRAY_DELTA], 0, sizeof(Chunk)*CHUNK_ARRAY_DELTA);
-        
-        for(i=(chunkArray->maxChunkEntries-CHUNK_ARRAY_DELTA); i<chunkArray->maxChunkEntries; i++){
-            chunkArray->chunks[i].chunkId = INVALID;
-            chunkArray->chunks[i].numFree = INVALID;
-        }
-    }
-
-    {
-        int        idx     = 0;
-        Index        i       = 0;
-        Index        j       = 0;
-        
-        idx = pos;
-
-        chunkArray->chunks[idx].memory = (char*)NULL;
-        chunkArray->chunks[idx].memory = (char*)malloc(
-                                        sizeof(char) * chunkArray->elementSize * chunkArray->numElementsPerChunk);
-        memset(chunkArray->chunks[idx].memory, 0, sizeof(char)*chunkArray->elementSize * chunkArray->numElementsPerChunk);
-    
-        assert(chunkArray->chunks[idx].memory);
-
-        chunkArray->chunks[idx].chunkId = idx;
-
-        chunkArray->chunks[idx].freeList = (char**)NULL;
-        chunkArray->chunks[idx].freeList = (char**)malloc(
-                                        sizeof(char*) * chunkArray->numElementsPerChunk);
-        
-        assert(chunkArray->chunks[idx].freeList);
-
-        chunkArray->chunks[idx].numFree = chunkArray->numElementsPerChunk;
-
-        for(i=0,j=0; i<chunkArray->numElementsPerChunk*chunkArray->elementSize; i+=chunkArray->elementSize, j++){
-            chunkArray->chunks[idx].freeList[j] = &(chunkArray->chunks[idx].memory[i]);
-        }
-
-	    ++chunkArray->numChunks;
-
-        return idx;
-    }
-}
-
-void *
-ChunkArray_NewObjectFunc
-(
-    SizeT           elementSize,
-    ChunkArray      *chunkArray
-)
-{
-    char                        *result     = NULL;
-    int                objectID    = ChunkArray_NewObjectIDFunc(elementSize, chunkArray);
-    int                chunkID     = objectID >> 16;
-    Index                arrayIdx    = objectID & TWO_EXP16;
-
-    if(chunkID < chunkArray->maxChunkEntries && chunkArray->chunks[chunkID].numFree != INVALID){
-        if(arrayIdx < chunkArray->numElementsPerChunk*chunkArray->elementSize){
-            result = (char*) ChunkArray_ObjectAt(chunkArray, objectID);
-        }
-        else{
-            assert(0);
-        }
-    }
-    else{
-        assert(0);
-    }
-
-    return result;
-}
-
-unsigned int
-ChunkArray_NewObjectIDFunc
-(
-    SizeT           elementSize,
-    ChunkArray      *chunkArray
-)
-{
-    int             index       = 0;
-    Chunk           *chunk      = NULL;
-    unsigned int    resultID    = 0;
-    unsigned int    chunkID     = 0;
-    unsigned int    arrayIdx    = 0;
-    
-    assert(elementSize == chunkArray->elementSize);
-    
-    if(chunkArray->chunkToUse == INVALID){
-        chunkArray->chunkToUse = ChunkArray_CreateChunk(chunkArray, 0);
-    }
-    
-    chunk = &(chunkArray->chunks[chunkArray->chunkToUse]);
-
-    assert(chunk);
-
-label:    index = chunk->numFree - 1;
-    if( index < 0 ){
-
-        chunkArray->chunkToUse = ChunkArray_GetChunkWithFreeSlots(chunkArray);
-        
-        if(chunkArray->chunkToUse == INVALID){
-            int chunkSlot = ChunkArray_GetFreeChunkSlot(chunkArray);
-
-            if(chunkSlot==INVALID){
-                chunkArray->chunkToUse = ChunkArray_CreateChunk(chunkArray, chunkArray->maxChunkEntries);
-                assert( chunkArray->chunkToUse != INVALID );
-            }
-            else{
-                chunkArray->chunkToUse = ChunkArray_CreateChunk(chunkArray, chunkSlot);
-                assert( chunkArray->chunkToUse != INVALID );
-            }
-        }
-        
-        chunk = &(chunkArray->chunks[chunkArray->chunkToUse]);
-        goto label;
-    }
-
-    assert(chunk->chunkId < TWO_EXP16);
-
-    chunkID = chunk->chunkId;
-    arrayIdx = ((long int)(chunk->freeList[--chunk->numFree]) - (long int)chunk->memory);
-
-    resultID = resultID | (chunkID << 16);
-    resultID = resultID | (arrayIdx);
-    
-    return resultID;
-}
-
-int
-ChunkArray_GetFreeChunkSlot
-(
-    ChunkArray      *chunkArray
-)
-{
-    int i = 0;
-
-    assert(chunkArray);
-
-    for(i=0; i<chunkArray->maxChunkEntries; i++){
-        if(chunkArray->chunks[i].numFree == INVALID){
-            return i;
-        }
-    }
-
-    return INVALID;
-}
-
-int
-ChunkArray_GetChunkWithFreeSlots
-(
-    ChunkArray      *chunkArray
-)
-{
-    int i = 0;
-    int leastNumFree = 1<<30;
-    int leastNumFreeIdx = INVALID;
-
-    assert(chunkArray);
-
-    for(i=0; i<chunkArray->maxChunkEntries; i++){
-        if(chunkArray->chunks[i].numFree > 0){
-            if(chunkArray->chunks[i].numFree < leastNumFree){
-                leastNumFree = chunkArray->chunks[i].numFree;
-                leastNumFreeIdx = i;
-            }
-        }
-    }
-
-    return leastNumFreeIdx;
-}
-        
-int
-ChunkArray_DeleteObject
-(
-       ChunkArray       *chunkArray,
-       void             *object
-)
-{
-    if( object != NULL ){
-        int                 i           = 0;
-        int                 valid       = 0;
-        int                 chunkIdx    = 0;
-
-        for ( i=0; i<chunkArray->maxChunkEntries; i++ ){
-            
-            if( chunkArray->chunks[i].memory != NULL &&
-                ((char*)object >= chunkArray->chunks[i].memory) && 
-                ((char*)object < (chunkArray->chunks[i].memory+(chunkArray->numElementsPerChunk*chunkArray->elementSize))) ){
-                valid = 1;
-                chunkIdx = i;
-                break;
-            }
-        }
-
-        if( valid ){
-            memset(object, 0, chunkArray->elementSize);
-            chunkArray->chunks[chunkIdx].freeList[chunkArray->chunks[chunkIdx].numFree++] = (char*)object;
-
-            ChunkArray_Shrink( chunkArray );
-
-            return 1;
-        }
-        else{
-            return 0;
-        }
-    }
-    else{
-        return 0;
-    }
-}
-
-int
-ChunkArray_DeleteObjectID
-(
-       ChunkArray       *chunkArray,
-       unsigned int          objectId
-)
-{
-    int chunkID  = objectId >> 16;
-    Index arrayIdx = objectId & TWO_EXP16;
-    char         *objPtr  = NULL;
-        
-    if(chunkID < chunkArray->maxChunkEntries && chunkArray->chunks[chunkID].numFree != INVALID){
-        if(arrayIdx < chunkArray->numElementsPerChunk*chunkArray->elementSize){
-            if (chunkArray->chunks[chunkID].chunkId != chunkID){
-                return FAILURE;
-            } 
-            objPtr = ChunkArray_ObjectAt(chunkArray, objectId);
-
-            if( (arrayIdx < chunkArray->numElementsPerChunk*chunkArray->elementSize) &&
-                ((char*)objPtr >= chunkArray->chunks[chunkID].memory) && 
-                ((char*)objPtr < (chunkArray->chunks[chunkID].memory+(chunkArray->numElementsPerChunk*chunkArray->elementSize))) ){
-                
-                memset(objPtr, 0, chunkArray->elementSize);
-                chunkArray->chunks[chunkID].freeList[chunkArray->chunks[chunkID].numFree++] = (char*)objPtr;
-                ChunkArray_Shrink( chunkArray );
-            }
-            else{
-                return FAILURE;
-            }
-        }
-        else{
-            return FAILURE;
-        }
-    }
-    else{
-        return FAILURE;
-    }
-    
-    return SUCCESS;    
-}
-
-void
-ChunkArray_Shrink
-(
-    ChunkArray      *chunkArray
-)
-{
-    int                     i                = 0;
-    int                     deleteFlag       = 0;
-    int                     chunkIdx         = 0;
-    int                     shrinkChunkArray = 0;
-
-    assert( chunkArray );
-
-    for(i=0; i<chunkArray->maxChunkEntries; i++){
-        //printf("\t\tmaxChunks %d chunk id %d numFree %d\n", chunkArray->maxChunkEntries, chunkArray->chunks[i].chunkId, chunkArray->chunks[i].numFree);
-        if(chunkArray->chunks[i].numFree == chunkArray->numElementsPerChunk){
-            deleteFlag = 1;
-            chunkIdx = i;
-            break;
-        }
-    }
-
-    //printf("current live objects %d\n", currObjsAlive);
-    if(deleteFlag){
-        Chunk *c = (Chunk*)NULL;
-
-       
-        c = &(chunkArray->chunks[chunkIdx]);
-
-        free(c->freeList);
-        free(c->memory);
-        memset(c, 0, sizeof(Chunk));
-        c->chunkId = INVALID;
-        c->numFree = INVALID;
-        
-        chunkArray->numChunks--;
-
-#if 1
-label:  shrinkChunkArray = 1;
-        for(i=chunkArray->maxChunkEntries-1; i>=(chunkArray->maxChunkEntries-CHUNK_ARRAY_DELTA); i--){
-            if(chunkArray->chunks[i].numFree != INVALID){
-                shrinkChunkArray = 0;
-                break;
-            }
-            else{
-
-            }
-        }
-
-        if(shrinkChunkArray && chunkArray->maxChunkEntries>CHUNK_ARRAY_DELTA){
-            chunkArray->maxChunkEntries-=CHUNK_ARRAY_DELTA;
-            
-            if(chunkArray->numChunks > chunkArray->maxChunkEntries) 
-            {
-                assert(0);
-            }
-            
-              chunkArray->chunks = (Chunk*)realloc(chunkArray->chunks, sizeof(Chunk)*(chunkArray->maxChunkEntries));
-
-            chunkArray->chunkToUse = ChunkArray_GetChunkWithFreeSlots(chunkArray);
-            
-            /*printf("shrinking chunks array, maxChunks %d numChunks %d LiveObjects %d\n", chunkArray->maxChunkEntries, chunkArray->numChunks, currObjsAlive);*/
-            
-            goto label;
-
-        }
-#endif
-    }
-}
-
-char* ChunkArray_ObjectAt(ChunkArray *chunkArray, unsigned int objectId)
-{
-    unsigned int chunkID = objectId >> 16;
-    unsigned int arrayIdx = objectId & TWO_EXP16;
-    
-    return (char*)&(chunkArray->chunks[chunkID].memory[arrayIdx]);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/ChunkArray.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/ChunkArray.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,506 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ChunkArray.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "ChunkArray.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type ChunkArray_Type = "ChunkArray";
+
+ChunkArray *_ChunkArray_New(
+		SizeT					_sizeOfSelf,
+		Type					type,
+		Stg_Class_DeleteFunction*	_delete,
+		Stg_Class_PrintFunction*	_print,
+		Stg_Class_CopyFunction*		_copy
+		)
+{
+	ChunkArray *self = NULL;
+	
+	self = (ChunkArray*)malloc( _sizeOfSelf );
+	memset( self, 0, _sizeOfSelf );
+	
+	self->_sizeOfSelf = _sizeOfSelf;
+	self->_deleteSelf = True;
+	self->type = type;
+	self->_delete = _delete;
+	self->_print = _print;
+	self->_copy = _copy;
+	
+	return self;
+}
+
+void _ChunkArray_Init( ChunkArray* self )
+{
+    int i = 0;
+    
+    assert(self);
+
+    self->maxChunkEntries = CHUNK_ARRAY_DELTA;
+    self->chunkToUse = INVALID;
+    
+    self->chunks = (Chunk*)NULL;
+    self->chunks = (Chunk*)malloc( sizeof(Chunk)*self->maxChunkEntries );
+    memset(self->chunks, 0, sizeof(Chunk)*self->maxChunkEntries);
+    for(i=0; i<self->maxChunkEntries; i++){
+        self->chunks[i].chunkId = INVALID;
+        self->chunks[i].numFree = INVALID;
+    }
+    
+    assert(self->chunks);
+}
+	
+ChunkArray*
+ChunkArray_NewFunc
+(
+    int         elementSize,
+    int         numElementsPerChunk
+)
+{
+    ChunkArray      *self     = NULL;
+
+    self = _ChunkArray_New(
+		sizeof(ChunkArray),
+		ChunkArray_Type,
+		_ChunkArray_Delete,
+		_ChunkArray_Print,
+		NULL);
+		
+
+    assert(self);
+    assert(elementSize > 0);
+    assert(numElementsPerChunk > 0);
+
+    self->numChunks = 0;
+    self->elementSize = elementSize;
+
+    if(numElementsPerChunk < 65535){
+        self->numElementsPerChunk = numElementsPerChunk;
+    }
+    else{
+        return NULL;
+    }
+
+    _ChunkArray_Init(self);
+    return self;
+}
+
+
+void _ChunkArray_Print( void *self, Stream *myStream )
+{
+	ChunkArray *chArray = NULL;
+
+	chArray = (ChunkArray*) self;
+	assert( chArray );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) chArray, myStream );
+
+	/* general info */
+	Journal_Printf( myStream, "CHunkArray (ptr): (%p)\n", chArray );
+}
+
+void
+_ChunkArray_Delete
+(
+    void    *chunkArray
+)
+{
+    int        i       = 0;
+    ChunkArray          *self   = NULL;
+    
+    self = (ChunkArray*)chunkArray;
+    assert (self);
+    
+    for( i=0; i<self->maxChunkEntries; i++ ){
+        if( self->chunks[i].numFree != INVALID ){
+            free( self->chunks[i].memory );
+            free( self->chunks[i].freeList );
+        }
+    }
+
+    free ( self->chunks );
+    free( self );
+}
+
+int
+ChunkArray_CreateChunk
+(
+    ChunkArray      *chunkArray,
+    int         pos
+)
+{
+    assert( chunkArray );
+
+    //printf("creating chunk at %d\n", pos);
+    if((pos) < chunkArray->maxChunkEntries){
+    }
+    else{
+        int  i = 0;
+
+        chunkArray->maxChunkEntries += CHUNK_ARRAY_DELTA;
+          chunkArray->chunks = (Chunk*)realloc(chunkArray->chunks, sizeof(Chunk)*chunkArray->maxChunkEntries );
+
+        assert(chunkArray->chunks);
+    	memset(&chunkArray->chunks[chunkArray->maxChunkEntries-CHUNK_ARRAY_DELTA], 0, sizeof(Chunk)*CHUNK_ARRAY_DELTA);
+        
+        for(i=(chunkArray->maxChunkEntries-CHUNK_ARRAY_DELTA); i<chunkArray->maxChunkEntries; i++){
+            chunkArray->chunks[i].chunkId = INVALID;
+            chunkArray->chunks[i].numFree = INVALID;
+        }
+    }
+
+    {
+        int        idx     = 0;
+        Index        i       = 0;
+        Index        j       = 0;
+        
+        idx = pos;
+
+        chunkArray->chunks[idx].memory = (char*)NULL;
+        chunkArray->chunks[idx].memory = (char*)malloc(
+                                        sizeof(char) * chunkArray->elementSize * chunkArray->numElementsPerChunk);
+        memset(chunkArray->chunks[idx].memory, 0, sizeof(char)*chunkArray->elementSize * chunkArray->numElementsPerChunk);
+    
+        assert(chunkArray->chunks[idx].memory);
+
+        chunkArray->chunks[idx].chunkId = idx;
+
+        chunkArray->chunks[idx].freeList = (char**)NULL;
+        chunkArray->chunks[idx].freeList = (char**)malloc(
+                                        sizeof(char*) * chunkArray->numElementsPerChunk);
+        
+        assert(chunkArray->chunks[idx].freeList);
+
+        chunkArray->chunks[idx].numFree = chunkArray->numElementsPerChunk;
+
+        for(i=0,j=0; i<chunkArray->numElementsPerChunk*chunkArray->elementSize; i+=chunkArray->elementSize, j++){
+            chunkArray->chunks[idx].freeList[j] = &(chunkArray->chunks[idx].memory[i]);
+        }
+
+	    ++chunkArray->numChunks;
+
+        return idx;
+    }
+}
+
+void *
+ChunkArray_NewObjectFunc
+(
+    SizeT           elementSize,
+    ChunkArray      *chunkArray
+)
+{
+    char                        *result     = NULL;
+    int                objectID    = ChunkArray_NewObjectIDFunc(elementSize, chunkArray);
+    int                chunkID     = objectID >> 16;
+    Index                arrayIdx    = objectID & TWO_EXP16;
+
+    if(chunkID < chunkArray->maxChunkEntries && chunkArray->chunks[chunkID].numFree != INVALID){
+        if(arrayIdx < chunkArray->numElementsPerChunk*chunkArray->elementSize){
+            result = (char*) ChunkArray_ObjectAt(chunkArray, objectID);
+        }
+        else{
+            assert(0);
+        }
+    }
+    else{
+        assert(0);
+    }
+
+    return result;
+}
+
+unsigned int
+ChunkArray_NewObjectIDFunc
+(
+    SizeT           elementSize,
+    ChunkArray      *chunkArray
+)
+{
+    int             index       = 0;
+    Chunk           *chunk      = NULL;
+    unsigned int    resultID    = 0;
+    unsigned int    chunkID     = 0;
+    unsigned int    arrayIdx    = 0;
+    
+    assert(elementSize == chunkArray->elementSize);
+    
+    if(chunkArray->chunkToUse == INVALID){
+        chunkArray->chunkToUse = ChunkArray_CreateChunk(chunkArray, 0);
+    }
+    
+    chunk = &(chunkArray->chunks[chunkArray->chunkToUse]);
+
+    assert(chunk);
+
+label:    index = chunk->numFree - 1;
+    if( index < 0 ){
+
+        chunkArray->chunkToUse = ChunkArray_GetChunkWithFreeSlots(chunkArray);
+        
+        if(chunkArray->chunkToUse == INVALID){
+            int chunkSlot = ChunkArray_GetFreeChunkSlot(chunkArray);
+
+            if(chunkSlot==INVALID){
+                chunkArray->chunkToUse = ChunkArray_CreateChunk(chunkArray, chunkArray->maxChunkEntries);
+                assert( chunkArray->chunkToUse != INVALID );
+            }
+            else{
+                chunkArray->chunkToUse = ChunkArray_CreateChunk(chunkArray, chunkSlot);
+                assert( chunkArray->chunkToUse != INVALID );
+            }
+        }
+        
+        chunk = &(chunkArray->chunks[chunkArray->chunkToUse]);
+        goto label;
+    }
+
+    assert(chunk->chunkId < TWO_EXP16);
+
+    chunkID = chunk->chunkId;
+    arrayIdx = ((long int)(chunk->freeList[--chunk->numFree]) - (long int)chunk->memory);
+
+    resultID = resultID | (chunkID << 16);
+    resultID = resultID | (arrayIdx);
+    
+    return resultID;
+}
+
+int
+ChunkArray_GetFreeChunkSlot
+(
+    ChunkArray      *chunkArray
+)
+{
+    int i = 0;
+
+    assert(chunkArray);
+
+    for(i=0; i<chunkArray->maxChunkEntries; i++){
+        if(chunkArray->chunks[i].numFree == INVALID){
+            return i;
+        }
+    }
+
+    return INVALID;
+}
+
+int
+ChunkArray_GetChunkWithFreeSlots
+(
+    ChunkArray      *chunkArray
+)
+{
+    int i = 0;
+    int leastNumFree = 1<<30;
+    int leastNumFreeIdx = INVALID;
+
+    assert(chunkArray);
+
+    for(i=0; i<chunkArray->maxChunkEntries; i++){
+        if(chunkArray->chunks[i].numFree > 0){
+            if(chunkArray->chunks[i].numFree < leastNumFree){
+                leastNumFree = chunkArray->chunks[i].numFree;
+                leastNumFreeIdx = i;
+            }
+        }
+    }
+
+    return leastNumFreeIdx;
+}
+        
+int
+ChunkArray_DeleteObject
+(
+       ChunkArray       *chunkArray,
+       void             *object
+)
+{
+    if( object != NULL ){
+        int                 i           = 0;
+        int                 valid       = 0;
+        int                 chunkIdx    = 0;
+
+        for ( i=0; i<chunkArray->maxChunkEntries; i++ ){
+            
+            if( chunkArray->chunks[i].memory != NULL &&
+                ((char*)object >= chunkArray->chunks[i].memory) && 
+                ((char*)object < (chunkArray->chunks[i].memory+(chunkArray->numElementsPerChunk*chunkArray->elementSize))) ){
+                valid = 1;
+                chunkIdx = i;
+                break;
+            }
+        }
+
+        if( valid ){
+            memset(object, 0, chunkArray->elementSize);
+            chunkArray->chunks[chunkIdx].freeList[chunkArray->chunks[chunkIdx].numFree++] = (char*)object;
+
+            ChunkArray_Shrink( chunkArray );
+
+            return 1;
+        }
+        else{
+            return 0;
+        }
+    }
+    else{
+        return 0;
+    }
+}
+
+int
+ChunkArray_DeleteObjectID
+(
+       ChunkArray       *chunkArray,
+       unsigned int          objectId
+)
+{
+    int chunkID  = objectId >> 16;
+    Index arrayIdx = objectId & TWO_EXP16;
+    char         *objPtr  = NULL;
+        
+    if(chunkID < chunkArray->maxChunkEntries && chunkArray->chunks[chunkID].numFree != INVALID){
+        if(arrayIdx < chunkArray->numElementsPerChunk*chunkArray->elementSize){
+            if (chunkArray->chunks[chunkID].chunkId != chunkID){
+                return FAILURE;
+            } 
+            objPtr = ChunkArray_ObjectAt(chunkArray, objectId);
+
+            if( (arrayIdx < chunkArray->numElementsPerChunk*chunkArray->elementSize) &&
+                ((char*)objPtr >= chunkArray->chunks[chunkID].memory) && 
+                ((char*)objPtr < (chunkArray->chunks[chunkID].memory+(chunkArray->numElementsPerChunk*chunkArray->elementSize))) ){
+                
+                memset(objPtr, 0, chunkArray->elementSize);
+                chunkArray->chunks[chunkID].freeList[chunkArray->chunks[chunkID].numFree++] = (char*)objPtr;
+                ChunkArray_Shrink( chunkArray );
+            }
+            else{
+                return FAILURE;
+            }
+        }
+        else{
+            return FAILURE;
+        }
+    }
+    else{
+        return FAILURE;
+    }
+    
+    return SUCCESS;    
+}
+
+void
+ChunkArray_Shrink
+(
+    ChunkArray      *chunkArray
+)
+{
+    int                     i                = 0;
+    int                     deleteFlag       = 0;
+    int                     chunkIdx         = 0;
+    int                     shrinkChunkArray = 0;
+
+    assert( chunkArray );
+
+    for(i=0; i<chunkArray->maxChunkEntries; i++){
+        //printf("\t\tmaxChunks %d chunk id %d numFree %d\n", chunkArray->maxChunkEntries, chunkArray->chunks[i].chunkId, chunkArray->chunks[i].numFree);
+        if(chunkArray->chunks[i].numFree == chunkArray->numElementsPerChunk){
+            deleteFlag = 1;
+            chunkIdx = i;
+            break;
+        }
+    }
+
+    //printf("current live objects %d\n", currObjsAlive);
+    if(deleteFlag){
+        Chunk *c = (Chunk*)NULL;
+
+       
+        c = &(chunkArray->chunks[chunkIdx]);
+
+        free(c->freeList);
+        free(c->memory);
+        memset(c, 0, sizeof(Chunk));
+        c->chunkId = INVALID;
+        c->numFree = INVALID;
+        
+        chunkArray->numChunks--;
+
+#if 1
+label:  shrinkChunkArray = 1;
+        for(i=chunkArray->maxChunkEntries-1; i>=(chunkArray->maxChunkEntries-CHUNK_ARRAY_DELTA); i--){
+            if(chunkArray->chunks[i].numFree != INVALID){
+                shrinkChunkArray = 0;
+                break;
+            }
+            else{
+
+            }
+        }
+
+        if(shrinkChunkArray && chunkArray->maxChunkEntries>CHUNK_ARRAY_DELTA){
+            chunkArray->maxChunkEntries-=CHUNK_ARRAY_DELTA;
+            
+            if(chunkArray->numChunks > chunkArray->maxChunkEntries) 
+            {
+                assert(0);
+            }
+            
+              chunkArray->chunks = (Chunk*)realloc(chunkArray->chunks, sizeof(Chunk)*(chunkArray->maxChunkEntries));
+
+            chunkArray->chunkToUse = ChunkArray_GetChunkWithFreeSlots(chunkArray);
+            
+            /*printf("shrinking chunks array, maxChunks %d numChunks %d LiveObjects %d\n", chunkArray->maxChunkEntries, chunkArray->numChunks, currObjsAlive);*/
+            
+            goto label;
+
+        }
+#endif
+    }
+}
+
+char* ChunkArray_ObjectAt(ChunkArray *chunkArray, unsigned int objectId)
+{
+    unsigned int chunkID = objectId >> 16;
+    unsigned int arrayIdx = objectId & TWO_EXP16;
+    
+    return (char*)&(chunkArray->chunks[chunkID].memory[arrayIdx]);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Finalise.c
--- a/Base/Container/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "units.h"
-#include "types.h"
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool BaseContainer_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,48 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "units.h"
+#include "types.h"
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool BaseContainer_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/HashTable.c
--- a/Base/Container/src/HashTable.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,604 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: HashTable.c 2038 2005-4-13 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "HashTable.h"
-#include "PtrMap.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type HashTable_Type = "HashTable";
-#define MAX_ENTRIES 255
-#define SM_HEAP_TABLE_SIZE 256
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-HashTable* _HashTable_New(  HASHTABLE_DEFARGS  )
-{
-	HashTable *self = NULL;
-
-	self = (HashTable*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	return self;
-}
-
-HashTable* HashTable_New(
-			HashTable_dataCopyFunction*		dataCopyFunction,
-			HashTable_dataPrintFunction*	dataPrintFunction,
-			HashTable_dataDeleteFunction*	dataDeleteFunction,
-			KeyType keyType)
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(HashTable);
-	Type                              type = HashTable_Type;
-	Stg_Class_DeleteFunction*      _delete = _HashTable_DeleteFunc;
-	Stg_Class_PrintFunction*        _print = _HashTable_PrintFunc;
-	Stg_Class_CopyFunction*          _copy = _HashTable_CopyFunc;
-
-	
-	HashTable* self;
-	
-	/* General info */
-	self = _HashTable_New(  HASHTABLE_PASSARGS  );
-
-	/* List info */
-	/* At the moment only String keys are supported */
-	/*TODO 
-	 * add a hash function for hashing numeric keys */
-
-	if( keyType == HASHTABLE_STRING_KEY ){
-		self->hashFunction = hashStringFunction;
-	}
-	else if(  keyType == HASHTABLE_POINTER_KEY ){
-		self->hashFunction = hashPtrFunction;
-	}
-
-	self->dataCopyFunction = dataCopyFunction;
-	self->dataPrintFunction = dataPrintFunction;
-	self->dataDeleteFunction = dataDeleteFunction;
-	self->keyType = keyType;
-	
-	/* Virtual functions */
-	HashTable_Init( self );
-	return self;
-}
-
-void _HashTable_Init( HashTable* self ){
-	/* General info */
-	
-	assert( self );
-	_Stg_Class_Init ((Stg_Class*) self);
-	
-	self->max = MAX_ENTRIES;
-	self->entries = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * (self->max+1) );
-	memset( self->entries, 0, sizeof( HashTable_Entry* ) * (self->max+1) );
-
-	/* Dictionary info */
-}
-
-void HashTable_Init( HashTable *self )
-{
-	assert( self );
-	_HashTable_Init (self);
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual Functions
-*/
-void _HashTable_PrintFunc ( void *ht, Stream *stream )
-{
-	HashTable *self = NULL;
-	
-	self = (HashTable*) ht;
-	assert( self );
-	assert( stream );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) self, stream );
-
-	/* general info */
-	Journal_Printf( stream, "HashTable (ptr): (%p)\n", self );
-
-	/* Virtual Info */
-
-	/* HashTable Info */
-	Journal_Printf( stream, "\tEntryCount\t\t - %d\n", self->count );
-	Journal_Printf( stream, "\tHashTable KeyType\t - %s\n", (self->keyType == HASHTABLE_STRING_KEY)?"STRING":"INTEGER" );
-	
-	Journal_Printf( stream, "\tHashTable data\t - \n");
-	if (self->dataPrintFunction)
-		HashTable_ParseTable( self, (HashTable_parseFunction*)self->dataPrintFunction, (void*)stream );
-}
-
-void _HashTable_DeleteFunc( void *ht )
-{
-	HashTable *self = NULL;
-	HashTable_Entry *he = NULL, *heTemp = NULL;
-	Index i = 0;
-
-	self = (HashTable*)ht;
-	assert (self);
-	
-	/* In the case of a ptrHash table at least, it's possible to have keys that hash to 255 - the default max. So,
-	 * need to check that entry for possible deletion. -- PatrickSunter, 5 Jun 2009 */
-	for( i=0; i<self->max+1; i++ ){
-		he = self->entries[i];
-		
-		if(he){
-			while( he ){
-				if( self->dataDeleteFunction ){
-					self->dataDeleteFunction( (void*) he->data );
-				}
-				if( self->keyType == HASHTABLE_POINTER_KEY){
-					/* TODO: anything to be freed here? */
-				}
-				else{
-					Memory_Free( (char*)he->key );
-				}
-				
-				heTemp = he->next;
-				Memory_Free( he ); /** Freeing the Entry without calling the Class_Delete function, because HashTable_Entry does not inherit __Class */
-
-				he = heTemp;
-			}
-		}
-	}
-	Memory_Free( self->entries );
-	_Stg_Class_Delete( self );
-}
-
-void* _HashTable_CopyFunc( const void* source, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	HashTable* self = (HashTable*)source;
-	HashTable* newTable;
-	HashTable_Index* hi;
-	void* key;
-
-	newTable = (HashTable*)_Stg_Class_Copy( self, NULL, deep, nameExt, ptrMap ) ;
-
-	newTable->hashFunction = self->hashFunction;
-	newTable->dataCopyFunction = self->dataCopyFunction;
-	newTable->dataPrintFunction = self->dataPrintFunction;
-	newTable->dataDeleteFunction = self->dataDeleteFunction;
-
-	newTable->count = self->count;
-	newTable->max = self->max;
-	newTable->keyType = self->keyType;
-
-	newTable->entries = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * (self->max+1) );
-	memset( newTable->entries, 0, sizeof( HashTable_Entry* ) * (self->max+1) );
-
-	for ( hi = HashTable_First( self ); hi; hi = HashTable_Next( hi ) ) {
-		const void* dataPtr = PtrMap_Find( ptrMap, hi->curr->data );
-		if ( dataPtr == NULL ) {
-			if ( self->dataCopyFunction ) {
-				/* data copy */
-				dataPtr = self->dataCopyFunction( hi->curr->data, NULL, deep, nameExt, ptrMap );
-			}
-			else {
-				dataPtr = hi->curr->data;
-			}
-		}
-		key = PtrMap_Find( ptrMap, (void*)hi->curr->key );
-		if ( key == NULL ) {
-			/* Assume a const key so just assign */
-			key = (void*)hi->curr->key;
-		}
-			
-		HashTable_InsertEntry( newTable, key, hi->curr->keyLength, dataPtr, hi->curr->dataSize );
-	}
-	
-	return newTable;
-}
-
-static unsigned char hashtab[SM_HEAP_TABLE_SIZE] =
-{
-	161, 71, 77,187, 15,229,  9,176,221,119,239, 21, 85,138,203, 86,
-	102, 65, 80,199,235, 32,140, 96,224, 78,126,127,144,  0, 11,179,
-	64, 30,120, 23,225,226, 33, 50,205,167,130,240,174, 99,206, 73,
-	231,210,189,162, 48, 93,246, 54,213,141,135, 39, 41,192,236,193,
-	157, 88, 95,104,188, 63,133,177,234,110,158,214,238,131,233, 91,
-	125, 82, 94, 79, 66, 92,151, 45,252, 98, 26,183,  7,191,171,106,
-	145,154,251,100,113,  5, 74, 62, 76,124, 14,217,200, 75,115,190,
-	103, 28,198,196,169,219, 37,118,150, 18,152,175, 49,136,  6,142,
-	89, 19,243,254, 47,137, 24,166,180, 10, 40,186,202, 46,184, 67,
-	148,108,181, 81, 25,241, 13,139, 58, 38, 84,253,201, 12,116, 17,
-	195, 22,112, 69,255, 43,147,222,111, 56,194,216,149,244, 42,173,
-	232,220,249,105,207, 51,197,242, 72,211,208, 59,122,230,237,170,
-	165, 44, 68,123,129,245,143,101,  8,209,215,247,185, 57,218, 53,
-	114,121,  3,128,  4,204,212,146,  2,155, 83,250, 87, 29, 31,159,
-	60, 27,107,156,227,182,  1, 61, 36,160,109, 97, 90, 20,168,132,
-	223,248, 70,164, 55,172, 34, 52,163,117, 35,153,134, 16,178,228
-};
-
-/*
-**  PTRHASH -- hash a pointer value
-**
-**Parameters:
-**p -- pointer.
-**
-**Returns:
-**hash value.
-**
-**  ptrhash hashes a pointer value to a uniformly distributed random
-**  number between 0 and 255.
-**
-**  This hash algorithm is based on Peter K. Pearson,
-**  "Fast Hashing of Variable-Length Text Strings",
-**  in Communications of the ACM, June 1990, vol 33 no 6.
-*/
-
-unsigned int hashPtrFunction( const void *p, const unsigned int keyLen )
-{
-	int h;
-	unsigned long n = (unsigned long)p;
-
-	/* NOTE: these #if makes keyLen unused */
-
-#if defined(SYSTEM_SIZEOF_LONG) && SYSTEM_SIZEOF_LONG == 8
-	h = hashtab[n & 0xFF];
-	h = hashtab[h ^ ((n >> 8) & 0xFF)];
-	h = hashtab[h ^ ((n >> 16) & 0xFF)];
-	h = hashtab[h ^ ((n >> 24) & 0xFF)];
-	h = hashtab[h ^ ((n >> 32) & 0xFF)];
-	h = hashtab[h ^ ((n >> 40) & 0xFF)];
-	h = hashtab[h ^ ((n >> 48) & 0xFF)];
-	h = hashtab[h ^ ((n >> 56) & 0xFF)];
-#else
-	/* Else assume 32 bit system. Watch this get invalidated one day =) */
-	h = hashtab[n & 0xFF];
-	h = hashtab[h ^ ((n >> 8) & 0xFF)];
-	h = hashtab[h ^ ((n >> 16) & 0xFF)];
-	h = hashtab[h ^ ((n >> 24) & 0xFF)];
-#endif
-		
-	return h;
-}
-
-unsigned int hashStringFunction( const void *voidKey, const unsigned int keyLen )
-{
-    /*
-     * This is the popular `times 33' hash algorithm which is used by
-     * perl and also appears in Berkeley DB. This is one of the best
-     * known hash functions for strings because it is both computed
-     * very fast and distributes very well.
-     *
-     * The originator may be Dan Bernstein but the code in Berkeley DB
-     * cites Chris Torek as the source. The best citation I have found
-     * is "Chris Torek, Hash function for text in C, Usenet message
-     * <27038 at mimsy.umd.edu> in comp.lang.c , October, 1990." in Rich
-     * Salz's USENIX 1992 paper about INN which can be found at
-     * <http://citeseer.nj.nec.com/salz92internetnews.html>.
-     *
-     * The magic of number 33, i.e. why it works better than many other
-     * constants, prime or not, has never been adequately explained by
-     * anyone. So I try an explanation: if one experimentally tests all
-     * multipliers between 1 and 256 (as I did while writing a low-level
-     * data structure library some time ago) one detects that even
-     * numbers are not useable at all. The remaining 128 odd numbers
-     * (except for the number 1) work more or less all equally well.
-     * They all distribute in an acceptable way and this way fill a hash
-     * table with an average percent of approx. 86%.
-     *
-     * If one compares the chi^2 values of the variants (see
-     * Bob Jenkins ``Hashing Frequently Asked Questions'' at
-     * http://burtleburtle.net/bob/hash/hashfaq.html for a description
-     * of chi^2), the number 33 not even has the best value. But the
-     * number 33 and a few other equally good numbers like 17, 31, 63,
-     * 127 and 129 have nevertheless a great advantage to the remaining
-     * numbers in the large set of possible multipliers: their multiply
-     * operation can be replaced by a faster operation based on just one
-     * shift plus either a single addition or subtraction operation. And
-     * because a hash function has to both distribute good _and_ has to
-     * be very fast to compute, those few numbers should be preferred.
-     *
-     *                  -- Ralf S. Engelschall <rse at engelschall.com>
-     */
-	
-	/*
-	 * The above comment and the hash algorithm has been taken from 
-	 * subversion's hashFunction.
-	 */
-	
-	unsigned int hash = 0;
-	unsigned char *key;
-	unsigned char *p = (unsigned char*) 0;
-	unsigned int i = 0;
-	
-	key = (unsigned char*)voidKey;
-
-	hash = 0;
-	for( p=key, i=keyLen; i; i--, p++ ){
-		hash = hash * 33 + *p;
-	}
-
-	return hash;
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-int HashTable_InsertEntry ( HashTable *ht, const void *voidKey, unsigned int keyLen, const void *data, SizeT dataSize )
-{
-	unsigned int hash = 0;
-	HashTable_Entry *he = NULL, **hep = NULL;
-	unsigned char *key;
-	int count;
-	
-	assert( ht );
-	assert( data );
-	assert( ht->hashFunction );
-
-	key = (unsigned char*) voidKey;
-	
-	if( ht->keyType == HASHTABLE_POINTER_KEY ){
-		hash = ht->hashFunction( voidKey, sizeof( void* )  );
-		
-		count = 0;
-		for (hep = &ht->entries[hash], he = *hep;
-			he; hep = &he->next, he = *hep) {
-		
-			if (he->hash == (unsigned int)hash
-				&& ((void*)he->key == (void*)voidKey)){
-         
-				fprintf( stdout, "trying to enter duplicate keys\n" );
-				return 0;
-			}
-			count++;
-    		}
-	}
-	else{
-		hash = ht->hashFunction( voidKey, keyLen  );
-	
-
-		while( (hash & ht->max) > ht->max - 1 ){
-			expandArray( ht );
-		}
-	
-		count = 0;
-		for (hep = &ht->entries[hash & ht->max], he = *hep;
-			he; hep = &he->next, he = *hep) {
-		
-			if (he->hash == hash
-				&& he->keyLength == keyLen
-				&& memcmp(he->key, key, keyLen) == 0){
-         
-				fprintf( stderr, "trying to enter duplicate keys\n" );
-				return 0;
-			}
-			count++;
-    		}
-	}
-	
-	he = Memory_Alloc( HashTable_Entry , "HashTable_Entry");
-	memset( he, 0, sizeof( HashTable_Entry ) );
-	he->next = NULL;
-	he->hash = hash;
-	
-	if( ht->keyType== HASHTABLE_POINTER_KEY){
-		he->key = (void*)key;
-	}
-	else{
-		he->key = StG_Strdup( (char *)key );
-	}
-	
-	he->keyLength = keyLen;
-
-	he->data = data;
-	he->dataSize = dataSize;
-	ht->count++;
-	*hep = he;
-		
-	/*returning the number of collisions incurred. 0 means no collisions and a new entry
-	 * at that index, 1 means 1 collision, and so on */ 	
-	return count; 
-}
-
-int HashTable_InsertEntryCopyData ( HashTable *ht, const void *voidKey, unsigned int keyLen, void *data, SizeT dataSize ) {
-	void* dataToInsert = data;
-	if ( ht->dataCopyFunction ) {
-		dataToInsert = ht->dataCopyFunction( data, NULL, True, NULL, NULL );
-	}
-	return HashTable_InsertEntry( ht, voidKey, keyLen, dataToInsert, dataSize );
-}
-
-void *HashTable_FindEntryFunction( HashTable *ht, const void *voidKey, unsigned int keyLen )
-{
-	unsigned char *key;
-	unsigned int hash = 0;
-	HashTable_Entry *he = NULL, **hep = NULL;
-	
-	assert( ht );
-	assert( ht->hashFunction );
-
-	if( ht->keyType == HASHTABLE_POINTER_KEY  ){
-		hash = ht->hashFunction( voidKey, sizeof( void* )  );
-		
-		for (hep = &ht->entries[hash], he = *hep;
-			he; hep = &he->next, he = *hep) {
-		
-			if (he->hash == hash
-				&& ((void*)he->key == (void*)voidKey)){
-         
-				break;
-			}
-		}
-	}
-	else{
-		key = (unsigned char*)voidKey;
-		hash = ht->hashFunction( voidKey, keyLen );
-
-		for (hep = &ht->entries[hash & ht->max], he = *hep;
-			he; hep = &he->next, he = *hep) {
-		
-			if (he->hash == hash
-				&& he->keyLength == keyLen
-				&& memcmp(he->key, key, keyLen) == 0){
-         
-				break;
-			}
-	    	}
-	}
-
-	if( he ){
-		return (void*)he->data;
-	}
-	
-	return NULL;
-}
-
-int HashTable_DeleteEntry( HashTable* ht, const void *voidKey, unsigned int keyLen ) {
-	unsigned char*    key;
-	unsigned int      hash = 0;
-	HashTable_Entry*  he   = NULL; 
-	HashTable_Entry** hep  = NULL;
-	
-	assert( ht );
-	assert( ht->hashFunction );
-
-	key = (unsigned char*)voidKey;
-	assert( key );
-	hash = ht->hashFunction( voidKey, keyLen );
-
-	for (hep = &ht->entries[hash & ht->max], he = *hep; he; hep = &he->next, he = *hep) {
-		if ( he->hash == hash && he->keyLength == keyLen && memcmp(he->key, key, keyLen) == 0){
-			break;
-		}
-	}
-
-	if( he ) {
-		*hep = he->next;
-		ht->count--;
-		if( ht->dataDeleteFunction ){
-                  ht->dataDeleteFunction( (void*)(he->data) );
-		}
-		else{
-			/* Leaving the data inside the entry */
-		}
-		
-		Memory_Free( he );
-		return 1;
-	}
-
-	return 0;
-}
-
-int HashTable_ReplaceEntry( HashTable *ht, const void *voidKey, unsigned int keyLen, void *data, SizeT dataSize ) {
-	if ( HashTable_FindEntryFunction( ht, voidKey, keyLen ) ) {
-		HashTable_DeleteEntry( ht, voidKey, keyLen );
-	}
-	return HashTable_InsertEntry( ht, voidKey, keyLen, data, dataSize );
-}
-
-void HashTable_ParseTable( HashTable *ht, HashTable_parseFunction *parseFunction, void *args )
-{
-	HashTable *self = NULL;
-	HashTable_Entry *he = NULL;
-	Index i = 0;
-
-	self = (HashTable*)ht;
-	assert( self );
-	assert( parseFunction );
-	
-	/* In the case of a ptrHash table at least, it's possible to have keys that hash to 255 - the default max. So,
-	 * need to check that entry for possible handling. -- PatrickSunter, 5 Jun 2009 */
-	for( i=0; i<(self->max+1); i++ ){
-		he = self->entries[i];
-		
-		if(he){
-			while( he ){
-				parseFunction( he->data, args );
-				he = he->next;
-			}
-		}
-	}
-}
-
-void expandArray( HashTable *ht )
-{
-	unsigned int newMax = 0;
-	HashTable_Entry **newArray = NULL;
-	HashTable_Index *hi = NULL;
-
-	assert( ht );
-	
-	newMax = ht->max * 2 + 1;
-	newArray = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * newMax );
-	if( !newArray ){
-		Journal_Firewall(0, Journal_Register(ErrorStream_Type,"HashTable"), "Out of memory in '%s'\n", __func__ );
-	}
-	memset( newArray, 0, sizeof( HashTable_Entry* ) * newMax );
-	
-    for (hi = HashTable_First( ht ); hi; hi = HashTable_Next( hi )) {
-        unsigned int i = hi->curr->hash & newMax;
-        hi->curr->next = newArray[i];
-        newArray[i] = hi->curr;
-    }
-	
-	ht->entries = newArray;
-	ht->max = newMax;
-}
-
-HashTable_Index* HashTable_Next( HashTable_Index *hi )
-{
-	assert( hi );
-	
-	hi->curr= hi->next;
-	while (!hi->curr) {
-		if (hi->index > hi->ht->max - 1)
-			return NULL;
-
-		hi->curr= hi->ht->entries[hi->index++];
-	}
-	hi->next = hi->curr->next;
-
-	return hi;
-}
-
-HashTable_Index* HashTable_First( HashTable *ht )
-{
-	HashTable_Index *hi;
-    
-	assert( ht );
-	hi = &ht->iterator;
-
-	hi->ht = ht;
-	hi->index = 0;
-	hi->curr= NULL;
-	hi->next = NULL;
-    
-	return HashTable_Next( hi );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/HashTable.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/HashTable.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,604 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: HashTable.c 2038 2005-4-13 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "HashTable.h"
+#include "PtrMap.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type HashTable_Type = "HashTable";
+#define MAX_ENTRIES 255
+#define SM_HEAP_TABLE_SIZE 256
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+HashTable* _HashTable_New(  HASHTABLE_DEFARGS  )
+{
+	HashTable *self = NULL;
+
+	self = (HashTable*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	return self;
+}
+
+HashTable* HashTable_New(
+			HashTable_dataCopyFunction*		dataCopyFunction,
+			HashTable_dataPrintFunction*	dataPrintFunction,
+			HashTable_dataDeleteFunction*	dataDeleteFunction,
+			KeyType keyType)
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(HashTable);
+	Type                              type = HashTable_Type;
+	Stg_Class_DeleteFunction*      _delete = _HashTable_DeleteFunc;
+	Stg_Class_PrintFunction*        _print = _HashTable_PrintFunc;
+	Stg_Class_CopyFunction*          _copy = _HashTable_CopyFunc;
+
+	
+	HashTable* self;
+	
+	/* General info */
+	self = _HashTable_New(  HASHTABLE_PASSARGS  );
+
+	/* List info */
+	/* At the moment only String keys are supported */
+	/*TODO 
+	 * add a hash function for hashing numeric keys */
+
+	if( keyType == HASHTABLE_STRING_KEY ){
+		self->hashFunction = hashStringFunction;
+	}
+	else if(  keyType == HASHTABLE_POINTER_KEY ){
+		self->hashFunction = hashPtrFunction;
+	}
+
+	self->dataCopyFunction = dataCopyFunction;
+	self->dataPrintFunction = dataPrintFunction;
+	self->dataDeleteFunction = dataDeleteFunction;
+	self->keyType = keyType;
+	
+	/* Virtual functions */
+	HashTable_Init( self );
+	return self;
+}
+
+void _HashTable_Init( HashTable* self ){
+	/* General info */
+	
+	assert( self );
+	_Stg_Class_Init ((Stg_Class*) self);
+	
+	self->max = MAX_ENTRIES;
+	self->entries = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * (self->max+1) );
+	memset( self->entries, 0, sizeof( HashTable_Entry* ) * (self->max+1) );
+
+	/* Dictionary info */
+}
+
+void HashTable_Init( HashTable *self )
+{
+	assert( self );
+	_HashTable_Init (self);
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual Functions
+*/
+void _HashTable_PrintFunc ( void *ht, Stream *stream )
+{
+	HashTable *self = NULL;
+	
+	self = (HashTable*) ht;
+	assert( self );
+	assert( stream );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) self, stream );
+
+	/* general info */
+	Journal_Printf( stream, "HashTable (ptr): (%p)\n", self );
+
+	/* Virtual Info */
+
+	/* HashTable Info */
+	Journal_Printf( stream, "\tEntryCount\t\t - %d\n", self->count );
+	Journal_Printf( stream, "\tHashTable KeyType\t - %s\n", (self->keyType == HASHTABLE_STRING_KEY)?"STRING":"INTEGER" );
+	
+	Journal_Printf( stream, "\tHashTable data\t - \n");
+	if (self->dataPrintFunction)
+		HashTable_ParseTable( self, (HashTable_parseFunction*)self->dataPrintFunction, (void*)stream );
+}
+
+void _HashTable_DeleteFunc( void *ht )
+{
+	HashTable *self = NULL;
+	HashTable_Entry *he = NULL, *heTemp = NULL;
+	Index i = 0;
+
+	self = (HashTable*)ht;
+	assert (self);
+	
+	/* In the case of a ptrHash table at least, it's possible to have keys that hash to 255 - the default max. So,
+	 * need to check that entry for possible deletion. -- PatrickSunter, 5 Jun 2009 */
+	for( i=0; i<self->max+1; i++ ){
+		he = self->entries[i];
+		
+		if(he){
+			while( he ){
+				if( self->dataDeleteFunction ){
+					self->dataDeleteFunction( (void*) he->data );
+				}
+				if( self->keyType == HASHTABLE_POINTER_KEY){
+					/* TODO: anything to be freed here? */
+				}
+				else{
+					Memory_Free( (char*)he->key );
+				}
+				
+				heTemp = he->next;
+				Memory_Free( he ); /** Freeing the Entry without calling the Class_Delete function, because HashTable_Entry does not inherit __Class */
+
+				he = heTemp;
+			}
+		}
+	}
+	Memory_Free( self->entries );
+	_Stg_Class_Delete( self );
+}
+
+void* _HashTable_CopyFunc( const void* source, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	HashTable* self = (HashTable*)source;
+	HashTable* newTable;
+	HashTable_Index* hi;
+	void* key;
+
+	newTable = (HashTable*)_Stg_Class_Copy( self, NULL, deep, nameExt, ptrMap ) ;
+
+	newTable->hashFunction = self->hashFunction;
+	newTable->dataCopyFunction = self->dataCopyFunction;
+	newTable->dataPrintFunction = self->dataPrintFunction;
+	newTable->dataDeleteFunction = self->dataDeleteFunction;
+
+	newTable->count = self->count;
+	newTable->max = self->max;
+	newTable->keyType = self->keyType;
+
+	newTable->entries = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * (self->max+1) );
+	memset( newTable->entries, 0, sizeof( HashTable_Entry* ) * (self->max+1) );
+
+	for ( hi = HashTable_First( self ); hi; hi = HashTable_Next( hi ) ) {
+		const void* dataPtr = PtrMap_Find( ptrMap, hi->curr->data );
+		if ( dataPtr == NULL ) {
+			if ( self->dataCopyFunction ) {
+				/* data copy */
+				dataPtr = self->dataCopyFunction( hi->curr->data, NULL, deep, nameExt, ptrMap );
+			}
+			else {
+				dataPtr = hi->curr->data;
+			}
+		}
+		key = PtrMap_Find( ptrMap, (void*)hi->curr->key );
+		if ( key == NULL ) {
+			/* Assume a const key so just assign */
+			key = (void*)hi->curr->key;
+		}
+			
+		HashTable_InsertEntry( newTable, key, hi->curr->keyLength, dataPtr, hi->curr->dataSize );
+	}
+	
+	return newTable;
+}
+
+static unsigned char hashtab[SM_HEAP_TABLE_SIZE] =
+{
+	161, 71, 77,187, 15,229,  9,176,221,119,239, 21, 85,138,203, 86,
+	102, 65, 80,199,235, 32,140, 96,224, 78,126,127,144,  0, 11,179,
+	64, 30,120, 23,225,226, 33, 50,205,167,130,240,174, 99,206, 73,
+	231,210,189,162, 48, 93,246, 54,213,141,135, 39, 41,192,236,193,
+	157, 88, 95,104,188, 63,133,177,234,110,158,214,238,131,233, 91,
+	125, 82, 94, 79, 66, 92,151, 45,252, 98, 26,183,  7,191,171,106,
+	145,154,251,100,113,  5, 74, 62, 76,124, 14,217,200, 75,115,190,
+	103, 28,198,196,169,219, 37,118,150, 18,152,175, 49,136,  6,142,
+	89, 19,243,254, 47,137, 24,166,180, 10, 40,186,202, 46,184, 67,
+	148,108,181, 81, 25,241, 13,139, 58, 38, 84,253,201, 12,116, 17,
+	195, 22,112, 69,255, 43,147,222,111, 56,194,216,149,244, 42,173,
+	232,220,249,105,207, 51,197,242, 72,211,208, 59,122,230,237,170,
+	165, 44, 68,123,129,245,143,101,  8,209,215,247,185, 57,218, 53,
+	114,121,  3,128,  4,204,212,146,  2,155, 83,250, 87, 29, 31,159,
+	60, 27,107,156,227,182,  1, 61, 36,160,109, 97, 90, 20,168,132,
+	223,248, 70,164, 55,172, 34, 52,163,117, 35,153,134, 16,178,228
+};
+
+/*
+**  PTRHASH -- hash a pointer value
+**
+**Parameters:
+**p -- pointer.
+**
+**Returns:
+**hash value.
+**
+**  ptrhash hashes a pointer value to a uniformly distributed random
+**  number between 0 and 255.
+**
+**  This hash algorithm is based on Peter K. Pearson,
+**  "Fast Hashing of Variable-Length Text Strings",
+**  in Communications of the ACM, June 1990, vol 33 no 6.
+*/
+
+unsigned int hashPtrFunction( const void *p, const unsigned int keyLen )
+{
+	int h;
+	unsigned long n = (unsigned long)p;
+
+	/* NOTE: these #if makes keyLen unused */
+
+#if defined(SYSTEM_SIZEOF_LONG) && SYSTEM_SIZEOF_LONG == 8
+	h = hashtab[n & 0xFF];
+	h = hashtab[h ^ ((n >> 8) & 0xFF)];
+	h = hashtab[h ^ ((n >> 16) & 0xFF)];
+	h = hashtab[h ^ ((n >> 24) & 0xFF)];
+	h = hashtab[h ^ ((n >> 32) & 0xFF)];
+	h = hashtab[h ^ ((n >> 40) & 0xFF)];
+	h = hashtab[h ^ ((n >> 48) & 0xFF)];
+	h = hashtab[h ^ ((n >> 56) & 0xFF)];
+#else
+	/* Else assume 32 bit system. Watch this get invalidated one day =) */
+	h = hashtab[n & 0xFF];
+	h = hashtab[h ^ ((n >> 8) & 0xFF)];
+	h = hashtab[h ^ ((n >> 16) & 0xFF)];
+	h = hashtab[h ^ ((n >> 24) & 0xFF)];
+#endif
+		
+	return h;
+}
+
+unsigned int hashStringFunction( const void *voidKey, const unsigned int keyLen )
+{
+    /*
+     * This is the popular `times 33' hash algorithm which is used by
+     * perl and also appears in Berkeley DB. This is one of the best
+     * known hash functions for strings because it is both computed
+     * very fast and distributes very well.
+     *
+     * The originator may be Dan Bernstein but the code in Berkeley DB
+     * cites Chris Torek as the source. The best citation I have found
+     * is "Chris Torek, Hash function for text in C, Usenet message
+     * <27038 at mimsy.umd.edu> in comp.lang.c , October, 1990." in Rich
+     * Salz's USENIX 1992 paper about INN which can be found at
+     * <http://citeseer.nj.nec.com/salz92internetnews.html>.
+     *
+     * The magic of number 33, i.e. why it works better than many other
+     * constants, prime or not, has never been adequately explained by
+     * anyone. So I try an explanation: if one experimentally tests all
+     * multipliers between 1 and 256 (as I did while writing a low-level
+     * data structure library some time ago) one detects that even
+     * numbers are not useable at all. The remaining 128 odd numbers
+     * (except for the number 1) work more or less all equally well.
+     * They all distribute in an acceptable way and this way fill a hash
+     * table with an average percent of approx. 86%.
+     *
+     * If one compares the chi^2 values of the variants (see
+     * Bob Jenkins ``Hashing Frequently Asked Questions'' at
+     * http://burtleburtle.net/bob/hash/hashfaq.html for a description
+     * of chi^2), the number 33 not even has the best value. But the
+     * number 33 and a few other equally good numbers like 17, 31, 63,
+     * 127 and 129 have nevertheless a great advantage to the remaining
+     * numbers in the large set of possible multipliers: their multiply
+     * operation can be replaced by a faster operation based on just one
+     * shift plus either a single addition or subtraction operation. And
+     * because a hash function has to both distribute good _and_ has to
+     * be very fast to compute, those few numbers should be preferred.
+     *
+     *                  -- Ralf S. Engelschall <rse at engelschall.com>
+     */
+	
+	/*
+	 * The above comment and the hash algorithm has been taken from 
+	 * subversion's hashFunction.
+	 */
+	
+	unsigned int hash = 0;
+	unsigned char *key;
+	unsigned char *p = (unsigned char*) 0;
+	unsigned int i = 0;
+	
+	key = (unsigned char*)voidKey;
+
+	hash = 0;
+	for( p=key, i=keyLen; i; i--, p++ ){
+		hash = hash * 33 + *p;
+	}
+
+	return hash;
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+int HashTable_InsertEntry ( HashTable *ht, const void *voidKey, unsigned int keyLen, const void *data, SizeT dataSize )
+{
+	unsigned int hash = 0;
+	HashTable_Entry *he = NULL, **hep = NULL;
+	unsigned char *key;
+	int count;
+	
+	assert( ht );
+	assert( data );
+	assert( ht->hashFunction );
+
+	key = (unsigned char*) voidKey;
+	
+	if( ht->keyType == HASHTABLE_POINTER_KEY ){
+		hash = ht->hashFunction( voidKey, sizeof( void* )  );
+		
+		count = 0;
+		for (hep = &ht->entries[hash], he = *hep;
+			he; hep = &he->next, he = *hep) {
+		
+			if (he->hash == (unsigned int)hash
+				&& ((void*)he->key == (void*)voidKey)){
+         
+				fprintf( stdout, "trying to enter duplicate keys\n" );
+				return 0;
+			}
+			count++;
+    		}
+	}
+	else{
+		hash = ht->hashFunction( voidKey, keyLen  );
+	
+
+		while( (hash & ht->max) > ht->max - 1 ){
+			expandArray( ht );
+		}
+	
+		count = 0;
+		for (hep = &ht->entries[hash & ht->max], he = *hep;
+			he; hep = &he->next, he = *hep) {
+		
+			if (he->hash == hash
+				&& he->keyLength == keyLen
+				&& memcmp(he->key, key, keyLen) == 0){
+         
+				fprintf( stderr, "trying to enter duplicate keys\n" );
+				return 0;
+			}
+			count++;
+    		}
+	}
+	
+	he = Memory_Alloc( HashTable_Entry , "HashTable_Entry");
+	memset( he, 0, sizeof( HashTable_Entry ) );
+	he->next = NULL;
+	he->hash = hash;
+	
+	if( ht->keyType== HASHTABLE_POINTER_KEY){
+		he->key = (void*)key;
+	}
+	else{
+		he->key = StG_Strdup( (char *)key );
+	}
+	
+	he->keyLength = keyLen;
+
+	he->data = data;
+	he->dataSize = dataSize;
+	ht->count++;
+	*hep = he;
+		
+	/*returning the number of collisions incurred. 0 means no collisions and a new entry
+	 * at that index, 1 means 1 collision, and so on */ 	
+	return count; 
+}
+
+int HashTable_InsertEntryCopyData ( HashTable *ht, const void *voidKey, unsigned int keyLen, void *data, SizeT dataSize ) {
+	void* dataToInsert = data;
+	if ( ht->dataCopyFunction ) {
+		dataToInsert = ht->dataCopyFunction( data, NULL, True, NULL, NULL );
+	}
+	return HashTable_InsertEntry( ht, voidKey, keyLen, dataToInsert, dataSize );
+}
+
+void *HashTable_FindEntryFunction( HashTable *ht, const void *voidKey, unsigned int keyLen )
+{
+	unsigned char *key;
+	unsigned int hash = 0;
+	HashTable_Entry *he = NULL, **hep = NULL;
+	
+	assert( ht );
+	assert( ht->hashFunction );
+
+	if( ht->keyType == HASHTABLE_POINTER_KEY  ){
+		hash = ht->hashFunction( voidKey, sizeof( void* )  );
+		
+		for (hep = &ht->entries[hash], he = *hep;
+			he; hep = &he->next, he = *hep) {
+		
+			if (he->hash == hash
+				&& ((void*)he->key == (void*)voidKey)){
+         
+				break;
+			}
+		}
+	}
+	else{
+		key = (unsigned char*)voidKey;
+		hash = ht->hashFunction( voidKey, keyLen );
+
+		for (hep = &ht->entries[hash & ht->max], he = *hep;
+			he; hep = &he->next, he = *hep) {
+		
+			if (he->hash == hash
+				&& he->keyLength == keyLen
+				&& memcmp(he->key, key, keyLen) == 0){
+         
+				break;
+			}
+	    	}
+	}
+
+	if( he ){
+		return (void*)he->data;
+	}
+	
+	return NULL;
+}
+
+int HashTable_DeleteEntry( HashTable* ht, const void *voidKey, unsigned int keyLen ) {
+	unsigned char*    key;
+	unsigned int      hash = 0;
+	HashTable_Entry*  he   = NULL; 
+	HashTable_Entry** hep  = NULL;
+	
+	assert( ht );
+	assert( ht->hashFunction );
+
+	key = (unsigned char*)voidKey;
+	assert( key );
+	hash = ht->hashFunction( voidKey, keyLen );
+
+	for (hep = &ht->entries[hash & ht->max], he = *hep; he; hep = &he->next, he = *hep) {
+		if ( he->hash == hash && he->keyLength == keyLen && memcmp(he->key, key, keyLen) == 0){
+			break;
+		}
+	}
+
+	if( he ) {
+		*hep = he->next;
+		ht->count--;
+		if( ht->dataDeleteFunction ){
+                  ht->dataDeleteFunction( (void*)(he->data) );
+		}
+		else{
+			/* Leaving the data inside the entry */
+		}
+		
+		Memory_Free( he );
+		return 1;
+	}
+
+	return 0;
+}
+
+int HashTable_ReplaceEntry( HashTable *ht, const void *voidKey, unsigned int keyLen, void *data, SizeT dataSize ) {
+	if ( HashTable_FindEntryFunction( ht, voidKey, keyLen ) ) {
+		HashTable_DeleteEntry( ht, voidKey, keyLen );
+	}
+	return HashTable_InsertEntry( ht, voidKey, keyLen, data, dataSize );
+}
+
+void HashTable_ParseTable( HashTable *ht, HashTable_parseFunction *parseFunction, void *args )
+{
+	HashTable *self = NULL;
+	HashTable_Entry *he = NULL;
+	Index i = 0;
+
+	self = (HashTable*)ht;
+	assert( self );
+	assert( parseFunction );
+	
+	/* In the case of a ptrHash table at least, it's possible to have keys that hash to 255 - the default max. So,
+	 * need to check that entry for possible handling. -- PatrickSunter, 5 Jun 2009 */
+	for( i=0; i<(self->max+1); i++ ){
+		he = self->entries[i];
+		
+		if(he){
+			while( he ){
+				parseFunction( he->data, args );
+				he = he->next;
+			}
+		}
+	}
+}
+
+void expandArray( HashTable *ht )
+{
+	unsigned int newMax = 0;
+	HashTable_Entry **newArray = NULL;
+	HashTable_Index *hi = NULL;
+
+	assert( ht );
+	
+	newMax = ht->max * 2 + 1;
+	newArray = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * newMax );
+	if( !newArray ){
+		Journal_Firewall(0, Journal_Register(ErrorStream_Type,"HashTable"), "Out of memory in '%s'\n", __func__ );
+	}
+	memset( newArray, 0, sizeof( HashTable_Entry* ) * newMax );
+	
+    for (hi = HashTable_First( ht ); hi; hi = HashTable_Next( hi )) {
+        unsigned int i = hi->curr->hash & newMax;
+        hi->curr->next = newArray[i];
+        newArray[i] = hi->curr;
+    }
+	
+	ht->entries = newArray;
+	ht->max = newMax;
+}
+
+HashTable_Index* HashTable_Next( HashTable_Index *hi )
+{
+	assert( hi );
+	
+	hi->curr= hi->next;
+	while (!hi->curr) {
+		if (hi->index > hi->ht->max - 1)
+			return NULL;
+
+		hi->curr= hi->ht->entries[hi->index++];
+	}
+	hi->next = hi->curr->next;
+
+	return hi;
+}
+
+HashTable_Index* HashTable_First( HashTable *ht )
+{
+	HashTable_Index *hi;
+    
+	assert( ht );
+	hi = &ht->iterator;
+
+	hi->ht = ht;
+	hi->index = 0;
+	hi->curr= NULL;
+	hi->next = NULL;
+    
+	return HashTable_Next( hi );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Heap.c
--- a/Base/Container/src/Heap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/** \file
-** <b>Role:</b>
-**	Binary Tree class for objects.
-**
-** <b>Assumptions:</b>
-**	None
-**
-** <b>Comments:</b>
-**	None
-**
-** $Id: Heap.c 2087 2005-2-25 02:28:44Z RaquibulHassan $
-**
-**/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "Heap.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type Heap_Type = "Heap";
-
-_Heap* _Heap_New(  HEAP_DEFARGS  )
-{
-	_Heap *self = NULL;
-
-	self = (_Heap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	assert( heapify );
-	assert( extract );
-	assert( insert );
-	assert( compareFunction );
-	assert( keySwapFunction );
-	assert( keys );
-	assert( extendArray );
-	
-	self->heapify = heapify;
-	self->extract = extract;
-	self->insert = insert;
-	self->keySwap = keySwapFunction;
-	self->compare = compareFunction;
-	self->extendArray = extendArray;
-	self->numArrayElements = numArrayElements;
-	self->keys = keys;
-	self->keyLength = keyLength;
-	
-	_Heap_Init( self );
-	
-	return self;
-}
-
-void _Heap_Init( _Heap* self )
-{
-	assert( self );
-	
-	self->numHeapElements = self->numArrayElements;
-
-	_Heap_BuildHeap( self );
-}
-
-void _Heap_BuildHeap( _Heap *heap )
-{
-	int i = 0;
-	
-	assert( heap );
-	assert( heap->heapify );
-	
-	for( i=heap->numArrayElements/2+1; i>=1; i--  ){
-		heap->heapify( heap, i );
-	}
-}
-
-void _Heap_Heapify( _Heap *heap, int index )
-{
-	
-}
-
-void* _Heap_Extract( _Heap *heap )
-{
-	return NULL;
-}
-
-void _Heap_Insert( _Heap *heap, void* key )
-{
-	
-}
-	
-void _Heap_DeleteFunc ( void *heap )
-{
-	_Heap *self = ( _Heap* ) heap;
-
-	assert( self );
-
-	Memory_Free( self->keys );
-	_Stg_Class_Delete( self );
-}
-	
-void _Heap_PrintFunc ( void *heap, Stream* stream )
-{
-	_Heap *self = (_Heap*)heap;
-	assert( self );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) self, stream );
-
-	/* general info */
-	Journal_Printf( stream, "Heap (ptr): (%p)\n", self );
-	
-	Journal_Printf( stream, "Heap Elements\t%d\n", self->numHeapElements );
-	Journal_Printf( stream, "Array Elements\t%d\n", self->numArrayElements );
-	Journal_Printf( stream, "Key Length    \t%d\n", self->keyLength );
-}
-	
-/*Private functions*/
-
-int _Heap_Parent( _Heap *heap, int i )
-{
-	return i/2;
-}
-
-int _Heap_Left( _Heap *heap, int i )
-{
-	return 2*i;
-}
-
-int _Heap_Right( _Heap *heap, int i )
-{
-	return 2*i+1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Heap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/Heap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,162 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/** \file
+** <b>Role:</b>
+**	Binary Tree class for objects.
+**
+** <b>Assumptions:</b>
+**	None
+**
+** <b>Comments:</b>
+**	None
+**
+** $Id: Heap.c 2087 2005-2-25 02:28:44Z RaquibulHassan $
+**
+**/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "Heap.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type Heap_Type = "Heap";
+
+_Heap* _Heap_New(  HEAP_DEFARGS  )
+{
+	_Heap *self = NULL;
+
+	self = (_Heap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	assert( heapify );
+	assert( extract );
+	assert( insert );
+	assert( compareFunction );
+	assert( keySwapFunction );
+	assert( keys );
+	assert( extendArray );
+	
+	self->heapify = heapify;
+	self->extract = extract;
+	self->insert = insert;
+	self->keySwap = keySwapFunction;
+	self->compare = compareFunction;
+	self->extendArray = extendArray;
+	self->numArrayElements = numArrayElements;
+	self->keys = keys;
+	self->keyLength = keyLength;
+	
+	_Heap_Init( self );
+	
+	return self;
+}
+
+void _Heap_Init( _Heap* self )
+{
+	assert( self );
+	
+	self->numHeapElements = self->numArrayElements;
+
+	_Heap_BuildHeap( self );
+}
+
+void _Heap_BuildHeap( _Heap *heap )
+{
+	int i = 0;
+	
+	assert( heap );
+	assert( heap->heapify );
+	
+	for( i=heap->numArrayElements/2+1; i>=1; i--  ){
+		heap->heapify( heap, i );
+	}
+}
+
+void _Heap_Heapify( _Heap *heap, int index )
+{
+	
+}
+
+void* _Heap_Extract( _Heap *heap )
+{
+	return NULL;
+}
+
+void _Heap_Insert( _Heap *heap, void* key )
+{
+	
+}
+	
+void _Heap_DeleteFunc ( void *heap )
+{
+	_Heap *self = ( _Heap* ) heap;
+
+	assert( self );
+
+	Memory_Free( self->keys );
+	_Stg_Class_Delete( self );
+}
+	
+void _Heap_PrintFunc ( void *heap, Stream* stream )
+{
+	_Heap *self = (_Heap*)heap;
+	assert( self );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) self, stream );
+
+	/* general info */
+	Journal_Printf( stream, "Heap (ptr): (%p)\n", self );
+	
+	Journal_Printf( stream, "Heap Elements\t%d\n", self->numHeapElements );
+	Journal_Printf( stream, "Array Elements\t%d\n", self->numArrayElements );
+	Journal_Printf( stream, "Key Length    \t%d\n", self->keyLength );
+}
+	
+/*Private functions*/
+
+int _Heap_Parent( _Heap *heap, int i )
+{
+	return i/2;
+}
+
+int _Heap_Left( _Heap *heap, int i )
+{
+	return 2*i;
+}
+
+int _Heap_Right( _Heap *heap, int i )
+{
+	return 2*i+1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IArray.c
--- a/Base/Container/src/IArray.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IArray.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "types.h"
-#include "ISet.h"
-#include "IMap.h"
-#include "IArray.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-int IArray_Cmp( const void* l, const void* r );
-void IArray_ZeroAll( IArray* self );
-
-
-void _IArray_Init( void* _self ) {
-   IArray* self = (IArray*)_self;
-
-   _NewClass_Init( self );
-   self->delta = 100;
-   self->maxSize = 0;
-   self->size = 0;
-   self->ptr = NULL;
-   self->own = True;
-}
-
-void _IArray_Destruct( void* self ) {
-   IArray_Clear( self );
-   _NewClass_Destruct( self );
-}
-
-void _IArray_Copy( void* _self, const void* _op ) {
-   IArray* self = (IArray*)_self;
-   const IArray* op = (const IArray*)_op;
-
-   assert( self );
-   self->delta = op->delta;
-   self->maxSize = op->maxSize;
-   self->size = op->size;
-   self->ptr = Class_Array( self, int, self->size );
-   memcpy( self->ptr, op->ptr, sizeof(int) * self->size );
-}
-
-void IArray_SetDelta( void* _self, int delta ) {
-   IArray* self = (IArray*)_self;
-
-   assert( self );
-   self->delta = delta;
-}
-
-void IArray_Resize( void* _self, int size ) {
-   IArray* self = (IArray*)_self;
-
-   assert( self && self->delta );
-   if( !self->own )
-      IArray_ZeroAll( self );
-   self->maxSize = size / self->delta + ((size % self->delta) ? 1 : 0);
-   self->maxSize *= self->delta;
-   self->size = size;
-   self->ptr = Class_Rearray( self, self->ptr, int, self->maxSize );
-}
-
-void IArray_SoftResize( void* _self, int size ) {
-   IArray* self = (IArray*)_self;
-
-   assert( self && self->delta );
-   if( !self->own || size > self->maxSize )
-     IArray_Resize( self, size );
-   else
-     self->size = size;
-}
-
-void IArray_SetProxy( void* _self, int size, int* ptr ) {
-   IArray* self = Class_Cast( _self, IArray );
-
-   if( self->own ) {
-      if( self->ptr )
-	 free( self->ptr );
-      self->own = False;
-   }
-   self->maxSize = size;
-   self->size = size;
-   self->ptr = ptr;
-}
-
-void IArray_Set( void* _self, int nItms, const int* itms ) {
-   IArray* self = (IArray*)_self;
-
-   assert( self && (!nItms || itms) );
-   IArray_Resize( self, nItms );
-   memcpy( self->ptr, itms, nItms * sizeof(int) );
-}
-
-void IArray_Add( void* _self, int nItms, const int* itms ) {
-   IArray* self = (IArray*)_self;
-   int oldSize;
-
-   assert( self && (!nItms || itms) );
-   oldSize = self->size;
-   IArray_Resize( self, oldSize + nItms );
-   memcpy( self->ptr + oldSize, itms, nItms * sizeof(int) );
-}
-
-void IArray_Remove( void* _self, int nItms, const int* locals, IMap* map ) {
-   IArray* self = (IArray*)_self;
-   ISet toRemObj, *toRem = &toRemObj;
-   int* ord, pos;
-   int i_i;
-
-   assert( self && (!nItms || locals) && map );
-   ISet_Construct( toRem );
-   ISet_UseArray( toRem, nItms, locals );
-   ord = Class_Array( self, int, ISet_GetSize( toRem ) );
-   memcpy( ord, locals, nItms * sizeof(int) );
-   qsort( ord, nItms, sizeof(int), IArray_Cmp );
-   IMap_Clear( map );
-   IMap_SetMaxSize( map, nItms );
-   for( i_i = 0, pos = self->size - 1; 
-	i_i < nItms && pos > ord[i_i];
-	i_i++, pos-- )
-   {
-      while( ISet_Has( toRem, pos ) && pos > ord[i_i] )
-	 pos--;
-      if( pos <= ord[i_i] )
-	 break;
-      self->ptr[ord[i_i]] = self->ptr[pos];
-      IMap_Insert( map, pos, ord[i_i] );
-   }
-   if( IMap_GetSize( map ) < nItms )
-      IMap_SetMaxSize( map, IMap_GetSize( map ) );
-   ISet_Destruct( toRem );
-   Class_Free( self, ord );
-
-   IArray_Resize( self, self->size - nItms );
-}
-
-void IArray_Append( void* _self, int itm ) {
-   IArray* self = (IArray*)_self;
-
-   assert( self );
-   if( self->size == self->maxSize )
-      IArray_Resize( self, self->size + 1 );
-   else
-      self->size++;
-   self->ptr[self->size - 1] = itm;
-}
-
-void IArray_Push( void* _self, int itm ) {
-   IArray* self = Class_Cast( _self, IArray );
-
-   if( self->size == self->maxSize )
-      IArray_Resize( self, self->size + 1 );
-   else
-      self->size++;
-   self->ptr[self->size - 1] = itm;
-}
-
-void IArray_Clear( void* self ) {
-   IArray_Resize( self, 0 );
-}
-
-int IArray_GetSize( const void* self ) {
-   assert( self );
-   return ((IArray*)self)->size;
-}
-
-int* IArray_GetPtr( const void* self ) {
-   assert( self );
-   return ((IArray*)self)->ptr;
-}
-
-void IArray_GetArray( const void* self, int* size, const int** ptr ) {
-   assert( self );
-   if( size )
-      *size = ((IArray*)self)->size;
-   *ptr = ((IArray*)self)->ptr;
-}
-
-int IArray_Cmp( const void* l, const void* r ) {
-   assert( *(int*)l != *(int*)r );
-   return (*(int*)l > *(int*)r) ? 1 : -1;
-}
-
-void IArray_ZeroAll( IArray* self ) {
-   self->maxSize = 0;
-   self->size = 0;
-   self->ptr = NULL;
-   self->own = True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IArray.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/IArray.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,222 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IArray.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "types.h"
+#include "ISet.h"
+#include "IMap.h"
+#include "IArray.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+int IArray_Cmp( const void* l, const void* r );
+void IArray_ZeroAll( IArray* self );
+
+
+void _IArray_Init( void* _self ) {
+   IArray* self = (IArray*)_self;
+
+   _NewClass_Init( self );
+   self->delta = 100;
+   self->maxSize = 0;
+   self->size = 0;
+   self->ptr = NULL;
+   self->own = True;
+}
+
+void _IArray_Destruct( void* self ) {
+   IArray_Clear( self );
+   _NewClass_Destruct( self );
+}
+
+void _IArray_Copy( void* _self, const void* _op ) {
+   IArray* self = (IArray*)_self;
+   const IArray* op = (const IArray*)_op;
+
+   assert( self );
+   self->delta = op->delta;
+   self->maxSize = op->maxSize;
+   self->size = op->size;
+   self->ptr = Class_Array( self, int, self->size );
+   memcpy( self->ptr, op->ptr, sizeof(int) * self->size );
+}
+
+void IArray_SetDelta( void* _self, int delta ) {
+   IArray* self = (IArray*)_self;
+
+   assert( self );
+   self->delta = delta;
+}
+
+void IArray_Resize( void* _self, int size ) {
+   IArray* self = (IArray*)_self;
+
+   assert( self && self->delta );
+   if( !self->own )
+      IArray_ZeroAll( self );
+   self->maxSize = size / self->delta + ((size % self->delta) ? 1 : 0);
+   self->maxSize *= self->delta;
+   self->size = size;
+   self->ptr = Class_Rearray( self, self->ptr, int, self->maxSize );
+}
+
+void IArray_SoftResize( void* _self, int size ) {
+   IArray* self = (IArray*)_self;
+
+   assert( self && self->delta );
+   if( !self->own || size > self->maxSize )
+     IArray_Resize( self, size );
+   else
+     self->size = size;
+}
+
+void IArray_SetProxy( void* _self, int size, int* ptr ) {
+   IArray* self = Class_Cast( _self, IArray );
+
+   if( self->own ) {
+      if( self->ptr )
+	 free( self->ptr );
+      self->own = False;
+   }
+   self->maxSize = size;
+   self->size = size;
+   self->ptr = ptr;
+}
+
+void IArray_Set( void* _self, int nItms, const int* itms ) {
+   IArray* self = (IArray*)_self;
+
+   assert( self && (!nItms || itms) );
+   IArray_Resize( self, nItms );
+   memcpy( self->ptr, itms, nItms * sizeof(int) );
+}
+
+void IArray_Add( void* _self, int nItms, const int* itms ) {
+   IArray* self = (IArray*)_self;
+   int oldSize;
+
+   assert( self && (!nItms || itms) );
+   oldSize = self->size;
+   IArray_Resize( self, oldSize + nItms );
+   memcpy( self->ptr + oldSize, itms, nItms * sizeof(int) );
+}
+
+void IArray_Remove( void* _self, int nItms, const int* locals, IMap* map ) {
+   IArray* self = (IArray*)_self;
+   ISet toRemObj, *toRem = &toRemObj;
+   int* ord, pos;
+   int i_i;
+
+   assert( self && (!nItms || locals) && map );
+   ISet_Construct( toRem );
+   ISet_UseArray( toRem, nItms, locals );
+   ord = Class_Array( self, int, ISet_GetSize( toRem ) );
+   memcpy( ord, locals, nItms * sizeof(int) );
+   qsort( ord, nItms, sizeof(int), IArray_Cmp );
+   IMap_Clear( map );
+   IMap_SetMaxSize( map, nItms );
+   for( i_i = 0, pos = self->size - 1; 
+	i_i < nItms && pos > ord[i_i];
+	i_i++, pos-- )
+   {
+      while( ISet_Has( toRem, pos ) && pos > ord[i_i] )
+	 pos--;
+      if( pos <= ord[i_i] )
+	 break;
+      self->ptr[ord[i_i]] = self->ptr[pos];
+      IMap_Insert( map, pos, ord[i_i] );
+   }
+   if( IMap_GetSize( map ) < nItms )
+      IMap_SetMaxSize( map, IMap_GetSize( map ) );
+   ISet_Destruct( toRem );
+   Class_Free( self, ord );
+
+   IArray_Resize( self, self->size - nItms );
+}
+
+void IArray_Append( void* _self, int itm ) {
+   IArray* self = (IArray*)_self;
+
+   assert( self );
+   if( self->size == self->maxSize )
+      IArray_Resize( self, self->size + 1 );
+   else
+      self->size++;
+   self->ptr[self->size - 1] = itm;
+}
+
+void IArray_Push( void* _self, int itm ) {
+   IArray* self = Class_Cast( _self, IArray );
+
+   if( self->size == self->maxSize )
+      IArray_Resize( self, self->size + 1 );
+   else
+      self->size++;
+   self->ptr[self->size - 1] = itm;
+}
+
+void IArray_Clear( void* self ) {
+   IArray_Resize( self, 0 );
+}
+
+int IArray_GetSize( const void* self ) {
+   assert( self );
+   return ((IArray*)self)->size;
+}
+
+int* IArray_GetPtr( const void* self ) {
+   assert( self );
+   return ((IArray*)self)->ptr;
+}
+
+void IArray_GetArray( const void* self, int* size, const int** ptr ) {
+   assert( self );
+   if( size )
+      *size = ((IArray*)self)->size;
+   *ptr = ((IArray*)self)->ptr;
+}
+
+int IArray_Cmp( const void* l, const void* r ) {
+   assert( *(int*)l != *(int*)r );
+   return (*(int*)l > *(int*)r) ? 1 : -1;
+}
+
+void IArray_ZeroAll( IArray* self ) {
+   self->maxSize = 0;
+   self->size = 0;
+   self->ptr = NULL;
+   self->own = True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IMap.c
--- a/Base/Container/src/IMap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,323 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IMap.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "types.h"
-#include "Iter.h"
-#include "IMapIter.h"
-#include "IMap.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-const double IMap_TableFactor = 1.18;
-
-
-void _IMap_Init( void* _self ) {
-   IMap* self = (IMap*)_self;
-
-   _NewClass_Init( self );
-   self->maxSize = 0;
-   self->curSize = 0;
-   self->tblSize = 0;
-   self->tbl = NULL;
-   self->used = NULL;
-   IMap_SetMaxSize( self, 0 );
-}
-
-void _IMap_Destruct( void* self ) {
-   IMap_Clear( self );
-   Class_Free( self, ((IMap*)self)->tbl );
-   Class_Free( self, ((IMap*)self)->used );
-   _NewClass_Destruct( self );
-}
-
-void _IMap_Copy( void* _self, const void* _op ) {
-   IMap* self = (IMap*)_self;
-   const IMap* op = (const IMap*)_op;
-   IMapIter iter;
-
-   pcu_assert( self && op );
-   IMap_Clear( self );
-   IMap_SetMaxSize( self, op->maxSize );
-   IMapIter_Construct( &iter );
-   for( IMap_First( op, &iter ); Iter_IsValid( &iter ); IMapIter_Next( &iter ) )
-      IMap_Insert( self, IMapIter_GetKey( &iter ), IMapIter_GetValue( &iter ) );
-   NewClass_Destruct( &iter );
-}
-
-void IMap_SetMaxSize( void* _self, int maxSize ) {
-   IMap* self = (IMap*)_self;
-   int nOldItms, *keys, *vals;
-   IMapIter iterObj, *iter = &iterObj;
-   IMapItem* itm;
-   int i_i;
-
-   pcu_assert( self );
-   nOldItms = self->curSize;
-   keys = Class_Array( self, int, self->curSize );
-   vals = Class_Array( self, int, self->curSize );
-   IMapIter_Construct( iter );
-   for( i_i = 0, IMap_First( self, iter );
-	Iter_IsValid( iter );
-	i_i++, IMapIter_Next( iter ) )
-   {
-      keys[i_i] = IMapIter_GetKey( iter );
-      vals[i_i] = IMapIter_GetValue( iter );
-   }
-   NewClass_Destruct( iter );
-
-   IMap_Clear( self );
-   self->maxSize = maxSize;
-   self->curSize = 0;
-   self->tblSize = (int)((double)maxSize * IMap_TableFactor);
-   self->tblSize += (self->tblSize % 2) ? 0 : 1;
-   self->tbl = Class_Rearray( self, self->tbl, IMapItem, self->tblSize );
-   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
-      itm = self->tbl + i_i;
-      itm->key = 0;
-      itm->val = 0;
-      itm->next = NULL;
-   }
-   self->used = Class_Rearray( self, self->used, Bool, self->tblSize );
-   memset( self->used, 0, self->tblSize* sizeof(Bool) );
-
-   for( i_i = 0; i_i < nOldItms; i_i++ )
-      IMap_Insert( self, keys[i_i], vals[i_i] );
-   Class_Free( self, keys );
-   Class_Free( self, vals );
-}
-
-void IMap_Insert( void* _self, int key, int val ) {
-   IMap* self = (IMap*)_self;
-   IMapItem *itm, *cur;
-   int ind;
-
-   pcu_assert( self );
-   ind = IMap_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   itm = self->tbl + ind;
-   if( !self->used[ind] ) {
-      itm->key = key;
-      itm->val = val;
-      itm->next = NULL;
-      self->used[ind] = True;
-   }
-   else {
-#ifndef NDEBUG
-      cur = itm;
-      do {
-	 pcu_assert( cur->key != key );
-	 cur = cur->next;
-      } while( cur );
-#endif
-      cur = itm->next;
-      itm->next = Class_Alloc( self, IMapItem );
-      itm->next->key = key;
-      itm->next->val = val;
-      itm->next->next = cur;
-   }
-   insist( ++self->curSize, <= self->maxSize );
-}
-
-void IMap_SetValue( void* _self, int key, int val ) {
-   IMap* self = (IMap*)_self;
-   IMapItem *itm;
-   int ind;
-
-   pcu_assert( self );
-   ind = IMap_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   pcu_assert( self->used[ind] );
-   itm = self->tbl + ind;
-   do {
-      if( itm->key == key )
-	 break;
-      itm = itm->next;
-   } while( itm );
-   pcu_assert( itm );
-   itm->val = val;
-}
-
-void IMap_Remove( void* _self, int key ) {
-   IMap* self = (IMap*)_self;
-   IMapItem *itm, *prev, *toDel;
-   int ind;
-
-   pcu_assert( self );
-   ind = IMap_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   pcu_assert( self->used[ind] );
-   itm = self->tbl + ind;
-   if( itm->key == key ) {
-      toDel = itm->next;
-      if( toDel ) {
-	 itm->key = toDel->key;
-	 itm->val = toDel->val;
-	 itm->next = toDel->next;
-      }
-      else
-	 self->used[ind] = False;
-   }
-   else {
-      prev = itm;
-      toDel = itm->next;
-      while( toDel ) {
-	 if( toDel->key == key ) {
-	    prev->next = toDel->next;
-	    break;
-	 }
-	 prev = toDel;
-	 toDel = toDel->next;
-      }
-      pcu_assert( toDel );
-   }
-   if( toDel )
-      Class_Free( self, toDel );
-   self->curSize--;
-}
-
-void IMap_Clear( void* _self ) {
-   IMap* self = (IMap*)_self;
-   IMapItem *itm, *cur, *nxt;
-   int i_i;
-
-   pcu_assert( self );
-   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
-      self->used[i_i] = False;
-      itm = self->tbl + i_i;
-      cur = itm->next;
-      while( cur ) {
-	 nxt = cur->next;
-	 Class_Free( self, cur );
-	 cur = nxt;
-      }
-      itm->next = NULL;
-   }
-   self->curSize = 0;
-}
-
-int IMap_GetSize( const void* self ) {
-   pcu_assert( self );
-   return ((IMap*)self)->curSize;
-}
-
-int IMap_GetMaxSize( const void* self ) {
-   pcu_assert( self );
-   return ((IMap*)self)->maxSize;
-}
-
-int IMap_Map( const void* _self, int key ) {
-   const IMap* self = (const IMap*)_self;
-   IMapItem* itm;
-   int ind;
-
-   pcu_assert( self );
-   ind = IMap_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   pcu_assert( self->used[ind] );
-   itm = self->tbl + ind;
-   do {
-      if( itm->key == key )
-	 break;
-      itm = itm->next;
-   } while( itm );
-   pcu_assert( itm );
-   return itm->val;
-}
-
-Bool IMap_TryMap( const void* _self, int key, int* val ) {
-   const IMap* self = (const IMap*)_self;
-   IMapItem* itm;
-   int ind;
-
-   pcu_assert( self && val );
-   ind = IMap_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   if( !self->used[ind] )
-      return False;
-   itm = self->tbl + ind;
-   do {
-      if( itm->key == key )
-	 break;
-      itm = itm->next;
-   } while( itm );
-   if( !itm )
-      return False;
-   *val = itm->val;
-   return True;
-}
-
-Bool IMap_Has( const void* _self, int key ) {
-   const IMap* self = (const IMap*)_self;
-   IMapItem* itm;
-   int ind;
-
-   pcu_assert( self );
-   ind = IMap_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   if( !self->used[ind] )
-      return False;
-   itm = self->tbl + ind;
-   if( itm->key != key ) {
-      while( (itm = itm->next) ) {
-	 if( itm->key == key )
-	    break;
-      }
-   }
-   return itm ? True : False;
-}
-
-int IMap_Hash( const void* self, int key ) {
-   return key % ((IMap*)self)->tblSize;
-}
-
-void IMap_First( const void* _self, IMapIter* iter ) {
-   const IMap* self = (IMap*)_self;
-   int i_i;
-
-   pcu_assert( self && iter );
-   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
-      if( self->used[i_i] ) {
-	 iter->imap = (IMap*)self;
-	 iter->tblInd = i_i;
-	 iter->cur = self->tbl + i_i;
-	 iter->valid = True;
-	 return;
-      }
-   }
-   iter->valid = False;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/IMap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,323 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IMap.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "types.h"
+#include "Iter.h"
+#include "IMapIter.h"
+#include "IMap.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+const double IMap_TableFactor = 1.18;
+
+
+void _IMap_Init( void* _self ) {
+   IMap* self = (IMap*)_self;
+
+   _NewClass_Init( self );
+   self->maxSize = 0;
+   self->curSize = 0;
+   self->tblSize = 0;
+   self->tbl = NULL;
+   self->used = NULL;
+   IMap_SetMaxSize( self, 0 );
+}
+
+void _IMap_Destruct( void* self ) {
+   IMap_Clear( self );
+   Class_Free( self, ((IMap*)self)->tbl );
+   Class_Free( self, ((IMap*)self)->used );
+   _NewClass_Destruct( self );
+}
+
+void _IMap_Copy( void* _self, const void* _op ) {
+   IMap* self = (IMap*)_self;
+   const IMap* op = (const IMap*)_op;
+   IMapIter iter;
+
+   pcu_assert( self && op );
+   IMap_Clear( self );
+   IMap_SetMaxSize( self, op->maxSize );
+   IMapIter_Construct( &iter );
+   for( IMap_First( op, &iter ); Iter_IsValid( &iter ); IMapIter_Next( &iter ) )
+      IMap_Insert( self, IMapIter_GetKey( &iter ), IMapIter_GetValue( &iter ) );
+   NewClass_Destruct( &iter );
+}
+
+void IMap_SetMaxSize( void* _self, int maxSize ) {
+   IMap* self = (IMap*)_self;
+   int nOldItms, *keys, *vals;
+   IMapIter iterObj, *iter = &iterObj;
+   IMapItem* itm;
+   int i_i;
+
+   pcu_assert( self );
+   nOldItms = self->curSize;
+   keys = Class_Array( self, int, self->curSize );
+   vals = Class_Array( self, int, self->curSize );
+   IMapIter_Construct( iter );
+   for( i_i = 0, IMap_First( self, iter );
+	Iter_IsValid( iter );
+	i_i++, IMapIter_Next( iter ) )
+   {
+      keys[i_i] = IMapIter_GetKey( iter );
+      vals[i_i] = IMapIter_GetValue( iter );
+   }
+   NewClass_Destruct( iter );
+
+   IMap_Clear( self );
+   self->maxSize = maxSize;
+   self->curSize = 0;
+   self->tblSize = (int)((double)maxSize * IMap_TableFactor);
+   self->tblSize += (self->tblSize % 2) ? 0 : 1;
+   self->tbl = Class_Rearray( self, self->tbl, IMapItem, self->tblSize );
+   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
+      itm = self->tbl + i_i;
+      itm->key = 0;
+      itm->val = 0;
+      itm->next = NULL;
+   }
+   self->used = Class_Rearray( self, self->used, Bool, self->tblSize );
+   memset( self->used, 0, self->tblSize* sizeof(Bool) );
+
+   for( i_i = 0; i_i < nOldItms; i_i++ )
+      IMap_Insert( self, keys[i_i], vals[i_i] );
+   Class_Free( self, keys );
+   Class_Free( self, vals );
+}
+
+void IMap_Insert( void* _self, int key, int val ) {
+   IMap* self = (IMap*)_self;
+   IMapItem *itm, *cur;
+   int ind;
+
+   pcu_assert( self );
+   ind = IMap_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   itm = self->tbl + ind;
+   if( !self->used[ind] ) {
+      itm->key = key;
+      itm->val = val;
+      itm->next = NULL;
+      self->used[ind] = True;
+   }
+   else {
+#ifndef NDEBUG
+      cur = itm;
+      do {
+	 pcu_assert( cur->key != key );
+	 cur = cur->next;
+      } while( cur );
+#endif
+      cur = itm->next;
+      itm->next = Class_Alloc( self, IMapItem );
+      itm->next->key = key;
+      itm->next->val = val;
+      itm->next->next = cur;
+   }
+   insist( ++self->curSize, <= self->maxSize );
+}
+
+void IMap_SetValue( void* _self, int key, int val ) {
+   IMap* self = (IMap*)_self;
+   IMapItem *itm;
+   int ind;
+
+   pcu_assert( self );
+   ind = IMap_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   pcu_assert( self->used[ind] );
+   itm = self->tbl + ind;
+   do {
+      if( itm->key == key )
+	 break;
+      itm = itm->next;
+   } while( itm );
+   pcu_assert( itm );
+   itm->val = val;
+}
+
+void IMap_Remove( void* _self, int key ) {
+   IMap* self = (IMap*)_self;
+   IMapItem *itm, *prev, *toDel;
+   int ind;
+
+   pcu_assert( self );
+   ind = IMap_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   pcu_assert( self->used[ind] );
+   itm = self->tbl + ind;
+   if( itm->key == key ) {
+      toDel = itm->next;
+      if( toDel ) {
+	 itm->key = toDel->key;
+	 itm->val = toDel->val;
+	 itm->next = toDel->next;
+      }
+      else
+	 self->used[ind] = False;
+   }
+   else {
+      prev = itm;
+      toDel = itm->next;
+      while( toDel ) {
+	 if( toDel->key == key ) {
+	    prev->next = toDel->next;
+	    break;
+	 }
+	 prev = toDel;
+	 toDel = toDel->next;
+      }
+      pcu_assert( toDel );
+   }
+   if( toDel )
+      Class_Free( self, toDel );
+   self->curSize--;
+}
+
+void IMap_Clear( void* _self ) {
+   IMap* self = (IMap*)_self;
+   IMapItem *itm, *cur, *nxt;
+   int i_i;
+
+   pcu_assert( self );
+   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
+      self->used[i_i] = False;
+      itm = self->tbl + i_i;
+      cur = itm->next;
+      while( cur ) {
+	 nxt = cur->next;
+	 Class_Free( self, cur );
+	 cur = nxt;
+      }
+      itm->next = NULL;
+   }
+   self->curSize = 0;
+}
+
+int IMap_GetSize( const void* self ) {
+   pcu_assert( self );
+   return ((IMap*)self)->curSize;
+}
+
+int IMap_GetMaxSize( const void* self ) {
+   pcu_assert( self );
+   return ((IMap*)self)->maxSize;
+}
+
+int IMap_Map( const void* _self, int key ) {
+   const IMap* self = (const IMap*)_self;
+   IMapItem* itm;
+   int ind;
+
+   pcu_assert( self );
+   ind = IMap_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   pcu_assert( self->used[ind] );
+   itm = self->tbl + ind;
+   do {
+      if( itm->key == key )
+	 break;
+      itm = itm->next;
+   } while( itm );
+   pcu_assert( itm );
+   return itm->val;
+}
+
+Bool IMap_TryMap( const void* _self, int key, int* val ) {
+   const IMap* self = (const IMap*)_self;
+   IMapItem* itm;
+   int ind;
+
+   pcu_assert( self && val );
+   ind = IMap_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   if( !self->used[ind] )
+      return False;
+   itm = self->tbl + ind;
+   do {
+      if( itm->key == key )
+	 break;
+      itm = itm->next;
+   } while( itm );
+   if( !itm )
+      return False;
+   *val = itm->val;
+   return True;
+}
+
+Bool IMap_Has( const void* _self, int key ) {
+   const IMap* self = (const IMap*)_self;
+   IMapItem* itm;
+   int ind;
+
+   pcu_assert( self );
+   ind = IMap_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   if( !self->used[ind] )
+      return False;
+   itm = self->tbl + ind;
+   if( itm->key != key ) {
+      while( (itm = itm->next) ) {
+	 if( itm->key == key )
+	    break;
+      }
+   }
+   return itm ? True : False;
+}
+
+int IMap_Hash( const void* self, int key ) {
+   return key % ((IMap*)self)->tblSize;
+}
+
+void IMap_First( const void* _self, IMapIter* iter ) {
+   const IMap* self = (IMap*)_self;
+   int i_i;
+
+   pcu_assert( self && iter );
+   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
+      if( self->used[i_i] ) {
+	 iter->imap = (IMap*)self;
+	 iter->tblInd = i_i;
+	 iter->cur = self->tbl + i_i;
+	 iter->valid = True;
+	 return;
+      }
+   }
+   iter->valid = False;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IMapIter.c
--- a/Base/Container/src/IMapIter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IMapIter.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <assert.h>
-#include "Base/Foundation/Foundation.h"
-#include "types.h"
-#include "Iter.h"
-#include "IMap.h"
-#include "IMapIter.h"
-#include "Base/Foundation/ClassDef.h"
-
-
-void _IMapIter_Init( void* _self ) {
-   IMapIter* self = (IMapIter*)_self;
-
-   _Iter_Init( self );
-   self->imap = NULL;
-   self->tblInd = 0;
-   self->cur = NULL;
-}
-
-void _IMapIter_Copy( void* _self, const void* _op ) {
-   IMapIter* self = (IMapIter*)_self;
-   const IMapIter* op = (const IMapIter*)_op;
-
-   _Iter_Copy( self, op );
-   self->imap = op->imap;
-   self->tblInd = op->tblInd;
-   self->cur = op->cur;
-}
-
-void _IMapIter_Next( void* _self ) {
-   IMapIter* self = (IMapIter*)_self;
-   int i_i;
-
-   assert( self );
-   assert( self->tblInd < self->imap->tblSize && 
-	   self->imap->used[self->tblInd] );
-   assert( self->cur );
-   assert( self->valid );
-   if( !self->cur->next ) {
-      for( i_i = self->tblInd + 1; i_i < self->imap->tblSize; i_i++ ) {
-	 if( self->imap->used[i_i] )
-	    break;
-      }
-      if( i_i < self->imap->tblSize ) {
-	self->tblInd = i_i;
-	self->cur = self->imap->tbl + i_i;
-      }
-      else
-	self->valid = False;
-   }
-   else
-      self->cur = self->cur->next;
-}
-
-int IMapIter_GetKey( const void* self ) {
-   assert( self );
-   assert( ((IMapIter*)self)->valid && ((IMapIter*)self)->cur );
-   return ((IMapIter*)self)->cur->key;
-}
-
-int IMapIter_GetValue( const void* self ) {
-   assert( self );
-   assert( ((IMapIter*)self)->valid && ((IMapIter*)self)->cur );
-   return ((IMapIter*)self)->cur->val;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IMapIter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/IMapIter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,98 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IMapIter.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <assert.h>
+#include "Base/Foundation/Foundation.h"
+#include "types.h"
+#include "Iter.h"
+#include "IMap.h"
+#include "IMapIter.h"
+#include "Base/Foundation/ClassDef.h"
+
+
+void _IMapIter_Init( void* _self ) {
+   IMapIter* self = (IMapIter*)_self;
+
+   _Iter_Init( self );
+   self->imap = NULL;
+   self->tblInd = 0;
+   self->cur = NULL;
+}
+
+void _IMapIter_Copy( void* _self, const void* _op ) {
+   IMapIter* self = (IMapIter*)_self;
+   const IMapIter* op = (const IMapIter*)_op;
+
+   _Iter_Copy( self, op );
+   self->imap = op->imap;
+   self->tblInd = op->tblInd;
+   self->cur = op->cur;
+}
+
+void _IMapIter_Next( void* _self ) {
+   IMapIter* self = (IMapIter*)_self;
+   int i_i;
+
+   assert( self );
+   assert( self->tblInd < self->imap->tblSize && 
+	   self->imap->used[self->tblInd] );
+   assert( self->cur );
+   assert( self->valid );
+   if( !self->cur->next ) {
+      for( i_i = self->tblInd + 1; i_i < self->imap->tblSize; i_i++ ) {
+	 if( self->imap->used[i_i] )
+	    break;
+      }
+      if( i_i < self->imap->tblSize ) {
+	self->tblInd = i_i;
+	self->cur = self->imap->tbl + i_i;
+      }
+      else
+	self->valid = False;
+   }
+   else
+      self->cur = self->cur->next;
+}
+
+int IMapIter_GetKey( const void* self ) {
+   assert( self );
+   assert( ((IMapIter*)self)->valid && ((IMapIter*)self)->cur );
+   return ((IMapIter*)self)->cur->key;
+}
+
+int IMapIter_GetValue( const void* self ) {
+   assert( self );
+   assert( ((IMapIter*)self)->valid && ((IMapIter*)self)->cur );
+   return ((IMapIter*)self)->cur->val;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/ISet.c
--- a/Base/Container/src/ISet.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,429 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ISet.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "types.h"
-#include "IArray.h"
-#include "Iter.h"
-#include "ISetIter.h"
-#include "ISet.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-const double ISet_TableFactor = 1.18;
-
-
-void _ISet_Init( void* _self ) {
-   ISet* self = (ISet*)_self;
-
-   _NewClass_Init( self );
-   self->maxSize = 0;
-   self->curSize = 0;
-   self->tblSize = 0;
-   self->tbl = NULL;
-   self->used = NULL;
-   ISet_SetMaxSize( self, 0 );
-}
-
-void _ISet_Destruct( void* self ) {
-   ISet_Clear( self );
-   Class_Free( self, ((ISet*)self)->tbl );
-   Class_Free( self, ((ISet*)self)->used );
-   _NewClass_Destruct( self );
-}
-
-void _ISet_Copy( void* _self, const void* _op ) {
-   ISet* self = (ISet*)_self;
-   const ISet* op = (const ISet*)_op;
-   ISetIter iterObj, *iter = &iterObj;
-
-   pcu_assert( self && op );
-   ISet_Clear( self );
-   ISet_SetMaxSize( self, op->maxSize );
-   ISetIter_Construct( iter );
-   for( ISet_First( op, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) )
-      ISet_Insert( self, ISetIter_GetKey( iter ) );
-   NewClass_Destruct( iter );
-}
-
-void ISet_UseArray( void* _self, int size, const int* array ) {
-   ISet* self = (ISet*)_self;
-   int i_i;
-
-   ISet_Clear( self );
-   ISet_SetMaxSize( self, size );
-   for( i_i = 0; i_i < size; i_i++ )
-      ISet_Insert( self, array[i_i] );
-}
-
-void ISet_SetMaxSize( void* _self, int maxSize ) {
-   ISet* self = (ISet*)_self;
-   int nOldItms, *keys;
-   ISetItem* itm;
-   int i_i;
-
-   pcu_assert( self );
-   nOldItms = self->curSize;
-   keys = Class_Array( self, int, self->curSize );
-   ISet_GetArray( self, keys );
-
-   ISet_Clear( self );
-   self->maxSize = maxSize;
-   self->curSize = 0;
-   self->tblSize = (int)((double)maxSize * ISet_TableFactor);
-   self->tblSize += (self->tblSize % 2) ? 0 : 1;
-   self->tbl = Class_Rearray( self, self->tbl, ISetItem, self->tblSize );
-   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
-      itm = self->tbl + i_i;
-      itm->key = 0;
-      itm->next = NULL;
-   }
-   self->used = Class_Rearray( self, self->used, Bool, self->tblSize );
-   memset( self->used, 0, self->tblSize* sizeof(Bool) );
-
-   for( i_i = 0; i_i < nOldItms; i_i++ )
-      ISet_Insert( self, keys[i_i] );
-   Class_Free( self, keys );
-}
-
-void ISet_Insert( void* _self, int key ) {
-   ISet* self = (ISet*)_self;
-   ISetItem *itm, *cur;
-   int ind;
-
-   pcu_assert( self );
-   ind = ISet_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   itm = self->tbl + ind;
-   if( !self->used[ind] ) {
-      itm->key = key;
-      itm->next = NULL;
-      self->used[ind] = True;
-   }
-   else {
-#ifndef NDEBUG
-      cur = itm;
-      do {
-	 if( cur->key == key ) {
-	    pcu_assert( cur->key != key );
-	 }
-	 cur = cur->next;
-      } while( cur );
-#endif
-      cur = itm->next;
-      itm->next = Class_Alloc( self, ISetItem );
-      itm->next->key = key;
-      itm->next->next = cur;
-   }
-   insist( ++self->curSize, <= self->maxSize );
-}
-
-Bool ISet_TryInsert( void* _self, int key ) {
-   ISet* self = (ISet*)_self;
-   ISetItem *itm, *cur;
-   int ind;
-
-   pcu_assert( self );
-   ind = ISet_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   itm = self->tbl + ind;
-   if( !self->used[ind] ) {
-      itm->key = key;
-      itm->next = NULL;
-      self->used[ind] = True;
-   }
-   else {
-      cur = itm;
-      do {
-	 if( cur->key == key )
-	    return False;
-	 cur = cur->next;
-      } while( cur );
-      cur = itm->next;
-      itm->next = Class_Alloc( self, ISetItem );
-      itm->next->key = key;
-      itm->next->next = cur;
-   }
-   insist( ++self->curSize, <= self->maxSize );
-   return True;
-}
-
-void ISet_Remove( void* _self, int key ) {
-   ISet* self = (ISet*)_self;
-   ISetItem *itm, *prev, *toDel;
-   int ind;
-
-   pcu_assert( self );
-   ind = ISet_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   pcu_assert( self->used[ind] );
-   itm = self->tbl + ind;
-   if( itm->key == key ) {
-      toDel = itm->next;
-      if( toDel ) {
-	 itm->key = toDel->key;
-	 itm->next = toDel->next;
-      }
-      else
-	 self->used[ind] = False;
-   }
-   else {
-      prev = itm;
-      toDel = itm->next;
-      while( toDel ) {
-	 if( toDel->key == key ) {
-	    prev->next = toDel->next;
-	    break;
-	 }
-	 prev = toDel;
-	 toDel = toDel->next;
-      }
-      pcu_assert( toDel );
-   }
-   if( toDel )
-      Class_Free( self, toDel );
-   self->curSize--;
-}
-
-Bool ISet_TryRemove( void* _self, int key ) {
-   ISet* self = (ISet*)_self;
-   ISetItem *itm, *prev, *toDel;
-   int ind;
-
-   pcu_assert( self );
-   ind = ISet_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   if( !self->used[ind] )
-      return False;
-   itm = self->tbl + ind;
-   if( itm->key == key ) {
-      toDel = itm->next;
-      if( toDel ) {
-	 itm->key = toDel->key;
-	 itm->next = toDel->next;
-      }
-      else
-	 self->used[ind] = False;
-   }
-   else {
-      prev = itm;
-      toDel = itm->next;
-      while( toDel ) {
-	 if( toDel->key == key ) {
-	    prev->next = toDel->next;
-	    break;
-	 }
-	 prev = toDel;
-	 toDel = toDel->next;
-      }
-      if( !toDel )
-	 return False;
-   }
-   if( toDel )
-      Class_Free( self, toDel );
-   self->curSize--;
-   return True;
-}
-
-void ISet_Clear( void* _self ) {
-   ISet* self = (ISet*)_self;
-   ISetItem *itm, *cur, *nxt;
-   int i_i;
-
-   pcu_assert( self );
-   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
-      self->used[i_i] = False;
-      itm = self->tbl + i_i;
-      cur = itm->next;
-      while( cur ) {
-	 nxt = cur->next;
-	 Class_Free( self, cur );
-	 cur = nxt;
-      }
-      itm->next = NULL;
-   }
-   self->curSize = 0;
-}
-
-void ISet_Union( void* _self, const void* _op ) {
-   ISet* self = (ISet*)_self;
-   const ISet* op = (const ISet*)_op;
-   ISetIter iterObj, *iter = &iterObj;
-   IArray arrayObj, *array = &arrayObj;
-   int arrSize, key;
-   const int* arrPtr;
-   int i_i;
-
-   pcu_assert( self && op );
-   ISetIter_Construct( iter );
-   IArray_Construct( array );
-   for( ISet_First( op, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) ) {
-      key = ISetIter_GetKey( iter );
-      if( !ISet_Has( self, key ) )
-	 IArray_Append( array, key );
-   }
-   NewClass_Destruct( iter );
-
-   arrSize = IArray_GetSize( array );
-   arrPtr = IArray_GetPtr( array );
-   ISet_SetMaxSize( self, self->curSize + arrSize );
-   for( i_i = 0; i_i < arrSize; i_i++ )
-      ISet_Insert( self, arrPtr[i_i] );
-   IArray_Destruct( array );
-}
-
-void ISet_Isect( void* _self, const void* _op ) {
-   ISet* self = (ISet*)_self;
-   const ISet* op = (const ISet*)_op;
-   ISetIter iterObj, *iter = &iterObj;
-   IArray arrayObj, *array = &arrayObj;
-   int arrSize, key;
-   const int* arrPtr;
-   int i_i;
-
-   pcu_assert( self && op );
-   ISetIter_Construct( iter );
-   IArray_Construct( array );
-   for( ISet_First( op, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) ) {
-      key = ISetIter_GetKey( iter );
-      if( ISet_Has( self, key ) )
-	 IArray_Append( array, key );
-   }
-   NewClass_Destruct( iter );
-
-   arrSize = IArray_GetSize( array );
-   arrPtr = IArray_GetPtr( array );
-   ISet_Clear( self );
-   ISet_SetMaxSize( self, arrSize );
-   for( i_i = 0; i_i < arrSize; i_i++ )
-      ISet_Insert( self, arrPtr[i_i] );
-   IArray_Destruct( array );
-}
-
-void ISet_Subtr( void* _self, const void* _op ) {
-   ISet* self = (ISet*)_self;
-   const ISet* op = (const ISet*)_op;
-   ISetIter iterObj, *iter = &iterObj;
-   IArray arrayObj, *array = &arrayObj;
-   int arrSize, key;
-   const int* arrPtr;
-   int i_i;
-
-   pcu_assert( self && op );
-   ISetIter_Construct( iter );
-   IArray_Construct( array );
-   for( ISet_First( self, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) ) {
-      key = ISetIter_GetKey( iter );
-      if( !ISet_Has( op, key ) )
-	 IArray_Append( array, key );
-   }
-   NewClass_Destruct( iter );
-
-   arrSize = IArray_GetSize( array );
-   arrPtr = IArray_GetPtr( array );
-   ISet_Clear( self );
-   ISet_SetMaxSize( self, arrSize );
-   for( i_i = 0; i_i < arrSize; i_i++ )
-      ISet_Insert( self, arrPtr[i_i] );
-   IArray_Destruct( array );
-}
-
-int ISet_GetMaxSize( const void* self ) {
-   pcu_assert( self );
-   return ((ISet*)self)->maxSize;
-}
-
-int ISet_GetSize( const void* self ) {
-   pcu_assert( self );
-   return ((ISet*)self)->curSize;
-}
-
-void ISet_GetArray( const void* _self, int* keys ) {
-   const ISet* self = (const ISet*)_self;
-   ISetIter iterObj, *iter = &iterObj;
-   int i_i;
-
-   pcu_assert( self );
-   ISetIter_Construct( iter );
-   for( i_i = 0, ISet_First( self, iter );
-	Iter_IsValid( iter );
-	i_i++, ISetIter_Next( iter ) )
-   {
-      keys[i_i] = ISetIter_GetKey( iter );
-   }
-   NewClass_Destruct( iter );
-}
-
-Bool ISet_Has( const void* _self, int key ) {
-   const ISet* self = (const ISet*)_self;
-   ISetItem* itm;
-   int ind;
-
-   pcu_assert( self );
-   ind = ISet_Hash( self, key );
-   pcu_assert( ind < self->tblSize );
-   if( !self->used[ind] )
-      return False;
-   itm = self->tbl + ind;
-   if( itm->key != key ) {
-      while( (itm = itm->next) ) {
-	 if( itm->key == key )
-	    break;
-      }
-   }
-   return itm ? True : False;
-}
-
-int ISet_Hash( const void* self, int key ) {
-   return key % ((ISet*)self)->tblSize;
-}
-
-void ISet_First( const void* _self, ISetIter* iter ) {
-   const ISet* self = (ISet*)_self;
-   int i_i;
-
-   pcu_assert( self && iter );
-   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
-      if( self->used[i_i] ) {
-	 iter->iset = (ISet*)self;
-	 iter->tblInd = i_i;
-	 iter->cur = self->tbl + i_i;
-	 iter->valid = True;
-	 return;
-      }
-   }
-   iter->valid = False;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/ISet.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/ISet.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,429 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ISet.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "types.h"
+#include "IArray.h"
+#include "Iter.h"
+#include "ISetIter.h"
+#include "ISet.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+const double ISet_TableFactor = 1.18;
+
+
+void _ISet_Init( void* _self ) {
+   ISet* self = (ISet*)_self;
+
+   _NewClass_Init( self );
+   self->maxSize = 0;
+   self->curSize = 0;
+   self->tblSize = 0;
+   self->tbl = NULL;
+   self->used = NULL;
+   ISet_SetMaxSize( self, 0 );
+}
+
+void _ISet_Destruct( void* self ) {
+   ISet_Clear( self );
+   Class_Free( self, ((ISet*)self)->tbl );
+   Class_Free( self, ((ISet*)self)->used );
+   _NewClass_Destruct( self );
+}
+
+void _ISet_Copy( void* _self, const void* _op ) {
+   ISet* self = (ISet*)_self;
+   const ISet* op = (const ISet*)_op;
+   ISetIter iterObj, *iter = &iterObj;
+
+   pcu_assert( self && op );
+   ISet_Clear( self );
+   ISet_SetMaxSize( self, op->maxSize );
+   ISetIter_Construct( iter );
+   for( ISet_First( op, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) )
+      ISet_Insert( self, ISetIter_GetKey( iter ) );
+   NewClass_Destruct( iter );
+}
+
+void ISet_UseArray( void* _self, int size, const int* array ) {
+   ISet* self = (ISet*)_self;
+   int i_i;
+
+   ISet_Clear( self );
+   ISet_SetMaxSize( self, size );
+   for( i_i = 0; i_i < size; i_i++ )
+      ISet_Insert( self, array[i_i] );
+}
+
+void ISet_SetMaxSize( void* _self, int maxSize ) {
+   ISet* self = (ISet*)_self;
+   int nOldItms, *keys;
+   ISetItem* itm;
+   int i_i;
+
+   pcu_assert( self );
+   nOldItms = self->curSize;
+   keys = Class_Array( self, int, self->curSize );
+   ISet_GetArray( self, keys );
+
+   ISet_Clear( self );
+   self->maxSize = maxSize;
+   self->curSize = 0;
+   self->tblSize = (int)((double)maxSize * ISet_TableFactor);
+   self->tblSize += (self->tblSize % 2) ? 0 : 1;
+   self->tbl = Class_Rearray( self, self->tbl, ISetItem, self->tblSize );
+   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
+      itm = self->tbl + i_i;
+      itm->key = 0;
+      itm->next = NULL;
+   }
+   self->used = Class_Rearray( self, self->used, Bool, self->tblSize );
+   memset( self->used, 0, self->tblSize* sizeof(Bool) );
+
+   for( i_i = 0; i_i < nOldItms; i_i++ )
+      ISet_Insert( self, keys[i_i] );
+   Class_Free( self, keys );
+}
+
+void ISet_Insert( void* _self, int key ) {
+   ISet* self = (ISet*)_self;
+   ISetItem *itm, *cur;
+   int ind;
+
+   pcu_assert( self );
+   ind = ISet_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   itm = self->tbl + ind;
+   if( !self->used[ind] ) {
+      itm->key = key;
+      itm->next = NULL;
+      self->used[ind] = True;
+   }
+   else {
+#ifndef NDEBUG
+      cur = itm;
+      do {
+	 if( cur->key == key ) {
+	    pcu_assert( cur->key != key );
+	 }
+	 cur = cur->next;
+      } while( cur );
+#endif
+      cur = itm->next;
+      itm->next = Class_Alloc( self, ISetItem );
+      itm->next->key = key;
+      itm->next->next = cur;
+   }
+   insist( ++self->curSize, <= self->maxSize );
+}
+
+Bool ISet_TryInsert( void* _self, int key ) {
+   ISet* self = (ISet*)_self;
+   ISetItem *itm, *cur;
+   int ind;
+
+   pcu_assert( self );
+   ind = ISet_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   itm = self->tbl + ind;
+   if( !self->used[ind] ) {
+      itm->key = key;
+      itm->next = NULL;
+      self->used[ind] = True;
+   }
+   else {
+      cur = itm;
+      do {
+	 if( cur->key == key )
+	    return False;
+	 cur = cur->next;
+      } while( cur );
+      cur = itm->next;
+      itm->next = Class_Alloc( self, ISetItem );
+      itm->next->key = key;
+      itm->next->next = cur;
+   }
+   insist( ++self->curSize, <= self->maxSize );
+   return True;
+}
+
+void ISet_Remove( void* _self, int key ) {
+   ISet* self = (ISet*)_self;
+   ISetItem *itm, *prev, *toDel;
+   int ind;
+
+   pcu_assert( self );
+   ind = ISet_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   pcu_assert( self->used[ind] );
+   itm = self->tbl + ind;
+   if( itm->key == key ) {
+      toDel = itm->next;
+      if( toDel ) {
+	 itm->key = toDel->key;
+	 itm->next = toDel->next;
+      }
+      else
+	 self->used[ind] = False;
+   }
+   else {
+      prev = itm;
+      toDel = itm->next;
+      while( toDel ) {
+	 if( toDel->key == key ) {
+	    prev->next = toDel->next;
+	    break;
+	 }
+	 prev = toDel;
+	 toDel = toDel->next;
+      }
+      pcu_assert( toDel );
+   }
+   if( toDel )
+      Class_Free( self, toDel );
+   self->curSize--;
+}
+
+Bool ISet_TryRemove( void* _self, int key ) {
+   ISet* self = (ISet*)_self;
+   ISetItem *itm, *prev, *toDel;
+   int ind;
+
+   pcu_assert( self );
+   ind = ISet_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   if( !self->used[ind] )
+      return False;
+   itm = self->tbl + ind;
+   if( itm->key == key ) {
+      toDel = itm->next;
+      if( toDel ) {
+	 itm->key = toDel->key;
+	 itm->next = toDel->next;
+      }
+      else
+	 self->used[ind] = False;
+   }
+   else {
+      prev = itm;
+      toDel = itm->next;
+      while( toDel ) {
+	 if( toDel->key == key ) {
+	    prev->next = toDel->next;
+	    break;
+	 }
+	 prev = toDel;
+	 toDel = toDel->next;
+      }
+      if( !toDel )
+	 return False;
+   }
+   if( toDel )
+      Class_Free( self, toDel );
+   self->curSize--;
+   return True;
+}
+
+void ISet_Clear( void* _self ) {
+   ISet* self = (ISet*)_self;
+   ISetItem *itm, *cur, *nxt;
+   int i_i;
+
+   pcu_assert( self );
+   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
+      self->used[i_i] = False;
+      itm = self->tbl + i_i;
+      cur = itm->next;
+      while( cur ) {
+	 nxt = cur->next;
+	 Class_Free( self, cur );
+	 cur = nxt;
+      }
+      itm->next = NULL;
+   }
+   self->curSize = 0;
+}
+
+void ISet_Union( void* _self, const void* _op ) {
+   ISet* self = (ISet*)_self;
+   const ISet* op = (const ISet*)_op;
+   ISetIter iterObj, *iter = &iterObj;
+   IArray arrayObj, *array = &arrayObj;
+   int arrSize, key;
+   const int* arrPtr;
+   int i_i;
+
+   pcu_assert( self && op );
+   ISetIter_Construct( iter );
+   IArray_Construct( array );
+   for( ISet_First( op, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) ) {
+      key = ISetIter_GetKey( iter );
+      if( !ISet_Has( self, key ) )
+	 IArray_Append( array, key );
+   }
+   NewClass_Destruct( iter );
+
+   arrSize = IArray_GetSize( array );
+   arrPtr = IArray_GetPtr( array );
+   ISet_SetMaxSize( self, self->curSize + arrSize );
+   for( i_i = 0; i_i < arrSize; i_i++ )
+      ISet_Insert( self, arrPtr[i_i] );
+   IArray_Destruct( array );
+}
+
+void ISet_Isect( void* _self, const void* _op ) {
+   ISet* self = (ISet*)_self;
+   const ISet* op = (const ISet*)_op;
+   ISetIter iterObj, *iter = &iterObj;
+   IArray arrayObj, *array = &arrayObj;
+   int arrSize, key;
+   const int* arrPtr;
+   int i_i;
+
+   pcu_assert( self && op );
+   ISetIter_Construct( iter );
+   IArray_Construct( array );
+   for( ISet_First( op, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) ) {
+      key = ISetIter_GetKey( iter );
+      if( ISet_Has( self, key ) )
+	 IArray_Append( array, key );
+   }
+   NewClass_Destruct( iter );
+
+   arrSize = IArray_GetSize( array );
+   arrPtr = IArray_GetPtr( array );
+   ISet_Clear( self );
+   ISet_SetMaxSize( self, arrSize );
+   for( i_i = 0; i_i < arrSize; i_i++ )
+      ISet_Insert( self, arrPtr[i_i] );
+   IArray_Destruct( array );
+}
+
+void ISet_Subtr( void* _self, const void* _op ) {
+   ISet* self = (ISet*)_self;
+   const ISet* op = (const ISet*)_op;
+   ISetIter iterObj, *iter = &iterObj;
+   IArray arrayObj, *array = &arrayObj;
+   int arrSize, key;
+   const int* arrPtr;
+   int i_i;
+
+   pcu_assert( self && op );
+   ISetIter_Construct( iter );
+   IArray_Construct( array );
+   for( ISet_First( self, iter ); Iter_IsValid( iter ); ISetIter_Next( iter ) ) {
+      key = ISetIter_GetKey( iter );
+      if( !ISet_Has( op, key ) )
+	 IArray_Append( array, key );
+   }
+   NewClass_Destruct( iter );
+
+   arrSize = IArray_GetSize( array );
+   arrPtr = IArray_GetPtr( array );
+   ISet_Clear( self );
+   ISet_SetMaxSize( self, arrSize );
+   for( i_i = 0; i_i < arrSize; i_i++ )
+      ISet_Insert( self, arrPtr[i_i] );
+   IArray_Destruct( array );
+}
+
+int ISet_GetMaxSize( const void* self ) {
+   pcu_assert( self );
+   return ((ISet*)self)->maxSize;
+}
+
+int ISet_GetSize( const void* self ) {
+   pcu_assert( self );
+   return ((ISet*)self)->curSize;
+}
+
+void ISet_GetArray( const void* _self, int* keys ) {
+   const ISet* self = (const ISet*)_self;
+   ISetIter iterObj, *iter = &iterObj;
+   int i_i;
+
+   pcu_assert( self );
+   ISetIter_Construct( iter );
+   for( i_i = 0, ISet_First( self, iter );
+	Iter_IsValid( iter );
+	i_i++, ISetIter_Next( iter ) )
+   {
+      keys[i_i] = ISetIter_GetKey( iter );
+   }
+   NewClass_Destruct( iter );
+}
+
+Bool ISet_Has( const void* _self, int key ) {
+   const ISet* self = (const ISet*)_self;
+   ISetItem* itm;
+   int ind;
+
+   pcu_assert( self );
+   ind = ISet_Hash( self, key );
+   pcu_assert( ind < self->tblSize );
+   if( !self->used[ind] )
+      return False;
+   itm = self->tbl + ind;
+   if( itm->key != key ) {
+      while( (itm = itm->next) ) {
+	 if( itm->key == key )
+	    break;
+      }
+   }
+   return itm ? True : False;
+}
+
+int ISet_Hash( const void* self, int key ) {
+   return key % ((ISet*)self)->tblSize;
+}
+
+void ISet_First( const void* _self, ISetIter* iter ) {
+   const ISet* self = (ISet*)_self;
+   int i_i;
+
+   pcu_assert( self && iter );
+   for( i_i = 0; i_i < self->tblSize; i_i++ ) {
+      if( self->used[i_i] ) {
+	 iter->iset = (ISet*)self;
+	 iter->tblInd = i_i;
+	 iter->cur = self->tbl + i_i;
+	 iter->valid = True;
+	 return;
+      }
+   }
+   iter->valid = False;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/ISetIter.c
--- a/Base/Container/src/ISetIter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ISetIter.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "types.h"
-#include "Iter.h"
-#include "ISet.h"
-#include "ISetIter.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-void _ISetIter_Init( void* _self ) {
-   ISetIter* self = (ISetIter*)_self;
-
-   _Iter_Init( self );
-   self->iset = NULL;
-   self->tblInd = 0;
-   self->cur = NULL;
-}
-
-void _ISetIter_Copy( void* _self, const void* _op ) {
-   ISetIter* self = (ISetIter*)_self;
-   const ISetIter* op = (const ISetIter*)_op;
-
-   _Iter_Copy( self, op );
-   self->iset = op->iset;
-   self->tblInd = op->tblInd;
-   self->cur = op->cur;
-}
-
-void _ISetIter_Next( void* _self ) {
-   ISetIter* self = (ISetIter*)_self;
-   int i_i;
-
-   assert( self );
-   assert( self->tblInd < self->iset->tblSize && 
-	   self->iset->used[self->tblInd] );
-   assert( self->cur );
-   assert( self->valid );
-   if( !self->cur->next ) {
-      for( i_i = self->tblInd + 1; i_i < self->iset->tblSize; i_i++ ) {
-	 if( self->iset->used[i_i] )
-	    break;
-      }
-      if( i_i < self->iset->tblSize ) {
-	self->tblInd = i_i;
-	self->cur = self->iset->tbl + i_i;
-      }
-      else
-	self->valid = False;
-   }
-   else
-      self->cur = self->cur->next;
-}
-
-int ISetIter_GetKey( const void* self ) {
-   assert( self );
-   assert( ((ISetIter*)self)->valid && ((ISetIter*)self)->cur );
-   return ((ISetIter*)self)->cur->key;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/ISetIter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/ISetIter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,93 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ISetIter.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "types.h"
+#include "Iter.h"
+#include "ISet.h"
+#include "ISetIter.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+void _ISetIter_Init( void* _self ) {
+   ISetIter* self = (ISetIter*)_self;
+
+   _Iter_Init( self );
+   self->iset = NULL;
+   self->tblInd = 0;
+   self->cur = NULL;
+}
+
+void _ISetIter_Copy( void* _self, const void* _op ) {
+   ISetIter* self = (ISetIter*)_self;
+   const ISetIter* op = (const ISetIter*)_op;
+
+   _Iter_Copy( self, op );
+   self->iset = op->iset;
+   self->tblInd = op->tblInd;
+   self->cur = op->cur;
+}
+
+void _ISetIter_Next( void* _self ) {
+   ISetIter* self = (ISetIter*)_self;
+   int i_i;
+
+   assert( self );
+   assert( self->tblInd < self->iset->tblSize && 
+	   self->iset->used[self->tblInd] );
+   assert( self->cur );
+   assert( self->valid );
+   if( !self->cur->next ) {
+      for( i_i = self->tblInd + 1; i_i < self->iset->tblSize; i_i++ ) {
+	 if( self->iset->used[i_i] )
+	    break;
+      }
+      if( i_i < self->iset->tblSize ) {
+	self->tblInd = i_i;
+	self->cur = self->iset->tbl + i_i;
+      }
+      else
+	self->valid = False;
+   }
+   else
+      self->cur = self->cur->next;
+}
+
+int ISetIter_GetKey( const void* self ) {
+   assert( self );
+   assert( ((ISetIter*)self)->valid && ((ISetIter*)self)->cur );
+   return ((ISetIter*)self)->cur->key;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IndexMap.c
--- a/Base/Container/src/IndexMap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IndexMap.c 2192 2004-10-15 02:45:38Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "units.h"
-#include "types.h"
-#include "IndexMap.h"
-#include "PtrMap.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-#include <limits.h>
-
-/* Textual name of this class */
-const Type IndexMap_Type = "IndexMap";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-IndexMap* IndexMap_New_Param(
-		unsigned					delta )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(IndexMap);
-	Type                              type = IndexMap_Type;
-	Stg_Class_DeleteFunction*      _delete = _IndexMap_Delete;
-	Stg_Class_PrintFunction*        _print = _IndexMap_Print;
-	Stg_Class_CopyFunction*          _copy = _IndexMap_Copy;
-
-	return _IndexMap_New(  INDEXMAP_PASSARGS  );
-}
-
-
-void IndexMap_Init(
-		IndexMap*					self,
-		unsigned					delta )
-{
-	/* General info */
-	self->type = IndexMap_Type;
-	self->_sizeOfSelf = sizeof(IndexMap);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _IndexMap_Delete;
-	self->_print = _IndexMap_Print;
-	self->_copy = NULL;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* IndexMap info */
-	_IndexMap_Init( self, delta );
-}
-
-
-IndexMap* _IndexMap_New(  INDEXMAP_DEFARGS  )
-{
-	IndexMap*			self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(IndexMap) );
-	self = (IndexMap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* IndexMap info */
-	_IndexMap_Init( self, delta );
-	
-	return self;
-}
-
-
-void _IndexMap_Init(
-		IndexMap*				self,
-		unsigned				delta )
-{
-	/* General and Virtual info should already be set */
-	
-	/* IndexMap info */
-	assert( self );
-	
-	self->delta = delta;
-	self->maxTuples = self->delta;
-	self->tupleTbl = Memory_Alloc_Array( IndexMapTuple, self->maxTuples, "IndexMap->tupleTbl" );
-	assert( self->tupleTbl ); /* TODO change this to a firewall, or something */
-	self->tupleCnt = 0;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _IndexMap_Delete( void* indexMap ) {
-	IndexMap*			self = (IndexMap*)indexMap;
-	
-	/* Stg_Class_Delete the class itself */
-	assert( self );
-	
-	if( self->tupleTbl ) {
-		Memory_Free( self->tupleTbl );
-	}
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-
-void _IndexMap_Print( void* indexMap, Stream* stream ) {
-	IndexMap*		self = (IndexMap*)indexMap;
-	unsigned		tuple_I;
-	
-	/* Set the Journal for printing informations */
-	Stream*			myStream;
-	myStream = Journal_Register( InfoStream_Type, "IndexMapStream" );
-
-	/* Print parent */
-	assert( self );
-	_Stg_Class_Print( self, stream );
-	
-	/* General info */
-	Journal_Printf( myStream, "IndexMap (ptr): (%p)\n", self );
-	
-	/* Virtual info */
-	
-	/* IndexMap info */
-	for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
-		Journal_Printf( myStream, "\ttuple[%d]: %d -> %d\n", tuple_I, self->tupleTbl[tuple_I].key, self->tupleTbl[tuple_I].idx );
-	}
-}
-
-
-void* _IndexMap_Copy( const void* indexMap, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	IndexMap*	self = (IndexMap*)indexMap;
-	IndexMap*	newIndexMap;
-	PtrMap*		map = ptrMap;
-	Bool		ownMap = False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newIndexMap = (IndexMap*)_Stg_Class_Copy( self, dest, deep, nameExt, map );
-	
-	newIndexMap->dictionary = self->dictionary;
-	newIndexMap->delta = self->delta;
-	newIndexMap->maxTuples = self->maxTuples;
-	newIndexMap->tupleCnt = self->tupleCnt;
-	
-	if( deep ) {
-          if( (newIndexMap->tupleTbl = (IndexMapTuple*)PtrMap_Find( map, self->tupleTbl )) == NULL && self->tupleTbl ) {
-			newIndexMap->tupleTbl = Memory_Alloc_Array( IndexMapTuple, self->maxTuples, "IndexMap->tupleTbl" );
-			memcpy( newIndexMap->tupleTbl, self->tupleTbl, sizeof(IndexMapTuple) * self->maxTuples );
-			PtrMap_Append( map, self->tupleTbl, newIndexMap->tupleTbl );
-		}
-	}
-	else {
-		newIndexMap->tupleTbl = self->tupleTbl;
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-	
-	return (void*)newIndexMap;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void IndexMap_Append( void* indexMap, Index key, Index idx ) {
-	IndexMap*		self = (IndexMap*)indexMap;
-	unsigned		newTupleCnt;
-	
-	assert( self && key != (unsigned)(-1) && idx != (unsigned)(-1) );
-	
-	if( IndexMap_Find( self, key ) != (unsigned)(-1) ) {
-		return;
-	}
-	
-	newTupleCnt = self->tupleCnt + 1;
-	if( newTupleCnt >= self->maxTuples ) {
-		unsigned		factor;
-		IndexMapTuple*		newTuples;
-		
-		factor = ceil( (float)(newTupleCnt - self->maxTuples) / (float)self->delta );
-		self->maxTuples += factor * self->delta;
-		
-		newTuples = Memory_Alloc_Array( IndexMapTuple, self->maxTuples, "IndexMap->tupleTbl" );
-		assert( newTuples ); /* TODO change this */
-		if( self->tupleTbl ) {
-			memcpy( newTuples, self->tupleTbl, sizeof(IndexMapTuple) * self->tupleCnt );
-			Memory_Free( self->tupleTbl );
-		}
-		self->tupleTbl = newTuples;
-	}
-	
-	self->tupleTbl[self->tupleCnt].key = key;
-	self->tupleTbl[self->tupleCnt].idx = idx;
-	self->tupleCnt = newTupleCnt;
-}
-
-
-Index IndexMap_Find( void* indexMap, Index key ) {
-	IndexMap*		self = (IndexMap*)indexMap;
-	unsigned		tuple_I;
-	
-	assert( self );
-	
-	if( key != (unsigned)(-1) ) {
-		for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
-			if( self->tupleTbl[tuple_I].key == key )
-				return self->tupleTbl[tuple_I].idx;
-		}
-	}
-	
-	return (unsigned)(-1);
-}
-
-
-void IndexMap_Remap( void* indexMap, void* mapThrough ) {
-	IndexMap*	self = (IndexMap*)indexMap;
-	Index		tuple_I;
-	
-	for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
-		self->tupleTbl[tuple_I].idx = IndexMap_Find( mapThrough, self->tupleTbl[tuple_I].idx );
-	}
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IndexMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/IndexMap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,274 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IndexMap.c 2192 2004-10-15 02:45:38Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "units.h"
+#include "types.h"
+#include "IndexMap.h"
+#include "PtrMap.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+#include <limits.h>
+
+/* Textual name of this class */
+const Type IndexMap_Type = "IndexMap";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+IndexMap* IndexMap_New_Param(
+		unsigned					delta )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(IndexMap);
+	Type                              type = IndexMap_Type;
+	Stg_Class_DeleteFunction*      _delete = _IndexMap_Delete;
+	Stg_Class_PrintFunction*        _print = _IndexMap_Print;
+	Stg_Class_CopyFunction*          _copy = _IndexMap_Copy;
+
+	return _IndexMap_New(  INDEXMAP_PASSARGS  );
+}
+
+
+void IndexMap_Init(
+		IndexMap*					self,
+		unsigned					delta )
+{
+	/* General info */
+	self->type = IndexMap_Type;
+	self->_sizeOfSelf = sizeof(IndexMap);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _IndexMap_Delete;
+	self->_print = _IndexMap_Print;
+	self->_copy = NULL;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* IndexMap info */
+	_IndexMap_Init( self, delta );
+}
+
+
+IndexMap* _IndexMap_New(  INDEXMAP_DEFARGS  )
+{
+	IndexMap*			self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(IndexMap) );
+	self = (IndexMap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* IndexMap info */
+	_IndexMap_Init( self, delta );
+	
+	return self;
+}
+
+
+void _IndexMap_Init(
+		IndexMap*				self,
+		unsigned				delta )
+{
+	/* General and Virtual info should already be set */
+	
+	/* IndexMap info */
+	assert( self );
+	
+	self->delta = delta;
+	self->maxTuples = self->delta;
+	self->tupleTbl = Memory_Alloc_Array( IndexMapTuple, self->maxTuples, "IndexMap->tupleTbl" );
+	assert( self->tupleTbl ); /* TODO change this to a firewall, or something */
+	self->tupleCnt = 0;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _IndexMap_Delete( void* indexMap ) {
+	IndexMap*			self = (IndexMap*)indexMap;
+	
+	/* Stg_Class_Delete the class itself */
+	assert( self );
+	
+	if( self->tupleTbl ) {
+		Memory_Free( self->tupleTbl );
+	}
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+
+void _IndexMap_Print( void* indexMap, Stream* stream ) {
+	IndexMap*		self = (IndexMap*)indexMap;
+	unsigned		tuple_I;
+	
+	/* Set the Journal for printing informations */
+	Stream*			myStream;
+	myStream = Journal_Register( InfoStream_Type, "IndexMapStream" );
+
+	/* Print parent */
+	assert( self );
+	_Stg_Class_Print( self, stream );
+	
+	/* General info */
+	Journal_Printf( myStream, "IndexMap (ptr): (%p)\n", self );
+	
+	/* Virtual info */
+	
+	/* IndexMap info */
+	for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
+		Journal_Printf( myStream, "\ttuple[%d]: %d -> %d\n", tuple_I, self->tupleTbl[tuple_I].key, self->tupleTbl[tuple_I].idx );
+	}
+}
+
+
+void* _IndexMap_Copy( const void* indexMap, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	IndexMap*	self = (IndexMap*)indexMap;
+	IndexMap*	newIndexMap;
+	PtrMap*		map = ptrMap;
+	Bool		ownMap = False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newIndexMap = (IndexMap*)_Stg_Class_Copy( self, dest, deep, nameExt, map );
+	
+	newIndexMap->dictionary = self->dictionary;
+	newIndexMap->delta = self->delta;
+	newIndexMap->maxTuples = self->maxTuples;
+	newIndexMap->tupleCnt = self->tupleCnt;
+	
+	if( deep ) {
+          if( (newIndexMap->tupleTbl = (IndexMapTuple*)PtrMap_Find( map, self->tupleTbl )) == NULL && self->tupleTbl ) {
+			newIndexMap->tupleTbl = Memory_Alloc_Array( IndexMapTuple, self->maxTuples, "IndexMap->tupleTbl" );
+			memcpy( newIndexMap->tupleTbl, self->tupleTbl, sizeof(IndexMapTuple) * self->maxTuples );
+			PtrMap_Append( map, self->tupleTbl, newIndexMap->tupleTbl );
+		}
+	}
+	else {
+		newIndexMap->tupleTbl = self->tupleTbl;
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+	
+	return (void*)newIndexMap;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void IndexMap_Append( void* indexMap, Index key, Index idx ) {
+	IndexMap*		self = (IndexMap*)indexMap;
+	unsigned		newTupleCnt;
+	
+	assert( self && key != (unsigned)(-1) && idx != (unsigned)(-1) );
+	
+	if( IndexMap_Find( self, key ) != (unsigned)(-1) ) {
+		return;
+	}
+	
+	newTupleCnt = self->tupleCnt + 1;
+	if( newTupleCnt >= self->maxTuples ) {
+		unsigned		factor;
+		IndexMapTuple*		newTuples;
+		
+		factor = ceil( (float)(newTupleCnt - self->maxTuples) / (float)self->delta );
+		self->maxTuples += factor * self->delta;
+		
+		newTuples = Memory_Alloc_Array( IndexMapTuple, self->maxTuples, "IndexMap->tupleTbl" );
+		assert( newTuples ); /* TODO change this */
+		if( self->tupleTbl ) {
+			memcpy( newTuples, self->tupleTbl, sizeof(IndexMapTuple) * self->tupleCnt );
+			Memory_Free( self->tupleTbl );
+		}
+		self->tupleTbl = newTuples;
+	}
+	
+	self->tupleTbl[self->tupleCnt].key = key;
+	self->tupleTbl[self->tupleCnt].idx = idx;
+	self->tupleCnt = newTupleCnt;
+}
+
+
+Index IndexMap_Find( void* indexMap, Index key ) {
+	IndexMap*		self = (IndexMap*)indexMap;
+	unsigned		tuple_I;
+	
+	assert( self );
+	
+	if( key != (unsigned)(-1) ) {
+		for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
+			if( self->tupleTbl[tuple_I].key == key )
+				return self->tupleTbl[tuple_I].idx;
+		}
+	}
+	
+	return (unsigned)(-1);
+}
+
+
+void IndexMap_Remap( void* indexMap, void* mapThrough ) {
+	IndexMap*	self = (IndexMap*)indexMap;
+	Index		tuple_I;
+	
+	for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
+		self->tupleTbl[tuple_I].idx = IndexMap_Find( mapThrough, self->tupleTbl[tuple_I].idx );
+	}
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IndexSet.c
--- a/Base/Container/src/IndexSet.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,396 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IndexSet.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "units.h"
-#include "types.h"
-#include "IndexSet.h"
-
-#include <mpi.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Textual name of this class */
-const Type IndexSet_Type = "IndexSet";
-
-/** Macro to calculate container membership */
-#define IS_MEMBER( indexSet, index ) \
-	((indexSet)->_container[(index) / (sizeof(char) * 8 )] & (1 << ((index) % (sizeof(char) * 8))))
-
-IndexSet* IndexSet_New( IndexSet_Index size ) {
-	/* Variables set in this function */
-	SizeT                        _sizeOfSelf = sizeof(IndexSet);
-	Type                                type = IndexSet_Type;
-	Stg_Class_DeleteFunction*        _delete = _IndexSet_Delete;
-	Stg_Class_PrintFunction*          _print = _IndexSet_Print;
-	Stg_Class_CopyFunction*            _copy = _IndexSet_Copy;
-	IndexSet_DuplicateFunction*   _duplicate = _IndexSet_Duplicate;
-
-	return _IndexSet_New(  INDEXSET_PASSARGS  );
-}
-
-void IndexSet_Init( IndexSet* self, IndexSet_Index size ) {
-	/* General info */
-	self->type = IndexSet_Type;
-	self->_sizeOfSelf = sizeof(IndexSet);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _IndexSet_Delete;
-	self->_print = _IndexSet_Print;
-	self->_copy = _IndexSet_Copy;
-	self->_duplicate = _IndexSet_Duplicate;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* IndexSet info */
-	_IndexSet_Init( self, size );
-}
-
-
-IndexSet* _IndexSet_New(  INDEXSET_DEFARGS  )
-{
-	IndexSet* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(IndexSet) );
-	self = (IndexSet*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	self->_duplicate = _duplicate;
-	
-	/* IndexSet info */
-	_IndexSet_Init( self, size );
-	
-	return self;
-}
-
-
-void _IndexSet_Init( IndexSet* self, IndexSet_Index size ) {
-	/* General and Virtual info should already be set */
-	
-	/* IndexSet info */
-	self->size = size;
-	self->_containerSize = self->size / (sizeof(char) * 8) + (self->size % (sizeof(char) * 8) ? 1 : 0);
-	self->_container = Memory_Alloc_Array( BitField, self->_containerSize, "IndexSet->_container");
-	memset( self->_container, 0, sizeof(char) * self->_containerSize );
-	self->membersCount = 0;
-	self->error = Journal_Register( ErrorStream_Type, self->type );
-}
-
-
-void _IndexSet_Delete( void* indexSet ) {
-	IndexSet* self = (IndexSet*)indexSet;
-	
-	if( self->_container ) {
-		Memory_Free( self->_container );
-	}
-	
-	/* Stg_Class_Delete parent class */
-	_Stg_Class_Delete( self );
-}
-
-
-void _IndexSet_Print( void* indexSet, Stream* stream ) {
-	IndexSet* self = (IndexSet*)indexSet;
-	
-	/* Set the Journal for printing informations */
-	Stream* indexSetStream = Journal_Register( InfoStream_Type, "IndexSetStream");
-	
-	/* General info */
-	Journal_Printf( indexSetStream, "IndexSet (%p):\n", self );
-	
-	/* Virtual info */
-	
-	/* IndexSet */
-	Journal_Printf( indexSetStream, "\tsize: %u\n", self->size );
-	Journal_Printf( indexSetStream, "\t_containerSize: %lu\n", self->_containerSize );
-	Journal_Printf( indexSetStream, "\t_container: %p\n", self->_container );
-
-	if( self->_container ) {
-		IndexSet_Index		index_I;
-		
-		for( index_I = 0; index_I < self->size; index_I++ ) {
-			Index			containerIndex;
-			char			indexMask;
-			
-			containerIndex = index_I / (sizeof(char) * 8);
-			indexMask = 1 << (index_I % (sizeof(char) * 8));
-			
-			if( self->_container[containerIndex] & indexMask ) {
-				Journal_Printf( indexSetStream, "\t\tindex %u: In set.\n", index_I );
-			}
-			else {
-				Journal_Printf( indexSetStream, "\t\tindex %u: Not in set.\n", index_I );
-			}
-		}
-	}
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-}
-
-
-void* _IndexSet_Copy( const void* indexSet, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	IndexSet*	self = (IndexSet*)indexSet;
-	IndexSet*	newIndexSet;
-	
-	newIndexSet = (IndexSet*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	/* Virtual methods */
-	newIndexSet->_duplicate = self->_duplicate;
-	
-	newIndexSet->size = self->size;
-	newIndexSet->_containerSize = self->_containerSize;
-	newIndexSet->_container = Memory_Alloc_Array( char, newIndexSet->_containerSize, "IndexSet->_container" );
-	memcpy( newIndexSet->_container, self->_container, sizeof(char) * newIndexSet->_containerSize );
-	newIndexSet->membersCount = self->membersCount;
-	newIndexSet->error = self->error;
-	
-	return (void*)newIndexSet;
-}
-
-
-void IndexSet_Add( void* indexSet, Index index ) {
-	IndexSet* self = (IndexSet*)indexSet;
-
-	#ifdef CAUTIOUS
-		Journal_Firewall( index < self->size, self->error, "Error- %s: index %u outside current size %d. Aborting.\n",
-			__func__, index, self->size);
-	#endif
-	
-	self->_container[index / (sizeof(char) * 8)] |= (1 << (index % (sizeof(char) * 8)));
-	self->membersCount = (unsigned)-1;
-}
-
-
-void IndexSet_Remove( void* indexSet, Index index ) {
-	IndexSet* self = (IndexSet*)indexSet;
-
-	#ifdef CAUTIOUS
-		Journal_Firewall( index < self->size, self->error, "Error- %s: index %u outside current size %d. Aborting.\n",
-			__func__, index, self->size);
-	#endif
-	
-	self->_container[index / (sizeof(char) * 8)] &= ~(1 << (index % (sizeof(char) * 8)));
-	self->membersCount = (unsigned)-1;
-}
-
-Bool IndexSet_IsMember( void* indexSet, Index index ) {
-	IndexSet* self = (IndexSet*)indexSet;
-	Bool retFlag = False;
-
-	#ifdef CAUTIOUS
-		Journal_Firewall( index < self->size, self->error, "Error- %s: index %u outside current size %d. Aborting.\n",
-			__func__, index, self->size);
-	#endif
-	
-	if ( 0 == IS_MEMBER( self, index ) ) {
-		retFlag = False;
-	}
-	else {
-		retFlag = True;
-	}
-	
-	return retFlag;
-}
-
-
-IndexSet_Index IndexSet_GetIndexOfNthMember( void* indexSet, const Index nthMember ) {
-	IndexSet*		self = (IndexSet*)indexSet;
-	Index		membersSoFar = 0;
-	IndexSet_Index	index_I;
-	
-	for( index_I = 0; index_I < self->size; index_I++ ) {
-		if( IS_MEMBER( self, index_I ) ) {
-			if ( nthMember == membersSoFar ) {
-				return index_I;
-			}
-			membersSoFar++;
-		}
-	}
-
-	return IndexSet_Invalid( self );
-}
-
-
-IndexSet_Index IndexSet_UpdateMembersCount( void* indexSet ) {
-	IndexSet*		self = (IndexSet*)indexSet;
-	IndexSet_Index		index_I;
-
-	if (self->membersCount == (unsigned)-1 ) {
-		self->membersCount = 0;
-		for( index_I = 0; index_I < self->size; index_I++ ) {
-			if( IS_MEMBER( self, index_I ) ) {
-				self->membersCount++;
-			}
-		}
-	}
-
-	return self->membersCount;
-}
-
-
-void IndexSet_GetMembers( void* indexSet, IndexSet_Index* countPtr, Index** arrayPtr ) {
-	IndexSet*		self = (IndexSet*)indexSet;
-	
-	*countPtr = IndexSet_UpdateMembersCount( self );
-	if( *countPtr ) {
-		*arrayPtr = Memory_Alloc_Array( Index, (*countPtr), "IndexSet members" );
-		IndexSet_GetMembers2( self, *arrayPtr );
-	}
-	else {
-		*arrayPtr = NULL;
-	}
-}	
-
-
-void IndexSet_GetMembers2( void* indexSet, Index* const array ) {
-	IndexSet*		self = (IndexSet*)indexSet;
-	IndexSet_Index		index_I;
-	unsigned int		array_I;
-
-	for( array_I = 0, index_I = 0; index_I < self->size; index_I++ ) {
-		if( IS_MEMBER( self, index_I ) ) {
-			array[array_I] = index_I;
-			array_I++;
-		}
-	}
-}
-
-
-void IndexSet_GetVacancies( void* indexSet, IndexSet_Index* countPtr, Index** arrayPtr ) {
-	IndexSet*		self = (IndexSet*)indexSet;
-	IndexSet_Index		index_I;
-	unsigned int		array_I;
-
-	IndexSet_UpdateMembersCount( self );
-	*countPtr = self->size - self->membersCount;
-	
-	*arrayPtr = Memory_Alloc_Array( Index, (*countPtr), "IndexSet vacancies" );
-	for( array_I = 0, index_I = 0; index_I < self->size; index_I++ ) {
-		if( !IS_MEMBER( self, index_I) ) {
-			(*arrayPtr)[array_I] = index_I;
-			array_I++;
-		}
-	}
-}
-
-
-void IndexSet_Merge_OR(void* indexSet, void* indexSetTwo )
-{
-	IndexSet*	self = (IndexSet*)indexSet;
-	IndexSet*	secondSet = (IndexSet*)indexSetTwo;
-	Index		size;
-	Index		i;
-	
-	size = self->size <= secondSet->size ? self->_containerSize : secondSet->_containerSize;
-	
-	for (i = 0; i < size; i++)
-		self->_container[i] |= secondSet->_container[i];
-	
-	self->membersCount = (unsigned int)-1;
-}
-
-
-void IndexSet_Merge_AND(void* indexSet, void* indexSetTwo )
-{
-	IndexSet*	self = (IndexSet*)indexSet;
-	IndexSet*	secondSet = (IndexSet*)indexSetTwo;
-	Index		size;
-	Index		i;
-	
-	size = self->size <= secondSet->size ? self->_containerSize : secondSet->_containerSize;
-	
-	for (i = 0; i < size; i++)
-		self->_container[i] &= secondSet->_container[i];
-
-	/* As specified in header file description, if first given IndexSet is larger, zero out the
-	 * remaining entries since this is an AND operation */
-	for( i = size; i < self->_containerSize; i++) {
-		self->_container[i] &= 0x00;
-	}
-	
-	self->membersCount = (unsigned int)-1;
-}
-
-
-void IndexSet_AddAll( void* indexSet )
-{
-	IndexSet*	self = (IndexSet*)indexSet;
-	Index		i;
-	
-	for( i = 0; i < self->_containerSize; i++)
-		self->_container[i] |= -1;
-
-	self->membersCount = self->size;
-}
-
-
-void IndexSet_RemoveAll( void* indexSet )
-{
-	IndexSet*	self = (IndexSet*)indexSet;
-	Index		i;
-	
-	for( i = 0; i < self->_containerSize; i++)
-		self->_container[i] &= 0x00;
-
-	self->membersCount = 0;
-}
-
-
-IndexSet* IndexSet_Duplicate( void* indexSet ) {
-	IndexSet*	self = (IndexSet*)indexSet;
-	IndexSet*	newSelf = 0;
-	
-	if( self  ) {
-		newSelf = _IndexSet_New( self->_sizeOfSelf, self->type, self->_delete, self->_print, NULL, self->_duplicate, self->size );
-		self->_duplicate( self, newSelf );
-	}
-	return newSelf;
-}
-
-
-void _IndexSet_Duplicate( void* indexSet, void* newIndexSet ){
-	/* self->containerSize and self->container are set by _IndexSet_Init */
-	IndexSet*	self = (IndexSet*)indexSet;
-	IndexSet*	newSet = (IndexSet*)newIndexSet;
-	memcpy( ((IndexSet*)newIndexSet)->_container, ((IndexSet*)indexSet)->_container, sizeof(char)*((IndexSet*)indexSet)->_containerSize );
-	newSet->membersCount = self->membersCount;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/IndexSet.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/IndexSet.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,396 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IndexSet.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "units.h"
+#include "types.h"
+#include "IndexSet.h"
+
+#include <mpi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Textual name of this class */
+const Type IndexSet_Type = "IndexSet";
+
+/** Macro to calculate container membership */
+#define IS_MEMBER( indexSet, index ) \
+	((indexSet)->_container[(index) / (sizeof(char) * 8 )] & (1 << ((index) % (sizeof(char) * 8))))
+
+IndexSet* IndexSet_New( IndexSet_Index size ) {
+	/* Variables set in this function */
+	SizeT                        _sizeOfSelf = sizeof(IndexSet);
+	Type                                type = IndexSet_Type;
+	Stg_Class_DeleteFunction*        _delete = _IndexSet_Delete;
+	Stg_Class_PrintFunction*          _print = _IndexSet_Print;
+	Stg_Class_CopyFunction*            _copy = _IndexSet_Copy;
+	IndexSet_DuplicateFunction*   _duplicate = _IndexSet_Duplicate;
+
+	return _IndexSet_New(  INDEXSET_PASSARGS  );
+}
+
+void IndexSet_Init( IndexSet* self, IndexSet_Index size ) {
+	/* General info */
+	self->type = IndexSet_Type;
+	self->_sizeOfSelf = sizeof(IndexSet);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _IndexSet_Delete;
+	self->_print = _IndexSet_Print;
+	self->_copy = _IndexSet_Copy;
+	self->_duplicate = _IndexSet_Duplicate;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* IndexSet info */
+	_IndexSet_Init( self, size );
+}
+
+
+IndexSet* _IndexSet_New(  INDEXSET_DEFARGS  )
+{
+	IndexSet* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(IndexSet) );
+	self = (IndexSet*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	self->_duplicate = _duplicate;
+	
+	/* IndexSet info */
+	_IndexSet_Init( self, size );
+	
+	return self;
+}
+
+
+void _IndexSet_Init( IndexSet* self, IndexSet_Index size ) {
+	/* General and Virtual info should already be set */
+	
+	/* IndexSet info */
+	self->size = size;
+	self->_containerSize = self->size / (sizeof(char) * 8) + (self->size % (sizeof(char) * 8) ? 1 : 0);
+	self->_container = Memory_Alloc_Array( BitField, self->_containerSize, "IndexSet->_container");
+	memset( self->_container, 0, sizeof(char) * self->_containerSize );
+	self->membersCount = 0;
+	self->error = Journal_Register( ErrorStream_Type, self->type );
+}
+
+
+void _IndexSet_Delete( void* indexSet ) {
+	IndexSet* self = (IndexSet*)indexSet;
+	
+	if( self->_container ) {
+		Memory_Free( self->_container );
+	}
+	
+	/* Stg_Class_Delete parent class */
+	_Stg_Class_Delete( self );
+}
+
+
+void _IndexSet_Print( void* indexSet, Stream* stream ) {
+	IndexSet* self = (IndexSet*)indexSet;
+	
+	/* Set the Journal for printing informations */
+	Stream* indexSetStream = Journal_Register( InfoStream_Type, "IndexSetStream");
+	
+	/* General info */
+	Journal_Printf( indexSetStream, "IndexSet (%p):\n", self );
+	
+	/* Virtual info */
+	
+	/* IndexSet */
+	Journal_Printf( indexSetStream, "\tsize: %u\n", self->size );
+	Journal_Printf( indexSetStream, "\t_containerSize: %lu\n", self->_containerSize );
+	Journal_Printf( indexSetStream, "\t_container: %p\n", self->_container );
+
+	if( self->_container ) {
+		IndexSet_Index		index_I;
+		
+		for( index_I = 0; index_I < self->size; index_I++ ) {
+			Index			containerIndex;
+			char			indexMask;
+			
+			containerIndex = index_I / (sizeof(char) * 8);
+			indexMask = 1 << (index_I % (sizeof(char) * 8));
+			
+			if( self->_container[containerIndex] & indexMask ) {
+				Journal_Printf( indexSetStream, "\t\tindex %u: In set.\n", index_I );
+			}
+			else {
+				Journal_Printf( indexSetStream, "\t\tindex %u: Not in set.\n", index_I );
+			}
+		}
+	}
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+}
+
+
+void* _IndexSet_Copy( const void* indexSet, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	IndexSet*	self = (IndexSet*)indexSet;
+	IndexSet*	newIndexSet;
+	
+	newIndexSet = (IndexSet*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	/* Virtual methods */
+	newIndexSet->_duplicate = self->_duplicate;
+	
+	newIndexSet->size = self->size;
+	newIndexSet->_containerSize = self->_containerSize;
+	newIndexSet->_container = Memory_Alloc_Array( char, newIndexSet->_containerSize, "IndexSet->_container" );
+	memcpy( newIndexSet->_container, self->_container, sizeof(char) * newIndexSet->_containerSize );
+	newIndexSet->membersCount = self->membersCount;
+	newIndexSet->error = self->error;
+	
+	return (void*)newIndexSet;
+}
+
+
+void IndexSet_Add( void* indexSet, Index index ) {
+	IndexSet* self = (IndexSet*)indexSet;
+
+	#ifdef CAUTIOUS
+		Journal_Firewall( index < self->size, self->error, "Error- %s: index %u outside current size %d. Aborting.\n",
+			__func__, index, self->size);
+	#endif
+	
+	self->_container[index / (sizeof(char) * 8)] |= (1 << (index % (sizeof(char) * 8)));
+	self->membersCount = (unsigned)-1;
+}
+
+
+void IndexSet_Remove( void* indexSet, Index index ) {
+	IndexSet* self = (IndexSet*)indexSet;
+
+	#ifdef CAUTIOUS
+		Journal_Firewall( index < self->size, self->error, "Error- %s: index %u outside current size %d. Aborting.\n",
+			__func__, index, self->size);
+	#endif
+	
+	self->_container[index / (sizeof(char) * 8)] &= ~(1 << (index % (sizeof(char) * 8)));
+	self->membersCount = (unsigned)-1;
+}
+
+Bool IndexSet_IsMember( void* indexSet, Index index ) {
+	IndexSet* self = (IndexSet*)indexSet;
+	Bool retFlag = False;
+
+	#ifdef CAUTIOUS
+		Journal_Firewall( index < self->size, self->error, "Error- %s: index %u outside current size %d. Aborting.\n",
+			__func__, index, self->size);
+	#endif
+	
+	if ( 0 == IS_MEMBER( self, index ) ) {
+		retFlag = False;
+	}
+	else {
+		retFlag = True;
+	}
+	
+	return retFlag;
+}
+
+
+IndexSet_Index IndexSet_GetIndexOfNthMember( void* indexSet, const Index nthMember ) {
+	IndexSet*		self = (IndexSet*)indexSet;
+	Index		membersSoFar = 0;
+	IndexSet_Index	index_I;
+	
+	for( index_I = 0; index_I < self->size; index_I++ ) {
+		if( IS_MEMBER( self, index_I ) ) {
+			if ( nthMember == membersSoFar ) {
+				return index_I;
+			}
+			membersSoFar++;
+		}
+	}
+
+	return IndexSet_Invalid( self );
+}
+
+
+IndexSet_Index IndexSet_UpdateMembersCount( void* indexSet ) {
+	IndexSet*		self = (IndexSet*)indexSet;
+	IndexSet_Index		index_I;
+
+	if (self->membersCount == (unsigned)-1 ) {
+		self->membersCount = 0;
+		for( index_I = 0; index_I < self->size; index_I++ ) {
+			if( IS_MEMBER( self, index_I ) ) {
+				self->membersCount++;
+			}
+		}
+	}
+
+	return self->membersCount;
+}
+
+
+void IndexSet_GetMembers( void* indexSet, IndexSet_Index* countPtr, Index** arrayPtr ) {
+	IndexSet*		self = (IndexSet*)indexSet;
+	
+	*countPtr = IndexSet_UpdateMembersCount( self );
+	if( *countPtr ) {
+		*arrayPtr = Memory_Alloc_Array( Index, (*countPtr), "IndexSet members" );
+		IndexSet_GetMembers2( self, *arrayPtr );
+	}
+	else {
+		*arrayPtr = NULL;
+	}
+}	
+
+
+void IndexSet_GetMembers2( void* indexSet, Index* const array ) {
+	IndexSet*		self = (IndexSet*)indexSet;
+	IndexSet_Index		index_I;
+	unsigned int		array_I;
+
+	for( array_I = 0, index_I = 0; index_I < self->size; index_I++ ) {
+		if( IS_MEMBER( self, index_I ) ) {
+			array[array_I] = index_I;
+			array_I++;
+		}
+	}
+}
+
+
+void IndexSet_GetVacancies( void* indexSet, IndexSet_Index* countPtr, Index** arrayPtr ) {
+	IndexSet*		self = (IndexSet*)indexSet;
+	IndexSet_Index		index_I;
+	unsigned int		array_I;
+
+	IndexSet_UpdateMembersCount( self );
+	*countPtr = self->size - self->membersCount;
+	
+	*arrayPtr = Memory_Alloc_Array( Index, (*countPtr), "IndexSet vacancies" );
+	for( array_I = 0, index_I = 0; index_I < self->size; index_I++ ) {
+		if( !IS_MEMBER( self, index_I) ) {
+			(*arrayPtr)[array_I] = index_I;
+			array_I++;
+		}
+	}
+}
+
+
+void IndexSet_Merge_OR(void* indexSet, void* indexSetTwo )
+{
+	IndexSet*	self = (IndexSet*)indexSet;
+	IndexSet*	secondSet = (IndexSet*)indexSetTwo;
+	Index		size;
+	Index		i;
+	
+	size = self->size <= secondSet->size ? self->_containerSize : secondSet->_containerSize;
+	
+	for (i = 0; i < size; i++)
+		self->_container[i] |= secondSet->_container[i];
+	
+	self->membersCount = (unsigned int)-1;
+}
+
+
+void IndexSet_Merge_AND(void* indexSet, void* indexSetTwo )
+{
+	IndexSet*	self = (IndexSet*)indexSet;
+	IndexSet*	secondSet = (IndexSet*)indexSetTwo;
+	Index		size;
+	Index		i;
+	
+	size = self->size <= secondSet->size ? self->_containerSize : secondSet->_containerSize;
+	
+	for (i = 0; i < size; i++)
+		self->_container[i] &= secondSet->_container[i];
+
+	/* As specified in header file description, if first given IndexSet is larger, zero out the
+	 * remaining entries since this is an AND operation */
+	for( i = size; i < self->_containerSize; i++) {
+		self->_container[i] &= 0x00;
+	}
+	
+	self->membersCount = (unsigned int)-1;
+}
+
+
+void IndexSet_AddAll( void* indexSet )
+{
+	IndexSet*	self = (IndexSet*)indexSet;
+	Index		i;
+	
+	for( i = 0; i < self->_containerSize; i++)
+		self->_container[i] |= -1;
+
+	self->membersCount = self->size;
+}
+
+
+void IndexSet_RemoveAll( void* indexSet )
+{
+	IndexSet*	self = (IndexSet*)indexSet;
+	Index		i;
+	
+	for( i = 0; i < self->_containerSize; i++)
+		self->_container[i] &= 0x00;
+
+	self->membersCount = 0;
+}
+
+
+IndexSet* IndexSet_Duplicate( void* indexSet ) {
+	IndexSet*	self = (IndexSet*)indexSet;
+	IndexSet*	newSelf = 0;
+	
+	if( self  ) {
+		newSelf = _IndexSet_New( self->_sizeOfSelf, self->type, self->_delete, self->_print, NULL, self->_duplicate, self->size );
+		self->_duplicate( self, newSelf );
+	}
+	return newSelf;
+}
+
+
+void _IndexSet_Duplicate( void* indexSet, void* newIndexSet ){
+	/* self->containerSize and self->container are set by _IndexSet_Init */
+	IndexSet*	self = (IndexSet*)indexSet;
+	IndexSet*	newSet = (IndexSet*)newIndexSet;
+	memcpy( ((IndexSet*)newIndexSet)->_container, ((IndexSet*)indexSet)->_container, sizeof(char)*((IndexSet*)indexSet)->_containerSize );
+	newSet->membersCount = self->membersCount;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Init.c
--- a/Base/Container/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "units.h"
-#include "types.h"
-#include "Init.h"
-
-#include <stdio.h>
-
-Bool BaseContainer_Init( int* argc, char** argv[] ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,47 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "units.h"
+#include "types.h"
+#include "Init.h"
+
+#include <stdio.h>
+
+Bool BaseContainer_Init( int* argc, char** argv[] ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Iter.c
--- a/Base/Container/src/Iter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Iter.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <assert.h>
-#include "Base/Foundation/Foundation.h"
-#include "types.h"
-#include "Iter.h"
-#include "Base/Foundation/ClassDef.h"
-
-
-void _Iter_Init( void* self ) {
-   _NewClass_Init( self );
-   ((Iter*)self)->valid = False;
-}
-
-void _Iter_Copy( void* self, const void* op ) {
-   assert( self && op );
-   ((Iter*)self)->valid = ((Iter*)op)->valid;
-}
-
-Bool Iter_IsValid( void* self ) {
-  assert( self );
-  return ((Iter*)self)->valid;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Iter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/Iter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,55 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Iter.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <assert.h>
+#include "Base/Foundation/Foundation.h"
+#include "types.h"
+#include "Iter.h"
+#include "Base/Foundation/ClassDef.h"
+
+
+void _Iter_Init( void* self ) {
+   _NewClass_Init( self );
+   ((Iter*)self)->valid = False;
+}
+
+void _Iter_Copy( void* self, const void* op ) {
+   assert( self && op );
+   ((Iter*)self)->valid = ((Iter*)op)->valid;
+}
+
+Bool Iter_IsValid( void* self ) {
+  assert( self );
+  return ((Iter*)self)->valid;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/LinkedList.c
--- a/Base/Container/src/LinkedList.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,381 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: List.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "LinkedListNode.h"
-#include "LinkedList.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type LinkedList_Type = "LinkedList";
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-LinkedList* _LinkedList_New(  LINKEDLIST_DEFARGS  )
-{
-	LinkedList *self = NULL;
-
-	self = (LinkedList*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	return self;
-}
-
-LinkedList* LinkedList_New( 
-		LinkedList_compareFunction*		compareFunction,
-		LinkedList_dataCopyFunction*	dataCopyFunction,
-		LinkedList_dataPrintFunction*	dataPrintFunction,
-		LinkedList_dataDeleteFunction*	dataDeleteFunction,
-		Order listOrder )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(LinkedList);
-	Type                              type = LinkedList_Type;
-	Stg_Class_DeleteFunction*      _delete = _LinkedList_DeleteFunc;
-	Stg_Class_PrintFunction*        _print = _LinkedList_PrintFunc;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	
-	LinkedList* self;
-	
-	/* General info */
-	assert ( compareFunction );
-	
-	self = _LinkedList_New(  LINKEDLIST_PASSARGS  );
-
-	/* List info */
-	self->compareFunction = compareFunction;
-	self->dataCopyFunction = dataCopyFunction;
-	self->dataPrintFunction = dataPrintFunction;
-	self->dataDeleteFunction = dataDeleteFunction;
-	self->listOrder = listOrder;
-	
-	/* Virtual functions */
-	LinkedList_Init( self );
-	return self;
-}
-
-void _LinkedList_Init( LinkedList* self ){
-	/* General info */
-	
-	assert( self );
-	_Stg_Class_Init ((Stg_Class*) self);
-	
-	self->head = NULL;
-	self->nodeCount = 0;
-	/* Dictionary info */
-}
-
-void LinkedList_Init( LinkedList *self )
-{
-	assert( self );
-	_LinkedList_Init (self);
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual Functions
-*/
-void _LinkedList_PrintFunc ( void *list, Stream *stream )
-{
-	LinkedList *self = NULL;
-	
-	self = (LinkedList*) list;
-	assert( self );
-	assert( stream );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) self, stream );
-
-	/* general info */
-	Journal_Printf( stream, "LinkedList (ptr): (%p)\n", self );
-
-	/* Virtual Info */
-
-	/* LinkedList Info */
-	Journal_Printf( stream, "\tNodeCount\t\t - %d\n", self->nodeCount );
-	Journal_Printf( stream, "\tLinkedList Order\t - %s\n", (self->listOrder == LINKEDLIST_SORTED)?"SORTED":"UNSORTED" );
-	
-	Journal_Printf( stream, "\tLinkedList data\t - \n");
-	if (self->dataPrintFunction)
-		LinkedList_ParseList( self, (LinkedList_parseFunction*)self->dataPrintFunction, (void*)stream );
-}
-
-int LinkedList_DeleteAllNodes( LinkedList *list )
-{
-	LinkedList *self = NULL;
-	LinkedListNode *curr = NULL, *temp = NULL;
-
-	self = (LinkedList*)list;
-	assert (self);
-
-	curr = self->head;
-	while (curr != NULL){
-		temp = curr->next;
-
-		if (self->dataDeleteFunction){
-			self->dataDeleteFunction( curr->data );
-		}
-		else{
-			Memory_Free(curr->data);
-		}
-		Memory_Free( curr ); /** Freeing the Node without calling the Stg_Class_Delete function, because LinkedList_Node does not inherit __Stg_Class */
-		
-		curr = temp;
-		--self->nodeCount;
-	}
-	self->head = NULL;
-
-	return 0;
-}
-
-void _LinkedList_DeleteFunc( void *list )
-{
-	LinkedList *self = NULL;
-	
-	self = (LinkedList*)list;
-	assert (self);
-	
-	LinkedList_DeleteAllNodes( self );
-	
-	_Stg_Class_Delete( self );
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-void LinkedList_InsertNode ( LinkedList *list, void *newNodeData, SizeT dataSize)
-{
-	LinkedListNode *curr = NULL, *prev = NULL;
-	LinkedListNode *newNode = NULL;
-	
-	assert (list);
-	
-	newNode = LinkedListNode_New();
-	if(list->dataCopyFunction){
-		list->dataCopyFunction(&newNode->data, newNodeData, dataSize);
-	}
-	else{
-		newNode->data = newNodeData;
-	}
-
-	if( list->listOrder == LINKEDLIST_SORTED ){
-		curr = list->head;
-		prev = NULL;
-		while(curr != NULL){
-			if (list->compareFunction(newNodeData, curr->data) < 0){
-				break;
-			}
-			prev = curr;
-			curr = curr->next;
-		}
-		
-		if (prev == NULL){
-			newNode->next = list->head;
-			list->head = newNode;
-		}
-		else {
-			prev->next = newNode;
-			newNode->next = curr;
-		}
-	}
-	else{
-		if (list->head == NULL){
-			list->head = newNode;
-		}
-		else{
-			newNode->next = list->head;
-			list->head = newNode;
-		}
-	}
-	++list->nodeCount;
-}
-
-LinkedListNode *LinkedList_FindNode( LinkedList *list, void *data )
-{
-	LinkedListNode *curr = NULL;
-
-	assert (list);
-
-	curr = list->head;
-
-	while(curr != NULL){
-		if (list->compareFunction(curr->data, data) == 0){
-			return curr;
-		}
-		curr = curr->next;
-	}
-	return NULL;
-}
-
-int LinkedList_DeleteNode( LinkedList *list, void *nodeData )
-{
-	LinkedListNode *curr = NULL, *prev = NULL, *targetNode = NULL;
-	
-
-	assert (list);
-
-	curr = list->head;
-	prev = NULL;
-	while(curr != NULL){
-		if (curr->data && nodeData){
-			if (list->compareFunction(curr->data, nodeData) == 0){
-				targetNode = curr;
-				break;
-			}
-		}
-		prev = curr;
-		curr = curr->next;
-	}
-
-	if (targetNode != NULL){
-		if (list->dataDeleteFunction){
-			list->dataDeleteFunction(targetNode->data);
-		}
-		else{
-			Memory_Free(targetNode->data);
-		}
-
-		if(prev == NULL){
-			list->head = targetNode->next;
-		}
-		else{
-			prev->next = targetNode->next;
-		}
-		
-		Memory_Free(targetNode);
-		--list->nodeCount;
-		return 1;
-	}
-	else{
-		
-	}
-
-	return 0;
-}
-
-void LinkedList_ParseList( LinkedList *list, LinkedList_parseFunction *parseFunction, void *args )
-{
-	LinkedListNode *curr;
-
-	assert(list);
-	assert(parseFunction);
-
-	curr = list->head;
-	while(curr != NULL){
-		parseFunction(curr->data, args);
-		curr = curr->next;
-	}
-}
-
-char* LinkedList_ReturnArrayFunc( LinkedList *list, SizeT dataSize )
-{
-	LinkedListNode *curr = NULL;
-	char *array = NULL;
-	int counter = 0;
-
-	assert( list );
-	
-	array = Memory_Alloc_Array_Unnamed(char, list->nodeCount * dataSize );
-	assert( array );
-	
-	curr = list->head;
-	while(curr != NULL){
-		memcpy(&array[(counter++)*dataSize], curr->data, dataSize);
-		curr = curr->next;
-	}
-
-	return array;
-}
-
-void LinkedList_SetCompareFunction ( LinkedList *list, LinkedList_compareFunction *compareFunction )
-{
-	assert (list);
-	assert (compareFunction);
-
-	list->compareFunction = compareFunction;
-}
-
-void LinkedList_ParseListNode( LinkedListNode *root, LinkedList_parseFunction *parseFunction, void *args )
-{
-	LinkedListNode *curr;
-
-	assert(root);
-	assert(parseFunction);
-
-	curr = root;
-	while(curr != NULL){
-		parseFunction(curr->data, args);
-		curr = curr->next;
-	}
-}
-
-void *LinkedList_FindNodeDataFunc( LinkedList *list, void *data )
-{
-	LinkedListNode *curr = NULL;
-
-	assert (list);
-
-	curr = list->head;
-
-	while(curr != NULL){
-		if (list->compareFunction(curr->data, data) == 0){
-			return curr->data;
-		}
-		curr = curr->next;
-	}
-	return NULL;
-}
-
-void *LinkedList_ReturnNodeDataAtFunc( LinkedList *list, int index )
-{
-	LinkedListNode *curr = NULL;
-	int nodeIndex = 0;
-
-	assert (list);
-
-	curr = list->head;
-
-	while(curr != NULL){
-		
-		if (index == nodeIndex++){
-			return curr->data;
-		}
-		else if (nodeIndex > index){
-			break;
-		}
-		curr = curr->next;
-	}
-	return NULL;
-}
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/LinkedList.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/LinkedList.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,381 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: List.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "LinkedListNode.h"
+#include "LinkedList.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type LinkedList_Type = "LinkedList";
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+LinkedList* _LinkedList_New(  LINKEDLIST_DEFARGS  )
+{
+	LinkedList *self = NULL;
+
+	self = (LinkedList*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	return self;
+}
+
+LinkedList* LinkedList_New( 
+		LinkedList_compareFunction*		compareFunction,
+		LinkedList_dataCopyFunction*	dataCopyFunction,
+		LinkedList_dataPrintFunction*	dataPrintFunction,
+		LinkedList_dataDeleteFunction*	dataDeleteFunction,
+		Order listOrder )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(LinkedList);
+	Type                              type = LinkedList_Type;
+	Stg_Class_DeleteFunction*      _delete = _LinkedList_DeleteFunc;
+	Stg_Class_PrintFunction*        _print = _LinkedList_PrintFunc;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	
+	LinkedList* self;
+	
+	/* General info */
+	assert ( compareFunction );
+	
+	self = _LinkedList_New(  LINKEDLIST_PASSARGS  );
+
+	/* List info */
+	self->compareFunction = compareFunction;
+	self->dataCopyFunction = dataCopyFunction;
+	self->dataPrintFunction = dataPrintFunction;
+	self->dataDeleteFunction = dataDeleteFunction;
+	self->listOrder = listOrder;
+	
+	/* Virtual functions */
+	LinkedList_Init( self );
+	return self;
+}
+
+void _LinkedList_Init( LinkedList* self ){
+	/* General info */
+	
+	assert( self );
+	_Stg_Class_Init ((Stg_Class*) self);
+	
+	self->head = NULL;
+	self->nodeCount = 0;
+	/* Dictionary info */
+}
+
+void LinkedList_Init( LinkedList *self )
+{
+	assert( self );
+	_LinkedList_Init (self);
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual Functions
+*/
+void _LinkedList_PrintFunc ( void *list, Stream *stream )
+{
+	LinkedList *self = NULL;
+	
+	self = (LinkedList*) list;
+	assert( self );
+	assert( stream );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) self, stream );
+
+	/* general info */
+	Journal_Printf( stream, "LinkedList (ptr): (%p)\n", self );
+
+	/* Virtual Info */
+
+	/* LinkedList Info */
+	Journal_Printf( stream, "\tNodeCount\t\t - %d\n", self->nodeCount );
+	Journal_Printf( stream, "\tLinkedList Order\t - %s\n", (self->listOrder == LINKEDLIST_SORTED)?"SORTED":"UNSORTED" );
+	
+	Journal_Printf( stream, "\tLinkedList data\t - \n");
+	if (self->dataPrintFunction)
+		LinkedList_ParseList( self, (LinkedList_parseFunction*)self->dataPrintFunction, (void*)stream );
+}
+
+int LinkedList_DeleteAllNodes( LinkedList *list )
+{
+	LinkedList *self = NULL;
+	LinkedListNode *curr = NULL, *temp = NULL;
+
+	self = (LinkedList*)list;
+	assert (self);
+
+	curr = self->head;
+	while (curr != NULL){
+		temp = curr->next;
+
+		if (self->dataDeleteFunction){
+			self->dataDeleteFunction( curr->data );
+		}
+		else{
+			Memory_Free(curr->data);
+		}
+		Memory_Free( curr ); /** Freeing the Node without calling the Stg_Class_Delete function, because LinkedList_Node does not inherit __Stg_Class */
+		
+		curr = temp;
+		--self->nodeCount;
+	}
+	self->head = NULL;
+
+	return 0;
+}
+
+void _LinkedList_DeleteFunc( void *list )
+{
+	LinkedList *self = NULL;
+	
+	self = (LinkedList*)list;
+	assert (self);
+	
+	LinkedList_DeleteAllNodes( self );
+	
+	_Stg_Class_Delete( self );
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+void LinkedList_InsertNode ( LinkedList *list, void *newNodeData, SizeT dataSize)
+{
+	LinkedListNode *curr = NULL, *prev = NULL;
+	LinkedListNode *newNode = NULL;
+	
+	assert (list);
+	
+	newNode = LinkedListNode_New();
+	if(list->dataCopyFunction){
+		list->dataCopyFunction(&newNode->data, newNodeData, dataSize);
+	}
+	else{
+		newNode->data = newNodeData;
+	}
+
+	if( list->listOrder == LINKEDLIST_SORTED ){
+		curr = list->head;
+		prev = NULL;
+		while(curr != NULL){
+			if (list->compareFunction(newNodeData, curr->data) < 0){
+				break;
+			}
+			prev = curr;
+			curr = curr->next;
+		}
+		
+		if (prev == NULL){
+			newNode->next = list->head;
+			list->head = newNode;
+		}
+		else {
+			prev->next = newNode;
+			newNode->next = curr;
+		}
+	}
+	else{
+		if (list->head == NULL){
+			list->head = newNode;
+		}
+		else{
+			newNode->next = list->head;
+			list->head = newNode;
+		}
+	}
+	++list->nodeCount;
+}
+
+LinkedListNode *LinkedList_FindNode( LinkedList *list, void *data )
+{
+	LinkedListNode *curr = NULL;
+
+	assert (list);
+
+	curr = list->head;
+
+	while(curr != NULL){
+		if (list->compareFunction(curr->data, data) == 0){
+			return curr;
+		}
+		curr = curr->next;
+	}
+	return NULL;
+}
+
+int LinkedList_DeleteNode( LinkedList *list, void *nodeData )
+{
+	LinkedListNode *curr = NULL, *prev = NULL, *targetNode = NULL;
+	
+
+	assert (list);
+
+	curr = list->head;
+	prev = NULL;
+	while(curr != NULL){
+		if (curr->data && nodeData){
+			if (list->compareFunction(curr->data, nodeData) == 0){
+				targetNode = curr;
+				break;
+			}
+		}
+		prev = curr;
+		curr = curr->next;
+	}
+
+	if (targetNode != NULL){
+		if (list->dataDeleteFunction){
+			list->dataDeleteFunction(targetNode->data);
+		}
+		else{
+			Memory_Free(targetNode->data);
+		}
+
+		if(prev == NULL){
+			list->head = targetNode->next;
+		}
+		else{
+			prev->next = targetNode->next;
+		}
+		
+		Memory_Free(targetNode);
+		--list->nodeCount;
+		return 1;
+	}
+	else{
+		
+	}
+
+	return 0;
+}
+
+void LinkedList_ParseList( LinkedList *list, LinkedList_parseFunction *parseFunction, void *args )
+{
+	LinkedListNode *curr;
+
+	assert(list);
+	assert(parseFunction);
+
+	curr = list->head;
+	while(curr != NULL){
+		parseFunction(curr->data, args);
+		curr = curr->next;
+	}
+}
+
+char* LinkedList_ReturnArrayFunc( LinkedList *list, SizeT dataSize )
+{
+	LinkedListNode *curr = NULL;
+	char *array = NULL;
+	int counter = 0;
+
+	assert( list );
+	
+	array = Memory_Alloc_Array_Unnamed(char, list->nodeCount * dataSize );
+	assert( array );
+	
+	curr = list->head;
+	while(curr != NULL){
+		memcpy(&array[(counter++)*dataSize], curr->data, dataSize);
+		curr = curr->next;
+	}
+
+	return array;
+}
+
+void LinkedList_SetCompareFunction ( LinkedList *list, LinkedList_compareFunction *compareFunction )
+{
+	assert (list);
+	assert (compareFunction);
+
+	list->compareFunction = compareFunction;
+}
+
+void LinkedList_ParseListNode( LinkedListNode *root, LinkedList_parseFunction *parseFunction, void *args )
+{
+	LinkedListNode *curr;
+
+	assert(root);
+	assert(parseFunction);
+
+	curr = root;
+	while(curr != NULL){
+		parseFunction(curr->data, args);
+		curr = curr->next;
+	}
+}
+
+void *LinkedList_FindNodeDataFunc( LinkedList *list, void *data )
+{
+	LinkedListNode *curr = NULL;
+
+	assert (list);
+
+	curr = list->head;
+
+	while(curr != NULL){
+		if (list->compareFunction(curr->data, data) == 0){
+			return curr->data;
+		}
+		curr = curr->next;
+	}
+	return NULL;
+}
+
+void *LinkedList_ReturnNodeDataAtFunc( LinkedList *list, int index )
+{
+	LinkedListNode *curr = NULL;
+	int nodeIndex = 0;
+
+	assert (list);
+
+	curr = list->head;
+
+	while(curr != NULL){
+		
+		if (index == nodeIndex++){
+			return curr->data;
+		}
+		else if (nodeIndex > index){
+			break;
+		}
+		curr = curr->next;
+	}
+	return NULL;
+}
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/LinkedListIterator.c
--- a/Base/Container/src/LinkedListIterator.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: LinkedListIterator.c 2038 2005-04-16 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "LinkedListNode.h"
-#include "LinkedList.h"
-#include "LinkedListIterator.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type LinkedListIterator_Type = "LinkedListIterator";
-
-LinkedListIterator *_LinkedListIterator_New(  LINKEDLISTITERATOR_DEFARGS  )
-{
-	LinkedListIterator *self = NULL;
-
-	/** LinkedListIterator using Class_New, because  Memory module has been initialized */
-	
-	self = (LinkedListIterator*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	return self;
-}
-
-LinkedListIterator *LinkedListIterator_New( LinkedList *list )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(LinkedListIterator);
-	Type                              type = LinkedListIterator_Type;
-	Stg_Class_DeleteFunction*      _delete = _LinkedListIterator_DeleteFunc;
-	Stg_Class_PrintFunction*        _print = _LinkedListIterator_PrintFunc;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	
-	LinkedListIterator* self;
-	
-	assert( list );
-	self = _LinkedListIterator_New(  LINKEDLISTITERATOR_PASSARGS  );
-	/* General info */
-	
-	/* Virtual functions */
-	assert( list );
-	self->list = list;
-	
-	_LinkedListIterator_Init( self );	
-	return self;
-}
-
-void _LinkedListIterator_Init( LinkedListIterator* self )
-{
-
-}
-
-void _LinkedListIterator_DeleteFunc( void *self )
-{
-	if( self ){
-		_Stg_Class_Delete( self );
-	}
-}
-
-void _LinkedListIterator_PrintFunc( void *self, Stream *myStream )
-{
-	LinkedListIterator *iterator = NULL;
-
-	iterator = (LinkedListIterator*) self;
-	assert( iterator );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) iterator, myStream );
-
-	/* general info */
-	Journal_Printf( myStream, "LinkedListIterator (ptr): (%p)\n", iterator );
-	Journal_Printf( myStream, "\tlist (ptr): (%p)\n", iterator->list );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/LinkedListIterator.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/LinkedListIterator.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,107 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: LinkedListIterator.c 2038 2005-04-16 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "LinkedListNode.h"
+#include "LinkedList.h"
+#include "LinkedListIterator.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type LinkedListIterator_Type = "LinkedListIterator";
+
+LinkedListIterator *_LinkedListIterator_New(  LINKEDLISTITERATOR_DEFARGS  )
+{
+	LinkedListIterator *self = NULL;
+
+	/** LinkedListIterator using Class_New, because  Memory module has been initialized */
+	
+	self = (LinkedListIterator*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	return self;
+}
+
+LinkedListIterator *LinkedListIterator_New( LinkedList *list )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(LinkedListIterator);
+	Type                              type = LinkedListIterator_Type;
+	Stg_Class_DeleteFunction*      _delete = _LinkedListIterator_DeleteFunc;
+	Stg_Class_PrintFunction*        _print = _LinkedListIterator_PrintFunc;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	
+	LinkedListIterator* self;
+	
+	assert( list );
+	self = _LinkedListIterator_New(  LINKEDLISTITERATOR_PASSARGS  );
+	/* General info */
+	
+	/* Virtual functions */
+	assert( list );
+	self->list = list;
+	
+	_LinkedListIterator_Init( self );	
+	return self;
+}
+
+void _LinkedListIterator_Init( LinkedListIterator* self )
+{
+
+}
+
+void _LinkedListIterator_DeleteFunc( void *self )
+{
+	if( self ){
+		_Stg_Class_Delete( self );
+	}
+}
+
+void _LinkedListIterator_PrintFunc( void *self, Stream *myStream )
+{
+	LinkedListIterator *iterator = NULL;
+
+	iterator = (LinkedListIterator*) self;
+	assert( iterator );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) iterator, myStream );
+
+	/* general info */
+	Journal_Printf( myStream, "LinkedListIterator (ptr): (%p)\n", iterator );
+	Journal_Printf( myStream, "\tlist (ptr): (%p)\n", iterator->list );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/LinkedListNode.c
--- a/Base/Container/src/LinkedListNode.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ListNode.c 2038 2005-2-25 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "LinkedListNode.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type LinkedListNode_Type = "LinkedListNode";
-
-LinkedListNode* LinkedListNode_New( void )
-{
-	LinkedListNode* self;
-	
-	/* Allocate memory */
-	self = Memory_Alloc( LinkedListNode, "LinkedListNode" );
-	memset ( self, 0, sizeof ( LinkedListNode ) );
-
-	assert( self );
-	/* General info */
-	
-	/* Virtual functions */
-	
-	self->next = NULL;
-	_LinkedListNode_Init( self );
-	
-	return self;
-}
-
-void _LinkedListNode_Init( LinkedListNode* self ){
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* ListNode info */
-		assert( self );
-	self->data = NULL;
-	self->sizeOfData = 0;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/LinkedListNode.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/LinkedListNode.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,75 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ListNode.c 2038 2005-2-25 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "LinkedListNode.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type LinkedListNode_Type = "LinkedListNode";
+
+LinkedListNode* LinkedListNode_New( void )
+{
+	LinkedListNode* self;
+	
+	/* Allocate memory */
+	self = Memory_Alloc( LinkedListNode, "LinkedListNode" );
+	memset ( self, 0, sizeof ( LinkedListNode ) );
+
+	assert( self );
+	/* General info */
+	
+	/* Virtual functions */
+	
+	self->next = NULL;
+	_LinkedListNode_Init( self );
+	
+	return self;
+}
+
+void _LinkedListNode_Init( LinkedListNode* self ){
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* ListNode info */
+		assert( self );
+	self->data = NULL;
+	self->sizeOfData = 0;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/List.c
--- a/Base/Container/src/List.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: List.c 3584 2006-05-16 11:11:07Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "types.h"
-#include "List.h"
-
-
-/* Textual name of this class */
-const Type List_Type = "List";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-List* List_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(List);
-	Type                              type = List_Type;
-	Stg_Class_DeleteFunction*      _delete = _List_Delete;
-	Stg_Class_PrintFunction*        _print = _List_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return _List_New(  LIST_PASSARGS  );
-}
-
-List* _List_New(  LIST_DEFARGS  ) {
-	List*	self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(List) );
-	self = (List*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	/* Virtual info */
-
-	/* List info */
-	_List_Init( self );
-
-	return self;
-}
-
-void _List_Init( List* self ) {
-	self->nItems = 0;
-	self->items = NULL;
-	self->itemSize = 0;
-	self->maxItems = 0;
-	self->delta = 10;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _List_Delete( void* list ) {
-	List*	self = (List*)list;
-
-	List_Destruct( self );
-
-	/* Delete the parent. */
-	_Stg_Class_Delete( self );
-}
-
-void _List_Print( void* list, Stream* stream ) {
-	List*	self = (List*)list;
-	
-	/* Set the Journal for printing informations */
-	Stream* listStream;
-	listStream = Journal_Register( InfoStream_Type, "ListStream" );
-
-	/* Print parent */
-	Journal_Printf( stream, "List (ptr): (%p)\n", self );
-	_Stg_Class_Print( self, stream );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void List_SetDelta( void* list, unsigned delta ) {
-	List*	self = (List*)list;
-
-	assert( self );
-	assert( delta );
-
-	self->delta = delta;
-}
-
-void List_SetItemSize( void* list, unsigned itemSize ) {
-	List*	self = (List*)list;
-
-	assert( self );
-	assert( itemSize );
-
-	List_Destruct( self );
-
-	self->itemSize = itemSize;
-}
-
-void List_Clear( void* list ) {
-	List*	self = (List*)list;
-
-	assert( self );
-
-	self->nItems = 0;
-	KillArray( self->items );
-	self->maxItems = 0;
-}
-
-void List_Insert( void* list, unsigned index, void* data ) {
-	List*		self = (List*)list;
-	unsigned	item_i;
-
-	assert( self );
-	assert( index <= self->nItems );
-	assert( data );
-	assert( self->itemSize );
-
-	if( self->nItems == self->maxItems )
-		List_Expand( self );
-
-	for( item_i = self->nItems; item_i > index; item_i-- )
-		memcpy( self->items + self->itemSize * item_i, 
-			self->items + self->itemSize * (item_i - 1), 
-			self->itemSize );
-
-	memcpy( self->items + self->itemSize * index, data, self->itemSize );
-
-	self->nItems++;
-}
-
-void List_Append( void* list, void* data ) {
-	List*	self = (List*)list;
-
-	assert( self );
-
-	List_Insert( self, self->nItems, data );
-}
-
-void List_Prepend( void* list, void* data ) {
-	List_Insert( list, 0, data );
-}
-
-void List_Remove( void* list, void* data ) {
-	List*		self = (List*)list;
-	unsigned	item_i;
-
-	assert( self );
-	assert( data );
-
-	for( item_i = 0; item_i < self->nItems; item_i++ ) {
-		if( !memcmp( self->items + self->itemSize * item_i, data, self->itemSize ) )
-			break;
-	}
-	assert( item_i < self->nItems );
-
-	for( item_i++; item_i < self->nItems; item_i++ ) {
-		memcpy( self->items + self->itemSize * (item_i - 1), 
-			self->items + self->itemSize * item_i, 
-			self->itemSize );
-	}
-
-	if( --self->nItems % self->delta == 0 )
-		List_Contract( self );
-}
-
-void* List_GetItem( void* list, unsigned index ) {
-	List*	self = (List*)list;
-
-	assert( self );
-	assert( index < self->nItems );
-
-	return self->items + self->itemSize * index;
-}
-
-unsigned List_GetSize( void* list ) {
-	List*	self = (List*)list;
-
-	assert( self );
-
-	return self->nItems;
-}
-
-Bool List_Exists( void* list, void* data ) {
-	List*		self = (List*)list;
-	unsigned	item_i;
-
-	assert( self );
-
-	for( item_i = 0; item_i < self->nItems; item_i++ ) {
-		if( !memcmp( self->items + self->itemSize * item_i, data, self->itemSize ) )
-			break;
-	}
-
-	return (item_i < self->nItems) ? True : False;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-void List_Expand( List* self ) {
-	self->maxItems += self->delta;
-	if( !self->items )
-          self->items = (Stg_Byte*)Memory_Alloc_Array_Bytes( self->itemSize, self->maxItems, "", "List::items" );
-	else
-          self->items = (Stg_Byte*)Memory_Realloc_Array_Bytes( self->items, self->itemSize, self->maxItems );
-}
-
-void List_Contract( List* self ) {
-	if( self->delta > self->maxItems )
-		self->maxItems = 0;
-	else
-		self->maxItems -= self->delta;
-
-	if( !self->maxItems )
-		KillArray( self->items );
-	else
-          self->items = (Stg_Byte*)Memory_Realloc_Array_Bytes( self->items, self->itemSize, self->maxItems );
-}
-
-void List_Destruct( List* self ) {
-	self->nItems = 0;
-	KillArray( self->items );
-	self->itemSize = 0;
-	self->maxItems = 0;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/List.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/List.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,267 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: List.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "types.h"
+#include "List.h"
+
+
+/* Textual name of this class */
+const Type List_Type = "List";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+List* List_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(List);
+	Type                              type = List_Type;
+	Stg_Class_DeleteFunction*      _delete = _List_Delete;
+	Stg_Class_PrintFunction*        _print = _List_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return _List_New(  LIST_PASSARGS  );
+}
+
+List* _List_New(  LIST_DEFARGS  ) {
+	List*	self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(List) );
+	self = (List*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	/* Virtual info */
+
+	/* List info */
+	_List_Init( self );
+
+	return self;
+}
+
+void _List_Init( List* self ) {
+	self->nItems = 0;
+	self->items = NULL;
+	self->itemSize = 0;
+	self->maxItems = 0;
+	self->delta = 10;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _List_Delete( void* list ) {
+	List*	self = (List*)list;
+
+	List_Destruct( self );
+
+	/* Delete the parent. */
+	_Stg_Class_Delete( self );
+}
+
+void _List_Print( void* list, Stream* stream ) {
+	List*	self = (List*)list;
+	
+	/* Set the Journal for printing informations */
+	Stream* listStream;
+	listStream = Journal_Register( InfoStream_Type, "ListStream" );
+
+	/* Print parent */
+	Journal_Printf( stream, "List (ptr): (%p)\n", self );
+	_Stg_Class_Print( self, stream );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void List_SetDelta( void* list, unsigned delta ) {
+	List*	self = (List*)list;
+
+	assert( self );
+	assert( delta );
+
+	self->delta = delta;
+}
+
+void List_SetItemSize( void* list, unsigned itemSize ) {
+	List*	self = (List*)list;
+
+	assert( self );
+	assert( itemSize );
+
+	List_Destruct( self );
+
+	self->itemSize = itemSize;
+}
+
+void List_Clear( void* list ) {
+	List*	self = (List*)list;
+
+	assert( self );
+
+	self->nItems = 0;
+	KillArray( self->items );
+	self->maxItems = 0;
+}
+
+void List_Insert( void* list, unsigned index, void* data ) {
+	List*		self = (List*)list;
+	unsigned	item_i;
+
+	assert( self );
+	assert( index <= self->nItems );
+	assert( data );
+	assert( self->itemSize );
+
+	if( self->nItems == self->maxItems )
+		List_Expand( self );
+
+	for( item_i = self->nItems; item_i > index; item_i-- )
+		memcpy( self->items + self->itemSize * item_i, 
+			self->items + self->itemSize * (item_i - 1), 
+			self->itemSize );
+
+	memcpy( self->items + self->itemSize * index, data, self->itemSize );
+
+	self->nItems++;
+}
+
+void List_Append( void* list, void* data ) {
+	List*	self = (List*)list;
+
+	assert( self );
+
+	List_Insert( self, self->nItems, data );
+}
+
+void List_Prepend( void* list, void* data ) {
+	List_Insert( list, 0, data );
+}
+
+void List_Remove( void* list, void* data ) {
+	List*		self = (List*)list;
+	unsigned	item_i;
+
+	assert( self );
+	assert( data );
+
+	for( item_i = 0; item_i < self->nItems; item_i++ ) {
+		if( !memcmp( self->items + self->itemSize * item_i, data, self->itemSize ) )
+			break;
+	}
+	assert( item_i < self->nItems );
+
+	for( item_i++; item_i < self->nItems; item_i++ ) {
+		memcpy( self->items + self->itemSize * (item_i - 1), 
+			self->items + self->itemSize * item_i, 
+			self->itemSize );
+	}
+
+	if( --self->nItems % self->delta == 0 )
+		List_Contract( self );
+}
+
+void* List_GetItem( void* list, unsigned index ) {
+	List*	self = (List*)list;
+
+	assert( self );
+	assert( index < self->nItems );
+
+	return self->items + self->itemSize * index;
+}
+
+unsigned List_GetSize( void* list ) {
+	List*	self = (List*)list;
+
+	assert( self );
+
+	return self->nItems;
+}
+
+Bool List_Exists( void* list, void* data ) {
+	List*		self = (List*)list;
+	unsigned	item_i;
+
+	assert( self );
+
+	for( item_i = 0; item_i < self->nItems; item_i++ ) {
+		if( !memcmp( self->items + self->itemSize * item_i, data, self->itemSize ) )
+			break;
+	}
+
+	return (item_i < self->nItems) ? True : False;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+void List_Expand( List* self ) {
+	self->maxItems += self->delta;
+	if( !self->items )
+          self->items = (Stg_Byte*)Memory_Alloc_Array_Bytes( self->itemSize, self->maxItems, "", "List::items" );
+	else
+          self->items = (Stg_Byte*)Memory_Realloc_Array_Bytes( self->items, self->itemSize, self->maxItems );
+}
+
+void List_Contract( List* self ) {
+	if( self->delta > self->maxItems )
+		self->maxItems = 0;
+	else
+		self->maxItems -= self->delta;
+
+	if( !self->maxItems )
+		KillArray( self->items );
+	else
+          self->items = (Stg_Byte*)Memory_Realloc_Array_Bytes( self->items, self->itemSize, self->maxItems );
+}
+
+void List_Destruct( List* self ) {
+	self->nItems = 0;
+	KillArray( self->items );
+	self->itemSize = 0;
+	self->maxItems = 0;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/MPIRoutines.c
--- a/Base/Container/src/MPIRoutines.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MPIRoutines.c 2276 2004-11-04 02:01:18Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "MPIRoutines.h"
-
-
-void MPIArray_Bcast( unsigned* arraySize, void** array, size_t itemSize, 
-		     unsigned root, MPI_Comm comm )
-{
-	unsigned	nProcs;
-	unsigned	rank;
-
-	/* Sanity check. */
-	assert( !arraySize || array );
-
-	/* Get basic MPI info. */
-	MPI_Comm_size( comm, (int*)&nProcs );
-	MPI_Comm_rank( comm, (int*)&rank );
-
-	/* Send array sizes and allocate. */
-	MPI_Bcast( arraySize, 1, MPI_UNSIGNED, root, comm );
-	if( rank != root )
-		*array = Memory_Alloc_Array_Bytes_Unnamed( itemSize, *arraySize, "unknown" );
-
-	/* Send array. */
-	MPI_Bcast( *array, itemSize * (*arraySize), MPI_BYTE, root, comm );
-}
-
-
-void MPIArray_Gather( unsigned arraySize, void* array, 
-		      unsigned** dstSizes, void*** dstArrays, 
-		      size_t itemSize, unsigned root, MPI_Comm comm )
-{
-	unsigned	nProcs;
-	unsigned	rank;
-	unsigned*	tmpSizes;
-	unsigned*	disps;
-	unsigned	netSize;
-	Stg_Byte*	tmpArray;
-	unsigned	p_i;
-
-	/* Get basic MPI info. */
-	MPI_Comm_size( comm, (int*)&nProcs );
-	MPI_Comm_rank( comm, (int*)&rank );
-
-	/*
-	** Send a 1D array of arbitrary length to root process in supplied communicator.  This means we also
-	** need to receive arrays of arbitrary length from all others.  As the array from this proc is already stored
-	** elsewhere we will remove it from the received array, setting its length to zero.
-	*/
-	if( rank == root )
-		*dstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	else
-		*dstSizes = NULL;
-	MPI_Gather( &arraySize, 1, MPI_UNSIGNED, *dstSizes, 1, MPI_UNSIGNED, root, comm );
-
-	/* Factor in 'itemSize'. */
-	if( rank == root ) {
-		tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-		for( p_i = 0; p_i < nProcs; p_i++ )
-			tmpSizes[p_i] = (*dstSizes)[p_i] * itemSize;
-
-		/* Allocate space for the coming arrays and build a displacement list. */
-		disps = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-		disps[0] = 0;
-		netSize = (*dstSizes)[0];
-		for( p_i = 1; p_i < nProcs; p_i++ ) {
-			disps[p_i] = disps[p_i - 1] + tmpSizes[p_i - 1];
-			netSize += (*dstSizes)[p_i];
-		}
-
-		if( netSize )
-                  tmpArray = (Stg_Byte*)Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
-		else
-			tmpArray = NULL;
-	}
-	else {
-		tmpArray = NULL;
-		tmpSizes = NULL;
-		disps = NULL;
-	}
-
-	/* Send/receive array/s. */
-	MPI_Gatherv( array, arraySize * itemSize, MPI_BYTE, 
-		     tmpArray, (int*)tmpSizes, (int*)disps, MPI_BYTE, 
-		     root, comm );
-
-	/* Free the displacements and temporary-sizes. */
-	FreeArray( disps );
-	FreeArray( tmpSizes );
-
-	/* Convert result to 2D array. */
-	if( rank == root )
-		Array_1DTo2D( nProcs, *dstSizes, tmpArray, dstArrays, itemSize );
-}
-
-void MPIArray_Allgather( unsigned arraySize, void* array, 
-			 unsigned** dstSizes, void*** dstArrays, 
-			 size_t itemSize, MPI_Comm comm )
-{
-	unsigned	nProcs;
-	unsigned	rank;
-	unsigned*	tmpSizes;
-	void*		tmpArray1D;
-	unsigned*	disps;
-	unsigned	netSize;
-	unsigned	p_i;
-
-	/* Get basic MPI info. */
-	MPI_Comm_size( comm, (int*)&nProcs );
-	MPI_Comm_rank( comm, (int*)&rank );
-
-	/*
-	** Send a 1D array of arbitrary length to all other processes in the supplied communicator.  This means we also
-	** need to receive arrays of arbitrary length from all others.  As the array from this proc is already stored
-	** elsewhere we will remove it from the received array, setting its length to zero.
-	*/
-	*dstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	MPI_Allgather( &arraySize, 1, MPI_UNSIGNED, *dstSizes, 1, MPI_UNSIGNED, comm );
-
-	/* Factor in 'itemSize'. */
-	tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	for( p_i = 0; p_i < nProcs; p_i++ )
-		tmpSizes[p_i] = (*dstSizes)[p_i] * itemSize;
-		
-	/* Allocate space for the coming arrays and build a displacement list. */
-	disps = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	disps[0] = 0;
-	netSize = (*dstSizes)[0];
-	for( p_i = 1; p_i < nProcs; p_i++ ) {
-		disps[p_i] = disps[p_i - 1] + tmpSizes[p_i - 1];
-		netSize += (*dstSizes)[p_i];
-	}
-
-	if( netSize )
-		tmpArray1D = Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
-	else
-		tmpArray1D = NULL;
-
-	/* Send/receive array/s. */
-	MPI_Allgatherv( array, arraySize * itemSize, MPI_BYTE, 
-			tmpArray1D, (int*)tmpSizes, (int*)disps, 
-			MPI_BYTE, comm );
-
-	/* Free the displacements and temp-sizes. */
-	FreeArray( disps );
-	FreeArray( tmpSizes );
-
-	/* Unpack the 1D array into the 2D destination. */
-	Array_1DTo2D( nProcs, *dstSizes, tmpArray1D, dstArrays, itemSize );
-
-	/* Free resources. */
-	FreeArray( tmpArray1D );
-}
-
-void MPIArray_Alltoall( unsigned* arraySizes, void** arrays, 
-			unsigned** dstSizes, void*** dstArrays, 
-			size_t itemSize, MPI_Comm comm )
-{
-	unsigned	nProcs;
-	unsigned	rank;
-	unsigned*	tmpDstSizes;
-	unsigned*	tmpDstArray1D;
-	unsigned*	dstDisps;
-	unsigned	netSize;
-	unsigned*	tmpSizes;
-	void*		tmpSrcArray1D;
-	unsigned*	disps;
-	unsigned	p_i;
-
-	/* Get basic MPI info. */
-	MPI_Comm_size( comm, (int*)&nProcs );
-	MPI_Comm_rank( comm, (int*)&rank );
-
-	/*
-	** Blah, blah, sick of comments.
-	*/
-	*dstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	MPI_Alltoall( arraySizes, 1, MPI_UNSIGNED, *dstSizes, 1, MPI_UNSIGNED, comm );
-
-	/* Copy sizes into a new array and modify to include 'itemSize'. */
-	tmpDstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	for( p_i = 0; p_i < nProcs; p_i++ )
-		tmpDstSizes[p_i] = (*dstSizes)[p_i] * itemSize;
-
-	/* Allocate space for the coming arrays and build a displacement list. */
-	dstDisps = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	dstDisps[0] = 0;
-	netSize = (*dstSizes)[0];
-	for( p_i = 1; p_i < nProcs; p_i++ ) {
-		dstDisps[p_i] = dstDisps[p_i - 1] + tmpDstSizes[p_i - 1];
-		netSize += (*dstSizes)[p_i];
-	}
-
-	if( netSize )
-          tmpDstArray1D = (unsigned*)Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
-	else
-		tmpDstArray1D = NULL;
-
-	/* Pack the supplied 2D array into a 1D array and send/receive. */
-	Array_2DTo1D( nProcs, arraySizes, arrays, &tmpSrcArray1D, sizeof(unsigned), &disps );
-
-	/* Generate a temporary set of sizes to include 'itemSize'. Modify 'dists' while we're at it. */
-	tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
-	for( p_i = 0; p_i < nProcs; p_i++ ) {
-		disps[p_i] *= itemSize;
-		tmpSizes[p_i] = arraySizes[p_i] * itemSize;
-	}
-
-	/* Send/recv. */
-	MPI_Alltoallv( tmpSrcArray1D, (int*)tmpSizes, (int*)disps, MPI_BYTE, 
-		       tmpDstArray1D, (int*)tmpDstSizes, (int*)dstDisps, MPI_BYTE, 
-		       comm );
-
-	/* Free memory. */
-	FreeArray( tmpSizes );
-	FreeArray( disps );
-	FreeArray( dstDisps );
-	FreeArray( tmpDstSizes );
-	FreeArray( tmpSrcArray1D );
-
-	/* Unpack the 1D array into the 2D destination. */
-	Array_1DTo2D( nProcs, *dstSizes, tmpDstArray1D, dstArrays, itemSize );
-
-	/* Free resources. */
-	FreeArray( tmpDstArray1D );
-}
-
-void Array_1DTo2D( unsigned nBlocks, unsigned* sizes, void* srcArray, 
-		   void*** dstArrays, size_t itemSize )
-{
-	Stg_Byte**	tmp;
-	unsigned*	tmpSizes;
-	unsigned	curPos = 0;
-	unsigned	b_i;
-
-	if( nBlocks == 0 ) {
-		*dstArrays = NULL;
-		return;
-	}
-
-	/* Allocate base array. */
-
-
-	/* Calculate sizes. */
-	tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nBlocks );
-	for( b_i = 0; b_i < nBlocks; b_i++ )
-		tmpSizes[b_i] = sizes[b_i] * (unsigned)itemSize;
-
-	/* Allocate. */
-	tmp = Memory_Alloc_Array_Unnamed( Stg_Byte*, nBlocks );
-	for( b_i = 0; b_i < nBlocks; b_i++ ) {
-		if( sizes[b_i] == 0 ) {
-			tmp[b_i] = NULL;
-			continue;
-		}
-
-		tmp[b_i] = Memory_Alloc_Array_Unnamed( Stg_Byte, tmpSizes[b_i] );
-		memcpy( tmp[b_i], (Stg_Byte*)srcArray + curPos, tmpSizes[b_i] );
-		curPos += tmpSizes[b_i];
-	}
-
-	/* Free memory. */
-	FreeArray( tmpSizes );
-
-	*dstArrays = (void**)tmp;
-}
-
-void Array_2DTo1D( unsigned nBlocks, unsigned* sizes, void** srcArrays, 
-		   void** dstArray, size_t itemSize, unsigned** disps )
-{
-	if( nBlocks == 0 ) {
-		dstArray = NULL;
-		disps = NULL;
-		return;
-	}
-	
-	/*
-	** Dump a 2D array into a 1D array and build a displacement array to accompany it.
-	*/
-	
-	{
-		unsigned	netSize;
-		unsigned	b_i;
-		unsigned*	tmpDisps;
-		
-		tmpDisps = Memory_Alloc_Array_Unnamed( unsigned, nBlocks );
-		
-		tmpDisps[0] = 0;
-		netSize = sizes[0];
-		for( b_i = 1; b_i < nBlocks; b_i++ ) {
-			tmpDisps[b_i] = tmpDisps[b_i - 1] + sizes[b_i - 1];
-			netSize += sizes[b_i];
-		}
-		
-		if( netSize > 0 ) {
-			void*	tmpArray;
-			char*	dest;
-			
-			tmpArray = Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "" );
-
-			for( b_i = 0; b_i < nBlocks; b_i++ ) {
-                          dest = (char*)tmpArray;
-				dest += (tmpDisps[b_i] * itemSize);
-				memcpy( dest, srcArrays[b_i], itemSize * sizes[b_i] );
-			}
-			
-			*dstArray = tmpArray;
-		}
-		else {
-			*dstArray = NULL;
-		}
-		
-		*disps = tmpDisps;
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/MPIRoutines.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/MPIRoutines.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,354 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MPIRoutines.c 2276 2004-11-04 02:01:18Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "MPIRoutines.h"
+
+
+void MPIArray_Bcast( unsigned* arraySize, void** array, size_t itemSize, 
+		     unsigned root, MPI_Comm comm )
+{
+	unsigned	nProcs;
+	unsigned	rank;
+
+	/* Sanity check. */
+	assert( !arraySize || array );
+
+	/* Get basic MPI info. */
+	MPI_Comm_size( comm, (int*)&nProcs );
+	MPI_Comm_rank( comm, (int*)&rank );
+
+	/* Send array sizes and allocate. */
+	MPI_Bcast( arraySize, 1, MPI_UNSIGNED, root, comm );
+	if( rank != root )
+		*array = Memory_Alloc_Array_Bytes_Unnamed( itemSize, *arraySize, "unknown" );
+
+	/* Send array. */
+	MPI_Bcast( *array, itemSize * (*arraySize), MPI_BYTE, root, comm );
+}
+
+
+void MPIArray_Gather( unsigned arraySize, void* array, 
+		      unsigned** dstSizes, void*** dstArrays, 
+		      size_t itemSize, unsigned root, MPI_Comm comm )
+{
+	unsigned	nProcs;
+	unsigned	rank;
+	unsigned*	tmpSizes;
+	unsigned*	disps;
+	unsigned	netSize;
+	Stg_Byte*	tmpArray;
+	unsigned	p_i;
+
+	/* Get basic MPI info. */
+	MPI_Comm_size( comm, (int*)&nProcs );
+	MPI_Comm_rank( comm, (int*)&rank );
+
+	/*
+	** Send a 1D array of arbitrary length to root process in supplied communicator.  This means we also
+	** need to receive arrays of arbitrary length from all others.  As the array from this proc is already stored
+	** elsewhere we will remove it from the received array, setting its length to zero.
+	*/
+	if( rank == root )
+		*dstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	else
+		*dstSizes = NULL;
+	MPI_Gather( &arraySize, 1, MPI_UNSIGNED, *dstSizes, 1, MPI_UNSIGNED, root, comm );
+
+	/* Factor in 'itemSize'. */
+	if( rank == root ) {
+		tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+		for( p_i = 0; p_i < nProcs; p_i++ )
+			tmpSizes[p_i] = (*dstSizes)[p_i] * itemSize;
+
+		/* Allocate space for the coming arrays and build a displacement list. */
+		disps = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+		disps[0] = 0;
+		netSize = (*dstSizes)[0];
+		for( p_i = 1; p_i < nProcs; p_i++ ) {
+			disps[p_i] = disps[p_i - 1] + tmpSizes[p_i - 1];
+			netSize += (*dstSizes)[p_i];
+		}
+
+		if( netSize )
+                  tmpArray = (Stg_Byte*)Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
+		else
+			tmpArray = NULL;
+	}
+	else {
+		tmpArray = NULL;
+		tmpSizes = NULL;
+		disps = NULL;
+	}
+
+	/* Send/receive array/s. */
+	MPI_Gatherv( array, arraySize * itemSize, MPI_BYTE, 
+		     tmpArray, (int*)tmpSizes, (int*)disps, MPI_BYTE, 
+		     root, comm );
+
+	/* Free the displacements and temporary-sizes. */
+	FreeArray( disps );
+	FreeArray( tmpSizes );
+
+	/* Convert result to 2D array. */
+	if( rank == root )
+		Array_1DTo2D( nProcs, *dstSizes, tmpArray, dstArrays, itemSize );
+}
+
+void MPIArray_Allgather( unsigned arraySize, void* array, 
+			 unsigned** dstSizes, void*** dstArrays, 
+			 size_t itemSize, MPI_Comm comm )
+{
+	unsigned	nProcs;
+	unsigned	rank;
+	unsigned*	tmpSizes;
+	void*		tmpArray1D;
+	unsigned*	disps;
+	unsigned	netSize;
+	unsigned	p_i;
+
+	/* Get basic MPI info. */
+	MPI_Comm_size( comm, (int*)&nProcs );
+	MPI_Comm_rank( comm, (int*)&rank );
+
+	/*
+	** Send a 1D array of arbitrary length to all other processes in the supplied communicator.  This means we also
+	** need to receive arrays of arbitrary length from all others.  As the array from this proc is already stored
+	** elsewhere we will remove it from the received array, setting its length to zero.
+	*/
+	*dstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	MPI_Allgather( &arraySize, 1, MPI_UNSIGNED, *dstSizes, 1, MPI_UNSIGNED, comm );
+
+	/* Factor in 'itemSize'. */
+	tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	for( p_i = 0; p_i < nProcs; p_i++ )
+		tmpSizes[p_i] = (*dstSizes)[p_i] * itemSize;
+		
+	/* Allocate space for the coming arrays and build a displacement list. */
+	disps = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	disps[0] = 0;
+	netSize = (*dstSizes)[0];
+	for( p_i = 1; p_i < nProcs; p_i++ ) {
+		disps[p_i] = disps[p_i - 1] + tmpSizes[p_i - 1];
+		netSize += (*dstSizes)[p_i];
+	}
+
+	if( netSize )
+		tmpArray1D = Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
+	else
+		tmpArray1D = NULL;
+
+	/* Send/receive array/s. */
+	MPI_Allgatherv( array, arraySize * itemSize, MPI_BYTE, 
+			tmpArray1D, (int*)tmpSizes, (int*)disps, 
+			MPI_BYTE, comm );
+
+	/* Free the displacements and temp-sizes. */
+	FreeArray( disps );
+	FreeArray( tmpSizes );
+
+	/* Unpack the 1D array into the 2D destination. */
+	Array_1DTo2D( nProcs, *dstSizes, tmpArray1D, dstArrays, itemSize );
+
+	/* Free resources. */
+	FreeArray( tmpArray1D );
+}
+
+void MPIArray_Alltoall( unsigned* arraySizes, void** arrays, 
+			unsigned** dstSizes, void*** dstArrays, 
+			size_t itemSize, MPI_Comm comm )
+{
+	unsigned	nProcs;
+	unsigned	rank;
+	unsigned*	tmpDstSizes;
+	unsigned*	tmpDstArray1D;
+	unsigned*	dstDisps;
+	unsigned	netSize;
+	unsigned*	tmpSizes;
+	void*		tmpSrcArray1D;
+	unsigned*	disps;
+	unsigned	p_i;
+
+	/* Get basic MPI info. */
+	MPI_Comm_size( comm, (int*)&nProcs );
+	MPI_Comm_rank( comm, (int*)&rank );
+
+	/*
+	** Blah, blah, sick of comments.
+	*/
+	*dstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	MPI_Alltoall( arraySizes, 1, MPI_UNSIGNED, *dstSizes, 1, MPI_UNSIGNED, comm );
+
+	/* Copy sizes into a new array and modify to include 'itemSize'. */
+	tmpDstSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	for( p_i = 0; p_i < nProcs; p_i++ )
+		tmpDstSizes[p_i] = (*dstSizes)[p_i] * itemSize;
+
+	/* Allocate space for the coming arrays and build a displacement list. */
+	dstDisps = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	dstDisps[0] = 0;
+	netSize = (*dstSizes)[0];
+	for( p_i = 1; p_i < nProcs; p_i++ ) {
+		dstDisps[p_i] = dstDisps[p_i - 1] + tmpDstSizes[p_i - 1];
+		netSize += (*dstSizes)[p_i];
+	}
+
+	if( netSize )
+          tmpDstArray1D = (unsigned*)Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
+	else
+		tmpDstArray1D = NULL;
+
+	/* Pack the supplied 2D array into a 1D array and send/receive. */
+	Array_2DTo1D( nProcs, arraySizes, arrays, &tmpSrcArray1D, sizeof(unsigned), &disps );
+
+	/* Generate a temporary set of sizes to include 'itemSize'. Modify 'dists' while we're at it. */
+	tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
+	for( p_i = 0; p_i < nProcs; p_i++ ) {
+		disps[p_i] *= itemSize;
+		tmpSizes[p_i] = arraySizes[p_i] * itemSize;
+	}
+
+	/* Send/recv. */
+	MPI_Alltoallv( tmpSrcArray1D, (int*)tmpSizes, (int*)disps, MPI_BYTE, 
+		       tmpDstArray1D, (int*)tmpDstSizes, (int*)dstDisps, MPI_BYTE, 
+		       comm );
+
+	/* Free memory. */
+	FreeArray( tmpSizes );
+	FreeArray( disps );
+	FreeArray( dstDisps );
+	FreeArray( tmpDstSizes );
+	FreeArray( tmpSrcArray1D );
+
+	/* Unpack the 1D array into the 2D destination. */
+	Array_1DTo2D( nProcs, *dstSizes, tmpDstArray1D, dstArrays, itemSize );
+
+	/* Free resources. */
+	FreeArray( tmpDstArray1D );
+}
+
+void Array_1DTo2D( unsigned nBlocks, unsigned* sizes, void* srcArray, 
+		   void*** dstArrays, size_t itemSize )
+{
+	Stg_Byte**	tmp;
+	unsigned*	tmpSizes;
+	unsigned	curPos = 0;
+	unsigned	b_i;
+
+	if( nBlocks == 0 ) {
+		*dstArrays = NULL;
+		return;
+	}
+
+	/* Allocate base array. */
+
+
+	/* Calculate sizes. */
+	tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nBlocks );
+	for( b_i = 0; b_i < nBlocks; b_i++ )
+		tmpSizes[b_i] = sizes[b_i] * (unsigned)itemSize;
+
+	/* Allocate. */
+	tmp = Memory_Alloc_Array_Unnamed( Stg_Byte*, nBlocks );
+	for( b_i = 0; b_i < nBlocks; b_i++ ) {
+		if( sizes[b_i] == 0 ) {
+			tmp[b_i] = NULL;
+			continue;
+		}
+
+		tmp[b_i] = Memory_Alloc_Array_Unnamed( Stg_Byte, tmpSizes[b_i] );
+		memcpy( tmp[b_i], (Stg_Byte*)srcArray + curPos, tmpSizes[b_i] );
+		curPos += tmpSizes[b_i];
+	}
+
+	/* Free memory. */
+	FreeArray( tmpSizes );
+
+	*dstArrays = (void**)tmp;
+}
+
+void Array_2DTo1D( unsigned nBlocks, unsigned* sizes, void** srcArrays, 
+		   void** dstArray, size_t itemSize, unsigned** disps )
+{
+	if( nBlocks == 0 ) {
+		dstArray = NULL;
+		disps = NULL;
+		return;
+	}
+	
+	/*
+	** Dump a 2D array into a 1D array and build a displacement array to accompany it.
+	*/
+	
+	{
+		unsigned	netSize;
+		unsigned	b_i;
+		unsigned*	tmpDisps;
+		
+		tmpDisps = Memory_Alloc_Array_Unnamed( unsigned, nBlocks );
+		
+		tmpDisps[0] = 0;
+		netSize = sizes[0];
+		for( b_i = 1; b_i < nBlocks; b_i++ ) {
+			tmpDisps[b_i] = tmpDisps[b_i - 1] + sizes[b_i - 1];
+			netSize += sizes[b_i];
+		}
+		
+		if( netSize > 0 ) {
+			void*	tmpArray;
+			char*	dest;
+			
+			tmpArray = Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "" );
+
+			for( b_i = 0; b_i < nBlocks; b_i++ ) {
+                          dest = (char*)tmpArray;
+				dest += (tmpDisps[b_i] * itemSize);
+				memcpy( dest, srcArrays[b_i], itemSize * sizes[b_i] );
+			}
+			
+			*dstArray = tmpArray;
+		}
+		else {
+			*dstArray = NULL;
+		}
+		
+		*disps = tmpDisps;
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/MaxHeap.c
--- a/Base/Container/src/MaxHeap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/** \file
-** <b>Role:</b>
-**	Binary Tree class for objects.
-**
-** <b>Assumptions:</b>
-**	None
-**
-** <b>Comments:</b>
-**	None
-**
-** $Id: MaxHeap.c 2087 2005-2-25 02:28:44Z RaquibulHassan $
-**
-**/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "Heap.h"
-#include "MaxHeap.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type MaxHeap_Type = "MaxHeap";
-
-MaxHeap* MaxHeap_New( void **keys, int keyLength, int numArrayElements, 
-						Heap_KeySwapFunction *keySwap,
-						Heap_CompareFunction *keyCompare,
-						Heap_ExtendArrayFunc *extendArray )
-{
-	/* Variables set in this function */
-	SizeT                          _sizeOfSelf = sizeof( MaxHeap );
-	Type                                  type = MaxHeap_Type;
-	Stg_Class_DeleteFunction*          _delete = _MaxHeap_DeleteFunc;
-	Stg_Class_PrintFunction*            _print = _MaxHeap_PrintFunc;
-	Stg_Class_CopyFunction*              _copy = NULL;
-	Heap_HeapifyFunction*              heapify = MaxHeap_Heapify;
-	Heap_ExtractFunction*              extract = (Heap_ExtractFunction*)MaxHeap_Extract;
-	Heap_InsertFunction*                insert = MaxHeap_InsertFunc;
-	Heap_KeySwapFunction*      keySwapFunction = keySwap;
-	Heap_CompareFunction*      compareFunction = keyCompare;
-
-	return _MaxHeap_New(  MAXHEAP_PASSARGS  );
-}
-
-MaxHeap* _MaxHeap_New(  MAXHEAP_DEFARGS  )
-{
-	_Heap *heap;
-
-	heap = _Heap_New(  HEAP_PASSARGS  );
-
-	_MaxHeap_Init( (MaxHeap*)heap );
-	return ( MaxHeap* )heap;
-}
-
-void _MaxHeap_Init( MaxHeap* self )
-{
-
-}
-	
-void MaxHeap_Heapify( _Heap *heap, int index )
-{
-	int l, r, largest;
-
-	assert( heap );
-	
-	l = _Heap_Left( heap, index );
-	r = _Heap_Right( heap, index );
-
-	if( (l <= heap->numHeapElements) &&
-			(heap->compare( heap->keys[l-1], heap->keys[index-1]) == 1) ){
-		largest = l;
-	}
-	else{
-		largest = index;
-	}
-
-	if( (r <= heap->numHeapElements) &&
-			(heap->compare( heap->keys[r-1], heap->keys[largest-1] ) == 1) ){
-		largest = r;
-	}
-
-	if( largest != index ){
-
-		heap->keySwap( &(heap->keys[index-1]), &(heap->keys[largest-1]) );
-		
-		MaxHeap_Heapify( heap, largest );
-	}
-}
-
-void* MaxHeap_Extract( void* heap ) {
-	MaxHeap*	self = (MaxHeap*)heap;
-	void*		max;
-	
-	assert( self );
-
-	if( self->numHeapElements < 1 ){
-		fprintf( stderr, "Heap Underflow..!!\n Aborting..!!\n" );
-		assert( 0 );
-	}
-
-	max = self->keys[0];
-
-	self->keySwap( &(self->keys[0]), &(self->keys[self->numHeapElements-1]) );
-	self->numHeapElements -= 1;
-
-	self->heapify( (_Heap*)self, 1 );
-
-	return max;
-}
-
-	/** Stg_Class_Delete interface. */
-	/** Stg_Class delete function */
-void _MaxHeap_DeleteFunc ( void *heap )
-{
-	MaxHeap *self = (MaxHeap*)heap;
-
-	assert( self );
-
-	_Heap_DeleteFunc( self );
-}
-	
-	/** Print interface. */
-	/** Stg_Class print function */
-void _MaxHeap_PrintFunc ( void *heap, Stream* stream )
-{
-	MaxHeap *self = (MaxHeap*)heap;
-	assert( self );
-
-	/* print parent */
-	_Heap_PrintFunc( (void*) self, stream );
-
-	/* general info */
-	Journal_Printf( stream, "MaxHeap (ptr): (%p)\n", self );
-
-	/* Virtual Info */
-	
-}
-
-	/** Public functions */
-
-void MaxHeap_InsertFunc( _Heap *maxHeap, void *key )
-{
-	int i = 0;
-
-	assert( maxHeap );
-	assert( key );
-
-	if( maxHeap->numHeapElements >= maxHeap->numArrayElements ){
-
-		maxHeap->numArrayElements += 1;		
-		maxHeap->keys = maxHeap->extendArray( maxHeap->numArrayElements, &(maxHeap->keys) );		
-	}
-
-	maxHeap->numHeapElements += 1;
-
-	maxHeap->keys[maxHeap->numHeapElements-1] = key;
-
-	i = maxHeap->numHeapElements;
-	while( ( (i > 1) && (maxHeap->compare( maxHeap->keys[_Heap_Parent( maxHeap, i )-1], maxHeap->keys[i-1] ) == -1) ) ){
-		
-		maxHeap->keySwap( &(maxHeap->keys[i-1]), &(maxHeap->keys[_Heap_Parent( maxHeap, i )-1]) );
-
-		i = _Heap_Parent( maxHeap, i );
-	}
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/MaxHeap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/MaxHeap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,198 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/** \file
+** <b>Role:</b>
+**	Binary Tree class for objects.
+**
+** <b>Assumptions:</b>
+**	None
+**
+** <b>Comments:</b>
+**	None
+**
+** $Id: MaxHeap.c 2087 2005-2-25 02:28:44Z RaquibulHassan $
+**
+**/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "Heap.h"
+#include "MaxHeap.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type MaxHeap_Type = "MaxHeap";
+
+MaxHeap* MaxHeap_New( void **keys, int keyLength, int numArrayElements, 
+						Heap_KeySwapFunction *keySwap,
+						Heap_CompareFunction *keyCompare,
+						Heap_ExtendArrayFunc *extendArray )
+{
+	/* Variables set in this function */
+	SizeT                          _sizeOfSelf = sizeof( MaxHeap );
+	Type                                  type = MaxHeap_Type;
+	Stg_Class_DeleteFunction*          _delete = _MaxHeap_DeleteFunc;
+	Stg_Class_PrintFunction*            _print = _MaxHeap_PrintFunc;
+	Stg_Class_CopyFunction*              _copy = NULL;
+	Heap_HeapifyFunction*              heapify = MaxHeap_Heapify;
+	Heap_ExtractFunction*              extract = (Heap_ExtractFunction*)MaxHeap_Extract;
+	Heap_InsertFunction*                insert = MaxHeap_InsertFunc;
+	Heap_KeySwapFunction*      keySwapFunction = keySwap;
+	Heap_CompareFunction*      compareFunction = keyCompare;
+
+	return _MaxHeap_New(  MAXHEAP_PASSARGS  );
+}
+
+MaxHeap* _MaxHeap_New(  MAXHEAP_DEFARGS  )
+{
+	_Heap *heap;
+
+	heap = _Heap_New(  HEAP_PASSARGS  );
+
+	_MaxHeap_Init( (MaxHeap*)heap );
+	return ( MaxHeap* )heap;
+}
+
+void _MaxHeap_Init( MaxHeap* self )
+{
+
+}
+	
+void MaxHeap_Heapify( _Heap *heap, int index )
+{
+	int l, r, largest;
+
+	assert( heap );
+	
+	l = _Heap_Left( heap, index );
+	r = _Heap_Right( heap, index );
+
+	if( (l <= heap->numHeapElements) &&
+			(heap->compare( heap->keys[l-1], heap->keys[index-1]) == 1) ){
+		largest = l;
+	}
+	else{
+		largest = index;
+	}
+
+	if( (r <= heap->numHeapElements) &&
+			(heap->compare( heap->keys[r-1], heap->keys[largest-1] ) == 1) ){
+		largest = r;
+	}
+
+	if( largest != index ){
+
+		heap->keySwap( &(heap->keys[index-1]), &(heap->keys[largest-1]) );
+		
+		MaxHeap_Heapify( heap, largest );
+	}
+}
+
+void* MaxHeap_Extract( void* heap ) {
+	MaxHeap*	self = (MaxHeap*)heap;
+	void*		max;
+	
+	assert( self );
+
+	if( self->numHeapElements < 1 ){
+		fprintf( stderr, "Heap Underflow..!!\n Aborting..!!\n" );
+		assert( 0 );
+	}
+
+	max = self->keys[0];
+
+	self->keySwap( &(self->keys[0]), &(self->keys[self->numHeapElements-1]) );
+	self->numHeapElements -= 1;
+
+	self->heapify( (_Heap*)self, 1 );
+
+	return max;
+}
+
+	/** Stg_Class_Delete interface. */
+	/** Stg_Class delete function */
+void _MaxHeap_DeleteFunc ( void *heap )
+{
+	MaxHeap *self = (MaxHeap*)heap;
+
+	assert( self );
+
+	_Heap_DeleteFunc( self );
+}
+	
+	/** Print interface. */
+	/** Stg_Class print function */
+void _MaxHeap_PrintFunc ( void *heap, Stream* stream )
+{
+	MaxHeap *self = (MaxHeap*)heap;
+	assert( self );
+
+	/* print parent */
+	_Heap_PrintFunc( (void*) self, stream );
+
+	/* general info */
+	Journal_Printf( stream, "MaxHeap (ptr): (%p)\n", self );
+
+	/* Virtual Info */
+	
+}
+
+	/** Public functions */
+
+void MaxHeap_InsertFunc( _Heap *maxHeap, void *key )
+{
+	int i = 0;
+
+	assert( maxHeap );
+	assert( key );
+
+	if( maxHeap->numHeapElements >= maxHeap->numArrayElements ){
+
+		maxHeap->numArrayElements += 1;		
+		maxHeap->keys = maxHeap->extendArray( maxHeap->numArrayElements, &(maxHeap->keys) );		
+	}
+
+	maxHeap->numHeapElements += 1;
+
+	maxHeap->keys[maxHeap->numHeapElements-1] = key;
+
+	i = maxHeap->numHeapElements;
+	while( ( (i > 1) && (maxHeap->compare( maxHeap->keys[_Heap_Parent( maxHeap, i )-1], maxHeap->keys[i-1] ) == -1) ) ){
+		
+		maxHeap->keySwap( &(maxHeap->keys[i-1]), &(maxHeap->keys[_Heap_Parent( maxHeap, i )-1]) );
+
+		i = _Heap_Parent( maxHeap, i );
+	}
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/MemoryPool.c
--- a/Base/Container/src/MemoryPool.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: List.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Base/Foundation/Foundation.h>
-#include <Base/IO/IO.h>
-
-#include "types.h"
-#include "MemoryPool.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type MemoryPool_Type = "MemoryPool";
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-MemoryPool* _MemoryPool_New(  MEMORYPOOL_DEFARGS  )
-{
-	MemoryPool *self = NULL;
-
-	self = (MemoryPool*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	self->numMemChunks = 1;
-	self->delta = delta;
-	self->elementSize = elementSize;
-	self->numElements = numElements;
-	self->numInitialElements = numElements;
-	self->numElementsFree = numElements;
-	self->callbackFunc = NULL;
-	self->callbackFuncArg = NULL;
-
-	return self;
-}
-
-MemoryPool* MemoryPool_NewFunc( SizeT elementSize, int numElements, int delta )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(MemoryPool);
-	Type                              type = MemoryPool_Type;
-	Stg_Class_DeleteFunction*      _delete = _MemoryPool_DeleteFunc;
-	Stg_Class_PrintFunction*        _print = _MemoryPool_PrintFunc;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	
-	MemoryPool* self;
-	
-	self = _MemoryPool_New(  MEMORYPOOL_PASSARGS  );
-
-	/* Virtual functions */
-	_MemoryPool_Init( self );
-	return self;
-}
-
-void _MemoryPool_Init( MemoryPool* self ){
-	int i = 0;
-	
-	/* General info */
-	
-	assert( self );
-	_Stg_Class_Init ((Stg_Class*) self);
-	
-	assert( self->numMemChunks == 1 );
-
-	self->chunks = (MemChunk*)Memory_Alloc_Bytes_Unnamed( sizeof(MemChunk)*self->numMemChunks, "char*" );
-	self->chunks[self->numMemChunks-1].memory = (char*)Memory_Alloc_Bytes_Unnamed( self->elementSize * self->numElements, "char" );
-	memset( self->chunks[self->numMemChunks-1].memory, 0, self->elementSize * self->numElements );
-	self->chunks[self->numMemChunks-1].numFree = self->numElements;
-	self->chunks[self->numMemChunks-1].maxFree = self->numElements;
-
-	self->pool = (char**)Memory_Alloc_Bytes_Unnamed( sizeof( char* ) * self->numElements, "char*" );
-	memset( self->pool, 0, sizeof(char*) * self->numElements );
-	
-	for( i=0; i<self->numElements; i++ ){
-		self->pool[i] = &(self->chunks[self->numMemChunks-1].memory[i*self->elementSize]);
-	}
-}
-
-void *MemoryPool_Init( MemoryPool *self )
-{
-	/*TODO*/
-	return NULL;
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual Functions
-*/
-void _MemoryPool_PrintFunc ( void *memPool, Stream *stream )
-{
-	MemoryPool *self = NULL;
-	
-	self = (MemoryPool*) memPool;
-	assert( self );
-	assert( stream );
-
-	/* print parent */
-	_Stg_Class_Print( (void*) self, stream );
-
-	/* general info */
-	Journal_Printf( stream, "MemoryPool (ptr): (%p)\n", self );
-
-	/* Virtual Info */
-
-	/* MemoryPool Info */
-	Journal_Printf( stream, "\tElementSize\t\t - %d\n", self->elementSize );
-	Journal_Printf( stream, "\tNumElememts\t\t - %d\n", self->numElements );
-	Journal_Printf( stream, "\tNumElememtsFree\t\t - %d\n", self->numElementsFree );
-	Journal_Printf( stream, "\tNumMemChunks\t\t - %d\n", self->numMemChunks );
-	Journal_Printf( stream, "\tDelta\t\t\t - %d\n", self->delta );
-}
-
-void _MemoryPool_DeleteFunc( void *memPool )
-{
-	int i = 0;
-	MemoryPool *self = NULL;
-	
-	self = (MemoryPool*)memPool;
-	assert (self);
-	
-	for( i=0; i<self->numMemChunks; i++ ){
-		if( self->chunks[i].memory != ((char*)NULL) ){
-			Memory_Free( self->chunks[i].memory );
-		}
-	}
-
-	Memory_Free( self->chunks );
-	Memory_Free( self->pool );
-	
-	_Stg_Class_Delete( self );
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void *MemoryPool_NewObjectFunc( SizeT elementSize, MemoryPool *memPool )
-{
-	int index = 0;
-	int i = 0;
-	char *result = NULL;
-	
-	assert( elementSize == memPool->elementSize );
-	
-label:	index = memPool->numElementsFree - 1;
-
-	if( index < 0 ){
-		MemoryPool_Extend( memPool );
-		goto label;
-	}
-
-	result = (char*)(memPool->pool[--memPool->numElementsFree]);
-
-	for( i=0; i<memPool->numMemChunks; i++ ){
-		int numObjs = 0;
-
-		numObjs = memPool->chunks[i].maxFree*memPool->elementSize;
-		
-		if( (result >= memPool->chunks[i].memory) && (result < (memPool->chunks[i].memory+numObjs)) ){
-			memPool->chunks[i].numFree--;
-			break;
-		}
-	}
-
-	return (void*)result;
-}
-		
-Bool MemoryPool_DeleteObject( MemoryPool *memPool, void *object )
-{
-	if( object != NULL ){
-		int i = 0;
-		int valid = 0;
-
-		for ( i=0; i<memPool->numMemChunks; i++ ){
-			int numObjs = 0;
-
-			numObjs = memPool->chunks[i].maxFree*memPool->elementSize;
-			
-			if( ((char*)object >= memPool->chunks[i].memory) && ((char*)object < (memPool->chunks[i].memory+numObjs)) ){
-				memPool->chunks[i].numFree++;
-				valid = 1;
-				break;
-			}
-		}
-
-		if( valid ){
-			memset( (char*)object, 0, memPool->elementSize );
-			memPool->pool[memPool->numElementsFree++] = (char*)object;
-			MemoryPool_Shrink( memPool );
-			return True;
-		}
-		else{
-			return False;
-		}
-	}
-	else{
-		return False;
-	}
-}
-
-void MemoryPool_Extend( MemoryPool *memPool )
-{
-	int i = 0;
-	char **newPool;
-
-	assert( memPool );
-
-	memPool->numMemChunks++;
-
-	memPool->chunks = (MemChunk*)Memory_Realloc( memPool->chunks, sizeof(MemChunk)*memPool->numMemChunks );
-	assert( memPool->chunks );
-
-	memPool->chunks[memPool->numMemChunks-1].memory = (char*)Memory_Alloc_Bytes_Unnamed( memPool->elementSize * memPool->delta, "int" );
-	memset( memPool->chunks[memPool->numMemChunks-1].memory, 0, memPool->elementSize * memPool->delta );
-	memPool->chunks[memPool->numMemChunks-1].numFree = memPool->delta;
-	memPool->chunks[memPool->numMemChunks-1].maxFree = memPool->delta;
-
-	newPool = (char**)Memory_Alloc_Bytes_Unnamed( sizeof(char*) * (memPool->numElements+memPool->delta), "char*" );
-	assert( newPool );
-
-	memcpy( newPool+memPool->delta, memPool->pool, sizeof(char*)*memPool->numElements );
-
-	for( i=0; i<memPool->delta; i++ ){
-		newPool[i] = &(memPool->chunks[memPool->numMemChunks-1].memory[i*memPool->elementSize]);
-	}
-
-	Memory_Free( memPool->pool );
-	memPool->pool = newPool;
-	memPool->numElements+=memPool->delta;
-	memPool->numElementsFree=memPool->delta;
-
-	if( memPool->callbackFunc ){
-		memPool->callbackFunc( memPool->callbackFuncArg );
-	}
-}
-
-void MemoryPool_Shrink( MemoryPool *memPool )
-{
-	int i = 0;
-	Bool deleteFlag = False;
-	int chunkIdx = 0;
-	char **newPool = (char**)0;
-	int eCounter = 0;
-
-	assert( memPool );
-
-	if( memPool->numElementsFree < memPool->delta ){
-		return;
-	}
-
-	for( i=0; i<memPool->numMemChunks; i++ )
-	{
-		if( memPool->chunks[i].numFree == memPool->chunks[i].maxFree ){
-			deleteFlag = True;
-			chunkIdx = i;
-			break;
-		}
-	}
-
-	if( deleteFlag ){
-		int numObjs = 0;
-		numObjs = memPool->chunks[chunkIdx].maxFree*memPool->elementSize;
-
-		newPool = (char**)Memory_Alloc_Bytes_Unnamed( sizeof(char*) * (memPool->numElements-memPool->chunks[chunkIdx].maxFree), "char*" );
-
-		eCounter = 0;
-		for( i=0; i<memPool->numElements; i++ ){
-			if( (memPool->pool[i] >= memPool->chunks[chunkIdx].memory) && 
-					(memPool->pool[i] < (memPool->chunks[chunkIdx].memory+numObjs)) ){
-			}
-			else{
-				newPool[eCounter++] = memPool->pool[i];
-			}
-		}
-
-		Memory_Free( memPool->pool );
-		memPool->pool = newPool;
-		
-		memPool->numElements-=memPool->chunks[chunkIdx].maxFree;
-		memPool->numElementsFree-=memPool->chunks[chunkIdx].maxFree;
-
-		Memory_Free( memPool->chunks[chunkIdx].memory );
-		memPool->chunks[chunkIdx].memory = (char*)NULL;
-
-		if( chunkIdx == (memPool->numMemChunks-1) ){
-			memPool->numMemChunks--;
-
-			if( memPool->numMemChunks>0 ){
-				memPool->chunks = (MemChunk*)Memory_Realloc( memPool->chunks, sizeof(MemChunk)*memPool->numMemChunks );
-				assert( memPool->chunks );
-			}
-		}
-		else{
-			memcpy( &(memPool->chunks[chunkIdx]), &(memPool->chunks[chunkIdx+1]), sizeof(MemChunk)*(memPool->numMemChunks - (chunkIdx+1)) );
-			memPool->numMemChunks--;
-			memPool->chunks = (MemChunk*)Memory_Realloc( memPool->chunks, sizeof(MemChunk)*memPool->numMemChunks );
-			assert( memPool->chunks );
-		}
-	}
-	
-	if( memPool->callbackFunc ){
-		memPool->callbackFunc( memPool->callbackFuncArg );
-	}
-}
-
-void MemoryPool_SetCallbackFunc( MemoryPool *memPool, MemoryPool_ResizeCallbackFunc *f )
-{
-	assert( memPool );
-	memPool->callbackFunc = f;
-}
-
-void MemoryPool_SetCallbackFuncArg( MemoryPool *memPool, void *callbackFuncArg )
-{
-	assert( memPool );
-	memPool->callbackFuncArg = callbackFuncArg;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/MemoryPool.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/MemoryPool.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,347 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: List.c 2038 2004-11-15 07:11:01Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Base/Foundation/Foundation.h>
+#include <Base/IO/IO.h>
+
+#include "types.h"
+#include "MemoryPool.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type MemoryPool_Type = "MemoryPool";
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+MemoryPool* _MemoryPool_New(  MEMORYPOOL_DEFARGS  )
+{
+	MemoryPool *self = NULL;
+
+	self = (MemoryPool*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	self->numMemChunks = 1;
+	self->delta = delta;
+	self->elementSize = elementSize;
+	self->numElements = numElements;
+	self->numInitialElements = numElements;
+	self->numElementsFree = numElements;
+	self->callbackFunc = NULL;
+	self->callbackFuncArg = NULL;
+
+	return self;
+}
+
+MemoryPool* MemoryPool_NewFunc( SizeT elementSize, int numElements, int delta )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(MemoryPool);
+	Type                              type = MemoryPool_Type;
+	Stg_Class_DeleteFunction*      _delete = _MemoryPool_DeleteFunc;
+	Stg_Class_PrintFunction*        _print = _MemoryPool_PrintFunc;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	
+	MemoryPool* self;
+	
+	self = _MemoryPool_New(  MEMORYPOOL_PASSARGS  );
+
+	/* Virtual functions */
+	_MemoryPool_Init( self );
+	return self;
+}
+
+void _MemoryPool_Init( MemoryPool* self ){
+	int i = 0;
+	
+	/* General info */
+	
+	assert( self );
+	_Stg_Class_Init ((Stg_Class*) self);
+	
+	assert( self->numMemChunks == 1 );
+
+	self->chunks = (MemChunk*)Memory_Alloc_Bytes_Unnamed( sizeof(MemChunk)*self->numMemChunks, "char*" );
+	self->chunks[self->numMemChunks-1].memory = (char*)Memory_Alloc_Bytes_Unnamed( self->elementSize * self->numElements, "char" );
+	memset( self->chunks[self->numMemChunks-1].memory, 0, self->elementSize * self->numElements );
+	self->chunks[self->numMemChunks-1].numFree = self->numElements;
+	self->chunks[self->numMemChunks-1].maxFree = self->numElements;
+
+	self->pool = (char**)Memory_Alloc_Bytes_Unnamed( sizeof( char* ) * self->numElements, "char*" );
+	memset( self->pool, 0, sizeof(char*) * self->numElements );
+	
+	for( i=0; i<self->numElements; i++ ){
+		self->pool[i] = &(self->chunks[self->numMemChunks-1].memory[i*self->elementSize]);
+	}
+}
+
+void *MemoryPool_Init( MemoryPool *self )
+{
+	/*TODO*/
+	return NULL;
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual Functions
+*/
+void _MemoryPool_PrintFunc ( void *memPool, Stream *stream )
+{
+	MemoryPool *self = NULL;
+	
+	self = (MemoryPool*) memPool;
+	assert( self );
+	assert( stream );
+
+	/* print parent */
+	_Stg_Class_Print( (void*) self, stream );
+
+	/* general info */
+	Journal_Printf( stream, "MemoryPool (ptr): (%p)\n", self );
+
+	/* Virtual Info */
+
+	/* MemoryPool Info */
+	Journal_Printf( stream, "\tElementSize\t\t - %d\n", self->elementSize );
+	Journal_Printf( stream, "\tNumElememts\t\t - %d\n", self->numElements );
+	Journal_Printf( stream, "\tNumElememtsFree\t\t - %d\n", self->numElementsFree );
+	Journal_Printf( stream, "\tNumMemChunks\t\t - %d\n", self->numMemChunks );
+	Journal_Printf( stream, "\tDelta\t\t\t - %d\n", self->delta );
+}
+
+void _MemoryPool_DeleteFunc( void *memPool )
+{
+	int i = 0;
+	MemoryPool *self = NULL;
+	
+	self = (MemoryPool*)memPool;
+	assert (self);
+	
+	for( i=0; i<self->numMemChunks; i++ ){
+		if( self->chunks[i].memory != ((char*)NULL) ){
+			Memory_Free( self->chunks[i].memory );
+		}
+	}
+
+	Memory_Free( self->chunks );
+	Memory_Free( self->pool );
+	
+	_Stg_Class_Delete( self );
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void *MemoryPool_NewObjectFunc( SizeT elementSize, MemoryPool *memPool )
+{
+	int index = 0;
+	int i = 0;
+	char *result = NULL;
+	
+	assert( elementSize == memPool->elementSize );
+	
+label:	index = memPool->numElementsFree - 1;
+
+	if( index < 0 ){
+		MemoryPool_Extend( memPool );
+		goto label;
+	}
+
+	result = (char*)(memPool->pool[--memPool->numElementsFree]);
+
+	for( i=0; i<memPool->numMemChunks; i++ ){
+		int numObjs = 0;
+
+		numObjs = memPool->chunks[i].maxFree*memPool->elementSize;
+		
+		if( (result >= memPool->chunks[i].memory) && (result < (memPool->chunks[i].memory+numObjs)) ){
+			memPool->chunks[i].numFree--;
+			break;
+		}
+	}
+
+	return (void*)result;
+}
+		
+Bool MemoryPool_DeleteObject( MemoryPool *memPool, void *object )
+{
+	if( object != NULL ){
+		int i = 0;
+		int valid = 0;
+
+		for ( i=0; i<memPool->numMemChunks; i++ ){
+			int numObjs = 0;
+
+			numObjs = memPool->chunks[i].maxFree*memPool->elementSize;
+			
+			if( ((char*)object >= memPool->chunks[i].memory) && ((char*)object < (memPool->chunks[i].memory+numObjs)) ){
+				memPool->chunks[i].numFree++;
+				valid = 1;
+				break;
+			}
+		}
+
+		if( valid ){
+			memset( (char*)object, 0, memPool->elementSize );
+			memPool->pool[memPool->numElementsFree++] = (char*)object;
+			MemoryPool_Shrink( memPool );
+			return True;
+		}
+		else{
+			return False;
+		}
+	}
+	else{
+		return False;
+	}
+}
+
+void MemoryPool_Extend( MemoryPool *memPool )
+{
+	int i = 0;
+	char **newPool;
+
+	assert( memPool );
+
+	memPool->numMemChunks++;
+
+	memPool->chunks = (MemChunk*)Memory_Realloc( memPool->chunks, sizeof(MemChunk)*memPool->numMemChunks );
+	assert( memPool->chunks );
+
+	memPool->chunks[memPool->numMemChunks-1].memory = (char*)Memory_Alloc_Bytes_Unnamed( memPool->elementSize * memPool->delta, "int" );
+	memset( memPool->chunks[memPool->numMemChunks-1].memory, 0, memPool->elementSize * memPool->delta );
+	memPool->chunks[memPool->numMemChunks-1].numFree = memPool->delta;
+	memPool->chunks[memPool->numMemChunks-1].maxFree = memPool->delta;
+
+	newPool = (char**)Memory_Alloc_Bytes_Unnamed( sizeof(char*) * (memPool->numElements+memPool->delta), "char*" );
+	assert( newPool );
+
+	memcpy( newPool+memPool->delta, memPool->pool, sizeof(char*)*memPool->numElements );
+
+	for( i=0; i<memPool->delta; i++ ){
+		newPool[i] = &(memPool->chunks[memPool->numMemChunks-1].memory[i*memPool->elementSize]);
+	}
+
+	Memory_Free( memPool->pool );
+	memPool->pool = newPool;
+	memPool->numElements+=memPool->delta;
+	memPool->numElementsFree=memPool->delta;
+
+	if( memPool->callbackFunc ){
+		memPool->callbackFunc( memPool->callbackFuncArg );
+	}
+}
+
+void MemoryPool_Shrink( MemoryPool *memPool )
+{
+	int i = 0;
+	Bool deleteFlag = False;
+	int chunkIdx = 0;
+	char **newPool = (char**)0;
+	int eCounter = 0;
+
+	assert( memPool );
+
+	if( memPool->numElementsFree < memPool->delta ){
+		return;
+	}
+
+	for( i=0; i<memPool->numMemChunks; i++ )
+	{
+		if( memPool->chunks[i].numFree == memPool->chunks[i].maxFree ){
+			deleteFlag = True;
+			chunkIdx = i;
+			break;
+		}
+	}
+
+	if( deleteFlag ){
+		int numObjs = 0;
+		numObjs = memPool->chunks[chunkIdx].maxFree*memPool->elementSize;
+
+		newPool = (char**)Memory_Alloc_Bytes_Unnamed( sizeof(char*) * (memPool->numElements-memPool->chunks[chunkIdx].maxFree), "char*" );
+
+		eCounter = 0;
+		for( i=0; i<memPool->numElements; i++ ){
+			if( (memPool->pool[i] >= memPool->chunks[chunkIdx].memory) && 
+					(memPool->pool[i] < (memPool->chunks[chunkIdx].memory+numObjs)) ){
+			}
+			else{
+				newPool[eCounter++] = memPool->pool[i];
+			}
+		}
+
+		Memory_Free( memPool->pool );
+		memPool->pool = newPool;
+		
+		memPool->numElements-=memPool->chunks[chunkIdx].maxFree;
+		memPool->numElementsFree-=memPool->chunks[chunkIdx].maxFree;
+
+		Memory_Free( memPool->chunks[chunkIdx].memory );
+		memPool->chunks[chunkIdx].memory = (char*)NULL;
+
+		if( chunkIdx == (memPool->numMemChunks-1) ){
+			memPool->numMemChunks--;
+
+			if( memPool->numMemChunks>0 ){
+				memPool->chunks = (MemChunk*)Memory_Realloc( memPool->chunks, sizeof(MemChunk)*memPool->numMemChunks );
+				assert( memPool->chunks );
+			}
+		}
+		else{
+			memcpy( &(memPool->chunks[chunkIdx]), &(memPool->chunks[chunkIdx+1]), sizeof(MemChunk)*(memPool->numMemChunks - (chunkIdx+1)) );
+			memPool->numMemChunks--;
+			memPool->chunks = (MemChunk*)Memory_Realloc( memPool->chunks, sizeof(MemChunk)*memPool->numMemChunks );
+			assert( memPool->chunks );
+		}
+	}
+	
+	if( memPool->callbackFunc ){
+		memPool->callbackFunc( memPool->callbackFuncArg );
+	}
+}
+
+void MemoryPool_SetCallbackFunc( MemoryPool *memPool, MemoryPool_ResizeCallbackFunc *f )
+{
+	assert( memPool );
+	memPool->callbackFunc = f;
+}
+
+void MemoryPool_SetCallbackFuncArg( MemoryPool *memPool, void *callbackFuncArg )
+{
+	assert( memPool );
+	memPool->callbackFuncArg = callbackFuncArg;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/PtrMap.c
--- a/Base/Container/src/PtrMap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: PtrMap.c 2192 2004-10-15 02:45:38Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "units.h"
-#include "types.h"
-#include "PtrMap.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-
-/* Textual name of this class */
-const Type PtrMap_Type = "PtrMap";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-PtrMap* PtrMap_New(
-		unsigned					delta )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(PtrMap);
-	Type                              type = PtrMap_Type;
-	Stg_Class_DeleteFunction*      _delete = _PtrMap_Delete;
-	Stg_Class_PrintFunction*        _print = _PtrMap_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return _PtrMap_New(  PTRMAP_PASSARGS  );
-}
-
-
-void PtrMap_Init(
-		PtrMap*						self,
-		unsigned					delta )
-{
-	/* General info */
-	self->type = PtrMap_Type;
-	self->_sizeOfSelf = sizeof(PtrMap);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _PtrMap_Delete;
-	self->_print = _PtrMap_Print;
-	self->_copy = NULL;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* PtrMap info */
-	_PtrMap_Init( self, delta );
-}
-
-
-PtrMap* _PtrMap_New(  PTRMAP_DEFARGS  )
-{
-	PtrMap*			self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(PtrMap) );
-	self = (PtrMap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* PtrMap info */
-	_PtrMap_Init( self, delta );
-	
-	return self;
-}
-
-
-void _PtrMap_Init(
-		PtrMap*					self,
-		unsigned				delta )
-{
-	/* General and Virtual info should already be set */
-	
-	/* PtrMap info */
-	assert( self );
-	
-	self->delta = delta;
-	self->maxTuples = self->delta;
-	self->tupleTbl = Memory_Alloc_Array_Unnamed( PtrMapTuple, self->maxTuples );
-	assert( self->tupleTbl ); /* TODO change this to a firewall, or something */
-
-	self->tupleCnt = 0;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _PtrMap_Delete( void* ptrMap ) {
-	PtrMap*			self = (PtrMap*)ptrMap;
-	
-	/* Stg_Class_Delete the class itself */
-	assert( self );
-	
-	if( self->tupleTbl )
-		Memory_Free( self->tupleTbl );
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-
-void _PtrMap_Print( void* ptrMap, Stream* stream ) {
-	PtrMap*			self = (PtrMap*)ptrMap;
-	
-	/* Set the Journal for printing informations */
-	Stream*			myStream;
-	myStream = Journal_Register( InfoStream_Type, "PtrMapStream" );
-
-	/* Print parent */
-	assert( self );
-	_Stg_Class_Print( self, stream );
-	
-	/* General info */
-	Journal_Printf( myStream, "PtrMap (ptr): (%p)\n", self );
-	
-	/* Virtual info */
-	
-	/* PtrMap info */
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void PtrMap_Append( void* ptrMap, void* key, void* ptr ) {
-	PtrMap*			self = (PtrMap*)ptrMap;
-	unsigned		newTupleCnt;
-	
-	assert( self && key && ptr );
-	
-	if( PtrMap_Find( self, key ) != NULL ) {
-		return;
-	}
-	
-	newTupleCnt = self->tupleCnt + 1;
-	if( newTupleCnt >= self->maxTuples ) {
-		unsigned		factor;
-		PtrMapTuple*		newTuples;
-		
-		factor = ceil( (float)(newTupleCnt - self->maxTuples) / (float)self->delta );
-		self->maxTuples += factor * self->delta;
-		
-		newTuples = Memory_Alloc_Array_Unnamed( PtrMapTuple, self->maxTuples );
-		assert( newTuples ); /* TODO change this */
-		if( self->tupleTbl ) {
-			memcpy( newTuples, self->tupleTbl, sizeof(PtrMapTuple) * self->tupleCnt );
-			Memory_Free( self->tupleTbl );
-		}
-		self->tupleTbl = newTuples;
-	}
-	
-	self->tupleTbl[self->tupleCnt].key = key;
-	self->tupleTbl[self->tupleCnt].ptr = ptr;
-	self->tupleCnt = newTupleCnt;
-}
-
-
-void* PtrMap_Find( void* ptrMap, const void* key ) {
-	PtrMap*			self = (PtrMap*)ptrMap;
-	unsigned		tuple_I;
-	
-	assert( self );
-	
-	if( key ) {
-		for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
-			if( self->tupleTbl[tuple_I].key == key )
-				return self->tupleTbl[tuple_I].ptr;
-		}
-	}
-	
-	return NULL;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/PtrMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/PtrMap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,221 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: PtrMap.c 2192 2004-10-15 02:45:38Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "units.h"
+#include "types.h"
+#include "PtrMap.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+
+/* Textual name of this class */
+const Type PtrMap_Type = "PtrMap";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+PtrMap* PtrMap_New(
+		unsigned					delta )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(PtrMap);
+	Type                              type = PtrMap_Type;
+	Stg_Class_DeleteFunction*      _delete = _PtrMap_Delete;
+	Stg_Class_PrintFunction*        _print = _PtrMap_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return _PtrMap_New(  PTRMAP_PASSARGS  );
+}
+
+
+void PtrMap_Init(
+		PtrMap*						self,
+		unsigned					delta )
+{
+	/* General info */
+	self->type = PtrMap_Type;
+	self->_sizeOfSelf = sizeof(PtrMap);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _PtrMap_Delete;
+	self->_print = _PtrMap_Print;
+	self->_copy = NULL;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* PtrMap info */
+	_PtrMap_Init( self, delta );
+}
+
+
+PtrMap* _PtrMap_New(  PTRMAP_DEFARGS  )
+{
+	PtrMap*			self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(PtrMap) );
+	self = (PtrMap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* PtrMap info */
+	_PtrMap_Init( self, delta );
+	
+	return self;
+}
+
+
+void _PtrMap_Init(
+		PtrMap*					self,
+		unsigned				delta )
+{
+	/* General and Virtual info should already be set */
+	
+	/* PtrMap info */
+	assert( self );
+	
+	self->delta = delta;
+	self->maxTuples = self->delta;
+	self->tupleTbl = Memory_Alloc_Array_Unnamed( PtrMapTuple, self->maxTuples );
+	assert( self->tupleTbl ); /* TODO change this to a firewall, or something */
+
+	self->tupleCnt = 0;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _PtrMap_Delete( void* ptrMap ) {
+	PtrMap*			self = (PtrMap*)ptrMap;
+	
+	/* Stg_Class_Delete the class itself */
+	assert( self );
+	
+	if( self->tupleTbl )
+		Memory_Free( self->tupleTbl );
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+
+void _PtrMap_Print( void* ptrMap, Stream* stream ) {
+	PtrMap*			self = (PtrMap*)ptrMap;
+	
+	/* Set the Journal for printing informations */
+	Stream*			myStream;
+	myStream = Journal_Register( InfoStream_Type, "PtrMapStream" );
+
+	/* Print parent */
+	assert( self );
+	_Stg_Class_Print( self, stream );
+	
+	/* General info */
+	Journal_Printf( myStream, "PtrMap (ptr): (%p)\n", self );
+	
+	/* Virtual info */
+	
+	/* PtrMap info */
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void PtrMap_Append( void* ptrMap, void* key, void* ptr ) {
+	PtrMap*			self = (PtrMap*)ptrMap;
+	unsigned		newTupleCnt;
+	
+	assert( self && key && ptr );
+	
+	if( PtrMap_Find( self, key ) != NULL ) {
+		return;
+	}
+	
+	newTupleCnt = self->tupleCnt + 1;
+	if( newTupleCnt >= self->maxTuples ) {
+		unsigned		factor;
+		PtrMapTuple*		newTuples;
+		
+		factor = ceil( (float)(newTupleCnt - self->maxTuples) / (float)self->delta );
+		self->maxTuples += factor * self->delta;
+		
+		newTuples = Memory_Alloc_Array_Unnamed( PtrMapTuple, self->maxTuples );
+		assert( newTuples ); /* TODO change this */
+		if( self->tupleTbl ) {
+			memcpy( newTuples, self->tupleTbl, sizeof(PtrMapTuple) * self->tupleCnt );
+			Memory_Free( self->tupleTbl );
+		}
+		self->tupleTbl = newTuples;
+	}
+	
+	self->tupleTbl[self->tupleCnt].key = key;
+	self->tupleTbl[self->tupleCnt].ptr = ptr;
+	self->tupleCnt = newTupleCnt;
+}
+
+
+void* PtrMap_Find( void* ptrMap, const void* key ) {
+	PtrMap*			self = (PtrMap*)ptrMap;
+	unsigned		tuple_I;
+	
+	assert( self );
+	
+	if( key ) {
+		for( tuple_I = 0; tuple_I < self->tupleCnt; tuple_I++ ) {
+			if( self->tupleTbl[tuple_I].key == key )
+				return self->tupleTbl[tuple_I].ptr;
+		}
+	}
+	
+	return NULL;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/PtrSet.c
--- a/Base/Container/src/PtrSet.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: PtrSet.c 2192 2004-10-15 02:45:38Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "types.h"
-#include "BTreeNode.h"
-#include "BTree.h"
-#include "Set.h"
-#include "PtrSet.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* Textual name of this class */
-const Type PtrSet_Type = "PtrSet";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-PtrSet* PtrSet_New(
-		Dictionary*					dictionary )
-{
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(PtrSet);
-	Type                                    type = PtrSet_Type;
-	Stg_Class_DeleteFunction*            _delete = _PtrSet_Delete;
-	Stg_Class_PrintFunction*              _print = _PtrSet_Print;
-	Stg_Class_CopyFunction*                _copy = NULL;
-	Set_UnionFunc*                    _unionFunc = _PtrSet_Union;
-	Set_IntersectionFunc*      _intersectionFunc = _PtrSet_Intersection;
-	Set_SubtractionFunc*        _subtractionFunc = _PtrSet_Subtraction;
-	SizeT                            elementSize = 0;
-	BTree_compareFunction*           compareFunc = _PtrSet_CompareData;
-	BTree_dataCopyFunction*         dataCopyFunc = NULL;
-	BTree_dataDeleteFunction*     dataDeleteFunc = _PtrSet_DeleteData;
-
-	return _PtrSet_New(  PTRSET_PASSARGS  );
-}
-
-
-void PtrSet_Init(
-		PtrSet*						self,
-		Dictionary*					dictionary )
-{
-	/* General info */
-	self->type = PtrSet_Type;
-	self->_sizeOfSelf = sizeof(PtrSet);
-	self->_deleteSelf = False;
-	self->dictionary = dictionary;
-	
-	/* Virtual info */
-	self->_delete = _PtrSet_Delete;
-	self->_print = _PtrSet_Print;
-	self->_copy = NULL;
-	self->_unionFunc = _PtrSet_Union;
-	self->_intersectionFunc = _PtrSet_Intersection;
-	self->_subtractionFunc = _PtrSet_Subtraction;
-	_Set_Init( (Set*)self, 0, _PtrSet_CompareData, NULL, _PtrSet_DeleteData );
-	
-	/* PtrSet info */
-	_PtrSet_Init( self );
-}
-
-
-PtrSet* _PtrSet_New(  PTRSET_DEFARGS  )
-{
-	PtrSet*	self;
-	
-	/* allocate memory */
-	assert( _sizeOfSelf >= sizeof(PtrSet) );
-	self = (PtrSet*)_Set_New(  SET_PASSARGS  );
-	
-	/* general info */
-	
-	/* virtual info */
-	
-	/* PtrSet info */
-	_PtrSet_Init( self );
-	
-	return self;
-}
-
-
-void _PtrSet_Init(
-		PtrSet*						self )
-{
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _PtrSet_Delete( void* ptrPtrSet ) {
-	PtrSet*	self = (PtrSet*)ptrPtrSet;
-	
-	/* delete the class itself */
-	
-	/* delete parent */
-	_Set_Delete( self );
-}
-
-
-void _PtrSet_Print( void* ptrPtrSet, Stream* stream ) {
-	PtrSet*		self = (PtrSet*)ptrPtrSet;
-	Stream*		myStream = Journal_Register( InfoStream_Type, "PtrSetStream" );
-
-	/* print parent */
-	_Set_Print( self, stream );
-	
-	/* general info */
-	Journal_Printf( myStream, "PtrSet (ptr): (%p)\n", self );
-	Journal_Printf( myStream, "\tdictionary (ptr): %p\n", self->dictionary );
-	
-	/* virtual info */
-	
-	/* PtrSet info */
-}
-
-
-void* _PtrSet_Union( void* ptrPtrSet, void* operand ) {
-	PtrSet*	self = (PtrSet*)ptrPtrSet;
-	PtrSet*	results;
-
-	results = PtrSet_New( self->dictionary );
-
-	BTree_ParseTree( self->_btree, _Set_BTreeUnion, results );
-	BTree_ParseTree( ((PtrSet*)operand)->_btree, _Set_BTreeUnion, results );
-
-	return results;
-}
-
-
-void* _PtrSet_Intersection( void* ptrPtrSet, void* operand ) {
-	PtrSet*	self = (PtrSet*)ptrPtrSet;
-	PtrSet*	results;
-	void*	pack[2];
-
-	results = PtrSet_New( self->dictionary );
-
-	pack[0] = operand;
-	pack[1] = results;
-	BTree_ParseTree( self->_btree, _Set_BTreeIntersection, pack );
-
-	return results;
-}
-
-
-void* _PtrSet_Subtraction( void* ptrPtrSet, void* operand ) {
-	PtrSet*	self = (PtrSet*)ptrPtrSet;
-	PtrSet*	results;
-	void*	pack[2];
-
-	results = PtrSet_New( self->dictionary );
-
-	pack[0] = operand;
-	pack[1] = results;
-	BTree_ParseTree( self->_btree, _Set_BTreeSubtraction, pack );
-
-	return results;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-int _PtrSet_CompareData( void* left, void* right ) {
-	if( (ArithPointer)left < (ArithPointer)right ) {
-		return -1;
-	}
-	else if( (ArithPointer)left > (ArithPointer)right ) {
-		return 1;
-	}
-	else {
-		return 0;
-	}
-}
-
-
-void _PtrSet_DeleteData( void* data ) {
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/PtrSet.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/PtrSet.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,223 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: PtrSet.c 2192 2004-10-15 02:45:38Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "types.h"
+#include "BTreeNode.h"
+#include "BTree.h"
+#include "Set.h"
+#include "PtrSet.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* Textual name of this class */
+const Type PtrSet_Type = "PtrSet";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+PtrSet* PtrSet_New(
+		Dictionary*					dictionary )
+{
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(PtrSet);
+	Type                                    type = PtrSet_Type;
+	Stg_Class_DeleteFunction*            _delete = _PtrSet_Delete;
+	Stg_Class_PrintFunction*              _print = _PtrSet_Print;
+	Stg_Class_CopyFunction*                _copy = NULL;
+	Set_UnionFunc*                    _unionFunc = _PtrSet_Union;
+	Set_IntersectionFunc*      _intersectionFunc = _PtrSet_Intersection;
+	Set_SubtractionFunc*        _subtractionFunc = _PtrSet_Subtraction;
+	SizeT                            elementSize = 0;
+	BTree_compareFunction*           compareFunc = _PtrSet_CompareData;
+	BTree_dataCopyFunction*         dataCopyFunc = NULL;
+	BTree_dataDeleteFunction*     dataDeleteFunc = _PtrSet_DeleteData;
+
+	return _PtrSet_New(  PTRSET_PASSARGS  );
+}
+
+
+void PtrSet_Init(
+		PtrSet*						self,
+		Dictionary*					dictionary )
+{
+	/* General info */
+	self->type = PtrSet_Type;
+	self->_sizeOfSelf = sizeof(PtrSet);
+	self->_deleteSelf = False;
+	self->dictionary = dictionary;
+	
+	/* Virtual info */
+	self->_delete = _PtrSet_Delete;
+	self->_print = _PtrSet_Print;
+	self->_copy = NULL;
+	self->_unionFunc = _PtrSet_Union;
+	self->_intersectionFunc = _PtrSet_Intersection;
+	self->_subtractionFunc = _PtrSet_Subtraction;
+	_Set_Init( (Set*)self, 0, _PtrSet_CompareData, NULL, _PtrSet_DeleteData );
+	
+	/* PtrSet info */
+	_PtrSet_Init( self );
+}
+
+
+PtrSet* _PtrSet_New(  PTRSET_DEFARGS  )
+{
+	PtrSet*	self;
+	
+	/* allocate memory */
+	assert( _sizeOfSelf >= sizeof(PtrSet) );
+	self = (PtrSet*)_Set_New(  SET_PASSARGS  );
+	
+	/* general info */
+	
+	/* virtual info */
+	
+	/* PtrSet info */
+	_PtrSet_Init( self );
+	
+	return self;
+}
+
+
+void _PtrSet_Init(
+		PtrSet*						self )
+{
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _PtrSet_Delete( void* ptrPtrSet ) {
+	PtrSet*	self = (PtrSet*)ptrPtrSet;
+	
+	/* delete the class itself */
+	
+	/* delete parent */
+	_Set_Delete( self );
+}
+
+
+void _PtrSet_Print( void* ptrPtrSet, Stream* stream ) {
+	PtrSet*		self = (PtrSet*)ptrPtrSet;
+	Stream*		myStream = Journal_Register( InfoStream_Type, "PtrSetStream" );
+
+	/* print parent */
+	_Set_Print( self, stream );
+	
+	/* general info */
+	Journal_Printf( myStream, "PtrSet (ptr): (%p)\n", self );
+	Journal_Printf( myStream, "\tdictionary (ptr): %p\n", self->dictionary );
+	
+	/* virtual info */
+	
+	/* PtrSet info */
+}
+
+
+void* _PtrSet_Union( void* ptrPtrSet, void* operand ) {
+	PtrSet*	self = (PtrSet*)ptrPtrSet;
+	PtrSet*	results;
+
+	results = PtrSet_New( self->dictionary );
+
+	BTree_ParseTree( self->_btree, _Set_BTreeUnion, results );
+	BTree_ParseTree( ((PtrSet*)operand)->_btree, _Set_BTreeUnion, results );
+
+	return results;
+}
+
+
+void* _PtrSet_Intersection( void* ptrPtrSet, void* operand ) {
+	PtrSet*	self = (PtrSet*)ptrPtrSet;
+	PtrSet*	results;
+	void*	pack[2];
+
+	results = PtrSet_New( self->dictionary );
+
+	pack[0] = operand;
+	pack[1] = results;
+	BTree_ParseTree( self->_btree, _Set_BTreeIntersection, pack );
+
+	return results;
+}
+
+
+void* _PtrSet_Subtraction( void* ptrPtrSet, void* operand ) {
+	PtrSet*	self = (PtrSet*)ptrPtrSet;
+	PtrSet*	results;
+	void*	pack[2];
+
+	results = PtrSet_New( self->dictionary );
+
+	pack[0] = operand;
+	pack[1] = results;
+	BTree_ParseTree( self->_btree, _Set_BTreeSubtraction, pack );
+
+	return results;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+int _PtrSet_CompareData( void* left, void* right ) {
+	if( (ArithPointer)left < (ArithPointer)right ) {
+		return -1;
+	}
+	else if( (ArithPointer)left > (ArithPointer)right ) {
+		return 1;
+	}
+	else {
+		return 0;
+	}
+}
+
+
+void _PtrSet_DeleteData( void* data ) {
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/RangeSet.c
--- a/Base/Container/src/RangeSet.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,616 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: RangeSet.c 3584 2006-05-16 11:11:07Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "types.h"
-#include "BTreeNode.h"
-#include "BTree.h"
-#include "RangeSet.h"
-
-
-/* Textual name of this class */
-const Type RangeSet_Type = "RangeSet";
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-RangeSet* RangeSet_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(RangeSet);
-	Type                              type = RangeSet_Type;
-	Stg_Class_DeleteFunction*      _delete = _RangeSet_Delete;
-	Stg_Class_PrintFunction*        _print = _RangeSet_Print;
-	Stg_Class_CopyFunction*          _copy = _RangeSet_Copy;
-
-	return _RangeSet_New(  RANGESET_PASSARGS  );
-}
-
-RangeSet* _RangeSet_New(  RANGESET_DEFARGS  ) {
-	RangeSet* self;
-
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(RangeSet) );
-	self = (RangeSet*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	/* Virtual info */
-
-	/* RangeSet info */
-	_RangeSet_Init( self );
-
-	return self;
-}
-
-void _RangeSet_Init( RangeSet* self ) {
-	assert( self );
-
-	self->nInds = 0;
-	self->btree = BTree_New( RangeSet_DataCompare, RangeSet_DataCopy, RangeSet_DataDelete, NULL, 
-				 BTREE_NO_DUPLICATES );
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _RangeSet_Delete( void* rangeSet ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-
-	assert( self );
-
-	RangeSet_Destruct( self );
-	FreeObject( self->btree );
-
-	/* Delete the parent. */
-	_Stg_Class_Delete( self );
-}
-
-void _RangeSet_Print( void* rangeSet, Stream* stream ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	
-	/* Set the Journal for printing informations */
-	Stream* rangeSetStream;
-	rangeSetStream = Journal_Register( InfoStream_Type, "RangeSetStream" );
-
-	/* Print parent */
-	Journal_Printf( stream, "RangeSet (ptr): (%p)\n", self );
-	_Stg_Class_Print( self, stream );
-}
-
-void* _RangeSet_Copy( const void* rangeSet, void* destProc_I, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	RangeSet*	newRangeSet;
-	unsigned	nInds, *inds;
-
-	inds = NULL;
-	RangeSet_GetIndices( self, &nInds, &inds );
-	newRangeSet = RangeSet_New();
-	RangeSet_SetIndices( newRangeSet, nInds, inds );
-	FreeArray( inds );
-
-	return (void*)newRangeSet;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void RangeSet_SetIndices( void* rangeSet, unsigned nInds, unsigned* inds ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	unsigned*	tmpInds;
-	unsigned	curInd = 0;
-
-	assert( self );
-	assert( !nInds || inds );
-
-	RangeSet_Destruct( self );
-	if( !nInds ) return;
-
-	self->nInds = nInds;
-	tmpInds = Memory_Alloc_Array_Unnamed( unsigned, nInds );
-	memcpy( tmpInds, inds, nInds * sizeof(unsigned) );
-	qsort( tmpInds, nInds, sizeof(unsigned), RangeSet_SortCmp );
-
-	while( curInd < nInds ) {
-		RangeSet_Range	rng;
-
-		rng.begin = tmpInds[curInd++];
-		while( curInd < nInds && tmpInds[curInd] == tmpInds[curInd - 1] ) {
-			curInd++;
-			self->nInds--;
-		}
-		if( curInd == nInds ) {
-			rng.end = rng.begin + 1;
-			rng.step = 1;
-			BTree_InsertNode( self->btree, &rng, sizeof(RangeSet_Range) );
-			break;
-		}
-
-		rng.end = tmpInds[curInd++];
-		while( curInd < nInds && tmpInds[curInd] == rng.end ) {
-			curInd++;
-			self->nInds--;
-		}
-		rng.step = rng.end - rng.begin;
-
-		while( curInd < nInds && tmpInds[curInd] - rng.end == rng.step ) {
-			rng.end = tmpInds[curInd++];
-			while( curInd < nInds && tmpInds[curInd] == rng.end ) {
-				curInd++;
-				self->nInds--;
-			}
-		}
-		rng.end++;
-
-		BTree_InsertNode( self->btree, &rng, sizeof(RangeSet_Range) );
-	}
-
-	FreeArray( tmpInds );
-}
-
-void RangeSet_AddIndices( void* rangeSet, unsigned nInds, unsigned* inds ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	RangeSet*	tmpSet;
-
-	assert( self );
-
-	tmpSet = RangeSet_New();
-	RangeSet_SetIndices( tmpSet, nInds, inds );
-	RangeSet_Union( self, tmpSet );
-}
-
-void RangeSet_SetRange( void* rangeSet, unsigned begin, unsigned end, unsigned step ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	RangeSet_Range	rng;
-
-	assert( self );
-
-	RangeSet_Destruct( self );
-	self->nInds = (end - begin) / step;
-	rng.begin = begin;
-	rng.end = end;
-	rng.step = step;
-	BTree_InsertNode( self->btree, &rng, sizeof(RangeSet_Range) );
-}
-
-void RangeSet_Clear( void* rangeSet ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-
-	assert( self );
-
-	RangeSet_Destruct( self );
-}
-
-void RangeSet_GetIndices( void* rangeSet, unsigned* nInds, unsigned** inds ) {
-	RangeSet*		self = (RangeSet*)rangeSet;
-	RangeSet_ParseStruct	parse;
-
-	assert( self );
-
-	parse.nInds = 0;
-	parse.inds = (*inds) ? *inds : AllocArray( unsigned, self->nInds );
-	BTree_ParseTree( self->btree, RangeSet_GetIndicesParse, &parse );
-
-	*nInds = parse.nInds;
-	*inds = parse.inds;
-
-	/* Sanity check. */
-	assert( *nInds == self->nInds );
-}
-
-unsigned RangeSet_GetSize( void* rangeSet ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-
-	assert( self );
-
-	return self->nInds;
-}
-
-unsigned RangeSet_GetNumRanges( void* rangeSet ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-
-	assert( self );
-	assert( self->btree );
-
-	return self->btree->nodeCount;
-}
-
-RangeSet_Range* RangeSet_GetRange( void* rangeSet, unsigned index ) {
-	RangeSet*		self = (RangeSet*)rangeSet;
-	RangeSet_ParseStruct	parse;
-
-	assert( self );
-	assert( self->btree );
-	assert( index < self->btree->nodeCount );
-
-	parse.nInds = index;
-	parse.curInd = 0;
-	BTree_ParseTree( self->btree, RangeSet_GetRangeParse, &parse );
-
-	return parse.range;
-}
-
-Bool RangeSet_HasIndex( void* rangeSet, unsigned index ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	RangeSet_Range	rng;
-	BTreeNode*	node;
-
-	assert( self );
-
-	rng.begin = index;
-	rng.end = index + 1;
-	rng.step = 1;
-	node = BTree_FindNode( self->btree, &rng );
-
-	if( node )
-          return RangeSet_Range_HasIndex( (RangeSet_Range*)(node->data), index );
-	else
-		return False;
-}
-
-void RangeSet_Union( void* rangeSet, RangeSet* rSet ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-	unsigned	nInds, *inds, *tmpInds;
-
-	assert( self );
-	assert( rSet );
-
-	inds = AllocArray( unsigned, rSet->nInds + self->nInds );
-	RangeSet_GetIndices( self, &nInds, &inds );
-	assert( nInds == self->nInds );
-	tmpInds = inds + self->nInds;
-	RangeSet_GetIndices( rSet, &nInds, &tmpInds );
-
-	RangeSet_SetIndices( self, rSet->nInds + self->nInds, inds );
-	FreeArray( inds );
-}
-
-void RangeSet_Intersection( void* rangeSet, RangeSet* rSet ) {
-	RangeSet*		self = (RangeSet*)rangeSet;
-	RangeSet_ParseStruct	parse;
-
-	assert( self );
-	assert( rSet );
-
-	parse.operand = rSet;
-	parse.nInds = 0;
-	parse.inds = AllocArray( unsigned, (self->nInds > rSet->nInds) ? self->nInds : rSet->nInds );
-	BTree_ParseTree( self->btree, RangeSet_IntersectionParse, &parse );
-
-	RangeSet_SetIndices( self, parse.nInds, parse.inds );
-	FreeArray( parse.inds );
-
-#if 0
-	RangeSet*		self = (RangeSet*)rangeSet;
-	RangeSet_ParseStruct	parse;
-
-	assert( self );
-	assert( rSet );
-
-	parse.self = self;
-	parse.operand = rSet;
-	parse.range = NULL;
-	parse.newTree = BTree_New( RangeSet_DataCompare, RangeSet_DataCopy, RangeSet_DataDelete, NULL, 
-					 BTREE_NO_DUPLICATES );
-	parse.nInds = 0;
-	BTree_ParseTree( self->btree, RangeSet_IntersectionParse, &parse );
-
-	FreeObject( self->btree );
-	self->btree = parse.newTree;
-	self->nInds = parse.nInds;
-#endif
-}
-
-void RangeSet_Subtraction( void* rangeSet, RangeSet* rSet ) {
-	RangeSet*		self = (RangeSet*)rangeSet;
-	RangeSet_ParseStruct	parse;
-
-	assert( self );
-	assert( rSet );
-
-	parse.operand = rSet;
-	parse.nInds = 0;
-	parse.inds = AllocArray( unsigned, self->nInds );
-	BTree_ParseTree( self->btree, RangeSet_SubtractionParse, &parse );
-
-	RangeSet_SetIndices( self, parse.nInds, parse.inds );
-	FreeArray( parse.inds );
-}
-
-void RangeSet_Pickle( void* rangeSet, unsigned* nBytes, Stg_Byte** bytes ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-
-	assert( self );
-	assert( nBytes );
-	assert( bytes );
-
-	if( self->nInds ) {
-		RangeSet_ParseStruct	parse;
-
-		*nBytes = sizeof(unsigned) + self->btree->nodeCount * sizeof(RangeSet_Range);
-		*bytes = AllocArray( Stg_Byte, *nBytes );
-		((unsigned*)*bytes)[0] = self->nInds;
-		parse.bytes = *bytes;
-		parse.curInd = 0;
-		BTree_ParseTree( self->btree, RangeSet_PickleParse, &parse );
-	}
-	else {
-		*nBytes = 0;
-		*bytes = NULL;
-	}
-}
-
-void RangeSet_Unpickle( void* rangeSet, unsigned nBytes, Stg_Byte* bytes ) {
-	RangeSet*	self = (RangeSet*)rangeSet;
-
-	assert( self );
-	assert( (nBytes - sizeof(unsigned)) % sizeof(RangeSet_Range) == 0 );
-	assert( !nBytes || bytes );
-
-	RangeSet_Destruct( self );
-
-	if( nBytes ) {
-		self->nInds = ((unsigned*)bytes)[0];
-		if( self->nInds ) {
-			unsigned	nRngs;
-			RangeSet_Range*	rng;
-			unsigned	r_i;
-
-			nRngs = (nBytes - sizeof(unsigned)) / sizeof(RangeSet_Range);
-			for( r_i = 0; r_i < nRngs; r_i++ ) {
-				rng = (RangeSet_Range*)(bytes + sizeof(unsigned) + r_i * sizeof(RangeSet_Range));
-				BTree_InsertNode( self->btree, rng, sizeof(RangeSet_Range) );
-			}
-		}
-	}
-}
-
-unsigned RangeSet_Range_GetNumIndices( RangeSet_Range* self ) {
-	unsigned	w;
-
-	assert( self );
-
-	w = self->end - self->begin;
-	return w / self->step + ((w % self->step) ? 1 : 0);
-}
-
-void RangeSet_Range_GetIndices( RangeSet_Range* self, unsigned* nInds, unsigned** inds ) {
-	unsigned	ind_i;
-
-	assert( self );
-
-	if( !(*inds) )
-		*inds = AllocArray( unsigned, RangeSet_Range_GetNumIndices( self ) );
-
-	*nInds = 0;
-	for( ind_i = self->begin; ind_i < self->end; ind_i += self->step )
-		(*inds)[(*nInds)++] = ind_i;
-}
-
-Bool RangeSet_Range_HasIndex( RangeSet_Range* self, unsigned index ) {
-	assert( self );
-	assert( self->step > 0 );
-
-	if( index < self->begin || index >= self->end )
-		return False;
-
-	return ((index - self->begin) % self->step) ? False : True;
-}
-
-void RangeSet_Range_Intersection( RangeSet_Range* left, RangeSet_Range* right, RangeSet_Range* result ) {
-	unsigned	a, b, t;
-	unsigned	ind_i;
-
-	assert( left );
-	assert( right );
-	assert( result );
-
-	/* Find start point. */
-	for( ind_i = right->begin; ind_i < right->end; ind_i += right->step ) {
-		if( RangeSet_Range_HasIndex( left, ind_i ) )
-			break;
-	}
-	if( ind_i >= right->end ) {
-		result->begin = 0;
-		result->end = 0;
-		result->step = 1;
-	}
-	else
-		result->begin = ind_i;
-
-	/* Calculate step size using Euclid's theorem. */
-	a = left->step;
-	b = right->step;
-	while( b != 0 ) {
-		t = b;
-		b = a % b;
-		a = t;
-	}
-	result->step = a;
-
-	/* Calculate end point. */
-	t = (left->end > right->end) ? left->end : right->end;
-	result->end = (t / result->step) * result->step;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-void RangeSet_GetIndicesParse( void* data, void* _parse ) {
-	RangeSet_Range*		range = (RangeSet_Range*)data;
-	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
-	unsigned		nInds, *tmpInds;
-
-	assert( range );
-	assert( parse );
-
-	tmpInds = parse->inds + parse->nInds;
-	RangeSet_Range_GetIndices( range, &nInds, &tmpInds );
-	parse->nInds += nInds;
-}
-
-void RangeSet_GetRangeParse( void* data, void* _parse ) {
-	RangeSet_Range*		range = (RangeSet_Range*)data;
-	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
-
-	assert( range );
-	assert( parse );
-
-	if( parse->curInd++ == parse->nInds )
-		parse->range = range;
-}
-
-void RangeSet_IntersectionParse( void* data, void* _parse ) {
-	RangeSet_Range*		range = (RangeSet_Range*)data;
-	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
-	unsigned		ind_i;
-
-	assert( range );
-	assert( parse );
-
-	for( ind_i = range->begin; ind_i < range->end; ind_i += range->step ) {
-		if( RangeSet_HasIndex( parse->operand, ind_i ) )
-			parse->inds[parse->nInds++] = ind_i;
-	}
-
-#if 0
-	RangeSet_Range*		range = (RangeSet_Range*)data;
-	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
-
-	assert( range );
-	assert( parse );
-
-	parse->range = data;
-	RangeSet_RangeIntersectionParse( parse->operand->btree->root, parse );
-#endif
-}
-
-void RangeSet_SubtractionParse( void* data, void* _parse ) {
-	RangeSet_Range*		range = (RangeSet_Range*)data;
-	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
-	unsigned		ind_i;
-
-	assert( range );
-	assert( parse );
-
-	for( ind_i = range->begin; ind_i < range->end; ind_i += range->step ) {
-		if( !RangeSet_HasIndex( parse->operand, ind_i ) )
-			parse->inds[parse->nInds++] = ind_i;
-	}
-}
-
-void RangeSet_PickleParse( void* data, void* _parse ) {
-	RangeSet_Range*		range = (RangeSet_Range*)data;
-	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
-
-	assert( range );
-	assert( parse );
-
-	memcpy( parse->bytes + sizeof(unsigned) + parse->curInd, range, sizeof(RangeSet_Range) );
-	parse->curInd += sizeof(RangeSet_Range);
-}
-
-#if 0
-void RangeSet_RangeIntersectionParse( BTreeNode* node, RangeSet_ParseStruct* parse ) {
-	RangeSet_Range*		range;
-	RangeSet_Range		newRng;
-	unsigned		nInds;
-
-	assert( node );
-	assert( node->data );
-	assert( parse );
-
-	range = (RangeSet_Range*)node->data;
-
-	if( range->end > parse->range->begin && range->begin < parse->range->end ) {
-		RangeSet_Range_Intersection( range, parse->range, &newRng );
-		nInds = RangeSet_Range_GetNumIndices( &newRng );
-		if( nInds ) {
-			parse->nInds += nInds;
-			BTree_InsertNode( parse->newTree, &newRng, sizeof(RangeSet_Range) );
-		}
-	}
-
-	if( range->begin < parse->range->begin && node->left != NIL )
-		RangeSet_RangeIntersectionParse( node->left, parse );
-	if( range->end > parse->range->end && node->right != NIL )
-		RangeSet_RangeIntersectionParse( node->right, parse );
-}
-#endif
-
-int RangeSet_SortCmp( const void* itema, const void* itemb ) {
-	assert( itema && itemb );
-	return *((unsigned*)itema) - *((unsigned*)itemb);
-}
-
-int RangeSet_DataCompare( void* left, void* right ) {
-	RangeSet_Range*	a = (RangeSet_Range*)left;
-	RangeSet_Range*	b = (RangeSet_Range*)right;
-
-	if( a->begin >= b->end )
-		return 1;
-	else if( a->end <= b->begin )
-		return -1;
-	else
-		return 0;
-}
-
-void RangeSet_DataCopy( void** dstData, void* data, SizeT size ) {
-	*dstData = AllocArray( RangeSet_Range, 1 );
-	memcpy( *dstData, data, sizeof(RangeSet_Range) );
-}
-
-void RangeSet_DataDelete( void* data ) {
-	FreeArray( data );
-}
-
-
-void RangeSet_Destruct( RangeSet* self ) {
-	assert( self );
-
-	self->nInds = 0;
-	FreeObject( self->btree );
-	self->btree = BTree_New( RangeSet_DataCompare, RangeSet_DataCopy, RangeSet_DataDelete, NULL, 
-				 BTREE_NO_DUPLICATES );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/RangeSet.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/RangeSet.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,616 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: RangeSet.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "types.h"
+#include "BTreeNode.h"
+#include "BTree.h"
+#include "RangeSet.h"
+
+
+/* Textual name of this class */
+const Type RangeSet_Type = "RangeSet";
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+RangeSet* RangeSet_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(RangeSet);
+	Type                              type = RangeSet_Type;
+	Stg_Class_DeleteFunction*      _delete = _RangeSet_Delete;
+	Stg_Class_PrintFunction*        _print = _RangeSet_Print;
+	Stg_Class_CopyFunction*          _copy = _RangeSet_Copy;
+
+	return _RangeSet_New(  RANGESET_PASSARGS  );
+}
+
+RangeSet* _RangeSet_New(  RANGESET_DEFARGS  ) {
+	RangeSet* self;
+
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(RangeSet) );
+	self = (RangeSet*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	/* Virtual info */
+
+	/* RangeSet info */
+	_RangeSet_Init( self );
+
+	return self;
+}
+
+void _RangeSet_Init( RangeSet* self ) {
+	assert( self );
+
+	self->nInds = 0;
+	self->btree = BTree_New( RangeSet_DataCompare, RangeSet_DataCopy, RangeSet_DataDelete, NULL, 
+				 BTREE_NO_DUPLICATES );
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _RangeSet_Delete( void* rangeSet ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+
+	assert( self );
+
+	RangeSet_Destruct( self );
+	FreeObject( self->btree );
+
+	/* Delete the parent. */
+	_Stg_Class_Delete( self );
+}
+
+void _RangeSet_Print( void* rangeSet, Stream* stream ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	
+	/* Set the Journal for printing informations */
+	Stream* rangeSetStream;
+	rangeSetStream = Journal_Register( InfoStream_Type, "RangeSetStream" );
+
+	/* Print parent */
+	Journal_Printf( stream, "RangeSet (ptr): (%p)\n", self );
+	_Stg_Class_Print( self, stream );
+}
+
+void* _RangeSet_Copy( const void* rangeSet, void* destProc_I, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	RangeSet*	newRangeSet;
+	unsigned	nInds, *inds;
+
+	inds = NULL;
+	RangeSet_GetIndices( self, &nInds, &inds );
+	newRangeSet = RangeSet_New();
+	RangeSet_SetIndices( newRangeSet, nInds, inds );
+	FreeArray( inds );
+
+	return (void*)newRangeSet;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void RangeSet_SetIndices( void* rangeSet, unsigned nInds, unsigned* inds ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	unsigned*	tmpInds;
+	unsigned	curInd = 0;
+
+	assert( self );
+	assert( !nInds || inds );
+
+	RangeSet_Destruct( self );
+	if( !nInds ) return;
+
+	self->nInds = nInds;
+	tmpInds = Memory_Alloc_Array_Unnamed( unsigned, nInds );
+	memcpy( tmpInds, inds, nInds * sizeof(unsigned) );
+	qsort( tmpInds, nInds, sizeof(unsigned), RangeSet_SortCmp );
+
+	while( curInd < nInds ) {
+		RangeSet_Range	rng;
+
+		rng.begin = tmpInds[curInd++];
+		while( curInd < nInds && tmpInds[curInd] == tmpInds[curInd - 1] ) {
+			curInd++;
+			self->nInds--;
+		}
+		if( curInd == nInds ) {
+			rng.end = rng.begin + 1;
+			rng.step = 1;
+			BTree_InsertNode( self->btree, &rng, sizeof(RangeSet_Range) );
+			break;
+		}
+
+		rng.end = tmpInds[curInd++];
+		while( curInd < nInds && tmpInds[curInd] == rng.end ) {
+			curInd++;
+			self->nInds--;
+		}
+		rng.step = rng.end - rng.begin;
+
+		while( curInd < nInds && tmpInds[curInd] - rng.end == rng.step ) {
+			rng.end = tmpInds[curInd++];
+			while( curInd < nInds && tmpInds[curInd] == rng.end ) {
+				curInd++;
+				self->nInds--;
+			}
+		}
+		rng.end++;
+
+		BTree_InsertNode( self->btree, &rng, sizeof(RangeSet_Range) );
+	}
+
+	FreeArray( tmpInds );
+}
+
+void RangeSet_AddIndices( void* rangeSet, unsigned nInds, unsigned* inds ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	RangeSet*	tmpSet;
+
+	assert( self );
+
+	tmpSet = RangeSet_New();
+	RangeSet_SetIndices( tmpSet, nInds, inds );
+	RangeSet_Union( self, tmpSet );
+}
+
+void RangeSet_SetRange( void* rangeSet, unsigned begin, unsigned end, unsigned step ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	RangeSet_Range	rng;
+
+	assert( self );
+
+	RangeSet_Destruct( self );
+	self->nInds = (end - begin) / step;
+	rng.begin = begin;
+	rng.end = end;
+	rng.step = step;
+	BTree_InsertNode( self->btree, &rng, sizeof(RangeSet_Range) );
+}
+
+void RangeSet_Clear( void* rangeSet ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+
+	assert( self );
+
+	RangeSet_Destruct( self );
+}
+
+void RangeSet_GetIndices( void* rangeSet, unsigned* nInds, unsigned** inds ) {
+	RangeSet*		self = (RangeSet*)rangeSet;
+	RangeSet_ParseStruct	parse;
+
+	assert( self );
+
+	parse.nInds = 0;
+	parse.inds = (*inds) ? *inds : AllocArray( unsigned, self->nInds );
+	BTree_ParseTree( self->btree, RangeSet_GetIndicesParse, &parse );
+
+	*nInds = parse.nInds;
+	*inds = parse.inds;
+
+	/* Sanity check. */
+	assert( *nInds == self->nInds );
+}
+
+unsigned RangeSet_GetSize( void* rangeSet ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+
+	assert( self );
+
+	return self->nInds;
+}
+
+unsigned RangeSet_GetNumRanges( void* rangeSet ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+
+	assert( self );
+	assert( self->btree );
+
+	return self->btree->nodeCount;
+}
+
+RangeSet_Range* RangeSet_GetRange( void* rangeSet, unsigned index ) {
+	RangeSet*		self = (RangeSet*)rangeSet;
+	RangeSet_ParseStruct	parse;
+
+	assert( self );
+	assert( self->btree );
+	assert( index < self->btree->nodeCount );
+
+	parse.nInds = index;
+	parse.curInd = 0;
+	BTree_ParseTree( self->btree, RangeSet_GetRangeParse, &parse );
+
+	return parse.range;
+}
+
+Bool RangeSet_HasIndex( void* rangeSet, unsigned index ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	RangeSet_Range	rng;
+	BTreeNode*	node;
+
+	assert( self );
+
+	rng.begin = index;
+	rng.end = index + 1;
+	rng.step = 1;
+	node = BTree_FindNode( self->btree, &rng );
+
+	if( node )
+          return RangeSet_Range_HasIndex( (RangeSet_Range*)(node->data), index );
+	else
+		return False;
+}
+
+void RangeSet_Union( void* rangeSet, RangeSet* rSet ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+	unsigned	nInds, *inds, *tmpInds;
+
+	assert( self );
+	assert( rSet );
+
+	inds = AllocArray( unsigned, rSet->nInds + self->nInds );
+	RangeSet_GetIndices( self, &nInds, &inds );
+	assert( nInds == self->nInds );
+	tmpInds = inds + self->nInds;
+	RangeSet_GetIndices( rSet, &nInds, &tmpInds );
+
+	RangeSet_SetIndices( self, rSet->nInds + self->nInds, inds );
+	FreeArray( inds );
+}
+
+void RangeSet_Intersection( void* rangeSet, RangeSet* rSet ) {
+	RangeSet*		self = (RangeSet*)rangeSet;
+	RangeSet_ParseStruct	parse;
+
+	assert( self );
+	assert( rSet );
+
+	parse.operand = rSet;
+	parse.nInds = 0;
+	parse.inds = AllocArray( unsigned, (self->nInds > rSet->nInds) ? self->nInds : rSet->nInds );
+	BTree_ParseTree( self->btree, RangeSet_IntersectionParse, &parse );
+
+	RangeSet_SetIndices( self, parse.nInds, parse.inds );
+	FreeArray( parse.inds );
+
+#if 0
+	RangeSet*		self = (RangeSet*)rangeSet;
+	RangeSet_ParseStruct	parse;
+
+	assert( self );
+	assert( rSet );
+
+	parse.self = self;
+	parse.operand = rSet;
+	parse.range = NULL;
+	parse.newTree = BTree_New( RangeSet_DataCompare, RangeSet_DataCopy, RangeSet_DataDelete, NULL, 
+					 BTREE_NO_DUPLICATES );
+	parse.nInds = 0;
+	BTree_ParseTree( self->btree, RangeSet_IntersectionParse, &parse );
+
+	FreeObject( self->btree );
+	self->btree = parse.newTree;
+	self->nInds = parse.nInds;
+#endif
+}
+
+void RangeSet_Subtraction( void* rangeSet, RangeSet* rSet ) {
+	RangeSet*		self = (RangeSet*)rangeSet;
+	RangeSet_ParseStruct	parse;
+
+	assert( self );
+	assert( rSet );
+
+	parse.operand = rSet;
+	parse.nInds = 0;
+	parse.inds = AllocArray( unsigned, self->nInds );
+	BTree_ParseTree( self->btree, RangeSet_SubtractionParse, &parse );
+
+	RangeSet_SetIndices( self, parse.nInds, parse.inds );
+	FreeArray( parse.inds );
+}
+
+void RangeSet_Pickle( void* rangeSet, unsigned* nBytes, Stg_Byte** bytes ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+
+	assert( self );
+	assert( nBytes );
+	assert( bytes );
+
+	if( self->nInds ) {
+		RangeSet_ParseStruct	parse;
+
+		*nBytes = sizeof(unsigned) + self->btree->nodeCount * sizeof(RangeSet_Range);
+		*bytes = AllocArray( Stg_Byte, *nBytes );
+		((unsigned*)*bytes)[0] = self->nInds;
+		parse.bytes = *bytes;
+		parse.curInd = 0;
+		BTree_ParseTree( self->btree, RangeSet_PickleParse, &parse );
+	}
+	else {
+		*nBytes = 0;
+		*bytes = NULL;
+	}
+}
+
+void RangeSet_Unpickle( void* rangeSet, unsigned nBytes, Stg_Byte* bytes ) {
+	RangeSet*	self = (RangeSet*)rangeSet;
+
+	assert( self );
+	assert( (nBytes - sizeof(unsigned)) % sizeof(RangeSet_Range) == 0 );
+	assert( !nBytes || bytes );
+
+	RangeSet_Destruct( self );
+
+	if( nBytes ) {
+		self->nInds = ((unsigned*)bytes)[0];
+		if( self->nInds ) {
+			unsigned	nRngs;
+			RangeSet_Range*	rng;
+			unsigned	r_i;
+
+			nRngs = (nBytes - sizeof(unsigned)) / sizeof(RangeSet_Range);
+			for( r_i = 0; r_i < nRngs; r_i++ ) {
+				rng = (RangeSet_Range*)(bytes + sizeof(unsigned) + r_i * sizeof(RangeSet_Range));
+				BTree_InsertNode( self->btree, rng, sizeof(RangeSet_Range) );
+			}
+		}
+	}
+}
+
+unsigned RangeSet_Range_GetNumIndices( RangeSet_Range* self ) {
+	unsigned	w;
+
+	assert( self );
+
+	w = self->end - self->begin;
+	return w / self->step + ((w % self->step) ? 1 : 0);
+}
+
+void RangeSet_Range_GetIndices( RangeSet_Range* self, unsigned* nInds, unsigned** inds ) {
+	unsigned	ind_i;
+
+	assert( self );
+
+	if( !(*inds) )
+		*inds = AllocArray( unsigned, RangeSet_Range_GetNumIndices( self ) );
+
+	*nInds = 0;
+	for( ind_i = self->begin; ind_i < self->end; ind_i += self->step )
+		(*inds)[(*nInds)++] = ind_i;
+}
+
+Bool RangeSet_Range_HasIndex( RangeSet_Range* self, unsigned index ) {
+	assert( self );
+	assert( self->step > 0 );
+
+	if( index < self->begin || index >= self->end )
+		return False;
+
+	return ((index - self->begin) % self->step) ? False : True;
+}
+
+void RangeSet_Range_Intersection( RangeSet_Range* left, RangeSet_Range* right, RangeSet_Range* result ) {
+	unsigned	a, b, t;
+	unsigned	ind_i;
+
+	assert( left );
+	assert( right );
+	assert( result );
+
+	/* Find start point. */
+	for( ind_i = right->begin; ind_i < right->end; ind_i += right->step ) {
+		if( RangeSet_Range_HasIndex( left, ind_i ) )
+			break;
+	}
+	if( ind_i >= right->end ) {
+		result->begin = 0;
+		result->end = 0;
+		result->step = 1;
+	}
+	else
+		result->begin = ind_i;
+
+	/* Calculate step size using Euclid's theorem. */
+	a = left->step;
+	b = right->step;
+	while( b != 0 ) {
+		t = b;
+		b = a % b;
+		a = t;
+	}
+	result->step = a;
+
+	/* Calculate end point. */
+	t = (left->end > right->end) ? left->end : right->end;
+	result->end = (t / result->step) * result->step;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+void RangeSet_GetIndicesParse( void* data, void* _parse ) {
+	RangeSet_Range*		range = (RangeSet_Range*)data;
+	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
+	unsigned		nInds, *tmpInds;
+
+	assert( range );
+	assert( parse );
+
+	tmpInds = parse->inds + parse->nInds;
+	RangeSet_Range_GetIndices( range, &nInds, &tmpInds );
+	parse->nInds += nInds;
+}
+
+void RangeSet_GetRangeParse( void* data, void* _parse ) {
+	RangeSet_Range*		range = (RangeSet_Range*)data;
+	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
+
+	assert( range );
+	assert( parse );
+
+	if( parse->curInd++ == parse->nInds )
+		parse->range = range;
+}
+
+void RangeSet_IntersectionParse( void* data, void* _parse ) {
+	RangeSet_Range*		range = (RangeSet_Range*)data;
+	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
+	unsigned		ind_i;
+
+	assert( range );
+	assert( parse );
+
+	for( ind_i = range->begin; ind_i < range->end; ind_i += range->step ) {
+		if( RangeSet_HasIndex( parse->operand, ind_i ) )
+			parse->inds[parse->nInds++] = ind_i;
+	}
+
+#if 0
+	RangeSet_Range*		range = (RangeSet_Range*)data;
+	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
+
+	assert( range );
+	assert( parse );
+
+	parse->range = data;
+	RangeSet_RangeIntersectionParse( parse->operand->btree->root, parse );
+#endif
+}
+
+void RangeSet_SubtractionParse( void* data, void* _parse ) {
+	RangeSet_Range*		range = (RangeSet_Range*)data;
+	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
+	unsigned		ind_i;
+
+	assert( range );
+	assert( parse );
+
+	for( ind_i = range->begin; ind_i < range->end; ind_i += range->step ) {
+		if( !RangeSet_HasIndex( parse->operand, ind_i ) )
+			parse->inds[parse->nInds++] = ind_i;
+	}
+}
+
+void RangeSet_PickleParse( void* data, void* _parse ) {
+	RangeSet_Range*		range = (RangeSet_Range*)data;
+	RangeSet_ParseStruct*	parse = (RangeSet_ParseStruct*)_parse;
+
+	assert( range );
+	assert( parse );
+
+	memcpy( parse->bytes + sizeof(unsigned) + parse->curInd, range, sizeof(RangeSet_Range) );
+	parse->curInd += sizeof(RangeSet_Range);
+}
+
+#if 0
+void RangeSet_RangeIntersectionParse( BTreeNode* node, RangeSet_ParseStruct* parse ) {
+	RangeSet_Range*		range;
+	RangeSet_Range		newRng;
+	unsigned		nInds;
+
+	assert( node );
+	assert( node->data );
+	assert( parse );
+
+	range = (RangeSet_Range*)node->data;
+
+	if( range->end > parse->range->begin && range->begin < parse->range->end ) {
+		RangeSet_Range_Intersection( range, parse->range, &newRng );
+		nInds = RangeSet_Range_GetNumIndices( &newRng );
+		if( nInds ) {
+			parse->nInds += nInds;
+			BTree_InsertNode( parse->newTree, &newRng, sizeof(RangeSet_Range) );
+		}
+	}
+
+	if( range->begin < parse->range->begin && node->left != NIL )
+		RangeSet_RangeIntersectionParse( node->left, parse );
+	if( range->end > parse->range->end && node->right != NIL )
+		RangeSet_RangeIntersectionParse( node->right, parse );
+}
+#endif
+
+int RangeSet_SortCmp( const void* itema, const void* itemb ) {
+	assert( itema && itemb );
+	return *((unsigned*)itema) - *((unsigned*)itemb);
+}
+
+int RangeSet_DataCompare( void* left, void* right ) {
+	RangeSet_Range*	a = (RangeSet_Range*)left;
+	RangeSet_Range*	b = (RangeSet_Range*)right;
+
+	if( a->begin >= b->end )
+		return 1;
+	else if( a->end <= b->begin )
+		return -1;
+	else
+		return 0;
+}
+
+void RangeSet_DataCopy( void** dstData, void* data, SizeT size ) {
+	*dstData = AllocArray( RangeSet_Range, 1 );
+	memcpy( *dstData, data, sizeof(RangeSet_Range) );
+}
+
+void RangeSet_DataDelete( void* data ) {
+	FreeArray( data );
+}
+
+
+void RangeSet_Destruct( RangeSet* self ) {
+	assert( self );
+
+	self->nInds = 0;
+	FreeObject( self->btree );
+	self->btree = BTree_New( RangeSet_DataCompare, RangeSet_DataCopy, RangeSet_DataDelete, NULL, 
+				 BTREE_NO_DUPLICATES );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/STree.c
--- a/Base/Container/src/STree.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,365 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: STree.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-#include <StGermain/Base/Foundation/Foundation.h>
-
-#include "types.h"
-#include "STree.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-#define INV_LOG2 1.442695041
-
-
-void STreeNode_Insert( STreeNode *self, STreeNode *node, STree *tree, STreeNode **par );
-void STreeNode_Destroy( STreeNode *self, STree *tree );
-int STree_IntCmp( const void* left, const void* right );
-void STree_IntDel( void* itm );
-
-
-int log2i( int x ) {
-    int e = 0;
-    while((x >> e) != 1 )
-	e++;
-    return e;
-}
-
-
-void _STree_Init( void* _self ) {
-   STree* self = Class_Cast( _self, STree );
-
-   _NewClass_Init( self );
-   self->root = NULL;
-   self->nNodes = 0;
-   self->maxNodes = 0;
-   self->alpha = 0.65;
-   self->invAlpha = 1.0 / 0.65;
-   self->curDepth = 0;
-   self->curSize = 0;
-   self->flip= 0;
-}
-
-void _STree_Destruct( void* _self ) {
-   STree* self = Class_Cast( _self, STree );
-
-   if( self->root )
-      STreeNode_Destroy( self->root, self );
-   _NewClass_Destruct( self );
-}
-
-void _STree_Copy( void* _self, const void* _op ) {
-   /*STree* self = Class_Cast( _self, STree );*/
-   /*const STree* op = Class_ConstCast( _op, STree );*/
-
-   abort();
-}
-
-void STree_SetCallbacks( void* _self, STree_CompareCB* cmp, STree_DeleteCB* del ) {
-   STree* self = Class_Cast( _self, STree );
-
-   STree_Clear( self );
-   self->cmp = cmp;
-   self->del = del;
-}
-
-void STree_SetIntCallbacks( void* _self ) {
-   STree* self = Class_Cast( _self, STree );
-
-   STree_Clear( self );
-   self->cmp = STree_IntCmp;
-   self->del = STree_IntDel;
-}
-
-void STree_SetItemSize( void* _self, int itmSize ) {
-   STree* self = Class_Cast( _self, STree );
-
-   STree_Clear( self );
-   self->itmSize = itmSize;
-}
-
-void STree_SetAlpha( void* _self, float alpha ) {
-   STree* self = Class_Cast( _self, STree );
-
-   assert( alpha >= 0.5 && alpha <= 1.0 );
-   self->alpha = alpha;
-   self->invAlpha = 1.0 / alpha;
-}
-
-void STree_Insert( void* _self, const void* itm ) {
-   STree* self = Class_Cast( _self, STree );
-   STreeNode* node;
-
-   assert( itm );
-   node = Class_Alloc( self, STreeNode );
-   node->left = NULL;
-   node->right = NULL;
-   node->data = Class_Array( self, stgByte, self->itmSize );
-   memcpy( node->data, itm, self->itmSize );
-   if ( self->root ) {
-      STreeNode_Insert( self->root, node, self, &self->root );
-      self->curDepth = 0;
-   }
-   else
-      self->root = node;
-   if ( ++self->nNodes > self->maxNodes )
-      self->maxNodes = self->nNodes;
-}
-
-void STree_Remove( void* _self, const void* itm ) {
-   STree* self = Class_Cast( _self, STree );
-   STreeNode *cur = self->root, **pre = &self->root;
-   int res;
-
-   assert( itm );
-   assert( self->cmp );
-   while( (res = self->cmp( itm, cur->data )) ) {
-      if ( res < 0 ) {
-	 pre = &cur->left;
-	 cur = cur->left;
-      }
-      else {
-	 pre = &cur->right;
-	 cur = cur->right;
-      }
-   }
-   assert( cur );
-   if ( !cur->left )
-      *pre = cur->right;
-   else if ( !cur->right )
-      *pre = cur->left;
-   else if ( !cur->left->right ) {
-      *pre = cur->left;
-      cur->left->right = cur->right;
-   }
-   else if ( !cur->right->left ) {
-      *pre = cur->right;
-      cur->right->left = cur->left;
-   }
-   else if ( self->flip ) {
-      STreeNode *last = cur->left, *preLast=NULL;
-      while ( last->right ) {
-	 preLast = last;
-	 last = last->right;
-      }
-      preLast->right = last->left;
-      last->left = cur->left;
-      last->right = cur->right;
-      *pre = last;
-      self->flip = 0;
-   }
-   else {
-      STreeNode *last = cur->right, *preLast=NULL;
-      while ( last->left ) {
-	 preLast = last;
-	 last = last->left;
-      }
-      preLast->left = last->right;
-      last->right = cur->right;
-      last->left = cur->left;
-      *pre = last;
-      self->flip = 1;
-   }
-   self->del( cur->data );
-   Class_Free( self, cur->data );
-   Class_Free( self, cur );
-   if ( --self->nNodes <= self->maxNodes / 2 ) {
-      self->root = STree_Rebalance( self, self->root, self->nNodes );
-      self->maxNodes = self->nNodes;
-   }
-}
-
-void STree_Clear( void* _self ) {
-   STree* self = Class_Cast( _self, STree );
-
-   if ( self->root ) {
-      STreeNode_Destroy( self->root, self );
-      self->root = NULL;
-      self->nNodes = 0;
-      self->maxNodes = 0;
-      self->curDepth = 0;
-      self->curSize = 0;
-      self->flip = 0;
-   }
-}
-
-int STree_GetSize( const void* _self ) {
-   const STree* self = Class_ConstCast( _self, STree );
-
-   return self->nNodes;
-}
-
-const STreeNode* STree_GetRoot( const void* _self ) {
-   const STree* self = Class_ConstCast( _self, STree );
-
-   return self->root;
-}
-
-Bool STree_Has( const void* _self, const void* itm ) {
-   STree* self = Class_Cast( _self, STree );
-   STreeNode *cur = self->root;
-   int res;
-
-   assert( self->cmp );
-   while ( cur && (res = self->cmp( itm, cur->data )) )
-      cur = (res < 0) ? cur->left : cur->right;
-
-   return cur ? True : False;
-}
-
-int STree_Size( const STreeNode *node ) {
-   if ( node )
-      return STree_Size( node->left ) + STree_Size( node->right ) + 1;
-   else
-      return 0;
-}
-
-STreeNode* STree_Rebalance( void* _self, STreeNode *root, int nNodes ) {
-   STree* self = Class_Cast( _self, STree );
-   STreeNode *pseudo, *tmp;
-
-   pseudo = Class_Alloc( self, STreeNode );
-   pseudo->left = NULL;
-   pseudo->right = root;
-   pseudo->data = NULL;
-   STree_Flatten( pseudo );
-   STree_Grow( pseudo, nNodes );
-   tmp = pseudo->right;
-   Class_Free( self, pseudo );
-
-   return tmp;
-}
-
-void STree_Flatten( STreeNode *pseudo ) {
-   STreeNode *tail, *rem;
-
-   assert( pseudo );
-   tail = pseudo;
-   rem = tail->right;
-   while ( rem ) {
-      if ( rem->left ) {
-	 STreeNode *tmp = rem->left;
-	 rem->left = tmp->right;
-	 tmp->right = rem;
-	 rem = tmp;
-	 tail->right = tmp;
-      }
-      else {
-	 tail = rem;
-	 rem = rem->right;
-      }
-   }
-}
-
-void STree_Grow( STreeNode *pseudo, int nNodes ) {
-   int nLeaves, nSpineNodes;
-
-   nLeaves = nNodes + 1 - ( 1 << log2i( nNodes + 1 ) );
-   STree_Compression( pseudo, nLeaves );
-   nSpineNodes = nNodes - nLeaves;
-   while ( nSpineNodes > 1 ) {
-      nSpineNodes /= 2;
-      STree_Compression( pseudo, nSpineNodes );
-   }
-}
-
-void STree_Compression( STreeNode *pseudo, int nSpineNodes ) {
-   STreeNode *scan = pseudo;
-   int n_i;
-
-   for ( n_i = 0; n_i < nSpineNodes; n_i++ ) {
-      STreeNode *child = scan->right;
-      scan->right = child->right;
-      scan = scan->right;
-      child->right = scan->left;
-      scan->left = child;
-   }
-}
-
-void STreeNode_Insert( STreeNode *self, STreeNode *node, STree *tree, STreeNode **par ) {
-   STreeNode **child;
-   int res;
-
-   assert( tree->cmp );
-   res = tree->cmp( node->data, self->data );
-   assert( res );
-   tree->curDepth++;
-   child = (res < 0) ? &self->left : &self->right;
-   if ( *child )
-      STreeNode_Insert( *child, node, tree, child );
-   else {
-      int height;
-      *child = node;
-      height = (int)((log( (float)(tree->nNodes + 1) ) * INV_LOG2) /
-                     (log( tree->invAlpha ) * INV_LOG2));
-      if ( tree->curDepth > height )
-	 tree->curSize = 1;
-   }
-   if ( tree->curSize ) {
-      STreeNode **bro = (res < 0) ? &self->right : &self->left;
-      int broSize = STree_Size( *bro );
-      int nodeSize = tree->curSize + broSize + 1;
-      float weight = tree->alpha * ( float )nodeSize;
-
-      if (( float )tree->curSize > weight ||
-	  ( float )broSize > weight )
-      {
-	 *par = STree_Rebalance( tree, self, nodeSize );
-	 tree->curSize = 0;
-      }
-      else
-	 tree->curSize = nodeSize;
-   }
-}
-
-void STreeNode_Destroy( STreeNode *self, STree *tree ) {
-   if ( self->left )
-      STreeNode_Destroy( self->left, tree );
-   if ( self->right )
-      STreeNode_Destroy( self->right, tree );
-   tree->del( self->data );
-   Class_Free( tree, self->data );
-   Class_Free( tree, self );
-}
-
-int STree_IntCmp( const void* left, const void* right ) {
-   return (*((int*)left) < *((int*)right)) ? -1 : 
-      (*((int*)left) > *((int*)right)) ? 1 : 0;
-}
-
-void STree_IntDel( void* itm ) {
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/STree.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/STree.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,365 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: STree.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <StGermain/Base/Foundation/Foundation.h>
+
+#include "types.h"
+#include "STree.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+#define INV_LOG2 1.442695041
+
+
+void STreeNode_Insert( STreeNode *self, STreeNode *node, STree *tree, STreeNode **par );
+void STreeNode_Destroy( STreeNode *self, STree *tree );
+int STree_IntCmp( const void* left, const void* right );
+void STree_IntDel( void* itm );
+
+
+int log2i( int x ) {
+    int e = 0;
+    while((x >> e) != 1 )
+	e++;
+    return e;
+}
+
+
+void _STree_Init( void* _self ) {
+   STree* self = Class_Cast( _self, STree );
+
+   _NewClass_Init( self );
+   self->root = NULL;
+   self->nNodes = 0;
+   self->maxNodes = 0;
+   self->alpha = 0.65;
+   self->invAlpha = 1.0 / 0.65;
+   self->curDepth = 0;
+   self->curSize = 0;
+   self->flip= 0;
+}
+
+void _STree_Destruct( void* _self ) {
+   STree* self = Class_Cast( _self, STree );
+
+   if( self->root )
+      STreeNode_Destroy( self->root, self );
+   _NewClass_Destruct( self );
+}
+
+void _STree_Copy( void* _self, const void* _op ) {
+   /*STree* self = Class_Cast( _self, STree );*/
+   /*const STree* op = Class_ConstCast( _op, STree );*/
+
+   abort();
+}
+
+void STree_SetCallbacks( void* _self, STree_CompareCB* cmp, STree_DeleteCB* del ) {
+   STree* self = Class_Cast( _self, STree );
+
+   STree_Clear( self );
+   self->cmp = cmp;
+   self->del = del;
+}
+
+void STree_SetIntCallbacks( void* _self ) {
+   STree* self = Class_Cast( _self, STree );
+
+   STree_Clear( self );
+   self->cmp = STree_IntCmp;
+   self->del = STree_IntDel;
+}
+
+void STree_SetItemSize( void* _self, int itmSize ) {
+   STree* self = Class_Cast( _self, STree );
+
+   STree_Clear( self );
+   self->itmSize = itmSize;
+}
+
+void STree_SetAlpha( void* _self, float alpha ) {
+   STree* self = Class_Cast( _self, STree );
+
+   assert( alpha >= 0.5 && alpha <= 1.0 );
+   self->alpha = alpha;
+   self->invAlpha = 1.0 / alpha;
+}
+
+void STree_Insert( void* _self, const void* itm ) {
+   STree* self = Class_Cast( _self, STree );
+   STreeNode* node;
+
+   assert( itm );
+   node = Class_Alloc( self, STreeNode );
+   node->left = NULL;
+   node->right = NULL;
+   node->data = Class_Array( self, stgByte, self->itmSize );
+   memcpy( node->data, itm, self->itmSize );
+   if ( self->root ) {
+      STreeNode_Insert( self->root, node, self, &self->root );
+      self->curDepth = 0;
+   }
+   else
+      self->root = node;
+   if ( ++self->nNodes > self->maxNodes )
+      self->maxNodes = self->nNodes;
+}
+
+void STree_Remove( void* _self, const void* itm ) {
+   STree* self = Class_Cast( _self, STree );
+   STreeNode *cur = self->root, **pre = &self->root;
+   int res;
+
+   assert( itm );
+   assert( self->cmp );
+   while( (res = self->cmp( itm, cur->data )) ) {
+      if ( res < 0 ) {
+	 pre = &cur->left;
+	 cur = cur->left;
+      }
+      else {
+	 pre = &cur->right;
+	 cur = cur->right;
+      }
+   }
+   assert( cur );
+   if ( !cur->left )
+      *pre = cur->right;
+   else if ( !cur->right )
+      *pre = cur->left;
+   else if ( !cur->left->right ) {
+      *pre = cur->left;
+      cur->left->right = cur->right;
+   }
+   else if ( !cur->right->left ) {
+      *pre = cur->right;
+      cur->right->left = cur->left;
+   }
+   else if ( self->flip ) {
+      STreeNode *last = cur->left, *preLast=NULL;
+      while ( last->right ) {
+	 preLast = last;
+	 last = last->right;
+      }
+      preLast->right = last->left;
+      last->left = cur->left;
+      last->right = cur->right;
+      *pre = last;
+      self->flip = 0;
+   }
+   else {
+      STreeNode *last = cur->right, *preLast=NULL;
+      while ( last->left ) {
+	 preLast = last;
+	 last = last->left;
+      }
+      preLast->left = last->right;
+      last->right = cur->right;
+      last->left = cur->left;
+      *pre = last;
+      self->flip = 1;
+   }
+   self->del( cur->data );
+   Class_Free( self, cur->data );
+   Class_Free( self, cur );
+   if ( --self->nNodes <= self->maxNodes / 2 ) {
+      self->root = STree_Rebalance( self, self->root, self->nNodes );
+      self->maxNodes = self->nNodes;
+   }
+}
+
+void STree_Clear( void* _self ) {
+   STree* self = Class_Cast( _self, STree );
+
+   if ( self->root ) {
+      STreeNode_Destroy( self->root, self );
+      self->root = NULL;
+      self->nNodes = 0;
+      self->maxNodes = 0;
+      self->curDepth = 0;
+      self->curSize = 0;
+      self->flip = 0;
+   }
+}
+
+int STree_GetSize( const void* _self ) {
+   const STree* self = Class_ConstCast( _self, STree );
+
+   return self->nNodes;
+}
+
+const STreeNode* STree_GetRoot( const void* _self ) {
+   const STree* self = Class_ConstCast( _self, STree );
+
+   return self->root;
+}
+
+Bool STree_Has( const void* _self, const void* itm ) {
+   STree* self = Class_Cast( _self, STree );
+   STreeNode *cur = self->root;
+   int res;
+
+   assert( self->cmp );
+   while ( cur && (res = self->cmp( itm, cur->data )) )
+      cur = (res < 0) ? cur->left : cur->right;
+
+   return cur ? True : False;
+}
+
+int STree_Size( const STreeNode *node ) {
+   if ( node )
+      return STree_Size( node->left ) + STree_Size( node->right ) + 1;
+   else
+      return 0;
+}
+
+STreeNode* STree_Rebalance( void* _self, STreeNode *root, int nNodes ) {
+   STree* self = Class_Cast( _self, STree );
+   STreeNode *pseudo, *tmp;
+
+   pseudo = Class_Alloc( self, STreeNode );
+   pseudo->left = NULL;
+   pseudo->right = root;
+   pseudo->data = NULL;
+   STree_Flatten( pseudo );
+   STree_Grow( pseudo, nNodes );
+   tmp = pseudo->right;
+   Class_Free( self, pseudo );
+
+   return tmp;
+}
+
+void STree_Flatten( STreeNode *pseudo ) {
+   STreeNode *tail, *rem;
+
+   assert( pseudo );
+   tail = pseudo;
+   rem = tail->right;
+   while ( rem ) {
+      if ( rem->left ) {
+	 STreeNode *tmp = rem->left;
+	 rem->left = tmp->right;
+	 tmp->right = rem;
+	 rem = tmp;
+	 tail->right = tmp;
+      }
+      else {
+	 tail = rem;
+	 rem = rem->right;
+      }
+   }
+}
+
+void STree_Grow( STreeNode *pseudo, int nNodes ) {
+   int nLeaves, nSpineNodes;
+
+   nLeaves = nNodes + 1 - ( 1 << log2i( nNodes + 1 ) );
+   STree_Compression( pseudo, nLeaves );
+   nSpineNodes = nNodes - nLeaves;
+   while ( nSpineNodes > 1 ) {
+      nSpineNodes /= 2;
+      STree_Compression( pseudo, nSpineNodes );
+   }
+}
+
+void STree_Compression( STreeNode *pseudo, int nSpineNodes ) {
+   STreeNode *scan = pseudo;
+   int n_i;
+
+   for ( n_i = 0; n_i < nSpineNodes; n_i++ ) {
+      STreeNode *child = scan->right;
+      scan->right = child->right;
+      scan = scan->right;
+      child->right = scan->left;
+      scan->left = child;
+   }
+}
+
+void STreeNode_Insert( STreeNode *self, STreeNode *node, STree *tree, STreeNode **par ) {
+   STreeNode **child;
+   int res;
+
+   assert( tree->cmp );
+   res = tree->cmp( node->data, self->data );
+   assert( res );
+   tree->curDepth++;
+   child = (res < 0) ? &self->left : &self->right;
+   if ( *child )
+      STreeNode_Insert( *child, node, tree, child );
+   else {
+      int height;
+      *child = node;
+      height = (int)((log( (float)(tree->nNodes + 1) ) * INV_LOG2) /
+                     (log( tree->invAlpha ) * INV_LOG2));
+      if ( tree->curDepth > height )
+	 tree->curSize = 1;
+   }
+   if ( tree->curSize ) {
+      STreeNode **bro = (res < 0) ? &self->right : &self->left;
+      int broSize = STree_Size( *bro );
+      int nodeSize = tree->curSize + broSize + 1;
+      float weight = tree->alpha * ( float )nodeSize;
+
+      if (( float )tree->curSize > weight ||
+	  ( float )broSize > weight )
+      {
+	 *par = STree_Rebalance( tree, self, nodeSize );
+	 tree->curSize = 0;
+      }
+      else
+	 tree->curSize = nodeSize;
+   }
+}
+
+void STreeNode_Destroy( STreeNode *self, STree *tree ) {
+   if ( self->left )
+      STreeNode_Destroy( self->left, tree );
+   if ( self->right )
+      STreeNode_Destroy( self->right, tree );
+   tree->del( self->data );
+   Class_Free( tree, self->data );
+   Class_Free( tree, self );
+}
+
+int STree_IntCmp( const void* left, const void* right ) {
+   return (*((int*)left) < *((int*)right)) ? -1 : 
+      (*((int*)left) > *((int*)right)) ? 1 : 0;
+}
+
+void STree_IntDel( void* itm ) {
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/STreeMap.c
--- a/Base/Container/src/STreeMap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: STreeMap.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-#include <StGermain/Base/Foundation/Foundation.h>
-
-#include "types.h"
-#include "STree.h"
-#include "STreeMap.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-void _STreeMap_Init( void* _self ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-
-   _STree_Init( self );
-   self->keySize = 0;
-   self->valSize = 0;
-}
-
-void _STreeMap_Destruct( void* _self ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-
-   _STree_Destruct( self );
-}
-
-void STreeMap_SetItemSize( void* _self, int keySize, int valSize ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-
-   STree_SetItemSize( self, keySize + valSize );
-   self->keySize = keySize;
-   self->valSize = valSize;
-}
-
-void STreeMap_Insert( void* _self, const void* key, const void* val ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-   stgByte* tmp;
-
-   tmp = (stgByte*)malloc( self->keySize + self->valSize );
-   assert( key );
-   memcpy( tmp, key, self->keySize );
-   if( val )
-      memcpy( tmp + self->keySize, val, self->valSize );
-   else
-      memset( tmp + self->keySize, 0, self->valSize );
-   STree_Insert( self, tmp );
-   if( tmp )
-     free( tmp );
-}
-
-void STreeMap_Remove( void* _self, const void* key ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-
-   STree_Remove( self, key );
-}
-
-void* STreeMap_Map( const void* _self, const void* key ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-   const STreeNode* node;
-   int res;
-
-   assert( self->root );
-   node = self->root;
-   while( node && (res = self->cmp( key, node->data )) )
-     node = (res < 0) ? node->left : node->right;
-   assert( node );
-   return node->data + self->keySize;
-}
-
-Bool STreeMap_HasKey( const void* _self, const void* key ) {
-   STreeMap* self = Class_Cast( _self, STreeMap );
-
-   return STree_Has( self, key );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/STreeMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/STreeMap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,108 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: STreeMap.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <StGermain/Base/Foundation/Foundation.h>
+
+#include "types.h"
+#include "STree.h"
+#include "STreeMap.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+void _STreeMap_Init( void* _self ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+
+   _STree_Init( self );
+   self->keySize = 0;
+   self->valSize = 0;
+}
+
+void _STreeMap_Destruct( void* _self ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+
+   _STree_Destruct( self );
+}
+
+void STreeMap_SetItemSize( void* _self, int keySize, int valSize ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+
+   STree_SetItemSize( self, keySize + valSize );
+   self->keySize = keySize;
+   self->valSize = valSize;
+}
+
+void STreeMap_Insert( void* _self, const void* key, const void* val ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+   stgByte* tmp;
+
+   tmp = (stgByte*)malloc( self->keySize + self->valSize );
+   assert( key );
+   memcpy( tmp, key, self->keySize );
+   if( val )
+      memcpy( tmp + self->keySize, val, self->valSize );
+   else
+      memset( tmp + self->keySize, 0, self->valSize );
+   STree_Insert( self, tmp );
+   if( tmp )
+     free( tmp );
+}
+
+void STreeMap_Remove( void* _self, const void* key ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+
+   STree_Remove( self, key );
+}
+
+void* STreeMap_Map( const void* _self, const void* key ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+   const STreeNode* node;
+   int res;
+
+   assert( self->root );
+   node = self->root;
+   while( node && (res = self->cmp( key, node->data )) )
+     node = (res < 0) ? node->left : node->right;
+   assert( node );
+   return node->data + self->keySize;
+}
+
+Bool STreeMap_HasKey( const void* _self, const void* key ) {
+   STreeMap* self = Class_Cast( _self, STreeMap );
+
+   return STree_Has( self, key );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Set.c
--- a/Base/Container/src/Set.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Set.c 2192 2004-10-15 02:45:38Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "types.h"
-#include "BTreeNode.h"
-#include "BTree.h"
-#include "Set.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* Textual name of this class */
-const Type Set_Type = "Set";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-Set* Set_New_all(
-		Dictionary*					dictionary, 
-		SizeT						elementSize, 
-		BTree_compareFunction*				compareFunc, 
-		BTree_dataCopyFunction*				dataCopyFunc, 
-		BTree_dataDeleteFunction*			dataDeleteFunc )
-{
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(Set);
-	Type                                    type = Set_Type;
-	Stg_Class_DeleteFunction*            _delete = _Set_Delete;
-	Stg_Class_PrintFunction*              _print = _Set_Print;
-	Stg_Class_CopyFunction*                _copy = NULL;
-	Set_UnionFunc*                    _unionFunc = _Set_Union;
-	Set_IntersectionFunc*      _intersectionFunc = _Set_Intersection;
-	Set_SubtractionFunc*        _subtractionFunc = _Set_Subtraction;
-
-	return _Set_New(  SET_PASSARGS  );
-}
-
-
-void Set_Init(
-		Set*						self,
-		Dictionary*					dictionary, 
-		SizeT						elementSize, 
-		BTree_compareFunction*				compareFunc, 
-		BTree_dataCopyFunction*				dataCopyFunc, 
-		BTree_dataDeleteFunction*			dataDeleteFunc )
-{
-	/* General info */
-	self->type = Set_Type;
-	self->_sizeOfSelf = sizeof(Set);
-	self->_deleteSelf = False;
-	self->dictionary = dictionary;
-	
-	/* Virtual info */
-	self->_delete = _Set_Delete;
-	self->_print = _Set_Print;
-	self->_copy = NULL;
-	self->_unionFunc = _Set_Union;
-	self->_intersectionFunc = _Set_Intersection;
-	self->_subtractionFunc = _Set_Subtraction;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* Set info */
-	_Set_Init( self, elementSize, compareFunc, dataCopyFunc, dataDeleteFunc );
-}
-
-
-Set* _Set_New(  SET_DEFARGS  )
-{
-	Set*	self;
-	
-	/* allocate memory */
-	assert( _sizeOfSelf >= sizeof(Set) );
-	self = (Set*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* general info */
-	self->dictionary = dictionary;
-	
-	/* virtual info */
-	self->_unionFunc = _unionFunc;
-	self->_intersectionFunc = _intersectionFunc;
-	self->_subtractionFunc = _subtractionFunc;
-	
-	/* Set info */
-	_Set_Init( self, elementSize, compareFunc, dataCopyFunc, dataDeleteFunc );
-	
-	return self;
-}
-
-
-void _Set_Init(
-		Set*						self, 
-		SizeT						elementSize, 
-		BTree_compareFunction*				compareFunc, 
-		BTree_dataCopyFunction*				dataCopyFunc, 
-		BTree_dataDeleteFunction*			dataDeleteFunc )
-{
-	/* TODO: convert to journal */
-	assert( compareFunc && dataDeleteFunc );
-
-	self->_elSize = elementSize;
-	self->_btree = BTree_New( compareFunc, dataCopyFunc, dataDeleteFunc, NULL, BTREE_ALLOW_DUPLICATES );
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _Set_Delete( void* set ) {
-	Set*	self = (Set*)set;
-	
-	/* delete the class itself */
-	Stg_Class_Delete( self->_btree );
-	
-	/* delete parent */
-	_Stg_Class_Delete( self );
-}
-
-
-void _Set_Print( void* set, Stream* stream ) {
-	Set*		self = (Set*)set;
-	Stream*		myStream = Journal_Register( InfoStream_Type, "SetStream" );
-
-	/* print parent */
-	_Stg_Class_Print( self, stream );
-	
-	/* general info */
-	Journal_Printf( myStream, "Set (ptr): (%p)\n", self );
-	Journal_Printf( myStream, "\tdictionary (ptr): %p\n", self->dictionary );
-	
-	/* virtual info */
-	
-	/* Set info */
-}
-
-
-void* _Set_Union( void* set, void* operand ) {
-	Set*	self = (Set*)set;
-	Set*	results;
-
-	results = Set_New_all( self->dictionary, 
-			       self->_elSize, 
-			       self->_btree->compareFunction, 
-			       self->_btree->dataCopyFunction, 
-			       self->_btree->dataDeleteFunction );
-
-	BTree_ParseTree( self->_btree, _Set_BTreeUnion, results );
-	BTree_ParseTree( ((Set*)operand)->_btree, _Set_BTreeUnion, results );
-
-	return results;
-}
-
-
-void* _Set_Intersection( void* set, void* operand ) {
-	Set*	self = (Set*)set;
-	Set*	results;
-	void*	pack[2];
-
-	results = Set_New_all( self->dictionary, 
-			       self->_elSize, 
-			       self->_btree->compareFunction, 
-			       self->_btree->dataCopyFunction, 
-			       self->_btree->dataDeleteFunction );
-
-	pack[0] = operand;
-	pack[1] = results;
-	BTree_ParseTree( self->_btree, _Set_BTreeIntersection, pack );
-
-	return results;
-}
-
-
-void* _Set_Subtraction( void* set, void* operand ) {
-	Set*	self = (Set*)set;
-	Set*	results;
-	void*	pack[2];
-
-	results = Set_New_all( self->dictionary, 
-			       self->_elSize, 
-			       self->_btree->compareFunction, 
-			       self->_btree->dataCopyFunction, 
-			       self->_btree->dataDeleteFunction );
-
-	pack[0] = operand;
-	pack[1] = results;
-	BTree_ParseTree( self->_btree, _Set_BTreeSubtraction, pack );
-
-	return results;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-Bool Set_Insert( void* set, void* data ) {
-	Set*      self = (Set*)set;
-
-	if( BTree_FindNode( self->_btree, data ) != NULL ) {
-		return False;
-	}
-
-	BTree_InsertNode( self->_btree, data, self->_elSize );
-
-	return True;
-}
-
-
-void Set_Traverse( void* set, BTree_parseFunction* func, void* args ) {
-	Set*      self = (Set*)set;
-
-	BTree_ParseTree( self->_btree, func, args );
-}
-
-
-Bool Set_Exists( void* set, void* data ) {
-	Set*      self = (Set*)set;
-
-	return (BTree_FindNode( self->_btree, data ) != NULL) ? True : False;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-void _Set_BTreeUnion( void* data, void* set ) {
-	Set_Insert( (Set*)set, data );
-}
-
-
-void _Set_BTreeIntersection( void* data, void* pack ) {
-	if( BTree_FindNode( ((Set**)pack)[0]->_btree, data ) != NULL ) {
-		Set_Insert( ((Set**)pack)[1], data );
-	}
-}
-
-
-void _Set_BTreeSubtraction( void* data, void* pack ) {
-	if( BTree_FindNode( ((Set**)pack)[0]->_btree, data ) == NULL ) {
-		Set_Insert( ((Set**)pack)[1], data );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/Set.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/Set.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,280 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Set.c 2192 2004-10-15 02:45:38Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "types.h"
+#include "BTreeNode.h"
+#include "BTree.h"
+#include "Set.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* Textual name of this class */
+const Type Set_Type = "Set";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+Set* Set_New_all(
+		Dictionary*					dictionary, 
+		SizeT						elementSize, 
+		BTree_compareFunction*				compareFunc, 
+		BTree_dataCopyFunction*				dataCopyFunc, 
+		BTree_dataDeleteFunction*			dataDeleteFunc )
+{
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(Set);
+	Type                                    type = Set_Type;
+	Stg_Class_DeleteFunction*            _delete = _Set_Delete;
+	Stg_Class_PrintFunction*              _print = _Set_Print;
+	Stg_Class_CopyFunction*                _copy = NULL;
+	Set_UnionFunc*                    _unionFunc = _Set_Union;
+	Set_IntersectionFunc*      _intersectionFunc = _Set_Intersection;
+	Set_SubtractionFunc*        _subtractionFunc = _Set_Subtraction;
+
+	return _Set_New(  SET_PASSARGS  );
+}
+
+
+void Set_Init(
+		Set*						self,
+		Dictionary*					dictionary, 
+		SizeT						elementSize, 
+		BTree_compareFunction*				compareFunc, 
+		BTree_dataCopyFunction*				dataCopyFunc, 
+		BTree_dataDeleteFunction*			dataDeleteFunc )
+{
+	/* General info */
+	self->type = Set_Type;
+	self->_sizeOfSelf = sizeof(Set);
+	self->_deleteSelf = False;
+	self->dictionary = dictionary;
+	
+	/* Virtual info */
+	self->_delete = _Set_Delete;
+	self->_print = _Set_Print;
+	self->_copy = NULL;
+	self->_unionFunc = _Set_Union;
+	self->_intersectionFunc = _Set_Intersection;
+	self->_subtractionFunc = _Set_Subtraction;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* Set info */
+	_Set_Init( self, elementSize, compareFunc, dataCopyFunc, dataDeleteFunc );
+}
+
+
+Set* _Set_New(  SET_DEFARGS  )
+{
+	Set*	self;
+	
+	/* allocate memory */
+	assert( _sizeOfSelf >= sizeof(Set) );
+	self = (Set*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* general info */
+	self->dictionary = dictionary;
+	
+	/* virtual info */
+	self->_unionFunc = _unionFunc;
+	self->_intersectionFunc = _intersectionFunc;
+	self->_subtractionFunc = _subtractionFunc;
+	
+	/* Set info */
+	_Set_Init( self, elementSize, compareFunc, dataCopyFunc, dataDeleteFunc );
+	
+	return self;
+}
+
+
+void _Set_Init(
+		Set*						self, 
+		SizeT						elementSize, 
+		BTree_compareFunction*				compareFunc, 
+		BTree_dataCopyFunction*				dataCopyFunc, 
+		BTree_dataDeleteFunction*			dataDeleteFunc )
+{
+	/* TODO: convert to journal */
+	assert( compareFunc && dataDeleteFunc );
+
+	self->_elSize = elementSize;
+	self->_btree = BTree_New( compareFunc, dataCopyFunc, dataDeleteFunc, NULL, BTREE_ALLOW_DUPLICATES );
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _Set_Delete( void* set ) {
+	Set*	self = (Set*)set;
+	
+	/* delete the class itself */
+	Stg_Class_Delete( self->_btree );
+	
+	/* delete parent */
+	_Stg_Class_Delete( self );
+}
+
+
+void _Set_Print( void* set, Stream* stream ) {
+	Set*		self = (Set*)set;
+	Stream*		myStream = Journal_Register( InfoStream_Type, "SetStream" );
+
+	/* print parent */
+	_Stg_Class_Print( self, stream );
+	
+	/* general info */
+	Journal_Printf( myStream, "Set (ptr): (%p)\n", self );
+	Journal_Printf( myStream, "\tdictionary (ptr): %p\n", self->dictionary );
+	
+	/* virtual info */
+	
+	/* Set info */
+}
+
+
+void* _Set_Union( void* set, void* operand ) {
+	Set*	self = (Set*)set;
+	Set*	results;
+
+	results = Set_New_all( self->dictionary, 
+			       self->_elSize, 
+			       self->_btree->compareFunction, 
+			       self->_btree->dataCopyFunction, 
+			       self->_btree->dataDeleteFunction );
+
+	BTree_ParseTree( self->_btree, _Set_BTreeUnion, results );
+	BTree_ParseTree( ((Set*)operand)->_btree, _Set_BTreeUnion, results );
+
+	return results;
+}
+
+
+void* _Set_Intersection( void* set, void* operand ) {
+	Set*	self = (Set*)set;
+	Set*	results;
+	void*	pack[2];
+
+	results = Set_New_all( self->dictionary, 
+			       self->_elSize, 
+			       self->_btree->compareFunction, 
+			       self->_btree->dataCopyFunction, 
+			       self->_btree->dataDeleteFunction );
+
+	pack[0] = operand;
+	pack[1] = results;
+	BTree_ParseTree( self->_btree, _Set_BTreeIntersection, pack );
+
+	return results;
+}
+
+
+void* _Set_Subtraction( void* set, void* operand ) {
+	Set*	self = (Set*)set;
+	Set*	results;
+	void*	pack[2];
+
+	results = Set_New_all( self->dictionary, 
+			       self->_elSize, 
+			       self->_btree->compareFunction, 
+			       self->_btree->dataCopyFunction, 
+			       self->_btree->dataDeleteFunction );
+
+	pack[0] = operand;
+	pack[1] = results;
+	BTree_ParseTree( self->_btree, _Set_BTreeSubtraction, pack );
+
+	return results;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+Bool Set_Insert( void* set, void* data ) {
+	Set*      self = (Set*)set;
+
+	if( BTree_FindNode( self->_btree, data ) != NULL ) {
+		return False;
+	}
+
+	BTree_InsertNode( self->_btree, data, self->_elSize );
+
+	return True;
+}
+
+
+void Set_Traverse( void* set, BTree_parseFunction* func, void* args ) {
+	Set*      self = (Set*)set;
+
+	BTree_ParseTree( self->_btree, func, args );
+}
+
+
+Bool Set_Exists( void* set, void* data ) {
+	Set*      self = (Set*)set;
+
+	return (BTree_FindNode( self->_btree, data ) != NULL) ? True : False;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+void _Set_BTreeUnion( void* data, void* set ) {
+	Set_Insert( (Set*)set, data );
+}
+
+
+void _Set_BTreeIntersection( void* data, void* pack ) {
+	if( BTree_FindNode( ((Set**)pack)[0]->_btree, data ) != NULL ) {
+		Set_Insert( ((Set**)pack)[1], data );
+	}
+}
+
+
+void _Set_BTreeSubtraction( void* data, void* pack ) {
+	if( BTree_FindNode( ((Set**)pack)[0]->_btree, data ) == NULL ) {
+		Set_Insert( ((Set**)pack)[1], data );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/UIntMap.c
--- a/Base/Container/src/UIntMap.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: UIntMap.c 3584 2006-05-16 11:11:07Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-
-#include "types.h"
-#include "BTreeNode.h"
-#include "BTree.h"
-#include "UIntMap.h"
-
-
-typedef struct {
-	unsigned	curItem;
-	unsigned*	keys;
-	unsigned*	vals;
-} UIntMap_ParseStruct;
-
-
-/* Textual name of this class */
-const Type UIntMap_Type = "UIntMap";
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-UIntMap* UIntMap_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(UIntMap);
-	Type                              type = UIntMap_Type;
-	Stg_Class_DeleteFunction*      _delete = _UIntMap_Delete;
-	Stg_Class_PrintFunction*        _print = _UIntMap_Print;
-	Stg_Class_CopyFunction*          _copy = _UIntMap_Copy;
-
-	return _UIntMap_New(  UINTMAP_PASSARGS  );
-}
-
-UIntMap* _UIntMap_New(  UINTMAP_DEFARGS  ) {
-	UIntMap* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(UIntMap) );
-	self = (UIntMap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	/* Virtual info */
-
-	/* UIntMap info */
-	_UIntMap_Init( self );
-
-	return self;
-}
-
-void _UIntMap_Init( UIntMap* self ) {
-	self->btree = BTree_New( UIntMap_DataCompare, UIntMap_DataCopy, UIntMap_DataDelete, NULL, 
-				  BTREE_NO_DUPLICATES );
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _UIntMap_Delete( void* generator ) {
-	UIntMap*	self = (UIntMap*)generator;
-
-	FreeObject( self->btree );
-
-	/* Delete the parent. */
-	_Stg_Class_Delete( self );
-}
-
-void _UIntMap_Print( void* generator, Stream* stream ) {
-	UIntMap*	self = (UIntMap*)generator;
-	
-	/* Set the Journal for printing informations */
-	Stream* generatorStream;
-	generatorStream = Journal_Register( InfoStream_Type, "UIntMapStream" );
-
-	/* Print parent */
-	Journal_Printf( stream, "UIntMap (ptr): (%p)\n", self );
-	_Stg_Class_Print( self, stream );
-}
-
-void* _UIntMap_Copy( const void* generator, void* destProc_I, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-#if 0
-	UIntMap*	self = (UIntMap*)generator;
-	UIntMap*	newUIntMap;
-	PtrMap*	map = ptrMap;
-	Bool	ownMap = False;
-
-	/* Damn me for making copying so difficult... what was I thinking? */
-	
-	/* We need to create a map if it doesn't already exist. */
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newUIntMap = (UIntMap*)_Mesh_Copy( self, destProc_I, deep, nameExt, map );
-	
-	/* Copy the virtual methods here. */
-
-	/* Deep or shallow? */
-	if( deep ) {
-	}
-	else {
-	}
-	
-	/* If we own the map, get rid of it here. */
-	if( ownMap ) Stg_Class_Delete( map );
-	
-	return (void*)newUIntMap;
-#endif
-
-	return NULL;
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void UIntMap_Insert( void* map, unsigned key, unsigned value ) {
-	UIntMap*	self = (UIntMap*)map;
-	BTreeNode*	node;
-
-	assert( self );
-
-	node = BTree_FindNode( self->btree, &key );
-	if( node )
-		((unsigned*)node->data)[1] = value;
-	else {
-		unsigned	data[2];
-
-		data[0] = key;
-		data[1] = value;
-		BTree_InsertNode( self->btree, data, 2 * sizeof(unsigned) );
-		self->size = self->btree->nodeCount;
-	}
-}
-
-void UIntMap_Remove( void* map, unsigned key ) {
-	UIntMap*	self = (UIntMap*)map;
-	BTreeNode*	node;
-
-	assert( self );
-
-	node = BTree_FindNode( self->btree, &key );
-	assert( node );
-	BTree_DeleteNode( self->btree, node );
-}
-
-void UIntMap_Clear( void* map ) {
-	UIntMap*	self = (UIntMap*)map;
-
-	assert( self );
-
-	FreeObject( self->btree );
-	self->btree = BTree_New( UIntMap_DataCompare, UIntMap_DataCopy, UIntMap_DataDelete, NULL, 
-				  BTREE_NO_DUPLICATES );
-}
-
-Bool UIntMap_Map( void* map, unsigned key, unsigned* value ) {
-	UIntMap*	self = (UIntMap*)map;
-	BTreeNode*	node;
-
-	assert( self );
-
-	node = BTree_FindNode( self->btree, &key );
-	if( node ) {
-		*value = ((unsigned*)node->data)[1];
-		return True;
-	}
-
-	return False;
-}
-
-void UIntMap_GetItems( void* map, unsigned* nItems, unsigned** keys, unsigned** values ) {
-	UIntMap*		self = (UIntMap*)map;
-	UIntMap_ParseStruct	parseStruct;
-
-	assert( self );
-
-	parseStruct.curItem = 0;
-	parseStruct.keys = Memory_Alloc_Array_Unnamed( unsigned, self->size );
-	parseStruct.vals = Memory_Alloc_Array_Unnamed( unsigned, self->size );
-	BTree_ParseTree( self->btree, UIntMap_ParseNode, &parseStruct );
-
-	*nItems = self->size;
-	*keys = parseStruct.keys;
-	*values = parseStruct.vals;
-}
-
-unsigned UIntMap_GetSize( void* map ) {
-	UIntMap*	self = (UIntMap*)map;
-
-	assert( self );
-
-	return self->size;
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-int UIntMap_DataCompare( void* left, void* right ) {
-	if( ((unsigned*)left)[0] > ((unsigned*)right)[0] )
-		return 1;
-	else if( ((unsigned*)left)[0] < ((unsigned*)right)[0] )
-		return -1;
-	else
-		return 0;
-}
-
-void UIntMap_DataCopy( void** dstData, void* data, SizeT size ) {
-	*dstData = Memory_Alloc_Array_Unnamed( unsigned, 2 );
-	((unsigned*)(*dstData))[0] = ((unsigned*)data)[0];
-	((unsigned*)(*dstData))[1] = ((unsigned*)data)[1];
-}
-
-void UIntMap_DataDelete( void* data ) {
-	Memory_Free( data );
-}
-
-void UIntMap_ParseNode( void* data, void* _parseStruct ) {
-	UIntMap_ParseStruct*	parseStruct = (UIntMap_ParseStruct*)_parseStruct;
-
-	assert( data );
-	assert( parseStruct );
-
-	parseStruct->keys[parseStruct->curItem] = ((unsigned*)data)[0];
-	parseStruct->vals[parseStruct->curItem++] = ((unsigned*)data)[1];
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/src/UIntMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/src/UIntMap.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,267 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: UIntMap.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+
+#include "types.h"
+#include "BTreeNode.h"
+#include "BTree.h"
+#include "UIntMap.h"
+
+
+typedef struct {
+	unsigned	curItem;
+	unsigned*	keys;
+	unsigned*	vals;
+} UIntMap_ParseStruct;
+
+
+/* Textual name of this class */
+const Type UIntMap_Type = "UIntMap";
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+UIntMap* UIntMap_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(UIntMap);
+	Type                              type = UIntMap_Type;
+	Stg_Class_DeleteFunction*      _delete = _UIntMap_Delete;
+	Stg_Class_PrintFunction*        _print = _UIntMap_Print;
+	Stg_Class_CopyFunction*          _copy = _UIntMap_Copy;
+
+	return _UIntMap_New(  UINTMAP_PASSARGS  );
+}
+
+UIntMap* _UIntMap_New(  UINTMAP_DEFARGS  ) {
+	UIntMap* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(UIntMap) );
+	self = (UIntMap*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	/* Virtual info */
+
+	/* UIntMap info */
+	_UIntMap_Init( self );
+
+	return self;
+}
+
+void _UIntMap_Init( UIntMap* self ) {
+	self->btree = BTree_New( UIntMap_DataCompare, UIntMap_DataCopy, UIntMap_DataDelete, NULL, 
+				  BTREE_NO_DUPLICATES );
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _UIntMap_Delete( void* generator ) {
+	UIntMap*	self = (UIntMap*)generator;
+
+	FreeObject( self->btree );
+
+	/* Delete the parent. */
+	_Stg_Class_Delete( self );
+}
+
+void _UIntMap_Print( void* generator, Stream* stream ) {
+	UIntMap*	self = (UIntMap*)generator;
+	
+	/* Set the Journal for printing informations */
+	Stream* generatorStream;
+	generatorStream = Journal_Register( InfoStream_Type, "UIntMapStream" );
+
+	/* Print parent */
+	Journal_Printf( stream, "UIntMap (ptr): (%p)\n", self );
+	_Stg_Class_Print( self, stream );
+}
+
+void* _UIntMap_Copy( const void* generator, void* destProc_I, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+#if 0
+	UIntMap*	self = (UIntMap*)generator;
+	UIntMap*	newUIntMap;
+	PtrMap*	map = ptrMap;
+	Bool	ownMap = False;
+
+	/* Damn me for making copying so difficult... what was I thinking? */
+	
+	/* We need to create a map if it doesn't already exist. */
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newUIntMap = (UIntMap*)_Mesh_Copy( self, destProc_I, deep, nameExt, map );
+	
+	/* Copy the virtual methods here. */
+
+	/* Deep or shallow? */
+	if( deep ) {
+	}
+	else {
+	}
+	
+	/* If we own the map, get rid of it here. */
+	if( ownMap ) Stg_Class_Delete( map );
+	
+	return (void*)newUIntMap;
+#endif
+
+	return NULL;
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void UIntMap_Insert( void* map, unsigned key, unsigned value ) {
+	UIntMap*	self = (UIntMap*)map;
+	BTreeNode*	node;
+
+	assert( self );
+
+	node = BTree_FindNode( self->btree, &key );
+	if( node )
+		((unsigned*)node->data)[1] = value;
+	else {
+		unsigned	data[2];
+
+		data[0] = key;
+		data[1] = value;
+		BTree_InsertNode( self->btree, data, 2 * sizeof(unsigned) );
+		self->size = self->btree->nodeCount;
+	}
+}
+
+void UIntMap_Remove( void* map, unsigned key ) {
+	UIntMap*	self = (UIntMap*)map;
+	BTreeNode*	node;
+
+	assert( self );
+
+	node = BTree_FindNode( self->btree, &key );
+	assert( node );
+	BTree_DeleteNode( self->btree, node );
+}
+
+void UIntMap_Clear( void* map ) {
+	UIntMap*	self = (UIntMap*)map;
+
+	assert( self );
+
+	FreeObject( self->btree );
+	self->btree = BTree_New( UIntMap_DataCompare, UIntMap_DataCopy, UIntMap_DataDelete, NULL, 
+				  BTREE_NO_DUPLICATES );
+}
+
+Bool UIntMap_Map( void* map, unsigned key, unsigned* value ) {
+	UIntMap*	self = (UIntMap*)map;
+	BTreeNode*	node;
+
+	assert( self );
+
+	node = BTree_FindNode( self->btree, &key );
+	if( node ) {
+		*value = ((unsigned*)node->data)[1];
+		return True;
+	}
+
+	return False;
+}
+
+void UIntMap_GetItems( void* map, unsigned* nItems, unsigned** keys, unsigned** values ) {
+	UIntMap*		self = (UIntMap*)map;
+	UIntMap_ParseStruct	parseStruct;
+
+	assert( self );
+
+	parseStruct.curItem = 0;
+	parseStruct.keys = Memory_Alloc_Array_Unnamed( unsigned, self->size );
+	parseStruct.vals = Memory_Alloc_Array_Unnamed( unsigned, self->size );
+	BTree_ParseTree( self->btree, UIntMap_ParseNode, &parseStruct );
+
+	*nItems = self->size;
+	*keys = parseStruct.keys;
+	*values = parseStruct.vals;
+}
+
+unsigned UIntMap_GetSize( void* map ) {
+	UIntMap*	self = (UIntMap*)map;
+
+	assert( self );
+
+	return self->size;
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+int UIntMap_DataCompare( void* left, void* right ) {
+	if( ((unsigned*)left)[0] > ((unsigned*)right)[0] )
+		return 1;
+	else if( ((unsigned*)left)[0] < ((unsigned*)right)[0] )
+		return -1;
+	else
+		return 0;
+}
+
+void UIntMap_DataCopy( void** dstData, void* data, SizeT size ) {
+	*dstData = Memory_Alloc_Array_Unnamed( unsigned, 2 );
+	((unsigned*)(*dstData))[0] = ((unsigned*)data)[0];
+	((unsigned*)(*dstData))[1] = ((unsigned*)data)[1];
+}
+
+void UIntMap_DataDelete( void* data ) {
+	Memory_Free( data );
+}
+
+void UIntMap_ParseNode( void* data, void* _parseStruct ) {
+	UIntMap_ParseStruct*	parseStruct = (UIntMap_ParseStruct*)_parseStruct;
+
+	assert( data );
+	assert( parseStruct );
+
+	parseStruct->keys[parseStruct->curItem] = ((unsigned*)data)[0];
+	parseStruct->vals[parseStruct->curItem++] = ((unsigned*)data)[1];
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/BTreeSuite.c
--- a/Base/Container/tests/BTreeSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,296 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testBTree.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "BTreeSuite.h"
-
-typedef struct {
-   BTree*       numList;
-} BTreeSuiteData;
-
-#define NUM_DATA 100
-#define NUM_DATA_LARGE 10000
-
-typedef struct praseFunctionArguments_t{
-   double result;
-}parseFunctionArguments;
-
-static int compareFunction(void *data1, void *data2)
-{
-   int *d1 = NULL, *d2 = NULL;
-
-   d1 = (int*)data1;
-   d2 = (int*)data2;
-
-   if (d1 == NULL || d2 == NULL){
-      return 0;   
-   }
-   
-   if (*d1 > *d2){
-      return  1;
-   }
-   else if (*d1 == *d2){
-      return 0;
-   }
-   else{
-      return -1;
-   }
-}
-
-static void dataPrintFunction( void *nodeData, Stream *printStream )
-{
-   assert (nodeData);
-
-   Journal_Printf( printStream, "\t%d\n", *(int*)nodeData );
-}
-
-static void dataCopyFunction( void **nodeData, void *newData, SizeT dataSize)
-{
-   *nodeData = malloc( dataSize );
-   memset(*nodeData, 0, dataSize);
-
-   memcpy(*nodeData, newData, dataSize);
-}
-
-static void dataDeleteFunction( void *nodeData )
-{
-   if( nodeData != NULL ){
-      free( nodeData );
-   }
-}
-
-void treeParseFunction( void *nodeData, void *args )
-{
-   parseFunctionArguments *arguments = NULL;
-
-   assert( nodeData );
-   arguments = (parseFunctionArguments*) args;
-   assert( arguments );
-
-   arguments->result += *(int*)nodeData;
-}
-
-
-void BTreeSuite_Setup( BTreeSuiteData* data ) {
-   data->numList = BTree_New(
-            compareFunction,
-            dataCopyFunction,
-            dataDeleteFunction,
-            dataPrintFunction,
-            BTREE_ALLOW_DUPLICATES);
-}
-
-void BTreeSuite_Teardown( BTreeSuiteData* data ) {
-   Stg_Class_Delete( data->numList );
-}
-
-
-void BTreeSuite_TestInsert( BTreeSuiteData* data ) {
-   int*                    array[NUM_DATA] = {0};
-   BTreeIterator*          iterator = NULL;
-   void*                   treeData = NULL;
-   int                     ii = 0;
-
-   /* Testing basic Insertion, Deletion and Query functions\n */
-
-   /* Inserting data into the Tree\n */
-   for(ii=0; ii<NUM_DATA; ii++){
-     array[ii] = (int*)malloc(sizeof(int));
-      *array[ii] = NUM_DATA - ii;
-      BTree_InsertNode(data->numList, (void*)array[ii], sizeof(int));
-   }
-
-   /* Expect the nodes to have been inserted from 0 to NUM_DATA now */
-   pcu_check_true(data->numList->nodeCount == NUM_DATA);
-   ii = 1;
-   iterator = BTreeIterator_New( data->numList );
-   treeData = BTreeIterator_First( iterator ); 
-   for( ; treeData != NULL; treeData = BTreeIterator_Next( iterator ) ){
-      pcu_check_true( *(int*)treeData == ii++ );
-   }
-
-   for(ii=0; ii<NUM_DATA; ii++) {
-      free( array[ii] );
-   }
-   Stg_Class_Delete( iterator );
-}   
-
-
-void BTreeSuite_TestDelete( BTreeSuiteData* data ) {
-   int*                    array[NUM_DATA] = {0};
-   BTreeIterator*          iterator = NULL;
-   void*                   treeData = NULL;
-   BTreeNode*              node = NULL;
-   int                     ii = 0;
-
-   /* Inserting data into the Tree\n */
-   for(ii=0; ii<NUM_DATA; ii++){
-     array[ii] = (int*)malloc(sizeof(int));
-      *array[ii] = NUM_DATA - ii;
-      BTree_InsertNode(data->numList, (void*)array[ii], sizeof(int));
-   }
-
-   /* \nDeleting half the nodes previously inserted into the tree\n */
-   for(ii=0; ii<NUM_DATA/2; ii++){
-      node = BTree_FindNode( data->numList, (void*)array[ii] );
-      
-      if( node ){
-         BTree_DeleteNode( data->numList, node );
-      }
-   }
-   
-   pcu_check_true(data->numList->nodeCount == NUM_DATA/2);
-   ii = 1;
-   iterator = BTreeIterator_New( data->numList );
-   treeData = BTreeIterator_First( iterator ); 
-   for( ; treeData != NULL; treeData = BTreeIterator_Next( iterator ) ){
-      pcu_check_true( *(int*)treeData == ii++ );
-   }
-
-   for(ii=0; ii<NUM_DATA; ii++) {
-      free( array[ii] );
-   }
-   Stg_Class_Delete( iterator );
-}
- 
-
-void BTreeSuite_TestFindNode( BTreeSuiteData* data ) {
-   int*                    array[NUM_DATA] = {0};
-   BTreeNode*              node = NULL;
-   int                     ii = 0;
-
-   /* Inserting data into the Tree\n */
-   for(ii=0; ii<NUM_DATA/2; ii++){
-     array[ii] = (int*)malloc(sizeof(int));
-      *array[ii] = NUM_DATA - ii;
-      BTree_InsertNode(data->numList, (void*)array[ii], sizeof(int));
-   }
-
-   /* \nSearching for Node data in the tree\n */
-   for(ii=0; ii<NUM_DATA/2; ii++){
-      node = BTree_FindNode( data->numList, array[ii] );
-      pcu_check_true( node != NULL );
-   }
-   for(ii=NUM_DATA/2; ii<NUM_DATA; ii++){
-      node = BTree_FindNode( data->numList, array[ii] );
-      pcu_check_true( node == NULL );
-   }
-
-   for(ii=0; ii<NUM_DATA; ii++) {
-      free( array[ii] );
-   }
-}
-
-
-void BTreeSuite_TestComplexityPerformance( BTreeSuiteData* data ) {
-   int                     intData = 0;
-   int                     idealComplexity = 0, hops = 0;
-   int                     ii = 0;
-   BTreeNode*              node = NULL;
-
-   srand( (unsigned)time( NULL ) );
-   for( ii=0; ii<NUM_DATA_LARGE; ii++ ) {
-      intData = (int) NUM_DATA_LARGE * (rand() / (RAND_MAX + 1.0));
-      BTree_InsertNode(data->numList, (void*)&intData, sizeof(int));
-      
-      idealComplexity = (int)ceil((log( (double)data->numList->nodeCount ) / log(2.0)));
-      
-      /* 
-       *          n >= 2^(bh) - 1
-       *  where bh is the black height of the tree 
-       *  but bh ~ h/2 
-       *  
-       *  log( n+1 ) >= (bh/2)
-       *   bh <= 2log(n+1)
-       *
-       *  */   
-      
-      pcu_check_true( node = BTree_FindNodeAndHops( data->numList, (void*)&intData, &hops ) );
-      /* Testing BTree_FindNode has a complexity of O(log n):
-         This implies similar complexity for Insertion and Deletion. */
-      /* Need the if statement to check for special case of 1-node tree, in which case both hops and
-       * idealComplexity will be 0 */
-      if ( hops > 0 ) {
-         pcu_check_true( hops < (idealComplexity * 2)  );
-      }
-   }
-}
-   
-
-void BTreeSuite_TestParseTreeForAverage( BTreeSuiteData* data ) {
-   int                     intData = 0;
-   double                  average = 0, parsedAverage = 0;
-   parseFunctionArguments  parseArguments;
-   double                  epsilon  = 1e-5;
-   int                     ii = 0;
-
-   average = 0;
-   srand( (unsigned)time( NULL ) );
-   for( ii=0; ii<NUM_DATA_LARGE; ii++ ){
-      intData = (int) NUM_DATA_LARGE * (rand() / (RAND_MAX + 1.0));
-      BTree_InsertNode(data->numList, (void*)&intData, sizeof(int));
-      average += intData;
-   }
-   /* \nCalculating the average of all the numbers stored in the tree\n */
-   average /= NUM_DATA_LARGE;
-   
-   /* Using the parseTreeFunction to parse the entire tree and calculate the average of all
-    *  the numnbers stored in the tree.
-    * The parseTreeFunction returns the sum of all the numbers in the tree via
-    * parseArguments.result, where parseArguments is a user specified struct. */
-
-   parseArguments.result = 0;
-   BTree_ParseTree( data->numList, treeParseFunction, (void*) &parseArguments );
-   parsedAverage = parseArguments.result / NUM_DATA_LARGE;
-
-   pcu_check_true( fabs(average - parsedAverage) < epsilon );
-}
-
-
-void BTreeSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, BTreeSuiteData );
-   pcu_suite_setFixtures( suite, BTreeSuite_Setup, BTreeSuite_Teardown );
-   pcu_suite_addTest( suite, BTreeSuite_TestInsert );
-   pcu_suite_addTest( suite, BTreeSuite_TestDelete );
-   pcu_suite_addTest( suite, BTreeSuite_TestFindNode );
-   pcu_suite_addTest( suite, BTreeSuite_TestComplexityPerformance );
-   pcu_suite_addTest( suite, BTreeSuite_TestParseTreeForAverage );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/BTreeSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/BTreeSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,296 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testBTree.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "BTreeSuite.h"
+
+typedef struct {
+   BTree*       numList;
+} BTreeSuiteData;
+
+#define NUM_DATA 100
+#define NUM_DATA_LARGE 10000
+
+typedef struct praseFunctionArguments_t{
+   double result;
+}parseFunctionArguments;
+
+static int compareFunction(void *data1, void *data2)
+{
+   int *d1 = NULL, *d2 = NULL;
+
+   d1 = (int*)data1;
+   d2 = (int*)data2;
+
+   if (d1 == NULL || d2 == NULL){
+      return 0;   
+   }
+   
+   if (*d1 > *d2){
+      return  1;
+   }
+   else if (*d1 == *d2){
+      return 0;
+   }
+   else{
+      return -1;
+   }
+}
+
+static void dataPrintFunction( void *nodeData, Stream *printStream )
+{
+   assert (nodeData);
+
+   Journal_Printf( printStream, "\t%d\n", *(int*)nodeData );
+}
+
+static void dataCopyFunction( void **nodeData, void *newData, SizeT dataSize)
+{
+   *nodeData = malloc( dataSize );
+   memset(*nodeData, 0, dataSize);
+
+   memcpy(*nodeData, newData, dataSize);
+}
+
+static void dataDeleteFunction( void *nodeData )
+{
+   if( nodeData != NULL ){
+      free( nodeData );
+   }
+}
+
+void treeParseFunction( void *nodeData, void *args )
+{
+   parseFunctionArguments *arguments = NULL;
+
+   assert( nodeData );
+   arguments = (parseFunctionArguments*) args;
+   assert( arguments );
+
+   arguments->result += *(int*)nodeData;
+}
+
+
+void BTreeSuite_Setup( BTreeSuiteData* data ) {
+   data->numList = BTree_New(
+            compareFunction,
+            dataCopyFunction,
+            dataDeleteFunction,
+            dataPrintFunction,
+            BTREE_ALLOW_DUPLICATES);
+}
+
+void BTreeSuite_Teardown( BTreeSuiteData* data ) {
+   Stg_Class_Delete( data->numList );
+}
+
+
+void BTreeSuite_TestInsert( BTreeSuiteData* data ) {
+   int*                    array[NUM_DATA] = {0};
+   BTreeIterator*          iterator = NULL;
+   void*                   treeData = NULL;
+   int                     ii = 0;
+
+   /* Testing basic Insertion, Deletion and Query functions\n */
+
+   /* Inserting data into the Tree\n */
+   for(ii=0; ii<NUM_DATA; ii++){
+     array[ii] = (int*)malloc(sizeof(int));
+      *array[ii] = NUM_DATA - ii;
+      BTree_InsertNode(data->numList, (void*)array[ii], sizeof(int));
+   }
+
+   /* Expect the nodes to have been inserted from 0 to NUM_DATA now */
+   pcu_check_true(data->numList->nodeCount == NUM_DATA);
+   ii = 1;
+   iterator = BTreeIterator_New( data->numList );
+   treeData = BTreeIterator_First( iterator ); 
+   for( ; treeData != NULL; treeData = BTreeIterator_Next( iterator ) ){
+      pcu_check_true( *(int*)treeData == ii++ );
+   }
+
+   for(ii=0; ii<NUM_DATA; ii++) {
+      free( array[ii] );
+   }
+   Stg_Class_Delete( iterator );
+}   
+
+
+void BTreeSuite_TestDelete( BTreeSuiteData* data ) {
+   int*                    array[NUM_DATA] = {0};
+   BTreeIterator*          iterator = NULL;
+   void*                   treeData = NULL;
+   BTreeNode*              node = NULL;
+   int                     ii = 0;
+
+   /* Inserting data into the Tree\n */
+   for(ii=0; ii<NUM_DATA; ii++){
+     array[ii] = (int*)malloc(sizeof(int));
+      *array[ii] = NUM_DATA - ii;
+      BTree_InsertNode(data->numList, (void*)array[ii], sizeof(int));
+   }
+
+   /* \nDeleting half the nodes previously inserted into the tree\n */
+   for(ii=0; ii<NUM_DATA/2; ii++){
+      node = BTree_FindNode( data->numList, (void*)array[ii] );
+      
+      if( node ){
+         BTree_DeleteNode( data->numList, node );
+      }
+   }
+   
+   pcu_check_true(data->numList->nodeCount == NUM_DATA/2);
+   ii = 1;
+   iterator = BTreeIterator_New( data->numList );
+   treeData = BTreeIterator_First( iterator ); 
+   for( ; treeData != NULL; treeData = BTreeIterator_Next( iterator ) ){
+      pcu_check_true( *(int*)treeData == ii++ );
+   }
+
+   for(ii=0; ii<NUM_DATA; ii++) {
+      free( array[ii] );
+   }
+   Stg_Class_Delete( iterator );
+}
+ 
+
+void BTreeSuite_TestFindNode( BTreeSuiteData* data ) {
+   int*                    array[NUM_DATA] = {0};
+   BTreeNode*              node = NULL;
+   int                     ii = 0;
+
+   /* Inserting data into the Tree\n */
+   for(ii=0; ii<NUM_DATA/2; ii++){
+     array[ii] = (int*)malloc(sizeof(int));
+      *array[ii] = NUM_DATA - ii;
+      BTree_InsertNode(data->numList, (void*)array[ii], sizeof(int));
+   }
+
+   /* \nSearching for Node data in the tree\n */
+   for(ii=0; ii<NUM_DATA/2; ii++){
+      node = BTree_FindNode( data->numList, array[ii] );
+      pcu_check_true( node != NULL );
+   }
+   for(ii=NUM_DATA/2; ii<NUM_DATA; ii++){
+      node = BTree_FindNode( data->numList, array[ii] );
+      pcu_check_true( node == NULL );
+   }
+
+   for(ii=0; ii<NUM_DATA; ii++) {
+      free( array[ii] );
+   }
+}
+
+
+void BTreeSuite_TestComplexityPerformance( BTreeSuiteData* data ) {
+   int                     intData = 0;
+   int                     idealComplexity = 0, hops = 0;
+   int                     ii = 0;
+   BTreeNode*              node = NULL;
+
+   srand( (unsigned)time( NULL ) );
+   for( ii=0; ii<NUM_DATA_LARGE; ii++ ) {
+      intData = (int) NUM_DATA_LARGE * (rand() / (RAND_MAX + 1.0));
+      BTree_InsertNode(data->numList, (void*)&intData, sizeof(int));
+      
+      idealComplexity = (int)ceil((log( (double)data->numList->nodeCount ) / log(2.0)));
+      
+      /* 
+       *          n >= 2^(bh) - 1
+       *  where bh is the black height of the tree 
+       *  but bh ~ h/2 
+       *  
+       *  log( n+1 ) >= (bh/2)
+       *   bh <= 2log(n+1)
+       *
+       *  */   
+      
+      pcu_check_true( node = BTree_FindNodeAndHops( data->numList, (void*)&intData, &hops ) );
+      /* Testing BTree_FindNode has a complexity of O(log n):
+         This implies similar complexity for Insertion and Deletion. */
+      /* Need the if statement to check for special case of 1-node tree, in which case both hops and
+       * idealComplexity will be 0 */
+      if ( hops > 0 ) {
+         pcu_check_true( hops < (idealComplexity * 2)  );
+      }
+   }
+}
+   
+
+void BTreeSuite_TestParseTreeForAverage( BTreeSuiteData* data ) {
+   int                     intData = 0;
+   double                  average = 0, parsedAverage = 0;
+   parseFunctionArguments  parseArguments;
+   double                  epsilon  = 1e-5;
+   int                     ii = 0;
+
+   average = 0;
+   srand( (unsigned)time( NULL ) );
+   for( ii=0; ii<NUM_DATA_LARGE; ii++ ){
+      intData = (int) NUM_DATA_LARGE * (rand() / (RAND_MAX + 1.0));
+      BTree_InsertNode(data->numList, (void*)&intData, sizeof(int));
+      average += intData;
+   }
+   /* \nCalculating the average of all the numbers stored in the tree\n */
+   average /= NUM_DATA_LARGE;
+   
+   /* Using the parseTreeFunction to parse the entire tree and calculate the average of all
+    *  the numnbers stored in the tree.
+    * The parseTreeFunction returns the sum of all the numbers in the tree via
+    * parseArguments.result, where parseArguments is a user specified struct. */
+
+   parseArguments.result = 0;
+   BTree_ParseTree( data->numList, treeParseFunction, (void*) &parseArguments );
+   parsedAverage = parseArguments.result / NUM_DATA_LARGE;
+
+   pcu_check_true( fabs(average - parsedAverage) < epsilon );
+}
+
+
+void BTreeSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, BTreeSuiteData );
+   pcu_suite_setFixtures( suite, BTreeSuite_Setup, BTreeSuite_Teardown );
+   pcu_suite_addTest( suite, BTreeSuite_TestInsert );
+   pcu_suite_addTest( suite, BTreeSuite_TestDelete );
+   pcu_suite_addTest( suite, BTreeSuite_TestFindNode );
+   pcu_suite_addTest( suite, BTreeSuite_TestComplexityPerformance );
+   pcu_suite_addTest( suite, BTreeSuite_TestParseTreeForAverage );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/HashTableSuite.c
--- a/Base/Container/tests/HashTableSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testHashTable.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "HashTableSuite.h"
-
-
-unsigned int NumWords_Global = 0; 
-/* Expect to read in ~100 words */
-char* WordList_Global[1000];
-
-
-typedef struct {
-   HashTable*       table;
-   HashTable*       ptrTable;
-} HashTableSuiteData;
-
-typedef struct DataRef {
-   void* ptr;
-   Bool  found;
-} DataRef;
-
-void deleteFunction( void *entry ){
-	assert( entry );
-
-	Memory_Free( entry );
-}
-
-void printFunction( void *entry, void *stream ){
-	
-	assert( entry );
-	assert( stream );
-
-	Journal_Printf( (Stream*)stream, "\t\t%s", (void*)entry );
-}
-
-void ptrPrintFunction( void *entry, void *stream ){
-	
-	assert( entry );
-	assert( stream );
-
-	Journal_Printf( (Stream*)stream, "\t\t(ptr)%p\n", (void*)entry );
-}
-
-void checkFunction( const void *entry, void *arg ){
-   int*     wordFoundArray = (int*)arg;
-   Index    ii;
-	
-	assert( entry );
-
-   for (ii=0; ii<NumWords_Global; ii++) {
-     if ( 0 == strcmp( (Name)entry, WordList_Global[ii] ) ) {
-         wordFoundArray[ii] = True;
-         break;
-      }
-   }
-}
-
-void checkPtrFunction( const void *entry, void *arg ){
-   DataRef*    dataRefs = (DataRef*)arg;
-   Index       ii;
-	
-	assert( entry );
-
-   for (ii=0; ii<NumWords_Global; ii++) {
-      /* Deliberately comparing ptrs here, rather than strings */
-	   if ( entry == dataRefs[ii].ptr ) {
-         dataRefs[ii].found = True;
-         break;
-      }
-   }
-}
-
-
-void HashTableSuite_Setup( HashTableSuiteData* data ) {
-   char     dictFilename[PCU_PATH_MAX];
-   FILE*    dictFile=NULL;
-   char     wordBuffer[1024];
-
-   /* Read in the words from the dictionary file */
-   pcu_filename_input( "dictionary.txt", dictFilename );
-   dictFile = fopen( dictFilename, "r+" );
-   NumWords_Global=0;
-   while( (fgets( wordBuffer, sizeof(wordBuffer), dictFile ) != NULL) ){
-      WordList_Global[NumWords_Global++] = StG_Strdup(wordBuffer);
-   }
-   fclose( dictFile );
-
-   data->table = HashTable_New( NULL, printFunction, NULL, HASHTABLE_STRING_KEY );
-   data->ptrTable = HashTable_New( NULL, ptrPrintFunction, deleteFunction, HASHTABLE_POINTER_KEY );
-}
-
-void HashTableSuite_Teardown( HashTableSuiteData* data ) {
-   Index    ii;
-
-   Stg_Class_Delete( data->table );
-   Stg_Class_Delete( data->ptrTable );
-   for ( ii=0; ii < NumWords_Global; ii++ ) {
-      Memory_Free( WordList_Global[ii] );
-   }
-   NumWords_Global=0;
-}
-
-
-void HashTableSuite_TestInsert( HashTableSuiteData* data ) {
-   char           *word = NULL;
-   int            result = 0;
-   int            sum = 0;
-   Bool           wordFoundArray[NumWords_Global];
-   Index          ii=0;
-   
-   
-   /* Testing hash table with string keys..\n\n */
-   /* Inserting data into the hash table\n\n */
-   for (ii=0; ii<NumWords_Global; ii++) {
-      word = StG_Strdup(WordList_Global[ii]);
-      result = HashTable_InsertEntry( data->table, (void*)word, strlen(word), (void*)word, strlen(word));
-      sum += result;
-   }
-   
-   pcu_check_true( NumWords_Global == data->table->count );
-
-   /* The count of insertion operations should be at least the number of entries we inserted */
-   pcu_check_true( sum >= 0 );
-
-   /* This is a basic check that the number of collisions was within reason. Perhaps a stricter
-    *  mathematical calc should really be performed here */
-   /* Hash table has 255 places, only inserted 100 entries, therefore not many collisions expected */
-   pcu_check_true( sum <= (data->table->count * 0.3) );
-   
-   /* Now parse the tree, and check the actual entries - note they won't necessarily be in same 'order'
-    * while being parsed */
-   for (ii=0; ii<NumWords_Global; ii++) {
-      wordFoundArray[ii] = False;
-   }   
-   HashTable_ParseTable( data->table, checkFunction, wordFoundArray );
-   for (ii=0; ii<NumWords_Global; ii++) {
-      pcu_check_true( wordFoundArray[ii] == True );
-   }
-}
-
-
-void HashTableSuite_TestSearch( HashTableSuiteData* data ) {
-   char*          word = NULL;
-   Index          ii=0;
-   char*          searchResult = NULL;
-
-   /* Inserting data into the hash table\n\n */
-   for (ii=0; ii<NumWords_Global; ii++) {
-      word = StG_Strdup(WordList_Global[ii]);
-      HashTable_InsertEntry( data->table, (void*)word, strlen(word), (void*)word, strlen(word));
-   }
-   
-   for (ii=0; ii<NumWords_Global; ii++) {
-      searchResult = (char*)HashTable_FindEntry( data->table, WordList_Global[ii], strlen(WordList_Global[ii]), char* );
-      pcu_check_true( searchResult != NULL );
-      pcu_check_streq( WordList_Global[ii], searchResult );
-   }
-}
-
-
-void HashTableSuite_TestInsertPointers( HashTableSuiteData* data ) {
-   char           *word = NULL;
-   int            result = 0;
-   int            sum = 0;
-   DataRef        dataRefs[NumWords_Global];
-   Index          ii=0;
-
-   for (ii=0; ii<NumWords_Global; ii++) {
-      dataRefs[ii].ptr = NULL;
-      dataRefs[ii].found = False;
-   }
-   /* Testing hash table with pointer keys..\n\n */
-   /* Inserting data into the hash table\n\n */
-   
-   for (ii=0; ii<NumWords_Global; ii++) {
-      word = StG_Strdup(WordList_Global[ii]);
-      result = HashTable_InsertEntry( data->ptrTable, (void*)word, sizeof(void*), (void*)word, strlen(word));
-      sum += result;
-      dataRefs[ii].ptr = word;
-   }
-   
-   pcu_check_true( NumWords_Global == data->ptrTable->count );
-
-   /* The count of insertion operations should be at least the number of entries we inserted */
-   pcu_check_true( sum >= 0 );
-
-   /* This is a basic check that the number of collisions was within reason. Perhaps a stricter
-    *  mathematical calc should really be performed here */
-   /* Hash table has 255 places, only inserted 100 entries, therefore not many collisions expected */
-   pcu_check_true( sum <= (int)(data->ptrTable->count * 0.4) );
-   
-   /* Now parse the tree, and check the actual entries - note they won't necessarily be in same 'order'
-    * while being parsed */
-   HashTable_ParseTable( data->ptrTable, checkPtrFunction, dataRefs );
-   for (ii=0; ii<NumWords_Global; ii++) {
-      pcu_check_true( dataRefs[ii].found == True );
-   }
-}
-
-
-/* Searching for items in the table:\n\n */
-void HashTableSuite_TestSearchPointers( HashTableSuiteData* data ) {
-   char           *word = NULL;
-   DataRef        dataRefs[NumWords_Global];
-   Index          ii=0;
-   char*          searchResult = NULL;
-
-   for (ii=0; ii<NumWords_Global; ii++) {
-      dataRefs[ii].ptr = NULL;
-      dataRefs[ii].found = False;
-   }
-   /* Inserting data into the hash table\n\n */
-   for (ii=0; ii<NumWords_Global; ii++) {
-      word = StG_Strdup(WordList_Global[ii]);
-      HashTable_InsertEntry( data->ptrTable, (void*)word, sizeof(void*), (void*)word, strlen(word));
-      dataRefs[ii].ptr = word;
-   }
- 
-   for (ii=0; ii<NumWords_Global; ii++) {
-      searchResult = (char*)HashTable_FindEntry( data->ptrTable, (void*)dataRefs[ii].ptr, 0, char* );
-      pcu_check_true( searchResult != NULL );
-      pcu_check_streq( WordList_Global[ii], searchResult );
-   }
-}
-
-
-void HashTableSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, HashTableSuiteData );
-   pcu_suite_setFixtures( suite, HashTableSuite_Setup, HashTableSuite_Teardown );
-   pcu_suite_addTest( suite, HashTableSuite_TestInsert );
-   pcu_suite_addTest( suite, HashTableSuite_TestSearch );
-   pcu_suite_addTest( suite, HashTableSuite_TestInsertPointers );
-   pcu_suite_addTest( suite, HashTableSuite_TestSearchPointers );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/HashTableSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/HashTableSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,272 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testHashTable.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "HashTableSuite.h"
+
+
+unsigned int NumWords_Global = 0; 
+/* Expect to read in ~100 words */
+char* WordList_Global[1000];
+
+
+typedef struct {
+   HashTable*       table;
+   HashTable*       ptrTable;
+} HashTableSuiteData;
+
+typedef struct DataRef {
+   void* ptr;
+   Bool  found;
+} DataRef;
+
+void deleteFunction( void *entry ){
+	assert( entry );
+
+	Memory_Free( entry );
+}
+
+void printFunction( void *entry, void *stream ){
+	
+	assert( entry );
+	assert( stream );
+
+	Journal_Printf( (Stream*)stream, "\t\t%s", (void*)entry );
+}
+
+void ptrPrintFunction( void *entry, void *stream ){
+	
+	assert( entry );
+	assert( stream );
+
+	Journal_Printf( (Stream*)stream, "\t\t(ptr)%p\n", (void*)entry );
+}
+
+void checkFunction( const void *entry, void *arg ){
+   int*     wordFoundArray = (int*)arg;
+   Index    ii;
+	
+	assert( entry );
+
+   for (ii=0; ii<NumWords_Global; ii++) {
+     if ( 0 == strcmp( (Name)entry, WordList_Global[ii] ) ) {
+         wordFoundArray[ii] = True;
+         break;
+      }
+   }
+}
+
+void checkPtrFunction( const void *entry, void *arg ){
+   DataRef*    dataRefs = (DataRef*)arg;
+   Index       ii;
+	
+	assert( entry );
+
+   for (ii=0; ii<NumWords_Global; ii++) {
+      /* Deliberately comparing ptrs here, rather than strings */
+	   if ( entry == dataRefs[ii].ptr ) {
+         dataRefs[ii].found = True;
+         break;
+      }
+   }
+}
+
+
+void HashTableSuite_Setup( HashTableSuiteData* data ) {
+   char     dictFilename[PCU_PATH_MAX];
+   FILE*    dictFile=NULL;
+   char     wordBuffer[1024];
+
+   /* Read in the words from the dictionary file */
+   pcu_filename_input( "dictionary.txt", dictFilename );
+   dictFile = fopen( dictFilename, "r+" );
+   NumWords_Global=0;
+   while( (fgets( wordBuffer, sizeof(wordBuffer), dictFile ) != NULL) ){
+      WordList_Global[NumWords_Global++] = StG_Strdup(wordBuffer);
+   }
+   fclose( dictFile );
+
+   data->table = HashTable_New( NULL, printFunction, NULL, HASHTABLE_STRING_KEY );
+   data->ptrTable = HashTable_New( NULL, ptrPrintFunction, deleteFunction, HASHTABLE_POINTER_KEY );
+}
+
+void HashTableSuite_Teardown( HashTableSuiteData* data ) {
+   Index    ii;
+
+   Stg_Class_Delete( data->table );
+   Stg_Class_Delete( data->ptrTable );
+   for ( ii=0; ii < NumWords_Global; ii++ ) {
+      Memory_Free( WordList_Global[ii] );
+   }
+   NumWords_Global=0;
+}
+
+
+void HashTableSuite_TestInsert( HashTableSuiteData* data ) {
+   char           *word = NULL;
+   int            result = 0;
+   int            sum = 0;
+   Bool           wordFoundArray[NumWords_Global];
+   Index          ii=0;
+   
+   
+   /* Testing hash table with string keys..\n\n */
+   /* Inserting data into the hash table\n\n */
+   for (ii=0; ii<NumWords_Global; ii++) {
+      word = StG_Strdup(WordList_Global[ii]);
+      result = HashTable_InsertEntry( data->table, (void*)word, strlen(word), (void*)word, strlen(word));
+      sum += result;
+   }
+   
+   pcu_check_true( NumWords_Global == data->table->count );
+
+   /* The count of insertion operations should be at least the number of entries we inserted */
+   pcu_check_true( sum >= 0 );
+
+   /* This is a basic check that the number of collisions was within reason. Perhaps a stricter
+    *  mathematical calc should really be performed here */
+   /* Hash table has 255 places, only inserted 100 entries, therefore not many collisions expected */
+   pcu_check_true( sum <= (data->table->count * 0.3) );
+   
+   /* Now parse the tree, and check the actual entries - note they won't necessarily be in same 'order'
+    * while being parsed */
+   for (ii=0; ii<NumWords_Global; ii++) {
+      wordFoundArray[ii] = False;
+   }   
+   HashTable_ParseTable( data->table, checkFunction, wordFoundArray );
+   for (ii=0; ii<NumWords_Global; ii++) {
+      pcu_check_true( wordFoundArray[ii] == True );
+   }
+}
+
+
+void HashTableSuite_TestSearch( HashTableSuiteData* data ) {
+   char*          word = NULL;
+   Index          ii=0;
+   char*          searchResult = NULL;
+
+   /* Inserting data into the hash table\n\n */
+   for (ii=0; ii<NumWords_Global; ii++) {
+      word = StG_Strdup(WordList_Global[ii]);
+      HashTable_InsertEntry( data->table, (void*)word, strlen(word), (void*)word, strlen(word));
+   }
+   
+   for (ii=0; ii<NumWords_Global; ii++) {
+      searchResult = (char*)HashTable_FindEntry( data->table, WordList_Global[ii], strlen(WordList_Global[ii]), char* );
+      pcu_check_true( searchResult != NULL );
+      pcu_check_streq( WordList_Global[ii], searchResult );
+   }
+}
+
+
+void HashTableSuite_TestInsertPointers( HashTableSuiteData* data ) {
+   char           *word = NULL;
+   int            result = 0;
+   int            sum = 0;
+   DataRef        dataRefs[NumWords_Global];
+   Index          ii=0;
+
+   for (ii=0; ii<NumWords_Global; ii++) {
+      dataRefs[ii].ptr = NULL;
+      dataRefs[ii].found = False;
+   }
+   /* Testing hash table with pointer keys..\n\n */
+   /* Inserting data into the hash table\n\n */
+   
+   for (ii=0; ii<NumWords_Global; ii++) {
+      word = StG_Strdup(WordList_Global[ii]);
+      result = HashTable_InsertEntry( data->ptrTable, (void*)word, sizeof(void*), (void*)word, strlen(word));
+      sum += result;
+      dataRefs[ii].ptr = word;
+   }
+   
+   pcu_check_true( NumWords_Global == data->ptrTable->count );
+
+   /* The count of insertion operations should be at least the number of entries we inserted */
+   pcu_check_true( sum >= 0 );
+
+   /* This is a basic check that the number of collisions was within reason. Perhaps a stricter
+    *  mathematical calc should really be performed here */
+   /* Hash table has 255 places, only inserted 100 entries, therefore not many collisions expected */
+   pcu_check_true( sum <= (int)(data->ptrTable->count * 0.4) );
+   
+   /* Now parse the tree, and check the actual entries - note they won't necessarily be in same 'order'
+    * while being parsed */
+   HashTable_ParseTable( data->ptrTable, checkPtrFunction, dataRefs );
+   for (ii=0; ii<NumWords_Global; ii++) {
+      pcu_check_true( dataRefs[ii].found == True );
+   }
+}
+
+
+/* Searching for items in the table:\n\n */
+void HashTableSuite_TestSearchPointers( HashTableSuiteData* data ) {
+   char           *word = NULL;
+   DataRef        dataRefs[NumWords_Global];
+   Index          ii=0;
+   char*          searchResult = NULL;
+
+   for (ii=0; ii<NumWords_Global; ii++) {
+      dataRefs[ii].ptr = NULL;
+      dataRefs[ii].found = False;
+   }
+   /* Inserting data into the hash table\n\n */
+   for (ii=0; ii<NumWords_Global; ii++) {
+      word = StG_Strdup(WordList_Global[ii]);
+      HashTable_InsertEntry( data->ptrTable, (void*)word, sizeof(void*), (void*)word, strlen(word));
+      dataRefs[ii].ptr = word;
+   }
+ 
+   for (ii=0; ii<NumWords_Global; ii++) {
+      searchResult = (char*)HashTable_FindEntry( data->ptrTable, (void*)dataRefs[ii].ptr, 0, char* );
+      pcu_check_true( searchResult != NULL );
+      pcu_check_streq( WordList_Global[ii], searchResult );
+   }
+}
+
+
+void HashTableSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, HashTableSuiteData );
+   pcu_suite_setFixtures( suite, HashTableSuite_Setup, HashTableSuite_Teardown );
+   pcu_suite_addTest( suite, HashTableSuite_TestInsert );
+   pcu_suite_addTest( suite, HashTableSuite_TestSearch );
+   pcu_suite_addTest( suite, HashTableSuite_TestInsertPointers );
+   pcu_suite_addTest( suite, HashTableSuite_TestSearchPointers );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IArraySuite.c
--- a/Base/Container/tests/IArraySuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testIArray.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "IArraySuite.h"
-
-#define NUM_ITEMS 5
-
-typedef struct {
-   IArray*  iArray;
-   int      arrayData[NUM_ITEMS];
-} IArraySuiteData;
-
-
-void IArraySuite_Setup( IArraySuiteData* data ) {
-   Index         idx;
-
-   data->iArray = IArray_New();
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      data->arrayData[idx] = idx;
-   }
-}
-
-
-void IArraySuite_Teardown( IArraySuiteData* data ) {
-   NewClass_Delete( data->iArray );
-}
-
-
-void IArraySuite_TestSet( IArraySuiteData* data ) {
-   const int* ptr;
-   int i_i;
-
-   IArray_Set( data->iArray, NUM_ITEMS, data->arrayData );
-   pcu_check_true( IArray_GetSize( data->iArray ) == NUM_ITEMS );
-   pcu_check_true( (ptr = IArray_GetPtr( data->iArray )) != 0 );
-   for( i_i = 0; i_i < NUM_ITEMS; i_i++ ) {
-      pcu_check_true( ptr[i_i] == i_i );
-   }
-}
-
-
-void IArraySuite_TestAdd( IArraySuiteData* data ) {
-   const int* ptr;
-   int i_i;
-
-   IArray_Set( data->iArray, 3, data->arrayData );
-   IArray_Add( data->iArray, 2, data->arrayData + 3 );
-   pcu_check_true( IArray_GetSize( data->iArray ) == NUM_ITEMS );
-   pcu_check_true( (ptr = IArray_GetPtr( data->iArray )) != 0 );
-   for( i_i = 0; i_i < NUM_ITEMS; i_i++ ) {
-      pcu_check_true( ptr[i_i] == i_i );
-   }
-}
-
-
-void IArraySuite_TestRemove( IArraySuiteData* data ) {
-   const int*  ptr;
-   IMap*       map = NULL;
-
-   IArray_Set( data->iArray, NUM_ITEMS, data->arrayData );
-   data->arrayData[0] = 1; data->arrayData[1] = 3;
-   map = IMap_New();
-   IArray_Remove( data->iArray, 2, data->arrayData, map );
-   pcu_check_true( IArray_GetSize( data->iArray ) == 3 );
-   pcu_check_true( (ptr = IArray_GetPtr( data->iArray )) != 0 );
-   pcu_check_true( ptr[0] == 0 && ptr[1] == 4 && ptr[2] == 2 );
-   pcu_check_true( IMap_GetSize( map ) == 1 );
-   pcu_check_true( IMap_Has( map, 4 ) );
-   pcu_check_true( IMap_Map( map, 4 ) == 1 );
-
-   NewClass_Delete( map );
-}
-
-
-void IArraySuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, IArraySuiteData );
-   pcu_suite_setFixtures( suite, IArraySuite_Setup, IArraySuite_Teardown );
-   pcu_suite_addTest( suite, IArraySuite_TestSet );
-   pcu_suite_addTest( suite, IArraySuite_TestAdd );
-   pcu_suite_addTest( suite, IArraySuite_TestRemove );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IArraySuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/IArraySuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,118 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testIArray.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "IArraySuite.h"
+
+#define NUM_ITEMS 5
+
+typedef struct {
+   IArray*  iArray;
+   int      arrayData[NUM_ITEMS];
+} IArraySuiteData;
+
+
+void IArraySuite_Setup( IArraySuiteData* data ) {
+   Index         idx;
+
+   data->iArray = IArray_New();
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      data->arrayData[idx] = idx;
+   }
+}
+
+
+void IArraySuite_Teardown( IArraySuiteData* data ) {
+   NewClass_Delete( data->iArray );
+}
+
+
+void IArraySuite_TestSet( IArraySuiteData* data ) {
+   const int* ptr;
+   int i_i;
+
+   IArray_Set( data->iArray, NUM_ITEMS, data->arrayData );
+   pcu_check_true( IArray_GetSize( data->iArray ) == NUM_ITEMS );
+   pcu_check_true( (ptr = IArray_GetPtr( data->iArray )) != 0 );
+   for( i_i = 0; i_i < NUM_ITEMS; i_i++ ) {
+      pcu_check_true( ptr[i_i] == i_i );
+   }
+}
+
+
+void IArraySuite_TestAdd( IArraySuiteData* data ) {
+   const int* ptr;
+   int i_i;
+
+   IArray_Set( data->iArray, 3, data->arrayData );
+   IArray_Add( data->iArray, 2, data->arrayData + 3 );
+   pcu_check_true( IArray_GetSize( data->iArray ) == NUM_ITEMS );
+   pcu_check_true( (ptr = IArray_GetPtr( data->iArray )) != 0 );
+   for( i_i = 0; i_i < NUM_ITEMS; i_i++ ) {
+      pcu_check_true( ptr[i_i] == i_i );
+   }
+}
+
+
+void IArraySuite_TestRemove( IArraySuiteData* data ) {
+   const int*  ptr;
+   IMap*       map = NULL;
+
+   IArray_Set( data->iArray, NUM_ITEMS, data->arrayData );
+   data->arrayData[0] = 1; data->arrayData[1] = 3;
+   map = IMap_New();
+   IArray_Remove( data->iArray, 2, data->arrayData, map );
+   pcu_check_true( IArray_GetSize( data->iArray ) == 3 );
+   pcu_check_true( (ptr = IArray_GetPtr( data->iArray )) != 0 );
+   pcu_check_true( ptr[0] == 0 && ptr[1] == 4 && ptr[2] == 2 );
+   pcu_check_true( IMap_GetSize( map ) == 1 );
+   pcu_check_true( IMap_Has( map, 4 ) );
+   pcu_check_true( IMap_Map( map, 4 ) == 1 );
+
+   NewClass_Delete( map );
+}
+
+
+void IArraySuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, IArraySuiteData );
+   pcu_suite_setFixtures( suite, IArraySuite_Setup, IArraySuite_Teardown );
+   pcu_suite_addTest( suite, IArraySuite_TestSet );
+   pcu_suite_addTest( suite, IArraySuite_TestAdd );
+   pcu_suite_addTest( suite, IArraySuite_TestRemove );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IMapSuite.c
--- a/Base/Container/tests/IMapSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testIMap.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "IMapSuite.h"
-
-#define NUM_ITEMS 5
-
-typedef struct {
-   IMap*    iMap;
-} IMapSuiteData;
-
-
-void IMapSuite_Setup( IMapSuiteData* data ) {
-   data->iMap = IMap_New();
-}
-
-
-void IMapSuite_Teardown( IMapSuiteData* data ) {
-   NewClass_Delete( data->iMap );
-}
-
-
-void IMapSuite_TestConstruct( IMapSuiteData* data ) {
-
-   pcu_check_true( data->iMap );
-   pcu_check_true( data->iMap->maxSize == 0 );
-   pcu_check_true( data->iMap->curSize == 0 );
-   /* The 3 conditions below don't hold because IMap_SetMaxSize( self, 0 ) is called
-    *  in the IMap constructor function. I presume Luke did this for a good reason, so
-    *  will just comment out the conditions for now. PatrickSunter, 3 Jul 2009 */   
-   /*pcu_check_true( data->iMap->tblSize == 0 );
-   pcu_check_true( data->iMap->tbl == NULL );
-   pcu_check_true( data->iMap->used == NULL );*/
-}
-
-
-void IMapSuite_TestSetMaxSize( IMapSuiteData* data ) {
-   IMap_SetMaxSize( data->iMap, 10 );
-   pcu_check_true( data->iMap->maxSize == 10 );
-   pcu_check_true( data->iMap->tblSize >= 10 );
-   IMap_SetMaxSize( data->iMap, 20 );
-   pcu_check_true( data->iMap->maxSize == 20 );
-   pcu_check_true( data->iMap->tblSize >= 20 );
-}
-
-
-void IMapSuite_TestInsert( IMapSuiteData* data ) {
-   int i_i;
-
-   IMap_SetMaxSize( data->iMap, 10 );
-   for( i_i = 0; i_i < 20; i_i += 2 ) {
-      IMap_Insert( data->iMap, i_i, i_i + 100 );
-   }
-   pcu_check_assert( IMap_Insert( data->iMap, 0, 100 ) );
-   pcu_check_true( IMap_GetSize( data->iMap ) == 10 );
-   for( i_i = 0; i_i < 20; i_i += 2 ) {
-      pcu_check_true( IMap_Has( data->iMap, i_i ) );
-   }
-}
-
-
-void IMapSuite_TestMap( IMapSuiteData* data ) {
-   int i_i;
-
-   IMap_SetMaxSize( data->iMap, 10 );
-   for( i_i = 0; i_i < 20; i_i += 2 ) {
-      IMap_Insert( data->iMap, i_i, i_i + 100 );
-   }
-   for( i_i = 0; i_i < 20; i_i += 2 ) {
-      pcu_check_true( IMap_Map( data->iMap, i_i ) == i_i + 100 );
-   }
-}
-
-
-void IMapSuite_TestRemove( IMapSuiteData* data ) {
-   int i_i;
-
-   IMap_SetMaxSize( data->iMap, 10 );
-   for( i_i = 0; i_i < 20; i_i += 2 ) {
-      IMap_Insert( data->iMap, i_i, i_i + 100 );
-   }
-   for( i_i = 0; i_i < 20; i_i += 4 ) {
-      IMap_Remove( data->iMap, i_i );
-   }
-   pcu_check_assert( IMap_Remove( data->iMap, 0 ) );
-   pcu_check_true( IMap_GetSize( data->iMap ) == 5 );
-   for( i_i = 0; i_i < 20; i_i += 4 ) {
-      if( i_i % 4 ) {
-	      pcu_check_true( IMap_Has( data->iMap, i_i ) );
-      }
-      else {
-	      pcu_check_true( !IMap_Has( data->iMap, i_i ) );
-      }
-   }
-}
-
-
-void IMapSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, IMapSuiteData );
-   pcu_suite_setFixtures( suite, IMapSuite_Setup, IMapSuite_Teardown );
-   pcu_suite_addTest( suite, IMapSuite_TestConstruct );
-   pcu_suite_addTest( suite, IMapSuite_TestSetMaxSize );
-   pcu_suite_addTest( suite, IMapSuite_TestInsert );
-   pcu_suite_addTest( suite, IMapSuite_TestMap );
-   pcu_suite_addTest( suite, IMapSuite_TestRemove );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IMapSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/IMapSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,143 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testIMap.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "IMapSuite.h"
+
+#define NUM_ITEMS 5
+
+typedef struct {
+   IMap*    iMap;
+} IMapSuiteData;
+
+
+void IMapSuite_Setup( IMapSuiteData* data ) {
+   data->iMap = IMap_New();
+}
+
+
+void IMapSuite_Teardown( IMapSuiteData* data ) {
+   NewClass_Delete( data->iMap );
+}
+
+
+void IMapSuite_TestConstruct( IMapSuiteData* data ) {
+
+   pcu_check_true( data->iMap );
+   pcu_check_true( data->iMap->maxSize == 0 );
+   pcu_check_true( data->iMap->curSize == 0 );
+   /* The 3 conditions below don't hold because IMap_SetMaxSize( self, 0 ) is called
+    *  in the IMap constructor function. I presume Luke did this for a good reason, so
+    *  will just comment out the conditions for now. PatrickSunter, 3 Jul 2009 */   
+   /*pcu_check_true( data->iMap->tblSize == 0 );
+   pcu_check_true( data->iMap->tbl == NULL );
+   pcu_check_true( data->iMap->used == NULL );*/
+}
+
+
+void IMapSuite_TestSetMaxSize( IMapSuiteData* data ) {
+   IMap_SetMaxSize( data->iMap, 10 );
+   pcu_check_true( data->iMap->maxSize == 10 );
+   pcu_check_true( data->iMap->tblSize >= 10 );
+   IMap_SetMaxSize( data->iMap, 20 );
+   pcu_check_true( data->iMap->maxSize == 20 );
+   pcu_check_true( data->iMap->tblSize >= 20 );
+}
+
+
+void IMapSuite_TestInsert( IMapSuiteData* data ) {
+   int i_i;
+
+   IMap_SetMaxSize( data->iMap, 10 );
+   for( i_i = 0; i_i < 20; i_i += 2 ) {
+      IMap_Insert( data->iMap, i_i, i_i + 100 );
+   }
+   pcu_check_assert( IMap_Insert( data->iMap, 0, 100 ) );
+   pcu_check_true( IMap_GetSize( data->iMap ) == 10 );
+   for( i_i = 0; i_i < 20; i_i += 2 ) {
+      pcu_check_true( IMap_Has( data->iMap, i_i ) );
+   }
+}
+
+
+void IMapSuite_TestMap( IMapSuiteData* data ) {
+   int i_i;
+
+   IMap_SetMaxSize( data->iMap, 10 );
+   for( i_i = 0; i_i < 20; i_i += 2 ) {
+      IMap_Insert( data->iMap, i_i, i_i + 100 );
+   }
+   for( i_i = 0; i_i < 20; i_i += 2 ) {
+      pcu_check_true( IMap_Map( data->iMap, i_i ) == i_i + 100 );
+   }
+}
+
+
+void IMapSuite_TestRemove( IMapSuiteData* data ) {
+   int i_i;
+
+   IMap_SetMaxSize( data->iMap, 10 );
+   for( i_i = 0; i_i < 20; i_i += 2 ) {
+      IMap_Insert( data->iMap, i_i, i_i + 100 );
+   }
+   for( i_i = 0; i_i < 20; i_i += 4 ) {
+      IMap_Remove( data->iMap, i_i );
+   }
+   pcu_check_assert( IMap_Remove( data->iMap, 0 ) );
+   pcu_check_true( IMap_GetSize( data->iMap ) == 5 );
+   for( i_i = 0; i_i < 20; i_i += 4 ) {
+      if( i_i % 4 ) {
+	      pcu_check_true( IMap_Has( data->iMap, i_i ) );
+      }
+      else {
+	      pcu_check_true( !IMap_Has( data->iMap, i_i ) );
+      }
+   }
+}
+
+
+void IMapSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, IMapSuiteData );
+   pcu_suite_setFixtures( suite, IMapSuite_Setup, IMapSuite_Teardown );
+   pcu_suite_addTest( suite, IMapSuite_TestConstruct );
+   pcu_suite_addTest( suite, IMapSuite_TestSetMaxSize );
+   pcu_suite_addTest( suite, IMapSuite_TestInsert );
+   pcu_suite_addTest( suite, IMapSuite_TestMap );
+   pcu_suite_addTest( suite, IMapSuite_TestRemove );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/ISetSuite.c
--- a/Base/Container/tests/ISetSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testISet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "ISetSuite.h"
-
-typedef struct {
-   ISet*    iSet0;
-   ISet*    iSet1;
-} ISetSuiteData;
-
-
-void ISetSuite_Setup( ISetSuiteData* data ) {
-   data->iSet0 = ISet_New();
-   data->iSet1 = ISet_New();
-}
-
-
-void ISetSuite_Teardown( ISetSuiteData* data ) {
-   NewClass_Delete( data->iSet0 );
-   NewClass_Delete( data->iSet1 );
-}
-
-
-void ISetSuite_TestConstruct( ISetSuiteData* data ) {
-   pcu_check_true( data->iSet0 );
-   pcu_check_true( data->iSet0->maxSize == 0 );
-   pcu_check_true( data->iSet0->curSize == 0 );
-   /* Same situation as IMapSuite_Construct - PatrickSunter, 3 June 2009 */
-#if 0
-   pcu_check_true( data->iSet0->tblSize == 0 );
-   pcu_check_true( data->iSet0->tbl == NULL );
-   pcu_check_true( data->iSet0->used == NULL );
-#endif
-}
-
-
-void ISetSuite_TestInsert( ISetSuiteData* data ) {
-   int i_i;
-
-   ISet_SetMaxSize( data->iSet0, 20 );
-   for( i_i = 0; i_i < 20; i_i += 2 ) {
-      ISet_Insert( data->iSet0, i_i );
-   }
-   for( i_i = 1; i_i < 20; i_i += 2 ) {
-      ISet_Insert( data->iSet0, i_i );
-   }
-   pcu_check_true( ISet_GetSize( data->iSet0 ) == 20 );
-   pcu_check_assert( ISet_Insert( data->iSet0, 0 ) );
-   ISet_TryInsert( data->iSet0, 0 );
-   for( i_i = 0; i_i < 20; i_i++ ) {
-      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
-   }
-   pcu_check_true( !ISet_Has( data->iSet0, 21 ) );
-}
-
-
-void ISetSuite_TestUseArray( ISetSuiteData* data ) {
-   int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-   int i_i;
-
-   ISet_UseArray( data->iSet0, 10, array );
-   pcu_check_true( ISet_GetSize( data->iSet0 ) == 10 );
-   for( i_i = 0; i_i < 10; i_i++ ) {
-      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
-   }
-   pcu_check_true( !ISet_Has( data->iSet0, 10 ) );
-}
-
-
-void ISetSuite_TestUnion( ISetSuiteData* data ) {
-   int array0[5] = {0, 1, 2, 3, 4};
-   int array1[5] = {3, 4, 5, 6, 7};
-   int i_i;
-
-   ISet_UseArray( data->iSet0, 5, array0 );
-   ISet_UseArray( data->iSet1, 5, array1 );
-   ISet_Union( data->iSet0, data->iSet1 );
-   pcu_check_true( ISet_GetSize( data->iSet0 ) == 8 );
-   for( i_i = 0; i_i < 8; i_i++ ) {
-      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
-   }
-   pcu_check_true( !ISet_Has( data->iSet0, 10 ) );
-}
-
-
-void ISetSuite_TestIsect( ISetSuiteData* data ) {
-   int array0[5] = {0, 1, 2, 3, 4};
-   int array1[5] = {3, 4, 5, 6, 7};
-   int i_i;
-
-   ISet_UseArray( data->iSet0, 5, array0 );
-   ISet_UseArray( data->iSet1, 5, array1 );
-   ISet_Isect( data->iSet0, data->iSet1 );
-   pcu_check_true( ISet_GetSize( data->iSet0 ) == 2 );
-   for( i_i = 3; i_i < 5; i_i++ ) {
-      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
-   }
-   pcu_check_true( !ISet_Has( data->iSet0, 1 ) );
-}
-
-
-void ISetSuite_TestSubtr( ISetSuiteData* data ) {
-   int array0[5] = {0, 1, 2, 3, 4};
-   int array1[5] = {3, 4, 5, 6, 7};
-   int i_i;
-
-   ISet_UseArray( data->iSet0, 5, array0 );
-   ISet_UseArray( data->iSet1, 5, array1 );
-   ISet_Subtr( data->iSet0, data->iSet1 );
-   pcu_check_true( ISet_GetSize( data->iSet0 ) == 3 );
-   for( i_i = 0; i_i < 3; i_i++ ) {
-      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
-   }
-   pcu_check_true( !ISet_Has( data->iSet0, 3 ) );
-}
-
-
-void ISetSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ISetSuiteData );
-   pcu_suite_setFixtures( suite, ISetSuite_Setup, ISetSuite_Teardown );
-   pcu_suite_addTest( suite, ISetSuite_TestConstruct );
-   pcu_suite_addTest( suite, ISetSuite_TestInsert );
-   pcu_suite_addTest( suite, ISetSuite_TestUseArray );
-   pcu_suite_addTest( suite, ISetSuite_TestUnion );
-   pcu_suite_addTest( suite, ISetSuite_TestIsect );
-   pcu_suite_addTest( suite, ISetSuite_TestSubtr );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/ISetSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/ISetSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,164 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testISet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "ISetSuite.h"
+
+typedef struct {
+   ISet*    iSet0;
+   ISet*    iSet1;
+} ISetSuiteData;
+
+
+void ISetSuite_Setup( ISetSuiteData* data ) {
+   data->iSet0 = ISet_New();
+   data->iSet1 = ISet_New();
+}
+
+
+void ISetSuite_Teardown( ISetSuiteData* data ) {
+   NewClass_Delete( data->iSet0 );
+   NewClass_Delete( data->iSet1 );
+}
+
+
+void ISetSuite_TestConstruct( ISetSuiteData* data ) {
+   pcu_check_true( data->iSet0 );
+   pcu_check_true( data->iSet0->maxSize == 0 );
+   pcu_check_true( data->iSet0->curSize == 0 );
+   /* Same situation as IMapSuite_Construct - PatrickSunter, 3 June 2009 */
+#if 0
+   pcu_check_true( data->iSet0->tblSize == 0 );
+   pcu_check_true( data->iSet0->tbl == NULL );
+   pcu_check_true( data->iSet0->used == NULL );
+#endif
+}
+
+
+void ISetSuite_TestInsert( ISetSuiteData* data ) {
+   int i_i;
+
+   ISet_SetMaxSize( data->iSet0, 20 );
+   for( i_i = 0; i_i < 20; i_i += 2 ) {
+      ISet_Insert( data->iSet0, i_i );
+   }
+   for( i_i = 1; i_i < 20; i_i += 2 ) {
+      ISet_Insert( data->iSet0, i_i );
+   }
+   pcu_check_true( ISet_GetSize( data->iSet0 ) == 20 );
+   pcu_check_assert( ISet_Insert( data->iSet0, 0 ) );
+   ISet_TryInsert( data->iSet0, 0 );
+   for( i_i = 0; i_i < 20; i_i++ ) {
+      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
+   }
+   pcu_check_true( !ISet_Has( data->iSet0, 21 ) );
+}
+
+
+void ISetSuite_TestUseArray( ISetSuiteData* data ) {
+   int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+   int i_i;
+
+   ISet_UseArray( data->iSet0, 10, array );
+   pcu_check_true( ISet_GetSize( data->iSet0 ) == 10 );
+   for( i_i = 0; i_i < 10; i_i++ ) {
+      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
+   }
+   pcu_check_true( !ISet_Has( data->iSet0, 10 ) );
+}
+
+
+void ISetSuite_TestUnion( ISetSuiteData* data ) {
+   int array0[5] = {0, 1, 2, 3, 4};
+   int array1[5] = {3, 4, 5, 6, 7};
+   int i_i;
+
+   ISet_UseArray( data->iSet0, 5, array0 );
+   ISet_UseArray( data->iSet1, 5, array1 );
+   ISet_Union( data->iSet0, data->iSet1 );
+   pcu_check_true( ISet_GetSize( data->iSet0 ) == 8 );
+   for( i_i = 0; i_i < 8; i_i++ ) {
+      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
+   }
+   pcu_check_true( !ISet_Has( data->iSet0, 10 ) );
+}
+
+
+void ISetSuite_TestIsect( ISetSuiteData* data ) {
+   int array0[5] = {0, 1, 2, 3, 4};
+   int array1[5] = {3, 4, 5, 6, 7};
+   int i_i;
+
+   ISet_UseArray( data->iSet0, 5, array0 );
+   ISet_UseArray( data->iSet1, 5, array1 );
+   ISet_Isect( data->iSet0, data->iSet1 );
+   pcu_check_true( ISet_GetSize( data->iSet0 ) == 2 );
+   for( i_i = 3; i_i < 5; i_i++ ) {
+      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
+   }
+   pcu_check_true( !ISet_Has( data->iSet0, 1 ) );
+}
+
+
+void ISetSuite_TestSubtr( ISetSuiteData* data ) {
+   int array0[5] = {0, 1, 2, 3, 4};
+   int array1[5] = {3, 4, 5, 6, 7};
+   int i_i;
+
+   ISet_UseArray( data->iSet0, 5, array0 );
+   ISet_UseArray( data->iSet1, 5, array1 );
+   ISet_Subtr( data->iSet0, data->iSet1 );
+   pcu_check_true( ISet_GetSize( data->iSet0 ) == 3 );
+   for( i_i = 0; i_i < 3; i_i++ ) {
+      pcu_check_true( ISet_Has( data->iSet0, i_i ) );
+   }
+   pcu_check_true( !ISet_Has( data->iSet0, 3 ) );
+}
+
+
+void ISetSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ISetSuiteData );
+   pcu_suite_setFixtures( suite, ISetSuite_Setup, ISetSuite_Teardown );
+   pcu_suite_addTest( suite, ISetSuite_TestConstruct );
+   pcu_suite_addTest( suite, ISetSuite_TestInsert );
+   pcu_suite_addTest( suite, ISetSuite_TestUseArray );
+   pcu_suite_addTest( suite, ISetSuite_TestUnion );
+   pcu_suite_addTest( suite, ISetSuite_TestIsect );
+   pcu_suite_addTest( suite, ISetSuite_TestSubtr );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IndexMapSuite.c
--- a/Base/Container/tests/IndexMapSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testIndexMap.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "IndexMapSuite.h"
-
-typedef struct {
-   IndexMap*      map;
-} IndexMapSuiteData;
-
-
-void IndexMapSuite_Setup( IndexMapSuiteData* data ) {
-   data->map = IndexMap_New();
-}
-
-void IndexMapSuite_Teardown( IndexMapSuiteData* data ) {
-   Stg_Class_Delete( data->map );
-}
-
-
-void IndexMapSuite_TestAppendFind( IndexMapSuiteData* data ) {
-   Index          idx;
-
-   pcu_docstring( "This test inserts a set of indices to an IndexSet in reverse order, "
-      " then checks they can be found at the correct indices." );
-   
-   for( idx = 0; idx < 100; idx++ ) {
-      IndexMap_Append( data->map, idx + 1, 100 - idx );
-   }
-   
-   for( idx = 0; idx < 100; idx++ ) {
-      pcu_check_true( IndexMap_Find( data->map, idx + 1 ) == (100 - idx) );
-   }
-}
-
-
-void IndexMapSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, IndexMapSuiteData );
-   pcu_suite_setFixtures( suite, IndexMapSuite_Setup, IndexMapSuite_Teardown );
-   pcu_suite_addTest( suite, IndexMapSuite_TestAppendFind );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IndexMapSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/IndexMapSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,77 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testIndexMap.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "IndexMapSuite.h"
+
+typedef struct {
+   IndexMap*      map;
+} IndexMapSuiteData;
+
+
+void IndexMapSuite_Setup( IndexMapSuiteData* data ) {
+   data->map = IndexMap_New();
+}
+
+void IndexMapSuite_Teardown( IndexMapSuiteData* data ) {
+   Stg_Class_Delete( data->map );
+}
+
+
+void IndexMapSuite_TestAppendFind( IndexMapSuiteData* data ) {
+   Index          idx;
+
+   pcu_docstring( "This test inserts a set of indices to an IndexSet in reverse order, "
+      " then checks they can be found at the correct indices." );
+   
+   for( idx = 0; idx < 100; idx++ ) {
+      IndexMap_Append( data->map, idx + 1, 100 - idx );
+   }
+   
+   for( idx = 0; idx < 100; idx++ ) {
+      pcu_check_true( IndexMap_Find( data->map, idx + 1 ) == (100 - idx) );
+   }
+}
+
+
+void IndexMapSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, IndexMapSuiteData );
+   pcu_suite_setFixtures( suite, IndexMapSuite_Setup, IndexMapSuite_Teardown );
+   pcu_suite_addTest( suite, IndexMapSuite_TestAppendFind );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IndexSetSuite.c
--- a/Base/Container/tests/IndexSetSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,426 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testIndexSet.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "IndexSetSuite.h"
-
-
-#define IS1_SIZE   25
-#define IS2_SIZE   40
-
-typedef struct {
-      IndexSet* is;
-      IndexSet* is2;
-} IndexSetSuiteData;
-
-
-void IndexSetSuite_Setup( IndexSetSuiteData* data ) {
-   /* Index sets are deliberately different sizes, to test all aspects of merge functionality */
-   data->is = IndexSet_New(IS1_SIZE);
-   data->is2 = IndexSet_New(IS2_SIZE);
-}
-
-void IndexSetSuite_Teardown( IndexSetSuiteData* data ) {
-   Stg_Class_Delete( data->is );
-   Stg_Class_Delete( data->is2 );
-}
-
-
-/* Start with this test, so we can be confident to returen an IS to a zero state, for other tests */
-void IndexSetSuite_TestRemoveAll( IndexSetSuiteData* data ) {
-   Index ii;
-
-  /* a couple of additions, so we know there's something to remove */
-   IndexSet_Add( data->is, 0 );
-   IndexSet_Add( data->is, 24 );
-   IndexSet_RemoveAll( data->is );
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      pcu_check_true( 0 == IndexSet_IsMember( data->is, ii ) );
-   }
-}
-
-
-void IndexSetSuite_TestAddAll( IndexSetSuiteData* data ) {
-   Index ii;
-
-   /* Index set will be starting in empty state */
-   IndexSet_AddAll( data->is );
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      pcu_check_true( True == IndexSet_IsMember( data->is, ii ) );
-   }
-}
-
-
-void IndexSetSuite_TestInsertion( IndexSetSuiteData* data ) {
-   Index ii=0;
-
-   IndexSet_RemoveAll( data->is );
-   IndexSet_Add( data->is, 0 );
-   IndexSet_Add( data->is, 7 );
-   IndexSet_Add( data->is, 8 );
-   IndexSet_Add( data->is, 22 );
-   IndexSet_Add( data->is, 24 );
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      if ( (ii==0) || (ii==7) || (ii==8) || (ii==22) || (ii==24) ) {
-         pcu_check_true( True == IndexSet_IsMember( data->is, ii ) );
-      }
-      else {
-         pcu_check_true( False == IndexSet_IsMember( data->is, ii ) );
-      }
-   }
-}
-
-
-void IndexSetSuite_TestRemoval( IndexSetSuiteData* data ) {
-   Index ii=0;
-
-   IndexSet_RemoveAll( data->is );
-   IndexSet_Add( data->is, 0 );
-   IndexSet_Add( data->is, 7 );
-   IndexSet_Add( data->is, 8 );
-   IndexSet_Add( data->is, 22 );
-   IndexSet_Add( data->is, 24 );
-
-   /*Now remove a couple of these again */
-   IndexSet_Remove( data->is, 7 );
-   IndexSet_Remove( data->is, 24 );
-
-   /*Thus list of members should be (0,7,8,22,24) - (7,24) = (0,8,22) */
-
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      if ( (ii==0) || (ii==8) || (ii==22) ) {
-         pcu_check_true( True == IndexSet_IsMember( data->is, ii ) );
-      }
-      else {
-         pcu_check_true( False == IndexSet_IsMember( data->is, ii ) );
-      }
-   }
-}
-
-void IndexSetSuite_TestUpdateMembersCount( IndexSetSuiteData* data ) {
-   Index ii=0;
-
-   IndexSet_RemoveAll( data->is );
-
-   IndexSet_UpdateMembersCount( data->is );
-   pcu_check_true( 0 == data->is->membersCount );
-
-   /* Add some members, to generate a count */
-   for ( ii=0; ii < 5; ii++ ) {
-      IndexSet_Add( data->is, ii );
-   }
-   for ( ii=20; ii < 25; ii++ ) {
-      IndexSet_Add( data->is, ii );
-   }
-   IndexSet_UpdateMembersCount( data->is );
-   pcu_check_true( 10 == data->is->membersCount );
-
-}
-
-
-void IndexSetSuite_TestGetIndexOfNthMember( IndexSetSuiteData* data ) {
-   Index ii;
-   Index retreivedIndex;
-   #define TEST_INDICES_LENGTH 5
-   Index testIndices[TEST_INDICES_LENGTH] = {0,3,9,11,22};
-
-   /* add all the test indices */
-   for( ii = 0; ii < TEST_INDICES_LENGTH; ii++ ) {
-      IndexSet_Add( data->is, testIndices[ii] );
-   }
-
-   IndexSet_UpdateMembersCount( data->is );
-   /* now check we are able to recover their indices correctly */
-   for( ii = 0; ii < data->is->membersCount; ii++ ) {
-      retreivedIndex = IndexSet_GetIndexOfNthMember( data->is, ii );
-      pcu_check_true( testIndices[ii] == retreivedIndex );
-   }
-}
-
-
-void IndexSetSuite_TestGetMembers( IndexSetSuiteData* data ) {
-   Index*	setArray;
-   unsigned int	setArraySize;
-
-   IndexSet_RemoveAll( data->is );
-
-   /* add some test set members */
-   IndexSet_Add( data->is, 0 );
-   IndexSet_Add( data->is, 7 );
-   IndexSet_Add( data->is, 8 );
-   IndexSet_Add( data->is, 22 );
-   IndexSet_Add( data->is, 24 );
-
-   IndexSet_GetMembers( data->is, &setArraySize, &setArray );
-   pcu_check_true( 5 == setArraySize );
-   pcu_check_true( 0 == setArray[0] );
-   pcu_check_true( 7 == setArray[1] );
-   pcu_check_true( 8 == setArray[2] );
-   pcu_check_true( 22 == setArray[3] );
-   pcu_check_true( 24 == setArray[4] );
-
-   Memory_Free( setArray );
-}
-
-
-void IndexSetSuite_TestGetVacancies( IndexSetSuiteData* data ) {
-   Index        ii;
-   Index*	setArray;
-   unsigned int	setArraySize;
-
-   IndexSet_RemoveAll( data->is );
-
-   /* set all indices to be included, except those exactly divisible by an example number */
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      if ( 0 != (ii % 5) ) {
-         IndexSet_Add( data->is, ii );
-      } 
-   }
-
-   IndexSet_GetVacancies( data->is, &setArraySize, &setArray );
-
-   pcu_check_true( (IS1_SIZE/5) == setArraySize );
-   for ( ii=0; ii < IS1_SIZE/5; ii++ ) {
-      pcu_check_true( ii*5 == setArray[ii] );
-   }
-
-   Memory_Free( setArray );
-}
-
-
-void IndexSetSuite_TestDuplicate( IndexSetSuiteData* data ) {
-   IndexSet* isDup;
-   Index     ii;
-
-   /* add some test set members to is1 for the duplicate */
-   IndexSet_RemoveAll( data->is );
-   IndexSet_Add( data->is, 0 );
-   IndexSet_Add( data->is, 7 );
-   IndexSet_Add( data->is, 8 );
-   IndexSet_Add( data->is, 22 );
-   IndexSet_UpdateMembersCount( data->is );
-   
-   isDup = IndexSet_Duplicate( data->is );
-
-   /* check it's exactly the same */
-   pcu_check_true( isDup->size == data->is->size );
-   pcu_check_true( isDup->membersCount == data->is->membersCount );
-
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      pcu_check_true( IndexSet_IsMember( isDup, ii ) == IndexSet_IsMember( data->is, ii ) );
-   }
-}
-
-
-void IndexSetSuite_TestMerge_OR( IndexSetSuiteData* data ) {
-   Index     ii;
-   #define   TEST_INDICES1_LENGTH 5
-   Index     testIndices1[TEST_INDICES1_LENGTH] = {0,3,9,11,   22};
-   /* Note is2 is slightly larger, so we can add some test data outside range of is1 */
-   #define   TEST_INDICES2_LENGTH 6
-   Index     testIndices2[TEST_INDICES2_LENGTH] = {0,  9,   14,22,28,38};
-   IndexSet* is1_preMerge = NULL;  
-   IndexSet* is2_preMerge = NULL; 
-
-   /* Create two copies of the index sets to use for comparison later */
-   is1_preMerge = IndexSet_New(IS1_SIZE);
-   is2_preMerge = IndexSet_New(IS2_SIZE);
-
-   /* set up some test data. */
-   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
-      IndexSet_Add( data->is, testIndices1[ii] );
-      IndexSet_Add( is1_preMerge, testIndices1[ii] );
-   }
-   for ( ii=0; ii< TEST_INDICES2_LENGTH; ii++ ) {
-      IndexSet_Add( data->is2, testIndices2[ii] );
-      IndexSet_Add( is2_preMerge, testIndices2[ii] );
-   }
-
-   /* at this point, data->is and is1_preMerge should be identical, and likewise for is2_preMerge
-   ** and testIndices2
-   */
-   
-   IndexSet_Merge_OR( data->is, data->is2 );
-
-   /* after the merge, we now expect data->is to hold the merged-or list */
-
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      /* check that an OR of the original list gives the same result as in merged list */
-      if ( IndexSet_IsMember( is1_preMerge, ii ) || IndexSet_IsMember( is2_preMerge, ii ) ) {
-         pcu_check_true( IndexSet_IsMember( data->is, ii ) );
-      }
-   }
-   /* merge function isn't supposed to modify its second argument. Check this. */
-   for ( ii=0; ii< IS2_SIZE; ii++ ) {
-      pcu_check_true( IndexSet_IsMember( data->is2, ii ) == IndexSet_IsMember( is2_preMerge, ii ) );
-   }
-
-   /* ok - now try reverse operation, merging into is2. Result up to IS1_SIZE should be
-      identical,
-      but after that is2 list should be unchanged. */
-
-   /* first re-set is1 */
-   IndexSet_RemoveAll( data->is );
-   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
-      IndexSet_Add( data->is, testIndices1[ii] );
-   }
-
-   /* then merge again, arguments reversed */
-   IndexSet_Merge_OR( data->is2, data->is );
-   /* and check is2 is merged for common length */
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      /* check that an OR of the original list gives the same result as in merged list */
-      if ( IndexSet_IsMember( is1_preMerge, ii ) || IndexSet_IsMember( is2_preMerge, ii ) ) {
-         pcu_check_true( IndexSet_IsMember( data->is2, ii ) );
-      }
-   }
-   /* check unchanged for last part of is2 */
-   for ( ii=IS1_SIZE; ii< IS2_SIZE; ii++ ) {
-      pcu_check_true( IndexSet_IsMember( data->is2, ii ) == IndexSet_IsMember( is2_preMerge, ii ) );
-   }
-   /* merge function isn't supposed to modify its second argument. Check this. */
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      pcu_check_true( IndexSet_IsMember( data->is, ii ) == IndexSet_IsMember( is1_preMerge, ii ) );
-   }
-}
-
-
-void IndexSetSuite_TestMerge_AND( IndexSetSuiteData* data ) {
-   Index     ii;
-   #define   TEST_INDICES1_LENGTH 5
-   Index     testIndices1[TEST_INDICES1_LENGTH] = {0,3,9,11,   22};
-   /* Note is2 is slightly larger, so we can add some test data outside range of is1 */
-   #define   TEST_INDICES2_LENGTH 6
-   Index     testIndices2[TEST_INDICES2_LENGTH] = {0,  9,   14,22,28,38};
-   IndexSet* is1_preMerge = NULL;  
-   IndexSet* is2_preMerge = NULL; 
-
-   /* Create two copies of the index sets to use for comparison later */
-   is1_preMerge = IndexSet_New(IS1_SIZE);
-   is2_preMerge = IndexSet_New(IS2_SIZE);
-
-   /* set up some test data.  */
-   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
-      IndexSet_Add( data->is, testIndices1[ii] );
-      IndexSet_Add( is1_preMerge, testIndices1[ii] );
-   }
-   for ( ii=0; ii< TEST_INDICES2_LENGTH; ii++ ) {
-      IndexSet_Add( data->is2, testIndices2[ii] );
-      IndexSet_Add( is2_preMerge, testIndices2[ii] );
-   }
-
-   /* at this point, data->is and is1_preMerge should be identical, and likewise
-    *  for is2_preMerge and testIndices2 */
-   
-   IndexSet_Merge_AND( data->is, data->is2 );
-
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      /* check that an AND of the original list gives the same result as in merged list */
-      if ( IndexSet_IsMember( is1_preMerge, ii ) && IndexSet_IsMember( is2_preMerge, ii ) ) {
-         pcu_check_true( IndexSet_IsMember( data->is, ii ) );
-      }
-   }
-   /* merge function isn't supposed to modify its second argument. Check this. */
-   for ( ii=0; ii< IS2_SIZE; ii++ ) {
-      pcu_check_true( IndexSet_IsMember( data->is2, ii ) == IndexSet_IsMember( is2_preMerge, ii ) );
-   }
-
-   /* ok - now try reverse operation, merging into is2. Result up to IS1_SIZE should be
-    * identical, but after that is2 list should be unchanged.
-    */
-
-   /* first re-set is1 */
-   IndexSet_RemoveAll( data->is );
-   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
-      IndexSet_Add( data->is, testIndices1[ii] );
-   }
-
-   IndexSet_Merge_AND( data->is2, data->is );
-
-   /* and check is2 is merged for common length */
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      /* check that an AND of the original list gives the same result as in merged list */
-      if ( IndexSet_IsMember( is1_preMerge, ii ) && IndexSet_IsMember( is2_preMerge, ii ) ) {
-         pcu_check_true( IndexSet_IsMember( data->is2, ii ) );
-      }
-   }
-   /* check last part of is2, beyond length of is1, has all entries set to 0 */
-   for ( ii=IS1_SIZE; ii< IS2_SIZE; ii++ ) {
-      pcu_check_true( False == IndexSet_IsMember( data->is2, ii ) );
-   }
-   /* merge function isn't supposed to modify its second argument. Check this. */
-   for ( ii=0; ii< IS1_SIZE; ii++ ) {
-      pcu_check_true( IndexSet_IsMember( data->is, ii ) == IndexSet_IsMember( is1_preMerge, ii ) );
-   }
-}
-
-
-void IndexSetSuite_TestBadAccess( IndexSetSuiteData* data ) {
-   stJournal->enable = False;
-   pcu_check_assert( IndexSet_IsMember( data->is, IS1_SIZE ) );
-   stJournal->enable = True;
-}
-
-
-void IndexSetSuite_TestBadAssign( IndexSetSuiteData* data ) {
-   stJournal->enable = False;
-   pcu_check_assert( IndexSet_Add( data->is, IS1_SIZE ) );
-   stJournal->enable = True;
-}
-
-
-void IndexSetSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, IndexSetSuiteData );
-   pcu_suite_setFixtures( suite, IndexSetSuite_Setup, IndexSetSuite_Teardown );
-   pcu_suite_addTest( suite, IndexSetSuite_TestRemoveAll );
-   pcu_suite_addTest( suite, IndexSetSuite_TestAddAll );
-   pcu_suite_addTest( suite, IndexSetSuite_TestInsertion );
-   pcu_suite_addTest( suite, IndexSetSuite_TestRemoval );
-   pcu_suite_addTest( suite, IndexSetSuite_TestUpdateMembersCount );
-   pcu_suite_addTest( suite, IndexSetSuite_TestGetIndexOfNthMember );
-   pcu_suite_addTest( suite, IndexSetSuite_TestGetMembers );
-   pcu_suite_addTest( suite, IndexSetSuite_TestGetVacancies );
-   pcu_suite_addTest( suite, IndexSetSuite_TestDuplicate );
-   pcu_suite_addTest( suite, IndexSetSuite_TestMerge_OR );
-   pcu_suite_addTest( suite, IndexSetSuite_TestMerge_AND );
-   #ifdef CAUTIOUS
-   pcu_suite_addTest( suite, IndexSetSuite_TestBadAccess );
-   pcu_suite_addTest( suite, IndexSetSuite_TestBadAssign );
-   #endif
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/IndexSetSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/IndexSetSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,426 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testIndexSet.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "IndexSetSuite.h"
+
+
+#define IS1_SIZE   25
+#define IS2_SIZE   40
+
+typedef struct {
+      IndexSet* is;
+      IndexSet* is2;
+} IndexSetSuiteData;
+
+
+void IndexSetSuite_Setup( IndexSetSuiteData* data ) {
+   /* Index sets are deliberately different sizes, to test all aspects of merge functionality */
+   data->is = IndexSet_New(IS1_SIZE);
+   data->is2 = IndexSet_New(IS2_SIZE);
+}
+
+void IndexSetSuite_Teardown( IndexSetSuiteData* data ) {
+   Stg_Class_Delete( data->is );
+   Stg_Class_Delete( data->is2 );
+}
+
+
+/* Start with this test, so we can be confident to returen an IS to a zero state, for other tests */
+void IndexSetSuite_TestRemoveAll( IndexSetSuiteData* data ) {
+   Index ii;
+
+  /* a couple of additions, so we know there's something to remove */
+   IndexSet_Add( data->is, 0 );
+   IndexSet_Add( data->is, 24 );
+   IndexSet_RemoveAll( data->is );
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      pcu_check_true( 0 == IndexSet_IsMember( data->is, ii ) );
+   }
+}
+
+
+void IndexSetSuite_TestAddAll( IndexSetSuiteData* data ) {
+   Index ii;
+
+   /* Index set will be starting in empty state */
+   IndexSet_AddAll( data->is );
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      pcu_check_true( True == IndexSet_IsMember( data->is, ii ) );
+   }
+}
+
+
+void IndexSetSuite_TestInsertion( IndexSetSuiteData* data ) {
+   Index ii=0;
+
+   IndexSet_RemoveAll( data->is );
+   IndexSet_Add( data->is, 0 );
+   IndexSet_Add( data->is, 7 );
+   IndexSet_Add( data->is, 8 );
+   IndexSet_Add( data->is, 22 );
+   IndexSet_Add( data->is, 24 );
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      if ( (ii==0) || (ii==7) || (ii==8) || (ii==22) || (ii==24) ) {
+         pcu_check_true( True == IndexSet_IsMember( data->is, ii ) );
+      }
+      else {
+         pcu_check_true( False == IndexSet_IsMember( data->is, ii ) );
+      }
+   }
+}
+
+
+void IndexSetSuite_TestRemoval( IndexSetSuiteData* data ) {
+   Index ii=0;
+
+   IndexSet_RemoveAll( data->is );
+   IndexSet_Add( data->is, 0 );
+   IndexSet_Add( data->is, 7 );
+   IndexSet_Add( data->is, 8 );
+   IndexSet_Add( data->is, 22 );
+   IndexSet_Add( data->is, 24 );
+
+   /*Now remove a couple of these again */
+   IndexSet_Remove( data->is, 7 );
+   IndexSet_Remove( data->is, 24 );
+
+   /*Thus list of members should be (0,7,8,22,24) - (7,24) = (0,8,22) */
+
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      if ( (ii==0) || (ii==8) || (ii==22) ) {
+         pcu_check_true( True == IndexSet_IsMember( data->is, ii ) );
+      }
+      else {
+         pcu_check_true( False == IndexSet_IsMember( data->is, ii ) );
+      }
+   }
+}
+
+void IndexSetSuite_TestUpdateMembersCount( IndexSetSuiteData* data ) {
+   Index ii=0;
+
+   IndexSet_RemoveAll( data->is );
+
+   IndexSet_UpdateMembersCount( data->is );
+   pcu_check_true( 0 == data->is->membersCount );
+
+   /* Add some members, to generate a count */
+   for ( ii=0; ii < 5; ii++ ) {
+      IndexSet_Add( data->is, ii );
+   }
+   for ( ii=20; ii < 25; ii++ ) {
+      IndexSet_Add( data->is, ii );
+   }
+   IndexSet_UpdateMembersCount( data->is );
+   pcu_check_true( 10 == data->is->membersCount );
+
+}
+
+
+void IndexSetSuite_TestGetIndexOfNthMember( IndexSetSuiteData* data ) {
+   Index ii;
+   Index retreivedIndex;
+   #define TEST_INDICES_LENGTH 5
+   Index testIndices[TEST_INDICES_LENGTH] = {0,3,9,11,22};
+
+   /* add all the test indices */
+   for( ii = 0; ii < TEST_INDICES_LENGTH; ii++ ) {
+      IndexSet_Add( data->is, testIndices[ii] );
+   }
+
+   IndexSet_UpdateMembersCount( data->is );
+   /* now check we are able to recover their indices correctly */
+   for( ii = 0; ii < data->is->membersCount; ii++ ) {
+      retreivedIndex = IndexSet_GetIndexOfNthMember( data->is, ii );
+      pcu_check_true( testIndices[ii] == retreivedIndex );
+   }
+}
+
+
+void IndexSetSuite_TestGetMembers( IndexSetSuiteData* data ) {
+   Index*	setArray;
+   unsigned int	setArraySize;
+
+   IndexSet_RemoveAll( data->is );
+
+   /* add some test set members */
+   IndexSet_Add( data->is, 0 );
+   IndexSet_Add( data->is, 7 );
+   IndexSet_Add( data->is, 8 );
+   IndexSet_Add( data->is, 22 );
+   IndexSet_Add( data->is, 24 );
+
+   IndexSet_GetMembers( data->is, &setArraySize, &setArray );
+   pcu_check_true( 5 == setArraySize );
+   pcu_check_true( 0 == setArray[0] );
+   pcu_check_true( 7 == setArray[1] );
+   pcu_check_true( 8 == setArray[2] );
+   pcu_check_true( 22 == setArray[3] );
+   pcu_check_true( 24 == setArray[4] );
+
+   Memory_Free( setArray );
+}
+
+
+void IndexSetSuite_TestGetVacancies( IndexSetSuiteData* data ) {
+   Index        ii;
+   Index*	setArray;
+   unsigned int	setArraySize;
+
+   IndexSet_RemoveAll( data->is );
+
+   /* set all indices to be included, except those exactly divisible by an example number */
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      if ( 0 != (ii % 5) ) {
+         IndexSet_Add( data->is, ii );
+      } 
+   }
+
+   IndexSet_GetVacancies( data->is, &setArraySize, &setArray );
+
+   pcu_check_true( (IS1_SIZE/5) == setArraySize );
+   for ( ii=0; ii < IS1_SIZE/5; ii++ ) {
+      pcu_check_true( ii*5 == setArray[ii] );
+   }
+
+   Memory_Free( setArray );
+}
+
+
+void IndexSetSuite_TestDuplicate( IndexSetSuiteData* data ) {
+   IndexSet* isDup;
+   Index     ii;
+
+   /* add some test set members to is1 for the duplicate */
+   IndexSet_RemoveAll( data->is );
+   IndexSet_Add( data->is, 0 );
+   IndexSet_Add( data->is, 7 );
+   IndexSet_Add( data->is, 8 );
+   IndexSet_Add( data->is, 22 );
+   IndexSet_UpdateMembersCount( data->is );
+   
+   isDup = IndexSet_Duplicate( data->is );
+
+   /* check it's exactly the same */
+   pcu_check_true( isDup->size == data->is->size );
+   pcu_check_true( isDup->membersCount == data->is->membersCount );
+
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      pcu_check_true( IndexSet_IsMember( isDup, ii ) == IndexSet_IsMember( data->is, ii ) );
+   }
+}
+
+
+void IndexSetSuite_TestMerge_OR( IndexSetSuiteData* data ) {
+   Index     ii;
+   #define   TEST_INDICES1_LENGTH 5
+   Index     testIndices1[TEST_INDICES1_LENGTH] = {0,3,9,11,   22};
+   /* Note is2 is slightly larger, so we can add some test data outside range of is1 */
+   #define   TEST_INDICES2_LENGTH 6
+   Index     testIndices2[TEST_INDICES2_LENGTH] = {0,  9,   14,22,28,38};
+   IndexSet* is1_preMerge = NULL;  
+   IndexSet* is2_preMerge = NULL; 
+
+   /* Create two copies of the index sets to use for comparison later */
+   is1_preMerge = IndexSet_New(IS1_SIZE);
+   is2_preMerge = IndexSet_New(IS2_SIZE);
+
+   /* set up some test data. */
+   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
+      IndexSet_Add( data->is, testIndices1[ii] );
+      IndexSet_Add( is1_preMerge, testIndices1[ii] );
+   }
+   for ( ii=0; ii< TEST_INDICES2_LENGTH; ii++ ) {
+      IndexSet_Add( data->is2, testIndices2[ii] );
+      IndexSet_Add( is2_preMerge, testIndices2[ii] );
+   }
+
+   /* at this point, data->is and is1_preMerge should be identical, and likewise for is2_preMerge
+   ** and testIndices2
+   */
+   
+   IndexSet_Merge_OR( data->is, data->is2 );
+
+   /* after the merge, we now expect data->is to hold the merged-or list */
+
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      /* check that an OR of the original list gives the same result as in merged list */
+      if ( IndexSet_IsMember( is1_preMerge, ii ) || IndexSet_IsMember( is2_preMerge, ii ) ) {
+         pcu_check_true( IndexSet_IsMember( data->is, ii ) );
+      }
+   }
+   /* merge function isn't supposed to modify its second argument. Check this. */
+   for ( ii=0; ii< IS2_SIZE; ii++ ) {
+      pcu_check_true( IndexSet_IsMember( data->is2, ii ) == IndexSet_IsMember( is2_preMerge, ii ) );
+   }
+
+   /* ok - now try reverse operation, merging into is2. Result up to IS1_SIZE should be
+      identical,
+      but after that is2 list should be unchanged. */
+
+   /* first re-set is1 */
+   IndexSet_RemoveAll( data->is );
+   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
+      IndexSet_Add( data->is, testIndices1[ii] );
+   }
+
+   /* then merge again, arguments reversed */
+   IndexSet_Merge_OR( data->is2, data->is );
+   /* and check is2 is merged for common length */
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      /* check that an OR of the original list gives the same result as in merged list */
+      if ( IndexSet_IsMember( is1_preMerge, ii ) || IndexSet_IsMember( is2_preMerge, ii ) ) {
+         pcu_check_true( IndexSet_IsMember( data->is2, ii ) );
+      }
+   }
+   /* check unchanged for last part of is2 */
+   for ( ii=IS1_SIZE; ii< IS2_SIZE; ii++ ) {
+      pcu_check_true( IndexSet_IsMember( data->is2, ii ) == IndexSet_IsMember( is2_preMerge, ii ) );
+   }
+   /* merge function isn't supposed to modify its second argument. Check this. */
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      pcu_check_true( IndexSet_IsMember( data->is, ii ) == IndexSet_IsMember( is1_preMerge, ii ) );
+   }
+}
+
+
+void IndexSetSuite_TestMerge_AND( IndexSetSuiteData* data ) {
+   Index     ii;
+   #define   TEST_INDICES1_LENGTH 5
+   Index     testIndices1[TEST_INDICES1_LENGTH] = {0,3,9,11,   22};
+   /* Note is2 is slightly larger, so we can add some test data outside range of is1 */
+   #define   TEST_INDICES2_LENGTH 6
+   Index     testIndices2[TEST_INDICES2_LENGTH] = {0,  9,   14,22,28,38};
+   IndexSet* is1_preMerge = NULL;  
+   IndexSet* is2_preMerge = NULL; 
+
+   /* Create two copies of the index sets to use for comparison later */
+   is1_preMerge = IndexSet_New(IS1_SIZE);
+   is2_preMerge = IndexSet_New(IS2_SIZE);
+
+   /* set up some test data.  */
+   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
+      IndexSet_Add( data->is, testIndices1[ii] );
+      IndexSet_Add( is1_preMerge, testIndices1[ii] );
+   }
+   for ( ii=0; ii< TEST_INDICES2_LENGTH; ii++ ) {
+      IndexSet_Add( data->is2, testIndices2[ii] );
+      IndexSet_Add( is2_preMerge, testIndices2[ii] );
+   }
+
+   /* at this point, data->is and is1_preMerge should be identical, and likewise
+    *  for is2_preMerge and testIndices2 */
+   
+   IndexSet_Merge_AND( data->is, data->is2 );
+
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      /* check that an AND of the original list gives the same result as in merged list */
+      if ( IndexSet_IsMember( is1_preMerge, ii ) && IndexSet_IsMember( is2_preMerge, ii ) ) {
+         pcu_check_true( IndexSet_IsMember( data->is, ii ) );
+      }
+   }
+   /* merge function isn't supposed to modify its second argument. Check this. */
+   for ( ii=0; ii< IS2_SIZE; ii++ ) {
+      pcu_check_true( IndexSet_IsMember( data->is2, ii ) == IndexSet_IsMember( is2_preMerge, ii ) );
+   }
+
+   /* ok - now try reverse operation, merging into is2. Result up to IS1_SIZE should be
+    * identical, but after that is2 list should be unchanged.
+    */
+
+   /* first re-set is1 */
+   IndexSet_RemoveAll( data->is );
+   for ( ii=0; ii< TEST_INDICES1_LENGTH; ii++ ) {
+      IndexSet_Add( data->is, testIndices1[ii] );
+   }
+
+   IndexSet_Merge_AND( data->is2, data->is );
+
+   /* and check is2 is merged for common length */
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      /* check that an AND of the original list gives the same result as in merged list */
+      if ( IndexSet_IsMember( is1_preMerge, ii ) && IndexSet_IsMember( is2_preMerge, ii ) ) {
+         pcu_check_true( IndexSet_IsMember( data->is2, ii ) );
+      }
+   }
+   /* check last part of is2, beyond length of is1, has all entries set to 0 */
+   for ( ii=IS1_SIZE; ii< IS2_SIZE; ii++ ) {
+      pcu_check_true( False == IndexSet_IsMember( data->is2, ii ) );
+   }
+   /* merge function isn't supposed to modify its second argument. Check this. */
+   for ( ii=0; ii< IS1_SIZE; ii++ ) {
+      pcu_check_true( IndexSet_IsMember( data->is, ii ) == IndexSet_IsMember( is1_preMerge, ii ) );
+   }
+}
+
+
+void IndexSetSuite_TestBadAccess( IndexSetSuiteData* data ) {
+   stJournal->enable = False;
+   pcu_check_assert( IndexSet_IsMember( data->is, IS1_SIZE ) );
+   stJournal->enable = True;
+}
+
+
+void IndexSetSuite_TestBadAssign( IndexSetSuiteData* data ) {
+   stJournal->enable = False;
+   pcu_check_assert( IndexSet_Add( data->is, IS1_SIZE ) );
+   stJournal->enable = True;
+}
+
+
+void IndexSetSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, IndexSetSuiteData );
+   pcu_suite_setFixtures( suite, IndexSetSuite_Setup, IndexSetSuite_Teardown );
+   pcu_suite_addTest( suite, IndexSetSuite_TestRemoveAll );
+   pcu_suite_addTest( suite, IndexSetSuite_TestAddAll );
+   pcu_suite_addTest( suite, IndexSetSuite_TestInsertion );
+   pcu_suite_addTest( suite, IndexSetSuite_TestRemoval );
+   pcu_suite_addTest( suite, IndexSetSuite_TestUpdateMembersCount );
+   pcu_suite_addTest( suite, IndexSetSuite_TestGetIndexOfNthMember );
+   pcu_suite_addTest( suite, IndexSetSuite_TestGetMembers );
+   pcu_suite_addTest( suite, IndexSetSuite_TestGetVacancies );
+   pcu_suite_addTest( suite, IndexSetSuite_TestDuplicate );
+   pcu_suite_addTest( suite, IndexSetSuite_TestMerge_OR );
+   pcu_suite_addTest( suite, IndexSetSuite_TestMerge_AND );
+   #ifdef CAUTIOUS
+   pcu_suite_addTest( suite, IndexSetSuite_TestBadAccess );
+   pcu_suite_addTest( suite, IndexSetSuite_TestBadAssign );
+   #endif
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/LinkedListIteratorSuite.c
--- a/Base/Container/tests/LinkedListIteratorSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testLinkedList.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "LinkedListSuite.h"
-#include "LinkedListIteratorSuite.h"
-
-#define NUM_DATA 100
-
-typedef struct {
-   LinkedList*       numList;
-   int*              array[NUM_DATA];
-} LinkedListIteratorSuiteData;
-
-
-void LinkedListIteratorSuite_Setup( LinkedListIteratorSuiteData* data ) {
-   Index          ii = 0;
-
-   data->numList = LinkedList_New(
-            LinkedListSuite_CompareFunction,
-            LinkedListSuite_DataCopyFunction,
-            LinkedListSuite_DataPrintFunction,
-            NULL,
-            LINKEDLIST_UNSORTED);
-
-   for(ii=0; ii<NUM_DATA; ii++){
-      data->array[ii] = Memory_Alloc(int, "TestLinkedList_ArrayEntry");
-      *data->array[ii] = ii;
-   }
-}
-
-void LinkedListIteratorSuite_Teardown( LinkedListIteratorSuiteData* data ) {
-   Index          ii = 0;
-
-   Stg_Class_Delete( data->numList );
-   for(ii=0; ii < NUM_DATA; ii++){
-      Memory_Free( data->array[ii] );
-   }
-}
-
-
-void LinkedListIteratorSuite_TestRetreive( LinkedListIteratorSuiteData* data ) {
-	LinkedListIterator *iterator = NULL;
-	LinkedListIterator *iterator1 = NULL;
-	void *result = NULL, *result1 = NULL;
-	int ii = 0;
-	int jj = 0;
-
-   iterator = LinkedListIterator_New( data->numList );
-   iterator1 = LinkedListIterator_New( data->numList );
-
-   for(ii=0; ii<NUM_DATA; ii++){
-      LinkedList_InsertNode( data->numList, data->array[ii], sizeof(int));
-   }
-
-   ii = 0;
-   for( result = LinkedListIterator_First( iterator ); result; result = LinkedListIterator_Next( iterator ) ){
-      pcu_check_true( *((int*)result) == (NUM_DATA-1 - *data->array[ii]) );
-      jj=0;
-      for( result1 = LinkedListIterator_First( iterator1 ); result1; result1 = LinkedListIterator_Next( iterator1 ) ){
-         pcu_check_true( *((int*)result1) == (NUM_DATA-1 - *data->array[jj]) );
-         jj++;
-      }
-      pcu_check_true( jj == NUM_DATA );
-      result = LinkedListIterator_Next( iterator1 ); 
-      pcu_check_true( NULL == result );
-      ii++;
-   }
-   pcu_check_true( ii == NUM_DATA );
-   result = LinkedListIterator_Next( iterator );
-   pcu_check_true( NULL == result );
-}
-
-
-void LinkedListIteratorSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, LinkedListIteratorSuiteData );
-   pcu_suite_setFixtures( suite, LinkedListIteratorSuite_Setup, LinkedListIteratorSuite_Teardown );
-   pcu_suite_addTest( suite, LinkedListIteratorSuite_TestRetreive );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/LinkedListIteratorSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/LinkedListIteratorSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,116 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testLinkedList.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "LinkedListSuite.h"
+#include "LinkedListIteratorSuite.h"
+
+#define NUM_DATA 100
+
+typedef struct {
+   LinkedList*       numList;
+   int*              array[NUM_DATA];
+} LinkedListIteratorSuiteData;
+
+
+void LinkedListIteratorSuite_Setup( LinkedListIteratorSuiteData* data ) {
+   Index          ii = 0;
+
+   data->numList = LinkedList_New(
+            LinkedListSuite_CompareFunction,
+            LinkedListSuite_DataCopyFunction,
+            LinkedListSuite_DataPrintFunction,
+            NULL,
+            LINKEDLIST_UNSORTED);
+
+   for(ii=0; ii<NUM_DATA; ii++){
+      data->array[ii] = Memory_Alloc(int, "TestLinkedList_ArrayEntry");
+      *data->array[ii] = ii;
+   }
+}
+
+void LinkedListIteratorSuite_Teardown( LinkedListIteratorSuiteData* data ) {
+   Index          ii = 0;
+
+   Stg_Class_Delete( data->numList );
+   for(ii=0; ii < NUM_DATA; ii++){
+      Memory_Free( data->array[ii] );
+   }
+}
+
+
+void LinkedListIteratorSuite_TestRetreive( LinkedListIteratorSuiteData* data ) {
+	LinkedListIterator *iterator = NULL;
+	LinkedListIterator *iterator1 = NULL;
+	void *result = NULL, *result1 = NULL;
+	int ii = 0;
+	int jj = 0;
+
+   iterator = LinkedListIterator_New( data->numList );
+   iterator1 = LinkedListIterator_New( data->numList );
+
+   for(ii=0; ii<NUM_DATA; ii++){
+      LinkedList_InsertNode( data->numList, data->array[ii], sizeof(int));
+   }
+
+   ii = 0;
+   for( result = LinkedListIterator_First( iterator ); result; result = LinkedListIterator_Next( iterator ) ){
+      pcu_check_true( *((int*)result) == (NUM_DATA-1 - *data->array[ii]) );
+      jj=0;
+      for( result1 = LinkedListIterator_First( iterator1 ); result1; result1 = LinkedListIterator_Next( iterator1 ) ){
+         pcu_check_true( *((int*)result1) == (NUM_DATA-1 - *data->array[jj]) );
+         jj++;
+      }
+      pcu_check_true( jj == NUM_DATA );
+      result = LinkedListIterator_Next( iterator1 ); 
+      pcu_check_true( NULL == result );
+      ii++;
+   }
+   pcu_check_true( ii == NUM_DATA );
+   result = LinkedListIterator_Next( iterator );
+   pcu_check_true( NULL == result );
+}
+
+
+void LinkedListIteratorSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, LinkedListIteratorSuiteData );
+   pcu_suite_setFixtures( suite, LinkedListIteratorSuite_Setup, LinkedListIteratorSuite_Teardown );
+   pcu_suite_addTest( suite, LinkedListIteratorSuite_TestRetreive );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/LinkedListSuite.c
--- a/Base/Container/tests/LinkedListSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testLinkedList.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "LinkedListSuite.h"
-
-#define NUM_DATA 100
-
-/*
- * Define the context data structure to be usesd for each test-case.
- */
-typedef struct {
-   LinkedList*       numList;
-   int*              array[NUM_DATA];
-} LinkedListSuiteData;
-
-
-int LinkedListSuite_CompareFunction(void *data1, void *data2)
-{
-	int *d1 = NULL, *d2 = NULL;
-
-	d1 = (int*)data1;
-	d2 = (int*)data2;
-
-	if (d1 == NULL || d2 == NULL){
-		return 0;	
-	}
-	
-	if (*d1 > *d2){
-		return  1;
-	}
-	else if (*d1 == *d2){
-		return 0;
-	}
-	else{
-		return -1;
-	}
-}
-
-void LinkedListSuite_DataPrintFunction( void *nodeData, void *args )
-{
-	Stream *myStream = NULL;
-	
-	assert (nodeData);
-	myStream = Journal_Register( InfoStream_Type, (Name)"LinkedListStream"  );
-
-	Journal_Printf( myStream, "\t%d\n", *(int*)nodeData );
-}
-
-void LinkedListSuite_DataCopyFunction( void **nodeData, void *newData, SizeT dataSize)
-{
-	*nodeData = Memory_Alloc_Bytes_Unnamed(dataSize, "char");
-	memset(*nodeData, 0, dataSize);
-
-	memcpy(*nodeData, newData, dataSize);
-}
-
-void LinkedListSuite_Setup( LinkedListSuiteData* data ) {
-   Index          ii = 0;
-
-   data->numList = LinkedList_New(
-            LinkedListSuite_CompareFunction,
-            LinkedListSuite_DataCopyFunction,
-            LinkedListSuite_DataPrintFunction,
-            NULL,
-            LINKEDLIST_UNSORTED);
-
-   for(ii=0; ii<NUM_DATA; ii++){
-      data->array[ii] = Memory_Alloc(int, "TestLinkedList_ArrayEntry");
-      *data->array[ii] = ii;
-   }
-}
-
-void LinkedListSuite_Teardown( LinkedListSuiteData* data ) {
-   Index          ii = 0;
-
-   Stg_Class_Delete( data->numList );
-   for(ii=0; ii < NUM_DATA; ii++){
-      Memory_Free( data->array[ii] );
-   }
-}
-
-
-void LinkedListSuite_TestInsert( LinkedListSuiteData* data ) {
-   Index             ii = 0;
-   LinkedListNode*   currNode=NULL;   
-
-   /* Inserting data into the List\n */
-   for(ii=0; ii<NUM_DATA; ii++){
-      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
-   }
-
-   pcu_check_true( data->numList->nodeCount == NUM_DATA );
-   currNode = data->numList->head;
-
-   /* Note: since current implementation inserts new linked list nodes at the head, rather than the tail, the
-    * list nodes will be in reverse order. This probably should be changed to insert at the tail, but I won't
-    * do this just in case some other code is relying on this reversed order. --PatrickSunter, 31 May 2009 */ 
-   for(ii=0; ii<NUM_DATA; ii++){
-      pcu_check_true( *((int*)currNode->data) == (NUM_DATA-1 - *data->array[ii]) );
-      currNode = currNode->next;
-   }
-}
-
-
-void LinkedListSuite_TestDelete( LinkedListSuiteData* data ) {
-   Index          ii = 0;
-   LinkedListNode*   currNode=NULL;   
-
-   for(ii=0; ii<NUM_DATA; ii++){
-      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
-   }
-   /* \nDeleting half the nodes previously inserted into the list\n */
-   for(ii=0; ii<NUM_DATA/2; ii++){
-      LinkedList_DeleteNode(data->numList, data->array[ii]);
-   }
-   
-   pcu_check_true( data->numList->nodeCount == NUM_DATA/2 );
-   currNode = data->numList->head;
-   /* Since they end up in reverse order, the deleted notes should be the 2nd half of the list, so the first half
-    * should have remained unchanged */   
-   for(ii=0; ii<NUM_DATA/2; ii++){
-      pcu_check_true( *((int*)currNode->data) == (NUM_DATA-1 - *data->array[ii]) );
-      currNode = currNode->next;
-   }
-}
-
-
-void LinkedListSuite_TestReturnArray( LinkedListSuiteData* data ) {
-   int*           numArray;
-   Index          ii = 0;
-
-   for(ii=0; ii<NUM_DATA; ii++){
-      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
-   }
-   /* \nRetrieving the data held in the list as an array\n */
-   numArray = LinkedList_ReturnArray(data->numList, int);
-
-   for(ii=0; ii<data->numList->nodeCount; ii++){
-      pcu_check_true(numArray[ii] == (NUM_DATA-1 - *data->array[ii]));
-   }
-   Memory_Free( numArray );
-}
-
-
-void LinkedListSuite_TestFindNodeData( LinkedListSuiteData* data ) {
-   int*           result = NULL;
-   Index          ii = 0;
-   int            secondArray[NUM_DATA];
-
-   for(ii=0; ii<NUM_DATA; ii++){
-      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
-      secondArray[ii] = *data->array[ii];
-   }
-   /* \nSearching for Node data in the list\n */
-   /* Deliberately search with ptrs from a different array: want the ptrs to be different, thus checking using the
-    *  compare function if the data itself is the same */
-   for(ii=0; ii<NUM_DATA/4; ii++) {
-      result = LinkedList_FindNodeData(data->numList, &secondArray[ii], int);
-      pcu_check_true( result != NULL );
-      pcu_check_true( *result == *data->array[ii] );
-   }
-}
-
-
-void LinkedListSuite( pcu_suite_t* suite ) {
-    /* Tell PCU the context data type to pass to each test-case in this suite. */
-   pcu_suite_setData( suite, LinkedListSuiteData );
-
-   /* Set the fixtures to be run before and after each test-case. */
-   pcu_suite_setFixtures( suite, LinkedListSuite_Setup, LinkedListSuite_Teardown );
-
-   /* Add all the test-cases. */
-   pcu_suite_addTest( suite, LinkedListSuite_TestInsert );
-   pcu_suite_addTest( suite, LinkedListSuite_TestDelete );
-   pcu_suite_addTest( suite, LinkedListSuite_TestReturnArray );
-   pcu_suite_addTest( suite, LinkedListSuite_TestFindNodeData );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/LinkedListSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/LinkedListSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,215 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testLinkedList.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "LinkedListSuite.h"
+
+#define NUM_DATA 100
+
+/*
+ * Define the context data structure to be usesd for each test-case.
+ */
+typedef struct {
+   LinkedList*       numList;
+   int*              array[NUM_DATA];
+} LinkedListSuiteData;
+
+
+int LinkedListSuite_CompareFunction(void *data1, void *data2)
+{
+	int *d1 = NULL, *d2 = NULL;
+
+	d1 = (int*)data1;
+	d2 = (int*)data2;
+
+	if (d1 == NULL || d2 == NULL){
+		return 0;	
+	}
+	
+	if (*d1 > *d2){
+		return  1;
+	}
+	else if (*d1 == *d2){
+		return 0;
+	}
+	else{
+		return -1;
+	}
+}
+
+void LinkedListSuite_DataPrintFunction( void *nodeData, void *args )
+{
+	Stream *myStream = NULL;
+	
+	assert (nodeData);
+	myStream = Journal_Register( InfoStream_Type, (Name)"LinkedListStream"  );
+
+	Journal_Printf( myStream, "\t%d\n", *(int*)nodeData );
+}
+
+void LinkedListSuite_DataCopyFunction( void **nodeData, void *newData, SizeT dataSize)
+{
+	*nodeData = Memory_Alloc_Bytes_Unnamed(dataSize, "char");
+	memset(*nodeData, 0, dataSize);
+
+	memcpy(*nodeData, newData, dataSize);
+}
+
+void LinkedListSuite_Setup( LinkedListSuiteData* data ) {
+   Index          ii = 0;
+
+   data->numList = LinkedList_New(
+            LinkedListSuite_CompareFunction,
+            LinkedListSuite_DataCopyFunction,
+            LinkedListSuite_DataPrintFunction,
+            NULL,
+            LINKEDLIST_UNSORTED);
+
+   for(ii=0; ii<NUM_DATA; ii++){
+      data->array[ii] = Memory_Alloc(int, "TestLinkedList_ArrayEntry");
+      *data->array[ii] = ii;
+   }
+}
+
+void LinkedListSuite_Teardown( LinkedListSuiteData* data ) {
+   Index          ii = 0;
+
+   Stg_Class_Delete( data->numList );
+   for(ii=0; ii < NUM_DATA; ii++){
+      Memory_Free( data->array[ii] );
+   }
+}
+
+
+void LinkedListSuite_TestInsert( LinkedListSuiteData* data ) {
+   Index             ii = 0;
+   LinkedListNode*   currNode=NULL;   
+
+   /* Inserting data into the List\n */
+   for(ii=0; ii<NUM_DATA; ii++){
+      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
+   }
+
+   pcu_check_true( data->numList->nodeCount == NUM_DATA );
+   currNode = data->numList->head;
+
+   /* Note: since current implementation inserts new linked list nodes at the head, rather than the tail, the
+    * list nodes will be in reverse order. This probably should be changed to insert at the tail, but I won't
+    * do this just in case some other code is relying on this reversed order. --PatrickSunter, 31 May 2009 */ 
+   for(ii=0; ii<NUM_DATA; ii++){
+      pcu_check_true( *((int*)currNode->data) == (NUM_DATA-1 - *data->array[ii]) );
+      currNode = currNode->next;
+   }
+}
+
+
+void LinkedListSuite_TestDelete( LinkedListSuiteData* data ) {
+   Index          ii = 0;
+   LinkedListNode*   currNode=NULL;   
+
+   for(ii=0; ii<NUM_DATA; ii++){
+      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
+   }
+   /* \nDeleting half the nodes previously inserted into the list\n */
+   for(ii=0; ii<NUM_DATA/2; ii++){
+      LinkedList_DeleteNode(data->numList, data->array[ii]);
+   }
+   
+   pcu_check_true( data->numList->nodeCount == NUM_DATA/2 );
+   currNode = data->numList->head;
+   /* Since they end up in reverse order, the deleted notes should be the 2nd half of the list, so the first half
+    * should have remained unchanged */   
+   for(ii=0; ii<NUM_DATA/2; ii++){
+      pcu_check_true( *((int*)currNode->data) == (NUM_DATA-1 - *data->array[ii]) );
+      currNode = currNode->next;
+   }
+}
+
+
+void LinkedListSuite_TestReturnArray( LinkedListSuiteData* data ) {
+   int*           numArray;
+   Index          ii = 0;
+
+   for(ii=0; ii<NUM_DATA; ii++){
+      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
+   }
+   /* \nRetrieving the data held in the list as an array\n */
+   numArray = LinkedList_ReturnArray(data->numList, int);
+
+   for(ii=0; ii<data->numList->nodeCount; ii++){
+      pcu_check_true(numArray[ii] == (NUM_DATA-1 - *data->array[ii]));
+   }
+   Memory_Free( numArray );
+}
+
+
+void LinkedListSuite_TestFindNodeData( LinkedListSuiteData* data ) {
+   int*           result = NULL;
+   Index          ii = 0;
+   int            secondArray[NUM_DATA];
+
+   for(ii=0; ii<NUM_DATA; ii++){
+      LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int));
+      secondArray[ii] = *data->array[ii];
+   }
+   /* \nSearching for Node data in the list\n */
+   /* Deliberately search with ptrs from a different array: want the ptrs to be different, thus checking using the
+    *  compare function if the data itself is the same */
+   for(ii=0; ii<NUM_DATA/4; ii++) {
+      result = LinkedList_FindNodeData(data->numList, &secondArray[ii], int);
+      pcu_check_true( result != NULL );
+      pcu_check_true( *result == *data->array[ii] );
+   }
+}
+
+
+void LinkedListSuite( pcu_suite_t* suite ) {
+    /* Tell PCU the context data type to pass to each test-case in this suite. */
+   pcu_suite_setData( suite, LinkedListSuiteData );
+
+   /* Set the fixtures to be run before and after each test-case. */
+   pcu_suite_setFixtures( suite, LinkedListSuite_Setup, LinkedListSuite_Teardown );
+
+   /* Add all the test-cases. */
+   pcu_suite_addTest( suite, LinkedListSuite_TestInsert );
+   pcu_suite_addTest( suite, LinkedListSuite_TestDelete );
+   pcu_suite_addTest( suite, LinkedListSuite_TestReturnArray );
+   pcu_suite_addTest( suite, LinkedListSuite_TestFindNodeData );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/ListSuite.c
--- a/Base/Container/tests/ListSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testList.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "ListSuite.h"
-
-#define NUM_ITEMS  100
-
-typedef struct {
-   List*    list;
-   int      arrayData[NUM_ITEMS];
-} ListSuiteData;
-
-
-void ListSuite_Setup( ListSuiteData* data ) {
-   Index         idx;
-
-   data->list = List_New();
-   List_SetItemSize( data->list, sizeof(int) );
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      data->arrayData[idx] = idx;
-   }
-}
-
-
-void ListSuite_Teardown( ListSuiteData* data ) {
-   Stg_Class_Delete( data->list );
-}
-
-
-void ListSuite_TestAppend( ListSuiteData* data ) {
-   Index         idx;
-
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      List_Append( data->list, &data->arrayData[idx] );
-   }
-
-   pcu_check_true( data->list->nItems == NUM_ITEMS );
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == idx );
-   }
-}
-
-
-void ListSuite_TestPrepend( ListSuiteData* data ) {
-   Index         idx;
-
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      List_Prepend( data->list, &data->arrayData[idx] );
-   }
-
-   pcu_check_true( data->list->nItems == NUM_ITEMS );
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == ((NUM_ITEMS-1) - idx) );
-   }
-}
-
-
-void ListSuite_TestInsert( ListSuiteData* data ) {
-   Index         idx;
-
-   /* Initially, insert at the end */
-   for( idx = 0; idx < NUM_ITEMS/2; idx++ ) {
-      List_Insert( data->list, idx, &data->arrayData[idx] );
-   }
-   /* Then insert the rest from the half-way point */
-   for( idx = NUM_ITEMS/2; idx < NUM_ITEMS; idx++ ) {
-      List_Insert( data->list, NUM_ITEMS/2, &data->arrayData[idx] );
-   }
-
-   pcu_check_true( data->list->nItems == NUM_ITEMS );
-
-   for( idx = 0; idx < NUM_ITEMS/2; idx++ ) {
-      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == idx );
-   }
-   for( idx = NUM_ITEMS/2; idx < NUM_ITEMS; idx++ ) {
-      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == ((NUM_ITEMS-1) - (idx - NUM_ITEMS/2)) );
-   }
-}
-
-
-void ListSuite_TestClear( ListSuiteData* data ) {
-   Index         idx;
-
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      List_Append( data->list, &data->arrayData[idx] );
-   }
-   List_Clear( data->list );
-   pcu_check_true( data->list->nItems == 0 );
-   List_Clear( data->list );
-   pcu_check_true( data->list->nItems == 0 );
-}
-
-
-void ListSuite_TestRemove( ListSuiteData* data ) {
-   Index         idx;
-   Index         listIndex=0;
-
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      List_Append( data->list, &data->arrayData[idx] );
-   }
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      if ( idx % 2 == 0 ) {
-         List_Remove( data->list, &data->arrayData[idx] );
-      }
-   }
-
-   pcu_check_true( data->list->nItems == NUM_ITEMS/2 );
-   listIndex=0;
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      if ( idx % 2 == 1 ) {
-         pcu_check_true( *(unsigned*)List_GetItem( data->list, listIndex ) == idx );
-         listIndex++;
-      }
-   }
-}
-
-
-void ListSuite_TestExists( ListSuiteData* data ) {
-   Index          idx;
-   int            inArray=5;
-   int            notInArray=34352;
-
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      List_Append( data->list, &data->arrayData[idx] );
-   }
-
-   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
-      pcu_check_true( List_Exists( data->list, &data->arrayData[idx] ) == True );
-   }
-   pcu_check_true( List_Exists( data->list, &inArray ) == True );
-   pcu_check_true( List_Exists( data->list, &notInArray ) == False );
-}
-
-
-void ListSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ListSuiteData );
-   pcu_suite_setFixtures( suite, ListSuite_Setup, ListSuite_Teardown );
-   pcu_suite_addTest( suite, ListSuite_TestAppend );
-   pcu_suite_addTest( suite, ListSuite_TestPrepend );
-   pcu_suite_addTest( suite, ListSuite_TestInsert );
-   pcu_suite_addTest( suite, ListSuite_TestClear );
-   pcu_suite_addTest( suite, ListSuite_TestRemove );
-   pcu_suite_addTest( suite, ListSuite_TestExists );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/ListSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/ListSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,181 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testList.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "ListSuite.h"
+
+#define NUM_ITEMS  100
+
+typedef struct {
+   List*    list;
+   int      arrayData[NUM_ITEMS];
+} ListSuiteData;
+
+
+void ListSuite_Setup( ListSuiteData* data ) {
+   Index         idx;
+
+   data->list = List_New();
+   List_SetItemSize( data->list, sizeof(int) );
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      data->arrayData[idx] = idx;
+   }
+}
+
+
+void ListSuite_Teardown( ListSuiteData* data ) {
+   Stg_Class_Delete( data->list );
+}
+
+
+void ListSuite_TestAppend( ListSuiteData* data ) {
+   Index         idx;
+
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      List_Append( data->list, &data->arrayData[idx] );
+   }
+
+   pcu_check_true( data->list->nItems == NUM_ITEMS );
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == idx );
+   }
+}
+
+
+void ListSuite_TestPrepend( ListSuiteData* data ) {
+   Index         idx;
+
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      List_Prepend( data->list, &data->arrayData[idx] );
+   }
+
+   pcu_check_true( data->list->nItems == NUM_ITEMS );
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == ((NUM_ITEMS-1) - idx) );
+   }
+}
+
+
+void ListSuite_TestInsert( ListSuiteData* data ) {
+   Index         idx;
+
+   /* Initially, insert at the end */
+   for( idx = 0; idx < NUM_ITEMS/2; idx++ ) {
+      List_Insert( data->list, idx, &data->arrayData[idx] );
+   }
+   /* Then insert the rest from the half-way point */
+   for( idx = NUM_ITEMS/2; idx < NUM_ITEMS; idx++ ) {
+      List_Insert( data->list, NUM_ITEMS/2, &data->arrayData[idx] );
+   }
+
+   pcu_check_true( data->list->nItems == NUM_ITEMS );
+
+   for( idx = 0; idx < NUM_ITEMS/2; idx++ ) {
+      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == idx );
+   }
+   for( idx = NUM_ITEMS/2; idx < NUM_ITEMS; idx++ ) {
+      pcu_check_true( *(unsigned*)List_GetItem( data->list, idx ) == ((NUM_ITEMS-1) - (idx - NUM_ITEMS/2)) );
+   }
+}
+
+
+void ListSuite_TestClear( ListSuiteData* data ) {
+   Index         idx;
+
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      List_Append( data->list, &data->arrayData[idx] );
+   }
+   List_Clear( data->list );
+   pcu_check_true( data->list->nItems == 0 );
+   List_Clear( data->list );
+   pcu_check_true( data->list->nItems == 0 );
+}
+
+
+void ListSuite_TestRemove( ListSuiteData* data ) {
+   Index         idx;
+   Index         listIndex=0;
+
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      List_Append( data->list, &data->arrayData[idx] );
+   }
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      if ( idx % 2 == 0 ) {
+         List_Remove( data->list, &data->arrayData[idx] );
+      }
+   }
+
+   pcu_check_true( data->list->nItems == NUM_ITEMS/2 );
+   listIndex=0;
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      if ( idx % 2 == 1 ) {
+         pcu_check_true( *(unsigned*)List_GetItem( data->list, listIndex ) == idx );
+         listIndex++;
+      }
+   }
+}
+
+
+void ListSuite_TestExists( ListSuiteData* data ) {
+   Index          idx;
+   int            inArray=5;
+   int            notInArray=34352;
+
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      List_Append( data->list, &data->arrayData[idx] );
+   }
+
+   for( idx = 0; idx < NUM_ITEMS; idx++ ) {
+      pcu_check_true( List_Exists( data->list, &data->arrayData[idx] ) == True );
+   }
+   pcu_check_true( List_Exists( data->list, &inArray ) == True );
+   pcu_check_true( List_Exists( data->list, &notInArray ) == False );
+}
+
+
+void ListSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ListSuiteData );
+   pcu_suite_setFixtures( suite, ListSuite_Setup, ListSuite_Teardown );
+   pcu_suite_addTest( suite, ListSuite_TestAppend );
+   pcu_suite_addTest( suite, ListSuite_TestPrepend );
+   pcu_suite_addTest( suite, ListSuite_TestInsert );
+   pcu_suite_addTest( suite, ListSuite_TestClear );
+   pcu_suite_addTest( suite, ListSuite_TestRemove );
+   pcu_suite_addTest( suite, ListSuite_TestExists );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/MPIRoutinesSuite.c
--- a/Base/Container/tests/MPIRoutinesSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,303 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testMPIRoutines.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "MPIRoutinesSuite.h"
-
-typedef struct {
-   int rank;
-   int nProcs;
-} MPIRoutinesSuiteData;
-
-void MPIRoutinesSuite_Setup( MPIRoutinesSuiteData* data ) {
-   /* Assign the rank and nProcs */
-   /* We can be sure MPI_Init called already, immediately in testStGermain.c the test harness code */
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-   MPI_Comm_size( MPI_COMM_WORLD, &data->nProcs );
-}
-
-void MPIRoutinesSuite_Teardown( MPIRoutinesSuiteData* data ) {
-}
-
-
-void fillArray( unsigned* array, unsigned size, unsigned rank ) {
- 
-   unsigned   i;
-
-   for( i = 0; i < size; i++ )
-      array[i] = rank * size + i;
-}
-
-
-void MPIRoutinesSuite_TestArrayConv( MPIRoutinesSuiteData* data ) {
-   unsigned   nBlocks = 3;
-   unsigned   sizes[3] = {2, 4, 1};
-   unsigned   src[7] = {0, 1, 2, 3, 4, 5, 6};
-   unsigned**   dst2D;
-   unsigned*   dst1D;
-   unsigned*   disps;
-
-   Array_1DTo2D( nBlocks, sizes, src, (void***)&dst2D, sizeof(unsigned) );
-   pcu_check_true( dst2D[0][0] == 0 && dst2D[0][1] == 1 && 
-       dst2D[1][0] == 2 && dst2D[1][1] == 3 && dst2D[1][2] == 4 && dst2D[1][3] == 5 && 
-       dst2D[2][0] == 6 );
-
-   Array_2DTo1D( nBlocks, sizes, (void**)dst2D, (void**)&dst1D, sizeof(unsigned), &disps );
-   pcu_check_true( dst1D[0] == 0 && dst1D[1] == 1 && dst1D[2] == 2 && dst1D[3] == 3 && 
-       dst1D[4] == 4 && dst1D[5] == 5 && dst1D[6] == 6 && 
-       disps[0] == 0 && disps[1] == 2 && disps[2] == 6 );
-
-   /* This time it tests the function can handle a 2D array with a zero-size column */
-   sizes[1] = 0;
-   Array_1DTo2D( nBlocks, sizes, src, (void***)&dst2D, sizeof(unsigned) );
-   pcu_check_true( dst2D[0][0] == 0 && dst2D[0][1] == 1 && 
-       dst2D[2][0] == 2 );
-
-   Array_2DTo1D( nBlocks, sizes, (void**)dst2D, (void**)&dst1D, sizeof(unsigned), &disps );
-   pcu_check_true( dst1D[0] == 0 && dst1D[1] == 1 && dst1D[2] == 2 && 
-       disps[0] == 0 && disps[1] == 2 && disps[2] == 2 );
-
-   FreeArray( dst2D );
-   FreeArray( dst1D );
-   FreeArray( disps );
-}
-
-
-void MPIRoutinesSuite_TestBcast( MPIRoutinesSuiteData* data ) {
-   unsigned    size = 200;
-   unsigned*   src = NULL;
-   Index       ii;
-
-   if( data->rank == 0 ) {
-      src = Memory_Alloc_Array_Unnamed( unsigned, size );
-      fillArray( src, size, data->rank );
-   }
-
-   MPIArray_Bcast( &size, (void**)&src, sizeof(unsigned), 
-         0, MPI_COMM_WORLD );
-
-   /* Make sure the contents of the broadcast array are the same as the fillArray function predicates */
-   for( ii = 0; ii < size; ii++ )
-      if( src[ii] != ii ) break;
-
-   pcu_check_true( ii == size );
-
-   FreeArray( src );
-   return;
-}
-
-
-void MPIRoutinesSuite_TestGather( MPIRoutinesSuiteData* data ) {
-   unsigned     size = 200;
-   unsigned     src[200];
-   unsigned*    dstSizes = NULL;
-   unsigned**   dstArrays = NULL;
-   int        ii;
-   int        watch;
-
-   fillArray( src, size, data->rank );
-
-   /* We should run the gather on each processor, to be thorough */
-   for ( watch = 0; watch < data->nProcs; watch++ ) {
-      MPIArray_Gather( size, src, &dstSizes, (void***)&dstArrays, sizeof(unsigned), watch, MPI_COMM_WORLD );
-
-      /* Only the gathering processor in each loop needs to check the dstArrays content.
-       * The others shouldn't receive anything in dstArrays */
-      if ( data->rank == watch ) {
-         for( ii = 0; ii < data->nProcs; ii++ ) {
-            pcu_check_true( dstSizes[ii] == size );
-         }
-
-         /* Check the contents of the arrays are correct. Note, I've kept Alan's approach
-          *  of breaking out of the loop when a problem's detected and pcu_asserting on
-          *  the result, to avoid potentially hundreds of pcu_assert prints if there's
-          *  a problem. Just one will suffice I think.
-          *  -- PatrickSunter, 1 April 2009.
-          */ 
-         for( ii = 0; ii < data->nProcs; ii++ ) {
-            unsigned   jj;
-
-            for( jj = 0; jj < size; jj++ )
-               if( dstArrays[ii][jj] != ii * size + jj ) break;
-            if( jj < size ) break;
-         }
-         pcu_check_true( ii == data->nProcs );
-
-         /* Free the dst arrays, so we can test they are autmatically re-created properly
-          * next loop */
-         FreeArray( dstSizes );
-         FreeArray( dstArrays );
-
-         dstSizes = NULL;
-         dstArrays = NULL;
-      }
-   }
-
-   /* Hmmm, shouldn't we test some variable size arrays as well?
-    * --PatrickSunter, 1 Apr 2009 */
-}
-
-
-void MPIRoutinesSuite_TestAllgather( MPIRoutinesSuiteData* data ) {
-   unsigned    size = 200;
-   unsigned    src[200];
-   unsigned*   dstSizes;
-   unsigned**  dstArrays;
-   int       ii;
-
-   fillArray( src, size, data->rank );
-
-   /* allgather runs just once, on all processors */
-   MPIArray_Allgather( size, src, &dstSizes, (void***)&dstArrays, sizeof(unsigned), MPI_COMM_WORLD );
-
-   /* Since all processors should now have the resulting dstArrays, all can do the test
-    *  concurrently */
-
-   for( ii = 0; ii < data->nProcs; ii++ ) {
-      pcu_check_true( dstSizes[ii] == size );
-   }
-
-   for( ii = 0; ii < data->nProcs; ii++ ) {
-      Index   jj;
-
-      if( !dstArrays[ii] ) break;
-      for( jj = 0; jj < size; jj++ ) {
-         if( dstArrays[ii][jj] != size * ii + jj ) break;
-      }
-      if( jj < size ) break;
-   }
-   pcu_check_true( ii == data->nProcs );
-
-   FreeArray( dstSizes );
-   FreeArray( dstArrays );
-
-   return;
-}
-
-
-/* MPI_AlltoAll is a tricky one - basically, it interleaves the original array on each processor
- * into a different destination array for each.
- * E.g. if Proc 0 has src [0A,0B] and Proc 1 has [1A,1B], then the result of an All to All would be:
- * Proc 0 having [0A,1A] and Proc 1 having [0B,1B]
- * So this test basically checks the above case works, except with multiples
- * of 100 for different source procs.
- */
-void MPIRoutinesSuite_TestAlltoall_1D( MPIRoutinesSuiteData* data ) {
-   unsigned*   srcSizes;
-   unsigned**  srcArrays;
-   unsigned*   dstSizes;
-   unsigned**  dstArrays;
-   int       procNum;
-   unsigned    procMulti = 100;
-
-   srcSizes = Memory_Alloc_Array_Unnamed( unsigned, data->nProcs );
-   srcArrays = Memory_Alloc_2DArray_Unnamed( unsigned, data->nProcs, 1 );
-
-   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
-      srcSizes[procNum] = 1;
-      srcArrays[procNum][0] = data->rank * procMulti + procNum;
-   }
-
-   MPIArray_Alltoall( srcSizes, (void**)srcArrays, &dstSizes, (void***)&dstArrays, sizeof(unsigned), MPI_COMM_WORLD );
-   FreeArray( srcSizes );
-   FreeArray( srcArrays );
-
-   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
-      pcu_check_true( dstSizes[procNum] == 1);
-      pcu_check_true( dstArrays[procNum][0] == data->rank + procMulti * procNum );
-   }
-
-   FreeArray( dstSizes );
-   FreeArray( dstArrays );
-
-   return;
-}
-
-
-/* Since this StG Alltoall wrapper is supposed to work on 2D arrays, need to test this.
- * Strategy is very similar to above test, except we also use multiples of 10 to handle extra
- * dimension */
-void MPIRoutinesSuite_TestAlltoall_2D( MPIRoutinesSuiteData* data ) {
-   unsigned*   srcSizes;
-   unsigned**  srcArrays;
-   unsigned*   dstSizes;
-   unsigned**  dstArrays;
-   int       procNum;
-   Index       ii;
-   unsigned    procMulti = 100;
-   Index       SecondDimSize=10;
-
-   srcSizes = Memory_Alloc_Array_Unnamed( unsigned, data->nProcs );
-   srcArrays = Memory_Alloc_2DArray_Unnamed( unsigned, data->nProcs, SecondDimSize );
-
-   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
-      srcSizes[procNum] = SecondDimSize;
-      for ( ii=0; ii<SecondDimSize; ii++ ) {
-         srcArrays[procNum][ii] = data->rank * procMulti + procNum * SecondDimSize + ii;
-      }
-   }
-
-   MPIArray_Alltoall( srcSizes, (void**)srcArrays, &dstSizes, (void***)&dstArrays, sizeof(unsigned), MPI_COMM_WORLD );
-   FreeArray( srcSizes );
-   FreeArray( srcArrays );
-
-   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
-      pcu_check_true( dstSizes[procNum] == SecondDimSize);
-      for ( ii=0; ii<SecondDimSize; ii++ ) {
-         pcu_check_true( dstArrays[procNum][ii] == data->rank * SecondDimSize + procNum * procMulti + ii );
-      }
-   }
-
-   FreeArray( dstSizes );
-   FreeArray( dstArrays );
-
-   return;
-}
-
-
-void MPIRoutinesSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MPIRoutinesSuiteData );
-   pcu_suite_setFixtures( suite, MPIRoutinesSuite_Setup, MPIRoutinesSuite_Teardown );
-   pcu_suite_addTest( suite, MPIRoutinesSuite_TestArrayConv );
-   pcu_suite_addTest( suite, MPIRoutinesSuite_TestBcast );
-   pcu_suite_addTest( suite, MPIRoutinesSuite_TestGather );
-   pcu_suite_addTest( suite, MPIRoutinesSuite_TestAllgather );
-   pcu_suite_addTest( suite, MPIRoutinesSuite_TestAlltoall_1D );
-   pcu_suite_addTest( suite, MPIRoutinesSuite_TestAlltoall_2D );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/MPIRoutinesSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/MPIRoutinesSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,303 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testMPIRoutines.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "MPIRoutinesSuite.h"
+
+typedef struct {
+   int rank;
+   int nProcs;
+} MPIRoutinesSuiteData;
+
+void MPIRoutinesSuite_Setup( MPIRoutinesSuiteData* data ) {
+   /* Assign the rank and nProcs */
+   /* We can be sure MPI_Init called already, immediately in testStGermain.c the test harness code */
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+   MPI_Comm_size( MPI_COMM_WORLD, &data->nProcs );
+}
+
+void MPIRoutinesSuite_Teardown( MPIRoutinesSuiteData* data ) {
+}
+
+
+void fillArray( unsigned* array, unsigned size, unsigned rank ) {
+ 
+   unsigned   i;
+
+   for( i = 0; i < size; i++ )
+      array[i] = rank * size + i;
+}
+
+
+void MPIRoutinesSuite_TestArrayConv( MPIRoutinesSuiteData* data ) {
+   unsigned   nBlocks = 3;
+   unsigned   sizes[3] = {2, 4, 1};
+   unsigned   src[7] = {0, 1, 2, 3, 4, 5, 6};
+   unsigned**   dst2D;
+   unsigned*   dst1D;
+   unsigned*   disps;
+
+   Array_1DTo2D( nBlocks, sizes, src, (void***)&dst2D, sizeof(unsigned) );
+   pcu_check_true( dst2D[0][0] == 0 && dst2D[0][1] == 1 && 
+       dst2D[1][0] == 2 && dst2D[1][1] == 3 && dst2D[1][2] == 4 && dst2D[1][3] == 5 && 
+       dst2D[2][0] == 6 );
+
+   Array_2DTo1D( nBlocks, sizes, (void**)dst2D, (void**)&dst1D, sizeof(unsigned), &disps );
+   pcu_check_true( dst1D[0] == 0 && dst1D[1] == 1 && dst1D[2] == 2 && dst1D[3] == 3 && 
+       dst1D[4] == 4 && dst1D[5] == 5 && dst1D[6] == 6 && 
+       disps[0] == 0 && disps[1] == 2 && disps[2] == 6 );
+
+   /* This time it tests the function can handle a 2D array with a zero-size column */
+   sizes[1] = 0;
+   Array_1DTo2D( nBlocks, sizes, src, (void***)&dst2D, sizeof(unsigned) );
+   pcu_check_true( dst2D[0][0] == 0 && dst2D[0][1] == 1 && 
+       dst2D[2][0] == 2 );
+
+   Array_2DTo1D( nBlocks, sizes, (void**)dst2D, (void**)&dst1D, sizeof(unsigned), &disps );
+   pcu_check_true( dst1D[0] == 0 && dst1D[1] == 1 && dst1D[2] == 2 && 
+       disps[0] == 0 && disps[1] == 2 && disps[2] == 2 );
+
+   FreeArray( dst2D );
+   FreeArray( dst1D );
+   FreeArray( disps );
+}
+
+
+void MPIRoutinesSuite_TestBcast( MPIRoutinesSuiteData* data ) {
+   unsigned    size = 200;
+   unsigned*   src = NULL;
+   Index       ii;
+
+   if( data->rank == 0 ) {
+      src = Memory_Alloc_Array_Unnamed( unsigned, size );
+      fillArray( src, size, data->rank );
+   }
+
+   MPIArray_Bcast( &size, (void**)&src, sizeof(unsigned), 
+         0, MPI_COMM_WORLD );
+
+   /* Make sure the contents of the broadcast array are the same as the fillArray function predicates */
+   for( ii = 0; ii < size; ii++ )
+      if( src[ii] != ii ) break;
+
+   pcu_check_true( ii == size );
+
+   FreeArray( src );
+   return;
+}
+
+
+void MPIRoutinesSuite_TestGather( MPIRoutinesSuiteData* data ) {
+   unsigned     size = 200;
+   unsigned     src[200];
+   unsigned*    dstSizes = NULL;
+   unsigned**   dstArrays = NULL;
+   int        ii;
+   int        watch;
+
+   fillArray( src, size, data->rank );
+
+   /* We should run the gather on each processor, to be thorough */
+   for ( watch = 0; watch < data->nProcs; watch++ ) {
+      MPIArray_Gather( size, src, &dstSizes, (void***)&dstArrays, sizeof(unsigned), watch, MPI_COMM_WORLD );
+
+      /* Only the gathering processor in each loop needs to check the dstArrays content.
+       * The others shouldn't receive anything in dstArrays */
+      if ( data->rank == watch ) {
+         for( ii = 0; ii < data->nProcs; ii++ ) {
+            pcu_check_true( dstSizes[ii] == size );
+         }
+
+         /* Check the contents of the arrays are correct. Note, I've kept Alan's approach
+          *  of breaking out of the loop when a problem's detected and pcu_asserting on
+          *  the result, to avoid potentially hundreds of pcu_assert prints if there's
+          *  a problem. Just one will suffice I think.
+          *  -- PatrickSunter, 1 April 2009.
+          */ 
+         for( ii = 0; ii < data->nProcs; ii++ ) {
+            unsigned   jj;
+
+            for( jj = 0; jj < size; jj++ )
+               if( dstArrays[ii][jj] != ii * size + jj ) break;
+            if( jj < size ) break;
+         }
+         pcu_check_true( ii == data->nProcs );
+
+         /* Free the dst arrays, so we can test they are autmatically re-created properly
+          * next loop */
+         FreeArray( dstSizes );
+         FreeArray( dstArrays );
+
+         dstSizes = NULL;
+         dstArrays = NULL;
+      }
+   }
+
+   /* Hmmm, shouldn't we test some variable size arrays as well?
+    * --PatrickSunter, 1 Apr 2009 */
+}
+
+
+void MPIRoutinesSuite_TestAllgather( MPIRoutinesSuiteData* data ) {
+   unsigned    size = 200;
+   unsigned    src[200];
+   unsigned*   dstSizes;
+   unsigned**  dstArrays;
+   int       ii;
+
+   fillArray( src, size, data->rank );
+
+   /* allgather runs just once, on all processors */
+   MPIArray_Allgather( size, src, &dstSizes, (void***)&dstArrays, sizeof(unsigned), MPI_COMM_WORLD );
+
+   /* Since all processors should now have the resulting dstArrays, all can do the test
+    *  concurrently */
+
+   for( ii = 0; ii < data->nProcs; ii++ ) {
+      pcu_check_true( dstSizes[ii] == size );
+   }
+
+   for( ii = 0; ii < data->nProcs; ii++ ) {
+      Index   jj;
+
+      if( !dstArrays[ii] ) break;
+      for( jj = 0; jj < size; jj++ ) {
+         if( dstArrays[ii][jj] != size * ii + jj ) break;
+      }
+      if( jj < size ) break;
+   }
+   pcu_check_true( ii == data->nProcs );
+
+   FreeArray( dstSizes );
+   FreeArray( dstArrays );
+
+   return;
+}
+
+
+/* MPI_AlltoAll is a tricky one - basically, it interleaves the original array on each processor
+ * into a different destination array for each.
+ * E.g. if Proc 0 has src [0A,0B] and Proc 1 has [1A,1B], then the result of an All to All would be:
+ * Proc 0 having [0A,1A] and Proc 1 having [0B,1B]
+ * So this test basically checks the above case works, except with multiples
+ * of 100 for different source procs.
+ */
+void MPIRoutinesSuite_TestAlltoall_1D( MPIRoutinesSuiteData* data ) {
+   unsigned*   srcSizes;
+   unsigned**  srcArrays;
+   unsigned*   dstSizes;
+   unsigned**  dstArrays;
+   int       procNum;
+   unsigned    procMulti = 100;
+
+   srcSizes = Memory_Alloc_Array_Unnamed( unsigned, data->nProcs );
+   srcArrays = Memory_Alloc_2DArray_Unnamed( unsigned, data->nProcs, 1 );
+
+   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
+      srcSizes[procNum] = 1;
+      srcArrays[procNum][0] = data->rank * procMulti + procNum;
+   }
+
+   MPIArray_Alltoall( srcSizes, (void**)srcArrays, &dstSizes, (void***)&dstArrays, sizeof(unsigned), MPI_COMM_WORLD );
+   FreeArray( srcSizes );
+   FreeArray( srcArrays );
+
+   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
+      pcu_check_true( dstSizes[procNum] == 1);
+      pcu_check_true( dstArrays[procNum][0] == data->rank + procMulti * procNum );
+   }
+
+   FreeArray( dstSizes );
+   FreeArray( dstArrays );
+
+   return;
+}
+
+
+/* Since this StG Alltoall wrapper is supposed to work on 2D arrays, need to test this.
+ * Strategy is very similar to above test, except we also use multiples of 10 to handle extra
+ * dimension */
+void MPIRoutinesSuite_TestAlltoall_2D( MPIRoutinesSuiteData* data ) {
+   unsigned*   srcSizes;
+   unsigned**  srcArrays;
+   unsigned*   dstSizes;
+   unsigned**  dstArrays;
+   int       procNum;
+   Index       ii;
+   unsigned    procMulti = 100;
+   Index       SecondDimSize=10;
+
+   srcSizes = Memory_Alloc_Array_Unnamed( unsigned, data->nProcs );
+   srcArrays = Memory_Alloc_2DArray_Unnamed( unsigned, data->nProcs, SecondDimSize );
+
+   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
+      srcSizes[procNum] = SecondDimSize;
+      for ( ii=0; ii<SecondDimSize; ii++ ) {
+         srcArrays[procNum][ii] = data->rank * procMulti + procNum * SecondDimSize + ii;
+      }
+   }
+
+   MPIArray_Alltoall( srcSizes, (void**)srcArrays, &dstSizes, (void***)&dstArrays, sizeof(unsigned), MPI_COMM_WORLD );
+   FreeArray( srcSizes );
+   FreeArray( srcArrays );
+
+   for( procNum = 0; procNum < data->nProcs; procNum++ ) {
+      pcu_check_true( dstSizes[procNum] == SecondDimSize);
+      for ( ii=0; ii<SecondDimSize; ii++ ) {
+         pcu_check_true( dstArrays[procNum][ii] == data->rank * SecondDimSize + procNum * procMulti + ii );
+      }
+   }
+
+   FreeArray( dstSizes );
+   FreeArray( dstArrays );
+
+   return;
+}
+
+
+void MPIRoutinesSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MPIRoutinesSuiteData );
+   pcu_suite_setFixtures( suite, MPIRoutinesSuite_Setup, MPIRoutinesSuite_Teardown );
+   pcu_suite_addTest( suite, MPIRoutinesSuite_TestArrayConv );
+   pcu_suite_addTest( suite, MPIRoutinesSuite_TestBcast );
+   pcu_suite_addTest( suite, MPIRoutinesSuite_TestGather );
+   pcu_suite_addTest( suite, MPIRoutinesSuite_TestAllgather );
+   pcu_suite_addTest( suite, MPIRoutinesSuite_TestAlltoall_1D );
+   pcu_suite_addTest( suite, MPIRoutinesSuite_TestAlltoall_2D );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/MaxHeapSuite.c
--- a/Base/Container/tests/MaxHeapSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testMaxHeap.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "MaxHeapSuite.h"
-
-typedef struct {
-   MaxHeap*       heap;
-   int*           dataArray;
-   int**          keys;
-} MaxHeapSuiteData;
-
-#define NUM_DATA 10
-#define NUM_INITIAL_DATA 5
-
-int compareFunction(void *data1, void *data2)
-{
-   int *d1 = NULL, *d2 = NULL;
-
-   d1 = (int*)data1;
-   d2 = (int*)data2;
-
-   if (d1 == NULL || d2 == NULL){
-      return 0;   
-   }
-   
-   if (*d1 > *d2){
-      return  1;
-   }
-   else if (*d1 == *d2){
-      return 0;
-   }
-   else{
-      return -1;
-   }
-}
-
-void** extendArray( int newCount, void ***array )
-{
-   assert( array );
-   /* TODO Check if this is executed by creating memory */
-   (*(int***)array) = (int**)Memory_Realloc_Array((*(int***)array), int**, newCount );
-   if( ((*(int***)array) == NULL) ){
-      Journal_Firewall( 0, Journal_Register( ErrorStream_Type, (Name)"testMaxHeap" ), "Memory allocation failed in '%s'!!\n Aborting..!!\n", __func__ );
-   
-   }
-   else{
-      return *array;
-   }
-
-   return NULL;
-}
-
-void keySwap( void **a, void **b )
-{
-   int *temp;
-
-   temp = (*((int**)a));
-
-   (*((int**)a)) = (*((int**)b));
-   (*((int**)b)) = temp;
-}
-
-
-void MaxHeapSuite_Setup( MaxHeapSuiteData* data ) {
-   Index    ii=0;
-
-   data->dataArray = Memory_Alloc_Array_Unnamed( int, NUM_DATA );
-   data->keys = Memory_Alloc_Array_Unnamed( int*, NUM_INITIAL_DATA );
-   
-   for(ii=0; ii<NUM_INITIAL_DATA; ii++){
-      data->keys[ii] = &(data->dataArray[ii]);
-   }
-   for(ii=0; ii<NUM_DATA; ii++){
-      data->dataArray[ii] = ii;
-   }
-   
-   data->heap = MaxHeap_New(
-            (void**)(data->keys), sizeof(int),
-            NUM_INITIAL_DATA,
-            keySwap,
-            compareFunction,
-            extendArray );
-}
-
-
-void MaxHeapSuite_Teardown( MaxHeapSuiteData* data ) {
-   Stg_Class_Delete( data->heap );
-   Memory_Free( data->dataArray );
-   /* Note: _Heap_Delete() (Heap.c:144) already frees the keys array. Not sure this is entirely logical - needs to
-    *  be well doco'd at least */
-   /*Memory_Free( data->keys );*/
-}
-
-
-void MaxHeapSuite_TestCreationExtraction( MaxHeapSuiteData* data ) {
-   Index    ii=0;
-
-   /* These initial totals due to set up above */
-   pcu_check_true( data->heap->numHeapElements == NUM_INITIAL_DATA );
-   pcu_check_true( data->heap->numArrayElements == NUM_INITIAL_DATA );
-
-   for( ii=0; ii<NUM_INITIAL_DATA; ii++ ){
-      /* Since we are always extracting the max, expect the order to be reversed */
-      pcu_check_true( *(int*)MaxHeap_Extract( data->heap ) == data->dataArray[(NUM_INITIAL_DATA-1)-ii] );
-   }
-
-   pcu_check_true( data->heap->numHeapElements == 0 );
-   pcu_check_true( data->heap->numArrayElements == NUM_INITIAL_DATA );
-}
-
-
-void MaxHeapSuite_TestInsertionExtraction( MaxHeapSuiteData* data ) {
-   Index    ii=0;
-
-   /*Inserting more entries into the Heap*/
-   for( ii=NUM_INITIAL_DATA; ii<NUM_DATA; ii++ ){
-      MaxHeap_Insert( data->heap, &(data->dataArray[ii]) );
-   }
-   
-   pcu_check_true( data->heap->numHeapElements == NUM_DATA );
-   pcu_check_true( data->heap->numArrayElements == NUM_DATA );
-
-   for( ii=0; ii<NUM_DATA; ii++ ){
-      /* Since we are always extracting the max, expect the order to be reversed */
-      pcu_check_true( *(int*)MaxHeap_Extract( data->heap ) == data->dataArray[(NUM_DATA-1)-ii] );
-   }
-
-   pcu_check_true( data->heap->numHeapElements == 0 );
-   pcu_check_true( data->heap->numArrayElements == NUM_DATA );
-}
-
-
-void MaxHeapSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MaxHeapSuiteData );
-   pcu_suite_setFixtures( suite, MaxHeapSuite_Setup, MaxHeapSuite_Teardown );
-   pcu_suite_addTest( suite, MaxHeapSuite_TestCreationExtraction );
-   pcu_suite_addTest( suite, MaxHeapSuite_TestInsertionExtraction );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/MaxHeapSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/MaxHeapSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,176 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testMaxHeap.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "MaxHeapSuite.h"
+
+typedef struct {
+   MaxHeap*       heap;
+   int*           dataArray;
+   int**          keys;
+} MaxHeapSuiteData;
+
+#define NUM_DATA 10
+#define NUM_INITIAL_DATA 5
+
+int compareFunction(void *data1, void *data2)
+{
+   int *d1 = NULL, *d2 = NULL;
+
+   d1 = (int*)data1;
+   d2 = (int*)data2;
+
+   if (d1 == NULL || d2 == NULL){
+      return 0;   
+   }
+   
+   if (*d1 > *d2){
+      return  1;
+   }
+   else if (*d1 == *d2){
+      return 0;
+   }
+   else{
+      return -1;
+   }
+}
+
+void** extendArray( int newCount, void ***array )
+{
+   assert( array );
+   /* TODO Check if this is executed by creating memory */
+   (*(int***)array) = (int**)Memory_Realloc_Array((*(int***)array), int**, newCount );
+   if( ((*(int***)array) == NULL) ){
+      Journal_Firewall( 0, Journal_Register( ErrorStream_Type, (Name)"testMaxHeap" ), "Memory allocation failed in '%s'!!\n Aborting..!!\n", __func__ );
+   
+   }
+   else{
+      return *array;
+   }
+
+   return NULL;
+}
+
+void keySwap( void **a, void **b )
+{
+   int *temp;
+
+   temp = (*((int**)a));
+
+   (*((int**)a)) = (*((int**)b));
+   (*((int**)b)) = temp;
+}
+
+
+void MaxHeapSuite_Setup( MaxHeapSuiteData* data ) {
+   Index    ii=0;
+
+   data->dataArray = Memory_Alloc_Array_Unnamed( int, NUM_DATA );
+   data->keys = Memory_Alloc_Array_Unnamed( int*, NUM_INITIAL_DATA );
+   
+   for(ii=0; ii<NUM_INITIAL_DATA; ii++){
+      data->keys[ii] = &(data->dataArray[ii]);
+   }
+   for(ii=0; ii<NUM_DATA; ii++){
+      data->dataArray[ii] = ii;
+   }
+   
+   data->heap = MaxHeap_New(
+            (void**)(data->keys), sizeof(int),
+            NUM_INITIAL_DATA,
+            keySwap,
+            compareFunction,
+            extendArray );
+}
+
+
+void MaxHeapSuite_Teardown( MaxHeapSuiteData* data ) {
+   Stg_Class_Delete( data->heap );
+   Memory_Free( data->dataArray );
+   /* Note: _Heap_Delete() (Heap.c:144) already frees the keys array. Not sure this is entirely logical - needs to
+    *  be well doco'd at least */
+   /*Memory_Free( data->keys );*/
+}
+
+
+void MaxHeapSuite_TestCreationExtraction( MaxHeapSuiteData* data ) {
+   Index    ii=0;
+
+   /* These initial totals due to set up above */
+   pcu_check_true( data->heap->numHeapElements == NUM_INITIAL_DATA );
+   pcu_check_true( data->heap->numArrayElements == NUM_INITIAL_DATA );
+
+   for( ii=0; ii<NUM_INITIAL_DATA; ii++ ){
+      /* Since we are always extracting the max, expect the order to be reversed */
+      pcu_check_true( *(int*)MaxHeap_Extract( data->heap ) == data->dataArray[(NUM_INITIAL_DATA-1)-ii] );
+   }
+
+   pcu_check_true( data->heap->numHeapElements == 0 );
+   pcu_check_true( data->heap->numArrayElements == NUM_INITIAL_DATA );
+}
+
+
+void MaxHeapSuite_TestInsertionExtraction( MaxHeapSuiteData* data ) {
+   Index    ii=0;
+
+   /*Inserting more entries into the Heap*/
+   for( ii=NUM_INITIAL_DATA; ii<NUM_DATA; ii++ ){
+      MaxHeap_Insert( data->heap, &(data->dataArray[ii]) );
+   }
+   
+   pcu_check_true( data->heap->numHeapElements == NUM_DATA );
+   pcu_check_true( data->heap->numArrayElements == NUM_DATA );
+
+   for( ii=0; ii<NUM_DATA; ii++ ){
+      /* Since we are always extracting the max, expect the order to be reversed */
+      pcu_check_true( *(int*)MaxHeap_Extract( data->heap ) == data->dataArray[(NUM_DATA-1)-ii] );
+   }
+
+   pcu_check_true( data->heap->numHeapElements == 0 );
+   pcu_check_true( data->heap->numArrayElements == NUM_DATA );
+}
+
+
+void MaxHeapSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MaxHeapSuiteData );
+   pcu_suite_setFixtures( suite, MaxHeapSuite_Setup, MaxHeapSuite_Teardown );
+   pcu_suite_addTest( suite, MaxHeapSuite_TestCreationExtraction );
+   pcu_suite_addTest( suite, MaxHeapSuite_TestInsertionExtraction );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/MemoryPoolSuite.c
--- a/Base/Container/tests/MemoryPoolSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testMemoryPool.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "MemoryPoolSuite.h"
-
-typedef struct Plane_t{
-	double normal[3];
-	double k;
-} Plane;
-
-#define CACHE_SIZE 200
-
-typedef struct {
-   MemoryPool*    pool;
-   Plane*         planeRefs[CACHE_SIZE*500];
-} MemoryPoolSuiteData;
-
-
-
-void MemoryPoolSuite_Setup( MemoryPoolSuiteData* data ) {
-   Index    ii=0;
-
-   data->pool = MemoryPool_New( Plane, CACHE_SIZE, CACHE_SIZE/2 );
-   for( ii=0; ii<CACHE_SIZE; ii++ ){
-      data->planeRefs[ii] = NULL;
-   }
-}
-
-
-void MemoryPoolSuite_Teardown( MemoryPoolSuiteData* data ) {
-   Stg_Class_Delete( data->pool );
-}
-
-
-void MemoryPoolSuite_TestAllocation( MemoryPoolSuiteData* data ) {
-   Plane*      p = NULL;
-   int         i = 0;
-   Bool        passed = False;
-   int         objCounter = 0;
-
-   passed = True;
-   /* Testing memory allocation from the Memory Pool..  */
-   for( i=0; i<CACHE_SIZE; i++ ){
-      p = NULL;
-      p = MemoryPool_NewObject( Plane, data->pool );
-      if( !p ){
-         passed = False;
-         break;
-      }
-      else{
-         objCounter++;
-         data->planeRefs[i] = p;
-         pcu_check_true( data->pool->numElementsFree == CACHE_SIZE-(i+1) );
-      }
-   }
-   pcu_check_true( passed );
-
-   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
-   pcu_check_true( data->pool->numElements == CACHE_SIZE );
-   pcu_check_true( data->pool->numElementsFree == 0 );
-   pcu_check_true( data->pool->numMemChunks == 1 );
-
-}
-   
-
-void MemoryPoolSuite_TestOverAllocation( MemoryPoolSuiteData* data ) {
-   Plane*      p = NULL;
-   int         i = 0;
-   Bool        passed = False;
-   int         objCounter = 0;
-
-   passed = True;
-   for( i=0; i<CACHE_SIZE*100; i++ ){
-      p = MemoryPool_NewObject( Plane, data->pool );
-      data->planeRefs[objCounter++] = p;
-      if( !p ){
-         passed = False;
-         break;
-      }
-   }
-   pcu_check_true( passed );
-   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
-   pcu_check_true( data->pool->numElements == CACHE_SIZE*100 );
-   pcu_check_true( data->pool->numElementsFree == 0 );
-   pcu_check_true( data->pool->numMemChunks == CACHE_SIZE*100/(CACHE_SIZE/2)-1 );
-}
-
-
-void MemoryPoolSuite_TestDeallocation( MemoryPoolSuiteData* data ) {
-   Plane*      p = NULL;
-   int         i = 0;
-   Bool        passed = False;
-   int         objCounter = 0;
-
-   passed = True;
-
-   for( i=0; i<CACHE_SIZE; i++ ){
-      p = NULL;
-      p = MemoryPool_NewObject( Plane, data->pool );
-      objCounter++;
-      data->planeRefs[i] = p;
-   }
-
-   for( i=0; i<CACHE_SIZE; i++ ){
-      if(False == MemoryPool_DeleteObject( data->pool, data->planeRefs[i] )){
-         passed = False;
-         break;
-      }
-   }
-   pcu_check_true( passed );
-
-   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
-   pcu_check_true( data->pool->numElements == 0 );
-   pcu_check_true( data->pool->numElementsFree == 0 );
-   pcu_check_true( data->pool->numMemChunks == 0 );
-}
-   
-
-void MemoryPoolSuite_TestIllegalDeallocation( MemoryPoolSuiteData* data ) {
-   Plane*      p = NULL;
-   int         i = 0;
-   Bool        passed = False;
-   int         objCounter = 0;
-   int*        junkRefs[CACHE_SIZE];
-   int         testData[CACHE_SIZE];
-
-   for( i=0; i<CACHE_SIZE; i++ ){
-      p = NULL;
-      p = MemoryPool_NewObject( Plane, data->pool );
-      objCounter++;
-      data->planeRefs[i] = p;
-   }
-
-   passed = True;
-   for( i=0; i<CACHE_SIZE; i++ ){
-      junkRefs[i] = &testData[i];
-   }
-
-   for( i=0; i<CACHE_SIZE/4; i++ ){
-      junkRefs[i] = (int*)(junkRefs+i+1);
-      pcu_check_true(False == MemoryPool_DeleteObject( data->pool, junkRefs[i] ));
-   }
-
-   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
-   pcu_check_true( data->pool->numElements == CACHE_SIZE );
-   pcu_check_true( data->pool->numElementsFree == 0 );
-   pcu_check_true( data->pool->numMemChunks == 1 );
-}
-
-
-void MemoryPoolSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MemoryPoolSuiteData );
-   pcu_suite_setFixtures( suite, MemoryPoolSuite_Setup, MemoryPoolSuite_Teardown );
-   pcu_suite_addTest( suite, MemoryPoolSuite_TestAllocation );
-   pcu_suite_addTest( suite, MemoryPoolSuite_TestOverAllocation );
-   pcu_suite_addTest( suite, MemoryPoolSuite_TestDeallocation );
-   pcu_suite_addTest( suite, MemoryPoolSuite_TestIllegalDeallocation );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/MemoryPoolSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/MemoryPoolSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,195 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testMemoryPool.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "MemoryPoolSuite.h"
+
+typedef struct Plane_t{
+	double normal[3];
+	double k;
+} Plane;
+
+#define CACHE_SIZE 200
+
+typedef struct {
+   MemoryPool*    pool;
+   Plane*         planeRefs[CACHE_SIZE*500];
+} MemoryPoolSuiteData;
+
+
+
+void MemoryPoolSuite_Setup( MemoryPoolSuiteData* data ) {
+   Index    ii=0;
+
+   data->pool = MemoryPool_New( Plane, CACHE_SIZE, CACHE_SIZE/2 );
+   for( ii=0; ii<CACHE_SIZE; ii++ ){
+      data->planeRefs[ii] = NULL;
+   }
+}
+
+
+void MemoryPoolSuite_Teardown( MemoryPoolSuiteData* data ) {
+   Stg_Class_Delete( data->pool );
+}
+
+
+void MemoryPoolSuite_TestAllocation( MemoryPoolSuiteData* data ) {
+   Plane*      p = NULL;
+   int         i = 0;
+   Bool        passed = False;
+   int         objCounter = 0;
+
+   passed = True;
+   /* Testing memory allocation from the Memory Pool..  */
+   for( i=0; i<CACHE_SIZE; i++ ){
+      p = NULL;
+      p = MemoryPool_NewObject( Plane, data->pool );
+      if( !p ){
+         passed = False;
+         break;
+      }
+      else{
+         objCounter++;
+         data->planeRefs[i] = p;
+         pcu_check_true( data->pool->numElementsFree == CACHE_SIZE-(i+1) );
+      }
+   }
+   pcu_check_true( passed );
+
+   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
+   pcu_check_true( data->pool->numElements == CACHE_SIZE );
+   pcu_check_true( data->pool->numElementsFree == 0 );
+   pcu_check_true( data->pool->numMemChunks == 1 );
+
+}
+   
+
+void MemoryPoolSuite_TestOverAllocation( MemoryPoolSuiteData* data ) {
+   Plane*      p = NULL;
+   int         i = 0;
+   Bool        passed = False;
+   int         objCounter = 0;
+
+   passed = True;
+   for( i=0; i<CACHE_SIZE*100; i++ ){
+      p = MemoryPool_NewObject( Plane, data->pool );
+      data->planeRefs[objCounter++] = p;
+      if( !p ){
+         passed = False;
+         break;
+      }
+   }
+   pcu_check_true( passed );
+   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
+   pcu_check_true( data->pool->numElements == CACHE_SIZE*100 );
+   pcu_check_true( data->pool->numElementsFree == 0 );
+   pcu_check_true( data->pool->numMemChunks == CACHE_SIZE*100/(CACHE_SIZE/2)-1 );
+}
+
+
+void MemoryPoolSuite_TestDeallocation( MemoryPoolSuiteData* data ) {
+   Plane*      p = NULL;
+   int         i = 0;
+   Bool        passed = False;
+   int         objCounter = 0;
+
+   passed = True;
+
+   for( i=0; i<CACHE_SIZE; i++ ){
+      p = NULL;
+      p = MemoryPool_NewObject( Plane, data->pool );
+      objCounter++;
+      data->planeRefs[i] = p;
+   }
+
+   for( i=0; i<CACHE_SIZE; i++ ){
+      if(False == MemoryPool_DeleteObject( data->pool, data->planeRefs[i] )){
+         passed = False;
+         break;
+      }
+   }
+   pcu_check_true( passed );
+
+   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
+   pcu_check_true( data->pool->numElements == 0 );
+   pcu_check_true( data->pool->numElementsFree == 0 );
+   pcu_check_true( data->pool->numMemChunks == 0 );
+}
+   
+
+void MemoryPoolSuite_TestIllegalDeallocation( MemoryPoolSuiteData* data ) {
+   Plane*      p = NULL;
+   int         i = 0;
+   Bool        passed = False;
+   int         objCounter = 0;
+   int*        junkRefs[CACHE_SIZE];
+   int         testData[CACHE_SIZE];
+
+   for( i=0; i<CACHE_SIZE; i++ ){
+      p = NULL;
+      p = MemoryPool_NewObject( Plane, data->pool );
+      objCounter++;
+      data->planeRefs[i] = p;
+   }
+
+   passed = True;
+   for( i=0; i<CACHE_SIZE; i++ ){
+      junkRefs[i] = &testData[i];
+   }
+
+   for( i=0; i<CACHE_SIZE/4; i++ ){
+      junkRefs[i] = (int*)(junkRefs+i+1);
+      pcu_check_true(False == MemoryPool_DeleteObject( data->pool, junkRefs[i] ));
+   }
+
+   pcu_check_true( data->pool->numInitialElements == CACHE_SIZE );
+   pcu_check_true( data->pool->numElements == CACHE_SIZE );
+   pcu_check_true( data->pool->numElementsFree == 0 );
+   pcu_check_true( data->pool->numMemChunks == 1 );
+}
+
+
+void MemoryPoolSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MemoryPoolSuiteData );
+   pcu_suite_setFixtures( suite, MemoryPoolSuite_Setup, MemoryPoolSuite_Teardown );
+   pcu_suite_addTest( suite, MemoryPoolSuite_TestAllocation );
+   pcu_suite_addTest( suite, MemoryPoolSuite_TestOverAllocation );
+   pcu_suite_addTest( suite, MemoryPoolSuite_TestDeallocation );
+   pcu_suite_addTest( suite, MemoryPoolSuite_TestIllegalDeallocation );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/PtrMapSuite.c
--- a/Base/Container/tests/PtrMapSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testPtrMap.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "PtrMapSuite.h"
-
-typedef struct {
-   PtrMap*    map;
-} PtrMapSuiteData;
-
-
-void PtrMapSuite_Setup( PtrMapSuiteData* data ) {
-   data->map = PtrMap_New( 10 );
-}
-
-
-void PtrMapSuite_Teardown( PtrMapSuiteData* data ) {
-   Stg_Class_Delete( data->map );
-}
-
-
-void PtrMapSuite_TestAppendFind( PtrMapSuiteData* data ) {
-   ArithPointer		idx;
-   
-   for( idx = 0; idx < 100; idx++ ) {
-      PtrMap_Append( data->map, (void*)(idx + 1), (void*)(100 - idx) );
-   }
-   
-   for( idx = 0; idx < 100; idx++ ) {
-      pcu_check_true( (ArithPointer)PtrMap_Find( data->map, (void*)(idx + 1) )
-         == (100 - idx) );
-   }
-}
-
-
-void PtrMapSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, PtrMapSuiteData );
-   pcu_suite_setFixtures( suite, PtrMapSuite_Setup, PtrMapSuite_Teardown );
-   pcu_suite_addTest( suite, PtrMapSuite_TestAppendFind );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/PtrMapSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/PtrMapSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,76 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testPtrMap.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "PtrMapSuite.h"
+
+typedef struct {
+   PtrMap*    map;
+} PtrMapSuiteData;
+
+
+void PtrMapSuite_Setup( PtrMapSuiteData* data ) {
+   data->map = PtrMap_New( 10 );
+}
+
+
+void PtrMapSuite_Teardown( PtrMapSuiteData* data ) {
+   Stg_Class_Delete( data->map );
+}
+
+
+void PtrMapSuite_TestAppendFind( PtrMapSuiteData* data ) {
+   ArithPointer		idx;
+   
+   for( idx = 0; idx < 100; idx++ ) {
+      PtrMap_Append( data->map, (void*)(idx + 1), (void*)(100 - idx) );
+   }
+   
+   for( idx = 0; idx < 100; idx++ ) {
+      pcu_check_true( (ArithPointer)PtrMap_Find( data->map, (void*)(idx + 1) )
+         == (100 - idx) );
+   }
+}
+
+
+void PtrMapSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, PtrMapSuiteData );
+   pcu_suite_setFixtures( suite, PtrMapSuite_Setup, PtrMapSuite_Teardown );
+   pcu_suite_addTest( suite, PtrMapSuite_TestAppendFind );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/PtrSetSuite.c
--- a/Base/Container/tests/PtrSetSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testSet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "PtrSetSuite.h"
-
-#define NUM_ITEMS 100
-
-typedef struct {
-   PtrSet*     setA;
-   PtrSet*     setB;
-   unsigned    dataArray[NUM_ITEMS];
-   Bool        inSet[NUM_ITEMS];
-} PtrSetSuiteData;
-
-
-void PtrSetSuite_Setup( PtrSetSuiteData* data ) {
-   Index         idx;
-
-   data->setA = PtrSet_New( NULL );
-   data->setB = PtrSet_New( NULL );
-
-   for( idx=0; idx < NUM_ITEMS; idx++ ) {
-      data->inSet[idx] = False;
-      /* We deliberately want the actual _numbers_ to be random, as the ptrset should do all its
-       * comparisons based on ptr values, not the numbers themselves */
-      data->dataArray[idx] = (unsigned)rand();
-   }
-}
-
-
-void PtrSetSuite_Teardown( PtrSetSuiteData* data ) {
-   Stg_Class_Delete( data->setA );
-   Stg_Class_Delete( data->setB );
-}
-
-
-static void markArray( void* setItem, void* args ) {
-   PtrSetSuiteData*  data = (PtrSetSuiteData*)args;
-   unsigned int      ptrIndex = 0;
-
-   assert( data );
-
-   ptrIndex = ((ArithPointer)setItem - (ArithPointer)data->dataArray) / sizeof(unsigned);
-   data->inSet[ptrIndex] = True;
-}
-
-
-void PtrSetSuite_TestInsertTraverse( PtrSetSuiteData* data ) {
-   unsigned    ptr_I;
-
-   for( ptr_I = 0; ptr_I < NUM_ITEMS; ptr_I++ ) {
-      Set_Insert( data->setA, &data->dataArray[ptr_I] );
-   }
-
-   Set_Traverse( data->setA, markArray, data );
-   for( ptr_I = 0; ptr_I < NUM_ITEMS; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == True );
-   }
-}
-
-
-void PtrSetSuite_TestUnion( PtrSetSuiteData* data ) {
-   Set*        setC=NULL;
-   unsigned    ptr_I;
-
-   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
-      Set_Insert( data->setA, &data->dataArray[ptr_I] );
-   }
-   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
-      Set_Insert( data->setB, &data->dataArray[ptr_I] );
-   }
-
-   setC = (Set*)Set_Union( data->setA, data->setB );
-   Set_Traverse( setC, markArray, data );
-   
-   for( ptr_I = 0; ptr_I < NUM_ITEMS*1/4; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == False );
-   }
-   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == True );
-   }
-   for( ptr_I = NUM_ITEMS*3/4; ptr_I < NUM_ITEMS; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == False );
-   }
-}
-
-
-void PtrSetSuite_TestIntersection( PtrSetSuiteData* data ) {
-   Set*        setC=NULL;
-   unsigned    ptr_I;
-
-   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
-      Set_Insert( data->setA, &data->dataArray[ptr_I] );
-   }
-   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
-      Set_Insert( data->setB, &data->dataArray[ptr_I] );
-   }
-
-   setC = (Set*)Set_Intersection( data->setA, data->setB );
-   Set_Traverse( setC, markArray, data );
-   
-   for( ptr_I = 0; ptr_I < NUM_ITEMS*3/8; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == False );
-   }
-   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == True );
-   }
-   for( ptr_I = NUM_ITEMS*5/8; ptr_I < NUM_ITEMS; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == False );
-   }
-}
-
-
-void PtrSetSuite_TestSubtraction( PtrSetSuiteData* data ) {
-   Set*        setC=NULL;
-   unsigned    ptr_I;
-
-   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
-      Set_Insert( data->setA, &data->dataArray[ptr_I] );
-   }
-   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
-      Set_Insert( data->setB, &data->dataArray[ptr_I] );
-   }
-
-   setC = (Set*)Set_Subtraction( data->setA, data->setB );
-   Set_Traverse( setC, markArray, data );
-   
-   for( ptr_I = 0; ptr_I < NUM_ITEMS*1/4; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == False );
-   }
-   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*3/8; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == True );
-   }
-   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS; ptr_I++ ) {
-      pcu_check_true( data->inSet[ptr_I] == False );
-   }
-}
-
-
-void PtrSetSuite_TestPerformance( PtrSetSuiteData* data ) {
-   unsigned    ptr_I;
-   double      startTime=0;
-   double      stopTime=0;
-   double      timeSpent=0;
-
-   /* Raq: I expect the set to be able to insert 100,000 items in the worst case
-      scenario in a reasonable amount of time. */
-   startTime = MPI_Wtime();
-   for( ptr_I = 0; ptr_I < 100000; ptr_I++ ) {
-      Set_Insert( data->setA, &data->dataArray[ptr_I] );
-   }
-   stopTime = MPI_Wtime();
-   timeSpent = stopTime - startTime;
-
-   /* 5 seconds is arbitrary, take into account slower systems */
-   pcu_check_true( timeSpent < 5.0 );
-}
-
-
-void PtrSetSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, PtrSetSuiteData );
-   pcu_suite_setFixtures( suite, PtrSetSuite_Setup, PtrSetSuite_Teardown );
-   pcu_suite_addTest( suite, PtrSetSuite_TestInsertTraverse );
-   pcu_suite_addTest( suite, PtrSetSuite_TestUnion );
-   pcu_suite_addTest( suite, PtrSetSuite_TestIntersection );
-   pcu_suite_addTest( suite, PtrSetSuite_TestSubtraction );
-   pcu_suite_addTest( suite, PtrSetSuite_TestPerformance );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/PtrSetSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/PtrSetSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,206 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testSet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "PtrSetSuite.h"
+
+#define NUM_ITEMS 100
+
+typedef struct {
+   PtrSet*     setA;
+   PtrSet*     setB;
+   unsigned    dataArray[NUM_ITEMS];
+   Bool        inSet[NUM_ITEMS];
+} PtrSetSuiteData;
+
+
+void PtrSetSuite_Setup( PtrSetSuiteData* data ) {
+   Index         idx;
+
+   data->setA = PtrSet_New( NULL );
+   data->setB = PtrSet_New( NULL );
+
+   for( idx=0; idx < NUM_ITEMS; idx++ ) {
+      data->inSet[idx] = False;
+      /* We deliberately want the actual _numbers_ to be random, as the ptrset should do all its
+       * comparisons based on ptr values, not the numbers themselves */
+      data->dataArray[idx] = (unsigned)rand();
+   }
+}
+
+
+void PtrSetSuite_Teardown( PtrSetSuiteData* data ) {
+   Stg_Class_Delete( data->setA );
+   Stg_Class_Delete( data->setB );
+}
+
+
+static void markArray( void* setItem, void* args ) {
+   PtrSetSuiteData*  data = (PtrSetSuiteData*)args;
+   unsigned int      ptrIndex = 0;
+
+   assert( data );
+
+   ptrIndex = ((ArithPointer)setItem - (ArithPointer)data->dataArray) / sizeof(unsigned);
+   data->inSet[ptrIndex] = True;
+}
+
+
+void PtrSetSuite_TestInsertTraverse( PtrSetSuiteData* data ) {
+   unsigned    ptr_I;
+
+   for( ptr_I = 0; ptr_I < NUM_ITEMS; ptr_I++ ) {
+      Set_Insert( data->setA, &data->dataArray[ptr_I] );
+   }
+
+   Set_Traverse( data->setA, markArray, data );
+   for( ptr_I = 0; ptr_I < NUM_ITEMS; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == True );
+   }
+}
+
+
+void PtrSetSuite_TestUnion( PtrSetSuiteData* data ) {
+   Set*        setC=NULL;
+   unsigned    ptr_I;
+
+   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
+      Set_Insert( data->setA, &data->dataArray[ptr_I] );
+   }
+   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
+      Set_Insert( data->setB, &data->dataArray[ptr_I] );
+   }
+
+   setC = (Set*)Set_Union( data->setA, data->setB );
+   Set_Traverse( setC, markArray, data );
+   
+   for( ptr_I = 0; ptr_I < NUM_ITEMS*1/4; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == False );
+   }
+   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == True );
+   }
+   for( ptr_I = NUM_ITEMS*3/4; ptr_I < NUM_ITEMS; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == False );
+   }
+}
+
+
+void PtrSetSuite_TestIntersection( PtrSetSuiteData* data ) {
+   Set*        setC=NULL;
+   unsigned    ptr_I;
+
+   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
+      Set_Insert( data->setA, &data->dataArray[ptr_I] );
+   }
+   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
+      Set_Insert( data->setB, &data->dataArray[ptr_I] );
+   }
+
+   setC = (Set*)Set_Intersection( data->setA, data->setB );
+   Set_Traverse( setC, markArray, data );
+   
+   for( ptr_I = 0; ptr_I < NUM_ITEMS*3/8; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == False );
+   }
+   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == True );
+   }
+   for( ptr_I = NUM_ITEMS*5/8; ptr_I < NUM_ITEMS; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == False );
+   }
+}
+
+
+void PtrSetSuite_TestSubtraction( PtrSetSuiteData* data ) {
+   Set*        setC=NULL;
+   unsigned    ptr_I;
+
+   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*5/8; ptr_I++ ) {
+      Set_Insert( data->setA, &data->dataArray[ptr_I] );
+   }
+   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS*3/4; ptr_I++ ) {
+      Set_Insert( data->setB, &data->dataArray[ptr_I] );
+   }
+
+   setC = (Set*)Set_Subtraction( data->setA, data->setB );
+   Set_Traverse( setC, markArray, data );
+   
+   for( ptr_I = 0; ptr_I < NUM_ITEMS*1/4; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == False );
+   }
+   for( ptr_I = NUM_ITEMS*1/4; ptr_I < NUM_ITEMS*3/8; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == True );
+   }
+   for( ptr_I = NUM_ITEMS*3/8; ptr_I < NUM_ITEMS; ptr_I++ ) {
+      pcu_check_true( data->inSet[ptr_I] == False );
+   }
+}
+
+
+void PtrSetSuite_TestPerformance( PtrSetSuiteData* data ) {
+   unsigned    ptr_I;
+   double      startTime=0;
+   double      stopTime=0;
+   double      timeSpent=0;
+
+   /* Raq: I expect the set to be able to insert 100,000 items in the worst case
+      scenario in a reasonable amount of time. */
+   startTime = MPI_Wtime();
+   for( ptr_I = 0; ptr_I < 100000; ptr_I++ ) {
+      Set_Insert( data->setA, &data->dataArray[ptr_I] );
+   }
+   stopTime = MPI_Wtime();
+   timeSpent = stopTime - startTime;
+
+   /* 5 seconds is arbitrary, take into account slower systems */
+   pcu_check_true( timeSpent < 5.0 );
+}
+
+
+void PtrSetSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, PtrSetSuiteData );
+   pcu_suite_setFixtures( suite, PtrSetSuite_Setup, PtrSetSuite_Teardown );
+   pcu_suite_addTest( suite, PtrSetSuite_TestInsertTraverse );
+   pcu_suite_addTest( suite, PtrSetSuite_TestUnion );
+   pcu_suite_addTest( suite, PtrSetSuite_TestIntersection );
+   pcu_suite_addTest( suite, PtrSetSuite_TestSubtraction );
+   pcu_suite_addTest( suite, PtrSetSuite_TestPerformance );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/RangeSetSuite.c
--- a/Base/Container/tests/RangeSetSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,266 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testRangeSet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "RangeSetSuite.h"
-
-#define NUM_ITEMS 100
-
-typedef struct {
-   RangeSet*    set0;
-   RangeSet*    set1;
-} RangeSetSuiteData;
-
-
-void RangeSetSuite_Setup( RangeSetSuiteData* data ) {
-   //Index         idx;
-
-   data->set0 = RangeSet_New();
-   data->set1 = RangeSet_New();
-}
-
-
-void RangeSetSuite_Teardown( RangeSetSuiteData* data ) {
-   FreeObject( data->set0 );
-   FreeObject( data->set1 );
-}
-
-
-void RangeSetSuite_TestIndices( RangeSetSuiteData* data ) {
-   unsigned   nInds = NUM_ITEMS;
-   unsigned   inds[NUM_ITEMS];
-   unsigned   nDstInds, *dstInds;
-   unsigned   i;
-   unsigned   ind_i;
-
-   for( i = 0; i < nInds; i++ ) {
-      inds[i] = i;
-   }
-
-   RangeSet_SetIndices( data->set0, nInds, inds );
-   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds );
-   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == 1 );
-
-   dstInds = NULL;
-   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
-
-   pcu_check_true( nDstInds == nInds );
-
-   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
-      pcu_check_true( dstInds[ind_i] == inds[ind_i] );
-   }
-   FreeArray( dstInds );
-}
-
-
-void RangeSetSuite_TestRanges( RangeSetSuiteData* data ) {
-   unsigned          nInds = NUM_ITEMS;
-   unsigned          inds[NUM_ITEMS];
-   unsigned          nDstInds, *dstInds;
-   unsigned          i;
-   RangeSet_Range*   rng;
-   unsigned          ind_i;
-
-   for( i = 0; i < nInds; i++ )
-      inds[i] = (i/10)*10 + i;
-
-   RangeSet_SetIndices( data->set0, nInds, inds );
-
-   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds );
-   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds/10 );
-
-   for( i = 0; i < nInds; i++ ) {
-
-      rng = RangeSet_GetRange( data->set0, i / 10 );
-      pcu_check_true( rng->begin == (i/10)*20 ); 
-      pcu_check_true( rng->end == (i/10)*20 + 10 );
-      pcu_check_true( rng->step == 1 );
-   }
-
-   dstInds = NULL;
-   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
-   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
-      pcu_check_true( dstInds[ind_i] == inds[ind_i] );
-   }
-   FreeArray( dstInds );
-}
-
-
-void RangeSetSuite_TestUnion( RangeSetSuiteData* data ) {
-   unsigned   nInds = NUM_ITEMS;
-   unsigned   inds0[NUM_ITEMS];
-   unsigned   inds1[NUM_ITEMS];
-   unsigned   nDstInds, *dstInds;
-   unsigned   i;
-   unsigned   ind_i;
-
-   for( i = 0; i < nInds; i++ )
-      inds0[i] = (i/10)*10 + i;
-   RangeSet_SetIndices( data->set0, nInds, inds0 );
-
-   for( i = 0; i < nInds; i++ )
-      inds1[i] = (i/10)*10 + NUM_ITEMS + i;
-   RangeSet_SetIndices( data->set1, nInds, inds1 );
-
-   RangeSet_Union( data->set0, data->set1 );
-   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds + nInds / 2 ); 
-   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds / 10 + nInds / 20 );
-
-   dstInds = NULL;
-   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
-   /* During the union, the 2nd half of the second set of indices should have been added on */
-   for( ind_i = 0; ind_i < nInds; ind_i++ ) {
-      pcu_check_true( dstInds[ind_i] == inds0[ind_i] );
-   }
-   for( ind_i = 0; ind_i < nInds/2; ind_i++ ) {
-      pcu_check_true( dstInds[nInds+ind_i] == inds1[nInds/2+ind_i] );
-   }
-   FreeArray( dstInds );
-}
-
-
-void RangeSetSuite_TestIntersection( RangeSetSuiteData* data ) {
-   unsigned   nInds = NUM_ITEMS;
-   unsigned   inds0[NUM_ITEMS];
-   unsigned   inds1[NUM_ITEMS];
-   unsigned   nDstInds, *dstInds;
-   unsigned   i;
-   unsigned   ind_i;
-
-   for( i = 0; i < nInds; i++ )
-      inds0[i] = (i/10)*10 + i;
-   RangeSet_SetIndices( data->set0, nInds, inds0 );
-
-   for( i = 0; i < nInds; i++ )
-      inds1[i] = (i/10)*10 + NUM_ITEMS + i;
-   RangeSet_SetIndices( data->set1, nInds, inds1 );
-
-   RangeSet_Intersection( data->set0, data->set1 );
-   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds / 2 ); 
-   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds / 20 );
-
-   dstInds = NULL;
-   /* During the union, the 2nd half of the first set (first half of second set) of indices should
-    * be the result */
-   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
-   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
-      pcu_check_true( dstInds[ind_i] == inds0[nInds/2+ind_i] );
-   }
-   FreeArray( dstInds );
-}
-
-
-void RangeSetSuite_TestSubtraction( RangeSetSuiteData* data ) {
-   unsigned   nInds = NUM_ITEMS;
-   unsigned   inds0[NUM_ITEMS];
-   unsigned   inds1[NUM_ITEMS];
-   unsigned   nDstInds, *dstInds;
-   unsigned   i;
-   unsigned   ind_i;
-
-   for( i = 0; i < nInds; i++ )
-      inds0[i] = (i/10)*10 + i;
-   RangeSet_SetIndices( data->set0, nInds, inds0 );
-
-   for( i = 0; i < nInds; i++ )
-      inds1[i] = (i/10)*10 + NUM_ITEMS + i;
-   RangeSet_SetIndices( data->set1, nInds, inds1 );
-
-   RangeSet_Subtraction( data->set0, data->set1 );
-   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds / 2 ); 
-   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds / 20 );
-
-   dstInds = NULL;
-   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
-   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
-      pcu_check_true( dstInds[ind_i] == inds0[ind_i] );
-   }
-   FreeArray( dstInds );
-}
-
-
-void RangeSetSuite_TestPickle( RangeSetSuiteData* data ) {
-   unsigned   nInds = NUM_ITEMS;
-   unsigned   inds[NUM_ITEMS];
-   unsigned   nBytes;
-   Stg_Byte*  bytes;
-   unsigned   nDstInds, *dstInds;
-   unsigned   i;
-   unsigned   ind_i;
-
-   for( i = 0; i < nInds; i++ )
-      inds[i] = (i/10)*10 + i;
-   RangeSet_SetIndices( data->set0, nInds, inds );
-
-   RangeSet_Pickle( data->set0, &nBytes, &bytes );
-   RangeSet_Clear( data->set0 );
-   RangeSet_Unpickle( data->set0, nBytes, bytes );
-
-   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds ); 
-   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds/10 );
-
-   for( i = 0; i < nInds; i++ ) {
-      RangeSet_Range*   rng;
-
-      rng = RangeSet_GetRange( data->set0, i / 10 );
-      pcu_check_true( rng->begin == (i/10)*20 ); 
-      pcu_check_true( rng->end == (i/10)*20 + 10 ); 
-      pcu_check_true( rng->step == 1 );
-   }
-
-   dstInds = NULL;
-   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
-   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
-      pcu_check_true( dstInds[ind_i] == inds[ind_i] );
-   }
-   FreeArray( dstInds );
-}
-
-
-void RangeSetSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, RangeSetSuiteData );
-   pcu_suite_setFixtures( suite, RangeSetSuite_Setup, RangeSetSuite_Teardown );
-   pcu_suite_addTest( suite, RangeSetSuite_TestIndices );
-   pcu_suite_addTest( suite, RangeSetSuite_TestRanges );
-   pcu_suite_addTest( suite, RangeSetSuite_TestUnion );
-   pcu_suite_addTest( suite, RangeSetSuite_TestIntersection );
-   pcu_suite_addTest( suite, RangeSetSuite_TestSubtraction );
-   pcu_suite_addTest( suite, RangeSetSuite_TestPickle );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/RangeSetSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/RangeSetSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,266 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testRangeSet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "RangeSetSuite.h"
+
+#define NUM_ITEMS 100
+
+typedef struct {
+   RangeSet*    set0;
+   RangeSet*    set1;
+} RangeSetSuiteData;
+
+
+void RangeSetSuite_Setup( RangeSetSuiteData* data ) {
+   //Index         idx;
+
+   data->set0 = RangeSet_New();
+   data->set1 = RangeSet_New();
+}
+
+
+void RangeSetSuite_Teardown( RangeSetSuiteData* data ) {
+   FreeObject( data->set0 );
+   FreeObject( data->set1 );
+}
+
+
+void RangeSetSuite_TestIndices( RangeSetSuiteData* data ) {
+   unsigned   nInds = NUM_ITEMS;
+   unsigned   inds[NUM_ITEMS];
+   unsigned   nDstInds, *dstInds;
+   unsigned   i;
+   unsigned   ind_i;
+
+   for( i = 0; i < nInds; i++ ) {
+      inds[i] = i;
+   }
+
+   RangeSet_SetIndices( data->set0, nInds, inds );
+   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds );
+   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == 1 );
+
+   dstInds = NULL;
+   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
+
+   pcu_check_true( nDstInds == nInds );
+
+   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
+      pcu_check_true( dstInds[ind_i] == inds[ind_i] );
+   }
+   FreeArray( dstInds );
+}
+
+
+void RangeSetSuite_TestRanges( RangeSetSuiteData* data ) {
+   unsigned          nInds = NUM_ITEMS;
+   unsigned          inds[NUM_ITEMS];
+   unsigned          nDstInds, *dstInds;
+   unsigned          i;
+   RangeSet_Range*   rng;
+   unsigned          ind_i;
+
+   for( i = 0; i < nInds; i++ )
+      inds[i] = (i/10)*10 + i;
+
+   RangeSet_SetIndices( data->set0, nInds, inds );
+
+   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds );
+   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds/10 );
+
+   for( i = 0; i < nInds; i++ ) {
+
+      rng = RangeSet_GetRange( data->set0, i / 10 );
+      pcu_check_true( rng->begin == (i/10)*20 ); 
+      pcu_check_true( rng->end == (i/10)*20 + 10 );
+      pcu_check_true( rng->step == 1 );
+   }
+
+   dstInds = NULL;
+   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
+   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
+      pcu_check_true( dstInds[ind_i] == inds[ind_i] );
+   }
+   FreeArray( dstInds );
+}
+
+
+void RangeSetSuite_TestUnion( RangeSetSuiteData* data ) {
+   unsigned   nInds = NUM_ITEMS;
+   unsigned   inds0[NUM_ITEMS];
+   unsigned   inds1[NUM_ITEMS];
+   unsigned   nDstInds, *dstInds;
+   unsigned   i;
+   unsigned   ind_i;
+
+   for( i = 0; i < nInds; i++ )
+      inds0[i] = (i/10)*10 + i;
+   RangeSet_SetIndices( data->set0, nInds, inds0 );
+
+   for( i = 0; i < nInds; i++ )
+      inds1[i] = (i/10)*10 + NUM_ITEMS + i;
+   RangeSet_SetIndices( data->set1, nInds, inds1 );
+
+   RangeSet_Union( data->set0, data->set1 );
+   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds + nInds / 2 ); 
+   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds / 10 + nInds / 20 );
+
+   dstInds = NULL;
+   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
+   /* During the union, the 2nd half of the second set of indices should have been added on */
+   for( ind_i = 0; ind_i < nInds; ind_i++ ) {
+      pcu_check_true( dstInds[ind_i] == inds0[ind_i] );
+   }
+   for( ind_i = 0; ind_i < nInds/2; ind_i++ ) {
+      pcu_check_true( dstInds[nInds+ind_i] == inds1[nInds/2+ind_i] );
+   }
+   FreeArray( dstInds );
+}
+
+
+void RangeSetSuite_TestIntersection( RangeSetSuiteData* data ) {
+   unsigned   nInds = NUM_ITEMS;
+   unsigned   inds0[NUM_ITEMS];
+   unsigned   inds1[NUM_ITEMS];
+   unsigned   nDstInds, *dstInds;
+   unsigned   i;
+   unsigned   ind_i;
+
+   for( i = 0; i < nInds; i++ )
+      inds0[i] = (i/10)*10 + i;
+   RangeSet_SetIndices( data->set0, nInds, inds0 );
+
+   for( i = 0; i < nInds; i++ )
+      inds1[i] = (i/10)*10 + NUM_ITEMS + i;
+   RangeSet_SetIndices( data->set1, nInds, inds1 );
+
+   RangeSet_Intersection( data->set0, data->set1 );
+   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds / 2 ); 
+   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds / 20 );
+
+   dstInds = NULL;
+   /* During the union, the 2nd half of the first set (first half of second set) of indices should
+    * be the result */
+   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
+   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
+      pcu_check_true( dstInds[ind_i] == inds0[nInds/2+ind_i] );
+   }
+   FreeArray( dstInds );
+}
+
+
+void RangeSetSuite_TestSubtraction( RangeSetSuiteData* data ) {
+   unsigned   nInds = NUM_ITEMS;
+   unsigned   inds0[NUM_ITEMS];
+   unsigned   inds1[NUM_ITEMS];
+   unsigned   nDstInds, *dstInds;
+   unsigned   i;
+   unsigned   ind_i;
+
+   for( i = 0; i < nInds; i++ )
+      inds0[i] = (i/10)*10 + i;
+   RangeSet_SetIndices( data->set0, nInds, inds0 );
+
+   for( i = 0; i < nInds; i++ )
+      inds1[i] = (i/10)*10 + NUM_ITEMS + i;
+   RangeSet_SetIndices( data->set1, nInds, inds1 );
+
+   RangeSet_Subtraction( data->set0, data->set1 );
+   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds / 2 ); 
+   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds / 20 );
+
+   dstInds = NULL;
+   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
+   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
+      pcu_check_true( dstInds[ind_i] == inds0[ind_i] );
+   }
+   FreeArray( dstInds );
+}
+
+
+void RangeSetSuite_TestPickle( RangeSetSuiteData* data ) {
+   unsigned   nInds = NUM_ITEMS;
+   unsigned   inds[NUM_ITEMS];
+   unsigned   nBytes;
+   Stg_Byte*  bytes;
+   unsigned   nDstInds, *dstInds;
+   unsigned   i;
+   unsigned   ind_i;
+
+   for( i = 0; i < nInds; i++ )
+      inds[i] = (i/10)*10 + i;
+   RangeSet_SetIndices( data->set0, nInds, inds );
+
+   RangeSet_Pickle( data->set0, &nBytes, &bytes );
+   RangeSet_Clear( data->set0 );
+   RangeSet_Unpickle( data->set0, nBytes, bytes );
+
+   pcu_check_true( RangeSet_GetSize( data->set0 ) == nInds ); 
+   pcu_check_true( RangeSet_GetNumRanges( data->set0 ) == nInds/10 );
+
+   for( i = 0; i < nInds; i++ ) {
+      RangeSet_Range*   rng;
+
+      rng = RangeSet_GetRange( data->set0, i / 10 );
+      pcu_check_true( rng->begin == (i/10)*20 ); 
+      pcu_check_true( rng->end == (i/10)*20 + 10 ); 
+      pcu_check_true( rng->step == 1 );
+   }
+
+   dstInds = NULL;
+   RangeSet_GetIndices( data->set0, &nDstInds, &dstInds );
+   for( ind_i = 0; ind_i < nDstInds; ind_i++ ) {
+      pcu_check_true( dstInds[ind_i] == inds[ind_i] );
+   }
+   FreeArray( dstInds );
+}
+
+
+void RangeSetSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, RangeSetSuiteData );
+   pcu_suite_setFixtures( suite, RangeSetSuite_Setup, RangeSetSuite_Teardown );
+   pcu_suite_addTest( suite, RangeSetSuite_TestIndices );
+   pcu_suite_addTest( suite, RangeSetSuite_TestRanges );
+   pcu_suite_addTest( suite, RangeSetSuite_TestUnion );
+   pcu_suite_addTest( suite, RangeSetSuite_TestIntersection );
+   pcu_suite_addTest( suite, RangeSetSuite_TestSubtraction );
+   pcu_suite_addTest( suite, RangeSetSuite_TestPickle );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/STreeMapSuite.c
--- a/Base/Container/tests/STreeMapSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testSTree.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "STreeMapSuite.h"
-
-typedef struct {
-   STreeMap*      sTreeMap;
-} STreeMapSuiteData;
-
-
-void STreeMapSuite_Setup( STreeMapSuiteData* data ) {
-   data->sTreeMap = STreeMap_New();
-   STreeMap_SetItemSize( data->sTreeMap, sizeof(int), sizeof(int) );
-   STree_SetIntCallbacks( data->sTreeMap );
-}
-
-
-void STreeMapSuite_Teardown( STreeMapSuiteData* data ) {
-   NewClass_Delete( data->sTreeMap );
-}
-
-
-void STreeMapSuite_TestConstruct( STreeMapSuiteData* data ) {
-   pcu_check_true( data->sTreeMap );
-}
-
-
-void STreeMapSuite_TestInsert( STreeMapSuiteData* data ) {
-   int c_i;
-
-   for ( c_i = 0; c_i < 10; c_i++ ) {
-      int tmp = 10 * c_i;
-      STreeMap_Insert( data->sTreeMap, &c_i, &tmp );
-   }
-   pcu_check_true( STree_GetSize( data->sTreeMap ) == 10 );
-
-}
-
-
-void STreeMapSuite_TestMap( STreeMapSuiteData* data ) {
-   int c_i;
-
-   for ( c_i = 0; c_i < 10; c_i++ ) {
-      int tmp = 10 * c_i;
-      STreeMap_Insert( data->sTreeMap, &c_i, &tmp );
-   }
-   for( c_i = 0; c_i < 10; c_i++ ) {
-      pcu_check_true( *((int*)STreeMap_Map( data->sTreeMap, &c_i )) == 10 * c_i );
-   }
-
-}
-
-
-void STreeMapSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, STreeMapSuiteData );
-   pcu_suite_setFixtures( suite, STreeMapSuite_Setup, STreeMapSuite_Teardown );
-   pcu_suite_addTest( suite, STreeMapSuite_TestConstruct );
-   pcu_suite_addTest( suite, STreeMapSuite_TestInsert );
-   pcu_suite_addTest( suite, STreeMapSuite_TestMap );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/STreeMapSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/STreeMapSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,97 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testSTree.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "STreeMapSuite.h"
+
+typedef struct {
+   STreeMap*      sTreeMap;
+} STreeMapSuiteData;
+
+
+void STreeMapSuite_Setup( STreeMapSuiteData* data ) {
+   data->sTreeMap = STreeMap_New();
+   STreeMap_SetItemSize( data->sTreeMap, sizeof(int), sizeof(int) );
+   STree_SetIntCallbacks( data->sTreeMap );
+}
+
+
+void STreeMapSuite_Teardown( STreeMapSuiteData* data ) {
+   NewClass_Delete( data->sTreeMap );
+}
+
+
+void STreeMapSuite_TestConstruct( STreeMapSuiteData* data ) {
+   pcu_check_true( data->sTreeMap );
+}
+
+
+void STreeMapSuite_TestInsert( STreeMapSuiteData* data ) {
+   int c_i;
+
+   for ( c_i = 0; c_i < 10; c_i++ ) {
+      int tmp = 10 * c_i;
+      STreeMap_Insert( data->sTreeMap, &c_i, &tmp );
+   }
+   pcu_check_true( STree_GetSize( data->sTreeMap ) == 10 );
+
+}
+
+
+void STreeMapSuite_TestMap( STreeMapSuiteData* data ) {
+   int c_i;
+
+   for ( c_i = 0; c_i < 10; c_i++ ) {
+      int tmp = 10 * c_i;
+      STreeMap_Insert( data->sTreeMap, &c_i, &tmp );
+   }
+   for( c_i = 0; c_i < 10; c_i++ ) {
+      pcu_check_true( *((int*)STreeMap_Map( data->sTreeMap, &c_i )) == 10 * c_i );
+   }
+
+}
+
+
+void STreeMapSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, STreeMapSuiteData );
+   pcu_suite_setFixtures( suite, STreeMapSuite_Setup, STreeMapSuite_Teardown );
+   pcu_suite_addTest( suite, STreeMapSuite_TestConstruct );
+   pcu_suite_addTest( suite, STreeMapSuite_TestInsert );
+   pcu_suite_addTest( suite, STreeMapSuite_TestMap );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/STreeSuite.c
--- a/Base/Container/tests/STreeSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testSTree.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "STreeSuite.h"
-
-typedef struct {
-   STree*    sTree;
-} STreeSuiteData;
-
-
-void calcDepth( const STreeNode* node, int* curDepth, int* depth ) {
-   if( !node )
-      return;
-   if( ++(*curDepth) > *depth )
-      *depth = *curDepth;
-   if( node->left )
-      calcDepth( node->left, curDepth, depth );
-   if( node->right )
-      calcDepth( node->right, curDepth, depth );
-   (*curDepth)--;
-}
-
-
-void STreeSuite_Setup( STreeSuiteData* data ) {
-   data->sTree = STree_New();
-   STree_SetItemSize( data->sTree, sizeof(int) );
-   STree_SetIntCallbacks( data->sTree );
-   STree_SetAlpha( data->sTree, 0.5 );
-}
-
-
-void STreeSuite_Teardown( STreeSuiteData* data ) {
-   NewClass_Delete( data->sTree );
-}
-
-
-void STreeSuite_TestConstruct( STreeSuiteData* data ) {
-  pcu_check_true( STree_GetSize( data->sTree ) == 0 );
-}
-
-
-void STreeSuite_TestInsert( STreeSuiteData* data ) {
-   int depth = 0, curDepth = 0;
-   int i_i;
-
-   for( i_i = 0; i_i < 15; i_i++ )
-      STree_Insert( data->sTree, &i_i );
-   pcu_check_true( STree_GetSize( data->sTree ) == 15 );
-   pcu_check_true( (calcDepth( STree_GetRoot( data->sTree ), &curDepth, &depth), depth) == 4 );
-}
-
-
-void STreeSuite_TestRemove( STreeSuiteData* data ) {
-   int depth = 0, curDepth = 0;
-   int i_i;
-
-   for( i_i = 0; i_i < 30; i_i++ )
-      STree_Insert( data->sTree, &i_i );
-   for( i_i = 0; i_i < 30; i_i += 2 )
-      STree_Remove( data->sTree, &i_i );
-   pcu_check_true( STree_GetSize( data->sTree ) == 15 );
-   pcu_check_true( (calcDepth( STree_GetRoot( data->sTree ), &curDepth, &depth), depth) == 4 );
-}
-
-
-void STreeSuite_TestHas( STreeSuiteData* data ) {
-   int i_i;
-
-   for( i_i = 0; i_i < 15; i_i++ )
-      STree_Insert( data->sTree, &i_i );
-   for( i_i = 0; i_i < 15; i_i++ ) {
-      pcu_check_true( STree_Has( data->sTree, &i_i ) );
-   }
-   for( i_i = 15; i_i < 30; i_i++ ) {
-      pcu_check_true( !STree_Has( data->sTree, &i_i ) );
-   }
-}
-
-
-void STreeSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, STreeSuiteData );
-   pcu_suite_setFixtures( suite, STreeSuite_Setup, STreeSuite_Teardown );
-   pcu_suite_addTest( suite, STreeSuite_TestConstruct );
-   pcu_suite_addTest( suite, STreeSuite_TestInsert );
-   pcu_suite_addTest( suite, STreeSuite_TestRemove );
-   pcu_suite_addTest( suite, STreeSuite_TestHas );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/STreeSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/STreeSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,124 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testSTree.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "STreeSuite.h"
+
+typedef struct {
+   STree*    sTree;
+} STreeSuiteData;
+
+
+void calcDepth( const STreeNode* node, int* curDepth, int* depth ) {
+   if( !node )
+      return;
+   if( ++(*curDepth) > *depth )
+      *depth = *curDepth;
+   if( node->left )
+      calcDepth( node->left, curDepth, depth );
+   if( node->right )
+      calcDepth( node->right, curDepth, depth );
+   (*curDepth)--;
+}
+
+
+void STreeSuite_Setup( STreeSuiteData* data ) {
+   data->sTree = STree_New();
+   STree_SetItemSize( data->sTree, sizeof(int) );
+   STree_SetIntCallbacks( data->sTree );
+   STree_SetAlpha( data->sTree, 0.5 );
+}
+
+
+void STreeSuite_Teardown( STreeSuiteData* data ) {
+   NewClass_Delete( data->sTree );
+}
+
+
+void STreeSuite_TestConstruct( STreeSuiteData* data ) {
+  pcu_check_true( STree_GetSize( data->sTree ) == 0 );
+}
+
+
+void STreeSuite_TestInsert( STreeSuiteData* data ) {
+   int depth = 0, curDepth = 0;
+   int i_i;
+
+   for( i_i = 0; i_i < 15; i_i++ )
+      STree_Insert( data->sTree, &i_i );
+   pcu_check_true( STree_GetSize( data->sTree ) == 15 );
+   pcu_check_true( (calcDepth( STree_GetRoot( data->sTree ), &curDepth, &depth), depth) == 4 );
+}
+
+
+void STreeSuite_TestRemove( STreeSuiteData* data ) {
+   int depth = 0, curDepth = 0;
+   int i_i;
+
+   for( i_i = 0; i_i < 30; i_i++ )
+      STree_Insert( data->sTree, &i_i );
+   for( i_i = 0; i_i < 30; i_i += 2 )
+      STree_Remove( data->sTree, &i_i );
+   pcu_check_true( STree_GetSize( data->sTree ) == 15 );
+   pcu_check_true( (calcDepth( STree_GetRoot( data->sTree ), &curDepth, &depth), depth) == 4 );
+}
+
+
+void STreeSuite_TestHas( STreeSuiteData* data ) {
+   int i_i;
+
+   for( i_i = 0; i_i < 15; i_i++ )
+      STree_Insert( data->sTree, &i_i );
+   for( i_i = 0; i_i < 15; i_i++ ) {
+      pcu_check_true( STree_Has( data->sTree, &i_i ) );
+   }
+   for( i_i = 15; i_i < 30; i_i++ ) {
+      pcu_check_true( !STree_Has( data->sTree, &i_i ) );
+   }
+}
+
+
+void STreeSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, STreeSuiteData );
+   pcu_suite_setFixtures( suite, STreeSuite_Setup, STreeSuite_Teardown );
+   pcu_suite_addTest( suite, STreeSuite_TestConstruct );
+   pcu_suite_addTest( suite, STreeSuite_TestInsert );
+   pcu_suite_addTest( suite, STreeSuite_TestRemove );
+   pcu_suite_addTest( suite, STreeSuite_TestHas );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/SetSuite.c
--- a/Base/Container/tests/SetSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testSet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "SetSuite.h"
-
-#define NUM_ITEMS 100
-
-typedef struct {
-   Set*    setA;
-   Set*    setB;
-   Bool    inSet[NUM_ITEMS];
-} SetSuiteData;
-
-
-static int compareFunc( void* left, void* right ) {
-   if( *(int*)left < *(int*)right ) {
-      return -1;
-   }
-   else if( *(int*)left > *(int*)right ) {
-      return 1;
-   }
-   else {
-      return 0;
-   }
-}
-
-
-static void copyFunc( void** newData, void* data, SizeT size ) {
-   *newData = Memory_Alloc_Bytes_Unnamed( size, "char" );
-   assert( *newData );
-
-   *(int*)(*newData) = *(int*)data;
-}
-
-
-static void deleteFunc( void* data ) {
-   assert( data );
-   Memory_Free( data );
-}
-
-
-void SetSuite_Setup( SetSuiteData* data ) {
-   Index         idx;
-
-   data->setA = Set_New( NULL, int, compareFunc, copyFunc, deleteFunc );
-   data->setB = Set_New( NULL, int, compareFunc, copyFunc, deleteFunc );
-
-   for( idx=0; idx < NUM_ITEMS; idx++ ) {
-      data->inSet[idx] = False;
-   }
-}
-
-
-void SetSuite_Teardown( SetSuiteData* data ) {
-   Stg_Class_Delete( data->setA );
-   Stg_Class_Delete( data->setB );
-}
-
-
-static void markArray( void* setItem, void* args ) {
-   SetSuiteData*  data = (SetSuiteData*)args;
-   assert( data );
-
-   data->inSet[*(int*)setItem] = True;
-}
-
-
-void SetSuite_TestInsertTraverse( SetSuiteData* data ) {
-   unsigned   int_I;
-
-   pcu_docstring( "This test inserts a set of ints into a Set, then tests that a simple function "
-      "when passed to Set_Traverse() is executed properly." );
-
-   for( int_I = 0; int_I < NUM_ITEMS; int_I++ ) {
-      Set_Insert( data->setA, &int_I );
-   }
-
-   Set_Traverse( data->setA, markArray, data );
-   for( int_I = 0; int_I < NUM_ITEMS; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == True );
-   }
-}
-
-
-void SetSuite_TestUnion( SetSuiteData* data ) {
-   Set*        setC=NULL;
-   unsigned    int_I;
-
-   pcu_docstring( "Checks that the Union of two overlapping sets results in a new set that "
-      "contains correct Union of set elements." );
-
-   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*5/8; int_I++ ) {
-      Set_Insert( data->setA, &int_I );
-   }
-   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*3/4; int_I++ ) {
-      Set_Insert( data->setB, &int_I );
-   }
-
-   setC = (Set*)Set_Union( data->setA, data->setB );
-   Set_Traverse( setC, markArray, data );
-   
-   for( int_I = 0; int_I < NUM_ITEMS*1/4; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == False );
-   }
-   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*3/4; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == True );
-   }
-   for( int_I = NUM_ITEMS*3/4; int_I < NUM_ITEMS; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == False );
-   }
-}
-
-
-void SetSuite_TestIntersection( SetSuiteData* data ) {
-   Set*        setC=NULL;
-   unsigned    int_I;
-
-   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*5/8; int_I++ ) {
-      Set_Insert( data->setA, &int_I );
-   }
-   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*3/4; int_I++ ) {
-      Set_Insert( data->setB, &int_I );
-   }
-
-   setC = (Set*)Set_Intersection( data->setA, data->setB );
-   Set_Traverse( setC, markArray, data );
-   
-   for( int_I = 0; int_I < NUM_ITEMS*3/8; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == False );
-   }
-   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*5/8; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == True );
-   }
-   for( int_I = NUM_ITEMS*5/8; int_I < NUM_ITEMS; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == False );
-   }
-}
-
-
-void SetSuite_TestSubtraction( SetSuiteData* data ) {
-   Set*        setC=NULL;
-   unsigned    int_I;
-
-   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*5/8; int_I++ ) {
-      Set_Insert( data->setA, &int_I );
-   }
-   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*3/4; int_I++ ) {
-      Set_Insert( data->setB, &int_I );
-   }
-
-   setC = (Set*)Set_Subtraction( data->setA, data->setB );
-   Set_Traverse( setC, markArray, data );
-   
-   for( int_I = 0; int_I < NUM_ITEMS*1/4; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == False );
-   }
-   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*3/8; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == True );
-   }
-   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS; int_I++ ) {
-      pcu_check_true( data->inSet[int_I] == False );
-   }
-}
-
-
-void SetSuite_TestPerformance( SetSuiteData* data ) {
-   unsigned    int_I;
-   double      startTime=0;
-   double      stopTime=0;
-   double      timeSpent=0;
-
-   /* Raq: I expect the set to be able to insert 100,000 items in the worst case
-      scenario in a reasonable amount of time. */
-   startTime = MPI_Wtime();
-   for( int_I = 0; int_I < 100000; int_I++ ) {
-      Set_Insert( data->setA, &int_I );
-   }
-   stopTime = MPI_Wtime();
-   timeSpent = stopTime - startTime;
-
-   /* 5 seconds is arbitrary, take into account slower systems */
-   pcu_check_true( timeSpent < 5.0 );
-}
-
-
-void SetSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, SetSuiteData );
-   pcu_suite_setFixtures( suite, SetSuite_Setup, SetSuite_Teardown );
-   pcu_suite_addTest( suite, SetSuite_TestInsertTraverse );
-   pcu_suite_addTest( suite, SetSuite_TestUnion );
-   pcu_suite_addTest( suite, SetSuite_TestIntersection );
-   pcu_suite_addTest( suite, SetSuite_TestSubtraction );
-   pcu_suite_addTest( suite, SetSuite_TestPerformance );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/SetSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/SetSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,232 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testSet.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "SetSuite.h"
+
+#define NUM_ITEMS 100
+
+typedef struct {
+   Set*    setA;
+   Set*    setB;
+   Bool    inSet[NUM_ITEMS];
+} SetSuiteData;
+
+
+static int compareFunc( void* left, void* right ) {
+   if( *(int*)left < *(int*)right ) {
+      return -1;
+   }
+   else if( *(int*)left > *(int*)right ) {
+      return 1;
+   }
+   else {
+      return 0;
+   }
+}
+
+
+static void copyFunc( void** newData, void* data, SizeT size ) {
+   *newData = Memory_Alloc_Bytes_Unnamed( size, "char" );
+   assert( *newData );
+
+   *(int*)(*newData) = *(int*)data;
+}
+
+
+static void deleteFunc( void* data ) {
+   assert( data );
+   Memory_Free( data );
+}
+
+
+void SetSuite_Setup( SetSuiteData* data ) {
+   Index         idx;
+
+   data->setA = Set_New( NULL, int, compareFunc, copyFunc, deleteFunc );
+   data->setB = Set_New( NULL, int, compareFunc, copyFunc, deleteFunc );
+
+   for( idx=0; idx < NUM_ITEMS; idx++ ) {
+      data->inSet[idx] = False;
+   }
+}
+
+
+void SetSuite_Teardown( SetSuiteData* data ) {
+   Stg_Class_Delete( data->setA );
+   Stg_Class_Delete( data->setB );
+}
+
+
+static void markArray( void* setItem, void* args ) {
+   SetSuiteData*  data = (SetSuiteData*)args;
+   assert( data );
+
+   data->inSet[*(int*)setItem] = True;
+}
+
+
+void SetSuite_TestInsertTraverse( SetSuiteData* data ) {
+   unsigned   int_I;
+
+   pcu_docstring( "This test inserts a set of ints into a Set, then tests that a simple function "
+      "when passed to Set_Traverse() is executed properly." );
+
+   for( int_I = 0; int_I < NUM_ITEMS; int_I++ ) {
+      Set_Insert( data->setA, &int_I );
+   }
+
+   Set_Traverse( data->setA, markArray, data );
+   for( int_I = 0; int_I < NUM_ITEMS; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == True );
+   }
+}
+
+
+void SetSuite_TestUnion( SetSuiteData* data ) {
+   Set*        setC=NULL;
+   unsigned    int_I;
+
+   pcu_docstring( "Checks that the Union of two overlapping sets results in a new set that "
+      "contains correct Union of set elements." );
+
+   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*5/8; int_I++ ) {
+      Set_Insert( data->setA, &int_I );
+   }
+   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*3/4; int_I++ ) {
+      Set_Insert( data->setB, &int_I );
+   }
+
+   setC = (Set*)Set_Union( data->setA, data->setB );
+   Set_Traverse( setC, markArray, data );
+   
+   for( int_I = 0; int_I < NUM_ITEMS*1/4; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == False );
+   }
+   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*3/4; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == True );
+   }
+   for( int_I = NUM_ITEMS*3/4; int_I < NUM_ITEMS; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == False );
+   }
+}
+
+
+void SetSuite_TestIntersection( SetSuiteData* data ) {
+   Set*        setC=NULL;
+   unsigned    int_I;
+
+   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*5/8; int_I++ ) {
+      Set_Insert( data->setA, &int_I );
+   }
+   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*3/4; int_I++ ) {
+      Set_Insert( data->setB, &int_I );
+   }
+
+   setC = (Set*)Set_Intersection( data->setA, data->setB );
+   Set_Traverse( setC, markArray, data );
+   
+   for( int_I = 0; int_I < NUM_ITEMS*3/8; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == False );
+   }
+   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*5/8; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == True );
+   }
+   for( int_I = NUM_ITEMS*5/8; int_I < NUM_ITEMS; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == False );
+   }
+}
+
+
+void SetSuite_TestSubtraction( SetSuiteData* data ) {
+   Set*        setC=NULL;
+   unsigned    int_I;
+
+   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*5/8; int_I++ ) {
+      Set_Insert( data->setA, &int_I );
+   }
+   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS*3/4; int_I++ ) {
+      Set_Insert( data->setB, &int_I );
+   }
+
+   setC = (Set*)Set_Subtraction( data->setA, data->setB );
+   Set_Traverse( setC, markArray, data );
+   
+   for( int_I = 0; int_I < NUM_ITEMS*1/4; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == False );
+   }
+   for( int_I = NUM_ITEMS*1/4; int_I < NUM_ITEMS*3/8; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == True );
+   }
+   for( int_I = NUM_ITEMS*3/8; int_I < NUM_ITEMS; int_I++ ) {
+      pcu_check_true( data->inSet[int_I] == False );
+   }
+}
+
+
+void SetSuite_TestPerformance( SetSuiteData* data ) {
+   unsigned    int_I;
+   double      startTime=0;
+   double      stopTime=0;
+   double      timeSpent=0;
+
+   /* Raq: I expect the set to be able to insert 100,000 items in the worst case
+      scenario in a reasonable amount of time. */
+   startTime = MPI_Wtime();
+   for( int_I = 0; int_I < 100000; int_I++ ) {
+      Set_Insert( data->setA, &int_I );
+   }
+   stopTime = MPI_Wtime();
+   timeSpent = stopTime - startTime;
+
+   /* 5 seconds is arbitrary, take into account slower systems */
+   pcu_check_true( timeSpent < 5.0 );
+}
+
+
+void SetSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, SetSuiteData );
+   pcu_suite_setFixtures( suite, SetSuite_Setup, SetSuite_Teardown );
+   pcu_suite_addTest( suite, SetSuite_TestInsertTraverse );
+   pcu_suite_addTest( suite, SetSuite_TestUnion );
+   pcu_suite_addTest( suite, SetSuite_TestIntersection );
+   pcu_suite_addTest( suite, SetSuite_TestSubtraction );
+   pcu_suite_addTest( suite, SetSuite_TestPerformance );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/UIntMapSuite.c
--- a/Base/Container/tests/UIntMapSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testUIntMap.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "UIntMapSuite.h"
-
-typedef struct {
-   UIntMap*    map;
-   unsigned	   size;
-} UIntMapSuiteData;
-
-
-void UIntMapSuite_Setup( UIntMapSuiteData* data ) {
-   data->map = UIntMap_New();
-   data->size = 5;
-}
-
-
-void UIntMapSuite_Teardown( UIntMapSuiteData* data ) {
-   FreeObject( data->map );
-}
-
-
-void UIntMapSuite_FillMap( UIntMapSuiteData* data ) {
-	unsigned	i;
-
-	for( i = 0; i < data->size; i++ ) {
-		UIntMap_Insert( data->map, i, data->size + i );
-   }
-}
-
-
-void UIntMapSuite_TestInsert( UIntMapSuiteData* data ) {
-   UIntMapSuite_FillMap( data );
-   pcu_check_true( data->map->size == data->size );
-}
-
-
-void UIntMapSuite_TestMap( UIntMapSuiteData* data ) {
-   unsigned	val;
-   unsigned	i;
-
-   UIntMapSuite_FillMap( data );
-
-   for( i = 0; i < data->size; i++ ) {
-      pcu_check_true( UIntMap_Map( data->map, i, &val ) );
-      pcu_check_true( val == data->size + i );
-   }
-}
-
-
-void UIntMapSuite_TestMemoryMap( UIntMapSuiteData* data ) {
-   unsigned	nReps = 10;
-   unsigned	val;
-   unsigned	r_i;
-
-   for( r_i = 0; r_i < nReps; r_i++ ) {
-      unsigned	i;
-
-      UIntMapSuite_FillMap( data );
-      for( i = 0; i < data->size; i++ ) {
-         pcu_check_true( UIntMap_Map( data->map, i, &val ) );
-         pcu_check_true( val == data->size + i );
-      }
-      FreeObject( data->map );
-      data->map = UIntMap_New();
-   }
-}
-
-
-void UIntMapSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, UIntMapSuiteData );
-   pcu_suite_setFixtures( suite, UIntMapSuite_Setup, UIntMapSuite_Teardown );
-   pcu_suite_addTest( suite, UIntMapSuite_TestInsert );
-   pcu_suite_addTest( suite, UIntMapSuite_TestMap );
-   pcu_suite_addTest( suite, UIntMapSuite_TestMemoryMap );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Container/tests/UIntMapSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Container/tests/UIntMapSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,113 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testUIntMap.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "UIntMapSuite.h"
+
+typedef struct {
+   UIntMap*    map;
+   unsigned	   size;
+} UIntMapSuiteData;
+
+
+void UIntMapSuite_Setup( UIntMapSuiteData* data ) {
+   data->map = UIntMap_New();
+   data->size = 5;
+}
+
+
+void UIntMapSuite_Teardown( UIntMapSuiteData* data ) {
+   FreeObject( data->map );
+}
+
+
+void UIntMapSuite_FillMap( UIntMapSuiteData* data ) {
+	unsigned	i;
+
+	for( i = 0; i < data->size; i++ ) {
+		UIntMap_Insert( data->map, i, data->size + i );
+   }
+}
+
+
+void UIntMapSuite_TestInsert( UIntMapSuiteData* data ) {
+   UIntMapSuite_FillMap( data );
+   pcu_check_true( data->map->size == data->size );
+}
+
+
+void UIntMapSuite_TestMap( UIntMapSuiteData* data ) {
+   unsigned	val;
+   unsigned	i;
+
+   UIntMapSuite_FillMap( data );
+
+   for( i = 0; i < data->size; i++ ) {
+      pcu_check_true( UIntMap_Map( data->map, i, &val ) );
+      pcu_check_true( val == data->size + i );
+   }
+}
+
+
+void UIntMapSuite_TestMemoryMap( UIntMapSuiteData* data ) {
+   unsigned	nReps = 10;
+   unsigned	val;
+   unsigned	r_i;
+
+   for( r_i = 0; r_i < nReps; r_i++ ) {
+      unsigned	i;
+
+      UIntMapSuite_FillMap( data );
+      for( i = 0; i < data->size; i++ ) {
+         pcu_check_true( UIntMap_Map( data->map, i, &val ) );
+         pcu_check_true( val == data->size + i );
+      }
+      FreeObject( data->map );
+      data->map = UIntMap_New();
+   }
+}
+
+
+void UIntMapSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, UIntMapSuiteData );
+   pcu_suite_setFixtures( suite, UIntMapSuite_Setup, UIntMapSuite_Teardown );
+   pcu_suite_addTest( suite, UIntMapSuite_TestInsert );
+   pcu_suite_addTest( suite, UIntMapSuite_TestMap );
+   pcu_suite_addTest( suite, UIntMapSuite_TestMemoryMap );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/AbstractContext.c
--- a/Base/Context/src/AbstractContext.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1173 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: AbstractContext.c 4301 2008-08-28 06:25:57Z JohnMansour $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>  /* subsequent files need this */
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "units.h"
-#include "types.h"
-#include "shortcuts.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "AbstractContext.h"
-#include "ContextEntryPoint.h"
-#include "DictionaryCheck.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <unistd.h>
-
-#if defined(READ_HDF5) || defined(WRITE_HDF5)
-#include <hdf5.h>
-#endif
-
-/* AbstractContext entry point names */
-Type AbstractContext_EP_AssignFromXML =				"Context_Construct";
-Type AbstractContext_EP_AssignFromXMLExtensions = 	"Context_ConstructExtensions";
-Type AbstractContext_EP_Build = 							"Context_Build";
-Type AbstractContext_EP_Initialise =					"Context_Initialise";
-Type AbstractContext_EP_Execute =						"Context_Execute";
-Type AbstractContext_EP_Destroy =						"Context_Destroy";
-Type AbstractContext_EP_DestroyExtensions = 			"Context_DestroyExtensions";
-
-Type AbstractContext_EP_Dt =								"Context_Dt";
-Type AbstractContext_EP_Step =							"Context_Step";
-Type AbstractContext_EP_UpdateClass =					"Context_UpdateClass";
-Type AbstractContext_EP_Solve =							"Context_Solve";
-Type AbstractContext_EP_PostSolvePreUpdate = 		"Context_PostSolvePreUpdate";
-Type AbstractContext_EP_Sync =							"Context_Sync";
-Type AbstractContext_EP_FrequentOutput = 				"Context_FrequentOutput";
-Type AbstractContext_EP_Dump =							"Context_Dump";
-Type AbstractContext_EP_DumpClass =						"Context_DumpClass";
-Type AbstractContext_EP_Save =							"Context_Save";
-Type AbstractContext_EP_SaveClass =						"Context_SaveClass";
-Type AbstractContext_EP_DataSave =						"Context_DataSave";
-Type AbstractContext_EP_DataSaveClass =				"Context_DataSaveClass";
-
-/* Dictionary entry names */
-const Type AbstractContext_Dict_Components =	"components";
-
-/* Class stuff ********************************************************************************************************************/
-
-/* Textual name of this class */
-const Type AbstractContext_Type = "Context";
-const Type AbstractContext_Type_Verbose = "Context-verbose";
-
-AbstractContext* _AbstractContext_New(  ABSTRACTCONTEXT_DEFARGS  ) {
-	AbstractContext* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(AbstractContext) );
-	self = (AbstractContext*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-	
-	/* General info */
-	self->dictionary = dictionary;
-
-	/* Virtual info */
-	self->CF = 0; /* gets built in stgMain and passed in during the construct phase */
-	self->_setDt = _setDt;
-	self->startTime = startTime;
-	self->stopTime = stopTime;
-	self->communicator = communicator;
-	
-	MPI_Comm_rank( self->communicator, &self->rank );
-	MPI_Comm_size( self->communicator, &self->nproc );
-		
-	return self;
-}
-
-void _AbstractContext_Init( AbstractContext* self ) {
-	Stream* debug = Journal_Register( DebugStream_Type, (Name)AbstractContext_Type  );
-	char buf[80];
-
-#ifdef READ_HDF5
-   /* disable HDF5 error reporting, as verbosity can be excessive, and some 
-      errors are expected and need not be reported */
-	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-   H5Eset_auto(NULL, NULL);
-	#else
-   H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-	#endif
-   
-#endif
-	
-	/* General and Virtual info should already be set */
-	
-	self->debug = debug;
-
-	Journal_Enable_TypedStream( DebugStream_Type, False );
-	Journal_Enable_TypedStream( DumpStream_Type, False );
-
-	if( self->rank == 0 ) {
-		Journal_Printf( 
-			debug, 
-			"In: %s: self->communicator: %u, self->nproc: %u, self->rank %u\n", 
-			__func__,
-			self->communicator,
-			self->nproc,
-			self->rank );
-	}
-	self->info = Journal_Register( InfoStream_Type, (Name)AbstractContext_Type  );
-	self->verbose = Journal_Register( InfoStream_Type, (Name)AbstractContext_Type_Verbose  );
-	sprintf( buf, "journal.info.%s", AbstractContext_Type_Verbose );
-
-	if( !Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)buf )  ) {
-		Journal_Enable_NamedStream( InfoStream_Type, AbstractContext_Type_Verbose, False );
-	}
-	/* Turn off the journal warning debug stream by default: even if debug is enabled in general */
-	if( !Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"journal.debug.DictionaryWarning" )  ) {
-		Journal_Enable_NamedStream( DebugStream_Type, "DictionaryWarning", False );
-	}
-	
-	/* Set up the registers and managers */
-	self->variable_Register = Variable_Register_New();
-	self->extensionMgr = ExtensionManager_New_OfExistingObject( (char*)(self->type), self );
-	ExtensionManager_Register_Add( extensionMgr_Register, self->extensionMgr );
-	self->pointer_Register = Stg_ObjectList_New();
-	self->plugins = PluginsManager_New();
-	
-	/* Build the entryPoint table */
-	self->entryPoint_Register = EntryPoint_Register_New(); 
-	/* For the construct EP, override the run function such that the context/ptrToContext remain in sync in the loop. */
-	self->constructK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_AssignFromXML, EntryPoint_2VoidPtr_CastType ) );
-	AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML )->_getRun = _AbstractContext_Construct_EP_GetRun;
-	AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML )->run = EntryPoint_GetRun( AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML ) );
-
-	self->constructExtensionsK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_AssignFromXMLExtensions, EntryPoint_VoidPtr_CastType ) );
-	self->buildK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Build, EntryPoint_VoidPtr_CastType ) );
-	self->initialiseK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Initialise, EntryPoint_VoidPtr_CastType ) );
-	self->executeK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Execute, EntryPoint_VoidPtr_CastType ) );
-	self->destroyK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Destroy, EntryPoint_VoidPtr_CastType ) );
-	self->destroyExtensionsK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DestroyExtensions, EntryPoint_VoidPtr_CastType ) );
-	
-	self->dtK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Dt, ContextEntryPoint_Dt_CastType ) );
-	self->stepK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Step, ContextEntryPoint_Step_CastType ) );
-	self->updateClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_UpdateClass, EntryPoint_Class_VoidPtr_CastType ) );
-	self->solveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Solve, EntryPoint_VoidPtr_CastType ) );
-	self->postSolveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_PostSolvePreUpdate, EntryPoint_VoidPtr_CastType ) );
-	self->syncK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Sync, EntryPoint_VoidPtr_CastType ) );
-	self->frequentOutputK =	Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_FrequentOutput, EntryPoint_VoidPtr_CastType ) );
-	self->dumpK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Dump, EntryPoint_VoidPtr_CastType ) );
-	self->dumpClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DumpClass, EntryPoint_Class_VoidPtr_CastType ) );
-	self->saveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Save, EntryPoint_VoidPtr_CastType ) );
-	self->saveClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_SaveClass, EntryPoint_Class_VoidPtr_CastType ) );
-	self->dataSaveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DataSave, EntryPoint_VoidPtr_CastType ) );
-	self->dataSaveClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DataSaveClass, EntryPoint_Class_VoidPtr_CastType ) );
-	
-	/* add initial hooks */
-   /* don't need now Stg_ComponentFactory_ConstructComponents, 13Nov09 JG, plan to rejig the context
-   post upcoming release */
-	EntryPoint_Append(
-		AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML ),
-		"_AbstractContext_Construct_Hook",
-		(Func_Ptr)_AbstractContext_Construct_Hook,
-		AbstractContext_Type );
-	EntryPoint_Append( 
-		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Execute ),
-		"_AbstractContext_Execute_Hook", 
-		(Func_Ptr)_AbstractContext_Execute_Hook, 
-		AbstractContext_Type );
-	EntryPoint_Append( 
-		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Step ),
-		"_AbstractContext_Step", 
-		(Func_Ptr)_AbstractContext_Step, 
-		AbstractContext_Type );
-	EntryPoint_Append( 
-		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Save ),
-		"_AbstractContext_SaveTimeInfo", 
-		(Func_Ptr)_AbstractContext_SaveTimeInfo, 
-		AbstractContext_Type );
-	EntryPoint_Prepend_AlwaysFirst( 
-		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Save ),
-		"_AbstractContext_CreateCheckpointDirectory", 
-		(Func_Ptr)_AbstractContext_CreateCheckpointDirectory, 
-		AbstractContext_Type );
-	EntryPoint_Prepend_AlwaysFirst( 
-		AbstractContext_GetEntryPoint( self, AbstractContext_EP_DataSave ),
-		"_AbstractContext_CreateCheckpointDirectory", 
-		(Func_Ptr)_AbstractContext_CreateCheckpointDirectory, 
-		AbstractContext_Type );
-}
-
-void _AbstractContext_Delete( void* abstractContext ) {
-	AbstractContext* self = (AbstractContext*)abstractContext;
-
-	Stg_Class_Delete( self->variable_Register );
-
-   /* unload all dynamic plugins */
-	PluginsManager_UnloadAll( self->plugins );
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Component_Delete( self );
-}
-
-void _AbstractContext_Print( void* abstractContext, Stream* stream ) {
-	AbstractContext* self = (AbstractContext*)abstractContext;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "AbstractContext (ptr)(%p):\n", self );
-	Journal_Printf( (void*) stream, "\tdictionary (ptr): %p\n", self->dictionary );
-	
-	/* Virtual info */
-	Journal_Printf( (void*) stream, "\t_setDt (ptr): %p\n", self->_setDt );
-	
-	/* AbstractContext info */
-	Journal_Printf( (void*) stream, "\tcommunicator: %i\n", self->communicator );
-	Journal_Printf( (void*) stream, "\tstartTime: %g\n", self->startTime );
-	Journal_Printf( (void*) stream, "\tstopTime: %g\n", self->stopTime );
-	Journal_Printf( (void*) stream, "\tcurrentTime: %g\n", self->currentTime );
-	Journal_Printf( (void*) stream, "\ttimeStep: %u\n", self->timeStep );
-	Journal_Printf( (void*) stream, "\ttimeStepSinceJobRestart: %u\n", self->timeStepSinceJobRestart );
-	Journal_Printf( (void*) stream, "\tmaxTimeSteps: %u\n", self->maxTimeSteps );
-	Journal_Printf( (void*) stream, "\tfinalTimeStep: %u\n", self->finalTimeStep );
-	Journal_Printf( (void*) stream, "\toutputEvery: %u\n", self->frequentOutputEvery );
-	Journal_Printf( (void*) stream, "\tdumpEvery: %u\n", self->dumpEvery );
-	Journal_Printf( (void*) stream, "\tcheckpointEvery: %u\n", self->checkpointEvery );
-   Journal_Printf( (void*) stream, "\tsaveDataEvery: %u\n", self->saveDataEvery );
-	Journal_Printf( (void*) stream, "\tcheckpointAtTimeInc: %g\n", self->checkpointAtTimeInc );
-
-	if( self->outputPath ) {
-		Journal_Printf( (void*) stream, "\toutputPath: %s\n", self->outputPath );
-	}
-	else {
-		Journal_Printf( (void*) stream, "\toutputPath: (null)\n" );
-	}
-
-	if( self->checkpointReadPath ) {
-		Journal_Printf( (void*) stream, "\tcheckpointReadPath: %s\n", self->checkpointReadPath );
-	}
-	else {
-		Journal_Printf( (void*) stream, "\tcheckpointReadPath: (null)\n" );
-	}
-
-	if( self->checkpointWritePath ) {
-		Journal_Printf( (void*) stream, "\tcheckpointWritePath: %s\n", self->checkpointWritePath );
-	}
-	else {
-		Journal_Printf( (void*) stream, "\tcheckpointWritePath: (null)\n" );
-	}
-
-	Journal_Printf( stream, "\tloadFromCheckPoint: %u\n", self->loadFromCheckPoint );
-	Journal_Printf( stream, "\trestartTimestep: %u\n", self->restartTimestep );
-	Journal_Printf( stream, "\tcheckPointPrefixString: %s\n", self->checkPointPrefixString );
-	
-	Stg_Class_Print( self->entryPoint_Register, stream );
-	
-	Journal_Printf( (void*) stream, "\tconstructK: %u\n", self->constructK );
-	Journal_Printf( (void*) stream, "\tconstructExtensionsK: %u\n", self->constructExtensionsK );
-	Journal_Printf( (void*) stream, "\tbuildK: %u\n", self->buildK );
-	Journal_Printf( (void*) stream, "\tinitialiseK: %u\n", self->initialiseK );
-	Journal_Printf( (void*) stream, "\texecuteK: %u\n", self->executeK );
-	Journal_Printf( (void*) stream, "\tdestroyK: %u\n", self->destroyK );
-	Journal_Printf( (void*) stream, "\tdestroyExtensionsK: %u\n", self->destroyExtensionsK );
-	
-	Journal_Printf( (void*) stream, "\tdt: %u\n", self->dtK );
-	Journal_Printf( (void*) stream, "\tstepK: %u\n", self->stepK );
-	Journal_Printf( (void*) stream, "\tsolveK: %u\n", self->solveK );
-	Journal_Printf( (void*) stream, "\tsyncK: %u\n", self->syncK );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-}
-
-
-/* Construct EP override stuff ****************************************************************************************************/
-
-
-Func_Ptr _AbstractContext_Construct_EP_GetRun( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	
-	switch( self->castType ) {
-		case EntryPoint_2VoidPtr_CastType:
-			return (void*) _AbstractContext_Construct_EP_Run;
-		
-		default:
-			return _EntryPoint_GetRun( self );
-	}
-	return 0;
-}
-
-void _AbstractContext_Construct_EP_Run( void* entryPoint, void* data0, void* data1 ) {
-	EntryPoint*		self = (EntryPoint*)entryPoint;
-	Hook_Index		hookIndex;
-	AbstractContext* 	context = (AbstractContext*)data0;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_2VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		((EntryPoint_2VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( context, NULL );
-		
-		self = KeyHandle( context, context->constructK );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-
-/* Component stuff ****************************************************************************************************************/
-
-
-void _AbstractContext_AssignFromXML( void* context, Stg_ComponentFactory* cf, void* data ) {
-	AbstractContext* 	self = (AbstractContext*)context;
-	Dictionary_Entry_Value* dictEntryVal = NULL;
-	double			startTime, stopTime;
-
-	Journal_Printf( self->debug, "In: %s\n", __func__ );
-
-   /* the following just pauses at this point to allow time to attach a debugger.. useful for mpi debugging */
-   sleep( Dictionary_Entry_Value_AsUnsignedInt(Dictionary_GetDefault( self->dictionary, "pauseToAttachDebugger", Dictionary_Entry_Value_FromUnsignedInt( 0 )) ) ); 
-      
-   /* this defines all the entryPoints, eg, self->constructK, etc...
-      so it must go before we start KeyCall */
-   _AbstractContext_Init( self );
-
-	/* Main input parameters */
-	self->frequentOutputEvery = Dictionary_Entry_Value_AsUnsignedInt( 
-		Dictionary_GetDefault( self->dictionary, "outputEvery", Dictionary_Entry_Value_FromUnsignedInt( 1 ) ) );
-	self->dumpEvery = Dictionary_Entry_Value_AsUnsignedInt( 
-		Dictionary_GetDefault( self->dictionary, "dumpEvery", Dictionary_Entry_Value_FromUnsignedInt( 10 ) ) );
-	self->checkpointEvery = Dictionary_Entry_Value_AsUnsignedInt( 
-		Dictionary_GetDefault( self->dictionary, "checkpointEvery", Dictionary_Entry_Value_FromUnsignedInt( 0 ) ) );
-	self->saveDataEvery = Dictionary_Entry_Value_AsUnsignedInt( 
-		Dictionary_GetDefault( self->dictionary, "saveDataEvery", Dictionary_Entry_Value_FromUnsignedInt( 0 ) ) );
-	self->checkpointAtTimeInc = Dictionary_Entry_Value_AsDouble( 
-		Dictionary_GetDefault( self->dictionary, "checkpointAtTimeInc", Dictionary_Entry_Value_FromDouble( 0 ) ) );
-	self->nextCheckpointTime = self->checkpointAtTimeInc;
-	self->experimentName = StG_Strdup( Dictionary_Entry_Value_AsString( 
-		Dictionary_GetDefault( self->dictionary, "experimentName", Dictionary_Entry_Value_FromString( "experiment" ) ) ) );
-	self->outputPath = StG_Strdup( Dictionary_Entry_Value_AsString( 
-		Dictionary_GetDefault( self->dictionary, "outputPath", Dictionary_Entry_Value_FromString( "./" ) ) ) );
-	
-   if( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointReadPath" )  ) {
-      self->checkpointReadPath = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointReadPath" ) ) );
-   }
-   else {
-      self->checkpointReadPath = StG_Strdup( self->outputPath  );
-   }
-   if( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointWritePath" )  ) {
-      self->checkpointWritePath = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointWritePath" ) ) );
-   }
-   else {
-      self->checkpointWritePath = StG_Strdup( self->outputPath  );
-   }
-
-	self->checkpointAppendStep = Dictionary_Entry_Value_AsBool( 
-		Dictionary_GetDefault( self->dictionary, "checkpointAppendStep", Dictionary_Entry_Value_FromBool( False ) ) ) ;
-	self->interpolateRestart = Dictionary_Entry_Value_AsBool( 
-		Dictionary_GetDefault( self->dictionary, "interpolateRestart", Dictionary_Entry_Value_FromBool( False ) ) ) ;
-	self->outputFlattenedXML = Dictionary_Entry_Value_AsBool( 
-		Dictionary_GetDefault( self->dictionary, "outputFlattenedXML", Dictionary_Entry_Value_FromBool( True ) ) ) ;
-
-	if ( self->rank == 0 ) {
-		if ( ! Stg_DirectoryExists( self->outputPath ) ) {
-			Bool ret;
-
-			if ( Stg_FileExists( self->outputPath ) ) {
-				Journal_Firewall( 
-					0, 
-					self->info, 
-					"outputPath '%s' is a file an not a directory! Exiting...\n", self->outputPath );
-			}
-			
-			Journal_Printf( self->info, "outputPath '%s' does not exist, attempting to create...\n", self->outputPath );
-			ret = Stg_CreateDirectory( self->outputPath );
-			Journal_Firewall( ret, self->info, "Unable to create non-existing outputPath to '%s'\n", self->outputPath );
-			/* else */
-			Journal_Printf( self->info, "outputPath '%s' successfully created!\n", self->outputPath );
-		}
-		if ( ! Stg_DirectoryExists( self->checkpointWritePath ) ) {
-			Bool ret;
-
-			if ( Stg_FileExists( self->checkpointWritePath ) ) {
-				Journal_Firewall( 
-					0, 
-					self->info, 
-					"checkpointWritePath '%s' is a file an not a directory! Exiting...\n", self->checkpointWritePath );
-			}
-			
-			Journal_Printf( self->info, "checkpointWritePath '%s' does not exist, attempting to create...\n", self->checkpointWritePath );
-			ret = Stg_CreateDirectory( self->checkpointWritePath );
-			Journal_Firewall( ret, self->info, "Unable to create non-existing checkpointWritePath to '%s'\n", self->checkpointWritePath );
-			/* else */
-			Journal_Printf( self->info, "checkpointWritePath '%s' successfully created!\n", self->checkpointWritePath );
-		}
-	}
-
-	if ( self->rank == 0 && self->outputFlattenedXML) {
-		XML_IO_Handler* ioHandler;
-		char*       inputfileRecord;
-		char*       inputfileRecordWithDateTimeStamp;
-		time_t      currTime;
-		struct tm*  timeInfo;
-		int         adjustedYear;
-		int         adjustedMonth;
-
-		Stream* s = Journal_Register( Info_Type, (Name)XML_IO_Handler_Type );
-
-		/* Avoid confusing messages from XML_IO_Handler...turn it off temporarily */
-		Bool isEnabled = Stream_IsEnable( s  );
-		Stream_EnableSelfOnly( s, False );
-
-		ioHandler = XML_IO_Handler_New();
-
-		/* Set file names */
-		Stg_asprintf( &inputfileRecord, "%s/%s", self->outputPath, "input.xml" );
-
-		currTime = time( NULL );
-		timeInfo = localtime( &currTime );
-		/* See man localtime() for why to adjust these */
-		adjustedYear = 1900 + timeInfo->tm_year;
-		adjustedMonth = 1 + timeInfo->tm_mon;
-		/* Format; path/input-YYYY.MM.DD-HH.MM.SS.xml */	
-		Stg_asprintf( &inputfileRecordWithDateTimeStamp, "%s/%s-%.4d.%.2d.%.2d-%.2d.%.2d.%.2d.%s", self->outputPath, "input", 
-			adjustedYear, adjustedMonth, timeInfo->tm_mday,
-			timeInfo->tm_hour, timeInfo->tm_min, timeInfo->tm_sec ,
-			"xml" );
-
-		IO_Handler_WriteAllToFile( ioHandler, inputfileRecord, self->dictionary );
-		IO_Handler_WriteAllToFile( ioHandler, inputfileRecordWithDateTimeStamp, self->dictionary );
-		
-		Stream_EnableSelfOnly( s, isEnabled );
-
-		Stg_Class_Delete( ioHandler );
-		Memory_Free( inputfileRecord );
-		Memory_Free( inputfileRecordWithDateTimeStamp );
-	}
-
-
-	/* Note: these try for deprecated keys "start", "end" and "stop" as well as new ones "startTime" and
-		"stopTime" - Main.PatrickSunter - 4 November 2004 */
-	startTime = stopTime = 0;
-	dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"start" );
-	if ( NULL == dictEntryVal  ) {
-		dictEntryVal = Dictionary_GetDefault( self->dictionary, "startTime",
-			Dictionary_Entry_Value_FromDouble( startTime ) );
-	}
-	self->startTime = Dictionary_Entry_Value_AsDouble( dictEntryVal );
-
-	dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"end" );
-	if ( NULL == dictEntryVal  ) {
-		dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"stop" );
-		if ( NULL == dictEntryVal  ) {
-			dictEntryVal = Dictionary_GetDefault( self->dictionary, "stopTime",
-				Dictionary_Entry_Value_FromDouble( stopTime ) );
-		}
-	} 
-	self->stopTime = Dictionary_Entry_Value_AsDouble( dictEntryVal );
-
-	/* maxTimeSteps of 0 means no maximum applied */
-	/* Note: these try for deprecated key "maxLoops" as well as new one "maxTimeSteps" - Main.PatrickSunter - 4 November 2004 */
-	dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"maxLoops" );
-	if ( NULL == dictEntryVal  ) {
-		dictEntryVal = Dictionary_GetDefault( self->dictionary, "maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 0 ) );
-	}
-	self->maxTimeSteps = Dictionary_Entry_Value_AsUnsignedInt( dictEntryVal );
-
-	self->finalTimeStep = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "finalTimeStep", 0 );
-	self->gracefulQuit = False;
-
-	/* TODO: does this need to be read from checkpoint file??? */
-	self->currentTime = self->startTime;
-	self->timeStep = 0;
-	self->timeStepSinceJobRestart = 0;
-	
-	/* Read in the checkpointing info */
-	self->restartTimestep = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "restartTimestep", 0 );
-	self->checkPointPrefixString = Dictionary_GetString_WithDefault( self->dictionary, "checkPointPrefixString", "" );
-	if ( self->restartTimestep != 0 ) {
-		double dtFromFile;
-		self->loadFromCheckPoint = True;
-		self->timeStep = self->restartTimestep;
-		_AbstractContext_LoadTimeInfoFromCheckPoint( (void*)self, self->restartTimestep, &dtFromFile );
-		self->nextCheckpointTime += self->currentTime;
-	}
-	else {
-		self->loadFromCheckPoint = False;
-	}
-
-	/* Check if we have been provided a constant to multiply our calculated dt values by. */
-	self->dtFactor = Dictionary_GetDouble_WithDefault( self->dictionary, (Dictionary_Entry_Key)"timestepFactor", 1.0  );
-
-	/* construct entry point */
-	KeyCall( self, self->constructK, EntryPoint_2VoidPtr_CallCast* )( KeyHandle( self, self->constructK ), self, self );
-
-	/* Load the plugins desired by this context (dictionary) */
-	ModulesManager_Load( self->plugins, self->dictionary, self->name );
-
-	self->CF = cf;
-
-	/* Extensions are the last thing we want to do */
-	KeyCall( self, self->constructExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->constructExtensionsK), self );
-	
-	if( self->rank == 0 ) 
-		Context_PrintConcise( self, self->verbose );
-
-	if ( True == Dictionary_GetBool_WithDefault( self->dictionary, (Dictionary_Entry_Key)"showJournalStatus", False ) ) {
-		Journal_PrintConcise( );	
-	}	
-}
-
-
-void _AbstractContext_Build( void* context, void* data ) {
-	AbstractContext* 	self = (AbstractContext*)context;
-	Bool			isBuilt;
-	
-	Journal_Printf( self->debug, "In: %s\n", __func__ );
-
-	#ifdef DEBUG
-		Context_WarnIfNoHooks( self, self->buildK, __func__  );
-	#endif
-	
-	/* Pre-mark the phase as complete as a default hook will attempt to build all live components (including this again) */
-	isBuilt = self->isBuilt;
-	self->isBuilt = True;
-
-	/* Construct the list of plugins. do this in the build phase se that we know that any components required by the plugins 
-	 * have already been constructed */
-	if( self->plugins->codelets->count )
-		ModulesManager_ConstructModules( self->plugins, self->CF, data );
-
-	KeyCall( self, self->buildK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->buildK), self );
-	self->isBuilt = isBuilt;
-}
-
-
-void _AbstractContext_Initialise( void* context, void* data ) {
-	AbstractContext*	self = (AbstractContext*)context;
-	Bool			isInitialised;
-	
-	Journal_Printf( self->debug, "In: %s\n", __func__ );
-
-	#ifdef DEBUG
-		AbstractContext_WarnIfNoHooks( self, self->initialiseK, __func__ );
-	#endif
-	
-	/* Pre-mark the phase as complete as a default hook will attempt to initialise all live components (including this again) */
-	isInitialised = self->isInitialised;
-	self->isInitialised = True;
-	KeyCall( self, self->initialiseK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->initialiseK), self );
-	self->isInitialised = isInitialised;
-}
-
-
-void _AbstractContext_Execute( void* context, void* data ) {
-	AbstractContext* 	self = (AbstractContext*)context;
-	Bool			hasExecuted;
-	
-	Journal_Printf( self->debug, "In: %s\n", __func__ );
-
-	#ifdef DEBUG
-		AbstractContext_WarnIfNoHooks( self, self->executeK, __func__ );
-	#endif
-	
-	/* Pre-mark the phase as complete as a default hook will attempt to initialise all live components (including this again) */
-	hasExecuted = self->hasExecuted;
-	self->hasExecuted = True;
-	KeyCall( self, self->executeK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->executeK), self );
-	self->hasExecuted = hasExecuted;
-}
-
-
-void _AbstractContext_Destroy( void* context, void* data ) {
-	AbstractContext* self = (AbstractContext*)context;
-
-	Journal_Printf( self->debug, "In: %s\n", __func__ );
-
-	/* Pre-mark the phase as complete as a default hook will attempt to initialise all live components (including this again) */
-   PluginsManager_RemoveAllFromComponentRegister( self->plugins ); 
-
-  	KeyCall( self, self->destroyExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->destroyExtensionsK), self );
-  	KeyCall( self, self->destroyK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->destroyK), self );
-
-   Stg_Class_Delete( self->entryPoint_Register );
-   Stg_ObjectList_DeleteAllObjects( self->pointer_Register );
-   Stg_Class_Delete( self->pointer_Register );
-
-   /* remove the self->extensionMgr of this context from the extensionMgr_Register */
-	ExtensionManager_Register_Remove( extensionMgr_Register, self->extensionMgr );
-   Stg_Class_Delete( self->extensionMgr );
-	Stg_Class_Delete( self->dictionary );	
-
-	Memory_Free( self->experimentName );
-	Memory_Free( self->outputPath );
-	Memory_Free( self->checkpointReadPath );
-	Memory_Free( self->checkpointWritePath );
-}
-
-
-/* Context public stuff ***********************************************************************************************************/
-
-
-void AbstractContext_PrintConcise( void* abstractContext, Stream* stream ) {
-	AbstractContext* self = (AbstractContext*)abstractContext;
-	EntryPoint_Index entryPointIndex;
-
-	Journal_Printf( stream, "Context: %s\n", self->type );
-	for( entryPointIndex = 0; entryPointIndex < self->entryPoint_Register->count; entryPointIndex++ ) {
-		EntryPoint_PrintConcise( EntryPoint_Register_At( self->entryPoint_Register, entryPointIndex ), stream );
-	}
-}
-
-
-EntryPoint_Index AbstractContext_AddEntryPoint( 
-		void*				abstractContext,
-		void*				entryPoint )
-{
-	AbstractContext* self = (AbstractContext*)abstractContext;
-
-	return EntryPoint_Register_Add( self->entryPoint_Register, entryPoint );
-}
-
-
-EntryPoint* AbstractContext_GetEntryPoint( void* abstractContext, Name entryPointName ) {
-	AbstractContext*	self = (AbstractContext*)abstractContext;
-	EntryPoint_Index	ep_I;
-
-	/* Find the entry point */
-	ep_I = EntryPoint_Register_GetHandle( self->entryPoint_Register, entryPointName );
-	if( ep_I == (unsigned)-1 ) {
-		return 0;
-	}
-	else {
-		return EntryPoint_Register_At( self->entryPoint_Register, ep_I );
-	}
-}
-
-
-Func_Ptr _AbstractContext_Call( void* abstractContext, Name entryPointName, void** epPtr ) {
-	AbstractContext*	self = (AbstractContext*)abstractContext;
-	EntryPoint_Index	ep_I;
-	
-	/* Find the entry point */
-	ep_I = EntryPoint_Register_GetHandle( self->entryPoint_Register, entryPointName );
-	if( ep_I == (unsigned)-1 ) {
-		*epPtr = 0;
-	}
-	else {
-		*epPtr = EntryPoint_Register_At( self->entryPoint_Register, ep_I );
-	}
-	
-	/* ... and run it */
-	if( *epPtr != 0 ) {
-		return ((EntryPoint*) (*epPtr))->run;
-	}
-	return 0;
-}
-
-
-double AbstractContext_Dt( void* context ) {
-	AbstractContext* self = (AbstractContext*)context;
-
-	AbstractContext_ErrorIfNoHooks( self, self->dtK, __func__ );
-	return KeyCall( self, self->dtK, ContextEntryPoint_Dt_CallCast* )( KeyHandle(self,self->dtK), self );
-}
-
-void AbstractContext_Step( void* context, double dt ) {
-	AbstractContext* self = (AbstractContext*)context;
-	#if DEBUG
-		AbstractContext_WarnIfNoHooks( self, self->stepK, __func__ );
-	#endif
-	KeyCall( self, self->stepK, ContextEntryPoint_Step_CallCast* )( KeyHandle(self,self->stepK), self, dt );
-}
-
-
-void AbstractContext_WarnIfNoHooks( void* context, EntryPoint_Index epIndex, Name caller ) {
-	AbstractContext* self = (AbstractContext*)context;
-	EntryPoint_WarnIfNoHooks( EntryPoint_Register_At( self->entryPoint_Register, epIndex ), caller );
-}
-
-
-void AbstractContext_ErrorIfNoHooks( void* context, EntryPoint_Index epIndex, Name caller ) {
-	AbstractContext* self = (AbstractContext*)context;
-	EntryPoint_ErrorIfNoHooks( EntryPoint_Register_At( self->entryPoint_Register, epIndex ), caller );
-}
-
-void AbstractContext_FrequentOutput( void* context ) {
-	AbstractContext* self = (AbstractContext*)context;
-
-	KeyCall( self, self->frequentOutputK, EntryPoint_VoidPtr_CallCast* )( 
-			KeyHandle(self,self->frequentOutputK), self );
-}
-
-void AbstractContext_Dump( void* context ) {
-	AbstractContext* self = (AbstractContext*)context;
-
-	KeyCall( self, self->dumpK, EntryPoint_VoidPtr_CallCast* )(      
-			KeyHandle(self,self->dumpK), self );
-	KeyCall( self, self->dumpClassK, EntryPoint_Class_VoidPtr_CallCast* )(
-			KeyHandle(self,self->dumpClassK), self );
-}
-
-void AbstractContext_Save( void* context ) {
-	AbstractContext* self = (AbstractContext*)context;
-
-	KeyCall( self, self->saveK, EntryPoint_VoidPtr_CallCast* )(     
-			KeyHandle(self,self->saveK), self );
-	KeyCall( self, self->saveClassK, EntryPoint_Class_VoidPtr_CallCast* )(      
-			KeyHandle(self,self->saveClassK), self );
-}
-
-void AbstractContext_DataSave( void* context ) {
-	AbstractContext* self = (AbstractContext*)context;
-
-	KeyCall( self, self->dataSaveK, EntryPoint_VoidPtr_CallCast* )(     
-			KeyHandle(self,self->dataSaveK), self );
-	KeyCall( self, self->dataSaveClassK, EntryPoint_Class_VoidPtr_CallCast* )(      
-			KeyHandle(self,self->dataSaveClassK), self );
-}
-
-/* Context hooks ******************************************************************************************************************/
-
-void _AbstractContext_Construct_Hook( void* _context, void* data ) {
-
-}
-
-void _AbstractContext_Execute_Hook( void* _context ) {
-	AbstractContext*   self = (AbstractContext*)_context;
-	double             dt = 0;
-	double             dtLoadedFromFile = 0;
-	
-	if (self->maxTimeSteps) {
-		Journal_RPrintf( self->info, "Run until %u timeSteps have been run\n", self->maxTimeSteps );
-	}
-	if (self->finalTimeStep ) {
-		if (self->maxTimeSteps ) {
-			Journal_RPrintf( self->info, "or " );
-		}	
-		else {
-			Journal_RPrintf( self->info, "Run " );
-		}
-		Journal_Printf( self->info, "until absolute time step %u reached\n", self->stopTime );
-	}
-	
-	if (self->stopTime) {
-		if (self->maxTimeSteps || self->finalTimeStep ) {
-			Journal_RPrintf( self->info, "or " );
-		}	
-		else {
-			Journal_RPrintf( self->info, "Run " );
-		}
-		Journal_RPrintf( self->info, "until simulation time passes %g.\n", self->stopTime );
-	}
-	
-	self->timeStepSinceJobRestart = 1;
-
-	/* Set timeStep to 0 if not restarting, so that incrementing timestep below affects both
-		regular and restart mode -- PatrickSunter - 18 June 2006 */
-	if ( False == self->loadFromCheckPoint ) {
-		self->timeStep = 0;
-		self->currentTime = self->startTime;
-	}
-	
-	self->timeStep++;
-
-	while( !self->gracefulQuit ) {
-		if ( ( True == self->loadFromCheckPoint ) &&
-			( self->timeStep == self->restartTimestep + 1 ) )
-		{ 
-			/* Note: when checkpointing time info, we called AbstractContext_Dt( self )
-			at the end of the step we were restarting from, which should be equivalent to the
-			call here - and that calculation may be dependent on the solver info for that step,
-			so we need to reload it here */
-			_AbstractContext_LoadTimeInfoFromCheckPoint( (void*)self, self->restartTimestep, &dtLoadedFromFile );
-			dt = dtLoadedFromFile;
-		}	
-		else {
-			dt = self->dtFactor * AbstractContext_Dt( self );
-		}
-
-		AbstractContext_Step( self, dt );
-
-		self->currentTime += dt;
-
-		if ( self->frequentOutputEvery ) {
-			if ( self->timeStep % self->frequentOutputEvery == 0 )
-				AbstractContext_FrequentOutput( self );
-		}	
-		if ( self->dumpEvery ) {
-			if ( self->timeStep % self->dumpEvery == 0 )
-				AbstractContext_Dump( self );
-		}	
-		if ( self->checkpointEvery ) {
-			if ( self->timeStep % self->checkpointEvery == 0 ){
-				AbstractContext_Save( self );
-         }
-		}	
-
-		if ( self->saveDataEvery ) {
-			if ( self->timeStep % self->saveDataEvery == 0 ){
-				AbstractContext_DataSave( self );
-         }
-		}	
-
-		if ( self->checkpointAtTimeInc ) {
-			if ( self->currentTime >= self->nextCheckpointTime){
-				AbstractContext_Save( self );
-				self->nextCheckpointTime += self->checkpointAtTimeInc; 
-			}
-		}	
-
-		if (self->maxTimeSteps && (self->timeStepSinceJobRestart >= self->maxTimeSteps)) break;
-		if (self->finalTimeStep && (self->timeStep >= self->finalTimeStep)) break;
-		if (self->stopTime && (self->currentTime >= self->stopTime)) break; 
-
-		stg_log_printf( "========================= Done step %d =========================\n\n", self->timeStep );
-		
-		self->timeStep++;
-		self->timeStepSinceJobRestart++;
-	}
-}
-
-
-void _AbstractContext_Step( void* _context, double dt ) {
-	AbstractContext* self = (AbstractContext*)_context;
-        Bool enabled;
-	
-	/* This will make it clear where the timestep starts when several procs
-	 * running. Figure this 1 synchronisation is ok since we are likely to
-	 * have just synchronised while calculating timestep anyway. */
-	MPI_Barrier( self->communicator );
-	Journal_DPrintf( self->debug, "In: %s\n", __func__ );
-
-        enabled=Stream_IsEnable(self->info);
-        Stream_Enable(self->info,True);
-	Journal_RPrintf( self->info, "TimeStep = %d, Time = %.6g\n",
-		self->timeStep-1, self->currentTime+dt );
-        Stream_Enable(self->info,enabled);
-
-	if (self->loadFromCheckPoint) {
-		Journal_RPrintf( self->info, "TimeStep since job restart = %d\n", self->timeStepSinceJobRestart );
-	}
-
-	#ifdef DEBUG
-		Context_WarnIfNoHooks( self, self->solveK, __func__ );	
-	#endif
-
-	self->_setDt( self, dt );
-	KeyCall( self, self->solveK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->solveK), self );
-	KeyCall( self, self->postSolveK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->postSolveK), self );	
-	KeyCall( self, self->updateClassK, EntryPoint_Class_VoidPtr_CallCast* )( KeyHandle(self,self->updateClassK), self );
-	KeyCall( self, self->syncK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->syncK), self );
-}
-
-
-void _AbstractContext_LoadTimeInfoFromCheckPoint( void* _context, Index timeStep, double* dtLoadedFromFile ) {
-	AbstractContext*       self = (AbstractContext*)_context;
-	char*                  timeInfoFileName = NULL;
-	char*                  timeInfoFileNamePart = NULL;
-	FILE*                  timeInfoFile;		
-	Stream*                errorStr = Journal_Register( Error_Type, (Name)self->type  );
-
-#ifdef READ_HDF5
-	hid_t             file, fileSpace, fileData;
-#endif
-
-	
-   timeInfoFileNamePart = Context_GetCheckPointReadPrefixString( self );
-#ifdef WRITE_HDF5
-	timeInfoFile = NULL;
-   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.h5", timeInfoFileNamePart, self->restartTimestep );
-	 
-	/* Open the file and data set. */
-	file = H5Fopen( timeInfoFileName, H5F_ACC_RDONLY, H5P_DEFAULT );
-	Journal_Firewall( 
-		file >= 0, 
-		errorStr, "\n\nError- in %s(), Couldn't find checkpoint time info file with "
-		"filename \"%s\" - aborting.\n", __func__, timeInfoFileName );
-		   	
-	/* Read currentTime from file */
-	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	fileData = H5Dopen( file, "/currentTime" );
-	#else
-	fileData = H5Dopen2( file, "/currentTime", H5P_DEFAULT );
-	#endif
-	fileSpace = H5Dget_space( fileData );
-	   
-	H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &self->currentTime );
-	   
-	H5Sclose( fileSpace );
-	H5Dclose( fileData );
-	
-	/* Read Dt from file */
-	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	fileData = H5Dopen( file, "/Dt" );
-	#else
-	fileData = H5Dopen2( file, "/Dt", H5P_DEFAULT );
-	#endif
-	fileSpace = H5Dget_space( fileData );
-	   
-	H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dtLoadedFromFile );
-	   
-	H5Sclose( fileSpace );
-	H5Dclose( fileData );
-
-	H5Fclose( file );
-	   
-#else	
-   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.dat", timeInfoFileNamePart, self->restartTimestep );
-	 
-	timeInfoFile = fopen( timeInfoFileName, "r" );
-	Journal_Firewall( NULL != timeInfoFile, errorStr, "Error- in %s(), Couldn't find checkpoint time info file with "
-		"filename \"%s\" (HD5 not enabled) - aborting.\n", __func__, timeInfoFileName );
-
-	/* set currentTime and Dt loaded from file */
-	fscanf( timeInfoFile, "%lg", &self->currentTime );
-	fscanf( timeInfoFile, "%lg", dtLoadedFromFile );
-	fclose( timeInfoFile );
-#endif
-	
-	Memory_Free( timeInfoFileName );
-   Memory_Free( timeInfoFileNamePart );
-}
-		
-
-void _AbstractContext_SaveTimeInfo( void* _context ) {
-	AbstractContext*       self = (AbstractContext*)_context;	
-	FILE*                  timeInfoFile = NULL;
-	char*                  timeInfoFileName = NULL;
-   char*                  timeInfoFileNamePart = NULL;
-	Stream*                errorStr = Journal_Register( Error_Type, (Name)self->type  );
-#ifdef WRITE_HDF5
-	hid_t                  file, fileSpace, fileData, props;
-	hsize_t                count;
-	double                 Dt;
-#endif 
-
-	/* Only the master process needs to write this file */
-	if ( self->rank == 0 ) {
-   timeInfoFileNamePart = Context_GetCheckPointWritePrefixString( self );
-#ifdef WRITE_HDF5
-	timeInfoFile = NULL;
-   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.h5", timeInfoFileNamePart, self->timeStep );
-	
-	/* Create parallel file property list. */
-	props = H5Pcreate( H5P_FILE_ACCESS );
-	
-	/* Open the HDF5 output file. */
-	file = H5Fcreate( timeInfoFileName, H5F_ACC_TRUNC, H5P_DEFAULT, props );
-	Journal_Firewall( 
-		file >= 0, 
-		errorStr,
-		"Error in %s for %s '%s' - Cannot create file %s.\n", 
-		__func__, 
-		self->type, 
-		self->name, 
-		timeInfoFileName );
-		
-	H5Pclose( props );
-
-	/* Dump currentTime */
-	count = 1;
-	fileSpace = H5Screate_simple( 1, &count, NULL );         
-	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	fileData = H5Dcreate( file, "/currentTime", H5T_NATIVE_DOUBLE, fileSpace, H5P_DEFAULT );
-	#else
-	fileData = H5Dcreate2( file, "/currentTime", H5T_NATIVE_DOUBLE, fileSpace,
-	                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
-	#endif
-	      
-	props = H5Pcreate( H5P_DATASET_XFER );
-	H5Dwrite( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, props, &(self->currentTime) );
-	H5Pclose( props );
-	H5Dclose( fileData );
-	H5Sclose( fileSpace );
-	
-	/* Dump Dt */
-	fileSpace = H5Screate_simple( 1, &count, NULL );         
-	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	fileData = H5Dcreate( file, "/Dt", H5T_NATIVE_DOUBLE, fileSpace, H5P_DEFAULT );
-	#else
-	fileData = H5Dcreate2( file, "/Dt", H5T_NATIVE_DOUBLE, fileSpace,
-	                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
-	#endif
-	      
-	props = H5Pcreate( H5P_DATASET_XFER );
-	Dt = AbstractContext_Dt( self );
-	H5Dwrite( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, props, &Dt );
-	H5Pclose( props );
-	H5Dclose( fileData );
-	H5Sclose( fileSpace );
-	
-	/* Dump nproc */
-	fileSpace = H5Screate_simple( 1, &count, NULL );         
-	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	fileData = H5Dcreate( file, "/nproc", H5T_NATIVE_INT, fileSpace, H5P_DEFAULT );
-	#else
-	fileData = H5Dcreate2( file, "/nproc", H5T_NATIVE_INT, fileSpace,
-	                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
-	#endif
-	      
-	props = H5Pcreate( H5P_DATASET_XFER );
-	H5Dwrite( fileData, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, props, &(self->nproc) );
-	H5Pclose( props );
-	H5Dclose( fileData );
-	H5Sclose( fileSpace );
-	
-	H5Fclose( file );
-	
-	
-#else	
-   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.dat", timeInfoFileNamePart, self->timeStep );
-	 
-	timeInfoFile = fopen( timeInfoFileName, "w" );
-
-	if ( False == timeInfoFile ) {
-		Journal_Printf( errorStr, "Error- in %s(), Couldn't create checkpoint time info file with "
-		"filename \"%s\" - aborting.\n", __func__, timeInfoFileName );
-		exit(EXIT_FAILURE);
-	}
-
-	/* set currentTime and Dt loaded from file */
-	fprintf( timeInfoFile, "%lg ", self->currentTime );
-	fprintf( timeInfoFile, "%lg\n", AbstractContext_Dt( self ) );
-	fclose( timeInfoFile );
-#endif
-	
-	Memory_Free( timeInfoFileName );
-   Memory_Free( timeInfoFileNamePart );
-} 
-}
-
-
-Bool AbstractContext_CheckPointExists( void* context, Index timeStep ) {
-  AbstractContext*       self = (AbstractContext*)context;	
-	char*                  timeInfoFileName = NULL;
-	char*                  timeInfoFileNamePart = NULL;   
-	struct stat            statInfo;
-	int                    statResult;
-
-   timeInfoFileNamePart = Context_GetCheckPointWritePrefixString( self );
-#ifdef WRITE_HDF5
-   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.h5", timeInfoFileNamePart, timeStep );
-#else	
-   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.dat", timeInfoFileNamePart, timeStep );
-#endif	
-	statResult = stat( timeInfoFileName, &statInfo );
-
-	Memory_Free( timeInfoFileName );
-   Memory_Free( timeInfoFileNamePart );
-
-	if ( 0 == statResult ) {
-		return True;
-	}
-	else {
-		return False;
-	}
-}
-
-char* Context_GetCheckPointReadPrefixString( void* context ) {
-  AbstractContext*	self = (AbstractContext*)context;	
-	char*					readPathString = NULL;
-
-   if ( self->checkpointAppendStep ) {
-      if ( strlen(self->checkPointPrefixString) > 0 ) {
-         Stg_asprintf( &readPathString, "%s/data.%.5u/%s.", self->checkpointReadPath, self->restartTimestep, self->checkPointPrefixString );
-      }
-      else {
-         Stg_asprintf( &readPathString, "%s/data.%.5u/", self->checkpointReadPath, self->restartTimestep );
-      }
-   } else {
-      if ( strlen(self->checkPointPrefixString) > 0 ) {
-         Stg_asprintf( &readPathString, "%s/%s.", self->checkpointReadPath, self->checkPointPrefixString );
-      }
-      else {
-         Stg_asprintf( &readPathString, "%s/", self->checkpointReadPath );
-      }
-   }
-
-	return readPathString;
-}
-
-char* Context_GetCheckPointWritePrefixString( void* context ) {
-  AbstractContext*	self = (AbstractContext*)context;	
-	char*					writePathString = NULL;
-
-   if ( self->checkpointAppendStep ) {
-      if ( strlen(self->checkPointPrefixString) > 0 ) {
-         Stg_asprintf( &writePathString, "%s/data.%.5u/%s.", self->checkpointWritePath, self->timeStep, self->checkPointPrefixString );
-      }
-      else {
-         Stg_asprintf( &writePathString, "%s/data.%.5u/", self->checkpointWritePath, self->timeStep );
-      }
-   } else {
-      if ( strlen(self->checkPointPrefixString) > 0 ) {
-         Stg_asprintf( &writePathString, "%s/%s.", self->checkpointWritePath, self->checkPointPrefixString );
-      }
-      else {
-         Stg_asprintf( &writePathString, "%s/", self->checkpointWritePath );
-      }
-   }
-
-	return writePathString;
-}
-
-void _AbstractContext_CreateCheckpointDirectory( void* _context ) {
-	AbstractContext*       self = (AbstractContext*)_context;	
-   /* if we are creating individual directories for each checkpoint timestep, first create the directory if it doesn't exist. */
-   if ( self->checkpointAppendStep ) {
-      /* Only the master process creates the directory */      
-      if ( self->rank == 0 ) {
-         char*                  writePathString = NULL;
-         Stg_asprintf( &writePathString, "%s/data.%.5u/", self->checkpointWritePath, self->timeStep );
-         if ( ! Stg_DirectoryExists( writePathString ) ) {
-            Bool ret;
-            if ( Stg_FileExists( writePathString ) )
-               Journal_Firewall( 
-                  0, 
-                  self->info, 
-                  "checkpoint outputPath '%s' is a file an not a directory! Exiting...\n", self->outputPath );
-            ret = Stg_CreateDirectory( writePathString );
-            Journal_Firewall( ret, self->info, "Unable to create non-existing outputPath to '%s'\n", self->outputPath );
-         }
-         /* other processes may proceed now that required directory has been created */
-         MPI_Barrier( self->communicator );
-			Memory_Free( writePathString );
-			writePathString = NULL;
-      } else
-      /* barrier to stop other processes continuing until required directory has been created */ 
-      MPI_Barrier( self->communicator );
-   }
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/AbstractContext.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/AbstractContext.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,1173 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: AbstractContext.c 4301 2008-08-28 06:25:57Z JohnMansour $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>  /* subsequent files need this */
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "units.h"
+#include "types.h"
+#include "shortcuts.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "AbstractContext.h"
+#include "ContextEntryPoint.h"
+#include "DictionaryCheck.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+
+#if defined(READ_HDF5) || defined(WRITE_HDF5)
+#include <hdf5.h>
+#endif
+
+/* AbstractContext entry point names */
+Type AbstractContext_EP_AssignFromXML =				"Context_Construct";
+Type AbstractContext_EP_AssignFromXMLExtensions = 	"Context_ConstructExtensions";
+Type AbstractContext_EP_Build = 							"Context_Build";
+Type AbstractContext_EP_Initialise =					"Context_Initialise";
+Type AbstractContext_EP_Execute =						"Context_Execute";
+Type AbstractContext_EP_Destroy =						"Context_Destroy";
+Type AbstractContext_EP_DestroyExtensions = 			"Context_DestroyExtensions";
+
+Type AbstractContext_EP_Dt =								"Context_Dt";
+Type AbstractContext_EP_Step =							"Context_Step";
+Type AbstractContext_EP_UpdateClass =					"Context_UpdateClass";
+Type AbstractContext_EP_Solve =							"Context_Solve";
+Type AbstractContext_EP_PostSolvePreUpdate = 		"Context_PostSolvePreUpdate";
+Type AbstractContext_EP_Sync =							"Context_Sync";
+Type AbstractContext_EP_FrequentOutput = 				"Context_FrequentOutput";
+Type AbstractContext_EP_Dump =							"Context_Dump";
+Type AbstractContext_EP_DumpClass =						"Context_DumpClass";
+Type AbstractContext_EP_Save =							"Context_Save";
+Type AbstractContext_EP_SaveClass =						"Context_SaveClass";
+Type AbstractContext_EP_DataSave =						"Context_DataSave";
+Type AbstractContext_EP_DataSaveClass =				"Context_DataSaveClass";
+
+/* Dictionary entry names */
+const Type AbstractContext_Dict_Components =	"components";
+
+/* Class stuff ********************************************************************************************************************/
+
+/* Textual name of this class */
+const Type AbstractContext_Type = "Context";
+const Type AbstractContext_Type_Verbose = "Context-verbose";
+
+AbstractContext* _AbstractContext_New(  ABSTRACTCONTEXT_DEFARGS  ) {
+	AbstractContext* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(AbstractContext) );
+	self = (AbstractContext*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+	
+	/* General info */
+	self->dictionary = dictionary;
+
+	/* Virtual info */
+	self->CF = 0; /* gets built in stgMain and passed in during the construct phase */
+	self->_setDt = _setDt;
+	self->startTime = startTime;
+	self->stopTime = stopTime;
+	self->communicator = communicator;
+	
+	MPI_Comm_rank( self->communicator, &self->rank );
+	MPI_Comm_size( self->communicator, &self->nproc );
+		
+	return self;
+}
+
+void _AbstractContext_Init( AbstractContext* self ) {
+	Stream* debug = Journal_Register( DebugStream_Type, (Name)AbstractContext_Type  );
+	char buf[80];
+
+#ifdef READ_HDF5
+   /* disable HDF5 error reporting, as verbosity can be excessive, and some 
+      errors are expected and need not be reported */
+	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+   H5Eset_auto(NULL, NULL);
+	#else
+   H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+	#endif
+   
+#endif
+	
+	/* General and Virtual info should already be set */
+	
+	self->debug = debug;
+
+	Journal_Enable_TypedStream( DebugStream_Type, False );
+	Journal_Enable_TypedStream( DumpStream_Type, False );
+
+	if( self->rank == 0 ) {
+		Journal_Printf( 
+			debug, 
+			"In: %s: self->communicator: %u, self->nproc: %u, self->rank %u\n", 
+			__func__,
+			self->communicator,
+			self->nproc,
+			self->rank );
+	}
+	self->info = Journal_Register( InfoStream_Type, (Name)AbstractContext_Type  );
+	self->verbose = Journal_Register( InfoStream_Type, (Name)AbstractContext_Type_Verbose  );
+	sprintf( buf, "journal.info.%s", AbstractContext_Type_Verbose );
+
+	if( !Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)buf )  ) {
+		Journal_Enable_NamedStream( InfoStream_Type, AbstractContext_Type_Verbose, False );
+	}
+	/* Turn off the journal warning debug stream by default: even if debug is enabled in general */
+	if( !Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"journal.debug.DictionaryWarning" )  ) {
+		Journal_Enable_NamedStream( DebugStream_Type, "DictionaryWarning", False );
+	}
+	
+	/* Set up the registers and managers */
+	self->variable_Register = Variable_Register_New();
+	self->extensionMgr = ExtensionManager_New_OfExistingObject( (char*)(self->type), self );
+	ExtensionManager_Register_Add( extensionMgr_Register, self->extensionMgr );
+	self->pointer_Register = Stg_ObjectList_New();
+	self->plugins = PluginsManager_New();
+	
+	/* Build the entryPoint table */
+	self->entryPoint_Register = EntryPoint_Register_New(); 
+	/* For the construct EP, override the run function such that the context/ptrToContext remain in sync in the loop. */
+	self->constructK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_AssignFromXML, EntryPoint_2VoidPtr_CastType ) );
+	AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML )->_getRun = _AbstractContext_Construct_EP_GetRun;
+	AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML )->run = EntryPoint_GetRun( AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML ) );
+
+	self->constructExtensionsK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_AssignFromXMLExtensions, EntryPoint_VoidPtr_CastType ) );
+	self->buildK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Build, EntryPoint_VoidPtr_CastType ) );
+	self->initialiseK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Initialise, EntryPoint_VoidPtr_CastType ) );
+	self->executeK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Execute, EntryPoint_VoidPtr_CastType ) );
+	self->destroyK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Destroy, EntryPoint_VoidPtr_CastType ) );
+	self->destroyExtensionsK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DestroyExtensions, EntryPoint_VoidPtr_CastType ) );
+	
+	self->dtK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Dt, ContextEntryPoint_Dt_CastType ) );
+	self->stepK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Step, ContextEntryPoint_Step_CastType ) );
+	self->updateClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_UpdateClass, EntryPoint_Class_VoidPtr_CastType ) );
+	self->solveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Solve, EntryPoint_VoidPtr_CastType ) );
+	self->postSolveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_PostSolvePreUpdate, EntryPoint_VoidPtr_CastType ) );
+	self->syncK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Sync, EntryPoint_VoidPtr_CastType ) );
+	self->frequentOutputK =	Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_FrequentOutput, EntryPoint_VoidPtr_CastType ) );
+	self->dumpK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Dump, EntryPoint_VoidPtr_CastType ) );
+	self->dumpClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DumpClass, EntryPoint_Class_VoidPtr_CastType ) );
+	self->saveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_Save, EntryPoint_VoidPtr_CastType ) );
+	self->saveClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_SaveClass, EntryPoint_Class_VoidPtr_CastType ) );
+	self->dataSaveK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DataSave, EntryPoint_VoidPtr_CastType ) );
+	self->dataSaveClassK = Context_AddEntryPoint( self, ContextEntryPoint_New( (char*)AbstractContext_EP_DataSaveClass, EntryPoint_Class_VoidPtr_CastType ) );
+	
+	/* add initial hooks */
+   /* don't need now Stg_ComponentFactory_ConstructComponents, 13Nov09 JG, plan to rejig the context
+   post upcoming release */
+	EntryPoint_Append(
+		AbstractContext_GetEntryPoint( self, AbstractContext_EP_AssignFromXML ),
+		"_AbstractContext_Construct_Hook",
+		(Func_Ptr)_AbstractContext_Construct_Hook,
+		AbstractContext_Type );
+	EntryPoint_Append( 
+		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Execute ),
+		"_AbstractContext_Execute_Hook", 
+		(Func_Ptr)_AbstractContext_Execute_Hook, 
+		AbstractContext_Type );
+	EntryPoint_Append( 
+		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Step ),
+		"_AbstractContext_Step", 
+		(Func_Ptr)_AbstractContext_Step, 
+		AbstractContext_Type );
+	EntryPoint_Append( 
+		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Save ),
+		"_AbstractContext_SaveTimeInfo", 
+		(Func_Ptr)_AbstractContext_SaveTimeInfo, 
+		AbstractContext_Type );
+	EntryPoint_Prepend_AlwaysFirst( 
+		AbstractContext_GetEntryPoint( self, AbstractContext_EP_Save ),
+		"_AbstractContext_CreateCheckpointDirectory", 
+		(Func_Ptr)_AbstractContext_CreateCheckpointDirectory, 
+		AbstractContext_Type );
+	EntryPoint_Prepend_AlwaysFirst( 
+		AbstractContext_GetEntryPoint( self, AbstractContext_EP_DataSave ),
+		"_AbstractContext_CreateCheckpointDirectory", 
+		(Func_Ptr)_AbstractContext_CreateCheckpointDirectory, 
+		AbstractContext_Type );
+}
+
+void _AbstractContext_Delete( void* abstractContext ) {
+	AbstractContext* self = (AbstractContext*)abstractContext;
+
+	Stg_Class_Delete( self->variable_Register );
+
+   /* unload all dynamic plugins */
+	PluginsManager_UnloadAll( self->plugins );
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Component_Delete( self );
+}
+
+void _AbstractContext_Print( void* abstractContext, Stream* stream ) {
+	AbstractContext* self = (AbstractContext*)abstractContext;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "AbstractContext (ptr)(%p):\n", self );
+	Journal_Printf( (void*) stream, "\tdictionary (ptr): %p\n", self->dictionary );
+	
+	/* Virtual info */
+	Journal_Printf( (void*) stream, "\t_setDt (ptr): %p\n", self->_setDt );
+	
+	/* AbstractContext info */
+	Journal_Printf( (void*) stream, "\tcommunicator: %i\n", self->communicator );
+	Journal_Printf( (void*) stream, "\tstartTime: %g\n", self->startTime );
+	Journal_Printf( (void*) stream, "\tstopTime: %g\n", self->stopTime );
+	Journal_Printf( (void*) stream, "\tcurrentTime: %g\n", self->currentTime );
+	Journal_Printf( (void*) stream, "\ttimeStep: %u\n", self->timeStep );
+	Journal_Printf( (void*) stream, "\ttimeStepSinceJobRestart: %u\n", self->timeStepSinceJobRestart );
+	Journal_Printf( (void*) stream, "\tmaxTimeSteps: %u\n", self->maxTimeSteps );
+	Journal_Printf( (void*) stream, "\tfinalTimeStep: %u\n", self->finalTimeStep );
+	Journal_Printf( (void*) stream, "\toutputEvery: %u\n", self->frequentOutputEvery );
+	Journal_Printf( (void*) stream, "\tdumpEvery: %u\n", self->dumpEvery );
+	Journal_Printf( (void*) stream, "\tcheckpointEvery: %u\n", self->checkpointEvery );
+   Journal_Printf( (void*) stream, "\tsaveDataEvery: %u\n", self->saveDataEvery );
+	Journal_Printf( (void*) stream, "\tcheckpointAtTimeInc: %g\n", self->checkpointAtTimeInc );
+
+	if( self->outputPath ) {
+		Journal_Printf( (void*) stream, "\toutputPath: %s\n", self->outputPath );
+	}
+	else {
+		Journal_Printf( (void*) stream, "\toutputPath: (null)\n" );
+	}
+
+	if( self->checkpointReadPath ) {
+		Journal_Printf( (void*) stream, "\tcheckpointReadPath: %s\n", self->checkpointReadPath );
+	}
+	else {
+		Journal_Printf( (void*) stream, "\tcheckpointReadPath: (null)\n" );
+	}
+
+	if( self->checkpointWritePath ) {
+		Journal_Printf( (void*) stream, "\tcheckpointWritePath: %s\n", self->checkpointWritePath );
+	}
+	else {
+		Journal_Printf( (void*) stream, "\tcheckpointWritePath: (null)\n" );
+	}
+
+	Journal_Printf( stream, "\tloadFromCheckPoint: %u\n", self->loadFromCheckPoint );
+	Journal_Printf( stream, "\trestartTimestep: %u\n", self->restartTimestep );
+	Journal_Printf( stream, "\tcheckPointPrefixString: %s\n", self->checkPointPrefixString );
+	
+	Stg_Class_Print( self->entryPoint_Register, stream );
+	
+	Journal_Printf( (void*) stream, "\tconstructK: %u\n", self->constructK );
+	Journal_Printf( (void*) stream, "\tconstructExtensionsK: %u\n", self->constructExtensionsK );
+	Journal_Printf( (void*) stream, "\tbuildK: %u\n", self->buildK );
+	Journal_Printf( (void*) stream, "\tinitialiseK: %u\n", self->initialiseK );
+	Journal_Printf( (void*) stream, "\texecuteK: %u\n", self->executeK );
+	Journal_Printf( (void*) stream, "\tdestroyK: %u\n", self->destroyK );
+	Journal_Printf( (void*) stream, "\tdestroyExtensionsK: %u\n", self->destroyExtensionsK );
+	
+	Journal_Printf( (void*) stream, "\tdt: %u\n", self->dtK );
+	Journal_Printf( (void*) stream, "\tstepK: %u\n", self->stepK );
+	Journal_Printf( (void*) stream, "\tsolveK: %u\n", self->solveK );
+	Journal_Printf( (void*) stream, "\tsyncK: %u\n", self->syncK );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+}
+
+
+/* Construct EP override stuff ****************************************************************************************************/
+
+
+Func_Ptr _AbstractContext_Construct_EP_GetRun( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	
+	switch( self->castType ) {
+		case EntryPoint_2VoidPtr_CastType:
+			return (void*) _AbstractContext_Construct_EP_Run;
+		
+		default:
+			return _EntryPoint_GetRun( self );
+	}
+	return 0;
+}
+
+void _AbstractContext_Construct_EP_Run( void* entryPoint, void* data0, void* data1 ) {
+	EntryPoint*		self = (EntryPoint*)entryPoint;
+	Hook_Index		hookIndex;
+	AbstractContext* 	context = (AbstractContext*)data0;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_2VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		((EntryPoint_2VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( context, NULL );
+		
+		self = KeyHandle( context, context->constructK );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+
+/* Component stuff ****************************************************************************************************************/
+
+
+void _AbstractContext_AssignFromXML( void* context, Stg_ComponentFactory* cf, void* data ) {
+	AbstractContext* 	self = (AbstractContext*)context;
+	Dictionary_Entry_Value* dictEntryVal = NULL;
+	double			startTime, stopTime;
+
+	Journal_Printf( self->debug, "In: %s\n", __func__ );
+
+   /* the following just pauses at this point to allow time to attach a debugger.. useful for mpi debugging */
+   sleep( Dictionary_Entry_Value_AsUnsignedInt(Dictionary_GetDefault( self->dictionary, "pauseToAttachDebugger", Dictionary_Entry_Value_FromUnsignedInt( 0 )) ) ); 
+      
+   /* this defines all the entryPoints, eg, self->constructK, etc...
+      so it must go before we start KeyCall */
+   _AbstractContext_Init( self );
+
+	/* Main input parameters */
+	self->frequentOutputEvery = Dictionary_Entry_Value_AsUnsignedInt( 
+		Dictionary_GetDefault( self->dictionary, "outputEvery", Dictionary_Entry_Value_FromUnsignedInt( 1 ) ) );
+	self->dumpEvery = Dictionary_Entry_Value_AsUnsignedInt( 
+		Dictionary_GetDefault( self->dictionary, "dumpEvery", Dictionary_Entry_Value_FromUnsignedInt( 10 ) ) );
+	self->checkpointEvery = Dictionary_Entry_Value_AsUnsignedInt( 
+		Dictionary_GetDefault( self->dictionary, "checkpointEvery", Dictionary_Entry_Value_FromUnsignedInt( 0 ) ) );
+	self->saveDataEvery = Dictionary_Entry_Value_AsUnsignedInt( 
+		Dictionary_GetDefault( self->dictionary, "saveDataEvery", Dictionary_Entry_Value_FromUnsignedInt( 0 ) ) );
+	self->checkpointAtTimeInc = Dictionary_Entry_Value_AsDouble( 
+		Dictionary_GetDefault( self->dictionary, "checkpointAtTimeInc", Dictionary_Entry_Value_FromDouble( 0 ) ) );
+	self->nextCheckpointTime = self->checkpointAtTimeInc;
+	self->experimentName = StG_Strdup( Dictionary_Entry_Value_AsString( 
+		Dictionary_GetDefault( self->dictionary, "experimentName", Dictionary_Entry_Value_FromString( "experiment" ) ) ) );
+	self->outputPath = StG_Strdup( Dictionary_Entry_Value_AsString( 
+		Dictionary_GetDefault( self->dictionary, "outputPath", Dictionary_Entry_Value_FromString( "./" ) ) ) );
+	
+   if( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointReadPath" )  ) {
+      self->checkpointReadPath = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointReadPath" ) ) );
+   }
+   else {
+      self->checkpointReadPath = StG_Strdup( self->outputPath  );
+   }
+   if( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointWritePath" )  ) {
+      self->checkpointWritePath = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"checkpointWritePath" ) ) );
+   }
+   else {
+      self->checkpointWritePath = StG_Strdup( self->outputPath  );
+   }
+
+	self->checkpointAppendStep = Dictionary_Entry_Value_AsBool( 
+		Dictionary_GetDefault( self->dictionary, "checkpointAppendStep", Dictionary_Entry_Value_FromBool( False ) ) ) ;
+	self->interpolateRestart = Dictionary_Entry_Value_AsBool( 
+		Dictionary_GetDefault( self->dictionary, "interpolateRestart", Dictionary_Entry_Value_FromBool( False ) ) ) ;
+	self->outputFlattenedXML = Dictionary_Entry_Value_AsBool( 
+		Dictionary_GetDefault( self->dictionary, "outputFlattenedXML", Dictionary_Entry_Value_FromBool( True ) ) ) ;
+
+	if ( self->rank == 0 ) {
+		if ( ! Stg_DirectoryExists( self->outputPath ) ) {
+			Bool ret;
+
+			if ( Stg_FileExists( self->outputPath ) ) {
+				Journal_Firewall( 
+					0, 
+					self->info, 
+					"outputPath '%s' is a file an not a directory! Exiting...\n", self->outputPath );
+			}
+			
+			Journal_Printf( self->info, "outputPath '%s' does not exist, attempting to create...\n", self->outputPath );
+			ret = Stg_CreateDirectory( self->outputPath );
+			Journal_Firewall( ret, self->info, "Unable to create non-existing outputPath to '%s'\n", self->outputPath );
+			/* else */
+			Journal_Printf( self->info, "outputPath '%s' successfully created!\n", self->outputPath );
+		}
+		if ( ! Stg_DirectoryExists( self->checkpointWritePath ) ) {
+			Bool ret;
+
+			if ( Stg_FileExists( self->checkpointWritePath ) ) {
+				Journal_Firewall( 
+					0, 
+					self->info, 
+					"checkpointWritePath '%s' is a file an not a directory! Exiting...\n", self->checkpointWritePath );
+			}
+			
+			Journal_Printf( self->info, "checkpointWritePath '%s' does not exist, attempting to create...\n", self->checkpointWritePath );
+			ret = Stg_CreateDirectory( self->checkpointWritePath );
+			Journal_Firewall( ret, self->info, "Unable to create non-existing checkpointWritePath to '%s'\n", self->checkpointWritePath );
+			/* else */
+			Journal_Printf( self->info, "checkpointWritePath '%s' successfully created!\n", self->checkpointWritePath );
+		}
+	}
+
+	if ( self->rank == 0 && self->outputFlattenedXML) {
+		XML_IO_Handler* ioHandler;
+		char*       inputfileRecord;
+		char*       inputfileRecordWithDateTimeStamp;
+		time_t      currTime;
+		struct tm*  timeInfo;
+		int         adjustedYear;
+		int         adjustedMonth;
+
+		Stream* s = Journal_Register( Info_Type, (Name)XML_IO_Handler_Type );
+
+		/* Avoid confusing messages from XML_IO_Handler...turn it off temporarily */
+		Bool isEnabled = Stream_IsEnable( s  );
+		Stream_EnableSelfOnly( s, False );
+
+		ioHandler = XML_IO_Handler_New();
+
+		/* Set file names */
+		Stg_asprintf( &inputfileRecord, "%s/%s", self->outputPath, "input.xml" );
+
+		currTime = time( NULL );
+		timeInfo = localtime( &currTime );
+		/* See man localtime() for why to adjust these */
+		adjustedYear = 1900 + timeInfo->tm_year;
+		adjustedMonth = 1 + timeInfo->tm_mon;
+		/* Format; path/input-YYYY.MM.DD-HH.MM.SS.xml */	
+		Stg_asprintf( &inputfileRecordWithDateTimeStamp, "%s/%s-%.4d.%.2d.%.2d-%.2d.%.2d.%.2d.%s", self->outputPath, "input", 
+			adjustedYear, adjustedMonth, timeInfo->tm_mday,
+			timeInfo->tm_hour, timeInfo->tm_min, timeInfo->tm_sec ,
+			"xml" );
+
+		IO_Handler_WriteAllToFile( ioHandler, inputfileRecord, self->dictionary );
+		IO_Handler_WriteAllToFile( ioHandler, inputfileRecordWithDateTimeStamp, self->dictionary );
+		
+		Stream_EnableSelfOnly( s, isEnabled );
+
+		Stg_Class_Delete( ioHandler );
+		Memory_Free( inputfileRecord );
+		Memory_Free( inputfileRecordWithDateTimeStamp );
+	}
+
+
+	/* Note: these try for deprecated keys "start", "end" and "stop" as well as new ones "startTime" and
+		"stopTime" - Main.PatrickSunter - 4 November 2004 */
+	startTime = stopTime = 0;
+	dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"start" );
+	if ( NULL == dictEntryVal  ) {
+		dictEntryVal = Dictionary_GetDefault( self->dictionary, "startTime",
+			Dictionary_Entry_Value_FromDouble( startTime ) );
+	}
+	self->startTime = Dictionary_Entry_Value_AsDouble( dictEntryVal );
+
+	dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"end" );
+	if ( NULL == dictEntryVal  ) {
+		dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"stop" );
+		if ( NULL == dictEntryVal  ) {
+			dictEntryVal = Dictionary_GetDefault( self->dictionary, "stopTime",
+				Dictionary_Entry_Value_FromDouble( stopTime ) );
+		}
+	} 
+	self->stopTime = Dictionary_Entry_Value_AsDouble( dictEntryVal );
+
+	/* maxTimeSteps of 0 means no maximum applied */
+	/* Note: these try for deprecated key "maxLoops" as well as new one "maxTimeSteps" - Main.PatrickSunter - 4 November 2004 */
+	dictEntryVal = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"maxLoops" );
+	if ( NULL == dictEntryVal  ) {
+		dictEntryVal = Dictionary_GetDefault( self->dictionary, "maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 0 ) );
+	}
+	self->maxTimeSteps = Dictionary_Entry_Value_AsUnsignedInt( dictEntryVal );
+
+	self->finalTimeStep = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "finalTimeStep", 0 );
+	self->gracefulQuit = False;
+
+	/* TODO: does this need to be read from checkpoint file??? */
+	self->currentTime = self->startTime;
+	self->timeStep = 0;
+	self->timeStepSinceJobRestart = 0;
+	
+	/* Read in the checkpointing info */
+	self->restartTimestep = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "restartTimestep", 0 );
+	self->checkPointPrefixString = Dictionary_GetString_WithDefault( self->dictionary, "checkPointPrefixString", "" );
+	if ( self->restartTimestep != 0 ) {
+		double dtFromFile;
+		self->loadFromCheckPoint = True;
+		self->timeStep = self->restartTimestep;
+		_AbstractContext_LoadTimeInfoFromCheckPoint( (void*)self, self->restartTimestep, &dtFromFile );
+		self->nextCheckpointTime += self->currentTime;
+	}
+	else {
+		self->loadFromCheckPoint = False;
+	}
+
+	/* Check if we have been provided a constant to multiply our calculated dt values by. */
+	self->dtFactor = Dictionary_GetDouble_WithDefault( self->dictionary, (Dictionary_Entry_Key)"timestepFactor", 1.0  );
+
+	/* construct entry point */
+	KeyCall( self, self->constructK, EntryPoint_2VoidPtr_CallCast* )( KeyHandle( self, self->constructK ), self, self );
+
+	/* Load the plugins desired by this context (dictionary) */
+	ModulesManager_Load( self->plugins, self->dictionary, self->name );
+
+	self->CF = cf;
+
+	/* Extensions are the last thing we want to do */
+	KeyCall( self, self->constructExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->constructExtensionsK), self );
+	
+	if( self->rank == 0 ) 
+		Context_PrintConcise( self, self->verbose );
+
+	if ( True == Dictionary_GetBool_WithDefault( self->dictionary, (Dictionary_Entry_Key)"showJournalStatus", False ) ) {
+		Journal_PrintConcise( );	
+	}	
+}
+
+
+void _AbstractContext_Build( void* context, void* data ) {
+	AbstractContext* 	self = (AbstractContext*)context;
+	Bool			isBuilt;
+	
+	Journal_Printf( self->debug, "In: %s\n", __func__ );
+
+	#ifdef DEBUG
+		Context_WarnIfNoHooks( self, self->buildK, __func__  );
+	#endif
+	
+	/* Pre-mark the phase as complete as a default hook will attempt to build all live components (including this again) */
+	isBuilt = self->isBuilt;
+	self->isBuilt = True;
+
+	/* Construct the list of plugins. do this in the build phase se that we know that any components required by the plugins 
+	 * have already been constructed */
+	if( self->plugins->codelets->count )
+		ModulesManager_ConstructModules( self->plugins, self->CF, data );
+
+	KeyCall( self, self->buildK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->buildK), self );
+	self->isBuilt = isBuilt;
+}
+
+
+void _AbstractContext_Initialise( void* context, void* data ) {
+	AbstractContext*	self = (AbstractContext*)context;
+	Bool			isInitialised;
+	
+	Journal_Printf( self->debug, "In: %s\n", __func__ );
+
+	#ifdef DEBUG
+		AbstractContext_WarnIfNoHooks( self, self->initialiseK, __func__ );
+	#endif
+	
+	/* Pre-mark the phase as complete as a default hook will attempt to initialise all live components (including this again) */
+	isInitialised = self->isInitialised;
+	self->isInitialised = True;
+	KeyCall( self, self->initialiseK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->initialiseK), self );
+	self->isInitialised = isInitialised;
+}
+
+
+void _AbstractContext_Execute( void* context, void* data ) {
+	AbstractContext* 	self = (AbstractContext*)context;
+	Bool			hasExecuted;
+	
+	Journal_Printf( self->debug, "In: %s\n", __func__ );
+
+	#ifdef DEBUG
+		AbstractContext_WarnIfNoHooks( self, self->executeK, __func__ );
+	#endif
+	
+	/* Pre-mark the phase as complete as a default hook will attempt to initialise all live components (including this again) */
+	hasExecuted = self->hasExecuted;
+	self->hasExecuted = True;
+	KeyCall( self, self->executeK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->executeK), self );
+	self->hasExecuted = hasExecuted;
+}
+
+
+void _AbstractContext_Destroy( void* context, void* data ) {
+	AbstractContext* self = (AbstractContext*)context;
+
+	Journal_Printf( self->debug, "In: %s\n", __func__ );
+
+	/* Pre-mark the phase as complete as a default hook will attempt to initialise all live components (including this again) */
+   PluginsManager_RemoveAllFromComponentRegister( self->plugins ); 
+
+  	KeyCall( self, self->destroyExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->destroyExtensionsK), self );
+  	KeyCall( self, self->destroyK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->destroyK), self );
+
+   Stg_Class_Delete( self->entryPoint_Register );
+   Stg_ObjectList_DeleteAllObjects( self->pointer_Register );
+   Stg_Class_Delete( self->pointer_Register );
+
+   /* remove the self->extensionMgr of this context from the extensionMgr_Register */
+	ExtensionManager_Register_Remove( extensionMgr_Register, self->extensionMgr );
+   Stg_Class_Delete( self->extensionMgr );
+	Stg_Class_Delete( self->dictionary );	
+
+	Memory_Free( self->experimentName );
+	Memory_Free( self->outputPath );
+	Memory_Free( self->checkpointReadPath );
+	Memory_Free( self->checkpointWritePath );
+}
+
+
+/* Context public stuff ***********************************************************************************************************/
+
+
+void AbstractContext_PrintConcise( void* abstractContext, Stream* stream ) {
+	AbstractContext* self = (AbstractContext*)abstractContext;
+	EntryPoint_Index entryPointIndex;
+
+	Journal_Printf( stream, "Context: %s\n", self->type );
+	for( entryPointIndex = 0; entryPointIndex < self->entryPoint_Register->count; entryPointIndex++ ) {
+		EntryPoint_PrintConcise( EntryPoint_Register_At( self->entryPoint_Register, entryPointIndex ), stream );
+	}
+}
+
+
+EntryPoint_Index AbstractContext_AddEntryPoint( 
+		void*				abstractContext,
+		void*				entryPoint )
+{
+	AbstractContext* self = (AbstractContext*)abstractContext;
+
+	return EntryPoint_Register_Add( self->entryPoint_Register, entryPoint );
+}
+
+
+EntryPoint* AbstractContext_GetEntryPoint( void* abstractContext, Name entryPointName ) {
+	AbstractContext*	self = (AbstractContext*)abstractContext;
+	EntryPoint_Index	ep_I;
+
+	/* Find the entry point */
+	ep_I = EntryPoint_Register_GetHandle( self->entryPoint_Register, entryPointName );
+	if( ep_I == (unsigned)-1 ) {
+		return 0;
+	}
+	else {
+		return EntryPoint_Register_At( self->entryPoint_Register, ep_I );
+	}
+}
+
+
+Func_Ptr _AbstractContext_Call( void* abstractContext, Name entryPointName, void** epPtr ) {
+	AbstractContext*	self = (AbstractContext*)abstractContext;
+	EntryPoint_Index	ep_I;
+	
+	/* Find the entry point */
+	ep_I = EntryPoint_Register_GetHandle( self->entryPoint_Register, entryPointName );
+	if( ep_I == (unsigned)-1 ) {
+		*epPtr = 0;
+	}
+	else {
+		*epPtr = EntryPoint_Register_At( self->entryPoint_Register, ep_I );
+	}
+	
+	/* ... and run it */
+	if( *epPtr != 0 ) {
+		return ((EntryPoint*) (*epPtr))->run;
+	}
+	return 0;
+}
+
+
+double AbstractContext_Dt( void* context ) {
+	AbstractContext* self = (AbstractContext*)context;
+
+	AbstractContext_ErrorIfNoHooks( self, self->dtK, __func__ );
+	return KeyCall( self, self->dtK, ContextEntryPoint_Dt_CallCast* )( KeyHandle(self,self->dtK), self );
+}
+
+void AbstractContext_Step( void* context, double dt ) {
+	AbstractContext* self = (AbstractContext*)context;
+	#if DEBUG
+		AbstractContext_WarnIfNoHooks( self, self->stepK, __func__ );
+	#endif
+	KeyCall( self, self->stepK, ContextEntryPoint_Step_CallCast* )( KeyHandle(self,self->stepK), self, dt );
+}
+
+
+void AbstractContext_WarnIfNoHooks( void* context, EntryPoint_Index epIndex, Name caller ) {
+	AbstractContext* self = (AbstractContext*)context;
+	EntryPoint_WarnIfNoHooks( EntryPoint_Register_At( self->entryPoint_Register, epIndex ), caller );
+}
+
+
+void AbstractContext_ErrorIfNoHooks( void* context, EntryPoint_Index epIndex, Name caller ) {
+	AbstractContext* self = (AbstractContext*)context;
+	EntryPoint_ErrorIfNoHooks( EntryPoint_Register_At( self->entryPoint_Register, epIndex ), caller );
+}
+
+void AbstractContext_FrequentOutput( void* context ) {
+	AbstractContext* self = (AbstractContext*)context;
+
+	KeyCall( self, self->frequentOutputK, EntryPoint_VoidPtr_CallCast* )( 
+			KeyHandle(self,self->frequentOutputK), self );
+}
+
+void AbstractContext_Dump( void* context ) {
+	AbstractContext* self = (AbstractContext*)context;
+
+	KeyCall( self, self->dumpK, EntryPoint_VoidPtr_CallCast* )(      
+			KeyHandle(self,self->dumpK), self );
+	KeyCall( self, self->dumpClassK, EntryPoint_Class_VoidPtr_CallCast* )(
+			KeyHandle(self,self->dumpClassK), self );
+}
+
+void AbstractContext_Save( void* context ) {
+	AbstractContext* self = (AbstractContext*)context;
+
+	KeyCall( self, self->saveK, EntryPoint_VoidPtr_CallCast* )(     
+			KeyHandle(self,self->saveK), self );
+	KeyCall( self, self->saveClassK, EntryPoint_Class_VoidPtr_CallCast* )(      
+			KeyHandle(self,self->saveClassK), self );
+}
+
+void AbstractContext_DataSave( void* context ) {
+	AbstractContext* self = (AbstractContext*)context;
+
+	KeyCall( self, self->dataSaveK, EntryPoint_VoidPtr_CallCast* )(     
+			KeyHandle(self,self->dataSaveK), self );
+	KeyCall( self, self->dataSaveClassK, EntryPoint_Class_VoidPtr_CallCast* )(      
+			KeyHandle(self,self->dataSaveClassK), self );
+}
+
+/* Context hooks ******************************************************************************************************************/
+
+void _AbstractContext_Construct_Hook( void* _context, void* data ) {
+
+}
+
+void _AbstractContext_Execute_Hook( void* _context ) {
+	AbstractContext*   self = (AbstractContext*)_context;
+	double             dt = 0;
+	double             dtLoadedFromFile = 0;
+	
+	if (self->maxTimeSteps) {
+		Journal_RPrintf( self->info, "Run until %u timeSteps have been run\n", self->maxTimeSteps );
+	}
+	if (self->finalTimeStep ) {
+		if (self->maxTimeSteps ) {
+			Journal_RPrintf( self->info, "or " );
+		}	
+		else {
+			Journal_RPrintf( self->info, "Run " );
+		}
+		Journal_Printf( self->info, "until absolute time step %u reached\n", self->stopTime );
+	}
+	
+	if (self->stopTime) {
+		if (self->maxTimeSteps || self->finalTimeStep ) {
+			Journal_RPrintf( self->info, "or " );
+		}	
+		else {
+			Journal_RPrintf( self->info, "Run " );
+		}
+		Journal_RPrintf( self->info, "until simulation time passes %g.\n", self->stopTime );
+	}
+	
+	self->timeStepSinceJobRestart = 1;
+
+	/* Set timeStep to 0 if not restarting, so that incrementing timestep below affects both
+		regular and restart mode -- PatrickSunter - 18 June 2006 */
+	if ( False == self->loadFromCheckPoint ) {
+		self->timeStep = 0;
+		self->currentTime = self->startTime;
+	}
+	
+	self->timeStep++;
+
+	while( !self->gracefulQuit ) {
+		if ( ( True == self->loadFromCheckPoint ) &&
+			( self->timeStep == self->restartTimestep + 1 ) )
+		{ 
+			/* Note: when checkpointing time info, we called AbstractContext_Dt( self )
+			at the end of the step we were restarting from, which should be equivalent to the
+			call here - and that calculation may be dependent on the solver info for that step,
+			so we need to reload it here */
+			_AbstractContext_LoadTimeInfoFromCheckPoint( (void*)self, self->restartTimestep, &dtLoadedFromFile );
+			dt = dtLoadedFromFile;
+		}	
+		else {
+			dt = self->dtFactor * AbstractContext_Dt( self );
+		}
+
+		AbstractContext_Step( self, dt );
+
+		self->currentTime += dt;
+
+		if ( self->frequentOutputEvery ) {
+			if ( self->timeStep % self->frequentOutputEvery == 0 )
+				AbstractContext_FrequentOutput( self );
+		}	
+		if ( self->dumpEvery ) {
+			if ( self->timeStep % self->dumpEvery == 0 )
+				AbstractContext_Dump( self );
+		}	
+		if ( self->checkpointEvery ) {
+			if ( self->timeStep % self->checkpointEvery == 0 ){
+				AbstractContext_Save( self );
+         }
+		}	
+
+		if ( self->saveDataEvery ) {
+			if ( self->timeStep % self->saveDataEvery == 0 ){
+				AbstractContext_DataSave( self );
+         }
+		}	
+
+		if ( self->checkpointAtTimeInc ) {
+			if ( self->currentTime >= self->nextCheckpointTime){
+				AbstractContext_Save( self );
+				self->nextCheckpointTime += self->checkpointAtTimeInc; 
+			}
+		}	
+
+		if (self->maxTimeSteps && (self->timeStepSinceJobRestart >= self->maxTimeSteps)) break;
+		if (self->finalTimeStep && (self->timeStep >= self->finalTimeStep)) break;
+		if (self->stopTime && (self->currentTime >= self->stopTime)) break; 
+
+		stg_log_printf( "========================= Done step %d =========================\n\n", self->timeStep );
+		
+		self->timeStep++;
+		self->timeStepSinceJobRestart++;
+	}
+}
+
+
+void _AbstractContext_Step( void* _context, double dt ) {
+	AbstractContext* self = (AbstractContext*)_context;
+        Bool enabled;
+	
+	/* This will make it clear where the timestep starts when several procs
+	 * running. Figure this 1 synchronisation is ok since we are likely to
+	 * have just synchronised while calculating timestep anyway. */
+	MPI_Barrier( self->communicator );
+	Journal_DPrintf( self->debug, "In: %s\n", __func__ );
+
+        enabled=Stream_IsEnable(self->info);
+        Stream_Enable(self->info,True);
+	Journal_RPrintf( self->info, "TimeStep = %d, Time = %.6g\n",
+		self->timeStep-1, self->currentTime+dt );
+        Stream_Enable(self->info,enabled);
+
+	if (self->loadFromCheckPoint) {
+		Journal_RPrintf( self->info, "TimeStep since job restart = %d\n", self->timeStepSinceJobRestart );
+	}
+
+	#ifdef DEBUG
+		Context_WarnIfNoHooks( self, self->solveK, __func__ );	
+	#endif
+
+	self->_setDt( self, dt );
+	KeyCall( self, self->solveK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->solveK), self );
+	KeyCall( self, self->postSolveK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->postSolveK), self );	
+	KeyCall( self, self->updateClassK, EntryPoint_Class_VoidPtr_CallCast* )( KeyHandle(self,self->updateClassK), self );
+	KeyCall( self, self->syncK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(self,self->syncK), self );
+}
+
+
+void _AbstractContext_LoadTimeInfoFromCheckPoint( void* _context, Index timeStep, double* dtLoadedFromFile ) {
+	AbstractContext*       self = (AbstractContext*)_context;
+	char*                  timeInfoFileName = NULL;
+	char*                  timeInfoFileNamePart = NULL;
+	FILE*                  timeInfoFile;		
+	Stream*                errorStr = Journal_Register( Error_Type, (Name)self->type  );
+
+#ifdef READ_HDF5
+	hid_t             file, fileSpace, fileData;
+#endif
+
+	
+   timeInfoFileNamePart = Context_GetCheckPointReadPrefixString( self );
+#ifdef WRITE_HDF5
+	timeInfoFile = NULL;
+   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.h5", timeInfoFileNamePart, self->restartTimestep );
+	 
+	/* Open the file and data set. */
+	file = H5Fopen( timeInfoFileName, H5F_ACC_RDONLY, H5P_DEFAULT );
+	Journal_Firewall( 
+		file >= 0, 
+		errorStr, "\n\nError- in %s(), Couldn't find checkpoint time info file with "
+		"filename \"%s\" - aborting.\n", __func__, timeInfoFileName );
+		   	
+	/* Read currentTime from file */
+	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+	fileData = H5Dopen( file, "/currentTime" );
+	#else
+	fileData = H5Dopen2( file, "/currentTime", H5P_DEFAULT );
+	#endif
+	fileSpace = H5Dget_space( fileData );
+	   
+	H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &self->currentTime );
+	   
+	H5Sclose( fileSpace );
+	H5Dclose( fileData );
+	
+	/* Read Dt from file */
+	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+	fileData = H5Dopen( file, "/Dt" );
+	#else
+	fileData = H5Dopen2( file, "/Dt", H5P_DEFAULT );
+	#endif
+	fileSpace = H5Dget_space( fileData );
+	   
+	H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dtLoadedFromFile );
+	   
+	H5Sclose( fileSpace );
+	H5Dclose( fileData );
+
+	H5Fclose( file );
+	   
+#else	
+   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.dat", timeInfoFileNamePart, self->restartTimestep );
+	 
+	timeInfoFile = fopen( timeInfoFileName, "r" );
+	Journal_Firewall( NULL != timeInfoFile, errorStr, "Error- in %s(), Couldn't find checkpoint time info file with "
+		"filename \"%s\" (HD5 not enabled) - aborting.\n", __func__, timeInfoFileName );
+
+	/* set currentTime and Dt loaded from file */
+	fscanf( timeInfoFile, "%lg", &self->currentTime );
+	fscanf( timeInfoFile, "%lg", dtLoadedFromFile );
+	fclose( timeInfoFile );
+#endif
+	
+	Memory_Free( timeInfoFileName );
+   Memory_Free( timeInfoFileNamePart );
+}
+		
+
+void _AbstractContext_SaveTimeInfo( void* _context ) {
+	AbstractContext*       self = (AbstractContext*)_context;	
+	FILE*                  timeInfoFile = NULL;
+	char*                  timeInfoFileName = NULL;
+   char*                  timeInfoFileNamePart = NULL;
+	Stream*                errorStr = Journal_Register( Error_Type, (Name)self->type  );
+#ifdef WRITE_HDF5
+	hid_t                  file, fileSpace, fileData, props;
+	hsize_t                count;
+	double                 Dt;
+#endif 
+
+	/* Only the master process needs to write this file */
+	if ( self->rank == 0 ) {
+   timeInfoFileNamePart = Context_GetCheckPointWritePrefixString( self );
+#ifdef WRITE_HDF5
+	timeInfoFile = NULL;
+   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.h5", timeInfoFileNamePart, self->timeStep );
+	
+	/* Create parallel file property list. */
+	props = H5Pcreate( H5P_FILE_ACCESS );
+	
+	/* Open the HDF5 output file. */
+	file = H5Fcreate( timeInfoFileName, H5F_ACC_TRUNC, H5P_DEFAULT, props );
+	Journal_Firewall( 
+		file >= 0, 
+		errorStr,
+		"Error in %s for %s '%s' - Cannot create file %s.\n", 
+		__func__, 
+		self->type, 
+		self->name, 
+		timeInfoFileName );
+		
+	H5Pclose( props );
+
+	/* Dump currentTime */
+	count = 1;
+	fileSpace = H5Screate_simple( 1, &count, NULL );         
+	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+	fileData = H5Dcreate( file, "/currentTime", H5T_NATIVE_DOUBLE, fileSpace, H5P_DEFAULT );
+	#else
+	fileData = H5Dcreate2( file, "/currentTime", H5T_NATIVE_DOUBLE, fileSpace,
+	                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+	#endif
+	      
+	props = H5Pcreate( H5P_DATASET_XFER );
+	H5Dwrite( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, props, &(self->currentTime) );
+	H5Pclose( props );
+	H5Dclose( fileData );
+	H5Sclose( fileSpace );
+	
+	/* Dump Dt */
+	fileSpace = H5Screate_simple( 1, &count, NULL );         
+	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+	fileData = H5Dcreate( file, "/Dt", H5T_NATIVE_DOUBLE, fileSpace, H5P_DEFAULT );
+	#else
+	fileData = H5Dcreate2( file, "/Dt", H5T_NATIVE_DOUBLE, fileSpace,
+	                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+	#endif
+	      
+	props = H5Pcreate( H5P_DATASET_XFER );
+	Dt = AbstractContext_Dt( self );
+	H5Dwrite( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, props, &Dt );
+	H5Pclose( props );
+	H5Dclose( fileData );
+	H5Sclose( fileSpace );
+	
+	/* Dump nproc */
+	fileSpace = H5Screate_simple( 1, &count, NULL );         
+	#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+	fileData = H5Dcreate( file, "/nproc", H5T_NATIVE_INT, fileSpace, H5P_DEFAULT );
+	#else
+	fileData = H5Dcreate2( file, "/nproc", H5T_NATIVE_INT, fileSpace,
+	                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+	#endif
+	      
+	props = H5Pcreate( H5P_DATASET_XFER );
+	H5Dwrite( fileData, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, props, &(self->nproc) );
+	H5Pclose( props );
+	H5Dclose( fileData );
+	H5Sclose( fileSpace );
+	
+	H5Fclose( file );
+	
+	
+#else	
+   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.dat", timeInfoFileNamePart, self->timeStep );
+	 
+	timeInfoFile = fopen( timeInfoFileName, "w" );
+
+	if ( False == timeInfoFile ) {
+		Journal_Printf( errorStr, "Error- in %s(), Couldn't create checkpoint time info file with "
+		"filename \"%s\" - aborting.\n", __func__, timeInfoFileName );
+		exit(EXIT_FAILURE);
+	}
+
+	/* set currentTime and Dt loaded from file */
+	fprintf( timeInfoFile, "%lg ", self->currentTime );
+	fprintf( timeInfoFile, "%lg\n", AbstractContext_Dt( self ) );
+	fclose( timeInfoFile );
+#endif
+	
+	Memory_Free( timeInfoFileName );
+   Memory_Free( timeInfoFileNamePart );
+} 
+}
+
+
+Bool AbstractContext_CheckPointExists( void* context, Index timeStep ) {
+  AbstractContext*       self = (AbstractContext*)context;	
+	char*                  timeInfoFileName = NULL;
+	char*                  timeInfoFileNamePart = NULL;   
+	struct stat            statInfo;
+	int                    statResult;
+
+   timeInfoFileNamePart = Context_GetCheckPointWritePrefixString( self );
+#ifdef WRITE_HDF5
+   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.h5", timeInfoFileNamePart, timeStep );
+#else	
+   Stg_asprintf( &timeInfoFileName, "%stimeInfo.%.5u.dat", timeInfoFileNamePart, timeStep );
+#endif	
+	statResult = stat( timeInfoFileName, &statInfo );
+
+	Memory_Free( timeInfoFileName );
+   Memory_Free( timeInfoFileNamePart );
+
+	if ( 0 == statResult ) {
+		return True;
+	}
+	else {
+		return False;
+	}
+}
+
+char* Context_GetCheckPointReadPrefixString( void* context ) {
+  AbstractContext*	self = (AbstractContext*)context;	
+	char*					readPathString = NULL;
+
+   if ( self->checkpointAppendStep ) {
+      if ( strlen(self->checkPointPrefixString) > 0 ) {
+         Stg_asprintf( &readPathString, "%s/data.%.5u/%s.", self->checkpointReadPath, self->restartTimestep, self->checkPointPrefixString );
+      }
+      else {
+         Stg_asprintf( &readPathString, "%s/data.%.5u/", self->checkpointReadPath, self->restartTimestep );
+      }
+   } else {
+      if ( strlen(self->checkPointPrefixString) > 0 ) {
+         Stg_asprintf( &readPathString, "%s/%s.", self->checkpointReadPath, self->checkPointPrefixString );
+      }
+      else {
+         Stg_asprintf( &readPathString, "%s/", self->checkpointReadPath );
+      }
+   }
+
+	return readPathString;
+}
+
+char* Context_GetCheckPointWritePrefixString( void* context ) {
+  AbstractContext*	self = (AbstractContext*)context;	
+	char*					writePathString = NULL;
+
+   if ( self->checkpointAppendStep ) {
+      if ( strlen(self->checkPointPrefixString) > 0 ) {
+         Stg_asprintf( &writePathString, "%s/data.%.5u/%s.", self->checkpointWritePath, self->timeStep, self->checkPointPrefixString );
+      }
+      else {
+         Stg_asprintf( &writePathString, "%s/data.%.5u/", self->checkpointWritePath, self->timeStep );
+      }
+   } else {
+      if ( strlen(self->checkPointPrefixString) > 0 ) {
+         Stg_asprintf( &writePathString, "%s/%s.", self->checkpointWritePath, self->checkPointPrefixString );
+      }
+      else {
+         Stg_asprintf( &writePathString, "%s/", self->checkpointWritePath );
+      }
+   }
+
+	return writePathString;
+}
+
+void _AbstractContext_CreateCheckpointDirectory( void* _context ) {
+	AbstractContext*       self = (AbstractContext*)_context;	
+   /* if we are creating individual directories for each checkpoint timestep, first create the directory if it doesn't exist. */
+   if ( self->checkpointAppendStep ) {
+      /* Only the master process creates the directory */      
+      if ( self->rank == 0 ) {
+         char*                  writePathString = NULL;
+         Stg_asprintf( &writePathString, "%s/data.%.5u/", self->checkpointWritePath, self->timeStep );
+         if ( ! Stg_DirectoryExists( writePathString ) ) {
+            Bool ret;
+            if ( Stg_FileExists( writePathString ) )
+               Journal_Firewall( 
+                  0, 
+                  self->info, 
+                  "checkpoint outputPath '%s' is a file an not a directory! Exiting...\n", self->outputPath );
+            ret = Stg_CreateDirectory( writePathString );
+            Journal_Firewall( ret, self->info, "Unable to create non-existing outputPath to '%s'\n", self->outputPath );
+         }
+         /* other processes may proceed now that required directory has been created */
+         MPI_Barrier( self->communicator );
+			Memory_Free( writePathString );
+			writePathString = NULL;
+      } else
+      /* barrier to stop other processes continuing until required directory has been created */ 
+      MPI_Barrier( self->communicator );
+   }
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Codelet.c
--- a/Base/Context/src/Codelet.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-*/
-/** \file
-**  Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: Codelet.c 3192 2005-08-25 01:45:42Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "AbstractContext.h"
-#include "Codelet.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	AllocationType nameAllocationType = NON_GLOBAL;
-
-const Type Codelet_Type = "Codelet";
-
-void* Codelet_New(
-		Type                                            type,
-		Stg_Component_DefaultConstructorFunction*       _defaultConstructor,
-		Stg_Component_ConstructFunction*                _construct,
-		Stg_Component_BuildFunction*                    _build,
-		Stg_Component_InitialiseFunction*               _initialise,
-		Stg_Component_ExecuteFunction*                  _execute,
-		Stg_Component_DestroyFunction*                  _destroy,
-		Name                                            name )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof( Codelet );
-	Stg_Class_DeleteFunction*      _delete = _Codelet_Delete;
-	Stg_Class_PrintFunction*        _print = _Codelet_Print;
-	Stg_Class_CopyFunction*          _copy = _Codelet_Copy;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Codelet_New(  CODELET_PASSARGS  );
-}
-
-void* _Codelet_New(  CODELET_DEFARGS  )
-{
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-}
-
-void  _Codelet_Delete( void* codelet ) {
-	_Stg_Component_Delete( codelet );
-}
-void  _Codelet_Print( void* codelet, Stream* stream ) {
-	Codelet* self = (Codelet*)codelet;
-	
-	Journal_Printf( stream, "Codelet: %s, Type %s\n", self->name, self->type );
-	_Stg_Component_Print( self, stream );
-}
-void* _Codelet_Copy( const void* codelet, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	return _Stg_Component_Copy( codelet, dest, deep, nameExt, ptrMap );
-}
-
-
-void  _Codelet_Build( void* codelet, void* data ) {
-
-}
-void  _Codelet_Initialise( void* codelet, void* data ) {
-
-}
-void  _Codelet_Execute( void* codelet, void* data ) {
-
-}
-void  _Codelet_Destroy( void* codelet, void* data ) {
-
-}
-
-Dictionary* Codelet_GetPluginDictionary( void* codelet, Dictionary* rootDict ) {
-	Codelet*		self		= (Codelet*)codelet;
-	Dictionary_Entry_Value*	pluginsDEV	= Dictionary_Get( rootDict, "plugins" );
-	Dictionary*		pluginDict;
-	unsigned		pluginIndex;
-	Name			pluginType;
-	
-	for( pluginIndex = 0; pluginIndex < Dictionary_Entry_Value_GetCount( pluginsDEV ); pluginIndex++ ) {
-		pluginDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value_GetElement( pluginsDEV, pluginIndex ) );
-		pluginType = Dictionary_GetString( pluginDict, "Type" );
-		if( !strcmp( self->type, pluginType ) )
-			return pluginDict;	
-	}
-
-	return NULL;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Codelet.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/Codelet.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,139 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Codelet.c 3192 2005-08-25 01:45:42Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "AbstractContext.h"
+#include "Codelet.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	AllocationType nameAllocationType = NON_GLOBAL;
+
+const Type Codelet_Type = "Codelet";
+
+void* Codelet_New(
+		Type                                            type,
+		Stg_Component_DefaultConstructorFunction*       _defaultConstructor,
+		Stg_Component_ConstructFunction*                _construct,
+		Stg_Component_BuildFunction*                    _build,
+		Stg_Component_InitialiseFunction*               _initialise,
+		Stg_Component_ExecuteFunction*                  _execute,
+		Stg_Component_DestroyFunction*                  _destroy,
+		Name                                            name )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof( Codelet );
+	Stg_Class_DeleteFunction*      _delete = _Codelet_Delete;
+	Stg_Class_PrintFunction*        _print = _Codelet_Print;
+	Stg_Class_CopyFunction*          _copy = _Codelet_Copy;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Codelet_New(  CODELET_PASSARGS  );
+}
+
+void* _Codelet_New(  CODELET_DEFARGS  )
+{
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	return _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+}
+
+void  _Codelet_Delete( void* codelet ) {
+	_Stg_Component_Delete( codelet );
+}
+void  _Codelet_Print( void* codelet, Stream* stream ) {
+	Codelet* self = (Codelet*)codelet;
+	
+	Journal_Printf( stream, "Codelet: %s, Type %s\n", self->name, self->type );
+	_Stg_Component_Print( self, stream );
+}
+void* _Codelet_Copy( const void* codelet, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	return _Stg_Component_Copy( codelet, dest, deep, nameExt, ptrMap );
+}
+
+
+void  _Codelet_Build( void* codelet, void* data ) {
+
+}
+void  _Codelet_Initialise( void* codelet, void* data ) {
+
+}
+void  _Codelet_Execute( void* codelet, void* data ) {
+
+}
+void  _Codelet_Destroy( void* codelet, void* data ) {
+
+}
+
+Dictionary* Codelet_GetPluginDictionary( void* codelet, Dictionary* rootDict ) {
+	Codelet*		self		= (Codelet*)codelet;
+	Dictionary_Entry_Value*	pluginsDEV	= Dictionary_Get( rootDict, "plugins" );
+	Dictionary*		pluginDict;
+	unsigned		pluginIndex;
+	Name			pluginType;
+	
+	for( pluginIndex = 0; pluginIndex < Dictionary_Entry_Value_GetCount( pluginsDEV ); pluginIndex++ ) {
+		pluginDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value_GetElement( pluginsDEV, pluginIndex ) );
+		pluginType = Dictionary_GetString( pluginDict, "Type" );
+		if( !strcmp( self->type, pluginType ) )
+			return pluginDict;	
+	}
+
+	return NULL;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/CompositeVC.c
--- a/Base/Context/src/CompositeVC.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,655 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: CompositeVC.c 4298 2008-08-25 01:14:56Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "VariableCondition.h"
-#include "VariableCondition_Register.h"
-#include "ConditionFunction.h"
-#include "ConditionFunction_Register.h"
-#include "ContextEntryPoint.h"
-#include "AbstractContext.h"
-#include "CompositeVC.h"
-
-#include <string.h>
-#include <assert.h>
-
-
-const Type CompositeVC_Type = "CompositeVC";
-const Name defaultCompositeVCName = "defaultCompositeVCName";
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* CompositeVC_Factory(
-	AbstractContext*					context,
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register,
-	Dictionary*							dictionary,
-	void*									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,
-	void*									data )
-{
-	CompositeVC* self = _CompositeVC_DefaultNew( name );
-
-	self->isConstructed = True;
-	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
-	_CompositeVC_Init( self, data );
-
-	return self;
-}
-
-CompositeVC* _CompositeVC_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(CompositeVC);
-	Type                                                      type = CompositeVC_Type;
-	Stg_Class_DeleteFunction*                              _delete = _CompositeVC_Delete;
-	Stg_Class_PrintFunction*                                _print = _CompositeVC_Print;
-	Stg_Class_CopyFunction*                                  _copy = _CompositeVC_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_CompositeVC_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _CompositeVC_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _CompositeVC_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _VariableCondition_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _VariableCondition_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _CompositeVC_Destroy;
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-	VariableCondition_BuildSelfFunc*                    _buildSelf = NULL;
-	VariableCondition_PrintConciseFunc*              _printConcise = _CompositeVC_PrintConcise;
-	VariableCondition_ReadDictionaryFunc*          _readDictionary = _CompositeVC_ReadDictionary;
-	VariableCondition_GetSetFunc*                          _getSet = _CompositeVC_GetSet;
-	VariableCondition_GetVariableCountFunc*      _getVariableCount = _CompositeVC_GetVariableCount;
-	VariableCondition_GetVariableIndexFunc*      _getVariableIndex = _CompositeVC_GetVariableIndex;
-	VariableCondition_GetValueIndexFunc*            _getValueIndex = _CompositeVC_GetValueIndex;
-	VariableCondition_GetValueCountFunc*            _getValueCount = _CompositeVC_GetValueCount;
-	VariableCondition_GetValueFunc*                      _getValue = _CompositeVC_GetValue;
-	VariableCondition_ApplyFunc*                            _apply = _CompositeVC_Apply;
-
-	return (CompositeVC*)_CompositeVC_New(  COMPOSITEVC_PASSARGS  );
-}
-
-CompositeVC* _CompositeVC_New(  COMPOSITEVC_DEFARGS  ) {
-	CompositeVC* self;
-	
-	/* Allocate memory/General info */
-	assert (_sizeOfSelf >= sizeof(CompositeVC) );
-	self = (CompositeVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	
-	return self;
-}
-
-
-void _CompositeVC_Init( void* compositeVC, void* data ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	
-	self->isConstructed = True;
-	self->itemCount = 0;
-	self->nIndepItems = 0;
-	self->indepItems = NULL;
-	self->_size = 8;
-	self->_delta = 8;
-	self->itemTbl = Memory_Alloc_Array( VariableCondition*, self->_size, "CompositeCV->itemTbl" );
-	memset(self->itemTbl, 0 , sizeof(VariableCondition*)*self->_size);
-	self->iOwnTbl = Memory_Alloc_Array( Bool, self->_size, "CompositeCV->iOwnTbl" );
-	memset(self->iOwnTbl, 0, sizeof(Bool)*self->_size);
-	self->data = data;
-	self->attachedSets = 0;
-	self->hasReadDictionary = False;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _CompositeVC_ReadDictionary( void* compositeVC, void* dictionary ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-
-	/* View the dictionary as a list of variable conditions */
-	if( dictionary && !self->hasReadDictionary ) {
-		Dictionary_Entry_Value*	vcList;
-		
-		vcList = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"independentVCList" );
-
-		if( vcList ) {
-			Index	count;
-			Index	entry_I;
-			
-			count = Dictionary_Entry_Value_GetCount(vcList);
-
-			for (entry_I = 0; entry_I < count; entry_I++ ) {
-				Dictionary_Entry_Value*	vcEntry;
-				Type			type;
-				Dictionary*		dictionary;
-				VariableCondition*	vc;
-				
-				vcEntry = Dictionary_Entry_Value_GetElement(vcList, entry_I);
-				type = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( vcEntry, (Dictionary_Entry_Key)"type"));
-				dictionary = Dictionary_Entry_Value_AsDictionary(vcEntry );
-				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 );
-
-				self->nIndepItems++;
-				self->indepItems = ReallocArray( self->indepItems, VariableCondition*, self->nIndepItems );
-				self->indepItems[self->nIndepItems - 1] = vc;
-
-				/* Don't add so we can modify the matrix later.
-				CompositeVC_Add(self, vc, True);
-				*/
-			}
-		}
-		vcList = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"vcList" );
-
-		if( vcList ) {
-			Index	count;
-			Index	entry_I;
-			
-			count = Dictionary_Entry_Value_GetCount(vcList);
-
-			for (entry_I = 0; entry_I < count; entry_I++ ) {
-				Dictionary_Entry_Value*	vcEntry;
-				Type			type;
-				Dictionary*		dictionary;
-				VariableCondition*	vc;
-				
-				vcEntry = Dictionary_Entry_Value_GetElement(vcList, entry_I);
-				type = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( vcEntry, (Dictionary_Entry_Key)"type"));
-				dictionary = Dictionary_Entry_Value_AsDictionary(vcEntry );
-				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);
-			}
-		}
-		self->hasReadDictionary = True;
-	}
-}
-
-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;
-	AbstractContext*	context;
-	
-	/* Need to store this so we can get at components
-		later on when using the fucked up 'ReadDictionary' function. */
-	self->cf = cf;
-
-	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !context  )
-		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
-	
-	variableRegister = context->variable_Register;
-	assert( variableRegister );
-	conditionFunctionRegister = condFunc_Register; 
-	assert( conditionFunctionRegister  );
-	
-	vcName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"vcName", self->name );
-
-	if ( cf->rootDict  )
-		vcDict = Dictionary_GetDictionary( cf->rootDict, vcName );
-
-	initData = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Data", Stg_Component, False, data  );
-	
-	_VariableCondition_Init( self, context,
-                                 (Variable_Register*)variableRegister,
-                                 (ConditionFunction_Register*)conditionFunctionRegister, vcDict );
-	_CompositeVC_Init( self, initData );
-}
-
-void _CompositeVC_Delete(void* compositeVC) {
-	CompositeVC* self = (CompositeVC*)compositeVC;
-	
-	/* Stg_Class_Delete parent */
-	_VariableCondition_Delete(self);
-}
-
-void _CompositeVC_Destroy(void* compositeVC, void* data) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	int				ii;
-
-	if( self->indepItems ) {
-		for( ii = 0; ii < self->nIndepItems; ii++ )
-         _VariableCondition_Delete( self->indepItems[ii]);
-		Memory_Free( self->indepItems );
-	}
-	
-	if (self->itemTbl) {
-		VariableCondition_Index	entry_I;
-		
-		for (entry_I = 0; entry_I < self->itemCount; entry_I++) {
-			if (self->iOwnTbl[entry_I] && self->itemTbl[entry_I])
-				//Stg_Component_Destroy( self->itemTbl[entry_I], NULL, False );
-				_VariableCondition_Delete( self->itemTbl[entry_I]);
-		}
-		Memory_Free(self->itemTbl);
-	}
-	
-	if( self->attachedSets ) {
-		Memory_Free( self->attachedSets );
-	}
-
-   Stg_Component_Destroy( self->data, NULL, False );
-
-	_VariableCondition_Destroy( self, data );
-}
-
-void _CompositeVC_Print(void* compositeVC, Stream* stream) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	Index				item_I;
-	
-	/* Set the Journal for printing informations */
-	Stream* info = stream;
-	
-	/* General info */
-	Journal_Printf( info, "CompositeVC (ptr): %p\n", self);
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
-	Journal_Printf( info, "\titemCount: %u\n", self->itemCount );
-	Journal_Printf( info, "\titemTbl (ptr): %p\n", self->itemTbl);
-	if (self->itemTbl)
-	{
-		for (item_I = 0; item_I < self->itemCount; item_I++)
-			Journal_Printf( info, "\t\titemTbl[%u] (ptr): %p\n", item_I, self->itemTbl[item_I]);
-	}
-	Journal_Printf( info, "\tiOwnTbl (ptr): %p\n", self->iOwnTbl);
-	if (self->iOwnTbl)
-	{
-		for (item_I = 0; item_I < self->itemCount; item_I++)
-			Journal_Printf( info, "\t\tiOwnTbl[%u]: %s\n", item_I, self->iOwnTbl[item_I] ? "True" : "False");
-	}
-	Journal_Printf( info, "\t_size: %lu\n", self->_size);
-	Journal_Printf( info, "\t_delta: %lu\n", self->_delta);
-	
-	/* Print parent */
-	_VariableCondition_Print(self);
-}
-
-
-void* _CompositeVC_Copy( const void* compositeVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	CompositeVC*	newCompositeVC;
-	PtrMap*		map = ptrMap;
-	Bool		ownMap = False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newCompositeVC = (CompositeVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
-	
-	newCompositeVC->itemCount = self->itemCount;
-	newCompositeVC->_size = self->_size;
-	newCompositeVC->_delta = self->_delta;
-	newCompositeVC->hasReadDictionary = self->hasReadDictionary;
-	newCompositeVC->data = self->data;
-	
-	if( deep ) {
-          if( (newCompositeVC->itemTbl = (VariableCondition**)PtrMap_Find( map, self->itemTbl )) == NULL && self->itemTbl ) {
-			Index	item_I;
-			
-			newCompositeVC->itemTbl = Memory_Alloc_Array( VariableCondition*, newCompositeVC->_size, "CompositeCV->itemTbl" );
-			memset( newCompositeVC->itemTbl, 0, sizeof(VariableCondition*) * newCompositeVC->_size );
-			for( item_I = 0; item_I < self->itemCount; item_I++ ) {
-				newCompositeVC->itemTbl[item_I] = (VariableCondition*)Stg_Class_Copy( self->itemTbl[item_I], NULL, deep, nameExt, map );
-			}
-			PtrMap_Append( map, newCompositeVC->itemTbl, self->itemTbl );
-		}
-		
-          if( (newCompositeVC->iOwnTbl = (Bool*)PtrMap_Find( map, self->iOwnTbl )) == NULL && self->iOwnTbl ) {
-			newCompositeVC->iOwnTbl = Memory_Alloc_Array( Bool, newCompositeVC->_size, "CompositeCV->iOwnTbl" );
-			memcpy( newCompositeVC->iOwnTbl, self->iOwnTbl, sizeof(Bool) * newCompositeVC->_size );
-			PtrMap_Append( map, newCompositeVC->iOwnTbl, self->iOwnTbl );
-		}
-		
-          if( (newCompositeVC->attachedSets = (IndexSet**)PtrMap_Find( map, self->attachedSets )) == NULL && self->attachedSets ) {
-			Index	item_I;
-			
-			self->attachedSets = Memory_Alloc_Array( IndexSet*, newCompositeVC->itemCount, "CompositeCV->attachedSets" );
-			for( item_I = 0; item_I < self->itemCount; item_I++ ) {
-				newCompositeVC->attachedSets[item_I] = (IndexSet*)Stg_Class_Copy( self->attachedSets[item_I], NULL, deep, nameExt, map );
-			}
-			PtrMap_Append( map, newCompositeVC->attachedSets, self->attachedSets );
-		}
-	}
-	else {
-		newCompositeVC->itemTbl = self->itemTbl;
-		newCompositeVC->iOwnTbl = self->iOwnTbl;
-		newCompositeVC->attachedSets = self->attachedSets;
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-	
-	return (void*)newCompositeVC;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _CompositeVC_Build( void* compositeVC, void* data ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	Index		index;
-        int ii;
-	
-	/* Read the dictionary... we have to do this early to get self->itemCount filled in. Hence we keep a flag to ensure we
-		dont read twice */
-	self->_readDictionary( self, self->dictionary );
-	
-	/* Build a temporary array to store the sets of attached VCs for the build process and clear it afterward */
-	if( self->itemCount ) {
-		Index			item_I;
-		
-		self->attachedSets = Memory_Alloc_Array( IndexSet*, self->itemCount, "CompositeCV->attachedSets" );
-		memset( self->attachedSets, 0, sizeof(IndexSet*) * self->itemCount );
-		
-		/* This guy is here so that a VC that was created by the composite VC can do any
-		   build stuff it needs, without calling _VariableCondition_Build for itself. */
-		for( item_I = 0; item_I < self->itemCount; item_I++ ) {
-			VariableCondition_BuildSelf( self->itemTbl[item_I], data );
-		}
-		
-		_VariableCondition_Build( self, data );
-		for( index = 0; index < self->itemCount; index++ ) {
-			Stg_Class_Delete( self->attachedSets[index] );
-		}
-		Memory_Free( self->attachedSets );
-		self->attachedSets = 0;
-	}
-
-        for( ii = 0; ii < self->nIndepItems; ii++ )
-           Stg_Component_Build( self->indepItems[ii], data, False );
-}
-
-
-IndexSet* _CompositeVC_GetSet( void* compositeVC ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	IndexSet*	set = NULL;
-	Index		i;
-	
-	/* Use the first attachment to obtain the size, etc. Be effecient by duplicating if for the my own set */
-	if( self->itemCount ) {
-		self->attachedSets[0] = self->itemTbl[0]->_getSet( self->itemTbl[0] );
-		set = IndexSet_Duplicate( self->attachedSets[0] );
-	}
-	
-	/* For the remainder of the attachments, OR in their sets */
-	for( i = 1; i < self->itemCount; i++ ) {
-		self->attachedSets[i] = self->itemTbl[i]->_getSet( self->itemTbl[i] );
-		IndexSet_Merge_OR( set, self->attachedSets[i] );
-	}
-	
-	return set;
-}
-
-	
-Variable_Index _CompositeVC_GetVariableCount( void* compositeVC, Index globalIndex ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	Variable_Index*	varIndices;
-	Variable_Index	varIndexCount = 0;
-	Index		i;
-	
-	varIndices = Memory_Alloc_Array( Variable_Index, self->variable_Register->count, "varIndices" );
-		
-	for( i = 0; i < self->itemCount; i++ ) {
-		if( IndexSet_IsMember( self->attachedSets[i], globalIndex ) ) {
-			Index	varCount = self->itemTbl[i]->_getVariableCount( self->itemTbl[i], globalIndex );
-			Index	j;
-		
-			for(j = 0; j < varCount; j++ ) {
-				Index	newVarIndex = self->itemTbl[i]->_getVariableIndex(self->itemTbl[i], globalIndex, j);
-				Index	k;
-			
-				for (k = 0; k < varIndexCount; k++)
-					if (varIndices[k] == newVarIndex)
-						break;
-				if (k < varIndexCount)
-					continue;
-				
-				varIndices[varIndexCount++] = newVarIndex;
-			}
-		}
-	}
-	
-	if (varIndices) Memory_Free(varIndices);
-	
-	return varIndexCount;
-}
-
-	
-Variable_Index _CompositeVC_GetVariableIndex(
-		void*				compositeVC, 
-		Index				globalIndex, 
-		VariableCondition_VariableIndex	varIndex)
-{
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	Variable_Index*	varIndices;
-	Variable_Index	varIndexCount = 0;
-	Index		i;
-	
-	varIndices = Memory_Alloc_Array( Variable_Index, self->variable_Register->count, "varIndices" );
-		
-	for( i = 0; i < self->itemCount; i++ ) {
-		if( IndexSet_IsMember( self->attachedSets[i], globalIndex ) ) {
-			Index	varCount = self->itemTbl[i]->_getVariableCount(self->itemTbl[i], globalIndex);
-			Index	j;
-		
-			for (j = 0; j < varCount; j++)
-			{
-				Index	newVarIndex = self->itemTbl[i]->_getVariableIndex(self->itemTbl[i], globalIndex, j);
-				Index	k;
-			
-				for (k = 0; k < varIndexCount; k++)
-					if (varIndices[k] == newVarIndex)
-						break;
-				if (k < varIndexCount)
-					continue;
-			
-				if (varIndexCount == varIndex)
-				{
-					if (varIndices) Memory_Free(varIndices);
-					return newVarIndex;
-				}
-			
-				varIndices[varIndexCount++] = newVarIndex;
-			}
-		}
-	}
-	
-	if (varIndices) Memory_Free(varIndices);
-	
-	return (Variable_Index)-1;
-}
-
-
-VariableCondition_ValueIndex _CompositeVC_GetValueIndex(
-				void*				compositeVC, 
-				Index				globalIndex, 
-				VariableCondition_VariableIndex	varIndex)
-{
-	CompositeVC*			self = (CompositeVC*)compositeVC;
-	VariableCondition_ValueIndex	valIndex = (VariableCondition_ValueIndex)-1;
-	CompositeVC_ItemIndex		valItem = 0;
-	Variable_Index			varRegIndex = self->_getVariableIndex(self, globalIndex, varIndex);
-	Index				i;
-	
-	for( i = self->itemCount; i > 0; i-- ) {
-		if( IndexSet_IsMember( self->attachedSets[i-1], globalIndex ) ) {
-			Index	j;
-			
-			for (j = 0; j < self->itemTbl[i - 1]->_getVariableCount(self->itemTbl[i - 1], globalIndex); j++)
-				if (self->itemTbl[i - 1]->_getVariableIndex(self->itemTbl[i - 1], globalIndex, j) == 
-					varRegIndex)
-					break;
-			if (j == self->itemTbl[i - 1]->_getVariableCount(self->itemTbl[i - 1], globalIndex))
-				continue;
-			
-			valItem = i - 1;
-			valIndex = self->itemTbl[valItem]->_getValueIndex(self->itemTbl[valItem], globalIndex, j);
-			break;
-		}
-	}
-	
-	for (i = 0; i < valItem; i++)
-		valIndex += self->itemTbl[i]->_getValueCount(self->itemTbl[i]);
-	
-	return valIndex;
-}
-
-	
-VariableCondition_ValueIndex _CompositeVC_GetValueCount(void* compositeVC)
-{
-	CompositeVC*			self = (CompositeVC*)compositeVC;
-	VariableCondition_ValueIndex	valCount = 0;
-	Index				i;
-	
-	for (i = 0; i < self->itemCount; i++)
-		valCount += self->itemTbl[i]->_getValueCount(self->itemTbl[i]);
-		
-	return valCount;
-}
-
-	
-VariableCondition_Value _CompositeVC_GetValue(void* compositeVC, VariableCondition_ValueIndex valIndex)
-{
-	CompositeVC*			self = (CompositeVC*)compositeVC;
-	VariableCondition_ValueIndex	valPos = valIndex;
-	Index				i = 0;
-	
-	while (valPos >= self->itemTbl[i]->_getValueCount(self->itemTbl[i]))
-	{
-		valPos -= self->itemTbl[i]->_getValueCount(self->itemTbl[i]);
-		i++;
-/*		if (++i >= self->itemCount)	*/
-			/* Then what? */
-	}
-	
-	return self->itemTbl[i]->_getValue(self->itemTbl[i], valPos);
-}
-
-
-void _CompositeVC_PrintConcise( void* compositeVC, Stream* stream ) {
-	CompositeVC*	self = (CompositeVC*)compositeVC;
-	Index		item_I;
-	
-	Journal_Printf( stream, "\ttype: %s, {\n", self->type );
-	if( self->itemTbl ) {
-		for( item_I = 0; item_I < self->itemCount; item_I++ ) {
-			VariableCondition_PrintConcise( self->itemTbl[item_I], stream );
-		}
-	}
-	Journal_Printf( stream, "}\n" );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-CompositeVC_ItemIndex CompositeVC_Add(void* compositeVC, void* variableCondition, Bool iOwn)
-{
-	CompositeVC*		self = (CompositeVC*)compositeVC;
-	CompositeVC_ItemIndex	handle;
-	
-	if (self->itemCount >= self->_size)
-	{
-		SizeT currentSize = self->_size;
-		
-		self->_size += self->_delta;
-
-		self->itemTbl = Memory_Realloc_Array( self->itemTbl, VariableCondition*, self->_size );
-		memset( (Pointer)((ArithPointer)self->itemTbl + (sizeof(VariableCondition*) * currentSize) ),
-			0, sizeof(VariableCondition*) * (self->_size - currentSize) );
-
-		self->iOwnTbl = Memory_Realloc_Array( self->iOwnTbl, Bool, self->_size );
-		memset( (Pointer)((ArithPointer)self->iOwnTbl + (sizeof(Bool) * currentSize )),
-			0, sizeof(Bool) * (self->_size - currentSize ) );
-	}
-	
-	handle = self->itemCount++;
-	self->itemTbl[handle] = (VariableCondition*) variableCondition;
-	self->iOwnTbl[handle] = iOwn;
-	
-	return handle;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-void _CompositeVC_Apply( void* _self, void* _ctx ) {
-   CompositeVC* self = (CompositeVC*)_self;
-   int ii;
-
-   _VariableCondition_Apply( self, _ctx );
-
-   for( ii = 0; ii < self->nIndepItems; ii++ )
-      VariableCondition_Apply( self->indepItems[ii], _ctx );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/CompositeVC.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/CompositeVC.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,655 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: CompositeVC.c 4298 2008-08-25 01:14:56Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "VariableCondition.h"
+#include "VariableCondition_Register.h"
+#include "ConditionFunction.h"
+#include "ConditionFunction_Register.h"
+#include "ContextEntryPoint.h"
+#include "AbstractContext.h"
+#include "CompositeVC.h"
+
+#include <string.h>
+#include <assert.h>
+
+
+const Type CompositeVC_Type = "CompositeVC";
+const Name defaultCompositeVCName = "defaultCompositeVCName";
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* CompositeVC_Factory(
+	AbstractContext*					context,
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register,
+	Dictionary*							dictionary,
+	void*									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,
+	void*									data )
+{
+	CompositeVC* self = _CompositeVC_DefaultNew( name );
+
+	self->isConstructed = True;
+	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
+	_CompositeVC_Init( self, data );
+
+	return self;
+}
+
+CompositeVC* _CompositeVC_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(CompositeVC);
+	Type                                                      type = CompositeVC_Type;
+	Stg_Class_DeleteFunction*                              _delete = _CompositeVC_Delete;
+	Stg_Class_PrintFunction*                                _print = _CompositeVC_Print;
+	Stg_Class_CopyFunction*                                  _copy = _CompositeVC_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_CompositeVC_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _CompositeVC_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _CompositeVC_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _VariableCondition_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _VariableCondition_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _CompositeVC_Destroy;
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+	VariableCondition_BuildSelfFunc*                    _buildSelf = NULL;
+	VariableCondition_PrintConciseFunc*              _printConcise = _CompositeVC_PrintConcise;
+	VariableCondition_ReadDictionaryFunc*          _readDictionary = _CompositeVC_ReadDictionary;
+	VariableCondition_GetSetFunc*                          _getSet = _CompositeVC_GetSet;
+	VariableCondition_GetVariableCountFunc*      _getVariableCount = _CompositeVC_GetVariableCount;
+	VariableCondition_GetVariableIndexFunc*      _getVariableIndex = _CompositeVC_GetVariableIndex;
+	VariableCondition_GetValueIndexFunc*            _getValueIndex = _CompositeVC_GetValueIndex;
+	VariableCondition_GetValueCountFunc*            _getValueCount = _CompositeVC_GetValueCount;
+	VariableCondition_GetValueFunc*                      _getValue = _CompositeVC_GetValue;
+	VariableCondition_ApplyFunc*                            _apply = _CompositeVC_Apply;
+
+	return (CompositeVC*)_CompositeVC_New(  COMPOSITEVC_PASSARGS  );
+}
+
+CompositeVC* _CompositeVC_New(  COMPOSITEVC_DEFARGS  ) {
+	CompositeVC* self;
+	
+	/* Allocate memory/General info */
+	assert (_sizeOfSelf >= sizeof(CompositeVC) );
+	self = (CompositeVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	
+	return self;
+}
+
+
+void _CompositeVC_Init( void* compositeVC, void* data ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	
+	self->isConstructed = True;
+	self->itemCount = 0;
+	self->nIndepItems = 0;
+	self->indepItems = NULL;
+	self->_size = 8;
+	self->_delta = 8;
+	self->itemTbl = Memory_Alloc_Array( VariableCondition*, self->_size, "CompositeCV->itemTbl" );
+	memset(self->itemTbl, 0 , sizeof(VariableCondition*)*self->_size);
+	self->iOwnTbl = Memory_Alloc_Array( Bool, self->_size, "CompositeCV->iOwnTbl" );
+	memset(self->iOwnTbl, 0, sizeof(Bool)*self->_size);
+	self->data = data;
+	self->attachedSets = 0;
+	self->hasReadDictionary = False;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _CompositeVC_ReadDictionary( void* compositeVC, void* dictionary ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+
+	/* View the dictionary as a list of variable conditions */
+	if( dictionary && !self->hasReadDictionary ) {
+		Dictionary_Entry_Value*	vcList;
+		
+		vcList = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"independentVCList" );
+
+		if( vcList ) {
+			Index	count;
+			Index	entry_I;
+			
+			count = Dictionary_Entry_Value_GetCount(vcList);
+
+			for (entry_I = 0; entry_I < count; entry_I++ ) {
+				Dictionary_Entry_Value*	vcEntry;
+				Type			type;
+				Dictionary*		dictionary;
+				VariableCondition*	vc;
+				
+				vcEntry = Dictionary_Entry_Value_GetElement(vcList, entry_I);
+				type = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( vcEntry, (Dictionary_Entry_Key)"type"));
+				dictionary = Dictionary_Entry_Value_AsDictionary(vcEntry );
+				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 );
+
+				self->nIndepItems++;
+				self->indepItems = ReallocArray( self->indepItems, VariableCondition*, self->nIndepItems );
+				self->indepItems[self->nIndepItems - 1] = vc;
+
+				/* Don't add so we can modify the matrix later.
+				CompositeVC_Add(self, vc, True);
+				*/
+			}
+		}
+		vcList = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"vcList" );
+
+		if( vcList ) {
+			Index	count;
+			Index	entry_I;
+			
+			count = Dictionary_Entry_Value_GetCount(vcList);
+
+			for (entry_I = 0; entry_I < count; entry_I++ ) {
+				Dictionary_Entry_Value*	vcEntry;
+				Type			type;
+				Dictionary*		dictionary;
+				VariableCondition*	vc;
+				
+				vcEntry = Dictionary_Entry_Value_GetElement(vcList, entry_I);
+				type = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( vcEntry, (Dictionary_Entry_Key)"type"));
+				dictionary = Dictionary_Entry_Value_AsDictionary(vcEntry );
+				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);
+			}
+		}
+		self->hasReadDictionary = True;
+	}
+}
+
+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;
+	AbstractContext*	context;
+	
+	/* Need to store this so we can get at components
+		later on when using the fucked up 'ReadDictionary' function. */
+	self->cf = cf;
+
+	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !context  )
+		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
+	
+	variableRegister = context->variable_Register;
+	assert( variableRegister );
+	conditionFunctionRegister = condFunc_Register; 
+	assert( conditionFunctionRegister  );
+	
+	vcName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"vcName", self->name );
+
+	if ( cf->rootDict  )
+		vcDict = Dictionary_GetDictionary( cf->rootDict, vcName );
+
+	initData = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Data", Stg_Component, False, data  );
+	
+	_VariableCondition_Init( self, context,
+                                 (Variable_Register*)variableRegister,
+                                 (ConditionFunction_Register*)conditionFunctionRegister, vcDict );
+	_CompositeVC_Init( self, initData );
+}
+
+void _CompositeVC_Delete(void* compositeVC) {
+	CompositeVC* self = (CompositeVC*)compositeVC;
+	
+	/* Stg_Class_Delete parent */
+	_VariableCondition_Delete(self);
+}
+
+void _CompositeVC_Destroy(void* compositeVC, void* data) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	int				ii;
+
+	if( self->indepItems ) {
+		for( ii = 0; ii < self->nIndepItems; ii++ )
+         _VariableCondition_Delete( self->indepItems[ii]);
+		Memory_Free( self->indepItems );
+	}
+	
+	if (self->itemTbl) {
+		VariableCondition_Index	entry_I;
+		
+		for (entry_I = 0; entry_I < self->itemCount; entry_I++) {
+			if (self->iOwnTbl[entry_I] && self->itemTbl[entry_I])
+				//Stg_Component_Destroy( self->itemTbl[entry_I], NULL, False );
+				_VariableCondition_Delete( self->itemTbl[entry_I]);
+		}
+		Memory_Free(self->itemTbl);
+	}
+	
+	if( self->attachedSets ) {
+		Memory_Free( self->attachedSets );
+	}
+
+   Stg_Component_Destroy( self->data, NULL, False );
+
+	_VariableCondition_Destroy( self, data );
+}
+
+void _CompositeVC_Print(void* compositeVC, Stream* stream) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	Index				item_I;
+	
+	/* Set the Journal for printing informations */
+	Stream* info = stream;
+	
+	/* General info */
+	Journal_Printf( info, "CompositeVC (ptr): %p\n", self);
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
+	Journal_Printf( info, "\titemCount: %u\n", self->itemCount );
+	Journal_Printf( info, "\titemTbl (ptr): %p\n", self->itemTbl);
+	if (self->itemTbl)
+	{
+		for (item_I = 0; item_I < self->itemCount; item_I++)
+			Journal_Printf( info, "\t\titemTbl[%u] (ptr): %p\n", item_I, self->itemTbl[item_I]);
+	}
+	Journal_Printf( info, "\tiOwnTbl (ptr): %p\n", self->iOwnTbl);
+	if (self->iOwnTbl)
+	{
+		for (item_I = 0; item_I < self->itemCount; item_I++)
+			Journal_Printf( info, "\t\tiOwnTbl[%u]: %s\n", item_I, self->iOwnTbl[item_I] ? "True" : "False");
+	}
+	Journal_Printf( info, "\t_size: %lu\n", self->_size);
+	Journal_Printf( info, "\t_delta: %lu\n", self->_delta);
+	
+	/* Print parent */
+	_VariableCondition_Print(self);
+}
+
+
+void* _CompositeVC_Copy( const void* compositeVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	CompositeVC*	newCompositeVC;
+	PtrMap*		map = ptrMap;
+	Bool		ownMap = False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newCompositeVC = (CompositeVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
+	
+	newCompositeVC->itemCount = self->itemCount;
+	newCompositeVC->_size = self->_size;
+	newCompositeVC->_delta = self->_delta;
+	newCompositeVC->hasReadDictionary = self->hasReadDictionary;
+	newCompositeVC->data = self->data;
+	
+	if( deep ) {
+          if( (newCompositeVC->itemTbl = (VariableCondition**)PtrMap_Find( map, self->itemTbl )) == NULL && self->itemTbl ) {
+			Index	item_I;
+			
+			newCompositeVC->itemTbl = Memory_Alloc_Array( VariableCondition*, newCompositeVC->_size, "CompositeCV->itemTbl" );
+			memset( newCompositeVC->itemTbl, 0, sizeof(VariableCondition*) * newCompositeVC->_size );
+			for( item_I = 0; item_I < self->itemCount; item_I++ ) {
+				newCompositeVC->itemTbl[item_I] = (VariableCondition*)Stg_Class_Copy( self->itemTbl[item_I], NULL, deep, nameExt, map );
+			}
+			PtrMap_Append( map, newCompositeVC->itemTbl, self->itemTbl );
+		}
+		
+          if( (newCompositeVC->iOwnTbl = (Bool*)PtrMap_Find( map, self->iOwnTbl )) == NULL && self->iOwnTbl ) {
+			newCompositeVC->iOwnTbl = Memory_Alloc_Array( Bool, newCompositeVC->_size, "CompositeCV->iOwnTbl" );
+			memcpy( newCompositeVC->iOwnTbl, self->iOwnTbl, sizeof(Bool) * newCompositeVC->_size );
+			PtrMap_Append( map, newCompositeVC->iOwnTbl, self->iOwnTbl );
+		}
+		
+          if( (newCompositeVC->attachedSets = (IndexSet**)PtrMap_Find( map, self->attachedSets )) == NULL && self->attachedSets ) {
+			Index	item_I;
+			
+			self->attachedSets = Memory_Alloc_Array( IndexSet*, newCompositeVC->itemCount, "CompositeCV->attachedSets" );
+			for( item_I = 0; item_I < self->itemCount; item_I++ ) {
+				newCompositeVC->attachedSets[item_I] = (IndexSet*)Stg_Class_Copy( self->attachedSets[item_I], NULL, deep, nameExt, map );
+			}
+			PtrMap_Append( map, newCompositeVC->attachedSets, self->attachedSets );
+		}
+	}
+	else {
+		newCompositeVC->itemTbl = self->itemTbl;
+		newCompositeVC->iOwnTbl = self->iOwnTbl;
+		newCompositeVC->attachedSets = self->attachedSets;
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+	
+	return (void*)newCompositeVC;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _CompositeVC_Build( void* compositeVC, void* data ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	Index		index;
+        int ii;
+	
+	/* Read the dictionary... we have to do this early to get self->itemCount filled in. Hence we keep a flag to ensure we
+		dont read twice */
+	self->_readDictionary( self, self->dictionary );
+	
+	/* Build a temporary array to store the sets of attached VCs for the build process and clear it afterward */
+	if( self->itemCount ) {
+		Index			item_I;
+		
+		self->attachedSets = Memory_Alloc_Array( IndexSet*, self->itemCount, "CompositeCV->attachedSets" );
+		memset( self->attachedSets, 0, sizeof(IndexSet*) * self->itemCount );
+		
+		/* This guy is here so that a VC that was created by the composite VC can do any
+		   build stuff it needs, without calling _VariableCondition_Build for itself. */
+		for( item_I = 0; item_I < self->itemCount; item_I++ ) {
+			VariableCondition_BuildSelf( self->itemTbl[item_I], data );
+		}
+		
+		_VariableCondition_Build( self, data );
+		for( index = 0; index < self->itemCount; index++ ) {
+			Stg_Class_Delete( self->attachedSets[index] );
+		}
+		Memory_Free( self->attachedSets );
+		self->attachedSets = 0;
+	}
+
+        for( ii = 0; ii < self->nIndepItems; ii++ )
+           Stg_Component_Build( self->indepItems[ii], data, False );
+}
+
+
+IndexSet* _CompositeVC_GetSet( void* compositeVC ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	IndexSet*	set = NULL;
+	Index		i;
+	
+	/* Use the first attachment to obtain the size, etc. Be effecient by duplicating if for the my own set */
+	if( self->itemCount ) {
+		self->attachedSets[0] = self->itemTbl[0]->_getSet( self->itemTbl[0] );
+		set = IndexSet_Duplicate( self->attachedSets[0] );
+	}
+	
+	/* For the remainder of the attachments, OR in their sets */
+	for( i = 1; i < self->itemCount; i++ ) {
+		self->attachedSets[i] = self->itemTbl[i]->_getSet( self->itemTbl[i] );
+		IndexSet_Merge_OR( set, self->attachedSets[i] );
+	}
+	
+	return set;
+}
+
+	
+Variable_Index _CompositeVC_GetVariableCount( void* compositeVC, Index globalIndex ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	Variable_Index*	varIndices;
+	Variable_Index	varIndexCount = 0;
+	Index		i;
+	
+	varIndices = Memory_Alloc_Array( Variable_Index, self->variable_Register->count, "varIndices" );
+		
+	for( i = 0; i < self->itemCount; i++ ) {
+		if( IndexSet_IsMember( self->attachedSets[i], globalIndex ) ) {
+			Index	varCount = self->itemTbl[i]->_getVariableCount( self->itemTbl[i], globalIndex );
+			Index	j;
+		
+			for(j = 0; j < varCount; j++ ) {
+				Index	newVarIndex = self->itemTbl[i]->_getVariableIndex(self->itemTbl[i], globalIndex, j);
+				Index	k;
+			
+				for (k = 0; k < varIndexCount; k++)
+					if (varIndices[k] == newVarIndex)
+						break;
+				if (k < varIndexCount)
+					continue;
+				
+				varIndices[varIndexCount++] = newVarIndex;
+			}
+		}
+	}
+	
+	if (varIndices) Memory_Free(varIndices);
+	
+	return varIndexCount;
+}
+
+	
+Variable_Index _CompositeVC_GetVariableIndex(
+		void*				compositeVC, 
+		Index				globalIndex, 
+		VariableCondition_VariableIndex	varIndex)
+{
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	Variable_Index*	varIndices;
+	Variable_Index	varIndexCount = 0;
+	Index		i;
+	
+	varIndices = Memory_Alloc_Array( Variable_Index, self->variable_Register->count, "varIndices" );
+		
+	for( i = 0; i < self->itemCount; i++ ) {
+		if( IndexSet_IsMember( self->attachedSets[i], globalIndex ) ) {
+			Index	varCount = self->itemTbl[i]->_getVariableCount(self->itemTbl[i], globalIndex);
+			Index	j;
+		
+			for (j = 0; j < varCount; j++)
+			{
+				Index	newVarIndex = self->itemTbl[i]->_getVariableIndex(self->itemTbl[i], globalIndex, j);
+				Index	k;
+			
+				for (k = 0; k < varIndexCount; k++)
+					if (varIndices[k] == newVarIndex)
+						break;
+				if (k < varIndexCount)
+					continue;
+			
+				if (varIndexCount == varIndex)
+				{
+					if (varIndices) Memory_Free(varIndices);
+					return newVarIndex;
+				}
+			
+				varIndices[varIndexCount++] = newVarIndex;
+			}
+		}
+	}
+	
+	if (varIndices) Memory_Free(varIndices);
+	
+	return (Variable_Index)-1;
+}
+
+
+VariableCondition_ValueIndex _CompositeVC_GetValueIndex(
+				void*				compositeVC, 
+				Index				globalIndex, 
+				VariableCondition_VariableIndex	varIndex)
+{
+	CompositeVC*			self = (CompositeVC*)compositeVC;
+	VariableCondition_ValueIndex	valIndex = (VariableCondition_ValueIndex)-1;
+	CompositeVC_ItemIndex		valItem = 0;
+	Variable_Index			varRegIndex = self->_getVariableIndex(self, globalIndex, varIndex);
+	Index				i;
+	
+	for( i = self->itemCount; i > 0; i-- ) {
+		if( IndexSet_IsMember( self->attachedSets[i-1], globalIndex ) ) {
+			Index	j;
+			
+			for (j = 0; j < self->itemTbl[i - 1]->_getVariableCount(self->itemTbl[i - 1], globalIndex); j++)
+				if (self->itemTbl[i - 1]->_getVariableIndex(self->itemTbl[i - 1], globalIndex, j) == 
+					varRegIndex)
+					break;
+			if (j == self->itemTbl[i - 1]->_getVariableCount(self->itemTbl[i - 1], globalIndex))
+				continue;
+			
+			valItem = i - 1;
+			valIndex = self->itemTbl[valItem]->_getValueIndex(self->itemTbl[valItem], globalIndex, j);
+			break;
+		}
+	}
+	
+	for (i = 0; i < valItem; i++)
+		valIndex += self->itemTbl[i]->_getValueCount(self->itemTbl[i]);
+	
+	return valIndex;
+}
+
+	
+VariableCondition_ValueIndex _CompositeVC_GetValueCount(void* compositeVC)
+{
+	CompositeVC*			self = (CompositeVC*)compositeVC;
+	VariableCondition_ValueIndex	valCount = 0;
+	Index				i;
+	
+	for (i = 0; i < self->itemCount; i++)
+		valCount += self->itemTbl[i]->_getValueCount(self->itemTbl[i]);
+		
+	return valCount;
+}
+
+	
+VariableCondition_Value _CompositeVC_GetValue(void* compositeVC, VariableCondition_ValueIndex valIndex)
+{
+	CompositeVC*			self = (CompositeVC*)compositeVC;
+	VariableCondition_ValueIndex	valPos = valIndex;
+	Index				i = 0;
+	
+	while (valPos >= self->itemTbl[i]->_getValueCount(self->itemTbl[i]))
+	{
+		valPos -= self->itemTbl[i]->_getValueCount(self->itemTbl[i]);
+		i++;
+/*		if (++i >= self->itemCount)	*/
+			/* Then what? */
+	}
+	
+	return self->itemTbl[i]->_getValue(self->itemTbl[i], valPos);
+}
+
+
+void _CompositeVC_PrintConcise( void* compositeVC, Stream* stream ) {
+	CompositeVC*	self = (CompositeVC*)compositeVC;
+	Index		item_I;
+	
+	Journal_Printf( stream, "\ttype: %s, {\n", self->type );
+	if( self->itemTbl ) {
+		for( item_I = 0; item_I < self->itemCount; item_I++ ) {
+			VariableCondition_PrintConcise( self->itemTbl[item_I], stream );
+		}
+	}
+	Journal_Printf( stream, "}\n" );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+CompositeVC_ItemIndex CompositeVC_Add(void* compositeVC, void* variableCondition, Bool iOwn)
+{
+	CompositeVC*		self = (CompositeVC*)compositeVC;
+	CompositeVC_ItemIndex	handle;
+	
+	if (self->itemCount >= self->_size)
+	{
+		SizeT currentSize = self->_size;
+		
+		self->_size += self->_delta;
+
+		self->itemTbl = Memory_Realloc_Array( self->itemTbl, VariableCondition*, self->_size );
+		memset( (Pointer)((ArithPointer)self->itemTbl + (sizeof(VariableCondition*) * currentSize) ),
+			0, sizeof(VariableCondition*) * (self->_size - currentSize) );
+
+		self->iOwnTbl = Memory_Realloc_Array( self->iOwnTbl, Bool, self->_size );
+		memset( (Pointer)((ArithPointer)self->iOwnTbl + (sizeof(Bool) * currentSize )),
+			0, sizeof(Bool) * (self->_size - currentSize ) );
+	}
+	
+	handle = self->itemCount++;
+	self->itemTbl[handle] = (VariableCondition*) variableCondition;
+	self->iOwnTbl[handle] = iOwn;
+	
+	return handle;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+void _CompositeVC_Apply( void* _self, void* _ctx ) {
+   CompositeVC* self = (CompositeVC*)_self;
+   int ii;
+
+   _VariableCondition_Apply( self, _ctx );
+
+   for( ii = 0; ii < self->nIndepItems; ii++ )
+      VariableCondition_Apply( self->indepItems[ii], _ctx );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/ConditionFunction.c
--- a/Base/Context/src/ConditionFunction.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ConditionFunction.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "ConditionFunction.h"
-
-#include <stdio.h>
-#include <assert.h>
-
-
-const Type ConditionFunction_Type = "ConditionFunction";
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-ConditionFunction* ConditionFunction_New(ConditionFunction_ApplyFunc* apply, Name name)
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(ConditionFunction);
-	Type                              type = ConditionFunction_Type;
-	Stg_Class_DeleteFunction*      _delete = _ConditionFunction_Delete;
-	Stg_Class_PrintFunction*        _print = _ConditionFunction_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return _ConditionFunction_New(  CONDITIONFUNCTION_PASSARGS  );
-}
-
-
-void ConditionFunction_Init(ConditionFunction* self, ConditionFunction_ApplyFunc* apply, Name name)
-{
-	/* General info */
-	self->type = ConditionFunction_Type;
-	self->_sizeOfSelf = sizeof(ConditionFunction);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ConditionFunction_Delete;
-	self->_print = _ConditionFunction_Print;
-	self->_copy = NULL;
-	
-	_Stg_Class_Init((Stg_Class*)self);
-	
-	/* Stg_Class info */
-	_ConditionFunction_Init(self, apply, name);
-}
-
-
-ConditionFunction* _ConditionFunction_New(  CONDITIONFUNCTION_DEFARGS  )
-{
-	ConditionFunction* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ConditionFunction) );
-	self = (ConditionFunction*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	
-	/* Stg_Class info */
-	_ConditionFunction_Init(self, apply, name);
-	
-	return self;
-}
-
-
-void _ConditionFunction_Init(void* conditionFunction, ConditionFunction_ApplyFunc* apply, Name name)
-{
-	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
-	
-	self->apply = apply;
-	self->name = name;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _ConditionFunction_Delete(void* conditionFunction)
-{
-	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
-	
-	/* Stg_Class_Delete parent class */
-	_Stg_Class_Delete(self);
-}
-
-
-void _ConditionFunction_Print(void* conditionFunction, Stream* stream)
-{
-	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
-	
-	/* Set the Journal for printing informations */
-	Stream* conditionFunctionStream = stream;
-	
-	/* General info */
-	Journal_Printf( conditionFunctionStream, "ConditionFunction (ptr): %p\n", self);
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	Journal_Printf( conditionFunctionStream, "\tapply (func ptr): %p\n", self->apply);
-	Journal_Printf( conditionFunctionStream, "\tname (ptr): %p\n", self->name);
-	if (self->name)
-		Journal_Printf( conditionFunctionStream, "\t\tname: %s\n", self->name);
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, conditionFunctionStream );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-void _ConditionFunction_Apply(void* conditionFunction, Index index, Variable_Index var_I, void* context, void* result)
-{
-	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
-	
-	ConditionFunction_Apply(self, index, var_I, context, result);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/ConditionFunction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/ConditionFunction.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,172 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ConditionFunction.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "ConditionFunction.h"
+
+#include <stdio.h>
+#include <assert.h>
+
+
+const Type ConditionFunction_Type = "ConditionFunction";
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+ConditionFunction* ConditionFunction_New(ConditionFunction_ApplyFunc* apply, Name name)
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(ConditionFunction);
+	Type                              type = ConditionFunction_Type;
+	Stg_Class_DeleteFunction*      _delete = _ConditionFunction_Delete;
+	Stg_Class_PrintFunction*        _print = _ConditionFunction_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return _ConditionFunction_New(  CONDITIONFUNCTION_PASSARGS  );
+}
+
+
+void ConditionFunction_Init(ConditionFunction* self, ConditionFunction_ApplyFunc* apply, Name name)
+{
+	/* General info */
+	self->type = ConditionFunction_Type;
+	self->_sizeOfSelf = sizeof(ConditionFunction);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ConditionFunction_Delete;
+	self->_print = _ConditionFunction_Print;
+	self->_copy = NULL;
+	
+	_Stg_Class_Init((Stg_Class*)self);
+	
+	/* Stg_Class info */
+	_ConditionFunction_Init(self, apply, name);
+}
+
+
+ConditionFunction* _ConditionFunction_New(  CONDITIONFUNCTION_DEFARGS  )
+{
+	ConditionFunction* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ConditionFunction) );
+	self = (ConditionFunction*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	
+	/* Stg_Class info */
+	_ConditionFunction_Init(self, apply, name);
+	
+	return self;
+}
+
+
+void _ConditionFunction_Init(void* conditionFunction, ConditionFunction_ApplyFunc* apply, Name name)
+{
+	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
+	
+	self->apply = apply;
+	self->name = name;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _ConditionFunction_Delete(void* conditionFunction)
+{
+	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
+	
+	/* Stg_Class_Delete parent class */
+	_Stg_Class_Delete(self);
+}
+
+
+void _ConditionFunction_Print(void* conditionFunction, Stream* stream)
+{
+	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
+	
+	/* Set the Journal for printing informations */
+	Stream* conditionFunctionStream = stream;
+	
+	/* General info */
+	Journal_Printf( conditionFunctionStream, "ConditionFunction (ptr): %p\n", self);
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	Journal_Printf( conditionFunctionStream, "\tapply (func ptr): %p\n", self->apply);
+	Journal_Printf( conditionFunctionStream, "\tname (ptr): %p\n", self->name);
+	if (self->name)
+		Journal_Printf( conditionFunctionStream, "\t\tname: %s\n", self->name);
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, conditionFunctionStream );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+void _ConditionFunction_Apply(void* conditionFunction, Index index, Variable_Index var_I, void* context, void* result)
+{
+	ConditionFunction*	self = (ConditionFunction*)conditionFunction;
+	
+	ConditionFunction_Apply(self, index, var_I, context, result);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/ConditionFunction_Register.c
--- a/Base/Context/src/ConditionFunction_Register.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ConditionFunction_Register.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "ConditionFunction.h"
-#include "ConditionFunction_Register.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-const Type ConditionFunction_Register_Type = "ConditionFunction_Register";
-
-ConditionFunction_Register* condFunc_Register = 0;
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-ConditionFunction_Register* ConditionFunction_Register_New(void)
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(ConditionFunction_Register);
-	Type                              type = ConditionFunction_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _ConditionFunction_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _ConditionFunction_Register_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
- 
-	return _ConditionFunction_Register_New(  CONDITIONFUNCTION_REGISTER_PASSARGS  );
-}
-
-
-void ConditionFunction_Register_Init(ConditionFunction_Register* self)
-{ 
-	/* General info */
-	self->type = ConditionFunction_Register_Type;
-	self->_sizeOfSelf = sizeof(ConditionFunction_Register);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ConditionFunction_Register_Delete;
-	self->_print = _ConditionFunction_Register_Print;
-	self->_copy = NULL;
-	
-	_Stg_Class_Init((Stg_Class*)self);
-	
-	/* Stg_Class info */
-	_ConditionFunction_Register_Init(self);
-}
-
-
-ConditionFunction_Register* _ConditionFunction_Register_New(  CONDITIONFUNCTION_REGISTER_DEFARGS  )
-{
-	ConditionFunction_Register*	self;
-	
-	/* Allocate memory */
-	self = (ConditionFunction_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* ConditionFunction_Register info */
-	_ConditionFunction_Register_Init(self);
-	
-	return self;
-}
-
-
-void _ConditionFunction_Register_Init(void* conditionFunction_Register)
-{ 
-	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
-	
-	self->count = 0;
-	self->_size = 8;
-	self->_delta = 8;
-	self->_cf = Memory_Alloc_Array( ConditionFunction*, self->_size, "ConditionFunction_Register->_cf" );
-	memset(self->_cf, 0, sizeof(ConditionFunction*)*self->_size);
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _ConditionFunction_Register_Delete(void* conditionFunction_Register)
-{
-	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
-	
-	if (self->_cf) Memory_Free(self->_cf);
-		
-	/* Stg_Class_Delete parent class */
-	_Stg_Class_Delete(self);
-}
-
-
-void _ConditionFunction_Register_Print(void* conditionFunction_Register, Stream* stream)
-{
-	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
-	
-	/* Set the Journal for printing informations */
-	Stream* conditionFunction_RegisterStream = stream;
-	
-	/* General info */
-	Journal_Printf( conditionFunction_RegisterStream, "ConditionFunction_Register (ptr): %p\n", self);
-	
-	/* Virtual info */
-	
-	/* ConditionFunction_Register info */
-	Journal_Printf( conditionFunction_RegisterStream, "\tcount: %u\n", self->count);
-	Journal_Printf( conditionFunction_RegisterStream, "\t_size: %lu\n", self->_size);
-	Journal_Printf( conditionFunction_RegisterStream, "\t_delta: %lu\n", self->_delta);
-	Journal_Printf( conditionFunction_RegisterStream, "\t_cf (ptr): %p\n", self->_cf);
-	if (self->_cf)
-	{
-		ConditionFunction_Index	cf_I;
-		
-		for (cf_I = 0; cf_I < self->count; cf_I++)
-			Journal_Printf( conditionFunction_RegisterStream, "\t\t_cf[%u]: %p\n", cf_I, self->_cf[cf_I]);
-	}
-	
-	/* Parent class info */
-	_Stg_Class_Print( self, conditionFunction_RegisterStream );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-ConditionFunction_Index ConditionFunction_Register_Add(void* conditionFunction_Register, ConditionFunction* cf)
-{
-	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
-	Variable_Index			handle;
-	
-	if (self->count >= self->_size)
-	{
-		SizeT currentSize = self->_size;
-		
-		/* Note: why is realloc not used here? */
-		self->_size += self->_delta;
-		
-		self->_cf = Memory_Realloc_Array( self->_cf, ConditionFunction*, self->_size );
-		memset( (Pointer)((ArithPointer)self->_cf + (sizeof(ConditionFunction*) * currentSize) ),
-			0, sizeof(ConditionFunction*) * (self->_size - currentSize) );
-	}
-	
-	handle = self->count++;
-	self->_cf[handle] = cf;
-	
-	return handle;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-ConditionFunction_Index ConditionFunction_Register_GetIndex(void* conditionFunction_Register, Name name)
-{
-	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
-	ConditionFunction_Index		cf_I;
-	
-	for (cf_I = 0; cf_I < self->count; cf_I++)
-	{
-		if (self->_cf[cf_I]->name && !strcmp(name, self->_cf[cf_I]->name))
-			return cf_I;
-	}
-	
-	return (ConditionFunction_Index)-1;
-}
-
-
-void ConditionFunction_Register_PrintNameOfEachFunc( void* conditionFunction_Register, Stream* stream ) {
-	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
-	ConditionFunction_Index		cf_I;
-	
-	for (cf_I = 0; cf_I < self->count; cf_I++)
-	{
-		Journal_Printf( stream, "\"%s\", ", self->_cf[cf_I]->name );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/ConditionFunction_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/ConditionFunction_Register.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,225 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ConditionFunction_Register.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "ConditionFunction.h"
+#include "ConditionFunction_Register.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+const Type ConditionFunction_Register_Type = "ConditionFunction_Register";
+
+ConditionFunction_Register* condFunc_Register = 0;
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+ConditionFunction_Register* ConditionFunction_Register_New(void)
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(ConditionFunction_Register);
+	Type                              type = ConditionFunction_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _ConditionFunction_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _ConditionFunction_Register_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+ 
+	return _ConditionFunction_Register_New(  CONDITIONFUNCTION_REGISTER_PASSARGS  );
+}
+
+
+void ConditionFunction_Register_Init(ConditionFunction_Register* self)
+{ 
+	/* General info */
+	self->type = ConditionFunction_Register_Type;
+	self->_sizeOfSelf = sizeof(ConditionFunction_Register);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ConditionFunction_Register_Delete;
+	self->_print = _ConditionFunction_Register_Print;
+	self->_copy = NULL;
+	
+	_Stg_Class_Init((Stg_Class*)self);
+	
+	/* Stg_Class info */
+	_ConditionFunction_Register_Init(self);
+}
+
+
+ConditionFunction_Register* _ConditionFunction_Register_New(  CONDITIONFUNCTION_REGISTER_DEFARGS  )
+{
+	ConditionFunction_Register*	self;
+	
+	/* Allocate memory */
+	self = (ConditionFunction_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* ConditionFunction_Register info */
+	_ConditionFunction_Register_Init(self);
+	
+	return self;
+}
+
+
+void _ConditionFunction_Register_Init(void* conditionFunction_Register)
+{ 
+	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
+	
+	self->count = 0;
+	self->_size = 8;
+	self->_delta = 8;
+	self->_cf = Memory_Alloc_Array( ConditionFunction*, self->_size, "ConditionFunction_Register->_cf" );
+	memset(self->_cf, 0, sizeof(ConditionFunction*)*self->_size);
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _ConditionFunction_Register_Delete(void* conditionFunction_Register)
+{
+	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
+	
+	if (self->_cf) Memory_Free(self->_cf);
+		
+	/* Stg_Class_Delete parent class */
+	_Stg_Class_Delete(self);
+}
+
+
+void _ConditionFunction_Register_Print(void* conditionFunction_Register, Stream* stream)
+{
+	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
+	
+	/* Set the Journal for printing informations */
+	Stream* conditionFunction_RegisterStream = stream;
+	
+	/* General info */
+	Journal_Printf( conditionFunction_RegisterStream, "ConditionFunction_Register (ptr): %p\n", self);
+	
+	/* Virtual info */
+	
+	/* ConditionFunction_Register info */
+	Journal_Printf( conditionFunction_RegisterStream, "\tcount: %u\n", self->count);
+	Journal_Printf( conditionFunction_RegisterStream, "\t_size: %lu\n", self->_size);
+	Journal_Printf( conditionFunction_RegisterStream, "\t_delta: %lu\n", self->_delta);
+	Journal_Printf( conditionFunction_RegisterStream, "\t_cf (ptr): %p\n", self->_cf);
+	if (self->_cf)
+	{
+		ConditionFunction_Index	cf_I;
+		
+		for (cf_I = 0; cf_I < self->count; cf_I++)
+			Journal_Printf( conditionFunction_RegisterStream, "\t\t_cf[%u]: %p\n", cf_I, self->_cf[cf_I]);
+	}
+	
+	/* Parent class info */
+	_Stg_Class_Print( self, conditionFunction_RegisterStream );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+ConditionFunction_Index ConditionFunction_Register_Add(void* conditionFunction_Register, ConditionFunction* cf)
+{
+	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
+	Variable_Index			handle;
+	
+	if (self->count >= self->_size)
+	{
+		SizeT currentSize = self->_size;
+		
+		/* Note: why is realloc not used here? */
+		self->_size += self->_delta;
+		
+		self->_cf = Memory_Realloc_Array( self->_cf, ConditionFunction*, self->_size );
+		memset( (Pointer)((ArithPointer)self->_cf + (sizeof(ConditionFunction*) * currentSize) ),
+			0, sizeof(ConditionFunction*) * (self->_size - currentSize) );
+	}
+	
+	handle = self->count++;
+	self->_cf[handle] = cf;
+	
+	return handle;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+ConditionFunction_Index ConditionFunction_Register_GetIndex(void* conditionFunction_Register, Name name)
+{
+	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
+	ConditionFunction_Index		cf_I;
+	
+	for (cf_I = 0; cf_I < self->count; cf_I++)
+	{
+		if (self->_cf[cf_I]->name && !strcmp(name, self->_cf[cf_I]->name))
+			return cf_I;
+	}
+	
+	return (ConditionFunction_Index)-1;
+}
+
+
+void ConditionFunction_Register_PrintNameOfEachFunc( void* conditionFunction_Register, Stream* stream ) {
+	ConditionFunction_Register*	self = (ConditionFunction_Register*)conditionFunction_Register;
+	ConditionFunction_Index		cf_I;
+	
+	for (cf_I = 0; cf_I < self->count; cf_I++)
+	{
+		Journal_Printf( stream, "\"%s\", ", self->_cf[cf_I]->name );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/ContextEntryPoint.c
--- a/Base/Context/src/ContextEntryPoint.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ContextEntryPoint.c 3851 2006-10-12 08:57:22Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "units.h"
-#include "types.h"
-#include "shortcuts.h"
-#include "ContextEntryPoint.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdarg.h>
-
-/* Textual name of this class */
-const Type ContextEntryPoint_Type = "ContextEntryPoint";
-
-
-ContextEntryPoint* ContextEntryPoint_New( Name name, unsigned int castType ) {
-	/* Variables set in this function */
-	SizeT                       _sizeOfSelf = sizeof(ContextEntryPoint);
-	Type                               type = ContextEntryPoint_Type;
-	Stg_Class_DeleteFunction*       _delete = _EntryPoint_Delete;
-	Stg_Class_PrintFunction*         _print = _EntryPoint_Print;
-	Stg_Class_CopyFunction*           _copy = NULL;
-	EntryPoint_GetRunFunction*      _getRun = _ContextEntryPoint_GetRun;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _ContextEntryPoint_New(  CONTEXTENTRYPOINT_PASSARGS  );
-}
-
-void ContextEntryPoint_Init( void* contextEntryPoint, Name name, unsigned int castType ) {
-	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
-	
-	/* General info */
-	self->type = ContextEntryPoint_Type;
-	self->_sizeOfSelf = sizeof(ContextEntryPoint);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _EntryPoint_Delete;
-	self->_print = _EntryPoint_Print;
-	self->_copy = NULL;
-	self->_getRun = _ContextEntryPoint_GetRun;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, GLOBAL );
-	_EntryPoint_Init( (EntryPoint*)self, castType );
-	
-	/* ContextEntryPoint info */
-	_ContextEntryPoint_Init( self );
-}
-
-ContextEntryPoint* _ContextEntryPoint_New(  CONTEXTENTRYPOINT_DEFARGS  )
-{
-	ContextEntryPoint* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ContextEntryPoint) );
-	self = (ContextEntryPoint*)_EntryPoint_New(  ENTRYPOINT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* ContextEntryPoint info */
-	_ContextEntryPoint_Init( self );
-	
-	return self;
-}
-
-void _ContextEntryPoint_Init( ContextEntryPoint* self ) {
-	/* General and Virtual info should already be set */
-	
-	/* ContextEntryPoint info */
-}
-
-
-Func_Ptr _ContextEntryPoint_GetRun( void* contextEntryPoint ) {
-	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
-	
-	switch( self->castType ) {
-		case ContextEntryPoint_Dt_CastType:
-			return (Func_Ptr)_ContextEntryPoint_Run_Dt;
-		
-		case ContextEntryPoint_Step_CastType:
-			return (Func_Ptr)_ContextEntryPoint_Run_Step;
-		
-		default:
-			return (Func_Ptr)_EntryPoint_GetRun( self );
-	}
-}
-
-
-double _ContextEntryPoint_Run_Dt( void* contextEntryPoint, void* data0 ) {
-	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
-	Hook_Index hookIndex;
-	double result = 0.0;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _ContextEntryPoint_Run_Dt, self->name );
-	#endif
-
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		result = ((ContextEntryPoint_Dt_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-
-	return result;
-}
-
-void _ContextEntryPoint_Run_Step( void* contextEntryPoint, void* data0, double data1 ) {
-	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
-	Hook_Index hookIndex;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _ContextEntryPoint_Run_Step, self->name );
-	#endif
-
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		((ContextEntryPoint_Step_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0, data1 );
-	}
-
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/ContextEntryPoint.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/ContextEntryPoint.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,168 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ContextEntryPoint.c 3851 2006-10-12 08:57:22Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "units.h"
+#include "types.h"
+#include "shortcuts.h"
+#include "ContextEntryPoint.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stdarg.h>
+
+/* Textual name of this class */
+const Type ContextEntryPoint_Type = "ContextEntryPoint";
+
+
+ContextEntryPoint* ContextEntryPoint_New( Name name, unsigned int castType ) {
+	/* Variables set in this function */
+	SizeT                       _sizeOfSelf = sizeof(ContextEntryPoint);
+	Type                               type = ContextEntryPoint_Type;
+	Stg_Class_DeleteFunction*       _delete = _EntryPoint_Delete;
+	Stg_Class_PrintFunction*         _print = _EntryPoint_Print;
+	Stg_Class_CopyFunction*           _copy = NULL;
+	EntryPoint_GetRunFunction*      _getRun = _ContextEntryPoint_GetRun;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _ContextEntryPoint_New(  CONTEXTENTRYPOINT_PASSARGS  );
+}
+
+void ContextEntryPoint_Init( void* contextEntryPoint, Name name, unsigned int castType ) {
+	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
+	
+	/* General info */
+	self->type = ContextEntryPoint_Type;
+	self->_sizeOfSelf = sizeof(ContextEntryPoint);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _EntryPoint_Delete;
+	self->_print = _EntryPoint_Print;
+	self->_copy = NULL;
+	self->_getRun = _ContextEntryPoint_GetRun;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_Object_Init( (Stg_Object*)self, name, GLOBAL );
+	_EntryPoint_Init( (EntryPoint*)self, castType );
+	
+	/* ContextEntryPoint info */
+	_ContextEntryPoint_Init( self );
+}
+
+ContextEntryPoint* _ContextEntryPoint_New(  CONTEXTENTRYPOINT_DEFARGS  )
+{
+	ContextEntryPoint* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ContextEntryPoint) );
+	self = (ContextEntryPoint*)_EntryPoint_New(  ENTRYPOINT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* ContextEntryPoint info */
+	_ContextEntryPoint_Init( self );
+	
+	return self;
+}
+
+void _ContextEntryPoint_Init( ContextEntryPoint* self ) {
+	/* General and Virtual info should already be set */
+	
+	/* ContextEntryPoint info */
+}
+
+
+Func_Ptr _ContextEntryPoint_GetRun( void* contextEntryPoint ) {
+	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
+	
+	switch( self->castType ) {
+		case ContextEntryPoint_Dt_CastType:
+			return (Func_Ptr)_ContextEntryPoint_Run_Dt;
+		
+		case ContextEntryPoint_Step_CastType:
+			return (Func_Ptr)_ContextEntryPoint_Run_Step;
+		
+		default:
+			return (Func_Ptr)_EntryPoint_GetRun( self );
+	}
+}
+
+
+double _ContextEntryPoint_Run_Dt( void* contextEntryPoint, void* data0 ) {
+	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
+	Hook_Index hookIndex;
+	double result = 0.0;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _ContextEntryPoint_Run_Dt, self->name );
+	#endif
+
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		result = ((ContextEntryPoint_Dt_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+
+	return result;
+}
+
+void _ContextEntryPoint_Run_Step( void* contextEntryPoint, void* data0, double data1 ) {
+	ContextEntryPoint* self = (ContextEntryPoint*)contextEntryPoint;
+	Hook_Index hookIndex;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _ContextEntryPoint_Run_Step, self->name );
+	#endif
+
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		((ContextEntryPoint_Step_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0, data1 );
+	}
+
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/DictionaryCheck.c
--- a/Base/Context/src/DictionaryCheck.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: AbstractContext.c 3562 2006-05-11 10:43:48Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "units.h"
-#include "types.h"
-#include "shortcuts.h"
-#include "ContextEntryPoint.h"
-#include <mpi.h>  /* subsequent files need this */
-#include "DictionaryCheck.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-
-void CheckDictionaryKeys( Dictionary* dictionary, Name errorMessage)
-{
-	Dictionary_Index index_I, index_J;
-	/* Put in the Journal_Firewall stream */
-	Stream* errStream = Journal_Register( Error_Type, "DictionaryCheck");
-	Index errCount;
-	Index** keyIndexArray;
-	Index errIndex = 0;
-	Bool  alreadyFoundRepeat = False;
-
-	keyIndexArray = Memory_Alloc_2DArray( Index, ((dictionary->count)*(dictionary->count - 1)), 
-					2, "Key Index Array" );
-	/* Iterate through the whole dictionary*/
-	errCount = 0;
-	for ( index_I = 0; index_I < dictionary->count; ++index_I )
-	{
-		alreadyFoundRepeat = False;
-		/* First, check if the current key has already been found & flagged as a repeat*/
-		for ( errIndex=0; errIndex < errCount; errIndex++) {
-			if ( index_I == keyIndexArray[errIndex][1] ) {
-				alreadyFoundRepeat = True;
-				break;
-			}
-		}
-		if (alreadyFoundRepeat==True) continue; 
-
-		/*For Each key, search through dictionary to see if there is another 
-		key the same*/
-		for (index_J = index_I+1; index_J < dictionary->count; ++index_J ) {
-			if (index_J != index_I)
-			{
-				/* If there are two keys with the same name */
-				if ( (0 == strcasecmp( dictionary->entryPtr[index_I]->key, 
-					dictionary->entryPtr[index_J]->key)) )
-				{
-					/* Check for the case that this is a 2nd or later 
-					 * repeat - in which case we don't need to add it */ 	
-					for ( errIndex=0; errIndex < errCount; errIndex++) {
-						if ( index_J == keyIndexArray[errIndex][0] ) {
-							alreadyFoundRepeat = True;
-							break;
-						}
-					}
-					if (alreadyFoundRepeat==True) break;
-
-/* 					preserve indexes index_I, index_J */
-					keyIndexArray[errCount][0] = index_I;
-					keyIndexArray[errCount][1] = index_J;					
-/* 					increment counter */
-					errCount++;
-					break;
-				}
-			}
-		}
-	}
-	/*if keyIndexArray is not empty, then do a print to error stream 
-	for each problem then call Journal_Firewall */
-	
-
-	if (errCount > 0) {
-		Index errIndex;
-		Journal_Printf(errStream, errorMessage);
-		Journal_Printf(errStream,"Error found in given dictionary:\n", dictionary);
-		Journal_Printf(errStream,"The following keys were repeated:\n");
-		Stream_Indent(errStream);
-		for (errIndex = 0; errIndex < errCount; errIndex++) {
-
-			Journal_Printf(errStream, "\"%s\"\n",					 
-				dictionary->entryPtr[keyIndexArray[errIndex][1]]->key );
-		}
-/* 		Do I need this one here if Journal_Firewall exits prog? */
-		Stream_UnIndent(errStream);
-		Journal_Printf(errStream, "Error in %s with %d entries in dictionary keys\n",
-			       __func__, errCount);
-		
-	}
-	Memory_Free(keyIndexArray);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/DictionaryCheck.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/DictionaryCheck.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,131 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: AbstractContext.c 3562 2006-05-11 10:43:48Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "units.h"
+#include "types.h"
+#include "shortcuts.h"
+#include "ContextEntryPoint.h"
+#include <mpi.h>  /* subsequent files need this */
+#include "DictionaryCheck.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+
+void CheckDictionaryKeys( Dictionary* dictionary, Name errorMessage)
+{
+	Dictionary_Index index_I, index_J;
+	/* Put in the Journal_Firewall stream */
+	Stream* errStream = Journal_Register( Error_Type, "DictionaryCheck");
+	Index errCount;
+	Index** keyIndexArray;
+	Index errIndex = 0;
+	Bool  alreadyFoundRepeat = False;
+
+	keyIndexArray = Memory_Alloc_2DArray( Index, ((dictionary->count)*(dictionary->count - 1)), 
+					2, "Key Index Array" );
+	/* Iterate through the whole dictionary*/
+	errCount = 0;
+	for ( index_I = 0; index_I < dictionary->count; ++index_I )
+	{
+		alreadyFoundRepeat = False;
+		/* First, check if the current key has already been found & flagged as a repeat*/
+		for ( errIndex=0; errIndex < errCount; errIndex++) {
+			if ( index_I == keyIndexArray[errIndex][1] ) {
+				alreadyFoundRepeat = True;
+				break;
+			}
+		}
+		if (alreadyFoundRepeat==True) continue; 
+
+		/*For Each key, search through dictionary to see if there is another 
+		key the same*/
+		for (index_J = index_I+1; index_J < dictionary->count; ++index_J ) {
+			if (index_J != index_I)
+			{
+				/* If there are two keys with the same name */
+				if ( (0 == strcasecmp( dictionary->entryPtr[index_I]->key, 
+					dictionary->entryPtr[index_J]->key)) )
+				{
+					/* Check for the case that this is a 2nd or later 
+					 * repeat - in which case we don't need to add it */ 	
+					for ( errIndex=0; errIndex < errCount; errIndex++) {
+						if ( index_J == keyIndexArray[errIndex][0] ) {
+							alreadyFoundRepeat = True;
+							break;
+						}
+					}
+					if (alreadyFoundRepeat==True) break;
+
+/* 					preserve indexes index_I, index_J */
+					keyIndexArray[errCount][0] = index_I;
+					keyIndexArray[errCount][1] = index_J;					
+/* 					increment counter */
+					errCount++;
+					break;
+				}
+			}
+		}
+	}
+	/*if keyIndexArray is not empty, then do a print to error stream 
+	for each problem then call Journal_Firewall */
+	
+
+	if (errCount > 0) {
+		Index errIndex;
+		Journal_Printf(errStream, errorMessage);
+		Journal_Printf(errStream,"Error found in given dictionary:\n", dictionary);
+		Journal_Printf(errStream,"The following keys were repeated:\n");
+		Stream_Indent(errStream);
+		for (errIndex = 0; errIndex < errCount; errIndex++) {
+
+			Journal_Printf(errStream, "\"%s\"\n",					 
+				dictionary->entryPtr[keyIndexArray[errIndex][1]]->key );
+		}
+/* 		Do I need this one here if Journal_Firewall exits prog? */
+		Stream_UnIndent(errStream);
+		Journal_Printf(errStream, "Error in %s with %d entries in dictionary keys\n",
+			       __func__, errCount);
+		
+	}
+	Memory_Free(keyIndexArray);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/DynamicVC.c
--- a/Base/Context/src/DynamicVC.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: DynamicVC.c 3881 2006-10-26 03:14:19Z KathleenHumble $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "ConditionFunction.h"
-#include "ConditionFunction_Register.h"
-#include "VariableCondition.h"
-#include "DynamicVC.h"
-
-#include <string.h>
-#include <assert.h>
-
-const Type DynamicVC_Type = "DynamicVC";
-const Name defaultDynamicVCName = "defaultDynamicVCName";
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* DynamicVC_Factory(
-	AbstractContext*					context,
-	Variable_Register*				varReg, 
-	ConditionFunction_Register*	conFuncReg, 
-	Dictionary*							dict, 
-	void*									data )
-{
-  return (VariableCondition*)DynamicVC_New( (char*)defaultDynamicVCName, context, varReg, conFuncReg, dict );
-}
-
-DynamicVC* DynamicVC_New(
-	Name									name,
-	AbstractContext*					context,
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register, 
-	Dictionary*							dictionary )
-{
-	DynamicVC* self = _DynamicVC_DefaultNew( name );
-
-	self->isConstructed = True;
-	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
-	_DynamicVC_Init( self );	
-
-	return self;
-}
-
-DynamicVC* _DynamicVC_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(DynamicVC);
-	Type                                                      type = DynamicVC_Type;
-	Stg_Class_DeleteFunction*                              _delete = _DynamicVC_Delete;
-	Stg_Class_PrintFunction*                                _print = _DynamicVC_Print;
-	Stg_Class_CopyFunction*                                  _copy = _DynamicVC_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_DynamicVC_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _VariableCondition_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _VariableCondition_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _VariableCondition_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _VariableCondition_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _VariableCondition_Destroy;
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-	VariableCondition_BuildSelfFunc*                    _buildSelf = NULL;
-	VariableCondition_PrintConciseFunc*              _printConcise = _DynamicVC_PrintConcise;
-	VariableCondition_ReadDictionaryFunc*          _readDictionary = _DynamicVC_ReadDictionary;
-	VariableCondition_GetSetFunc*                          _getSet = _DynamicVC_GetSet;
-	VariableCondition_GetVariableCountFunc*      _getVariableCount = _DynamicVC_GetVariableCount;
-	VariableCondition_GetVariableIndexFunc*      _getVariableIndex = _DynamicVC_GetVariableIndex;
-	VariableCondition_GetValueIndexFunc*            _getValueIndex = _DynamicVC_GetValueIndex;
-	VariableCondition_GetValueCountFunc*            _getValueCount = _DynamicVC_GetValueCount;
-	VariableCondition_GetValueFunc*                      _getValue = _DynamicVC_GetValue;
-	VariableCondition_ApplyFunc*                            _apply = DynamicVC_Apply;
-
-	return (DynamicVC*)_DynamicVC_New(  DYNAMICVC_PASSARGS  );
-}
-
-DynamicVC* _DynamicVC_New(  DYNAMICVC_DEFARGS  ) {
-	DynamicVC* self;
-
-	/* Allocate memory/General info */
-	assert( _sizeOfSelf >= sizeof(DynamicVC) );
-	self = (DynamicVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	
-	return self;
-}
-
-void _DynamicVC_Init( void* vc ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	assert( self );
-	self->vcMap = IMap_New();
-}	
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _DynamicVC_AssignFromXML( void* vc, Stg_ComponentFactory* cf, void* data ) {
-}
-
-void _DynamicVC_Build( void* vc, void* data ) {
-}
-
-void _DynamicVC_Initialise( void* vc, void* data ) {
-}
-
-void _DynamicVC_Execute( void* vc, void* data ) {
-}
-
-void _DynamicVC_Destroy( void* vc, void* data ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	NewClass_Delete( self->vcMap );
-
-	_VariableCondition_Destroy( self, data );
-}
-
-void _DynamicVC_ReadDictionary( void* vc, void* dict ) {
-}
-
-void _DynamicVC_Delete( void* vc ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	/* Stg_Class_Delete parent */
-	_VariableCondition_Delete( self );
-}
-
-void _DynamicVC_Print( void* vc, Stream* stream ) {
-	_VariableCondition_Print( vc );
-}
-
-void* _DynamicVC_Copy( const void* vc, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	return NULL;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-IndexSet* _DynamicVC_GetSet( void* vc ) {
-	return NULL;
-}
-
-VariableCondition_VariableIndex _DynamicVC_GetVariableCount( void* vc, Index globalIndex ) {
-	return 0;
-}
-
-Variable_Index _DynamicVC_GetVariableIndex( void* vc, Index globalIndex, VariableCondition_VariableIndex varIndex ) {
-	return 0;
-}
-
-VariableCondition_ValueIndex _DynamicVC_GetValueIndex( void* vc, 
-						       Index globalIndex, 
-						       VariableCondition_VariableIndex varIndex )
-{
-	return 0;
-}
-
-VariableCondition_ValueIndex _DynamicVC_GetValueCount( void* vc ) {
-	return 0;
-}
-
-VariableCondition_Value _DynamicVC_GetValue( void* vc, VariableCondition_ValueIndex valIndex ) {
-	VariableCondition_Value val;
-
-	val.type = VC_ValueType_Double;
-	val.as.typeDouble = 0.0;
-	return val;
-}
-
-void _DynamicVC_PrintConcise( void* vc, Stream* stream ) {
-}
-
-void DynamicVC_Apply( void* vc, void* ctx ) {
-	DynamicVC* self = (DynamicVC*)vc;
-	IMapIter* iter;
-	int ind, valInd, varInd;
-	VariableCondition_Value* val;
-	ConditionFunction* cf;
-	Stream *errorStrm = Journal_Register( Error_Type, self->type );
-
-	varInd = Variable_Register_GetIndex( self->variable_Register, self->var->name );
-	iter = IMapIter_New();
-	for( IMap_First( self->vcMap, iter );
-	     Iter_IsValid( iter ); 
-	     IMapIter_Next( iter ) )
-	{
-		ind = IMapIter_GetKey( iter );
-		valInd = IMapIter_GetValue( iter );
-		val = self->valueTbl + valInd;
-		switch( val->type ) {
-			case VC_ValueType_Double:
-				Journal_Firewall( self->var->dataTypeCounts[0] == 1, errorStrm,
-					"Error - in %s: while applying values for variable condition "
-					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
-					"which has %d components. Specify a scalar Variable instead.\n",
-					__func__, self->name, ind, "double",
-					self->var->name, self->var->dataTypeCounts[0] );
-				Variable_SetValueDouble( self->var, 
-							 ind, 
-							 val->as.typeDouble );
-				break;
-
-			case VC_ValueType_DoubleArray:
-				Variable_SetValue( self->var, 
-						   ind, 
-						   val->as.typeArray.array );
-				break;
-
-			case VC_ValueType_CFIndex:
-				Journal_Firewall( val->as.typeCFIndex != (unsigned)-1, errorStrm,
-					"Error - in %s: trying to apply to index %d of variable \"%s\", which "
-					"is supposed to be a condition function, but the cond. func. wasn't "
-					"found in the c.f. register.\n", __func__, ind, self->var->name );
-				cf = self->conFunc_Register->_cf[val->as.typeCFIndex];
-				ConditionFunction_Apply( cf, 
-							 ind, 
-							 varInd, 
-							 ctx, 
-							 Variable_GetStructPtr( self->var, ind ) );
-				break;
-
-			default:
-				assert( 0 );
-				break;
-		}
-	}
-	NewClass_Delete( iter );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-void DynamicVC_SetVariable( void* vc, Variable* var ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	assert( self );
-	self->var = var;
-}
-
-void DynamicVC_SetMaxEntries( void* vc, int maxEntries ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	assert( self );
-	/*IMap_Clear( self->vcMap );*/
-	IMap_SetMaxSize( self->vcMap, maxEntries );
-}
-
-int DynamicVC_GetMaxEntries( void* vc ) {
-   DynamicVC* self = (DynamicVC*)vc;
-
-   return IMap_GetMaxSize( self->vcMap );
-}
-
-void DynamicVC_SetValues( void* vc, int nVals, VariableCondition_Value* vals ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	assert( self );
-	self->valueCount = nVals;
-	self->valueTbl = MemRearray( self->valueTbl, VariableCondition_Value, nVals, DynamicVC_Type );
-	memcpy( self->valueTbl, vals, nVals * sizeof(VariableCondition_Value) );
-}
-
-void DynamicVC_Insert( void* vc, int index, int valIndex ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	assert( self );
-	if( !IMap_Has( self->vcMap, index ) )
-		IMap_Insert( self->vcMap, index, valIndex );
-}
-
-void DynamicVC_Remove( void* vc, int index ) {
-	DynamicVC* self = (DynamicVC*)vc;
-
-	assert( self );
-	if( IMap_Has( self->vcMap, index ) )
-		IMap_Remove( self->vcMap, index );
-}
-
-Bool DynamicVC_Has( void* _self, int index ) {
-	DynamicVC* self = (DynamicVC*)_self;
-
-	assert( self );
-        return IMap_Has( self->vcMap, index );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/DynamicVC.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/DynamicVC.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,338 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: DynamicVC.c 3881 2006-10-26 03:14:19Z KathleenHumble $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "ConditionFunction.h"
+#include "ConditionFunction_Register.h"
+#include "VariableCondition.h"
+#include "DynamicVC.h"
+
+#include <string.h>
+#include <assert.h>
+
+const Type DynamicVC_Type = "DynamicVC";
+const Name defaultDynamicVCName = "defaultDynamicVCName";
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* DynamicVC_Factory(
+	AbstractContext*					context,
+	Variable_Register*				varReg, 
+	ConditionFunction_Register*	conFuncReg, 
+	Dictionary*							dict, 
+	void*									data )
+{
+  return (VariableCondition*)DynamicVC_New( (char*)defaultDynamicVCName, context, varReg, conFuncReg, dict );
+}
+
+DynamicVC* DynamicVC_New(
+	Name									name,
+	AbstractContext*					context,
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register, 
+	Dictionary*							dictionary )
+{
+	DynamicVC* self = _DynamicVC_DefaultNew( name );
+
+	self->isConstructed = True;
+	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
+	_DynamicVC_Init( self );	
+
+	return self;
+}
+
+DynamicVC* _DynamicVC_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(DynamicVC);
+	Type                                                      type = DynamicVC_Type;
+	Stg_Class_DeleteFunction*                              _delete = _DynamicVC_Delete;
+	Stg_Class_PrintFunction*                                _print = _DynamicVC_Print;
+	Stg_Class_CopyFunction*                                  _copy = _DynamicVC_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_DynamicVC_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _VariableCondition_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _VariableCondition_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _VariableCondition_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _VariableCondition_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _VariableCondition_Destroy;
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+	VariableCondition_BuildSelfFunc*                    _buildSelf = NULL;
+	VariableCondition_PrintConciseFunc*              _printConcise = _DynamicVC_PrintConcise;
+	VariableCondition_ReadDictionaryFunc*          _readDictionary = _DynamicVC_ReadDictionary;
+	VariableCondition_GetSetFunc*                          _getSet = _DynamicVC_GetSet;
+	VariableCondition_GetVariableCountFunc*      _getVariableCount = _DynamicVC_GetVariableCount;
+	VariableCondition_GetVariableIndexFunc*      _getVariableIndex = _DynamicVC_GetVariableIndex;
+	VariableCondition_GetValueIndexFunc*            _getValueIndex = _DynamicVC_GetValueIndex;
+	VariableCondition_GetValueCountFunc*            _getValueCount = _DynamicVC_GetValueCount;
+	VariableCondition_GetValueFunc*                      _getValue = _DynamicVC_GetValue;
+	VariableCondition_ApplyFunc*                            _apply = DynamicVC_Apply;
+
+	return (DynamicVC*)_DynamicVC_New(  DYNAMICVC_PASSARGS  );
+}
+
+DynamicVC* _DynamicVC_New(  DYNAMICVC_DEFARGS  ) {
+	DynamicVC* self;
+
+	/* Allocate memory/General info */
+	assert( _sizeOfSelf >= sizeof(DynamicVC) );
+	self = (DynamicVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	
+	return self;
+}
+
+void _DynamicVC_Init( void* vc ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	assert( self );
+	self->vcMap = IMap_New();
+}	
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _DynamicVC_AssignFromXML( void* vc, Stg_ComponentFactory* cf, void* data ) {
+}
+
+void _DynamicVC_Build( void* vc, void* data ) {
+}
+
+void _DynamicVC_Initialise( void* vc, void* data ) {
+}
+
+void _DynamicVC_Execute( void* vc, void* data ) {
+}
+
+void _DynamicVC_Destroy( void* vc, void* data ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	NewClass_Delete( self->vcMap );
+
+	_VariableCondition_Destroy( self, data );
+}
+
+void _DynamicVC_ReadDictionary( void* vc, void* dict ) {
+}
+
+void _DynamicVC_Delete( void* vc ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	/* Stg_Class_Delete parent */
+	_VariableCondition_Delete( self );
+}
+
+void _DynamicVC_Print( void* vc, Stream* stream ) {
+	_VariableCondition_Print( vc );
+}
+
+void* _DynamicVC_Copy( const void* vc, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	return NULL;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+IndexSet* _DynamicVC_GetSet( void* vc ) {
+	return NULL;
+}
+
+VariableCondition_VariableIndex _DynamicVC_GetVariableCount( void* vc, Index globalIndex ) {
+	return 0;
+}
+
+Variable_Index _DynamicVC_GetVariableIndex( void* vc, Index globalIndex, VariableCondition_VariableIndex varIndex ) {
+	return 0;
+}
+
+VariableCondition_ValueIndex _DynamicVC_GetValueIndex( void* vc, 
+						       Index globalIndex, 
+						       VariableCondition_VariableIndex varIndex )
+{
+	return 0;
+}
+
+VariableCondition_ValueIndex _DynamicVC_GetValueCount( void* vc ) {
+	return 0;
+}
+
+VariableCondition_Value _DynamicVC_GetValue( void* vc, VariableCondition_ValueIndex valIndex ) {
+	VariableCondition_Value val;
+
+	val.type = VC_ValueType_Double;
+	val.as.typeDouble = 0.0;
+	return val;
+}
+
+void _DynamicVC_PrintConcise( void* vc, Stream* stream ) {
+}
+
+void DynamicVC_Apply( void* vc, void* ctx ) {
+	DynamicVC* self = (DynamicVC*)vc;
+	IMapIter* iter;
+	int ind, valInd, varInd;
+	VariableCondition_Value* val;
+	ConditionFunction* cf;
+	Stream *errorStrm = Journal_Register( Error_Type, self->type );
+
+	varInd = Variable_Register_GetIndex( self->variable_Register, self->var->name );
+	iter = IMapIter_New();
+	for( IMap_First( self->vcMap, iter );
+	     Iter_IsValid( iter ); 
+	     IMapIter_Next( iter ) )
+	{
+		ind = IMapIter_GetKey( iter );
+		valInd = IMapIter_GetValue( iter );
+		val = self->valueTbl + valInd;
+		switch( val->type ) {
+			case VC_ValueType_Double:
+				Journal_Firewall( self->var->dataTypeCounts[0] == 1, errorStrm,
+					"Error - in %s: while applying values for variable condition "
+					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
+					"which has %d components. Specify a scalar Variable instead.\n",
+					__func__, self->name, ind, "double",
+					self->var->name, self->var->dataTypeCounts[0] );
+				Variable_SetValueDouble( self->var, 
+							 ind, 
+							 val->as.typeDouble );
+				break;
+
+			case VC_ValueType_DoubleArray:
+				Variable_SetValue( self->var, 
+						   ind, 
+						   val->as.typeArray.array );
+				break;
+
+			case VC_ValueType_CFIndex:
+				Journal_Firewall( val->as.typeCFIndex != (unsigned)-1, errorStrm,
+					"Error - in %s: trying to apply to index %d of variable \"%s\", which "
+					"is supposed to be a condition function, but the cond. func. wasn't "
+					"found in the c.f. register.\n", __func__, ind, self->var->name );
+				cf = self->conFunc_Register->_cf[val->as.typeCFIndex];
+				ConditionFunction_Apply( cf, 
+							 ind, 
+							 varInd, 
+							 ctx, 
+							 Variable_GetStructPtr( self->var, ind ) );
+				break;
+
+			default:
+				assert( 0 );
+				break;
+		}
+	}
+	NewClass_Delete( iter );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+void DynamicVC_SetVariable( void* vc, Variable* var ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	assert( self );
+	self->var = var;
+}
+
+void DynamicVC_SetMaxEntries( void* vc, int maxEntries ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	assert( self );
+	/*IMap_Clear( self->vcMap );*/
+	IMap_SetMaxSize( self->vcMap, maxEntries );
+}
+
+int DynamicVC_GetMaxEntries( void* vc ) {
+   DynamicVC* self = (DynamicVC*)vc;
+
+   return IMap_GetMaxSize( self->vcMap );
+}
+
+void DynamicVC_SetValues( void* vc, int nVals, VariableCondition_Value* vals ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	assert( self );
+	self->valueCount = nVals;
+	self->valueTbl = MemRearray( self->valueTbl, VariableCondition_Value, nVals, DynamicVC_Type );
+	memcpy( self->valueTbl, vals, nVals * sizeof(VariableCondition_Value) );
+}
+
+void DynamicVC_Insert( void* vc, int index, int valIndex ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	assert( self );
+	if( !IMap_Has( self->vcMap, index ) )
+		IMap_Insert( self->vcMap, index, valIndex );
+}
+
+void DynamicVC_Remove( void* vc, int index ) {
+	DynamicVC* self = (DynamicVC*)vc;
+
+	assert( self );
+	if( IMap_Has( self->vcMap, index ) )
+		IMap_Remove( self->vcMap, index );
+}
+
+Bool DynamicVC_Has( void* _self, int index ) {
+	DynamicVC* self = (DynamicVC*)_self;
+
+	assert( self );
+        return IMap_Has( self->vcMap, index );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Finalise.c
--- a/Base/Context/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "VariableCondition.h"
-#include "VariableCondition_Register.h"
-#include "ConditionFunction_Register.h"
-#include "CompositeVC.h"
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool BaseContext_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	Stg_Class_Delete( condFunc_Register );
-	Stg_Class_Delete( variableCondition_Register );
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,56 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "VariableCondition.h"
+#include "VariableCondition_Register.h"
+#include "ConditionFunction_Register.h"
+#include "CompositeVC.h"
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool BaseContext_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	Stg_Class_Delete( condFunc_Register );
+	Stg_Class_Delete( variableCondition_Register );
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Init.c
--- a/Base/Context/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "VariableCondition.h"
-#include "VariableCondition_Register.h"
-#include "ConditionFunction_Register.h"
-#include "ConditionFunction.h"
-#include "CompositeVC.h"
-#include "DynamicVC.h"
-#include "VariableAllVC.h"
-#include "SetVC.h"
-#include "VariableDumpStream.h"
-#include "AbstractContext.h"
-#include "ContextEntryPoint.h"
-#include "Init.h"
-
-#include <stdio.h>
-
-Bool BaseContext_Init( int* argc, char** argv[] ) {
-	Stream* typedStream;
-	
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-	condFunc_Register = ConditionFunction_Register_New();
-	variableCondition_Register = VariableCondition_Register_New();
-	VariableCondition_Register_Add( variableCondition_Register, SetVC_Type, SetVC_Factory );
-	VariableCondition_Register_Add( variableCondition_Register, CompositeVC_Type, CompositeVC_Factory );
-	VariableCondition_Register_Add( variableCondition_Register, VariableAllVC_Type, VariableAllVC_Factory );
-
-	typedStream = VariableDumpStream_New( (char*)VariableDumpStream_Type );
-	Stream_Enable( typedStream, False );
-	Stream_SetLevel( typedStream, 1 );
-	Stream_SetFile( typedStream, stJournal->stdOut );
-	
-	Journal_RegisterTypedStream( typedStream );
-	
-	/** Adding default constructors of various components to the Stg_ComponentRegister */
-	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Variable_Type, (Name)"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, (Name)"0", (Stg_Component_DefaultConstructorFunction*)_SetVC_DefaultNew );
-	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister( ), VariableAllVC_Type, "0", (Stg_Component_DefaultConstructorFunction*)_VariableAllVC_DefaultNew );
-	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), DynamicVC_Type, (Name)"0", (Stg_Component_DefaultConstructorFunction*)_DynamicVC_DefaultNew  );
-
-	/** Register Parents for All Classes */
-	RegisterParent( Variable_Type, Stg_Component_Type );
-	RegisterParent( VariableCondition_Register_Type, Stg_Class_Type );
-	RegisterParent( VariableDumpStream_Type, CStream_Type );
-	RegisterParent( Variable_Register_Type, Stg_Class_Type );
-	RegisterParent( VariableCondition_Type, Stg_Component_Type );
-	RegisterParent( ConditionFunction_Type, Stg_Class_Type );
-	RegisterParent( ConditionFunction_Register_Type, Stg_Class_Type );
-	RegisterParent( CompositeVC_Type, VariableCondition_Type );
-	RegisterParent( DynamicVC_Type, VariableCondition_Type );
-	RegisterParent( VariableAllVC_Type, VariableCondition_Type );
-	RegisterParent( AbstractContext_Type, Stg_Component_Type );
-	RegisterParent( ContextEntryPoint_Type, EntryPoint_Type );
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,98 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "VariableCondition.h"
+#include "VariableCondition_Register.h"
+#include "ConditionFunction_Register.h"
+#include "ConditionFunction.h"
+#include "CompositeVC.h"
+#include "DynamicVC.h"
+#include "VariableAllVC.h"
+#include "SetVC.h"
+#include "VariableDumpStream.h"
+#include "AbstractContext.h"
+#include "ContextEntryPoint.h"
+#include "Init.h"
+
+#include <stdio.h>
+
+Bool BaseContext_Init( int* argc, char** argv[] ) {
+	Stream* typedStream;
+	
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+	condFunc_Register = ConditionFunction_Register_New();
+	variableCondition_Register = VariableCondition_Register_New();
+	VariableCondition_Register_Add( variableCondition_Register, SetVC_Type, SetVC_Factory );
+	VariableCondition_Register_Add( variableCondition_Register, CompositeVC_Type, CompositeVC_Factory );
+	VariableCondition_Register_Add( variableCondition_Register, VariableAllVC_Type, VariableAllVC_Factory );
+
+	typedStream = VariableDumpStream_New( (char*)VariableDumpStream_Type );
+	Stream_Enable( typedStream, False );
+	Stream_SetLevel( typedStream, 1 );
+	Stream_SetFile( typedStream, stJournal->stdOut );
+	
+	Journal_RegisterTypedStream( typedStream );
+	
+	/** Adding default constructors of various components to the Stg_ComponentRegister */
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Variable_Type, (Name)"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, (Name)"0", (Stg_Component_DefaultConstructorFunction*)_SetVC_DefaultNew );
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister( ), VariableAllVC_Type, "0", (Stg_Component_DefaultConstructorFunction*)_VariableAllVC_DefaultNew );
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), DynamicVC_Type, (Name)"0", (Stg_Component_DefaultConstructorFunction*)_DynamicVC_DefaultNew  );
+
+	/** Register Parents for All Classes */
+	RegisterParent( Variable_Type, Stg_Component_Type );
+	RegisterParent( VariableCondition_Register_Type, Stg_Class_Type );
+	RegisterParent( VariableDumpStream_Type, CStream_Type );
+	RegisterParent( Variable_Register_Type, Stg_Class_Type );
+	RegisterParent( VariableCondition_Type, Stg_Component_Type );
+	RegisterParent( ConditionFunction_Type, Stg_Class_Type );
+	RegisterParent( ConditionFunction_Register_Type, Stg_Class_Type );
+	RegisterParent( CompositeVC_Type, VariableCondition_Type );
+	RegisterParent( DynamicVC_Type, VariableCondition_Type );
+	RegisterParent( VariableAllVC_Type, VariableCondition_Type );
+	RegisterParent( AbstractContext_Type, Stg_Component_Type );
+	RegisterParent( ContextEntryPoint_Type, EntryPoint_Type );
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/SetVC.c
--- a/Base/Context/src/SetVC.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,443 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: SetVC.c 4153 2007-07-26 02:25:22Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "ConditionFunction.h"
-#include "ConditionFunction_Register.h"
-#include "VariableCondition.h"
-#include "SetVC.h"
-
-#include <string.h>
-#include <assert.h>
-
-
-const Type SetVC_Type = "SetVC";
-const Name defaultSetVCName = "defaultSetVCName";
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* SetVC_Factory(
-	AbstractContext*					context,
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register, 
-	Dictionary*							dictionary,
-	void*									data )
-{
-  return (VariableCondition*)SetVC_New( (char*)defaultSetVCName, context, NULL, variable_Register, conFunc_Register, dictionary );
-}
-
-SetVC* SetVC_New(
-	Name									name,
-	AbstractContext*					context,
-	char*									_dictionaryEntryName, 
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register,
-	Dictionary*							dictionary )
-{
-	SetVC* self = _SetVC_DefaultNew( name );
-
-	self->isConstructed = True;
-	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
-	_SetVC_Init( self,  _dictionaryEntryName );
-
-	return self;
-}
-
-SetVC* _SetVC_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                               _sizeOfSelf = sizeof(SetVC);
-	Type                                                       type = SetVC_Type;
-	Stg_Class_DeleteFunction*                               _delete = _SetVC_Delete;
-	Stg_Class_PrintFunction*                                 _print = _SetVC_Print;
-	Stg_Class_CopyFunction*                                   _copy = _SetVC_Copy;
-	Stg_Component_DefaultConstructorFunction*   _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_SetVC_DefaultNew;
-	Stg_Component_ConstructFunction*                     _construct = _VariableCondition_AssignFromXML;
-	Stg_Component_BuildFunction*                             _build = _VariableCondition_Build;
-	Stg_Component_InitialiseFunction*                   _initialise = _VariableCondition_Initialise;
-	Stg_Component_ExecuteFunction*                         _execute = _VariableCondition_Execute;
-	Stg_Component_DestroyFunction*                         _destroy = _SetVC_Destroy;
-	AllocationType                               nameAllocationType = NON_GLOBAL;
-	VariableCondition_BuildSelfFunc*                     _buildSelf = NULL;
-	VariableCondition_PrintConciseFunc*               _printConcise = _SetVC_PrintConcise;
-	VariableCondition_ReadDictionaryFunc*           _readDictionary = _SetVC_ReadDictionary;
-	VariableCondition_GetSetFunc*                           _getSet = _SetVC_GetSet;
-	VariableCondition_GetVariableCountFunc*       _getVariableCount = _SetVC_GetVariableCount;
-	VariableCondition_GetVariableIndexFunc*       _getVariableIndex = _SetVC_GetVariableIndex;
-	VariableCondition_GetValueIndexFunc*             _getValueIndex = _SetVC_GetValueIndex;
-	VariableCondition_GetValueCountFunc*             _getValueCount = _SetVC_GetValueCount;
-	VariableCondition_GetValueFunc*                       _getValue = _SetVC_GetValue;
-	VariableCondition_ApplyFunc*                             _apply = _VariableCondition_Apply;
-
-	return (SetVC*)_SetVC_New(  SETVC_PASSARGS  );
-}
-
-SetVC* _SetVC_New(  SETVC_DEFARGS  ) {
-	SetVC* self;
-	
-	/* Allocate memory/General info */
-	assert( _sizeOfSelf >= sizeof(SetVC) );
-	self = (SetVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	
-	return self;
-}
-
-void _SetVC_Init( void* setVC, Name _dictionaryEntryName ) {
-	SetVC* self = (SetVC*)setVC;
-	
-	self->_dictionaryEntryName = _dictionaryEntryName;
-}	
-	
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _SetVC_ReadDictionary( void* setVC, void* dictionary ) {
-	SetVC*			self = (SetVC*)setVC;
-	Dictionary_Entry_Value*	vcDictVal;
-	Dictionary_Entry_Value	_vcDictVal;
-	Dictionary_Entry_Value*	varsVal;
-	SetVC_Entry_Index	entry_I;
-	
-	
-	/* Find dictionary entry */
-	if (self->_dictionaryEntryName)
-		vcDictVal = Dictionary_Get( dictionary, (Dictionary_Entry_Key)self->_dictionaryEntryName  );
-	else {
-		vcDictVal = &_vcDictVal;
-		Dictionary_Entry_Value_InitFromStruct( vcDictVal, dictionary );
-	}
-	
-	if (vcDictVal) {
-		Dictionary_Entry_Value*		setVal = Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"indices"  );
-		Index				indexCnt = Dictionary_Entry_Value_AsUnsignedInt( 
-							Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"indexCount" )  );
-		Index				i, cnt;
-		
-		self->_vcset = IndexSet_New( indexCnt );
-		cnt = Dictionary_Entry_Value_GetCount( setVal );
-
-		for( i = 0; i < cnt; i++ )
-			IndexSet_Add( self->_vcset, Dictionary_Entry_Value_AsUnsignedInt( 
-				Dictionary_Entry_Value_GetElement( setVal, i ) ) );
-		
-		/* Obtain the variable entries */
-		varsVal = Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"variables");
-		self->_entryCount = Dictionary_Entry_Value_GetCount( varsVal  );
-		self->_entryTbl = Memory_Alloc_Array( SetVC_Entry, self->_entryCount, "SetVC->_entryTbl");
-		
-		for (entry_I = 0; entry_I < self->_entryCount; entry_I++) {
-			char* valType;
-			Dictionary_Entry_Value*	valueEntry;
-			Dictionary_Entry_Value*	varDictListVal;
-			
-			varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
-			valueEntry = Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"value" );
-			
-			self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
-				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
-				
-			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
-
-			if (!strcasecmp(valType, "func")) {
-				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
-				
-				self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
-				self->_entryTbl[entry_I].value.as.typeCFIndex = ConditionFunction_Register_GetIndex(
-					self->conFunc_Register, funcName);
-			}
-			else if (!strcasecmp(valType, "array")) {
-				Dictionary_Entry_Value*	valueElement;
-				Index			i;
-
-				self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
-				self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
-				self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
-					self->_entryTbl[entry_I].value.as.typeArray.size, "SetVC->_entryTbl[].value.as.typeArray.array" );
-					
-				for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++) {
-					valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
-					self->_entryTbl[entry_I].value.as.typeArray.array[i] = 
-						Dictionary_Entry_Value_AsDouble(valueElement);
-				}
-			}
-			else if( !strcasecmp( valType, "double" ) || !strcasecmp( valType, "d" ) || !strcasecmp( valType, "float" ) || !strcasecmp( valType, "f" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
-			}
-			else if( !strcasecmp( valType, "integer" ) || !strcasecmp( valType, "int" ) || !strcasecmp( valType, "i" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
-				self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
-			}
-			else if( !strcasecmp( valType, "short" ) || !strcasecmp( valType, "s" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
-				self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
-			}
-			else if( !strcasecmp( valType, "char" ) || !strcasecmp( valType, "c" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
-				self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
-			}
-			else if( !strcasecmp( valType, "pointer" ) || !strcasecmp( valType, "ptr" ) || !strcasecmp( valType, "p" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
-				self->_entryTbl[entry_I].value.as.typePtr = (void*) ((ArithPointer) Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
-			}
-			else {
-				/* Assume double */
-				Journal_DPrintf( Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
-			}
-		}
-	}
-	else {
-		self->_entryCount = 0;
-		self->_entryTbl = NULL;
-	}
-}
-
-void _SetVC_Delete(void* setVC) {
-	SetVC* self = (SetVC*)setVC;
-	
-	/* Stg_Class_Delete parent */
-	_VariableCondition_Delete(self);
-}
-
-void _SetVC_Destroy(void* setVC, void* data) {
-	SetVC* self = (SetVC*)setVC;
-		
-	if (self->_entryTbl) Memory_Free( self->_entryTbl );
-
-	_VariableCondition_Destroy( self, data );
-}
-
-void _SetVC_Print(void* setVC, Stream* stream) {
-	SetVC*				self = (SetVC*)setVC;
-	SetVC_Entry_Index	entry_I;
-	Index					i;
-	
-	/* Set the Journal for printing informations */
-	Stream* info = stream;
-	
-	/* General info */
-	Journal_Printf( info, "SetVC (ptr): %p\n", self);
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
-	Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
-	if (self->_dictionaryEntryName)
-		Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
-	Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
-	Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
-	if (self->_entryTbl)
-		for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
-		{
-			Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
-			Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
-			if (self->_entryTbl[entry_I].varName)
-				Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
-			Journal_Printf( info, "\t\t\tvalue:\n");
-			switch (self->_entryTbl[entry_I].value.type)
-			{
-				case VC_ValueType_Double:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
-					Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
-					break;
-					
-				case VC_ValueType_Int:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
-					Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
-					break;
-					
-				case VC_ValueType_Short:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
-					Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
-					break;
-					
-				case VC_ValueType_Char:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
-					Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
-					break;
-					
-				case VC_ValueType_Ptr:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
-					Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
-					break;
-					
-				case VC_ValueType_DoubleArray:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
-					Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
-					Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n", 
-						self->_entryTbl[entry_I].value.as.typeArray.array);
-					if (self->_entryTbl[entry_I].value.as.typeArray.array)
-						for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
-							Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
-								self->_entryTbl[entry_I].value.as.typeArray.array[i]);
-					break;
-					
-				case VC_ValueType_CFIndex:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
-					Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
-					break;
-			}
-		}
-	
-	/* Print parent */
-	_VariableCondition_Print(self);
-}
-
-
-void* _SetVC_Copy( const void* setVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	SetVC*	self = (SetVC*)setVC;
-	SetVC*	newSetVC;
-	PtrMap*	map = ptrMap;
-	Bool		ownMap = False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newSetVC = (SetVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
-	
-	newSetVC->_dictionaryEntryName = self->_dictionaryEntryName;
-	newSetVC->_entryCount = self->_entryCount;
-	
-	if( deep ) {
-		newSetVC->_vcset = (IndexSet*)Stg_Class_Copy( self->_vcset, NULL, deep, nameExt, map );
-		
-		if( (newSetVC->_entryTbl = (SetVC_Entry*)PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
-			newSetVC->_entryTbl = Memory_Alloc_Array( SetVC_Entry, newSetVC->_entryCount, "SetVC->_entryTbl");
-			memcpy( newSetVC->_entryTbl, self->_entryTbl, sizeof(SetVC_Entry) * newSetVC->_entryCount );
-			PtrMap_Append( map, newSetVC->_entryTbl, self->_entryTbl );
-		}
-	}
-	else {
-		newSetVC->_vcset = self->_vcset;
-		newSetVC->_entryTbl = self->_entryTbl;
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-	
-	return (void*)newSetVC;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-IndexSet* _SetVC_GetSet( void* variableCondition ) {
-	SetVC*		self = (SetVC*)variableCondition;
-	
-	return (IndexSet*) IndexSet_Duplicate( self->_vcset );
-}
-
-
-VariableCondition_VariableIndex _SetVC_GetVariableCount( void* variableCondition, Index globalIndex ) {
-	SetVC*	self = (SetVC*)variableCondition;
-	
-	return self->_entryCount;
-}
-
-
-Variable_Index _SetVC_GetVariableIndex( void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex ) {
-	SetVC*	self = (SetVC*)variableCondition;
-	
-	return Variable_Register_GetIndex(self->variable_Register, self->_entryTbl[varIndex].varName);
-}
-
-
-VariableCondition_ValueIndex _SetVC_GetValueIndex( void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex ) {
-	return varIndex;
-}
-
-
-VariableCondition_ValueIndex _SetVC_GetValueCount( void* variableCondition ) {
-	SetVC*	self = (SetVC*)variableCondition;
-	
-	return self->_entryCount;
-}
-
-
-VariableCondition_Value _SetVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex ) {
-	SetVC*	self = (SetVC*)variableCondition;
-
-	return self->_entryTbl[valIndex].value;
-}
-
-
-void _SetVC_PrintConcise( void* variableCondition, Stream* stream ) {
-	SetVC*		self = (SetVC*)variableCondition;
-	IndexSet_Index	set_I;
-	
-	Journal_Printf( stream, "\ttype: %s, set: {", self->type );
-	for( set_I = 0; set_I < self->_set->size; set_I++ ) {
-		if( IndexSet_IsMember( self->_set, set_I ) ) {
-			Journal_Printf( stream, "%u ", set_I );
-		}
-	}
-	Journal_Printf( stream, "}\n" );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/SetVC.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/SetVC.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,443 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: SetVC.c 4153 2007-07-26 02:25:22Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "ConditionFunction.h"
+#include "ConditionFunction_Register.h"
+#include "VariableCondition.h"
+#include "SetVC.h"
+
+#include <string.h>
+#include <assert.h>
+
+
+const Type SetVC_Type = "SetVC";
+const Name defaultSetVCName = "defaultSetVCName";
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* SetVC_Factory(
+	AbstractContext*					context,
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register, 
+	Dictionary*							dictionary,
+	void*									data )
+{
+  return (VariableCondition*)SetVC_New( (char*)defaultSetVCName, context, NULL, variable_Register, conFunc_Register, dictionary );
+}
+
+SetVC* SetVC_New(
+	Name									name,
+	AbstractContext*					context,
+	char*									_dictionaryEntryName, 
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register,
+	Dictionary*							dictionary )
+{
+	SetVC* self = _SetVC_DefaultNew( name );
+
+	self->isConstructed = True;
+	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
+	_SetVC_Init( self,  _dictionaryEntryName );
+
+	return self;
+}
+
+SetVC* _SetVC_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                               _sizeOfSelf = sizeof(SetVC);
+	Type                                                       type = SetVC_Type;
+	Stg_Class_DeleteFunction*                               _delete = _SetVC_Delete;
+	Stg_Class_PrintFunction*                                 _print = _SetVC_Print;
+	Stg_Class_CopyFunction*                                   _copy = _SetVC_Copy;
+	Stg_Component_DefaultConstructorFunction*   _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_SetVC_DefaultNew;
+	Stg_Component_ConstructFunction*                     _construct = _VariableCondition_AssignFromXML;
+	Stg_Component_BuildFunction*                             _build = _VariableCondition_Build;
+	Stg_Component_InitialiseFunction*                   _initialise = _VariableCondition_Initialise;
+	Stg_Component_ExecuteFunction*                         _execute = _VariableCondition_Execute;
+	Stg_Component_DestroyFunction*                         _destroy = _SetVC_Destroy;
+	AllocationType                               nameAllocationType = NON_GLOBAL;
+	VariableCondition_BuildSelfFunc*                     _buildSelf = NULL;
+	VariableCondition_PrintConciseFunc*               _printConcise = _SetVC_PrintConcise;
+	VariableCondition_ReadDictionaryFunc*           _readDictionary = _SetVC_ReadDictionary;
+	VariableCondition_GetSetFunc*                           _getSet = _SetVC_GetSet;
+	VariableCondition_GetVariableCountFunc*       _getVariableCount = _SetVC_GetVariableCount;
+	VariableCondition_GetVariableIndexFunc*       _getVariableIndex = _SetVC_GetVariableIndex;
+	VariableCondition_GetValueIndexFunc*             _getValueIndex = _SetVC_GetValueIndex;
+	VariableCondition_GetValueCountFunc*             _getValueCount = _SetVC_GetValueCount;
+	VariableCondition_GetValueFunc*                       _getValue = _SetVC_GetValue;
+	VariableCondition_ApplyFunc*                             _apply = _VariableCondition_Apply;
+
+	return (SetVC*)_SetVC_New(  SETVC_PASSARGS  );
+}
+
+SetVC* _SetVC_New(  SETVC_DEFARGS  ) {
+	SetVC* self;
+	
+	/* Allocate memory/General info */
+	assert( _sizeOfSelf >= sizeof(SetVC) );
+	self = (SetVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	
+	return self;
+}
+
+void _SetVC_Init( void* setVC, Name _dictionaryEntryName ) {
+	SetVC* self = (SetVC*)setVC;
+	
+	self->_dictionaryEntryName = _dictionaryEntryName;
+}	
+	
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _SetVC_ReadDictionary( void* setVC, void* dictionary ) {
+	SetVC*			self = (SetVC*)setVC;
+	Dictionary_Entry_Value*	vcDictVal;
+	Dictionary_Entry_Value	_vcDictVal;
+	Dictionary_Entry_Value*	varsVal;
+	SetVC_Entry_Index	entry_I;
+	
+	
+	/* Find dictionary entry */
+	if (self->_dictionaryEntryName)
+		vcDictVal = Dictionary_Get( dictionary, (Dictionary_Entry_Key)self->_dictionaryEntryName  );
+	else {
+		vcDictVal = &_vcDictVal;
+		Dictionary_Entry_Value_InitFromStruct( vcDictVal, dictionary );
+	}
+	
+	if (vcDictVal) {
+		Dictionary_Entry_Value*		setVal = Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"indices"  );
+		Index				indexCnt = Dictionary_Entry_Value_AsUnsignedInt( 
+							Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"indexCount" )  );
+		Index				i, cnt;
+		
+		self->_vcset = IndexSet_New( indexCnt );
+		cnt = Dictionary_Entry_Value_GetCount( setVal );
+
+		for( i = 0; i < cnt; i++ )
+			IndexSet_Add( self->_vcset, Dictionary_Entry_Value_AsUnsignedInt( 
+				Dictionary_Entry_Value_GetElement( setVal, i ) ) );
+		
+		/* Obtain the variable entries */
+		varsVal = Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"variables");
+		self->_entryCount = Dictionary_Entry_Value_GetCount( varsVal  );
+		self->_entryTbl = Memory_Alloc_Array( SetVC_Entry, self->_entryCount, "SetVC->_entryTbl");
+		
+		for (entry_I = 0; entry_I < self->_entryCount; entry_I++) {
+			char* valType;
+			Dictionary_Entry_Value*	valueEntry;
+			Dictionary_Entry_Value*	varDictListVal;
+			
+			varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
+			valueEntry = Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"value" );
+			
+			self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
+				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
+				
+			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
+
+			if (!strcasecmp(valType, "func")) {
+				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
+				
+				self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
+				self->_entryTbl[entry_I].value.as.typeCFIndex = ConditionFunction_Register_GetIndex(
+					self->conFunc_Register, funcName);
+			}
+			else if (!strcasecmp(valType, "array")) {
+				Dictionary_Entry_Value*	valueElement;
+				Index			i;
+
+				self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
+				self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
+				self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
+					self->_entryTbl[entry_I].value.as.typeArray.size, "SetVC->_entryTbl[].value.as.typeArray.array" );
+					
+				for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++) {
+					valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
+					self->_entryTbl[entry_I].value.as.typeArray.array[i] = 
+						Dictionary_Entry_Value_AsDouble(valueElement);
+				}
+			}
+			else if( !strcasecmp( valType, "double" ) || !strcasecmp( valType, "d" ) || !strcasecmp( valType, "float" ) || !strcasecmp( valType, "f" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+			}
+			else if( !strcasecmp( valType, "integer" ) || !strcasecmp( valType, "int" ) || !strcasecmp( valType, "i" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
+				self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+			}
+			else if( !strcasecmp( valType, "short" ) || !strcasecmp( valType, "s" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
+				self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+			}
+			else if( !strcasecmp( valType, "char" ) || !strcasecmp( valType, "c" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
+				self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+			}
+			else if( !strcasecmp( valType, "pointer" ) || !strcasecmp( valType, "ptr" ) || !strcasecmp( valType, "p" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
+				self->_entryTbl[entry_I].value.as.typePtr = (void*) ((ArithPointer) Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
+			}
+			else {
+				/* Assume double */
+				Journal_DPrintf( Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
+					"Type to variable on variable condition not given, assuming double\n" );
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+			}
+		}
+	}
+	else {
+		self->_entryCount = 0;
+		self->_entryTbl = NULL;
+	}
+}
+
+void _SetVC_Delete(void* setVC) {
+	SetVC* self = (SetVC*)setVC;
+	
+	/* Stg_Class_Delete parent */
+	_VariableCondition_Delete(self);
+}
+
+void _SetVC_Destroy(void* setVC, void* data) {
+	SetVC* self = (SetVC*)setVC;
+		
+	if (self->_entryTbl) Memory_Free( self->_entryTbl );
+
+	_VariableCondition_Destroy( self, data );
+}
+
+void _SetVC_Print(void* setVC, Stream* stream) {
+	SetVC*				self = (SetVC*)setVC;
+	SetVC_Entry_Index	entry_I;
+	Index					i;
+	
+	/* Set the Journal for printing informations */
+	Stream* info = stream;
+	
+	/* General info */
+	Journal_Printf( info, "SetVC (ptr): %p\n", self);
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
+	Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
+	if (self->_dictionaryEntryName)
+		Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
+	Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
+	Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
+	if (self->_entryTbl)
+		for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
+		{
+			Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
+			Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
+			if (self->_entryTbl[entry_I].varName)
+				Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
+			Journal_Printf( info, "\t\t\tvalue:\n");
+			switch (self->_entryTbl[entry_I].value.type)
+			{
+				case VC_ValueType_Double:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
+					Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
+					break;
+					
+				case VC_ValueType_Int:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
+					Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
+					break;
+					
+				case VC_ValueType_Short:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
+					Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
+					break;
+					
+				case VC_ValueType_Char:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
+					Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
+					break;
+					
+				case VC_ValueType_Ptr:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
+					Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
+					break;
+					
+				case VC_ValueType_DoubleArray:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
+					Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
+					Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n", 
+						self->_entryTbl[entry_I].value.as.typeArray.array);
+					if (self->_entryTbl[entry_I].value.as.typeArray.array)
+						for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+							Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
+								self->_entryTbl[entry_I].value.as.typeArray.array[i]);
+					break;
+					
+				case VC_ValueType_CFIndex:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
+					Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
+					break;
+			}
+		}
+	
+	/* Print parent */
+	_VariableCondition_Print(self);
+}
+
+
+void* _SetVC_Copy( const void* setVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	SetVC*	self = (SetVC*)setVC;
+	SetVC*	newSetVC;
+	PtrMap*	map = ptrMap;
+	Bool		ownMap = False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newSetVC = (SetVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
+	
+	newSetVC->_dictionaryEntryName = self->_dictionaryEntryName;
+	newSetVC->_entryCount = self->_entryCount;
+	
+	if( deep ) {
+		newSetVC->_vcset = (IndexSet*)Stg_Class_Copy( self->_vcset, NULL, deep, nameExt, map );
+		
+		if( (newSetVC->_entryTbl = (SetVC_Entry*)PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
+			newSetVC->_entryTbl = Memory_Alloc_Array( SetVC_Entry, newSetVC->_entryCount, "SetVC->_entryTbl");
+			memcpy( newSetVC->_entryTbl, self->_entryTbl, sizeof(SetVC_Entry) * newSetVC->_entryCount );
+			PtrMap_Append( map, newSetVC->_entryTbl, self->_entryTbl );
+		}
+	}
+	else {
+		newSetVC->_vcset = self->_vcset;
+		newSetVC->_entryTbl = self->_entryTbl;
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+	
+	return (void*)newSetVC;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+IndexSet* _SetVC_GetSet( void* variableCondition ) {
+	SetVC*		self = (SetVC*)variableCondition;
+	
+	return (IndexSet*) IndexSet_Duplicate( self->_vcset );
+}
+
+
+VariableCondition_VariableIndex _SetVC_GetVariableCount( void* variableCondition, Index globalIndex ) {
+	SetVC*	self = (SetVC*)variableCondition;
+	
+	return self->_entryCount;
+}
+
+
+Variable_Index _SetVC_GetVariableIndex( void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex ) {
+	SetVC*	self = (SetVC*)variableCondition;
+	
+	return Variable_Register_GetIndex(self->variable_Register, self->_entryTbl[varIndex].varName);
+}
+
+
+VariableCondition_ValueIndex _SetVC_GetValueIndex( void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex ) {
+	return varIndex;
+}
+
+
+VariableCondition_ValueIndex _SetVC_GetValueCount( void* variableCondition ) {
+	SetVC*	self = (SetVC*)variableCondition;
+	
+	return self->_entryCount;
+}
+
+
+VariableCondition_Value _SetVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex ) {
+	SetVC*	self = (SetVC*)variableCondition;
+
+	return self->_entryTbl[valIndex].value;
+}
+
+
+void _SetVC_PrintConcise( void* variableCondition, Stream* stream ) {
+	SetVC*		self = (SetVC*)variableCondition;
+	IndexSet_Index	set_I;
+	
+	Journal_Printf( stream, "\ttype: %s, set: {", self->type );
+	for( set_I = 0; set_I < self->_set->size; set_I++ ) {
+		if( IndexSet_IsMember( self->_set, set_I ) ) {
+			Journal_Printf( stream, "%u ", set_I );
+		}
+	}
+	Journal_Printf( stream, "}\n" );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Variable.c
--- a/Base/Context/src/Variable.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1145 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Variable.c 4149 2007-06-29 06:59:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ContextEntryPoint.h"
-#include "AbstractContext.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <math.h>
-
-/* Textual name of this class */
-const Type Variable_Type = "Variable";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-Variable* Variable_New(
-	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);
-	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_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;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	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 ) {
-	/* 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_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;
-	Index                                                dataCount = 0;
-	SizeT*                                             dataOffsets = NULL;
-	Variable_DataType*                                   dataTypes = NULL;
-	Index*                                          dataTypeCounts = NULL;
-	Name*                                                dataNames = NULL;
-	SizeT*                                           structSizePtr = NULL;
-	Index*                                            arraySizePtr = NULL;
-	Variable_ArraySizeFunc*                          arraySizeFunc = NULL;
-	void**                                             arrayPtrPtr = NULL;
-	Variable_Register*                                          vr = NULL;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	Variable* self = _Variable_New(  VARIABLE_PASSARGS  );
-	
-	return self;
-}
-
-Variable* Variable_NewScalar( 
-	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);
-	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_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;
-	Index                                                dataCount = 1;
-	Name*                                                dataNames = 0;
-	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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	Variable*			self;
-	SizeT					dataOffsets[] = { 0 };
-	Variable_DataType	dataTypes[] = { dataType };		/* Init value later */
-	Index					dataTypeCounts[] = { 1 };
-	
-	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,
-	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);
-	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_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;
-	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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	Variable*			self;
-	SizeT					dataOffsets[] = { 0 };
-	Variable_DataType	dataTypes[] = { dataType }; /* Init later... */
-	Index					dataTypeCounts[] = { 0 }; /* Init later... */
-	char**					dNames;
-        Name* dataNames;
-	Index					vector_I;
-	va_list				ap;
-
-	dataTypeCounts[0] = dataTypeCount;
-
-	dNames = Memory_Alloc_Array( char*, dataTypeCount, "dataNames" );
-
-	va_start( ap, vr );
-	for( vector_I = 0; vector_I < dataTypeCount; vector_I++ ) {
-		dNames[vector_I] = va_arg( ap, char* );
-	}
-	va_end( ap );
-	
-        dataNames=(Name*)dNames;
-	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,
-	AbstractContext*			context,
-	Variable_DataType			dataType,
-	Index							dataTypeCount,
-	Index*						arraySizePtr,
-	Variable_ArraySizeFunc*	arraySizeFunc,
-	void**						arrayPtrPtr,
-	Variable_Register*		vr,
-	Name*						dataNames )
-{
-	/* 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_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;
-	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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	Variable*			self;
-	SizeT					dataOffsets[] = { 0 };
-	Variable_DataType	dataTypes[] = { dataType };
-	Index					dataTypeCounts[] = { 0 };
-
-	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;
-}
-
-Variable* _Variable_New(  VARIABLE_DEFARGS  ) {
-	Variable* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Variable) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (Variable*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	self->_build = _build;
-	self->_initialise = _initialise;
-	
-	/* Variable info */
-	
-	return self;
-}
-
-void _Variable_Init(
-	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 );*/
-
-	/* General and Virtual info should already be set */
-	
-	/* Variable info */
-	self->context = context;
-	self->allocateSelf  = allocateSelf;
-	self->offsetCount = dataCount;
-	self->structSizePtr = structSizePtr;
-	self->arraySizePtr = arraySizePtr;
-	self->arraySizeFunc = arraySizeFunc;
-	self->arrayPtrPtr = arrayPtrPtr;
-	self->parent = NULL;
-
-	/* Checks */
-	/*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 );*/
-
-	/* Use of this class has increased... can't assume the info arrays are on persistant memory... copy by default. They will
-	   be deleted. */
-	Journal_Firewall( dataOffsets ? True : False, Journal_Register( Error_Type, Variable_Type ), "dataOffsets is null\n" );
-	self->offsets = Memory_Alloc_Array( SizeT, self->offsetCount, "Variable->offsets" );
-	memcpy( self->offsets, dataOffsets, sizeof(SizeT) * self->offsetCount );
-	
-	Journal_Firewall( dataTypes ? True : False, Journal_Register( Error_Type, Variable_Type ), "dataTypes is null\n" );
-	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" );
-	self->dataTypeCounts = Memory_Alloc_Array( Index, self->offsetCount, "Variable->dataTypeCounts" );
-	memcpy( self->dataTypeCounts, dataTypeCounts, sizeof(Index) * self->offsetCount );
-	
-	/* These get set at the build phase (when we assume the variable's data memory has been allocated) */
-	self->structSize = 0;
-	self->arrayPtr = 0;
-	self->dataSizes = 0;
-	
-	if ( dataNames && self->offsetCount == 1 && self->dataTypeCounts[0] > 1 ) {
-		/* Vector case */
-		self->subVariablesCount = self->dataTypeCounts[0];
-	}
-	else {
-		/* Scalar or Complex case */
-		self->subVariablesCount = self->offsetCount;
-	}
-	self->components = Memory_Alloc_Array( Variable*, self->subVariablesCount, "Variable->components" );
-	memset( self->components, 0, sizeof(Variable*) * self->subVariablesCount );
-	
-	/* If the variable register is provided, add this and component variable(s) to the register */
-	if( vr ) {
-		self->vr = vr;
-		Variable_Register_Add( vr, self );
-		
-		/* 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;
-			
-			for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-				if( dataNames[component_I] ) {
-					SizeT					componentOffsets[] = { 0 };
-					Variable_DataType	componentTypes[] = { self->dataTypes[component_I] };
-					Index					componentTypeCounts[] = { 0 };
-
-					componentOffsets[0] = self->offsets[component_I];
-					componentTypeCounts[0] = self->dataTypeCounts[component_I];
-					
-					/* Assumption: components are scalar or vector, but cannot be complex */
-					self->components[component_I] = Variable_New( 
-						dataNames[component_I], 
-						self->context,
-						1, 
-						componentOffsets, 
-						componentTypes, 
-						componentTypeCounts,
-						0,
-						self->structSizePtr,
-						self->arraySizePtr,
-						self->arraySizeFunc,
-						self->arrayPtrPtr,
-						vr );
-					self->components[component_I]->parent = self;
-				}
-			}
-		}
-		/* 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;
-
-			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[] = { self->dataTypes[0] };
-					Index					componentTypeCounts[] = { 1 };
-				
-					componentOffsets[0] = 
-						(ArithPointer)self->offsets[0] + 
-						( self->dataTypes[0] == Variable_DataType_Char ? ( sizeof(char) * vector_I ) :
-						  self->dataTypes[0] == Variable_DataType_Short ? ( sizeof(short) * vector_I ) :
-						  self->dataTypes[0] == Variable_DataType_Int ? ( sizeof(int) * vector_I ) :
-						  self->dataTypes[0] == Variable_DataType_Float ? ( sizeof(float) * vector_I ) :
-						  self->dataTypes[0] == Variable_DataType_Double ? ( sizeof(double) * vector_I ) :
-						  self->dataTypes[0] == Variable_DataType_Pointer ? ( sizeof(void*) * vector_I ) :
-						  Journal_Firewall(
-							0,
-							Journal_Register( Error_Type, Variable_Type ),
-							"Vector is of a non-builtin type\n" ) );
-
-					/* Assumption: vector-components are scalar, but cannot be complex */
-					self->components[vector_I] = Variable_New( 
-						dataNames[vector_I],
-						self->context,
-						1, 
-						componentOffsets, 
-						componentTypes, 
-						componentTypeCounts,
-						0,
-						self->structSizePtr,
-						self->arraySizePtr,
-						self->arraySizeFunc,
-						self->arrayPtrPtr,
-						vr );
-					self->components[vector_I]->parent = self;
-				}
-			}
-		}
-	}
-	else {
-		self->vr = NULL;
-	}
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _Variable_Delete( void* variable ) {
-	Variable* self = (Variable*)variable;
-
-	/* Stg_Class_Delete parent */
-	_Stg_Component_Delete( self );
-}
-
-
-void _Variable_Print( void* variable, Stream* stream ) {
-	Variable*	self = (Variable*)variable;
-	Index		component_I;
-	
-	/* Print parent */
-	_Stg_Component_Print( self, stream );
-	
-	/* General info */
-	Journal_Printf( stream, "Variable (ptr): (%p)\n", self );
-	
-	/* Virtual info */
-	
-	/* Variable info */
-	Journal_Printf( stream, "\toffsetCount: %u\n", self->offsetCount );
-	
-	Journal_Printf( stream, "\toffsets (ptr): %p\n", self->offsets );
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		Journal_Printf( stream, "\t\toffsets[%u]: %lu\n", component_I, self->offsets[component_I] );
-	}
-	
-	Journal_Printf( stream, "\tdataTypes (ptr): %p\n", self->dataTypes );
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		Journal_Printf( stream, "\t\tdataTypes[%u]: %lu\n", component_I, self->dataTypes[component_I] );
-	}
-	
-	Journal_Printf( stream, "\tdataTypeCounts (ptr): %p\n", self->dataTypeCounts );
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		Journal_Printf( stream, "\t\tdataTypeCounts[%u]: %lu\n", component_I, self->dataTypeCounts[component_I] );
-	}
-
-	Journal_Printf( stream, "\tdataSizes (ptr): %p\n", self->dataSizes );
-	for( component_I = 0; component_I < self->offsetCount && self->dataSizes; component_I++ ) {
-		Journal_Printf( stream, "\t\tdataSizes[%u]: %lu\n", component_I, self->dataSizes[component_I] );
-	}
-
-	Journal_Printf( stream, "\tcomponents (ptr): %p\n", self->components );
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		Journal_Printf( stream, "\t\tcomponents[%u] (ptr): %p\n", component_I, self->components[component_I] );
-		if( self->components[component_I] ) {
-			Journal_Printf( stream, "\t\tcomponents[%u]: %s\n", component_I, self->components[component_I]->name );
-		}
-	}
-
-	Journal_Printf( stream, "\tstructSize: %lu\n", self->structSize );
-	Journal_Printf( stream, "\tstructSizePtr (ptr): %p\n", self->structSizePtr );
-
-	Journal_Printf( stream, "\tarrayPtr (ptr): %p\n", self->arrayPtr );
-	Journal_Printf( stream, "\tarrayPtrPtr (ptr): %p\n", self->arrayPtrPtr );
-
-	Journal_Printf( stream, "\tarraySize: %lu\n", _Variable_GetNewArraySize( self ) );
-	Journal_Printf( stream, "\tarraySizePtr (ptr): %p\n", self->arraySizePtr );
-	Journal_Printf( stream, "\tarraySizeFunc (ptr): %p\n", self->arraySizeFunc );
-
-	Journal_Printf( stream, "\tallocateSelf = %s\n", self->allocateSelf ? "True" : "False" );
-}
-
-
-void* _Variable_Copy( const void* variable, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	Variable*	self = (Variable*)variable;
-	Variable*	newVariable;
-	PtrMap*		map = ptrMap;
-	
-	newVariable = (Variable*)_Stg_Component_Copy( self, dest, deep, nameExt, map );
-	PtrMap_Append( map, self, newVariable );
-	
-	/* virtual methods */
-	newVariable->offsetCount = self->offsetCount;
-	newVariable->structSize = self->structSize;
-	newVariable->arraySizePtr = self->arraySizePtr;
-	newVariable->arraySizeFunc = self->arraySizeFunc;
-	
-	newVariable->allocateSelf = self->allocateSelf; /* This may change depending on whether arrayPtr is found in map */
-	newVariable->subVariablesCount = self->subVariablesCount;
-
-	/* single valued members */
-	
-	if( deep ) {
-          if( (newVariable->offsets = (SizeT*)PtrMap_Find( map, self->offsets )) == NULL && self->offsets != NULL ) {
-			newVariable->offsets = Memory_Alloc_Array( SizeT, newVariable->offsetCount, "Variable->offsets" );
-			memcpy( newVariable->offsets, self->offsets, sizeof(SizeT) * newVariable->offsetCount );
-			PtrMap_Append( map, self->offsets, newVariable->offsets );
-		}
-		
-          if( (newVariable->dataTypes = (Variable_DataType*)PtrMap_Find( map, self->dataTypes )) == NULL && self->offsets != NULL ) {
-			newVariable->dataTypes = Memory_Alloc_Array( Variable_DataType, newVariable->offsetCount, "Variable->dataTypes" );
-			memcpy( newVariable->dataTypes, self->dataTypes, sizeof(Variable_DataType) * newVariable->offsetCount );
-			PtrMap_Append( map, self->dataTypes, newVariable->dataTypes );
-		}
-		
-          if( (newVariable->dataTypeCounts = (Index*)PtrMap_Find( map, self->dataTypeCounts )) == NULL && self->dataTypeCounts != NULL ) {
-			newVariable->dataTypeCounts = Memory_Alloc_Array( Index, newVariable->offsetCount, "Variable->dataTypeCounts" );
-			memcpy( newVariable->dataTypeCounts, self->dataTypeCounts, sizeof(Index) * newVariable->offsetCount );
-			PtrMap_Append( map, self->dataTypeCounts, newVariable->dataTypeCounts );
-		}
-		
-		if ( self->structSizePtr != NULL ) {
-                  if( (newVariable->structSizePtr = (SizeT*)PtrMap_Find( map, self->structSizePtr )) == NULL ) {
-				newVariable->structSizePtr = Memory_Alloc_Array( 
-					SizeT, 
-					1, 
-					"Variable->structSizePtr" );
-				memcpy( newVariable->structSizePtr, self->structSizePtr, sizeof(SizeT) );
-				PtrMap_Append( map, self->structSizePtr, newVariable->structSizePtr );
-			}
-		}
-		else {
-			newVariable->structSizePtr = NULL;
-		}
-		
-		if ( self->arraySizePtr != NULL ) {
-                  if( (newVariable->arraySizePtr = (Index*)PtrMap_Find( map, self->arraySizePtr )) == NULL ) {
-				newVariable->arraySizePtr = Memory_Alloc_Array(
-					Index,
-					1,
-					"Variable->arraySizePtr" );
-				memcpy( newVariable->arraySizePtr, self->arraySizePtr, sizeof(Index) );
-				PtrMap_Append( map, self->arraySizePtr, newVariable->arraySizePtr );
-			}
-		}
-		else {
-			newVariable->arraySizeFunc = NULL;
-		}
-		if ( self->arraySizeFunc != NULL ) {
-                  if( (newVariable->arraySizeFunc =
-                       (Variable_ArraySizeFunc*)PtrMap_Find( map, (void*)self->arraySizeFunc )) == NULL ) {
-                    newVariable->arraySizeFunc = (Variable_ArraySizeFunc*)
-                      Memory_Alloc_Array(void*,
-                                         1,
-                                         "Variable->arraySizeFunc" );
-                    memcpy((void*)newVariable->arraySizeFunc,
-                           (void*)self->arraySizeFunc, sizeof(Index) );
-                    PtrMap_Append(map,
-                                  (void*)(self->arraySizeFunc),
-                                  (void*)(newVariable->arraySizeFunc));
-                  }
-		}
-		else {
-			newVariable->arraySizeFunc = NULL;
-		}
-		
-		if( (newVariable->dataSizes = (SizeT*)PtrMap_Find( map, self->dataSizes )) == NULL && self->dataSizes != NULL ) {
-			newVariable->dataSizes = Memory_Alloc_Array( SizeT, newVariable->offsetCount, "Variable->dataSizes" );
-			memcpy( newVariable->dataSizes, self->dataSizes, sizeof(SizeT) * newVariable->offsetCount );
-			PtrMap_Append( map, self->dataSizes, newVariable->dataSizes );
-		}
-
-		if( (newVariable->arrayPtrPtr = (void**)PtrMap_Find( map, self->arrayPtrPtr )) == NULL && self->arrayPtrPtr != NULL ) {	
-			if( (newVariable->arrayPtr = PtrMap_Find( map, self->arrayPtr )) == NULL && self->arrayPtr != NULL ) {
-				Index memoryToAllocSize = _Variable_GetNewArraySize( self ) * self->structSize;
-				newVariable->arrayPtr = Memory_Alloc_Bytes( 
-					memoryToAllocSize,
-					Variable_Type,
-					"SelfAllocedArray" );
-				memcpy( newVariable->arrayPtr, self->arrayPtr, memoryToAllocSize );
-				PtrMap_Append( map, self->arrayPtr, newVariable->arrayPtr );
-
-				newVariable->arrayPtrPtr = &(newVariable->arrayPtr);
-				newVariable->allocateSelf = True;
-			}
-		}
-		else {
-			newVariable->arrayPtr = *newVariable->arrayPtrPtr;
-			memcpy( newVariable->arrayPtr, self->arrayPtr, _Variable_GetNewArraySize(self) * self->structSize );
-		}
-		
-		if( (newVariable->components = (Variable**)PtrMap_Find( map, self->components )) == NULL && self->components != NULL ) {
-			Index	comp_I;
-			
-			if( newVariable->offsetCount == 1 && newVariable->dataTypeCounts[0] > 1 ) {
-				/* Vector case */
-				newVariable->components = Memory_Alloc_Array( 
-					Variable*, 
-					newVariable->dataTypeCounts[0], 
-					"Variable->components" );
-				memset( newVariable->components, 0, sizeof(Variable*) * newVariable->dataTypeCounts[0] );
-				
-				for( comp_I = 0; comp_I < newVariable->dataTypeCounts[0]; comp_I++ ) {
-					newVariable->components[comp_I] = (Variable*)Stg_Class_Copy( 
-						self->components[comp_I], 
-						NULL, 
-						deep, 
-						nameExt, 
-						map );
-				}
-			}
-			else {
-				/* Scalar or Complex case */
-				newVariable->components = Memory_Alloc_Array( 
-					Variable*, 
-					newVariable->offsetCount, 
-					"Variable->components" );
-				memset( newVariable->components, 0, sizeof(Variable*) * newVariable->offsetCount );
-				
-				for( comp_I = 0; comp_I < newVariable->offsetCount; comp_I++ ) {
-					if ( self->components[comp_I] ) {
-						newVariable->components[comp_I] = (Variable*)Stg_Class_Copy( 
-							self->components[comp_I], 
-							NULL, 
-							deep, 
-							nameExt, 
-							map );
-					}
-				}
-			}
-			
-			PtrMap_Append( map, self->components, newVariable->components );
-		}
-
-		if ( self->vr ) {
-                  newVariable->vr = (Variable_Register*)Stg_Class_Copy( self->vr, NULL, deep, nameExt, map );
-		}
-	}
-	else {
-		fprintf( stderr, "Warning: please don't shallow copy variables yet...or ever!\n" );
-	}
-	
-	return (void*)newVariable;
-}
-
-
-void _Variable_Build( void* variable, void* data ) {
-	Variable*	self = (Variable*)variable;
-	Index 		component_I;
-	Index 		subVariable_I;
-
-	if( self->parent ) {
-		/* We need to build the parent first, as it may initialise data structures needed 
-	 	 * by this Variable. BUT, the parent will call Build() on all it's sub-Variables
-	 	 * including this one, so we need to avoid an infinite loop. */
-		self->isBuilt = True;
-		Stg_Component_Build( self->parent, NULL, False );
-		self->isBuilt = False;
-	}
-	
-	/* Obtain the actual array size, and array pointer */
-	Journal_Firewall( 
-		( self->arraySizeFunc || self->arraySizePtr )? True : False, 
-		Journal_Register( Error_Type, Variable_Type ), 
-		"arraySizePtr && arraySizeFunc is null\n" );
-	self->arraySize = _Variable_GetNewArraySize( self );
-
-
-	/* Work out the actual data sizes from the data types */
-	if( self->dataSizes ) {
-		Memory_Free( self->dataSizes );
-	}
-	self->dataSizes = Memory_Alloc_Array( SizeT, self->offsetCount, "Variable->dataSizes" );
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		switch ( self->dataTypes[component_I] ) {
-			case Variable_DataType_Variable:
-				Journal_Firewall( 
-					self->dataTypes[component_I] != Variable_DataType_Variable, 
-					Journal_Register( Error_Type, Variable_Type ),
-					"\"dataType[?] == Variable_DataType_Variables\" not yet implemented\n" );
-				break;
-			case Variable_DataType_Char:
-				self->dataSizes[component_I] = sizeof( char ) * self->dataTypeCounts[component_I];
-				break;
-			case Variable_DataType_Short:
-				self->dataSizes[component_I] = sizeof( short ) * self->dataTypeCounts[component_I];
-				break;
-			case Variable_DataType_Int:
-				self->dataSizes[component_I] = sizeof( int ) * self->dataTypeCounts[component_I];
-				break;
-			case Variable_DataType_Float:
-				self->dataSizes[component_I] = sizeof( float ) * self->dataTypeCounts[component_I];
-				break;
-			case Variable_DataType_Double:
-				self->dataSizes[component_I] = sizeof( double ) * self->dataTypeCounts[component_I];
-				break;
-			case Variable_DataType_Pointer:
-				self->dataSizes[component_I] = sizeof( void* ) * self->dataTypeCounts[component_I];
-				break;
-			default:
-				Journal_Firewall( 
-					self->dataTypes[component_I] >= Variable_DataType_Size, 
-					Journal_Register( Error_Type, Variable_Type ),
-					"\"dataType[?]\" is unrecognised\n" );
-				break;
-		}
-	}		
-	
-	/* Non-complex variables: Scalar & Vector can workout struct size for themselves.
-	 * Now that we know all the data sizes, work out the actual struct size (which may need the data sizes) */
-	if( self->offsetCount == 1 && !self->structSizePtr ) {
-		/* Vector and Scalars which are not apart of a Vector can work out their own size */
-		if ( self->structSize == 0 ) {
-			self->structSize = self->dataSizes[0];
-		}
-
-		/* If this is a vector, set its sub variables to the same struct size */
-		if ( self->dataTypeCounts[0] > 1 ) {
-			for ( subVariable_I = 0; subVariable_I < self->dataTypeCounts[0]; ++subVariable_I ) {
-				if ( self->components[subVariable_I] ) {
-					self->components[subVariable_I]->structSize = self->structSize;
-				}
-				else
-					/* break here because if one subVariable isn't allocated - then the rest shouldn't be */
-					break;
-			}
-		}
-	}
-	else {
-		Journal_Firewall( 
-			self->structSizePtr ? True: False, 
-			Journal_Register( Error_Type, Variable_Type ), 
-			"structSizePtr is null\n" );
-		self->structSize = *self->structSizePtr;
-	}
-	
-	if (self->allocateSelf) {
-		Index memoryToAllocSize = _Variable_GetNewArraySize( self ) * self->structSize;
-		Index subVariable_I;
-
-		Journal_Firewall( self->offsetCount == 1, 
-				Journal_Register( Error_Type, Variable_Type ), 
-				"Variable '%s' has 'offsetCount = %u', which should be 1 for self allocation.\n", 
-				self->name, self->offsetCount );
-
-		self->arrayPtr = Memory_Alloc_Bytes( memoryToAllocSize, Variable_Type, "SelfAllocedArray" );
-		memset( self->arrayPtr, 0, memoryToAllocSize );
-		
-		/* If this is a vector then set arrayPtr to be the same for each element of the vector */
-		if ( self->dataTypeCounts[0] > 1 ) {
-			for ( subVariable_I = 0 ; subVariable_I < self->dataTypeCounts[0] ; subVariable_I++ ) {
-				if ( self->components[subVariable_I] ) {
-					self->components[ subVariable_I ]->arrayPtr = self->arrayPtr;
-					self->components[ subVariable_I ]->arrayPtrPtr = &self->arrayPtr;
-				}
-				else {
-					/* break here because if one subVariable isn't allocated - then the rest shouldn't be */
-					break;
-				}
-			}
-		}
-	}
-	else {
-		Journal_Firewall( 
-			self->arrayPtrPtr ? True : False, 
-			Journal_Register( Error_Type, Variable_Type ), 
-			"Variable '%s' has NULL arrayPtrPtr\n", self->name );
-		self->arrayPtr = *self->arrayPtrPtr;
-	}
-
-	/* Lastly, build all components. It is reasonable if the user calls Build on "velocity", then
-	 * "velocity-x" etc are automatically build also. */	
-	for ( subVariable_I = 0; subVariable_I < self->subVariablesCount; subVariable_I++ ) {
-		if ( self->components[subVariable_I] ) {
-			/*Components now call Build on the parent, so if the parent is calling first,
-			 * need to avoid infinite recursion. */
-			self->isBuilt = True;
-			Stg_Component_Build( self->components[subVariable_I], data, False );
-			self->isBuilt = False;
-		}
-	}
-}
-
-
-void _Variable_Initialise( void* variable, void* data ) {
-	Variable*	self = (Variable*)variable;
-	Index 		subVariable_I;
-
-	for ( subVariable_I = 0; subVariable_I < self->subVariablesCount; subVariable_I++ ) {
-		if ( self->components[subVariable_I] ) {
-			Stg_Component_Initialise( self->components[subVariable_I], data, False );
-		}
-	}
-}
-
-
-void _Variable_Execute( void* variable, void* data ) {
-}
-
-void _Variable_AssignFromXML( void* variable, Stg_ComponentFactory* cf, void* data ) {
-	Variable*			self = (Variable*) variable;
-	SizeT					dataOffsets[] = { 0 };
-	Variable_DataType	dataTypes[] = { Variable_DataType_Size };
-	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;
-	char**					names = NULL;
-	Stream*				error = Journal_Register( Error_Type, self->type );
-	AbstractContext*	context;	
-	
-	assert( self );
-
-	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 );
-	thisComponentDict = Dictionary_GetDictionary( componentDict, self->name );
-	assert( thisComponentDict );
-	
-	/* Grab Registers */
-	variableRegister = context->variable_Register; 
-	assert( variableRegister );
-	pointerRegister = context->pointer_Register;
-	assert( pointerRegister );
-	
-	Stg_ComponentFactory_ConstructByKey( cf, self->name, "Dependency", Stg_Component, False, data );
-			
-	/* Get Pointer to number of elements in array */
-	countName = Dictionary_GetString( thisComponentDict, "Count" );
-	count = (unsigned*)Stg_ObjectList_Get( pointerRegister, countName );
-	//assert( count );
-	
-	/* Get Type of Variable */
-	dataTypeName = Dictionary_GetString( thisComponentDict, "DataType" );
-	if ( !strcasecmp( dataTypeName, "Double" ) )
-		dataTypes[0] = Variable_DataType_Double;
-	else if ( !strcasecmp( dataTypeName, "Float" ) )
-		dataTypes[0] = Variable_DataType_Float;
-	else if ( !strcasecmp( dataTypeName, "Int" ) )
-		dataTypes[0] = Variable_DataType_Int;
-	else if ( !strcasecmp( dataTypeName, "Char" ) )
-		dataTypes[0] = Variable_DataType_Char;
-	else if ( !strcasecmp( dataTypeName, "Short" ) )
-		dataTypes[0] = Variable_DataType_Short;
-	else 
-		Journal_Firewall( False, error, "Variable '%s' cannot understand data type '%s'\n", self->name, dataTypeName );
-
-	/* Get Rank of Variable - i.e. Scalar or Vector */
-	rankName = Dictionary_GetString( thisComponentDict, "Rank" );
-	if( !strcasecmp( rankName, "Scalar" ) ){
-		dataTypeCounts[0] = 1;
-	}
-	else if ( !strcasecmp( rankName, "Vector" ) ){
-		Dictionary_Entry_Value* list;
-		Index                   nameCount = 0;
-
-		/* Get Names from list */
-		if (( list = Dictionary_Get( thisComponentDict, "names" ) )) {
-			Index entry_I;
-
-			nameCount = Dictionary_Entry_Value_GetCount( list );
-			names = Memory_Alloc_Array( char*, nameCount, "Variable Names" );
-
-			for ( entry_I = 0 ; entry_I < nameCount ; entry_I++ )
-				names[ entry_I ] = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement(list, entry_I ) );
-		}
-		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] );
-	}
-	else
-		Journal_Firewall( False, error, "Variable '%s' cannot understand rank '%s'\n", self->name, rankName );
-
-	_Variable_Init( 
-		self, 
-		context,
-		1, 
-		dataOffsets,
-		dataTypes,
-		dataTypeCounts, 
-		(Name*)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,
-		(Variable_Register*)variableRegister );
-
-	/* Clean Up */
-	if (names)
-		Memory_Free(names);
-}
-	
-void _Variable_Destroy( void* variable, void* data ) {
-	Variable* self = (Variable*)variable;
-   Index ii;
-
-   for( ii = 0 ; ii < self->subVariablesCount ; ii++ ) {
-      Stg_Component_Destroy( self->components[ii], data, False );
-   }
-	
-	if ( self->dataSizes ) {
-		Memory_Free( self->dataSizes );
-	}
-	if (self->allocateSelf && self->arraySize != 0) {
-		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 ) {
-	Index arraySize = 0;
-
-	/* By default, we will try the simple ptr approach. */
-	if ( NULL != self->arraySizePtr ) {
-		arraySize = (*self->arraySizePtr);
-	}
-	else {
-		/* If that was NULL, we expect the arraySizeFunc to be set */
-
-		/* Because of the way sub-variables are constructed, they will use their parent's
-		 * arraySizePtr function (eg in the case of "vx", we want it to use the parent
-		 * Velocity MeshVariable's function to calculate the
-		 * size of the mesh.
-		 */ 
-		if ( NULL != self->parent ) {
-			arraySize = (*self->arraySizeFunc)( self->parent );
-		}
-		else {
-			arraySize = (*self->arraySizeFunc)( self );
-		}
-	}
-
-	return arraySize;
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void Variable_SetValue( void* variable, Index array_I, void* value ) {
-	Variable*		self = (Variable*)variable;
-	ArithPointer*	vPtr;
-	Index				component_I;
-	
-	vPtr = (ArithPointer*)value;
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		memcpy( _Variable_GetPtr( self, array_I, component_I, 0 ), (void*)vPtr, self->dataSizes[component_I] );
-		
-		vPtr += self->dataSizes[component_I];
-	}
-}
-
-
-void Variable_GetValue( void* variable, Index array_I, void* value ) {
-	Variable*	self = (Variable*)variable;
-	ArithPointer*	vPtr;
-	Index		component_I;
-	
-	vPtr = (ArithPointer*)value;
-	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
-		memcpy( (void*)vPtr, _Variable_GetPtr( self, array_I, component_I, 0 ), self->dataSizes[component_I] );
-		
-		vPtr += self->dataSizes[component_I];
-	}
-}
-
-void Variable_Update( void* variable ) {
-	Variable* self = (Variable*)variable;
-
-	/* array may have resized, assign local properties again */
-	self->arrayPtr = *self->arrayPtrPtr;
-	self->arraySize = _Variable_GetNewArraySize( self );
-	
-	if( !( self->offsetCount == 1 && !self->structSizePtr ) ) {
-		/* For non-scalar or non-vector variables, the targets may have been extended. */
-		self->structSize = *self->structSizePtr;
-	}
-}
-
-void Variable_SetValueDoubleAll( void* variable, double value ) {
-	Variable* self       = (Variable*)  variable;
-	Index     arraySize  = self->arraySize;
-	Index     array_I;
-
-	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) 
-		Variable_SetValueDouble( self, array_I, value );
-}
-		
-
-void Variable_SaveToFileAsDoubles( void* variable, Name filename ) {
-	Variable* self       = (Variable*)  variable;
-	Index     arraySize  = self->arraySize;
-	Index     array_I;
-	double    value;
-	FILE*     outputFile;
-	Index     comp_I;
-
-	outputFile = fopen( filename, "w" );
-
-	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) {
-		if ( *self->dataTypeCounts > 1 ) {
-			for ( comp_I = 0; comp_I < *self->dataTypeCounts; comp_I++ ) {	
-				value = Variable_GetValueAtDouble( self, array_I, comp_I );
-				fwrite( &value, sizeof(double), 1, outputFile );
-			}
-		}
-		else {
-			value = Variable_GetValueDouble( self, array_I );
-			fwrite( &value, sizeof(double), 1, outputFile );
-		}	
-	
-	}	
-
-	fclose( outputFile );
-}
-
-
-void Variable_ReadFromFileAsDoubles( void* variable, Name filename ) {
-	Variable* self       = (Variable*)  variable;
-	Index     arraySize  = self->arraySize;
-	Index     array_I;
-	double    value;
-	FILE*     inputFile;
-	Index     comp_I;
-
-	inputFile = fopen( filename, "r" );
-
-	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) {
-		if ( *self->dataTypeCounts > 1 ) {
-			for ( comp_I = 0; comp_I < *self->dataTypeCounts; comp_I++ ) {	
-				fread( &value, sizeof(double), 1, inputFile );
-				Variable_SetValueAtDouble( self, array_I, comp_I, value );
-			}
-		}
-		else {
-			fread( &value, sizeof(double), 1, inputFile );
-			Variable_SetValueDouble( self, array_I, value );
-		}
-	}	
-
-	fclose( inputFile );
-}
-
-
-/** Returns \f$ \frac{|| variable - comparison ||} { || variable ||} \f$, 
-  * where \f$ ||x|| \f$ indicates the Euclidean Norm which is the square root of the sum of the squares for each component in x
-  * i.e.  \f$ ||x|| = \sqrt{\sum_i x_i^2} \f$ */
-double Variable_ValueCompare( void* variable, void* _comparison ) {
-	Variable* self            = (Variable*)  variable;
-	Variable* comparison      = (Variable*) _comparison;
-	Index     arraySize       = self->arraySize;
-	Index     dataTypeCounts  = *self->dataTypeCounts;
-	Index     array_I;
-	Index     component_I;
-	double    differenceValue;
-	double    selfValue;
-	double    normDifference  = 0.0;
-	double    normVariable    = 0.0;
-	Stream*   error           = Journal_Register( Error_Type, self->type );
-
-	/* Simple Error Checking */
-	Journal_Firewall( arraySize == comparison->arraySize, error, 
-			"In func %s: Array sizes different for variables '%s' and '%s'\n", __func__, self->name, comparison->name );
-	Journal_Firewall( dataTypeCounts == *comparison->dataTypeCounts, error, 
-			"In func %s: Data Type Counts different for variables '%s' and '%s'\n",  __func__, self->name,comparison->name);
-
-	for ( component_I = 0 ; component_I < self->offsetCount ; component_I++ ) {
-		Journal_Firewall( self->dataTypes[component_I] == Variable_DataType_Double, error, 
-				"In func %s: Stg_Component %d of variable '%s' has different type to Variable_DataType_Double.\n", 
-				 __func__, component_I, self->name );
-		Journal_Firewall( comparison->dataTypes[component_I] == Variable_DataType_Double, error, 
-				"In func %s: Stg_Component %d of variable '%s' has different type to Variable_DataType_Double.\n", 
-				 __func__, component_I, comparison->name );
-	}
-
-	/* Calculate Euclidean Norms */
-	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) {
-		for ( component_I = 0 ; component_I < dataTypeCounts ; component_I++ ) {
-			selfValue       = Variable_GetValueAtDouble( self, array_I, component_I );
-			differenceValue = selfValue - Variable_GetValueAtDouble( comparison, array_I, component_I );
-
-			normDifference += differenceValue * differenceValue;
-			normVariable   += selfValue * selfValue;
-		}
-	}
-
-	normDifference = sqrt( normDifference );
-	normVariable   = sqrt( normVariable );
-
-	return normDifference/normVariable;
-}
-
-/** Checks whether || variable - comparison || / || variable || < tolerance */
-Bool Variable_ValueCompareWithinTolerance( void* variable, void* comparison, double tolerance ) {
-  return ( Variable_ValueCompare( variable, comparison ) < tolerance ? True : False);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Variable.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/Variable.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,1145 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Variable.c 4149 2007-06-29 06:59:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ContextEntryPoint.h"
+#include "AbstractContext.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <stdarg.h>
+#include <math.h>
+
+/* Textual name of this class */
+const Type Variable_Type = "Variable";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+Variable* Variable_New(
+	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);
+	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_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;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	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 ) {
+	/* 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_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;
+	Index                                                dataCount = 0;
+	SizeT*                                             dataOffsets = NULL;
+	Variable_DataType*                                   dataTypes = NULL;
+	Index*                                          dataTypeCounts = NULL;
+	Name*                                                dataNames = NULL;
+	SizeT*                                           structSizePtr = NULL;
+	Index*                                            arraySizePtr = NULL;
+	Variable_ArraySizeFunc*                          arraySizeFunc = NULL;
+	void**                                             arrayPtrPtr = NULL;
+	Variable_Register*                                          vr = NULL;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	Variable* self = _Variable_New(  VARIABLE_PASSARGS  );
+	
+	return self;
+}
+
+Variable* Variable_NewScalar( 
+	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);
+	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_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;
+	Index                                                dataCount = 1;
+	Name*                                                dataNames = 0;
+	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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	Variable*			self;
+	SizeT					dataOffsets[] = { 0 };
+	Variable_DataType	dataTypes[] = { dataType };		/* Init value later */
+	Index					dataTypeCounts[] = { 1 };
+	
+	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,
+	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);
+	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_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;
+	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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	Variable*			self;
+	SizeT					dataOffsets[] = { 0 };
+	Variable_DataType	dataTypes[] = { dataType }; /* Init later... */
+	Index					dataTypeCounts[] = { 0 }; /* Init later... */
+	char**					dNames;
+        Name* dataNames;
+	Index					vector_I;
+	va_list				ap;
+
+	dataTypeCounts[0] = dataTypeCount;
+
+	dNames = Memory_Alloc_Array( char*, dataTypeCount, "dataNames" );
+
+	va_start( ap, vr );
+	for( vector_I = 0; vector_I < dataTypeCount; vector_I++ ) {
+		dNames[vector_I] = va_arg( ap, char* );
+	}
+	va_end( ap );
+	
+        dataNames=(Name*)dNames;
+	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,
+	AbstractContext*			context,
+	Variable_DataType			dataType,
+	Index							dataTypeCount,
+	Index*						arraySizePtr,
+	Variable_ArraySizeFunc*	arraySizeFunc,
+	void**						arrayPtrPtr,
+	Variable_Register*		vr,
+	Name*						dataNames )
+{
+	/* 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_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;
+	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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	Variable*			self;
+	SizeT					dataOffsets[] = { 0 };
+	Variable_DataType	dataTypes[] = { dataType };
+	Index					dataTypeCounts[] = { 0 };
+
+	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;
+}
+
+Variable* _Variable_New(  VARIABLE_DEFARGS  ) {
+	Variable* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Variable) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (Variable*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	self->_build = _build;
+	self->_initialise = _initialise;
+	
+	/* Variable info */
+	
+	return self;
+}
+
+void _Variable_Init(
+	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 );*/
+
+	/* General and Virtual info should already be set */
+	
+	/* Variable info */
+	self->context = context;
+	self->allocateSelf  = allocateSelf;
+	self->offsetCount = dataCount;
+	self->structSizePtr = structSizePtr;
+	self->arraySizePtr = arraySizePtr;
+	self->arraySizeFunc = arraySizeFunc;
+	self->arrayPtrPtr = arrayPtrPtr;
+	self->parent = NULL;
+
+	/* Checks */
+	/*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 );*/
+
+	/* Use of this class has increased... can't assume the info arrays are on persistant memory... copy by default. They will
+	   be deleted. */
+	Journal_Firewall( dataOffsets ? True : False, Journal_Register( Error_Type, Variable_Type ), "dataOffsets is null\n" );
+	self->offsets = Memory_Alloc_Array( SizeT, self->offsetCount, "Variable->offsets" );
+	memcpy( self->offsets, dataOffsets, sizeof(SizeT) * self->offsetCount );
+	
+	Journal_Firewall( dataTypes ? True : False, Journal_Register( Error_Type, Variable_Type ), "dataTypes is null\n" );
+	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" );
+	self->dataTypeCounts = Memory_Alloc_Array( Index, self->offsetCount, "Variable->dataTypeCounts" );
+	memcpy( self->dataTypeCounts, dataTypeCounts, sizeof(Index) * self->offsetCount );
+	
+	/* These get set at the build phase (when we assume the variable's data memory has been allocated) */
+	self->structSize = 0;
+	self->arrayPtr = 0;
+	self->dataSizes = 0;
+	
+	if ( dataNames && self->offsetCount == 1 && self->dataTypeCounts[0] > 1 ) {
+		/* Vector case */
+		self->subVariablesCount = self->dataTypeCounts[0];
+	}
+	else {
+		/* Scalar or Complex case */
+		self->subVariablesCount = self->offsetCount;
+	}
+	self->components = Memory_Alloc_Array( Variable*, self->subVariablesCount, "Variable->components" );
+	memset( self->components, 0, sizeof(Variable*) * self->subVariablesCount );
+	
+	/* If the variable register is provided, add this and component variable(s) to the register */
+	if( vr ) {
+		self->vr = vr;
+		Variable_Register_Add( vr, self );
+		
+		/* 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;
+			
+			for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+				if( dataNames[component_I] ) {
+					SizeT					componentOffsets[] = { 0 };
+					Variable_DataType	componentTypes[] = { self->dataTypes[component_I] };
+					Index					componentTypeCounts[] = { 0 };
+
+					componentOffsets[0] = self->offsets[component_I];
+					componentTypeCounts[0] = self->dataTypeCounts[component_I];
+					
+					/* Assumption: components are scalar or vector, but cannot be complex */
+					self->components[component_I] = Variable_New( 
+						dataNames[component_I], 
+						self->context,
+						1, 
+						componentOffsets, 
+						componentTypes, 
+						componentTypeCounts,
+						0,
+						self->structSizePtr,
+						self->arraySizePtr,
+						self->arraySizeFunc,
+						self->arrayPtrPtr,
+						vr );
+					self->components[component_I]->parent = self;
+				}
+			}
+		}
+		/* 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;
+
+			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[] = { self->dataTypes[0] };
+					Index					componentTypeCounts[] = { 1 };
+				
+					componentOffsets[0] = 
+						(ArithPointer)self->offsets[0] + 
+						( self->dataTypes[0] == Variable_DataType_Char ? ( sizeof(char) * vector_I ) :
+						  self->dataTypes[0] == Variable_DataType_Short ? ( sizeof(short) * vector_I ) :
+						  self->dataTypes[0] == Variable_DataType_Int ? ( sizeof(int) * vector_I ) :
+						  self->dataTypes[0] == Variable_DataType_Float ? ( sizeof(float) * vector_I ) :
+						  self->dataTypes[0] == Variable_DataType_Double ? ( sizeof(double) * vector_I ) :
+						  self->dataTypes[0] == Variable_DataType_Pointer ? ( sizeof(void*) * vector_I ) :
+						  Journal_Firewall(
+							0,
+							Journal_Register( Error_Type, Variable_Type ),
+							"Vector is of a non-builtin type\n" ) );
+
+					/* Assumption: vector-components are scalar, but cannot be complex */
+					self->components[vector_I] = Variable_New( 
+						dataNames[vector_I],
+						self->context,
+						1, 
+						componentOffsets, 
+						componentTypes, 
+						componentTypeCounts,
+						0,
+						self->structSizePtr,
+						self->arraySizePtr,
+						self->arraySizeFunc,
+						self->arrayPtrPtr,
+						vr );
+					self->components[vector_I]->parent = self;
+				}
+			}
+		}
+	}
+	else {
+		self->vr = NULL;
+	}
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _Variable_Delete( void* variable ) {
+	Variable* self = (Variable*)variable;
+
+	/* Stg_Class_Delete parent */
+	_Stg_Component_Delete( self );
+}
+
+
+void _Variable_Print( void* variable, Stream* stream ) {
+	Variable*	self = (Variable*)variable;
+	Index		component_I;
+	
+	/* Print parent */
+	_Stg_Component_Print( self, stream );
+	
+	/* General info */
+	Journal_Printf( stream, "Variable (ptr): (%p)\n", self );
+	
+	/* Virtual info */
+	
+	/* Variable info */
+	Journal_Printf( stream, "\toffsetCount: %u\n", self->offsetCount );
+	
+	Journal_Printf( stream, "\toffsets (ptr): %p\n", self->offsets );
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		Journal_Printf( stream, "\t\toffsets[%u]: %lu\n", component_I, self->offsets[component_I] );
+	}
+	
+	Journal_Printf( stream, "\tdataTypes (ptr): %p\n", self->dataTypes );
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		Journal_Printf( stream, "\t\tdataTypes[%u]: %lu\n", component_I, self->dataTypes[component_I] );
+	}
+	
+	Journal_Printf( stream, "\tdataTypeCounts (ptr): %p\n", self->dataTypeCounts );
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		Journal_Printf( stream, "\t\tdataTypeCounts[%u]: %lu\n", component_I, self->dataTypeCounts[component_I] );
+	}
+
+	Journal_Printf( stream, "\tdataSizes (ptr): %p\n", self->dataSizes );
+	for( component_I = 0; component_I < self->offsetCount && self->dataSizes; component_I++ ) {
+		Journal_Printf( stream, "\t\tdataSizes[%u]: %lu\n", component_I, self->dataSizes[component_I] );
+	}
+
+	Journal_Printf( stream, "\tcomponents (ptr): %p\n", self->components );
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		Journal_Printf( stream, "\t\tcomponents[%u] (ptr): %p\n", component_I, self->components[component_I] );
+		if( self->components[component_I] ) {
+			Journal_Printf( stream, "\t\tcomponents[%u]: %s\n", component_I, self->components[component_I]->name );
+		}
+	}
+
+	Journal_Printf( stream, "\tstructSize: %lu\n", self->structSize );
+	Journal_Printf( stream, "\tstructSizePtr (ptr): %p\n", self->structSizePtr );
+
+	Journal_Printf( stream, "\tarrayPtr (ptr): %p\n", self->arrayPtr );
+	Journal_Printf( stream, "\tarrayPtrPtr (ptr): %p\n", self->arrayPtrPtr );
+
+	Journal_Printf( stream, "\tarraySize: %lu\n", _Variable_GetNewArraySize( self ) );
+	Journal_Printf( stream, "\tarraySizePtr (ptr): %p\n", self->arraySizePtr );
+	Journal_Printf( stream, "\tarraySizeFunc (ptr): %p\n", self->arraySizeFunc );
+
+	Journal_Printf( stream, "\tallocateSelf = %s\n", self->allocateSelf ? "True" : "False" );
+}
+
+
+void* _Variable_Copy( const void* variable, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	Variable*	self = (Variable*)variable;
+	Variable*	newVariable;
+	PtrMap*		map = ptrMap;
+	
+	newVariable = (Variable*)_Stg_Component_Copy( self, dest, deep, nameExt, map );
+	PtrMap_Append( map, self, newVariable );
+	
+	/* virtual methods */
+	newVariable->offsetCount = self->offsetCount;
+	newVariable->structSize = self->structSize;
+	newVariable->arraySizePtr = self->arraySizePtr;
+	newVariable->arraySizeFunc = self->arraySizeFunc;
+	
+	newVariable->allocateSelf = self->allocateSelf; /* This may change depending on whether arrayPtr is found in map */
+	newVariable->subVariablesCount = self->subVariablesCount;
+
+	/* single valued members */
+	
+	if( deep ) {
+          if( (newVariable->offsets = (SizeT*)PtrMap_Find( map, self->offsets )) == NULL && self->offsets != NULL ) {
+			newVariable->offsets = Memory_Alloc_Array( SizeT, newVariable->offsetCount, "Variable->offsets" );
+			memcpy( newVariable->offsets, self->offsets, sizeof(SizeT) * newVariable->offsetCount );
+			PtrMap_Append( map, self->offsets, newVariable->offsets );
+		}
+		
+          if( (newVariable->dataTypes = (Variable_DataType*)PtrMap_Find( map, self->dataTypes )) == NULL && self->offsets != NULL ) {
+			newVariable->dataTypes = Memory_Alloc_Array( Variable_DataType, newVariable->offsetCount, "Variable->dataTypes" );
+			memcpy( newVariable->dataTypes, self->dataTypes, sizeof(Variable_DataType) * newVariable->offsetCount );
+			PtrMap_Append( map, self->dataTypes, newVariable->dataTypes );
+		}
+		
+          if( (newVariable->dataTypeCounts = (Index*)PtrMap_Find( map, self->dataTypeCounts )) == NULL && self->dataTypeCounts != NULL ) {
+			newVariable->dataTypeCounts = Memory_Alloc_Array( Index, newVariable->offsetCount, "Variable->dataTypeCounts" );
+			memcpy( newVariable->dataTypeCounts, self->dataTypeCounts, sizeof(Index) * newVariable->offsetCount );
+			PtrMap_Append( map, self->dataTypeCounts, newVariable->dataTypeCounts );
+		}
+		
+		if ( self->structSizePtr != NULL ) {
+                  if( (newVariable->structSizePtr = (SizeT*)PtrMap_Find( map, self->structSizePtr )) == NULL ) {
+				newVariable->structSizePtr = Memory_Alloc_Array( 
+					SizeT, 
+					1, 
+					"Variable->structSizePtr" );
+				memcpy( newVariable->structSizePtr, self->structSizePtr, sizeof(SizeT) );
+				PtrMap_Append( map, self->structSizePtr, newVariable->structSizePtr );
+			}
+		}
+		else {
+			newVariable->structSizePtr = NULL;
+		}
+		
+		if ( self->arraySizePtr != NULL ) {
+                  if( (newVariable->arraySizePtr = (Index*)PtrMap_Find( map, self->arraySizePtr )) == NULL ) {
+				newVariable->arraySizePtr = Memory_Alloc_Array(
+					Index,
+					1,
+					"Variable->arraySizePtr" );
+				memcpy( newVariable->arraySizePtr, self->arraySizePtr, sizeof(Index) );
+				PtrMap_Append( map, self->arraySizePtr, newVariable->arraySizePtr );
+			}
+		}
+		else {
+			newVariable->arraySizeFunc = NULL;
+		}
+		if ( self->arraySizeFunc != NULL ) {
+                  if( (newVariable->arraySizeFunc =
+                       (Variable_ArraySizeFunc*)PtrMap_Find( map, (void*)self->arraySizeFunc )) == NULL ) {
+                    newVariable->arraySizeFunc = (Variable_ArraySizeFunc*)
+                      Memory_Alloc_Array(void*,
+                                         1,
+                                         "Variable->arraySizeFunc" );
+                    memcpy((void*)newVariable->arraySizeFunc,
+                           (void*)self->arraySizeFunc, sizeof(Index) );
+                    PtrMap_Append(map,
+                                  (void*)(self->arraySizeFunc),
+                                  (void*)(newVariable->arraySizeFunc));
+                  }
+		}
+		else {
+			newVariable->arraySizeFunc = NULL;
+		}
+		
+		if( (newVariable->dataSizes = (SizeT*)PtrMap_Find( map, self->dataSizes )) == NULL && self->dataSizes != NULL ) {
+			newVariable->dataSizes = Memory_Alloc_Array( SizeT, newVariable->offsetCount, "Variable->dataSizes" );
+			memcpy( newVariable->dataSizes, self->dataSizes, sizeof(SizeT) * newVariable->offsetCount );
+			PtrMap_Append( map, self->dataSizes, newVariable->dataSizes );
+		}
+
+		if( (newVariable->arrayPtrPtr = (void**)PtrMap_Find( map, self->arrayPtrPtr )) == NULL && self->arrayPtrPtr != NULL ) {	
+			if( (newVariable->arrayPtr = PtrMap_Find( map, self->arrayPtr )) == NULL && self->arrayPtr != NULL ) {
+				Index memoryToAllocSize = _Variable_GetNewArraySize( self ) * self->structSize;
+				newVariable->arrayPtr = Memory_Alloc_Bytes( 
+					memoryToAllocSize,
+					Variable_Type,
+					"SelfAllocedArray" );
+				memcpy( newVariable->arrayPtr, self->arrayPtr, memoryToAllocSize );
+				PtrMap_Append( map, self->arrayPtr, newVariable->arrayPtr );
+
+				newVariable->arrayPtrPtr = &(newVariable->arrayPtr);
+				newVariable->allocateSelf = True;
+			}
+		}
+		else {
+			newVariable->arrayPtr = *newVariable->arrayPtrPtr;
+			memcpy( newVariable->arrayPtr, self->arrayPtr, _Variable_GetNewArraySize(self) * self->structSize );
+		}
+		
+		if( (newVariable->components = (Variable**)PtrMap_Find( map, self->components )) == NULL && self->components != NULL ) {
+			Index	comp_I;
+			
+			if( newVariable->offsetCount == 1 && newVariable->dataTypeCounts[0] > 1 ) {
+				/* Vector case */
+				newVariable->components = Memory_Alloc_Array( 
+					Variable*, 
+					newVariable->dataTypeCounts[0], 
+					"Variable->components" );
+				memset( newVariable->components, 0, sizeof(Variable*) * newVariable->dataTypeCounts[0] );
+				
+				for( comp_I = 0; comp_I < newVariable->dataTypeCounts[0]; comp_I++ ) {
+					newVariable->components[comp_I] = (Variable*)Stg_Class_Copy( 
+						self->components[comp_I], 
+						NULL, 
+						deep, 
+						nameExt, 
+						map );
+				}
+			}
+			else {
+				/* Scalar or Complex case */
+				newVariable->components = Memory_Alloc_Array( 
+					Variable*, 
+					newVariable->offsetCount, 
+					"Variable->components" );
+				memset( newVariable->components, 0, sizeof(Variable*) * newVariable->offsetCount );
+				
+				for( comp_I = 0; comp_I < newVariable->offsetCount; comp_I++ ) {
+					if ( self->components[comp_I] ) {
+						newVariable->components[comp_I] = (Variable*)Stg_Class_Copy( 
+							self->components[comp_I], 
+							NULL, 
+							deep, 
+							nameExt, 
+							map );
+					}
+				}
+			}
+			
+			PtrMap_Append( map, self->components, newVariable->components );
+		}
+
+		if ( self->vr ) {
+                  newVariable->vr = (Variable_Register*)Stg_Class_Copy( self->vr, NULL, deep, nameExt, map );
+		}
+	}
+	else {
+		fprintf( stderr, "Warning: please don't shallow copy variables yet...or ever!\n" );
+	}
+	
+	return (void*)newVariable;
+}
+
+
+void _Variable_Build( void* variable, void* data ) {
+	Variable*	self = (Variable*)variable;
+	Index 		component_I;
+	Index 		subVariable_I;
+
+	if( self->parent ) {
+		/* We need to build the parent first, as it may initialise data structures needed 
+	 	 * by this Variable. BUT, the parent will call Build() on all it's sub-Variables
+	 	 * including this one, so we need to avoid an infinite loop. */
+		self->isBuilt = True;
+		Stg_Component_Build( self->parent, NULL, False );
+		self->isBuilt = False;
+	}
+	
+	/* Obtain the actual array size, and array pointer */
+	Journal_Firewall( 
+		( self->arraySizeFunc || self->arraySizePtr )? True : False, 
+		Journal_Register( Error_Type, Variable_Type ), 
+		"arraySizePtr && arraySizeFunc is null\n" );
+	self->arraySize = _Variable_GetNewArraySize( self );
+
+
+	/* Work out the actual data sizes from the data types */
+	if( self->dataSizes ) {
+		Memory_Free( self->dataSizes );
+	}
+	self->dataSizes = Memory_Alloc_Array( SizeT, self->offsetCount, "Variable->dataSizes" );
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		switch ( self->dataTypes[component_I] ) {
+			case Variable_DataType_Variable:
+				Journal_Firewall( 
+					self->dataTypes[component_I] != Variable_DataType_Variable, 
+					Journal_Register( Error_Type, Variable_Type ),
+					"\"dataType[?] == Variable_DataType_Variables\" not yet implemented\n" );
+				break;
+			case Variable_DataType_Char:
+				self->dataSizes[component_I] = sizeof( char ) * self->dataTypeCounts[component_I];
+				break;
+			case Variable_DataType_Short:
+				self->dataSizes[component_I] = sizeof( short ) * self->dataTypeCounts[component_I];
+				break;
+			case Variable_DataType_Int:
+				self->dataSizes[component_I] = sizeof( int ) * self->dataTypeCounts[component_I];
+				break;
+			case Variable_DataType_Float:
+				self->dataSizes[component_I] = sizeof( float ) * self->dataTypeCounts[component_I];
+				break;
+			case Variable_DataType_Double:
+				self->dataSizes[component_I] = sizeof( double ) * self->dataTypeCounts[component_I];
+				break;
+			case Variable_DataType_Pointer:
+				self->dataSizes[component_I] = sizeof( void* ) * self->dataTypeCounts[component_I];
+				break;
+			default:
+				Journal_Firewall( 
+					self->dataTypes[component_I] >= Variable_DataType_Size, 
+					Journal_Register( Error_Type, Variable_Type ),
+					"\"dataType[?]\" is unrecognised\n" );
+				break;
+		}
+	}		
+	
+	/* Non-complex variables: Scalar & Vector can workout struct size for themselves.
+	 * Now that we know all the data sizes, work out the actual struct size (which may need the data sizes) */
+	if( self->offsetCount == 1 && !self->structSizePtr ) {
+		/* Vector and Scalars which are not apart of a Vector can work out their own size */
+		if ( self->structSize == 0 ) {
+			self->structSize = self->dataSizes[0];
+		}
+
+		/* If this is a vector, set its sub variables to the same struct size */
+		if ( self->dataTypeCounts[0] > 1 ) {
+			for ( subVariable_I = 0; subVariable_I < self->dataTypeCounts[0]; ++subVariable_I ) {
+				if ( self->components[subVariable_I] ) {
+					self->components[subVariable_I]->structSize = self->structSize;
+				}
+				else
+					/* break here because if one subVariable isn't allocated - then the rest shouldn't be */
+					break;
+			}
+		}
+	}
+	else {
+		Journal_Firewall( 
+			self->structSizePtr ? True: False, 
+			Journal_Register( Error_Type, Variable_Type ), 
+			"structSizePtr is null\n" );
+		self->structSize = *self->structSizePtr;
+	}
+	
+	if (self->allocateSelf) {
+		Index memoryToAllocSize = _Variable_GetNewArraySize( self ) * self->structSize;
+		Index subVariable_I;
+
+		Journal_Firewall( self->offsetCount == 1, 
+				Journal_Register( Error_Type, Variable_Type ), 
+				"Variable '%s' has 'offsetCount = %u', which should be 1 for self allocation.\n", 
+				self->name, self->offsetCount );
+
+		self->arrayPtr = Memory_Alloc_Bytes( memoryToAllocSize, Variable_Type, "SelfAllocedArray" );
+		memset( self->arrayPtr, 0, memoryToAllocSize );
+		
+		/* If this is a vector then set arrayPtr to be the same for each element of the vector */
+		if ( self->dataTypeCounts[0] > 1 ) {
+			for ( subVariable_I = 0 ; subVariable_I < self->dataTypeCounts[0] ; subVariable_I++ ) {
+				if ( self->components[subVariable_I] ) {
+					self->components[ subVariable_I ]->arrayPtr = self->arrayPtr;
+					self->components[ subVariable_I ]->arrayPtrPtr = &self->arrayPtr;
+				}
+				else {
+					/* break here because if one subVariable isn't allocated - then the rest shouldn't be */
+					break;
+				}
+			}
+		}
+	}
+	else {
+		Journal_Firewall( 
+			self->arrayPtrPtr ? True : False, 
+			Journal_Register( Error_Type, Variable_Type ), 
+			"Variable '%s' has NULL arrayPtrPtr\n", self->name );
+		self->arrayPtr = *self->arrayPtrPtr;
+	}
+
+	/* Lastly, build all components. It is reasonable if the user calls Build on "velocity", then
+	 * "velocity-x" etc are automatically build also. */	
+	for ( subVariable_I = 0; subVariable_I < self->subVariablesCount; subVariable_I++ ) {
+		if ( self->components[subVariable_I] ) {
+			/*Components now call Build on the parent, so if the parent is calling first,
+			 * need to avoid infinite recursion. */
+			self->isBuilt = True;
+			Stg_Component_Build( self->components[subVariable_I], data, False );
+			self->isBuilt = False;
+		}
+	}
+}
+
+
+void _Variable_Initialise( void* variable, void* data ) {
+	Variable*	self = (Variable*)variable;
+	Index 		subVariable_I;
+
+	for ( subVariable_I = 0; subVariable_I < self->subVariablesCount; subVariable_I++ ) {
+		if ( self->components[subVariable_I] ) {
+			Stg_Component_Initialise( self->components[subVariable_I], data, False );
+		}
+	}
+}
+
+
+void _Variable_Execute( void* variable, void* data ) {
+}
+
+void _Variable_AssignFromXML( void* variable, Stg_ComponentFactory* cf, void* data ) {
+	Variable*			self = (Variable*) variable;
+	SizeT					dataOffsets[] = { 0 };
+	Variable_DataType	dataTypes[] = { Variable_DataType_Size };
+	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;
+	char**					names = NULL;
+	Stream*				error = Journal_Register( Error_Type, self->type );
+	AbstractContext*	context;	
+	
+	assert( self );
+
+	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 );
+	thisComponentDict = Dictionary_GetDictionary( componentDict, self->name );
+	assert( thisComponentDict );
+	
+	/* Grab Registers */
+	variableRegister = context->variable_Register; 
+	assert( variableRegister );
+	pointerRegister = context->pointer_Register;
+	assert( pointerRegister );
+	
+	Stg_ComponentFactory_ConstructByKey( cf, self->name, "Dependency", Stg_Component, False, data );
+			
+	/* Get Pointer to number of elements in array */
+	countName = Dictionary_GetString( thisComponentDict, "Count" );
+	count = (unsigned*)Stg_ObjectList_Get( pointerRegister, countName );
+	//assert( count );
+	
+	/* Get Type of Variable */
+	dataTypeName = Dictionary_GetString( thisComponentDict, "DataType" );
+	if ( !strcasecmp( dataTypeName, "Double" ) )
+		dataTypes[0] = Variable_DataType_Double;
+	else if ( !strcasecmp( dataTypeName, "Float" ) )
+		dataTypes[0] = Variable_DataType_Float;
+	else if ( !strcasecmp( dataTypeName, "Int" ) )
+		dataTypes[0] = Variable_DataType_Int;
+	else if ( !strcasecmp( dataTypeName, "Char" ) )
+		dataTypes[0] = Variable_DataType_Char;
+	else if ( !strcasecmp( dataTypeName, "Short" ) )
+		dataTypes[0] = Variable_DataType_Short;
+	else 
+		Journal_Firewall( False, error, "Variable '%s' cannot understand data type '%s'\n", self->name, dataTypeName );
+
+	/* Get Rank of Variable - i.e. Scalar or Vector */
+	rankName = Dictionary_GetString( thisComponentDict, "Rank" );
+	if( !strcasecmp( rankName, "Scalar" ) ){
+		dataTypeCounts[0] = 1;
+	}
+	else if ( !strcasecmp( rankName, "Vector" ) ){
+		Dictionary_Entry_Value* list;
+		Index                   nameCount = 0;
+
+		/* Get Names from list */
+		if (( list = Dictionary_Get( thisComponentDict, "names" ) )) {
+			Index entry_I;
+
+			nameCount = Dictionary_Entry_Value_GetCount( list );
+			names = Memory_Alloc_Array( char*, nameCount, "Variable Names" );
+
+			for ( entry_I = 0 ; entry_I < nameCount ; entry_I++ )
+				names[ entry_I ] = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement(list, entry_I ) );
+		}
+		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] );
+	}
+	else
+		Journal_Firewall( False, error, "Variable '%s' cannot understand rank '%s'\n", self->name, rankName );
+
+	_Variable_Init( 
+		self, 
+		context,
+		1, 
+		dataOffsets,
+		dataTypes,
+		dataTypeCounts, 
+		(Name*)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,
+		(Variable_Register*)variableRegister );
+
+	/* Clean Up */
+	if (names)
+		Memory_Free(names);
+}
+	
+void _Variable_Destroy( void* variable, void* data ) {
+	Variable* self = (Variable*)variable;
+   Index ii;
+
+   for( ii = 0 ; ii < self->subVariablesCount ; ii++ ) {
+      Stg_Component_Destroy( self->components[ii], data, False );
+   }
+	
+	if ( self->dataSizes ) {
+		Memory_Free( self->dataSizes );
+	}
+	if (self->allocateSelf && self->arraySize != 0) {
+		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 ) {
+	Index arraySize = 0;
+
+	/* By default, we will try the simple ptr approach. */
+	if ( NULL != self->arraySizePtr ) {
+		arraySize = (*self->arraySizePtr);
+	}
+	else {
+		/* If that was NULL, we expect the arraySizeFunc to be set */
+
+		/* Because of the way sub-variables are constructed, they will use their parent's
+		 * arraySizePtr function (eg in the case of "vx", we want it to use the parent
+		 * Velocity MeshVariable's function to calculate the
+		 * size of the mesh.
+		 */ 
+		if ( NULL != self->parent ) {
+			arraySize = (*self->arraySizeFunc)( self->parent );
+		}
+		else {
+			arraySize = (*self->arraySizeFunc)( self );
+		}
+	}
+
+	return arraySize;
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void Variable_SetValue( void* variable, Index array_I, void* value ) {
+	Variable*		self = (Variable*)variable;
+	ArithPointer*	vPtr;
+	Index				component_I;
+	
+	vPtr = (ArithPointer*)value;
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		memcpy( _Variable_GetPtr( self, array_I, component_I, 0 ), (void*)vPtr, self->dataSizes[component_I] );
+		
+		vPtr += self->dataSizes[component_I];
+	}
+}
+
+
+void Variable_GetValue( void* variable, Index array_I, void* value ) {
+	Variable*	self = (Variable*)variable;
+	ArithPointer*	vPtr;
+	Index		component_I;
+	
+	vPtr = (ArithPointer*)value;
+	for( component_I = 0; component_I < self->offsetCount; component_I++ ) {
+		memcpy( (void*)vPtr, _Variable_GetPtr( self, array_I, component_I, 0 ), self->dataSizes[component_I] );
+		
+		vPtr += self->dataSizes[component_I];
+	}
+}
+
+void Variable_Update( void* variable ) {
+	Variable* self = (Variable*)variable;
+
+	/* array may have resized, assign local properties again */
+	self->arrayPtr = *self->arrayPtrPtr;
+	self->arraySize = _Variable_GetNewArraySize( self );
+	
+	if( !( self->offsetCount == 1 && !self->structSizePtr ) ) {
+		/* For non-scalar or non-vector variables, the targets may have been extended. */
+		self->structSize = *self->structSizePtr;
+	}
+}
+
+void Variable_SetValueDoubleAll( void* variable, double value ) {
+	Variable* self       = (Variable*)  variable;
+	Index     arraySize  = self->arraySize;
+	Index     array_I;
+
+	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) 
+		Variable_SetValueDouble( self, array_I, value );
+}
+		
+
+void Variable_SaveToFileAsDoubles( void* variable, Name filename ) {
+	Variable* self       = (Variable*)  variable;
+	Index     arraySize  = self->arraySize;
+	Index     array_I;
+	double    value;
+	FILE*     outputFile;
+	Index     comp_I;
+
+	outputFile = fopen( filename, "w" );
+
+	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) {
+		if ( *self->dataTypeCounts > 1 ) {
+			for ( comp_I = 0; comp_I < *self->dataTypeCounts; comp_I++ ) {	
+				value = Variable_GetValueAtDouble( self, array_I, comp_I );
+				fwrite( &value, sizeof(double), 1, outputFile );
+			}
+		}
+		else {
+			value = Variable_GetValueDouble( self, array_I );
+			fwrite( &value, sizeof(double), 1, outputFile );
+		}	
+	
+	}	
+
+	fclose( outputFile );
+}
+
+
+void Variable_ReadFromFileAsDoubles( void* variable, Name filename ) {
+	Variable* self       = (Variable*)  variable;
+	Index     arraySize  = self->arraySize;
+	Index     array_I;
+	double    value;
+	FILE*     inputFile;
+	Index     comp_I;
+
+	inputFile = fopen( filename, "r" );
+
+	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) {
+		if ( *self->dataTypeCounts > 1 ) {
+			for ( comp_I = 0; comp_I < *self->dataTypeCounts; comp_I++ ) {	
+				fread( &value, sizeof(double), 1, inputFile );
+				Variable_SetValueAtDouble( self, array_I, comp_I, value );
+			}
+		}
+		else {
+			fread( &value, sizeof(double), 1, inputFile );
+			Variable_SetValueDouble( self, array_I, value );
+		}
+	}	
+
+	fclose( inputFile );
+}
+
+
+/** Returns \f$ \frac{|| variable - comparison ||} { || variable ||} \f$, 
+  * where \f$ ||x|| \f$ indicates the Euclidean Norm which is the square root of the sum of the squares for each component in x
+  * i.e.  \f$ ||x|| = \sqrt{\sum_i x_i^2} \f$ */
+double Variable_ValueCompare( void* variable, void* _comparison ) {
+	Variable* self            = (Variable*)  variable;
+	Variable* comparison      = (Variable*) _comparison;
+	Index     arraySize       = self->arraySize;
+	Index     dataTypeCounts  = *self->dataTypeCounts;
+	Index     array_I;
+	Index     component_I;
+	double    differenceValue;
+	double    selfValue;
+	double    normDifference  = 0.0;
+	double    normVariable    = 0.0;
+	Stream*   error           = Journal_Register( Error_Type, self->type );
+
+	/* Simple Error Checking */
+	Journal_Firewall( arraySize == comparison->arraySize, error, 
+			"In func %s: Array sizes different for variables '%s' and '%s'\n", __func__, self->name, comparison->name );
+	Journal_Firewall( dataTypeCounts == *comparison->dataTypeCounts, error, 
+			"In func %s: Data Type Counts different for variables '%s' and '%s'\n",  __func__, self->name,comparison->name);
+
+	for ( component_I = 0 ; component_I < self->offsetCount ; component_I++ ) {
+		Journal_Firewall( self->dataTypes[component_I] == Variable_DataType_Double, error, 
+				"In func %s: Stg_Component %d of variable '%s' has different type to Variable_DataType_Double.\n", 
+				 __func__, component_I, self->name );
+		Journal_Firewall( comparison->dataTypes[component_I] == Variable_DataType_Double, error, 
+				"In func %s: Stg_Component %d of variable '%s' has different type to Variable_DataType_Double.\n", 
+				 __func__, component_I, comparison->name );
+	}
+
+	/* Calculate Euclidean Norms */
+	for ( array_I = 0 ; array_I < arraySize ; array_I++ ) {
+		for ( component_I = 0 ; component_I < dataTypeCounts ; component_I++ ) {
+			selfValue       = Variable_GetValueAtDouble( self, array_I, component_I );
+			differenceValue = selfValue - Variable_GetValueAtDouble( comparison, array_I, component_I );
+
+			normDifference += differenceValue * differenceValue;
+			normVariable   += selfValue * selfValue;
+		}
+	}
+
+	normDifference = sqrt( normDifference );
+	normVariable   = sqrt( normVariable );
+
+	return normDifference/normVariable;
+}
+
+/** Checks whether || variable - comparison || / || variable || < tolerance */
+Bool Variable_ValueCompareWithinTolerance( void* variable, void* comparison, double tolerance ) {
+  return ( Variable_ValueCompare( variable, comparison ) < tolerance ? True : False);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableAllVC.c
--- a/Base/Context/src/VariableAllVC.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,468 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: VariableAllVC.c 2509 2005-01-10 23:39:07Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-	
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-                                                                                                                                    
-#include "types.h"
-#include "shortcuts.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "VariableCondition.h"
-#include "VariableAllVC.h"
-#include "ConditionFunction_Register.h"
-
-#include <string.h>
-#include <assert.h>
-
-
-const Type VariableAllVC_Type = "VariableAllVC";
-const Name defaultVariableAllVCName = "defaultVariableAllVCName";
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* VariableAllVC_Factory(
-	AbstractContext*					context,
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register, 
-	Dictionary*							dictionary,
-	void*									data )
-{
-  return (VariableCondition*)VariableAllVC_New( (char*)defaultVariableAllVCName, context, NULL, variable_Register, conFunc_Register, dictionary, data );
-}
-
-
-VariableAllVC*	VariableAllVC_New(
-	Name									name,
-	AbstractContext*					context,
-	char*									_dictionaryEntryName, 
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register,
-	Dictionary*							dictionary,
-	void*									data )
-{
-	VariableAllVC*	self = _VariableAllVC_DefaultNew( name );
-
-	self->isConstructed = True;
-	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
-	_VariableAllVC_Init( self, _dictionaryEntryName, data );
-
-	return self;
-}
-
-VariableAllVC*	_VariableAllVC_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                               _sizeOfSelf = sizeof(VariableAllVC);
-	Type                                                       type = VariableAllVC_Type;
-	Stg_Class_DeleteFunction*                               _delete = _VariableAllVC_Delete;
-	Stg_Class_PrintFunction*                                 _print = _VariableAllVC_Print;
-	Stg_Class_CopyFunction*                                   _copy = _VariableAllVC_Copy;
-	Stg_Component_DefaultConstructorFunction*   _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_VariableAllVC_DefaultNew;
-	Stg_Component_ConstructFunction*                     _construct = _VariableCondition_AssignFromXML;
-	Stg_Component_BuildFunction*                             _build = _VariableAllVC_Build;
-	Stg_Component_InitialiseFunction*                   _initialise = _VariableCondition_Initialise;
-	Stg_Component_ExecuteFunction*                         _execute = _VariableCondition_Execute;
-	Stg_Component_DestroyFunction*                         _destroy = _VariableAllVC_Destroy;
-	AllocationType                               nameAllocationType = NON_GLOBAL;
-	VariableCondition_BuildSelfFunc*                     _buildSelf = _VariableAllVC_BuildSelf;
-	VariableCondition_PrintConciseFunc*               _printConcise = _VariableAllVC_PrintConcise;
-	VariableCondition_ReadDictionaryFunc*           _readDictionary = _VariableAllVC_ReadDictionary;
-	VariableCondition_GetSetFunc*                           _getSet = _VariableAllVC_GetSet;
-	VariableCondition_GetVariableCountFunc*       _getVariableCount = _VariableAllVC_GetVariableCount;
-	VariableCondition_GetVariableIndexFunc*       _getVariableIndex = _VariableAllVC_GetVariableIndex;
-	VariableCondition_GetValueIndexFunc*             _getValueIndex = _VariableAllVC_GetValueIndex;
-	VariableCondition_GetValueCountFunc*             _getValueCount = _VariableAllVC_GetValueCount;
-	VariableCondition_GetValueFunc*                       _getValue = _VariableAllVC_GetValue;
-	VariableCondition_ApplyFunc*                             _apply = _VariableCondition_Apply;
-
-	return (VariableAllVC*)_VariableAllVC_New(  VARIABLEALLVC_PASSARGS  );
-}
-
-VariableAllVC* _VariableAllVC_New(  VARIABLEALLVC_DEFARGS  ) {
-	VariableAllVC*	self;
-	
-	/* Allocate memory/General info */
-	assert( _sizeOfSelf >= sizeof(VariableAllVC) );
-	self = (VariableAllVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	
-	return self;
-}
-
-void _VariableAllVC_Init(
-	void*	allElementsVC,
-	Name	_dictionaryEntryName, 
-	void*	data )
-{
-	VariableAllVC*			self = (VariableAllVC*)allElementsVC;
-
-	self->isConstructed = True;
-	self->_dictionaryEntryName = _dictionaryEntryName;
-	self->data = data;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _VariableAllVC_ReadDictionary( void* variableCondition, void* dictionary ) {
-	VariableAllVC*			self = (VariableAllVC*)variableCondition;
-	Dictionary_Entry_Value*		vcDictVal;
-	Dictionary_Entry_Value		_vcDictVal;
-	Dictionary_Entry_Value*		varsVal;
-	VariableAllVC_Entry_Index	entry_I;
-	
-	/* Find dictionary entry */
-	if (self->_dictionaryEntryName)
-		vcDictVal = Dictionary_Get( dictionary, (Dictionary_Entry_Key)self->_dictionaryEntryName  );
-	else
-	{
-		vcDictVal = &_vcDictVal;
-		Dictionary_Entry_Value_InitFromStruct( vcDictVal, dictionary );
-	}
-	
-	if (vcDictVal)
-	{
-		/* Obtain the variable entries */
-		self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"variables") );
-		self->_entryTbl = Memory_Alloc_Array( VariableAllVC_Entry, self->_entryCount, "VariableAllVC->_entryTbl" );
-		varsVal = Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"variables");
-		
-		for (entry_I = 0; entry_I < self->_entryCount; entry_I++ )
-		{
-			char*			valType;
-			Dictionary_Entry_Value*	valueEntry;
-			Dictionary_Entry_Value*	varDictListVal;
-			
-			varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
-			valueEntry = Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"value" );
-			
-			self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
-				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
-				
-			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
-			if (!strcasecmp(valType, "func"))
-			{
-				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
-				
-				self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
-				self->_entryTbl[entry_I].value.as.typeCFIndex = ConditionFunction_Register_GetIndex(
-					self->conFunc_Register, funcName);
-			}
-			else if (!strcasecmp(valType, "array"))
-			{
-				Dictionary_Entry_Value*	valueElement;
-				Index			i;
-
-				self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
-				self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
-				self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
-					self->_entryTbl[entry_I].value.as.typeArray.size,"VariableAllVC->_entryTbl[].value.as.typeArray.array" );
-					
-				for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
-				{
-					valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
-					self->_entryTbl[entry_I].value.as.typeArray.array[i] = 
-						Dictionary_Entry_Value_AsDouble(valueElement);
-				}
-			}
-			else if( !strcasecmp( valType, "double" ) || !strcasecmp( valType, "d" ) || !strcasecmp( valType, "float" ) || !strcasecmp( valType, "f" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
-			}
-			else if( !strcasecmp( valType, "integer" ) || !strcasecmp( valType, "int" ) || !strcasecmp( valType, "i" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
-				self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
-			}
-			else if( !strcasecmp( valType, "short" ) || !strcasecmp( valType, "s" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
-				self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
-			}
-			else if( !strcasecmp( valType, "char" ) || !strcasecmp( valType, "c" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
-				self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
-			}
-			else if( !strcasecmp( valType, "pointer" ) || !strcasecmp( valType, "ptr" ) || !strcasecmp( valType, "p" ) ) {
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
-				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer) Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
-			}
-			else {
-				/* Assume double */
-				Journal_DPrintf( Journal_Register( InfoStream_Type, (Name)"myStream"  ), "Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
-			}
-		}
-	}
-	else
-	{
-		self->_entryCount = 0;
-		self->_entryTbl = NULL;
-	}
-}
-
-
-void _VariableAllVC_Delete( void* allElementsVC ) {
-	VariableAllVC* self = (VariableAllVC*)allElementsVC;
-	
-	/* Stg_Class_Delete parent */
-	_VariableCondition_Delete( self );
-}
-
-void _VariableAllVC_Destroy( void* allElementsVC, void* data ) {
-	VariableAllVC* self = (VariableAllVC*)allElementsVC;
-
-	if (self->_entryTbl) Memory_Free(self->_entryTbl);
-
-	_VariableCondition_Destroy( self, data );	
-}
-
-void _VariableAllVC_Print( void* allElementsVC, Stream* stream ) {
-	VariableAllVC*					self = (VariableAllVC*)allElementsVC;
-	VariableAllVC_Entry_Index	entry_I;
-	Index								i;
-	
-	/* Set the Journal for printing informations */
-	Stream* info = stream;
-	
-	/* General info */
-	Journal_Printf( info, "VariableAllVC (ptr): %p\n", self);
-	
-	/* Print parent */
-	_VariableCondition_Print(self);
-
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
-	Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
-	if (self->_dictionaryEntryName)
-		Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
-	Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
-	Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
-	if( self->_entryTbl ) {
-		for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
-		{
-			Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
-			Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
-			if (self->_entryTbl[entry_I].varName)
-				Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
-			Journal_Printf( info, "\t\t\tvalue:\n");
-			switch (self->_entryTbl[entry_I].value.type)
-			{
-				case VC_ValueType_Double:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
-					Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
-					break;
-					
-				case VC_ValueType_Int:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
-					Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
-					break;
-					
-				case VC_ValueType_Short:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
-					Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
-					break;
-					
-				case VC_ValueType_Char:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
-					Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
-					break;
-					
-				case VC_ValueType_Ptr:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
-					Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
-					break;
-					
-				case VC_ValueType_DoubleArray:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
-					Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
-					Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n", 
-						self->_entryTbl[entry_I].value.as.typeArray.array);
-					if (self->_entryTbl[entry_I].value.as.typeArray.array)
-						for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
-							Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
-								self->_entryTbl[entry_I].value.as.typeArray.array[i]);
-					break;
-					
-				case VC_ValueType_CFIndex:
-					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
-					Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
-					break;
-			}
-		}
-	}
-}
-
-
-void* _VariableAllVC_Copy( const void* allElementsVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	VariableAllVC*		self = (VariableAllVC*)allElementsVC;
-	VariableAllVC*		newVariableAllVC;
-	PtrMap*			map = ptrMap;
-	Bool			ownMap = False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newVariableAllVC = (VariableAllVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
-	
-	newVariableAllVC->_dictionaryEntryName = self->_dictionaryEntryName;
-	newVariableAllVC->_entryCount = self->_entryCount;
-	
-	if( deep ) {
-		newVariableAllVC->data = Stg_Class_Copy( self->data, NULL, deep, nameExt, map );
-		
-		if( (newVariableAllVC->_entryTbl = (VariableAllVC_Entry*)PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
-			newVariableAllVC->_entryTbl = Memory_Alloc_Array( VariableAllVC_Entry, newVariableAllVC->_entryCount, "VariableAllVC->_entryTbl");
-			memcpy( newVariableAllVC->_entryTbl, self->_entryTbl, sizeof(VariableAllVC_Entry) * newVariableAllVC->_entryCount );
-			PtrMap_Append( map, newVariableAllVC->_entryTbl, self->_entryTbl );
-		}
-	}
-	else {
-		newVariableAllVC->data = self->data;
-		newVariableAllVC->_entryTbl = self->_entryTbl;
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-	
-	return (void*)newVariableAllVC;
-}
-
-
-void _VariableAllVC_Build( void* allElementsVC, void* data ) {
-	VariableAllVC*		self = (VariableAllVC*)allElementsVC;
-	
-	_VariableAllVC_BuildSelf( self, data );
-	
-	_VariableCondition_Build( self, data );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _VariableAllVC_BuildSelf( void* allElementsVC, void* data ) {
-	VariableAllVC*		self = (VariableAllVC*)allElementsVC;
-	
-	if( self->data ) {
-		Stg_Component_Build( self->data, data, False );
-	}
-}
-
-
-IndexSet* _VariableAllVC_GetSet( void* variableCondition ) {
-	VariableAllVC*				self = (VariableAllVC*)variableCondition;
-	Variable*				var = self->variable_Register->_variable[0];
-	IndexSet*				set = IndexSet_New( var->arraySize );
-	
-	IndexSet_AddAll( set );
-	
-	return set;
-}
-
-
-VariableCondition_VariableIndex _VariableAllVC_GetVariableCount( void* variableCondition, Index globalIndex ) {
-	VariableAllVC*	self = (VariableAllVC*)variableCondition;
-	
-	return self->_entryCount;
-}
-
-
-Variable_Index _VariableAllVC_GetVariableIndex(
-		void*				variableCondition, 
-		Index				globalIndex, 
-		VariableCondition_VariableIndex	varIndex) 
-{
-	VariableAllVC*	self = (VariableAllVC*)variableCondition;
-	
-	return Variable_Register_GetIndex(self->variable_Register, self->_entryTbl[varIndex].varName);
-}
-
-
-VariableCondition_ValueIndex _VariableAllVC_GetValueIndex(
-		void*				variableCondition, 
-		Index				globalIndex, 
-		VariableCondition_VariableIndex	varIndex)
-{
-	return varIndex;
-}
-
-
-VariableCondition_ValueIndex _VariableAllVC_GetValueCount( void* variableCondition ) {
-	VariableAllVC*	self = (VariableAllVC*)variableCondition;
-	
-	return self->_entryCount;
-}
-
-
-VariableCondition_Value _VariableAllVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex ) {
-	VariableAllVC*	self = (VariableAllVC*)variableCondition;
-
-	return self->_entryTbl[valIndex].value;
-}
-
-void _VariableAllVC_PrintConcise( void* variableCondition, Stream* stream ) {
-	VariableAllVC*		self = (VariableAllVC*)variableCondition;
-	
-	Journal_Printf( stream, "\ttype: %s, set: all\n", self->type );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableAllVC.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/VariableAllVC.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,468 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: VariableAllVC.c 2509 2005-01-10 23:39:07Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+	
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+                                                                                                                                    
+#include "types.h"
+#include "shortcuts.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "VariableCondition.h"
+#include "VariableAllVC.h"
+#include "ConditionFunction_Register.h"
+
+#include <string.h>
+#include <assert.h>
+
+
+const Type VariableAllVC_Type = "VariableAllVC";
+const Name defaultVariableAllVCName = "defaultVariableAllVCName";
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* VariableAllVC_Factory(
+	AbstractContext*					context,
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register, 
+	Dictionary*							dictionary,
+	void*									data )
+{
+  return (VariableCondition*)VariableAllVC_New( (char*)defaultVariableAllVCName, context, NULL, variable_Register, conFunc_Register, dictionary, data );
+}
+
+
+VariableAllVC*	VariableAllVC_New(
+	Name									name,
+	AbstractContext*					context,
+	char*									_dictionaryEntryName, 
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register,
+	Dictionary*							dictionary,
+	void*									data )
+{
+	VariableAllVC*	self = _VariableAllVC_DefaultNew( name );
+
+	self->isConstructed = True;
+	_VariableCondition_Init( self, context, variable_Register, conFunc_Register, dictionary );
+	_VariableAllVC_Init( self, _dictionaryEntryName, data );
+
+	return self;
+}
+
+VariableAllVC*	_VariableAllVC_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                               _sizeOfSelf = sizeof(VariableAllVC);
+	Type                                                       type = VariableAllVC_Type;
+	Stg_Class_DeleteFunction*                               _delete = _VariableAllVC_Delete;
+	Stg_Class_PrintFunction*                                 _print = _VariableAllVC_Print;
+	Stg_Class_CopyFunction*                                   _copy = _VariableAllVC_Copy;
+	Stg_Component_DefaultConstructorFunction*   _defaultConstructor = (Stg_Component_DefaultConstructorFunction*)_VariableAllVC_DefaultNew;
+	Stg_Component_ConstructFunction*                     _construct = _VariableCondition_AssignFromXML;
+	Stg_Component_BuildFunction*                             _build = _VariableAllVC_Build;
+	Stg_Component_InitialiseFunction*                   _initialise = _VariableCondition_Initialise;
+	Stg_Component_ExecuteFunction*                         _execute = _VariableCondition_Execute;
+	Stg_Component_DestroyFunction*                         _destroy = _VariableAllVC_Destroy;
+	AllocationType                               nameAllocationType = NON_GLOBAL;
+	VariableCondition_BuildSelfFunc*                     _buildSelf = _VariableAllVC_BuildSelf;
+	VariableCondition_PrintConciseFunc*               _printConcise = _VariableAllVC_PrintConcise;
+	VariableCondition_ReadDictionaryFunc*           _readDictionary = _VariableAllVC_ReadDictionary;
+	VariableCondition_GetSetFunc*                           _getSet = _VariableAllVC_GetSet;
+	VariableCondition_GetVariableCountFunc*       _getVariableCount = _VariableAllVC_GetVariableCount;
+	VariableCondition_GetVariableIndexFunc*       _getVariableIndex = _VariableAllVC_GetVariableIndex;
+	VariableCondition_GetValueIndexFunc*             _getValueIndex = _VariableAllVC_GetValueIndex;
+	VariableCondition_GetValueCountFunc*             _getValueCount = _VariableAllVC_GetValueCount;
+	VariableCondition_GetValueFunc*                       _getValue = _VariableAllVC_GetValue;
+	VariableCondition_ApplyFunc*                             _apply = _VariableCondition_Apply;
+
+	return (VariableAllVC*)_VariableAllVC_New(  VARIABLEALLVC_PASSARGS  );
+}
+
+VariableAllVC* _VariableAllVC_New(  VARIABLEALLVC_DEFARGS  ) {
+	VariableAllVC*	self;
+	
+	/* Allocate memory/General info */
+	assert( _sizeOfSelf >= sizeof(VariableAllVC) );
+	self = (VariableAllVC*)_VariableCondition_New(  VARIABLECONDITION_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	
+	return self;
+}
+
+void _VariableAllVC_Init(
+	void*	allElementsVC,
+	Name	_dictionaryEntryName, 
+	void*	data )
+{
+	VariableAllVC*			self = (VariableAllVC*)allElementsVC;
+
+	self->isConstructed = True;
+	self->_dictionaryEntryName = _dictionaryEntryName;
+	self->data = data;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _VariableAllVC_ReadDictionary( void* variableCondition, void* dictionary ) {
+	VariableAllVC*			self = (VariableAllVC*)variableCondition;
+	Dictionary_Entry_Value*		vcDictVal;
+	Dictionary_Entry_Value		_vcDictVal;
+	Dictionary_Entry_Value*		varsVal;
+	VariableAllVC_Entry_Index	entry_I;
+	
+	/* Find dictionary entry */
+	if (self->_dictionaryEntryName)
+		vcDictVal = Dictionary_Get( dictionary, (Dictionary_Entry_Key)self->_dictionaryEntryName  );
+	else
+	{
+		vcDictVal = &_vcDictVal;
+		Dictionary_Entry_Value_InitFromStruct( vcDictVal, dictionary );
+	}
+	
+	if (vcDictVal)
+	{
+		/* Obtain the variable entries */
+		self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"variables") );
+		self->_entryTbl = Memory_Alloc_Array( VariableAllVC_Entry, self->_entryCount, "VariableAllVC->_entryTbl" );
+		varsVal = Dictionary_Entry_Value_GetMember( vcDictVal, (Dictionary_Entry_Key)"variables");
+		
+		for (entry_I = 0; entry_I < self->_entryCount; entry_I++ )
+		{
+			char*			valType;
+			Dictionary_Entry_Value*	valueEntry;
+			Dictionary_Entry_Value*	varDictListVal;
+			
+			varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
+			valueEntry = Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"value" );
+			
+			self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
+				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
+				
+			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
+			if (!strcasecmp(valType, "func"))
+			{
+				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
+				
+				self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
+				self->_entryTbl[entry_I].value.as.typeCFIndex = ConditionFunction_Register_GetIndex(
+					self->conFunc_Register, funcName);
+			}
+			else if (!strcasecmp(valType, "array"))
+			{
+				Dictionary_Entry_Value*	valueElement;
+				Index			i;
+
+				self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
+				self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
+				self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
+					self->_entryTbl[entry_I].value.as.typeArray.size,"VariableAllVC->_entryTbl[].value.as.typeArray.array" );
+					
+				for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+				{
+					valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
+					self->_entryTbl[entry_I].value.as.typeArray.array[i] = 
+						Dictionary_Entry_Value_AsDouble(valueElement);
+				}
+			}
+			else if( !strcasecmp( valType, "double" ) || !strcasecmp( valType, "d" ) || !strcasecmp( valType, "float" ) || !strcasecmp( valType, "f" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+			}
+			else if( !strcasecmp( valType, "integer" ) || !strcasecmp( valType, "int" ) || !strcasecmp( valType, "i" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
+				self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+			}
+			else if( !strcasecmp( valType, "short" ) || !strcasecmp( valType, "s" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
+				self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+			}
+			else if( !strcasecmp( valType, "char" ) || !strcasecmp( valType, "c" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
+				self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+			}
+			else if( !strcasecmp( valType, "pointer" ) || !strcasecmp( valType, "ptr" ) || !strcasecmp( valType, "p" ) ) {
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
+				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer) Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
+			}
+			else {
+				/* Assume double */
+				Journal_DPrintf( Journal_Register( InfoStream_Type, (Name)"myStream"  ), "Type to variable on variable condition not given, assuming double\n" );
+				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+			}
+		}
+	}
+	else
+	{
+		self->_entryCount = 0;
+		self->_entryTbl = NULL;
+	}
+}
+
+
+void _VariableAllVC_Delete( void* allElementsVC ) {
+	VariableAllVC* self = (VariableAllVC*)allElementsVC;
+	
+	/* Stg_Class_Delete parent */
+	_VariableCondition_Delete( self );
+}
+
+void _VariableAllVC_Destroy( void* allElementsVC, void* data ) {
+	VariableAllVC* self = (VariableAllVC*)allElementsVC;
+
+	if (self->_entryTbl) Memory_Free(self->_entryTbl);
+
+	_VariableCondition_Destroy( self, data );	
+}
+
+void _VariableAllVC_Print( void* allElementsVC, Stream* stream ) {
+	VariableAllVC*					self = (VariableAllVC*)allElementsVC;
+	VariableAllVC_Entry_Index	entry_I;
+	Index								i;
+	
+	/* Set the Journal for printing informations */
+	Stream* info = stream;
+	
+	/* General info */
+	Journal_Printf( info, "VariableAllVC (ptr): %p\n", self);
+	
+	/* Print parent */
+	_VariableCondition_Print(self);
+
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
+	Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
+	if (self->_dictionaryEntryName)
+		Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
+	Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
+	Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
+	if( self->_entryTbl ) {
+		for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
+		{
+			Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
+			Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
+			if (self->_entryTbl[entry_I].varName)
+				Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
+			Journal_Printf( info, "\t\t\tvalue:\n");
+			switch (self->_entryTbl[entry_I].value.type)
+			{
+				case VC_ValueType_Double:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
+					Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
+					break;
+					
+				case VC_ValueType_Int:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
+					Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
+					break;
+					
+				case VC_ValueType_Short:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
+					Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
+					break;
+					
+				case VC_ValueType_Char:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
+					Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
+					break;
+					
+				case VC_ValueType_Ptr:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
+					Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
+					break;
+					
+				case VC_ValueType_DoubleArray:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
+					Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
+					Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n", 
+						self->_entryTbl[entry_I].value.as.typeArray.array);
+					if (self->_entryTbl[entry_I].value.as.typeArray.array)
+						for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+							Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
+								self->_entryTbl[entry_I].value.as.typeArray.array[i]);
+					break;
+					
+				case VC_ValueType_CFIndex:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
+					Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
+					break;
+			}
+		}
+	}
+}
+
+
+void* _VariableAllVC_Copy( const void* allElementsVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	VariableAllVC*		self = (VariableAllVC*)allElementsVC;
+	VariableAllVC*		newVariableAllVC;
+	PtrMap*			map = ptrMap;
+	Bool			ownMap = False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newVariableAllVC = (VariableAllVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
+	
+	newVariableAllVC->_dictionaryEntryName = self->_dictionaryEntryName;
+	newVariableAllVC->_entryCount = self->_entryCount;
+	
+	if( deep ) {
+		newVariableAllVC->data = Stg_Class_Copy( self->data, NULL, deep, nameExt, map );
+		
+		if( (newVariableAllVC->_entryTbl = (VariableAllVC_Entry*)PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
+			newVariableAllVC->_entryTbl = Memory_Alloc_Array( VariableAllVC_Entry, newVariableAllVC->_entryCount, "VariableAllVC->_entryTbl");
+			memcpy( newVariableAllVC->_entryTbl, self->_entryTbl, sizeof(VariableAllVC_Entry) * newVariableAllVC->_entryCount );
+			PtrMap_Append( map, newVariableAllVC->_entryTbl, self->_entryTbl );
+		}
+	}
+	else {
+		newVariableAllVC->data = self->data;
+		newVariableAllVC->_entryTbl = self->_entryTbl;
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+	
+	return (void*)newVariableAllVC;
+}
+
+
+void _VariableAllVC_Build( void* allElementsVC, void* data ) {
+	VariableAllVC*		self = (VariableAllVC*)allElementsVC;
+	
+	_VariableAllVC_BuildSelf( self, data );
+	
+	_VariableCondition_Build( self, data );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _VariableAllVC_BuildSelf( void* allElementsVC, void* data ) {
+	VariableAllVC*		self = (VariableAllVC*)allElementsVC;
+	
+	if( self->data ) {
+		Stg_Component_Build( self->data, data, False );
+	}
+}
+
+
+IndexSet* _VariableAllVC_GetSet( void* variableCondition ) {
+	VariableAllVC*				self = (VariableAllVC*)variableCondition;
+	Variable*				var = self->variable_Register->_variable[0];
+	IndexSet*				set = IndexSet_New( var->arraySize );
+	
+	IndexSet_AddAll( set );
+	
+	return set;
+}
+
+
+VariableCondition_VariableIndex _VariableAllVC_GetVariableCount( void* variableCondition, Index globalIndex ) {
+	VariableAllVC*	self = (VariableAllVC*)variableCondition;
+	
+	return self->_entryCount;
+}
+
+
+Variable_Index _VariableAllVC_GetVariableIndex(
+		void*				variableCondition, 
+		Index				globalIndex, 
+		VariableCondition_VariableIndex	varIndex) 
+{
+	VariableAllVC*	self = (VariableAllVC*)variableCondition;
+	
+	return Variable_Register_GetIndex(self->variable_Register, self->_entryTbl[varIndex].varName);
+}
+
+
+VariableCondition_ValueIndex _VariableAllVC_GetValueIndex(
+		void*				variableCondition, 
+		Index				globalIndex, 
+		VariableCondition_VariableIndex	varIndex)
+{
+	return varIndex;
+}
+
+
+VariableCondition_ValueIndex _VariableAllVC_GetValueCount( void* variableCondition ) {
+	VariableAllVC*	self = (VariableAllVC*)variableCondition;
+	
+	return self->_entryCount;
+}
+
+
+VariableCondition_Value _VariableAllVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex ) {
+	VariableAllVC*	self = (VariableAllVC*)variableCondition;
+
+	return self->_entryTbl[valIndex].value;
+}
+
+void _VariableAllVC_PrintConcise( void* variableCondition, Stream* stream ) {
+	VariableAllVC*		self = (VariableAllVC*)variableCondition;
+	
+	Journal_Printf( stream, "\ttype: %s, set: all\n", self->type );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableCondition.c
--- a/Base/Context/src/VariableCondition.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,741 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: VariableCondition.c 4297 2008-08-19 16:54:05Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-#include "ConditionFunction.h"
-#include "ConditionFunction_Register.h"
-#include "VariableCondition.h"
-
-#include <string.h>
-#include <assert.h>
-
-/** Textual name of this class */
-const Type VariableCondition_Type = "VariableCondition";
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* _VariableCondition_New(  VARIABLECONDITION_DEFARGS  ) {
-	VariableCondition*	self;
-	
-	/* Allocate memory/General info */
-	assert( _sizeOfSelf >= sizeof(VariableCondition) );
-	self = (VariableCondition*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-	
-	/* Virtual info */
-	self->_buildSelf = _buildSelf;
-	self->_printConcise = _printConcise;
-	self->_readDictionary = _readDictionary;
-	self->_getSet = _getSet;
-	self->_getVariableCount = _getVariableCount;
-	self->_getVariableIndex = _getVariableIndex;
-	self->_getValueIndex = _getValueIndex;
-	self->_getValueCount = _getValueCount;
-	self->_getValue = _getValue;
-	self->_apply = _apply;
-	
-	/* Stg_Class info */
-	
-	return self;
-}
-
-
-void _VariableCondition_Init(
-	void*									variableCondition, 
-	AbstractContext*					context,
-	Variable_Register*				variable_Register, 
-	ConditionFunction_Register*	conFunc_Register,
-	Dictionary*							dictionary )
-{
-	VariableCondition*	self = (VariableCondition*)variableCondition;
-	
-	self->context = context;
-	self->variable_Register = variable_Register;
-	self->conFunc_Register = conFunc_Register;
-	self->dictionary = dictionary;
-	self->_set = NULL;
-	self->indexCount = 0;
-	self->indexTbl = NULL;
-	self->vcVarCountTbl = NULL;
-	self->vcTbl = NULL;
-	self->valueCount = 0;
-	self->valueTbl = NULL;
-	self->mapping = NULL;
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _VariableCondition_Delete(void* variableCondition) {
-	VariableCondition* self = (VariableCondition*)variableCondition;
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Component_Delete( self );
-}
-
-
-void _VariableCondition_Print(void* variableCondition) {
-	VariableCondition*					self = (VariableCondition*)variableCondition;
-	VariableCondition_VariableIndex	vcVar_I;
-	VariableCondition_ValueIndex		val_I;
-	Index										i;
-	
-	/* Set the Journal for printing informations */
-	Stream* variableConditionStream = Journal_Register( InfoStream_Type,	"VariableConditionStream");
-	
-	/* General info */
-	Journal_Printf( variableConditionStream, "VariableCondition (ptr): %p\n", self);
-	
-	/* Print parent */
-	_Stg_Component_Print( self, variableConditionStream );
-	
-	/* Virtual info */
-	Journal_Printf( variableConditionStream, "\t_getSet (func ptr): %p\n", self->_getSet);
-	Journal_Printf( variableConditionStream, "\t_getVariableCount (func ptr): %p\n", self->_getVariableCount);
-	Journal_Printf( variableConditionStream, "\t_getVariableIndex (func ptr): %p\n", self->_getVariableIndex);
-	Journal_Printf( variableConditionStream, "\t_getValueIndex (func ptr): %p\n", self->_getValueIndex);
-	Journal_Printf( variableConditionStream, "\t_getValueCount (func ptr): %p\n", self->_getValueCount);
-	Journal_Printf( variableConditionStream, "\t_getValue (func ptr): %p\n", self->_getValue);
-	
-	/* Stg_Class info */
-	Journal_Printf( variableConditionStream, "\tvariable_Register (ptr): %p\n", self->variable_Register);
-	Journal_Printf( variableConditionStream, "\tconFunc_Register (ptr): %p\n", self->conFunc_Register);
-	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]);
-	Journal_Printf( variableConditionStream, "\tvcVarCountTbl (ptr): %p\n", self->vcVarCountTbl);
-	if (self->vcVarCountTbl)
-		for (i = 0; i < self->indexCount; i++)
-			Journal_Printf( variableConditionStream, "\t\tvcVarCountTbl[%u]: %u\n", i, self->vcVarCountTbl[i]);
-	Journal_Printf( variableConditionStream, "\tvcTbl (ptr): %p\n", self->vcTbl);
-	if (self->vcTbl)
-		for (i = 0; i < self->indexCount; i++)
-			for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++)
-			{
-				Journal_Printf( variableConditionStream, "\t\tvcTbl[%u][%u]:\n", i, vcVar_I);
-				Journal_Printf( variableConditionStream, "\t\t\tvarIndex: %u\n", self->vcTbl[i][vcVar_I].varIndex);
-				Journal_Printf( variableConditionStream, "\t\t\tvalIndex: %u\n", self->vcTbl[i][vcVar_I].valIndex);
-			}
-	Journal_Printf( variableConditionStream, "\tvalueCount: %u\n", self->valueCount);
-	Journal_Printf( variableConditionStream, "\tvalueTbl (ptr): %p\n", self->valueTbl);
-	if( self->valueTbl ) {
-		for (val_I = 0; val_I < self->valueCount; val_I++)
-		{
-			Journal_Printf( variableConditionStream, "\t\tvalueTbl[%u]:\n", val_I);
-			switch (self->valueTbl[val_I].type)
-			{
-				case VC_ValueType_Double:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Double\n" );
-					Journal_Printf( variableConditionStream, "\t\t\tasDouble: %g\n", self->valueTbl[val_I].as.typeDouble );
-					break;
-					
-				case VC_ValueType_Int:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Int\n" );
-					Journal_Printf( variableConditionStream, "\t\t\tasInt: %i\n", self->valueTbl[val_I].as.typeInt );
-					break;
-					
-				case VC_ValueType_Short:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Short\n" );
-					Journal_Printf( variableConditionStream, "\t\t\tasShort: %i\n", self->valueTbl[val_I].as.typeShort );
-					break;
-					
-				case VC_ValueType_Char:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Char\n");
-					Journal_Printf( variableConditionStream, "\t\t\tasChar: %c\n", self->valueTbl[val_I].as.typeChar );
-					break;
-					
-				case VC_ValueType_Ptr:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Ptr\n");
-					Journal_Printf( variableConditionStream, "\t\t\tasPtr: %g\n", self->valueTbl[val_I].as.typePtr );
-					break;
-					
-				case VC_ValueType_DoubleArray:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_DoubleArray\n");
-					Journal_Printf( variableConditionStream, "\t\t\tarraySize: %u\n", self->valueTbl[val_I].as.typeArray.size);
-					Journal_Printf( variableConditionStream, "\t\t\tasDoubleArray (ptr): %p\n", self->valueTbl[val_I].as.typeArray.array);
-					if (self->valueTbl[val_I].as.typeArray.array)
-						for (i = 0; i < self->valueTbl[val_I].as.typeArray.size; i++)
-							Journal_Printf( variableConditionStream, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
-								self->valueTbl[val_I].as.typeArray.array[i]);
-					break;
-					
-				case VC_ValueType_CFIndex:
-					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_CFIndex\n");
-					Journal_Printf( variableConditionStream, "\t\t\tasCFIndex: %u\n", self->valueTbl[val_I].as.typeCFIndex);
-					break;
-			}
-		}
-	}
-}
-
-
-void* _VariableCondition_Copy( const void* variableCondition, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	VariableCondition*	self = (VariableCondition*)variableCondition;
-	VariableCondition*	newVariableCondition;
-	PtrMap*			map = ptrMap;
-	Bool			ownMap = False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newVariableCondition = (VariableCondition*)_Stg_Component_Copy( self, dest, deep, nameExt, map );
-	
-	/* Virtual methods */
-	newVariableCondition->_buildSelf = self->_buildSelf;
-	newVariableCondition->_printConcise = self->_printConcise;
-	newVariableCondition->_readDictionary = self->_readDictionary;
-	newVariableCondition->_getSet = self->_getSet;
-	newVariableCondition->_getVariableCount = self->_getVariableCount;
-	newVariableCondition->_getVariableIndex = self->_getVariableIndex;
-	newVariableCondition->_getValueIndex = self->_getValueIndex;
-	newVariableCondition->_getValueCount = self->_getValueCount;
-	newVariableCondition->_getValue = self->_getValue;
-	
-	newVariableCondition->variable_Register = self->variable_Register;
-	newVariableCondition->conFunc_Register = self->conFunc_Register;
-	newVariableCondition->dictionary = self->dictionary;
-	newVariableCondition->indexCount = self->indexCount;
-	newVariableCondition->valueCount = self->valueCount;
-	
-	if( deep ) {
-		newVariableCondition->_set = (IndexSet*)Stg_Class_Copy( self->_set, NULL, deep, nameExt, map );
-		
-		if( (newVariableCondition->indexTbl = (Index*)PtrMap_Find( map, self->indexTbl )) == NULL && self->indexTbl ) {
-			newVariableCondition->indexTbl = (Index*)Memory_Alloc_Array( Index, newVariableCondition->indexCount, "VariableCondition->indexTbl" );
-			memcpy( newVariableCondition->indexTbl, self->indexTbl, sizeof(Index) * newVariableCondition->indexCount );
-			PtrMap_Append( map, newVariableCondition->indexTbl, self->indexTbl );
-		}
-		
-		if( (newVariableCondition->vcVarCountTbl = (VariableCondition_VariableIndex*)PtrMap_Find( map, self->vcVarCountTbl )) == NULL && self->vcVarCountTbl ) {
-			newVariableCondition->vcVarCountTbl = Memory_Alloc_Array( VariableCondition_VariableIndex, newVariableCondition->indexCount, "VC->vcVarCountTbl" );
-			memcpy( newVariableCondition->vcVarCountTbl, self->vcVarCountTbl, sizeof(VariableCondition_VariableIndex) * newVariableCondition->indexCount );
-			PtrMap_Append( map, newVariableCondition->vcVarCountTbl, self->vcVarCountTbl );
-		}
-		
-		if( (newVariableCondition->vcTbl = (VariableCondition_Tuple**)PtrMap_Find( map, self->vcTbl )) == NULL && self->vcTbl ) {
-			Index	idx_I;
-			
-			newVariableCondition->vcTbl = Memory_Alloc_2DComplex( VariableCondition_Tuple, newVariableCondition->indexCount, newVariableCondition->vcVarCountTbl, "VC->vcTbl" );
-			for( idx_I = 0; idx_I < newVariableCondition->indexCount; idx_I++ ) {
-				memcpy( newVariableCondition->vcTbl[idx_I], self->vcTbl[idx_I], sizeof(VariableCondition_Tuple) * newVariableCondition->vcVarCountTbl[idx_I] );
-			}
-			PtrMap_Append( map, newVariableCondition->vcTbl, self->vcTbl );
-		}
-		
-		if( (newVariableCondition->valueTbl = (VariableCondition_Value*)PtrMap_Find( map, self->valueTbl )) == NULL && self->valueTbl ) {
-			newVariableCondition->valueTbl = Memory_Alloc_Array( VariableCondition_Value, newVariableCondition->valueCount, "VC->valueTbl" );
-			memcpy( newVariableCondition->valueTbl, self->valueTbl, sizeof(VariableCondition_Value) * newVariableCondition->indexCount );
-			PtrMap_Append( map, newVariableCondition->valueTbl, self->valueTbl );
-		}
-	}
-	else {
-		newVariableCondition->_set = self->_set;
-		newVariableCondition->indexTbl = self->indexTbl;
-		newVariableCondition->vcVarCountTbl = self->vcVarCountTbl;
-		newVariableCondition->vcTbl = self->vcTbl;
-		newVariableCondition->valueTbl = self->valueTbl;
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-	
-	return (void*)newVariableCondition;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-void _VariableCondition_AssignFromXML( void* variableCondition, Stg_ComponentFactory* cf, void* data ) {
-}
-
-void _VariableCondition_Build( void* variableCondition, void* data ) {
-	VariableCondition*				self = (VariableCondition*)variableCondition;
-	VariableCondition_ValueIndex	val_I;
-	Index									i;
-	
-	/* Read the dictionary */
-	self->_readDictionary( self, self->dictionary );
-	
-	/* Obtain the set */
-	self->_set = self->_getSet(self);
-	if (self->_set)
-		IndexSet_GetMembers(self->_set, &self->indexCount, &self->indexTbl);
-	else {
-		self->indexCount = 0;
-		self->indexTbl = NULL;
-	}
-	
-	/* Only build the index related tables if there are active BCs */
-	if ( self->indexCount ) {
-		/* 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 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++ ) {
-			VariableCondition_VariableIndex 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. */
-				self->vcTbl[i][vcVar_I].varIndex = self->_getVariableIndex(self, self->indexTbl[i], vcVar_I);
-				self->vcTbl[i][vcVar_I].valIndex = self->_getValueIndex(self, self->indexTbl[i], vcVar_I);
-
-				/* Force the building of the variable (to be safe) */
-				var = self->variable_Register->_variable[self->vcTbl[i][vcVar_I].varIndex];
-				Stg_Component_Build( var, data, False );
-			}
-		}
-	}	
-
-	self->valueCount = self->_getValueCount(self);
-	self->valueTbl = Memory_Alloc_Array( VariableCondition_Value, self->valueCount, "VC->valueTbl" );
-	for (val_I = 0; val_I < self->valueCount; val_I++)
-		self->valueTbl[val_I] = self->_getValue(self, val_I);
-
-	/* Build mapping. */
-	self->mapping = UIntMap_New();
-	for( i = 0; i < self->indexCount; i++ )
-		UIntMap_Insert( self->mapping, self->indexTbl[i], i );
-}
-
-void _VariableCondition_Initialise( void* variableCondition, void* data ) {
-	VariableCondition*	self = (VariableCondition*)variableCondition;
-	Index						i;
-	
-	for( i = 0; i < self->indexCount; i++ ) {
-		VariableCondition_VariableIndex	vcVar_I;
-		
-		for( vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++ ) {
-			Variable* var;
-			
-			/* Force the building of the variable (to be safe) */
-			var = self->variable_Register->_variable[self->vcTbl[i][vcVar_I].varIndex];
-			Stg_Component_Initialise( var, data, False );
-		}
-	}
-}
-
-void _VariableCondition_Execute( void* variableCondition, void* data ) {
-	VariableCondition* self = (VariableCondition*)variableCondition;
-	
-	VariableCondition_Apply( self, data );
-}
-
-void _VariableCondition_Destroy( void* variableCondition, void* data ) {
-	VariableCondition* self = (VariableCondition*)variableCondition;
-
-	if (self->mapping) Stg_Class_Delete(self->mapping);
-	if (self->_set) Stg_Class_Delete(self->_set);
-	if (self->indexTbl) Memory_Free(self->indexTbl);
-	if (self->vcVarCountTbl) Memory_Free(self->vcVarCountTbl);
-	if (self->vcTbl) Memory_Free(self->vcTbl);
-	if (self->valueTbl) Memory_Free(self->valueTbl);
-}
-
-void _VariableCondition_Apply( void* variableCondition, void* context ) {
-	VariableCondition*	self = (VariableCondition*)variableCondition;
-	Index						i;
-	
-	for (i = 0; i < self->indexCount; i++)
-		VariableCondition_ApplyToIndex(variableCondition, self->indexTbl[i], context);
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-void VariableCondition_Apply( void* variableCondition, void* context ) {
-	assert( variableCondition );
-	((VariableCondition*)variableCondition)->_apply( variableCondition, context );
-}
-
-
-void VariableCondition_ApplyToVariable( void* variableCondition, VariableCondition_VariableIndex varIndex, void* context ) {
-	VariableCondition*	self = (VariableCondition*)variableCondition;
-	Index			i;
-	
-	for (i = 0; i < self->indexCount; i++)
-		VariableCondition_ApplyToIndexVariable(variableCondition, self->indexTbl[i], varIndex, context);
-}
-
-
-void VariableCondition_ApplyToIndex( void* variableCondition, Index localIndex, void* context ) {
-	VariableCondition*		self = (VariableCondition*)variableCondition;
-	Variable*			var;
-	Variable_Index			varIndex;
-	VariableCondition_ValueIndex	val_I;
-	ConditionFunction*		cf;
-	Index				index, i;
-	Stream*				errorStr = Journal_Register( Error_Type, self->type );
-
-	/* Ensure that the index provided (localIndex) has a condition attached to it */
-	insist( UIntMap_Map( self->mapping, localIndex, &index ), == True );
-	
-	/* For each variable that has a condition at this index */
-	for (i = 0; i < self->vcVarCountTbl[index]; i++)
-	{
-		varIndex = self->vcTbl[index][i].varIndex;
-		assert( varIndex != (unsigned)-1 );
-		
-		var = self->variable_Register->_variable[varIndex];
-		
-		val_I = self->vcTbl[index][i].valIndex;
-		assert( val_I != (unsigned)-1 );
-		
-		switch (self->valueTbl[val_I].type)
-		{
-			case VC_ValueType_Double:
-				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
-					"Error - in %s: while applying values for variable condition "
-					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
-					"which has %d components. Specify a scalar Variable instead.\n",
-					__func__, self->name, self->indexTbl[index], "double",
-					var->name, var->dataTypeCounts[0] );
-				Variable_SetValueDouble(
-					var, 
-					self->indexTbl[index], 
-					self->valueTbl[val_I].as.typeDouble );
-				break;
-			
-			case VC_ValueType_DoubleArray:
-				Variable_SetValue(
-					var, 
-					self->indexTbl[index], 
-					self->valueTbl[val_I].as.typeArray.array );
-				break;
-			
-			case VC_ValueType_CFIndex:
-				Journal_Firewall( self->valueTbl[val_I].as.typeCFIndex != (unsigned)-1, errorStr,
-					"Error - in %s: trying to apply to index %d of variable \"%s\", which "
-					"is supposed to be a condition function, but the cond. func. wasn't "
-					"found in the c.f. register.\n", __func__, localIndex, var->name );
-				cf = self->conFunc_Register->_cf[self->valueTbl[val_I].as.typeCFIndex];
-				ConditionFunction_Apply(
-					cf, 
-					localIndex, 
-					varIndex, 
-					context, 
-					Variable_GetStructPtr( var, self->indexTbl[index] ) );
-				break;
-			
-			case VC_ValueType_Int:
-				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
-					"Error - in %s: while applying values for variable condition "
-					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
-					"which has %d components. Specify a scalar Variable instead.\n",
-					__func__, self->name, self->indexTbl[index], "int",
-					var->name, var->dataTypeCounts[0] );
-				Variable_SetValueInt(
-					var, 
-					self->indexTbl[index], 
-					self->valueTbl[val_I].as.typeInt );
-				break;
-			
-			case VC_ValueType_Short:
-				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
-					"Error - in %s: while applying values for variable condition "
-					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
-					"which has %d components. Specify a scalar Variable instead.\n",
-					__func__, self->name, self->indexTbl[index], "short",
-					var->name, var->dataTypeCounts[0] );
-				Variable_SetValueShort(
-					var, 
-					self->indexTbl[index], 
-					self->valueTbl[val_I].as.typeShort );
-				break;
-			
-			case VC_ValueType_Char:
-				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
-					"Error - in %s: while applying values for variable condition "
-					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
-					"which has %d components. Specify a scalar Variable instead.\n",
-					__func__, self->name, self->indexTbl[index], "char",
-					var->name, var->dataTypeCounts[0] );
-				Variable_SetValueChar(
-					var, 
-					self->indexTbl[index], 
-					self->valueTbl[val_I].as.typeChar );
-				break;
-			
-			case VC_ValueType_Ptr:
-				Variable_SetValuePointer(
-					var, 
-					self->indexTbl[index], 
-					self->valueTbl[val_I].as.typePtr );
-				break;
-			
-			default:
-				assert(0);
-				break;
-		}
-	}
-}
-
-
-void VariableCondition_ApplyToIndexVariable(
-		void*				variableCondition, 
-		Index				localIndex, 
-		VariableCondition_VariableIndex	varIndex,
-		void*				context )
-{
-	VariableCondition*	self = (VariableCondition*)variableCondition;
-	Variable_Index		globalVarIndex;
-	Variable*		var;
-	ConditionFunction*	cf;
-	Index			index;
-	
-/*
- * NOTE: This algorithm here is RIDICULOUSLY slow. I've added a mapping
- *       to the class, that should help.
-
-	for (index = 0; index < self->indexCount; index++)
-		if (self->indexTbl[index] == localIndex)
-			break;
-*/
-
-	if(!UIntMap_Map( self->mapping, localIndex, &index ))
-	    return;
-	
-	globalVarIndex = self->vcTbl[index][varIndex].varIndex;
-	var = self->variable_Register->_variable[globalVarIndex];
-		
-	switch (self->valueTbl[self->vcTbl[index][varIndex].valIndex].type)
-	{
-		case VC_ValueType_Double:
-			Variable_SetValueDouble(
-				var, 
-				self->indexTbl[index], 
-				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeDouble );
-			break;
-		
-		case VC_ValueType_CFIndex:
-			cf = self->conFunc_Register->_cf[self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeCFIndex];
-			ConditionFunction_Apply( 
-				cf, 
-				localIndex, 
-				globalVarIndex, 
-				context, 
-				Variable_GetStructPtr( var, self->indexTbl[index]) );
-			break;
-		
-		case VC_ValueType_DoubleArray:
-			Variable_SetValue(
-				var, 
-				self->indexTbl[index], 
-				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeArray.array );
-			break;
-		
-		case VC_ValueType_Int:
-			Variable_SetValueInt(
-				var, 
-				self->indexTbl[index], 
-				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeInt );
-			break;
-		
-		case VC_ValueType_Short:
-			Variable_SetValueShort(
-				var, 
-				self->indexTbl[index], 
-				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeShort );
-			break;
-		
-		case VC_ValueType_Char:
-			Variable_SetValueChar(
-				var, 
-				self->indexTbl[index], 
-				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeChar );
-			break;
-		
-		case VC_ValueType_Ptr:
-			Variable_SetValuePointer(
-				var, 
-				self->indexTbl[index], 
-				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typePtr );
-			break;
-		
-		default:
-			assert(0);
-			break;
-	}
-}
-
-
-Bool VariableCondition_IsCondition( void* variableCondition, Index localIndex, Variable_Index inputVarIndex ) {
-	VariableCondition*		self = (VariableCondition*)variableCondition;
-	VariableCondition_VariableIndex	vcVar_I;
-	Index				i;
-	Variable_Index                  varIndexToTryMatch = 0;
-	Variable_Index                  subVarIndexToTryMatch = 0;
-	Variable*                       variableToTryMatch = NULL;
-	Variable*                       subVariableToTryMatch = NULL;
-	Variable_Index                  subVariable_I = 0;
-
-	/* if the set isn't initialised, this is a NULL BC : False */
-	if ( !self->_set ) {
-		return False;
-	}
-
-	/* first check if the index they've given us is actually in the list this VC applies to */
-	/* quick check, since we have the set available */
-	if ( localIndex >= self->_set->size ) {
-		Stream* warning = Journal_Register( ErrorStream_Type, self->type );
-		Journal_Printf( warning, "Error- In %s: Tried to check an index %d larger than the size of "
-			"the set (%d).\n", __func__, localIndex, self->_set->size );
-		assert(0);	
-		return False;
-	}
-
-	if(!UIntMap_Map( self->mapping, localIndex, &i ))
-	    return False;
-/*
-	if ( !IndexSet_IsMember( self->_set, localIndex ) ) {
-		return False;
-	}
-	for (i = 0; i < self->indexCount; i++)
-		if (self->indexTbl[i] == localIndex)
-			break;
-			
-	if (i == self->indexCount)
-		return False;
-*/
-	
-	/* now check if the Variable they've given us is actually in the list to apply at the given index */
-	for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++) {
-		varIndexToTryMatch = self->vcTbl[i][vcVar_I].varIndex;
-		variableToTryMatch = self->variable_Register->_variable[varIndexToTryMatch];
-
-		if ( varIndexToTryMatch == inputVarIndex) {
-			return True;
-		}
-		else if ( variableToTryMatch->subVariablesCount >= 1 ) {
-			/* 2nd chance draw is that if this Var has sub-components, we should test if the input argument is
-			 * actually one of those - in which case we should consider it has a condition applied to it. */
-			
-			for ( subVariable_I = 0; subVariable_I < variableToTryMatch->subVariablesCount; subVariable_I++ ) {
-			  /* TODO: next few lines bit slow! Maybe need to cache subvar indices on variable */
-				subVariableToTryMatch = variableToTryMatch->components[subVariable_I];
-				if ( subVariableToTryMatch == NULL ) continue;
-				
-				subVarIndexToTryMatch = Variable_Register_GetIndex( self->variable_Register,
-					subVariableToTryMatch->name );
-
-				if ( subVarIndexToTryMatch == inputVarIndex) {
-					return True;
-				}
-			}
-		}
-	}
-	
-	return False;
-}
-
-
-VariableCondition_ValueIndex VariableCondition_GetValueIndex (void* variableCondition, Index localIndex, Variable_Index varIndex )
-{
-	VariableCondition*		self = (VariableCondition*)variableCondition;
-	VariableCondition_VariableIndex	vcVar_I;
-	Index				i;
-	
-	/* if the set isn't initialised, this is a NULL BC : False */
-	if ( !self->_set ) {
-		return False;
-	}
-
-	/* first check if the index they've given us is actually in the list this VC applies to */
-	/* quick check, since we have the set available */
-	if ( localIndex >= self->_set->size ) {
-		Stream* warning = Journal_Register( ErrorStream_Type, self->type );
-		Journal_Printf( warning, "Error- In %s: Tried to check an index %d larger than the size of "
-			"the set (%d).\n", __func__, localIndex, self->_set->size );
-		assert(0);	
-		return False;
-	}
-	if ( !IndexSet_IsMember( self->_set, localIndex ) ) {
-		return (VariableCondition_ValueIndex)-1;
-	}
-	for (i = 0; i < self->indexCount; i++)
-		if (self->indexTbl[i] == localIndex)
-			break;
-			
-	if (i == self->indexCount)
-		return (VariableCondition_ValueIndex)-1;
-	
-	/* now check if the Variable they've given us is actually in the list to apply at the given index */
-	for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++)
-		if (self->vcTbl[i][vcVar_I].varIndex == varIndex)
-			return self->vcTbl[i][vcVar_I].valIndex;
-	
-	return (VariableCondition_ValueIndex)-1;
-}
-
-
-void VariableCondition_PrintConcise( void* variableCondition, Stream* stream ) {
-	VariableCondition*		self = (VariableCondition*)variableCondition;
-	
-	self->_printConcise( self, stream );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableCondition.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/VariableCondition.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,741 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: VariableCondition.c 4297 2008-08-19 16:54:05Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+#include "ConditionFunction.h"
+#include "ConditionFunction_Register.h"
+#include "VariableCondition.h"
+
+#include <string.h>
+#include <assert.h>
+
+/** Textual name of this class */
+const Type VariableCondition_Type = "VariableCondition";
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* _VariableCondition_New(  VARIABLECONDITION_DEFARGS  ) {
+	VariableCondition*	self;
+	
+	/* Allocate memory/General info */
+	assert( _sizeOfSelf >= sizeof(VariableCondition) );
+	self = (VariableCondition*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+	
+	/* Virtual info */
+	self->_buildSelf = _buildSelf;
+	self->_printConcise = _printConcise;
+	self->_readDictionary = _readDictionary;
+	self->_getSet = _getSet;
+	self->_getVariableCount = _getVariableCount;
+	self->_getVariableIndex = _getVariableIndex;
+	self->_getValueIndex = _getValueIndex;
+	self->_getValueCount = _getValueCount;
+	self->_getValue = _getValue;
+	self->_apply = _apply;
+	
+	/* Stg_Class info */
+	
+	return self;
+}
+
+
+void _VariableCondition_Init(
+	void*									variableCondition, 
+	AbstractContext*					context,
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*	conFunc_Register,
+	Dictionary*							dictionary )
+{
+	VariableCondition*	self = (VariableCondition*)variableCondition;
+	
+	self->context = context;
+	self->variable_Register = variable_Register;
+	self->conFunc_Register = conFunc_Register;
+	self->dictionary = dictionary;
+	self->_set = NULL;
+	self->indexCount = 0;
+	self->indexTbl = NULL;
+	self->vcVarCountTbl = NULL;
+	self->vcTbl = NULL;
+	self->valueCount = 0;
+	self->valueTbl = NULL;
+	self->mapping = NULL;
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _VariableCondition_Delete(void* variableCondition) {
+	VariableCondition* self = (VariableCondition*)variableCondition;
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Component_Delete( self );
+}
+
+
+void _VariableCondition_Print(void* variableCondition) {
+	VariableCondition*					self = (VariableCondition*)variableCondition;
+	VariableCondition_VariableIndex	vcVar_I;
+	VariableCondition_ValueIndex		val_I;
+	Index										i;
+	
+	/* Set the Journal for printing informations */
+	Stream* variableConditionStream = Journal_Register( InfoStream_Type,	"VariableConditionStream");
+	
+	/* General info */
+	Journal_Printf( variableConditionStream, "VariableCondition (ptr): %p\n", self);
+	
+	/* Print parent */
+	_Stg_Component_Print( self, variableConditionStream );
+	
+	/* Virtual info */
+	Journal_Printf( variableConditionStream, "\t_getSet (func ptr): %p\n", self->_getSet);
+	Journal_Printf( variableConditionStream, "\t_getVariableCount (func ptr): %p\n", self->_getVariableCount);
+	Journal_Printf( variableConditionStream, "\t_getVariableIndex (func ptr): %p\n", self->_getVariableIndex);
+	Journal_Printf( variableConditionStream, "\t_getValueIndex (func ptr): %p\n", self->_getValueIndex);
+	Journal_Printf( variableConditionStream, "\t_getValueCount (func ptr): %p\n", self->_getValueCount);
+	Journal_Printf( variableConditionStream, "\t_getValue (func ptr): %p\n", self->_getValue);
+	
+	/* Stg_Class info */
+	Journal_Printf( variableConditionStream, "\tvariable_Register (ptr): %p\n", self->variable_Register);
+	Journal_Printf( variableConditionStream, "\tconFunc_Register (ptr): %p\n", self->conFunc_Register);
+	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]);
+	Journal_Printf( variableConditionStream, "\tvcVarCountTbl (ptr): %p\n", self->vcVarCountTbl);
+	if (self->vcVarCountTbl)
+		for (i = 0; i < self->indexCount; i++)
+			Journal_Printf( variableConditionStream, "\t\tvcVarCountTbl[%u]: %u\n", i, self->vcVarCountTbl[i]);
+	Journal_Printf( variableConditionStream, "\tvcTbl (ptr): %p\n", self->vcTbl);
+	if (self->vcTbl)
+		for (i = 0; i < self->indexCount; i++)
+			for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++)
+			{
+				Journal_Printf( variableConditionStream, "\t\tvcTbl[%u][%u]:\n", i, vcVar_I);
+				Journal_Printf( variableConditionStream, "\t\t\tvarIndex: %u\n", self->vcTbl[i][vcVar_I].varIndex);
+				Journal_Printf( variableConditionStream, "\t\t\tvalIndex: %u\n", self->vcTbl[i][vcVar_I].valIndex);
+			}
+	Journal_Printf( variableConditionStream, "\tvalueCount: %u\n", self->valueCount);
+	Journal_Printf( variableConditionStream, "\tvalueTbl (ptr): %p\n", self->valueTbl);
+	if( self->valueTbl ) {
+		for (val_I = 0; val_I < self->valueCount; val_I++)
+		{
+			Journal_Printf( variableConditionStream, "\t\tvalueTbl[%u]:\n", val_I);
+			switch (self->valueTbl[val_I].type)
+			{
+				case VC_ValueType_Double:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Double\n" );
+					Journal_Printf( variableConditionStream, "\t\t\tasDouble: %g\n", self->valueTbl[val_I].as.typeDouble );
+					break;
+					
+				case VC_ValueType_Int:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Int\n" );
+					Journal_Printf( variableConditionStream, "\t\t\tasInt: %i\n", self->valueTbl[val_I].as.typeInt );
+					break;
+					
+				case VC_ValueType_Short:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Short\n" );
+					Journal_Printf( variableConditionStream, "\t\t\tasShort: %i\n", self->valueTbl[val_I].as.typeShort );
+					break;
+					
+				case VC_ValueType_Char:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Char\n");
+					Journal_Printf( variableConditionStream, "\t\t\tasChar: %c\n", self->valueTbl[val_I].as.typeChar );
+					break;
+					
+				case VC_ValueType_Ptr:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_Ptr\n");
+					Journal_Printf( variableConditionStream, "\t\t\tasPtr: %g\n", self->valueTbl[val_I].as.typePtr );
+					break;
+					
+				case VC_ValueType_DoubleArray:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_DoubleArray\n");
+					Journal_Printf( variableConditionStream, "\t\t\tarraySize: %u\n", self->valueTbl[val_I].as.typeArray.size);
+					Journal_Printf( variableConditionStream, "\t\t\tasDoubleArray (ptr): %p\n", self->valueTbl[val_I].as.typeArray.array);
+					if (self->valueTbl[val_I].as.typeArray.array)
+						for (i = 0; i < self->valueTbl[val_I].as.typeArray.size; i++)
+							Journal_Printf( variableConditionStream, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
+								self->valueTbl[val_I].as.typeArray.array[i]);
+					break;
+					
+				case VC_ValueType_CFIndex:
+					Journal_Printf( variableConditionStream, "\t\t\ttype: VC_ValueType_CFIndex\n");
+					Journal_Printf( variableConditionStream, "\t\t\tasCFIndex: %u\n", self->valueTbl[val_I].as.typeCFIndex);
+					break;
+			}
+		}
+	}
+}
+
+
+void* _VariableCondition_Copy( const void* variableCondition, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	VariableCondition*	self = (VariableCondition*)variableCondition;
+	VariableCondition*	newVariableCondition;
+	PtrMap*			map = ptrMap;
+	Bool			ownMap = False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newVariableCondition = (VariableCondition*)_Stg_Component_Copy( self, dest, deep, nameExt, map );
+	
+	/* Virtual methods */
+	newVariableCondition->_buildSelf = self->_buildSelf;
+	newVariableCondition->_printConcise = self->_printConcise;
+	newVariableCondition->_readDictionary = self->_readDictionary;
+	newVariableCondition->_getSet = self->_getSet;
+	newVariableCondition->_getVariableCount = self->_getVariableCount;
+	newVariableCondition->_getVariableIndex = self->_getVariableIndex;
+	newVariableCondition->_getValueIndex = self->_getValueIndex;
+	newVariableCondition->_getValueCount = self->_getValueCount;
+	newVariableCondition->_getValue = self->_getValue;
+	
+	newVariableCondition->variable_Register = self->variable_Register;
+	newVariableCondition->conFunc_Register = self->conFunc_Register;
+	newVariableCondition->dictionary = self->dictionary;
+	newVariableCondition->indexCount = self->indexCount;
+	newVariableCondition->valueCount = self->valueCount;
+	
+	if( deep ) {
+		newVariableCondition->_set = (IndexSet*)Stg_Class_Copy( self->_set, NULL, deep, nameExt, map );
+		
+		if( (newVariableCondition->indexTbl = (Index*)PtrMap_Find( map, self->indexTbl )) == NULL && self->indexTbl ) {
+			newVariableCondition->indexTbl = (Index*)Memory_Alloc_Array( Index, newVariableCondition->indexCount, "VariableCondition->indexTbl" );
+			memcpy( newVariableCondition->indexTbl, self->indexTbl, sizeof(Index) * newVariableCondition->indexCount );
+			PtrMap_Append( map, newVariableCondition->indexTbl, self->indexTbl );
+		}
+		
+		if( (newVariableCondition->vcVarCountTbl = (VariableCondition_VariableIndex*)PtrMap_Find( map, self->vcVarCountTbl )) == NULL && self->vcVarCountTbl ) {
+			newVariableCondition->vcVarCountTbl = Memory_Alloc_Array( VariableCondition_VariableIndex, newVariableCondition->indexCount, "VC->vcVarCountTbl" );
+			memcpy( newVariableCondition->vcVarCountTbl, self->vcVarCountTbl, sizeof(VariableCondition_VariableIndex) * newVariableCondition->indexCount );
+			PtrMap_Append( map, newVariableCondition->vcVarCountTbl, self->vcVarCountTbl );
+		}
+		
+		if( (newVariableCondition->vcTbl = (VariableCondition_Tuple**)PtrMap_Find( map, self->vcTbl )) == NULL && self->vcTbl ) {
+			Index	idx_I;
+			
+			newVariableCondition->vcTbl = Memory_Alloc_2DComplex( VariableCondition_Tuple, newVariableCondition->indexCount, newVariableCondition->vcVarCountTbl, "VC->vcTbl" );
+			for( idx_I = 0; idx_I < newVariableCondition->indexCount; idx_I++ ) {
+				memcpy( newVariableCondition->vcTbl[idx_I], self->vcTbl[idx_I], sizeof(VariableCondition_Tuple) * newVariableCondition->vcVarCountTbl[idx_I] );
+			}
+			PtrMap_Append( map, newVariableCondition->vcTbl, self->vcTbl );
+		}
+		
+		if( (newVariableCondition->valueTbl = (VariableCondition_Value*)PtrMap_Find( map, self->valueTbl )) == NULL && self->valueTbl ) {
+			newVariableCondition->valueTbl = Memory_Alloc_Array( VariableCondition_Value, newVariableCondition->valueCount, "VC->valueTbl" );
+			memcpy( newVariableCondition->valueTbl, self->valueTbl, sizeof(VariableCondition_Value) * newVariableCondition->indexCount );
+			PtrMap_Append( map, newVariableCondition->valueTbl, self->valueTbl );
+		}
+	}
+	else {
+		newVariableCondition->_set = self->_set;
+		newVariableCondition->indexTbl = self->indexTbl;
+		newVariableCondition->vcVarCountTbl = self->vcVarCountTbl;
+		newVariableCondition->vcTbl = self->vcTbl;
+		newVariableCondition->valueTbl = self->valueTbl;
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+	
+	return (void*)newVariableCondition;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+void _VariableCondition_AssignFromXML( void* variableCondition, Stg_ComponentFactory* cf, void* data ) {
+}
+
+void _VariableCondition_Build( void* variableCondition, void* data ) {
+	VariableCondition*				self = (VariableCondition*)variableCondition;
+	VariableCondition_ValueIndex	val_I;
+	Index									i;
+	
+	/* Read the dictionary */
+	self->_readDictionary( self, self->dictionary );
+	
+	/* Obtain the set */
+	self->_set = self->_getSet(self);
+	if (self->_set)
+		IndexSet_GetMembers(self->_set, &self->indexCount, &self->indexTbl);
+	else {
+		self->indexCount = 0;
+		self->indexTbl = NULL;
+	}
+	
+	/* Only build the index related tables if there are active BCs */
+	if ( self->indexCount ) {
+		/* 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 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++ ) {
+			VariableCondition_VariableIndex 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. */
+				self->vcTbl[i][vcVar_I].varIndex = self->_getVariableIndex(self, self->indexTbl[i], vcVar_I);
+				self->vcTbl[i][vcVar_I].valIndex = self->_getValueIndex(self, self->indexTbl[i], vcVar_I);
+
+				/* Force the building of the variable (to be safe) */
+				var = self->variable_Register->_variable[self->vcTbl[i][vcVar_I].varIndex];
+				Stg_Component_Build( var, data, False );
+			}
+		}
+	}	
+
+	self->valueCount = self->_getValueCount(self);
+	self->valueTbl = Memory_Alloc_Array( VariableCondition_Value, self->valueCount, "VC->valueTbl" );
+	for (val_I = 0; val_I < self->valueCount; val_I++)
+		self->valueTbl[val_I] = self->_getValue(self, val_I);
+
+	/* Build mapping. */
+	self->mapping = UIntMap_New();
+	for( i = 0; i < self->indexCount; i++ )
+		UIntMap_Insert( self->mapping, self->indexTbl[i], i );
+}
+
+void _VariableCondition_Initialise( void* variableCondition, void* data ) {
+	VariableCondition*	self = (VariableCondition*)variableCondition;
+	Index						i;
+	
+	for( i = 0; i < self->indexCount; i++ ) {
+		VariableCondition_VariableIndex	vcVar_I;
+		
+		for( vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++ ) {
+			Variable* var;
+			
+			/* Force the building of the variable (to be safe) */
+			var = self->variable_Register->_variable[self->vcTbl[i][vcVar_I].varIndex];
+			Stg_Component_Initialise( var, data, False );
+		}
+	}
+}
+
+void _VariableCondition_Execute( void* variableCondition, void* data ) {
+	VariableCondition* self = (VariableCondition*)variableCondition;
+	
+	VariableCondition_Apply( self, data );
+}
+
+void _VariableCondition_Destroy( void* variableCondition, void* data ) {
+	VariableCondition* self = (VariableCondition*)variableCondition;
+
+	if (self->mapping) Stg_Class_Delete(self->mapping);
+	if (self->_set) Stg_Class_Delete(self->_set);
+	if (self->indexTbl) Memory_Free(self->indexTbl);
+	if (self->vcVarCountTbl) Memory_Free(self->vcVarCountTbl);
+	if (self->vcTbl) Memory_Free(self->vcTbl);
+	if (self->valueTbl) Memory_Free(self->valueTbl);
+}
+
+void _VariableCondition_Apply( void* variableCondition, void* context ) {
+	VariableCondition*	self = (VariableCondition*)variableCondition;
+	Index						i;
+	
+	for (i = 0; i < self->indexCount; i++)
+		VariableCondition_ApplyToIndex(variableCondition, self->indexTbl[i], context);
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+void VariableCondition_Apply( void* variableCondition, void* context ) {
+	assert( variableCondition );
+	((VariableCondition*)variableCondition)->_apply( variableCondition, context );
+}
+
+
+void VariableCondition_ApplyToVariable( void* variableCondition, VariableCondition_VariableIndex varIndex, void* context ) {
+	VariableCondition*	self = (VariableCondition*)variableCondition;
+	Index			i;
+	
+	for (i = 0; i < self->indexCount; i++)
+		VariableCondition_ApplyToIndexVariable(variableCondition, self->indexTbl[i], varIndex, context);
+}
+
+
+void VariableCondition_ApplyToIndex( void* variableCondition, Index localIndex, void* context ) {
+	VariableCondition*		self = (VariableCondition*)variableCondition;
+	Variable*			var;
+	Variable_Index			varIndex;
+	VariableCondition_ValueIndex	val_I;
+	ConditionFunction*		cf;
+	Index				index, i;
+	Stream*				errorStr = Journal_Register( Error_Type, self->type );
+
+	/* Ensure that the index provided (localIndex) has a condition attached to it */
+	insist( UIntMap_Map( self->mapping, localIndex, &index ), == True );
+	
+	/* For each variable that has a condition at this index */
+	for (i = 0; i < self->vcVarCountTbl[index]; i++)
+	{
+		varIndex = self->vcTbl[index][i].varIndex;
+		assert( varIndex != (unsigned)-1 );
+		
+		var = self->variable_Register->_variable[varIndex];
+		
+		val_I = self->vcTbl[index][i].valIndex;
+		assert( val_I != (unsigned)-1 );
+		
+		switch (self->valueTbl[val_I].type)
+		{
+			case VC_ValueType_Double:
+				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
+					"Error - in %s: while applying values for variable condition "
+					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
+					"which has %d components. Specify a scalar Variable instead.\n",
+					__func__, self->name, self->indexTbl[index], "double",
+					var->name, var->dataTypeCounts[0] );
+				Variable_SetValueDouble(
+					var, 
+					self->indexTbl[index], 
+					self->valueTbl[val_I].as.typeDouble );
+				break;
+			
+			case VC_ValueType_DoubleArray:
+				Variable_SetValue(
+					var, 
+					self->indexTbl[index], 
+					self->valueTbl[val_I].as.typeArray.array );
+				break;
+			
+			case VC_ValueType_CFIndex:
+				Journal_Firewall( self->valueTbl[val_I].as.typeCFIndex != (unsigned)-1, errorStr,
+					"Error - in %s: trying to apply to index %d of variable \"%s\", which "
+					"is supposed to be a condition function, but the cond. func. wasn't "
+					"found in the c.f. register.\n", __func__, localIndex, var->name );
+				cf = self->conFunc_Register->_cf[self->valueTbl[val_I].as.typeCFIndex];
+				ConditionFunction_Apply(
+					cf, 
+					localIndex, 
+					varIndex, 
+					context, 
+					Variable_GetStructPtr( var, self->indexTbl[index] ) );
+				break;
+			
+			case VC_ValueType_Int:
+				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
+					"Error - in %s: while applying values for variable condition "
+					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
+					"which has %d components. Specify a scalar Variable instead.\n",
+					__func__, self->name, self->indexTbl[index], "int",
+					var->name, var->dataTypeCounts[0] );
+				Variable_SetValueInt(
+					var, 
+					self->indexTbl[index], 
+					self->valueTbl[val_I].as.typeInt );
+				break;
+			
+			case VC_ValueType_Short:
+				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
+					"Error - in %s: while applying values for variable condition "
+					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
+					"which has %d components. Specify a scalar Variable instead.\n",
+					__func__, self->name, self->indexTbl[index], "short",
+					var->name, var->dataTypeCounts[0] );
+				Variable_SetValueShort(
+					var, 
+					self->indexTbl[index], 
+					self->valueTbl[val_I].as.typeShort );
+				break;
+			
+			case VC_ValueType_Char:
+				Journal_Firewall( var->dataTypeCounts[0] == 1, errorStr,
+					"Error - in %s: while applying values for variable condition "
+					"\"%s\", to index %d - asked to apply a scalar %s to Variable \"%s\" "
+					"which has %d components. Specify a scalar Variable instead.\n",
+					__func__, self->name, self->indexTbl[index], "char",
+					var->name, var->dataTypeCounts[0] );
+				Variable_SetValueChar(
+					var, 
+					self->indexTbl[index], 
+					self->valueTbl[val_I].as.typeChar );
+				break;
+			
+			case VC_ValueType_Ptr:
+				Variable_SetValuePointer(
+					var, 
+					self->indexTbl[index], 
+					self->valueTbl[val_I].as.typePtr );
+				break;
+			
+			default:
+				assert(0);
+				break;
+		}
+	}
+}
+
+
+void VariableCondition_ApplyToIndexVariable(
+		void*				variableCondition, 
+		Index				localIndex, 
+		VariableCondition_VariableIndex	varIndex,
+		void*				context )
+{
+	VariableCondition*	self = (VariableCondition*)variableCondition;
+	Variable_Index		globalVarIndex;
+	Variable*		var;
+	ConditionFunction*	cf;
+	Index			index;
+	
+/*
+ * NOTE: This algorithm here is RIDICULOUSLY slow. I've added a mapping
+ *       to the class, that should help.
+
+	for (index = 0; index < self->indexCount; index++)
+		if (self->indexTbl[index] == localIndex)
+			break;
+*/
+
+	if(!UIntMap_Map( self->mapping, localIndex, &index ))
+	    return;
+	
+	globalVarIndex = self->vcTbl[index][varIndex].varIndex;
+	var = self->variable_Register->_variable[globalVarIndex];
+		
+	switch (self->valueTbl[self->vcTbl[index][varIndex].valIndex].type)
+	{
+		case VC_ValueType_Double:
+			Variable_SetValueDouble(
+				var, 
+				self->indexTbl[index], 
+				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeDouble );
+			break;
+		
+		case VC_ValueType_CFIndex:
+			cf = self->conFunc_Register->_cf[self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeCFIndex];
+			ConditionFunction_Apply( 
+				cf, 
+				localIndex, 
+				globalVarIndex, 
+				context, 
+				Variable_GetStructPtr( var, self->indexTbl[index]) );
+			break;
+		
+		case VC_ValueType_DoubleArray:
+			Variable_SetValue(
+				var, 
+				self->indexTbl[index], 
+				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeArray.array );
+			break;
+		
+		case VC_ValueType_Int:
+			Variable_SetValueInt(
+				var, 
+				self->indexTbl[index], 
+				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeInt );
+			break;
+		
+		case VC_ValueType_Short:
+			Variable_SetValueShort(
+				var, 
+				self->indexTbl[index], 
+				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeShort );
+			break;
+		
+		case VC_ValueType_Char:
+			Variable_SetValueChar(
+				var, 
+				self->indexTbl[index], 
+				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typeChar );
+			break;
+		
+		case VC_ValueType_Ptr:
+			Variable_SetValuePointer(
+				var, 
+				self->indexTbl[index], 
+				self->valueTbl[self->vcTbl[index][varIndex].valIndex].as.typePtr );
+			break;
+		
+		default:
+			assert(0);
+			break;
+	}
+}
+
+
+Bool VariableCondition_IsCondition( void* variableCondition, Index localIndex, Variable_Index inputVarIndex ) {
+	VariableCondition*		self = (VariableCondition*)variableCondition;
+	VariableCondition_VariableIndex	vcVar_I;
+	Index				i;
+	Variable_Index                  varIndexToTryMatch = 0;
+	Variable_Index                  subVarIndexToTryMatch = 0;
+	Variable*                       variableToTryMatch = NULL;
+	Variable*                       subVariableToTryMatch = NULL;
+	Variable_Index                  subVariable_I = 0;
+
+	/* if the set isn't initialised, this is a NULL BC : False */
+	if ( !self->_set ) {
+		return False;
+	}
+
+	/* first check if the index they've given us is actually in the list this VC applies to */
+	/* quick check, since we have the set available */
+	if ( localIndex >= self->_set->size ) {
+		Stream* warning = Journal_Register( ErrorStream_Type, self->type );
+		Journal_Printf( warning, "Error- In %s: Tried to check an index %d larger than the size of "
+			"the set (%d).\n", __func__, localIndex, self->_set->size );
+		assert(0);	
+		return False;
+	}
+
+	if(!UIntMap_Map( self->mapping, localIndex, &i ))
+	    return False;
+/*
+	if ( !IndexSet_IsMember( self->_set, localIndex ) ) {
+		return False;
+	}
+	for (i = 0; i < self->indexCount; i++)
+		if (self->indexTbl[i] == localIndex)
+			break;
+			
+	if (i == self->indexCount)
+		return False;
+*/
+	
+	/* now check if the Variable they've given us is actually in the list to apply at the given index */
+	for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++) {
+		varIndexToTryMatch = self->vcTbl[i][vcVar_I].varIndex;
+		variableToTryMatch = self->variable_Register->_variable[varIndexToTryMatch];
+
+		if ( varIndexToTryMatch == inputVarIndex) {
+			return True;
+		}
+		else if ( variableToTryMatch->subVariablesCount >= 1 ) {
+			/* 2nd chance draw is that if this Var has sub-components, we should test if the input argument is
+			 * actually one of those - in which case we should consider it has a condition applied to it. */
+			
+			for ( subVariable_I = 0; subVariable_I < variableToTryMatch->subVariablesCount; subVariable_I++ ) {
+			  /* TODO: next few lines bit slow! Maybe need to cache subvar indices on variable */
+				subVariableToTryMatch = variableToTryMatch->components[subVariable_I];
+				if ( subVariableToTryMatch == NULL ) continue;
+				
+				subVarIndexToTryMatch = Variable_Register_GetIndex( self->variable_Register,
+					subVariableToTryMatch->name );
+
+				if ( subVarIndexToTryMatch == inputVarIndex) {
+					return True;
+				}
+			}
+		}
+	}
+	
+	return False;
+}
+
+
+VariableCondition_ValueIndex VariableCondition_GetValueIndex (void* variableCondition, Index localIndex, Variable_Index varIndex )
+{
+	VariableCondition*		self = (VariableCondition*)variableCondition;
+	VariableCondition_VariableIndex	vcVar_I;
+	Index				i;
+	
+	/* if the set isn't initialised, this is a NULL BC : False */
+	if ( !self->_set ) {
+		return False;
+	}
+
+	/* first check if the index they've given us is actually in the list this VC applies to */
+	/* quick check, since we have the set available */
+	if ( localIndex >= self->_set->size ) {
+		Stream* warning = Journal_Register( ErrorStream_Type, self->type );
+		Journal_Printf( warning, "Error- In %s: Tried to check an index %d larger than the size of "
+			"the set (%d).\n", __func__, localIndex, self->_set->size );
+		assert(0);	
+		return False;
+	}
+	if ( !IndexSet_IsMember( self->_set, localIndex ) ) {
+		return (VariableCondition_ValueIndex)-1;
+	}
+	for (i = 0; i < self->indexCount; i++)
+		if (self->indexTbl[i] == localIndex)
+			break;
+			
+	if (i == self->indexCount)
+		return (VariableCondition_ValueIndex)-1;
+	
+	/* now check if the Variable they've given us is actually in the list to apply at the given index */
+	for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++)
+		if (self->vcTbl[i][vcVar_I].varIndex == varIndex)
+			return self->vcTbl[i][vcVar_I].valIndex;
+	
+	return (VariableCondition_ValueIndex)-1;
+}
+
+
+void VariableCondition_PrintConcise( void* variableCondition, Stream* stream ) {
+	VariableCondition*		self = (VariableCondition*)variableCondition;
+	
+	self->_printConcise( self, stream );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableCondition_Register.c
--- a/Base/Context/src/VariableCondition_Register.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: VariableCondition_Register.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "VariableCondition_Register.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type VariableCondition_Register_Type = "VariableCondition_Register";
-
-
-/* Global, default instantiation of the register... will be loaded with in built types (built in Init.c) */
-VariableCondition_Register* variableCondition_Register = 0;
-
-
-VariableCondition_Register* VariableCondition_Register_New(void) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(VariableCondition_Register);
-	Type                              type = VariableCondition_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _VariableCondition_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _VariableCondition_Register_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return _VariableCondition_Register_New(  VARIABLECONDITION_REGISTER_PASSARGS  );
-}
-
-void VariableCondition_Register_Init( void* variableCondition_Register ) {
-	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
-	
-	/* General info */
-	self->type = VariableCondition_Register_Type;
-	self->_sizeOfSelf = sizeof(VariableCondition_Register);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _VariableCondition_Register_Delete;
-	self->_print = _VariableCondition_Register_Print;
-	self->_copy = NULL;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* VariableCondition_Register info */
-	_VariableCondition_Register_Init( self );
-}
-
-VariableCondition_Register* _VariableCondition_Register_New(  VARIABLECONDITION_REGISTER_DEFARGS  )
-{
-	VariableCondition_Register* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(VariableCondition_Register) );
-	self = (VariableCondition_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	_VariableCondition_Register_Init( self );
-	
-	return self;
-}
-
-void _VariableCondition_Register_Init( void* variableCondition_Register ) {
-	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
-	
-	/* General and Virtual info should already be set */
-	
-	/* VariableCondition_Register info */
-	self->count = 0;
-	self->_size = 8;
-	self->_delta = 8;
-	self->entry = Memory_Alloc_Array( VariableCondition_Register_Entry, self->_size, "VC_Register->entry" );
-	memset( self->entry, 0, sizeof(VariableCondition_Register_Entry) * self->_size );
-}
-
-void _VariableCondition_Register_Delete( void* variableCondition_Register ) {
-	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
-	
-	/* Assumes ownerships of the element types */
-	if( self->entry ) {
-		Memory_Free( self->entry );
-	}
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-void _VariableCondition_Register_Print( void* variableCondition_Register, Stream* stream ) {
-	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
-	#ifdef DEBUG
-		VariableCondition_Index variableCondition_I;
-	#endif
-	
-	/* Set the Journal for printing informations */
-	Stream* variableCondition_RegisterStream = stream;
-	
-	/* General info */
-	Journal_Printf( variableCondition_RegisterStream, "VariableCondition_Register (ptr): %p\n", self );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, variableCondition_RegisterStream );
-	
-	/* Virtual info */
-	
-	/* VariableCondition_Register info */
-	Journal_Printf( variableCondition_RegisterStream, "\tcount: %u\n", self->count );
-	Journal_Printf( variableCondition_RegisterStream, "\t_size: %lu\n", self->_size );
-	Journal_Printf( variableCondition_RegisterStream, "\t_delta: %lu\n", self->_delta );
-	
-	Journal_Printf( variableCondition_RegisterStream, "\tvariableCondition (ptr): %p\n", self->entry );
-	Journal_Printf( variableCondition_RegisterStream, "\tvariableCondition[0-%u]:\n", self->count );
-	#ifdef DEBUG
-		for( variableCondition_I = 0; variableCondition_I < self->count; variableCondition_I++ ) {
-			Journal_Printf( variableCondition_RegisterStream, "\tentry[%u]:\n", variableCondition_I );
-			Journal_Printf( variableCondition_RegisterStream, "\t\ttype: %s\n", self->entry[variableCondition_I].type );
-			Journal_Printf( variableCondition_RegisterStream, "\t\tfactory (func ptr): %p\n", self->entry[variableCondition_I].factory );
-		}
-	#else
-		Journal_Printf( variableCondition_RegisterStream, "...\n" );
-	#endif
-	Journal_Printf( variableCondition_RegisterStream, "\t]\n" );
-}
-
-VariableCondition_Index VariableCondition_Register_Add(
-		void*					variableCondition_Register, 
-		Type					type, 
-		VariableCondition_Register_FactoryFunc*	factory )
-{
-	VariableCondition_Register*	self = (VariableCondition_Register*)variableCondition_Register;
-	VariableCondition_Index	handle;
-	
-	if( self->count >= self->_size ) {
-		SizeT currentSize = self->_size;
-
-		self->_size += self->_delta;
-		self->entry = Memory_Realloc_Array( self->entry, VariableCondition_Register_Entry, self->_size );
-		memset( (Pointer)((ArithPointer)self->entry + (currentSize * sizeof(VariableCondition_Register_Entry)) ),
-			0, sizeof(VariableCondition_Register_Entry) * (self->_size - currentSize) );
-	}
-	
-	handle = self->count;
-	self->entry[handle].type = type;
-	self->entry[handle].factory = factory;
-	self->count++;
-	
-	return handle;
-}
-
-VariableCondition_Index VariableCondition_Register_GetIndex( void* variableCondition_Register, Type type ) {
-	VariableCondition_Register*	self = (VariableCondition_Register*)variableCondition_Register;
-	VariableCondition_Index variableCondition_I;
-	
-	for( variableCondition_I = 0; variableCondition_I < self->count; variableCondition_I++ ) {
-		if( self->entry[variableCondition_I].type == type ) {
-			return variableCondition_I;
-		}
-	}
-	/* type is likely to be given from input file in this case... treat comparison checks like for Name... do strcmp too */
-	for( variableCondition_I = 0; variableCondition_I < self->count; variableCondition_I++ ) {
-		if( strcmp( self->entry[variableCondition_I].type, type ) == 0 ) {
-			return variableCondition_I;
-		}
-	}
-	return (unsigned)-1;
-}
-
-VariableCondition_Register_Entry* _VariableCondition_Register_At( 
-		void*					variableCondition_Register, 
-		VariableCondition_Index			handle ) 
-{
-	VariableCondition_Register*	self = (VariableCondition_Register*)variableCondition_Register;
-	
-	return VariableCondition_Register_At( self, handle );
-}
-
-VariableCondition* VariableCondition_Register_CreateNew(
-	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,
-		data );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableCondition_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/VariableCondition_Register.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,231 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: VariableCondition_Register.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "VariableCondition_Register.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type VariableCondition_Register_Type = "VariableCondition_Register";
+
+
+/* Global, default instantiation of the register... will be loaded with in built types (built in Init.c) */
+VariableCondition_Register* variableCondition_Register = 0;
+
+
+VariableCondition_Register* VariableCondition_Register_New(void) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(VariableCondition_Register);
+	Type                              type = VariableCondition_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _VariableCondition_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _VariableCondition_Register_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return _VariableCondition_Register_New(  VARIABLECONDITION_REGISTER_PASSARGS  );
+}
+
+void VariableCondition_Register_Init( void* variableCondition_Register ) {
+	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
+	
+	/* General info */
+	self->type = VariableCondition_Register_Type;
+	self->_sizeOfSelf = sizeof(VariableCondition_Register);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _VariableCondition_Register_Delete;
+	self->_print = _VariableCondition_Register_Print;
+	self->_copy = NULL;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* VariableCondition_Register info */
+	_VariableCondition_Register_Init( self );
+}
+
+VariableCondition_Register* _VariableCondition_Register_New(  VARIABLECONDITION_REGISTER_DEFARGS  )
+{
+	VariableCondition_Register* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(VariableCondition_Register) );
+	self = (VariableCondition_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	_VariableCondition_Register_Init( self );
+	
+	return self;
+}
+
+void _VariableCondition_Register_Init( void* variableCondition_Register ) {
+	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
+	
+	/* General and Virtual info should already be set */
+	
+	/* VariableCondition_Register info */
+	self->count = 0;
+	self->_size = 8;
+	self->_delta = 8;
+	self->entry = Memory_Alloc_Array( VariableCondition_Register_Entry, self->_size, "VC_Register->entry" );
+	memset( self->entry, 0, sizeof(VariableCondition_Register_Entry) * self->_size );
+}
+
+void _VariableCondition_Register_Delete( void* variableCondition_Register ) {
+	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
+	
+	/* Assumes ownerships of the element types */
+	if( self->entry ) {
+		Memory_Free( self->entry );
+	}
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+void _VariableCondition_Register_Print( void* variableCondition_Register, Stream* stream ) {
+	VariableCondition_Register* self = (VariableCondition_Register*)variableCondition_Register;
+	#ifdef DEBUG
+		VariableCondition_Index variableCondition_I;
+	#endif
+	
+	/* Set the Journal for printing informations */
+	Stream* variableCondition_RegisterStream = stream;
+	
+	/* General info */
+	Journal_Printf( variableCondition_RegisterStream, "VariableCondition_Register (ptr): %p\n", self );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, variableCondition_RegisterStream );
+	
+	/* Virtual info */
+	
+	/* VariableCondition_Register info */
+	Journal_Printf( variableCondition_RegisterStream, "\tcount: %u\n", self->count );
+	Journal_Printf( variableCondition_RegisterStream, "\t_size: %lu\n", self->_size );
+	Journal_Printf( variableCondition_RegisterStream, "\t_delta: %lu\n", self->_delta );
+	
+	Journal_Printf( variableCondition_RegisterStream, "\tvariableCondition (ptr): %p\n", self->entry );
+	Journal_Printf( variableCondition_RegisterStream, "\tvariableCondition[0-%u]:\n", self->count );
+	#ifdef DEBUG
+		for( variableCondition_I = 0; variableCondition_I < self->count; variableCondition_I++ ) {
+			Journal_Printf( variableCondition_RegisterStream, "\tentry[%u]:\n", variableCondition_I );
+			Journal_Printf( variableCondition_RegisterStream, "\t\ttype: %s\n", self->entry[variableCondition_I].type );
+			Journal_Printf( variableCondition_RegisterStream, "\t\tfactory (func ptr): %p\n", self->entry[variableCondition_I].factory );
+		}
+	#else
+		Journal_Printf( variableCondition_RegisterStream, "...\n" );
+	#endif
+	Journal_Printf( variableCondition_RegisterStream, "\t]\n" );
+}
+
+VariableCondition_Index VariableCondition_Register_Add(
+		void*					variableCondition_Register, 
+		Type					type, 
+		VariableCondition_Register_FactoryFunc*	factory )
+{
+	VariableCondition_Register*	self = (VariableCondition_Register*)variableCondition_Register;
+	VariableCondition_Index	handle;
+	
+	if( self->count >= self->_size ) {
+		SizeT currentSize = self->_size;
+
+		self->_size += self->_delta;
+		self->entry = Memory_Realloc_Array( self->entry, VariableCondition_Register_Entry, self->_size );
+		memset( (Pointer)((ArithPointer)self->entry + (currentSize * sizeof(VariableCondition_Register_Entry)) ),
+			0, sizeof(VariableCondition_Register_Entry) * (self->_size - currentSize) );
+	}
+	
+	handle = self->count;
+	self->entry[handle].type = type;
+	self->entry[handle].factory = factory;
+	self->count++;
+	
+	return handle;
+}
+
+VariableCondition_Index VariableCondition_Register_GetIndex( void* variableCondition_Register, Type type ) {
+	VariableCondition_Register*	self = (VariableCondition_Register*)variableCondition_Register;
+	VariableCondition_Index variableCondition_I;
+	
+	for( variableCondition_I = 0; variableCondition_I < self->count; variableCondition_I++ ) {
+		if( self->entry[variableCondition_I].type == type ) {
+			return variableCondition_I;
+		}
+	}
+	/* type is likely to be given from input file in this case... treat comparison checks like for Name... do strcmp too */
+	for( variableCondition_I = 0; variableCondition_I < self->count; variableCondition_I++ ) {
+		if( strcmp( self->entry[variableCondition_I].type, type ) == 0 ) {
+			return variableCondition_I;
+		}
+	}
+	return (unsigned)-1;
+}
+
+VariableCondition_Register_Entry* _VariableCondition_Register_At( 
+		void*					variableCondition_Register, 
+		VariableCondition_Index			handle ) 
+{
+	VariableCondition_Register*	self = (VariableCondition_Register*)variableCondition_Register;
+	
+	return VariableCondition_Register_At( self, handle );
+}
+
+VariableCondition* VariableCondition_Register_CreateNew(
+	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,
+		data );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableDumpStream.c
--- a/Base/Context/src/VariableDumpStream.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: VariableDumpStream.c 789 2004-02-10 17:15:11Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-                                                                                                                                    
-#include "types.h"
-#include "Variable.h"
-#include "VariableDumpStream.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-const Type VariableDumpStream_Type = "VariableDumpStream";
-
-
-Stream* VariableDumpStream_New( Name name )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(VariableDumpStream);
-	Type                              type = VariableDumpStream_Type;
-	Stg_Class_DeleteFunction*      _delete = _VariableDumpStream_Delete;
-	Stg_Class_PrintFunction*        _print = _VariableDumpStream_Print;
-	Stg_Class_CopyFunction*          _copy = _VariableDumpStream_Copy;
-	Stream_PrintfFunction*         _printf = _CStream_Printf;
-	Stream_WriteFunction*           _write = _CStream_Write;
-	Stream_DumpFunction*             _dump = _VariableDumpStream_Dump;
-	Stream_SetFileFunction*       _setFile = _CStream_SetFile;
-
-	return (Stream*)_VariableDumpStream_New(  VARIABLEDUMPSTREAM_PASSARGS  );
-}
-
-void VariableDumpStream_Init( VariableDumpStream* self, Name name )
-{
-	
-}
-
-
-VariableDumpStream* _VariableDumpStream_New(  VARIABLEDUMPSTREAM_DEFARGS  )
-{
-	VariableDumpStream* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(VariableDumpStream) );
-	self = (VariableDumpStream*)_CStream_New(  CSTREAM_PASSARGS  );
-	
-	_VariableDumpStream_Init( self );
-	
-	return self;
-}
-
-void _VariableDumpStream_Init( VariableDumpStream* self )
-{
-	self->data = NULL;
-	self->numItems = 0;
-}
-	
-void _VariableDumpStream_Delete( void* cStream )
-{
-	VariableDumpStream* self = (VariableDumpStream*)cStream;
-	
-	/* Stg_Class_Delete parent */
-	_Stream_Delete( self );
-}
-
-void _VariableDumpStream_Print( void* cStream, Stream* stream ) {
-
-	VariableDumpStream* self = (VariableDumpStream*)cStream;
-	
-	/* Print parent */
-	_Stream_Print( self, stream );
-	
-	/* General info */
-	Journal_Printf( stream,  "VariableDumpStream (ptr): %p\n", cStream);
-	
-	Journal_Printf( stream, "data (ptr): %p\n", self->data );
-	Journal_Printf( stream, "numItems: %d\n", self->numItems );
-}
-
-void* _VariableDumpStream_Copy( const void* variableDumpStream, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	VariableDumpStream*	self = (VariableDumpStream*)variableDumpStream;
-	VariableDumpStream*	newVariableDumpStream;
-	
-	newVariableDumpStream = (VariableDumpStream*)_Stream_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	/* HACK */
-	/* TODO: this should actually copy the data, i think... */
-	newVariableDumpStream->data = NULL;
-	newVariableDumpStream->numItems = 0;
-	/* END HACK */
-	newVariableDumpStream->dumpEvery = self->dumpEvery;
-	
-	return newVariableDumpStream;
-}
-
-Bool _VariableDumpStream_Dump( Stream* stream, const void* _loop )
-{
-	VariableDumpStream* self = (VariableDumpStream*)stream;
-	Index varI, typeI;
-	int* loop = (int*)_loop;
-	float tmp;
-	
-	
-	if ( self->data == NULL || self->numItems == 0 )
-	{
-		return True;
-	}
-	if ( loop != NULL )
-	{
-		if( !((*loop) == 0 || (((*loop) - 1) % self->dumpEvery == 0)) )
-			return True;
-	}
-
-	/* testing if the others compile....
-	char tmp1 = Variable_GetValueAsChar( self->data, varI );
-	short tmp2 = Variable_GetValueAsShort( self->data, varI );
-	int tmp3 = Variable_GetValueAsInt( self->data, varI );
-	double tmp4 = Variable_GetValueAsDouble( self->data, varI );
-	void* tmp5 = Variable_GetValueAsPointer( self->data, varI );*/
-	for ( varI = 0; varI < self->data->arraySize; ++varI ) {
-		if ( *self->data->dataTypeCounts > 1 ) {
-			for ( typeI = 0; typeI < *self->data->dataTypeCounts; ++typeI ) {
-				tmp = Variable_GetValueAtDoubleAsFloat( self->data, varI, typeI );
-				self->_write(
-					stream,
-					&tmp,
-					sizeof(float), 1 );
-			}
-		}
-		else {
-			tmp = Variable_GetValueDoubleAsFloat( self->data, varI );
-			self->_write(
-				stream,
-				&tmp,
-				sizeof(float), 1 );
-		}
-	}
-
-
-	return True;
-}
-
-void VariableDumpStream_SetVariable( void* stream, Variable* data, int numItems, unsigned int dumpEvery, Name fileName )
-{
-	VariableDumpStream* self = (VariableDumpStream*)stream;
-	JournalFile* file;
-	
-	self->data = data;
-	self->numItems = numItems;
-	self->dumpEvery = dumpEvery;
-	
-	file = Journal_GetFile( fileName );
-	if ( file == NULL )
-	{
-		file = CFile_New2( fileName );
-		Journal_RegisterFile( file );
-	}
-	Stream_SetFile( (Stream*)stream, file );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/VariableDumpStream.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/VariableDumpStream.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,193 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: VariableDumpStream.c 789 2004-02-10 17:15:11Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+                                                                                                                                    
+#include "types.h"
+#include "Variable.h"
+#include "VariableDumpStream.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+const Type VariableDumpStream_Type = "VariableDumpStream";
+
+
+Stream* VariableDumpStream_New( Name name )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(VariableDumpStream);
+	Type                              type = VariableDumpStream_Type;
+	Stg_Class_DeleteFunction*      _delete = _VariableDumpStream_Delete;
+	Stg_Class_PrintFunction*        _print = _VariableDumpStream_Print;
+	Stg_Class_CopyFunction*          _copy = _VariableDumpStream_Copy;
+	Stream_PrintfFunction*         _printf = _CStream_Printf;
+	Stream_WriteFunction*           _write = _CStream_Write;
+	Stream_DumpFunction*             _dump = _VariableDumpStream_Dump;
+	Stream_SetFileFunction*       _setFile = _CStream_SetFile;
+
+	return (Stream*)_VariableDumpStream_New(  VARIABLEDUMPSTREAM_PASSARGS  );
+}
+
+void VariableDumpStream_Init( VariableDumpStream* self, Name name )
+{
+	
+}
+
+
+VariableDumpStream* _VariableDumpStream_New(  VARIABLEDUMPSTREAM_DEFARGS  )
+{
+	VariableDumpStream* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(VariableDumpStream) );
+	self = (VariableDumpStream*)_CStream_New(  CSTREAM_PASSARGS  );
+	
+	_VariableDumpStream_Init( self );
+	
+	return self;
+}
+
+void _VariableDumpStream_Init( VariableDumpStream* self )
+{
+	self->data = NULL;
+	self->numItems = 0;
+}
+	
+void _VariableDumpStream_Delete( void* cStream )
+{
+	VariableDumpStream* self = (VariableDumpStream*)cStream;
+	
+	/* Stg_Class_Delete parent */
+	_Stream_Delete( self );
+}
+
+void _VariableDumpStream_Print( void* cStream, Stream* stream ) {
+
+	VariableDumpStream* self = (VariableDumpStream*)cStream;
+	
+	/* Print parent */
+	_Stream_Print( self, stream );
+	
+	/* General info */
+	Journal_Printf( stream,  "VariableDumpStream (ptr): %p\n", cStream);
+	
+	Journal_Printf( stream, "data (ptr): %p\n", self->data );
+	Journal_Printf( stream, "numItems: %d\n", self->numItems );
+}
+
+void* _VariableDumpStream_Copy( const void* variableDumpStream, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	VariableDumpStream*	self = (VariableDumpStream*)variableDumpStream;
+	VariableDumpStream*	newVariableDumpStream;
+	
+	newVariableDumpStream = (VariableDumpStream*)_Stream_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	/* HACK */
+	/* TODO: this should actually copy the data, i think... */
+	newVariableDumpStream->data = NULL;
+	newVariableDumpStream->numItems = 0;
+	/* END HACK */
+	newVariableDumpStream->dumpEvery = self->dumpEvery;
+	
+	return newVariableDumpStream;
+}
+
+Bool _VariableDumpStream_Dump( Stream* stream, const void* _loop )
+{
+	VariableDumpStream* self = (VariableDumpStream*)stream;
+	Index varI, typeI;
+	int* loop = (int*)_loop;
+	float tmp;
+	
+	
+	if ( self->data == NULL || self->numItems == 0 )
+	{
+		return True;
+	}
+	if ( loop != NULL )
+	{
+		if( !((*loop) == 0 || (((*loop) - 1) % self->dumpEvery == 0)) )
+			return True;
+	}
+
+	/* testing if the others compile....
+	char tmp1 = Variable_GetValueAsChar( self->data, varI );
+	short tmp2 = Variable_GetValueAsShort( self->data, varI );
+	int tmp3 = Variable_GetValueAsInt( self->data, varI );
+	double tmp4 = Variable_GetValueAsDouble( self->data, varI );
+	void* tmp5 = Variable_GetValueAsPointer( self->data, varI );*/
+	for ( varI = 0; varI < self->data->arraySize; ++varI ) {
+		if ( *self->data->dataTypeCounts > 1 ) {
+			for ( typeI = 0; typeI < *self->data->dataTypeCounts; ++typeI ) {
+				tmp = Variable_GetValueAtDoubleAsFloat( self->data, varI, typeI );
+				self->_write(
+					stream,
+					&tmp,
+					sizeof(float), 1 );
+			}
+		}
+		else {
+			tmp = Variable_GetValueDoubleAsFloat( self->data, varI );
+			self->_write(
+				stream,
+				&tmp,
+				sizeof(float), 1 );
+		}
+	}
+
+
+	return True;
+}
+
+void VariableDumpStream_SetVariable( void* stream, Variable* data, int numItems, unsigned int dumpEvery, Name fileName )
+{
+	VariableDumpStream* self = (VariableDumpStream*)stream;
+	JournalFile* file;
+	
+	self->data = data;
+	self->numItems = numItems;
+	self->dumpEvery = dumpEvery;
+	
+	file = Journal_GetFile( fileName );
+	if ( file == NULL )
+	{
+		file = CFile_New2( fileName );
+		Journal_RegisterFile( file );
+	}
+	Stream_SetFile( (Stream*)stream, file );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Variable_Register.c
--- a/Base/Context/src/Variable_Register.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Variable_Register.c 4137 2007-06-07 05:46:46Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Variable.h"
-#include "Variable_Register.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-const Type Variable_Register_Type = "Variable_Register";
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-Variable_Register* Variable_Register_New(void)
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(Variable_Register);
-	Type                              type = Variable_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _Variable_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _Variable_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _Variable_Register_Copy;
- 
-	return _Variable_Register_New(  VARIABLE_REGISTER_PASSARGS  );
-}
-
-
-void Variable_Register_Init(Variable_Register* self)
-{ 
-	/* General info */
-	self->type = Variable_Register_Type;
-	self->_sizeOfSelf = sizeof(Variable_Register);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _Variable_Register_Delete;
-	self->_print = _Variable_Register_Print;
-	self->_copy = _Variable_Register_Copy;
-	
-	_Stg_Class_Init((Stg_Class*)self);
-	
-	/* Stg_Class info */
-	_Variable_Register_Init(self);
-}
-
-
-Variable_Register* _Variable_Register_New(  VARIABLE_REGISTER_DEFARGS  )
-{
-	Variable_Register*	self;
-	
-	/* Allocate memory */
-	self = (Variable_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	_Variable_Register_Init(self);
-	
-	return self;
-}
-
-
-void _Variable_Register_Init(void* variable_Register)
-{ 
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	
-	self->count = 0;
-	self->_size = 8;
-	self->_delta = 8;
-	self->_variable = Memory_Alloc_Array( Variable*, self->_size, "Variable_Register->_variable" );
-	memset(self->_variable, 0, sizeof(Variable*)*self->_size);
-	self->errorStream = Journal_Register( Error_Type, self->type );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _Variable_Register_Delete(void* variable_Register)
-{
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	
-	if (self->_variable) Memory_Free(self->_variable);
-
-	/* Stg_Class_Delete parent class */
-	_Stg_Class_Delete(self);
-}
-
-void _Variable_Register_Print(void* variable_Register, Stream* stream)
-{
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	
-	/* Set the Journal for printing informations */
-	Stream* variable_RegisterStream = Journal_Register( InfoStream_Type,	"Variable_RegisterStream");
-	
-	/* General info */
-	Journal_Printf( variable_RegisterStream, "Variable_Register (ptr): %p\n", self);
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	Journal_Printf( variable_RegisterStream, "\tcount: %u\n", self->count);
-	Journal_Printf( variable_RegisterStream, "\t_size: %lu\n", self->_size);
-	Journal_Printf( variable_RegisterStream, "\t_delta: %lu\n", self->_delta);
-	Journal_Printf( variable_RegisterStream, "\t_variable (ptr): %p\n", self->_variable);
-	if (self->_variable)
-	{
-		Variable_Index	var_I;
-		
-		for (var_I = 0; var_I < self->count; var_I++)
-			Stg_Class_Print(self->_variable[var_I], stream);
-	}
-	
-	/* Print parent */
-	_Stg_Class_Print(self, variable_RegisterStream);
-}
-
-void* _Variable_Register_Copy( const void* vr, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-
-	Variable_Register* self = (Variable_Register*)vr;
-	Variable_Register* newVariableRegister;
-	Index ii;
-
-	newVariableRegister = (Variable_Register*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-	PtrMap_Append( ptrMap, self, newVariableRegister );
-
-	newVariableRegister->count = self->count;
-	newVariableRegister->_size = self->_size;
-	newVariableRegister->_variable = Memory_Alloc_Array( Variable*, self->_size, "Variable_Register->_variable" );
-	memset(newVariableRegister->_variable, 0, sizeof(Variable*)*self->_size);
-
-	for ( ii = 0; ii < self->count; ++ii ) {
-          if ( (newVariableRegister->_variable[ii] = (Variable*)PtrMap_Find( ptrMap, self->_variable[ii] )) == NULL ) {
-            newVariableRegister->_variable[ii] = (Variable*)Stg_Class_Copy( self->_variable[ii], NULL, deep, nameExt, ptrMap );
-		}
-	}
-
-	return newVariableRegister;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-Variable_Index Variable_Register_Add(void* variable_Register, Variable* variable)
-{
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	Variable_Index		handle;
-	
-	if (self->count >= self->_size)
-	{
-		SizeT currentSize = self->_size;
-
-		self->_size += self->_delta;
-		self->_variable = Memory_Realloc_Array( self->_variable, Variable*, self->_size );
-		memset( (Pointer)((ArithPointer)self->_variable + (currentSize * sizeof(Variable*)) ), 0, 
-			sizeof(Variable*) * (self->_size - currentSize) );
-	}
-	
-	handle = self->count++;
-	self->_variable[handle] = variable;
-
-	return handle;
-}
-
-
-void Variable_Register_BuildAll(void* variable_Register)
-{
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	Variable_Index		var_I;
-	
-	for (var_I = 0; var_I < self->count; var_I++)
-		Stg_Component_Build( self->_variable[var_I], 0, False );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-Variable_Index Variable_Register_GetIndex(void* variable_Register, Name name)
-{
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	Variable_Index		var_I;
-	
-	for (var_I = 0; var_I < self->count; var_I++)
-	{
-		if (self->_variable[var_I]->name && !strcmp(name, self->_variable[var_I]->name))
-			return var_I;
-	}
-	
-	return (Variable_Index)-1;
-}
-
-
-Variable* Variable_Register_GetByName(void* variable_Register, Name name)
-{
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	Variable_Index		varIndex;
-	
-	if( (varIndex = Variable_Register_GetIndex( self, name )) != (Variable_Index)-1 )
-		return self->_variable[varIndex];
-	
-	return NULL;
-}
-
-
-Variable* Variable_Register_GetByIndex(void* variable_Register, Variable_Index varIndex ) {
-	Variable_Register*	self = (Variable_Register*)variable_Register;
-	#if DEBUG
-	Stream*			error = self->errorStream;
-	
-	Journal_DFirewall(  (varIndex < self->count), error,
-		"Error: Given variable index %d not between 0 and variable count %d.\n",
-		varIndex, self->count );
-	#endif
-		
-	return  self->_variable[varIndex];
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/src/Variable_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/src/Variable_Register.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,272 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Variable_Register.c 4137 2007-06-07 05:46:46Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Variable.h"
+#include "Variable_Register.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+const Type Variable_Register_Type = "Variable_Register";
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+Variable_Register* Variable_Register_New(void)
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(Variable_Register);
+	Type                              type = Variable_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _Variable_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _Variable_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _Variable_Register_Copy;
+ 
+	return _Variable_Register_New(  VARIABLE_REGISTER_PASSARGS  );
+}
+
+
+void Variable_Register_Init(Variable_Register* self)
+{ 
+	/* General info */
+	self->type = Variable_Register_Type;
+	self->_sizeOfSelf = sizeof(Variable_Register);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _Variable_Register_Delete;
+	self->_print = _Variable_Register_Print;
+	self->_copy = _Variable_Register_Copy;
+	
+	_Stg_Class_Init((Stg_Class*)self);
+	
+	/* Stg_Class info */
+	_Variable_Register_Init(self);
+}
+
+
+Variable_Register* _Variable_Register_New(  VARIABLE_REGISTER_DEFARGS  )
+{
+	Variable_Register*	self;
+	
+	/* Allocate memory */
+	self = (Variable_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	_Variable_Register_Init(self);
+	
+	return self;
+}
+
+
+void _Variable_Register_Init(void* variable_Register)
+{ 
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	
+	self->count = 0;
+	self->_size = 8;
+	self->_delta = 8;
+	self->_variable = Memory_Alloc_Array( Variable*, self->_size, "Variable_Register->_variable" );
+	memset(self->_variable, 0, sizeof(Variable*)*self->_size);
+	self->errorStream = Journal_Register( Error_Type, self->type );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _Variable_Register_Delete(void* variable_Register)
+{
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	
+	if (self->_variable) Memory_Free(self->_variable);
+
+	/* Stg_Class_Delete parent class */
+	_Stg_Class_Delete(self);
+}
+
+void _Variable_Register_Print(void* variable_Register, Stream* stream)
+{
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	
+	/* Set the Journal for printing informations */
+	Stream* variable_RegisterStream = Journal_Register( InfoStream_Type,	"Variable_RegisterStream");
+	
+	/* General info */
+	Journal_Printf( variable_RegisterStream, "Variable_Register (ptr): %p\n", self);
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	Journal_Printf( variable_RegisterStream, "\tcount: %u\n", self->count);
+	Journal_Printf( variable_RegisterStream, "\t_size: %lu\n", self->_size);
+	Journal_Printf( variable_RegisterStream, "\t_delta: %lu\n", self->_delta);
+	Journal_Printf( variable_RegisterStream, "\t_variable (ptr): %p\n", self->_variable);
+	if (self->_variable)
+	{
+		Variable_Index	var_I;
+		
+		for (var_I = 0; var_I < self->count; var_I++)
+			Stg_Class_Print(self->_variable[var_I], stream);
+	}
+	
+	/* Print parent */
+	_Stg_Class_Print(self, variable_RegisterStream);
+}
+
+void* _Variable_Register_Copy( const void* vr, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+
+	Variable_Register* self = (Variable_Register*)vr;
+	Variable_Register* newVariableRegister;
+	Index ii;
+
+	newVariableRegister = (Variable_Register*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+	PtrMap_Append( ptrMap, self, newVariableRegister );
+
+	newVariableRegister->count = self->count;
+	newVariableRegister->_size = self->_size;
+	newVariableRegister->_variable = Memory_Alloc_Array( Variable*, self->_size, "Variable_Register->_variable" );
+	memset(newVariableRegister->_variable, 0, sizeof(Variable*)*self->_size);
+
+	for ( ii = 0; ii < self->count; ++ii ) {
+          if ( (newVariableRegister->_variable[ii] = (Variable*)PtrMap_Find( ptrMap, self->_variable[ii] )) == NULL ) {
+            newVariableRegister->_variable[ii] = (Variable*)Stg_Class_Copy( self->_variable[ii], NULL, deep, nameExt, ptrMap );
+		}
+	}
+
+	return newVariableRegister;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+Variable_Index Variable_Register_Add(void* variable_Register, Variable* variable)
+{
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	Variable_Index		handle;
+	
+	if (self->count >= self->_size)
+	{
+		SizeT currentSize = self->_size;
+
+		self->_size += self->_delta;
+		self->_variable = Memory_Realloc_Array( self->_variable, Variable*, self->_size );
+		memset( (Pointer)((ArithPointer)self->_variable + (currentSize * sizeof(Variable*)) ), 0, 
+			sizeof(Variable*) * (self->_size - currentSize) );
+	}
+	
+	handle = self->count++;
+	self->_variable[handle] = variable;
+
+	return handle;
+}
+
+
+void Variable_Register_BuildAll(void* variable_Register)
+{
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	Variable_Index		var_I;
+	
+	for (var_I = 0; var_I < self->count; var_I++)
+		Stg_Component_Build( self->_variable[var_I], 0, False );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+Variable_Index Variable_Register_GetIndex(void* variable_Register, Name name)
+{
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	Variable_Index		var_I;
+	
+	for (var_I = 0; var_I < self->count; var_I++)
+	{
+		if (self->_variable[var_I]->name && !strcmp(name, self->_variable[var_I]->name))
+			return var_I;
+	}
+	
+	return (Variable_Index)-1;
+}
+
+
+Variable* Variable_Register_GetByName(void* variable_Register, Name name)
+{
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	Variable_Index		varIndex;
+	
+	if( (varIndex = Variable_Register_GetIndex( self, name )) != (Variable_Index)-1 )
+		return self->_variable[varIndex];
+	
+	return NULL;
+}
+
+
+Variable* Variable_Register_GetByIndex(void* variable_Register, Variable_Index varIndex ) {
+	Variable_Register*	self = (Variable_Register*)variable_Register;
+	#if DEBUG
+	Stream*			error = self->errorStream;
+	
+	Journal_DFirewall(  (varIndex < self->count), error,
+		"Error: Given variable index %d not between 0 and variable count %d.\n",
+		varIndex, self->count );
+	#endif
+		
+	return  self->_variable[varIndex];
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/AbstractContextSuite.c
--- a/Base/Context/tests/AbstractContextSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,351 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "AbstractContextSuite.h"
-
-/* Temporarily needed until EP shortcuts are fixed */
-#define  CURR_MODULE_NAME "AbstractContextSuite"
-
-#define __TestContext \
-	__AbstractContext \
-	unsigned int	buildHookCalled; \
-	unsigned int	icHookCalled; \
-	unsigned int	dtHookCalled; \
-	unsigned int	solveHookCalled; \
-	unsigned int	solve2HookCalled; \
-	unsigned int	syncHookCalled; \
-	unsigned int	outputHookCalled; \
-	unsigned int	dumpHookCalled; \
-	unsigned int	checkpointHookCalled; \
-	double			computedValue; 
-struct TestContext { __TestContext };
-typedef struct TestContext TestContext;
-
-double dt = 2.0f;
-#define MAX_TIME_STEPS 1000
-double GLOBAL_COMP_VALUE[MAX_TIME_STEPS];
-
-void TestSetDt( void* context, double _dt ) {
-   dt = _dt;
-}
-
-typedef struct {
-   TestContext*	ctx;
-   Dictionary*		dict;
-} AbstractContextSuiteData;
-
-TestContext* TestContext_New(
-	Name			name,
-	double		startTime,
-	double		stopTime,
-	MPI_Comm		communicator,
-	Dictionary*	dictionary ) 
-{
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(TestContext);
-	Type                                                      type = "TestContext";
-	Stg_Class_DeleteFunction*                              _delete = _AbstractContext_Delete;
-	Stg_Class_PrintFunction*                                _print = _AbstractContext_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = NULL;
-	Stg_Component_ConstructFunction*                    _construct = NULL;
-	Stg_Component_BuildFunction*                            _build = _AbstractContext_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _AbstractContext_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _AbstractContext_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _AbstractContext_Destroy;
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-	AbstractContext_SetDt*                                  _setDt = TestSetDt;
-
-   TestContext* ctx;
-
-   ctx = (TestContext*)_AbstractContext_New(  ABSTRACTCONTEXT_PASSARGS  );
-
-   ctx->buildHookCalled = 0;  
-   ctx->icHookCalled = 0;
-   ctx->dtHookCalled = 0;
-   ctx->solveHookCalled = 0;
-   ctx->solve2HookCalled = 0;
-   ctx->syncHookCalled = 0;
-   ctx->outputHookCalled = 0;
-   ctx->dumpHookCalled = 0;
-   ctx->checkpointHookCalled = 0;
-   ctx->computedValue = 0;
-   
-   return ctx;
-}
-
-
-void TestBuild( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->buildHookCalled++;
-}
-
-void TestInitialConditions( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->icHookCalled++;
-   /* Since the current convention for loading from checkpoint is that there's no special entry point and 
-    * it should be done by the init() (possibly in data objects themselves), follow that here */   
-   if (self->loadFromCheckPoint) {
-      self->computedValue = GLOBAL_COMP_VALUE[self->restartTimestep];
-   }
-}
-
-double TestDt( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->dtHookCalled++;
-   return dt;
-}
-
-void TestSolve( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->solveHookCalled++;
-   self->computedValue = pow( 1.1, self->timeStep );
-}
-
-void TestSolve2( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->solve2HookCalled++;
-}
-
-void TestSync( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->syncHookCalled++;
-}
-
-void TestOutput( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->outputHookCalled++;
-}
-
-void TestCheckpoint( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->checkpointHookCalled++;
-   GLOBAL_COMP_VALUE[self->timeStep] = self->computedValue;
-}
-
-void TestDump( void* context ) {
-   TestContext* self = (TestContext*)context;
-   self->dumpHookCalled++;
-}
-
-void AbstractContextSuite_Setup( AbstractContextSuiteData* data ) {
-   Stg_ComponentFactory*	cf;
-   MPI_Comm						CommWorld;
-   Index							ii;
-
-   data->dict = Dictionary_New();
-
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"outputPath", Dictionary_Entry_Value_FromString( "output" )  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"checkpointEvery", Dictionary_Entry_Value_FromUnsignedInt( 5 )  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"dumpEvery", Dictionary_Entry_Value_FromUnsignedInt( 2 )  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 10 )  );
-   
-   cf = Stg_ComponentFactory_New( data->dict, NULL );
-
-   for (ii=0; ii < MAX_TIME_STEPS; ii++) {
-      GLOBAL_COMP_VALUE[ii] = 0.0;
-   }
-
-   MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-   /* Build the context */
-   data->ctx = TestContext_New( "context", 0, 0, CommWorld, data->dict );
-
-	_AbstractContext_Init( (AbstractContext*)data->ctx );
-   _AbstractContext_AssignFromXML( data->ctx, cf, NULL );
-
-   Stream_Enable( data->ctx->info, False );
-}
-
-void AbstractContextSuite_Teardown( AbstractContextSuiteData* data ) {
-	_Stg_Component_Delete( data->ctx );
-}
-
-void AbstractContextSuite_TestDefaultEPs( AbstractContextSuiteData* data ) {
-   ContextEntryPoint*      contextEP=NULL;
-
-   /* Assert that default EPs are set up correctly, eg for saving */
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Construct" );
-   pcu_check_true( contextEP->hooks->count == 1 );
-   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_Construct_Hook" );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_ConstructExtensions" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Build" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   //pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "BuildAllLiveComponents" );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Initialise" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   //pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "InitialiseAllLiveComponents" );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Execute" );
-   pcu_check_true( contextEP->hooks->count == 1 );
-   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_Execute_Hook" );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Destroy" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_DestroyExtensions" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Dt" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Step" );
-   pcu_check_true( contextEP->hooks->count == 1 );
-   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_Step" );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Solve" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_UpdateClass" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Sync" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_FrequentOutput" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Dump" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_DumpClass" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Save" );
-   pcu_check_true( contextEP->hooks->count == 2 );
-   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_CreateCheckpointDirectory" );
-   pcu_check_streq( ((Hook*)contextEP->hooks->data[1])->name, "_AbstractContext_SaveTimeInfo" );
-   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_SaveClass" );
-   pcu_check_true( contextEP->hooks->count == 0 );
-}
-
-
-void AbstractContextSuite_TestRunBasic( AbstractContextSuiteData* data ) {
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve ); 
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Sync, TestSync ); 
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dt, TestDt ); 
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dump, TestDump ); 
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Save, TestCheckpoint ); 
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_FrequentOutput, TestOutput ); 
-   ContextEP_Append( data->ctx, AbstractContext_EP_Solve, TestSolve2 );
-
-   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Execute( data->ctx, 0 /* dummy */, False );
-
-   pcu_check_true( data->ctx->buildHookCalled == 1 ); 
-   pcu_check_true( data->ctx->icHookCalled == 1 );
-   pcu_check_true( data->ctx->dtHookCalled == 10 );
-   pcu_check_true( data->ctx->solveHookCalled == 10 );
-   pcu_check_true( data->ctx->solve2HookCalled == 10 );
-   pcu_check_true( data->ctx->syncHookCalled == 10 );
-   pcu_check_true( data->ctx->outputHookCalled == 10 );
-   pcu_check_true( data->ctx->dumpHookCalled == 10/Dictionary_GetUnsignedInt(data->dict, "dumpEvery" ) );
-   pcu_check_true( data->ctx->checkpointHookCalled == 10/Dictionary_GetUnsignedInt(data->dict, "checkpointEvery" ) );
-}
-
-void AbstractContextSuite_TestRunNoDtDefined( AbstractContextSuiteData* data ) {
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve ); 
-
-   ContextEP_Append( data->ctx, AbstractContext_EP_Solve, TestSolve2 );
-
-   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
-
-   stJournal->enable = False;
-   pcu_check_assert( Stg_Component_Execute( data->ctx, 0 /* dummy */, False ) );
-   stJournal->enable = True;
-}
-
-void AbstractContextSuite_TestRestartFromCheckpoint( AbstractContextSuiteData* data ) {
-   Stg_ComponentFactory* cf;
-   MPI_Comm CommWorld;
-
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve ); 
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dt, TestDt ); 
-
-   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Execute( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Destroy( data->ctx, 0 /* dummy */, False );
-
-   data->dict = Dictionary_New();
-
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"outputPath", Dictionary_Entry_Value_FromString( "output" )  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"checkpointEvery", Dictionary_Entry_Value_FromUnsignedInt( 5 )  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"dumpEvery", Dictionary_Entry_Value_FromUnsignedInt( 2 )  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 10 )  );
-
-   /* ReBuild the context */
-   Dictionary_Set( data->dict, (Dictionary_Entry_Key)"maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 20 )  );
-   Dictionary_Set( data->dict, (Dictionary_Entry_Key)"restartTimestep", Dictionary_Entry_Value_FromUnsignedInt( 5 )  );
-   MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-   cf = Stg_ComponentFactory_New( data->dict, NULL );
-
-   data->ctx = TestContext_New( "context", 0, 0, CommWorld, data->dict );
-
-	_AbstractContext_Init( (AbstractContext*)data->ctx );
-   _AbstractContext_AssignFromXML( data->ctx, cf, NULL );
-
-   Stream_Enable( data->ctx->info, False );
-
-   /* add hooks to existing entry points */
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve );
-   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dt, TestDt );
-
-   /* Run the context for the second time */
-   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
-   Stg_Component_Execute( data->ctx, 0 /* dummy */, False );
-
-   /* As a fairly simple test of basic CP infrastructure, we know that the timesteps should equal
-    *  run1_ts + run2_ts, and computed value should equal 1.1 to power (run1_ts + run2_ts) */  
-   pcu_check_true( data->ctx->timeStep == (5 + 20) );
-   pcu_check_true( abs(data->ctx->computedValue - pow( 1.1, (5 + 20) )) < 1e-8 );
-}
-
-void AbstractContextSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, AbstractContextSuiteData );
-   pcu_suite_setFixtures( suite, AbstractContextSuite_Setup, AbstractContextSuite_Teardown );
-   pcu_suite_addTest( suite, AbstractContextSuite_TestDefaultEPs );
-   pcu_suite_addTest( suite, AbstractContextSuite_TestRunBasic );
-   pcu_suite_addTest( suite, AbstractContextSuite_TestRunNoDtDefined );
-   pcu_suite_addTest( suite, AbstractContextSuite_TestRestartFromCheckpoint );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/AbstractContextSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/AbstractContextSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,351 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "AbstractContextSuite.h"
+
+/* Temporarily needed until EP shortcuts are fixed */
+#define  CURR_MODULE_NAME "AbstractContextSuite"
+
+#define __TestContext \
+	__AbstractContext \
+	unsigned int	buildHookCalled; \
+	unsigned int	icHookCalled; \
+	unsigned int	dtHookCalled; \
+	unsigned int	solveHookCalled; \
+	unsigned int	solve2HookCalled; \
+	unsigned int	syncHookCalled; \
+	unsigned int	outputHookCalled; \
+	unsigned int	dumpHookCalled; \
+	unsigned int	checkpointHookCalled; \
+	double			computedValue; 
+struct TestContext { __TestContext };
+typedef struct TestContext TestContext;
+
+double dt = 2.0f;
+#define MAX_TIME_STEPS 1000
+double GLOBAL_COMP_VALUE[MAX_TIME_STEPS];
+
+void TestSetDt( void* context, double _dt ) {
+   dt = _dt;
+}
+
+typedef struct {
+   TestContext*	ctx;
+   Dictionary*		dict;
+} AbstractContextSuiteData;
+
+TestContext* TestContext_New(
+	Name			name,
+	double		startTime,
+	double		stopTime,
+	MPI_Comm		communicator,
+	Dictionary*	dictionary ) 
+{
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(TestContext);
+	Type                                                      type = "TestContext";
+	Stg_Class_DeleteFunction*                              _delete = _AbstractContext_Delete;
+	Stg_Class_PrintFunction*                                _print = _AbstractContext_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = NULL;
+	Stg_Component_ConstructFunction*                    _construct = NULL;
+	Stg_Component_BuildFunction*                            _build = _AbstractContext_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _AbstractContext_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _AbstractContext_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _AbstractContext_Destroy;
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+	AbstractContext_SetDt*                                  _setDt = TestSetDt;
+
+   TestContext* ctx;
+
+   ctx = (TestContext*)_AbstractContext_New(  ABSTRACTCONTEXT_PASSARGS  );
+
+   ctx->buildHookCalled = 0;  
+   ctx->icHookCalled = 0;
+   ctx->dtHookCalled = 0;
+   ctx->solveHookCalled = 0;
+   ctx->solve2HookCalled = 0;
+   ctx->syncHookCalled = 0;
+   ctx->outputHookCalled = 0;
+   ctx->dumpHookCalled = 0;
+   ctx->checkpointHookCalled = 0;
+   ctx->computedValue = 0;
+   
+   return ctx;
+}
+
+
+void TestBuild( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->buildHookCalled++;
+}
+
+void TestInitialConditions( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->icHookCalled++;
+   /* Since the current convention for loading from checkpoint is that there's no special entry point and 
+    * it should be done by the init() (possibly in data objects themselves), follow that here */   
+   if (self->loadFromCheckPoint) {
+      self->computedValue = GLOBAL_COMP_VALUE[self->restartTimestep];
+   }
+}
+
+double TestDt( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->dtHookCalled++;
+   return dt;
+}
+
+void TestSolve( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->solveHookCalled++;
+   self->computedValue = pow( 1.1, self->timeStep );
+}
+
+void TestSolve2( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->solve2HookCalled++;
+}
+
+void TestSync( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->syncHookCalled++;
+}
+
+void TestOutput( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->outputHookCalled++;
+}
+
+void TestCheckpoint( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->checkpointHookCalled++;
+   GLOBAL_COMP_VALUE[self->timeStep] = self->computedValue;
+}
+
+void TestDump( void* context ) {
+   TestContext* self = (TestContext*)context;
+   self->dumpHookCalled++;
+}
+
+void AbstractContextSuite_Setup( AbstractContextSuiteData* data ) {
+   Stg_ComponentFactory*	cf;
+   MPI_Comm						CommWorld;
+   Index							ii;
+
+   data->dict = Dictionary_New();
+
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"outputPath", Dictionary_Entry_Value_FromString( "output" )  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"checkpointEvery", Dictionary_Entry_Value_FromUnsignedInt( 5 )  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"dumpEvery", Dictionary_Entry_Value_FromUnsignedInt( 2 )  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 10 )  );
+   
+   cf = Stg_ComponentFactory_New( data->dict, NULL );
+
+   for (ii=0; ii < MAX_TIME_STEPS; ii++) {
+      GLOBAL_COMP_VALUE[ii] = 0.0;
+   }
+
+   MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+   /* Build the context */
+   data->ctx = TestContext_New( "context", 0, 0, CommWorld, data->dict );
+
+	_AbstractContext_Init( (AbstractContext*)data->ctx );
+   _AbstractContext_AssignFromXML( data->ctx, cf, NULL );
+
+   Stream_Enable( data->ctx->info, False );
+}
+
+void AbstractContextSuite_Teardown( AbstractContextSuiteData* data ) {
+	_Stg_Component_Delete( data->ctx );
+}
+
+void AbstractContextSuite_TestDefaultEPs( AbstractContextSuiteData* data ) {
+   ContextEntryPoint*      contextEP=NULL;
+
+   /* Assert that default EPs are set up correctly, eg for saving */
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Construct" );
+   pcu_check_true( contextEP->hooks->count == 1 );
+   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_Construct_Hook" );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_ConstructExtensions" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Build" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   //pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "BuildAllLiveComponents" );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Initialise" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   //pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "InitialiseAllLiveComponents" );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Execute" );
+   pcu_check_true( contextEP->hooks->count == 1 );
+   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_Execute_Hook" );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Destroy" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_DestroyExtensions" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Dt" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Step" );
+   pcu_check_true( contextEP->hooks->count == 1 );
+   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_Step" );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Solve" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_UpdateClass" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Sync" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_FrequentOutput" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Dump" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_DumpClass" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_Save" );
+   pcu_check_true( contextEP->hooks->count == 2 );
+   pcu_check_streq( ((Hook*)contextEP->hooks->data[0])->name, "_AbstractContext_CreateCheckpointDirectory" );
+   pcu_check_streq( ((Hook*)contextEP->hooks->data[1])->name, "_AbstractContext_SaveTimeInfo" );
+   contextEP = (ContextEntryPoint*)AbstractContext_GetEntryPoint( data->ctx, "Context_SaveClass" );
+   pcu_check_true( contextEP->hooks->count == 0 );
+}
+
+
+void AbstractContextSuite_TestRunBasic( AbstractContextSuiteData* data ) {
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve ); 
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Sync, TestSync ); 
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dt, TestDt ); 
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dump, TestDump ); 
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Save, TestCheckpoint ); 
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_FrequentOutput, TestOutput ); 
+   ContextEP_Append( data->ctx, AbstractContext_EP_Solve, TestSolve2 );
+
+   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Execute( data->ctx, 0 /* dummy */, False );
+
+   pcu_check_true( data->ctx->buildHookCalled == 1 ); 
+   pcu_check_true( data->ctx->icHookCalled == 1 );
+   pcu_check_true( data->ctx->dtHookCalled == 10 );
+   pcu_check_true( data->ctx->solveHookCalled == 10 );
+   pcu_check_true( data->ctx->solve2HookCalled == 10 );
+   pcu_check_true( data->ctx->syncHookCalled == 10 );
+   pcu_check_true( data->ctx->outputHookCalled == 10 );
+   pcu_check_true( data->ctx->dumpHookCalled == 10/Dictionary_GetUnsignedInt(data->dict, "dumpEvery" ) );
+   pcu_check_true( data->ctx->checkpointHookCalled == 10/Dictionary_GetUnsignedInt(data->dict, "checkpointEvery" ) );
+}
+
+void AbstractContextSuite_TestRunNoDtDefined( AbstractContextSuiteData* data ) {
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve ); 
+
+   ContextEP_Append( data->ctx, AbstractContext_EP_Solve, TestSolve2 );
+
+   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
+
+   stJournal->enable = False;
+   pcu_check_assert( Stg_Component_Execute( data->ctx, 0 /* dummy */, False ) );
+   stJournal->enable = True;
+}
+
+void AbstractContextSuite_TestRestartFromCheckpoint( AbstractContextSuiteData* data ) {
+   Stg_ComponentFactory* cf;
+   MPI_Comm CommWorld;
+
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve ); 
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dt, TestDt ); 
+
+   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Execute( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Destroy( data->ctx, 0 /* dummy */, False );
+
+   data->dict = Dictionary_New();
+
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"outputPath", Dictionary_Entry_Value_FromString( "output" )  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"checkpointEvery", Dictionary_Entry_Value_FromUnsignedInt( 5 )  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"dumpEvery", Dictionary_Entry_Value_FromUnsignedInt( 2 )  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)"maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 10 )  );
+
+   /* ReBuild the context */
+   Dictionary_Set( data->dict, (Dictionary_Entry_Key)"maxTimeSteps", Dictionary_Entry_Value_FromUnsignedInt( 20 )  );
+   Dictionary_Set( data->dict, (Dictionary_Entry_Key)"restartTimestep", Dictionary_Entry_Value_FromUnsignedInt( 5 )  );
+   MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+   cf = Stg_ComponentFactory_New( data->dict, NULL );
+
+   data->ctx = TestContext_New( "context", 0, 0, CommWorld, data->dict );
+
+	_AbstractContext_Init( (AbstractContext*)data->ctx );
+   _AbstractContext_AssignFromXML( data->ctx, cf, NULL );
+
+   Stream_Enable( data->ctx->info, False );
+
+   /* add hooks to existing entry points */
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Build, TestBuild );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Initialise, TestInitialConditions );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Solve, TestSolve );
+   ContextEP_ReplaceAll( data->ctx, AbstractContext_EP_Dt, TestDt );
+
+   /* Run the context for the second time */
+   Stg_Component_Build( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Initialise( data->ctx, 0 /* dummy */, False );
+   Stg_Component_Execute( data->ctx, 0 /* dummy */, False );
+
+   /* As a fairly simple test of basic CP infrastructure, we know that the timesteps should equal
+    *  run1_ts + run2_ts, and computed value should equal 1.1 to power (run1_ts + run2_ts) */  
+   pcu_check_true( data->ctx->timeStep == (5 + 20) );
+   pcu_check_true( abs(data->ctx->computedValue - pow( 1.1, (5 + 20) )) < 1e-8 );
+}
+
+void AbstractContextSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, AbstractContextSuiteData );
+   pcu_suite_setFixtures( suite, AbstractContextSuite_Setup, AbstractContextSuite_Teardown );
+   pcu_suite_addTest( suite, AbstractContextSuite_TestDefaultEPs );
+   pcu_suite_addTest( suite, AbstractContextSuite_TestRunBasic );
+   pcu_suite_addTest( suite, AbstractContextSuite_TestRunNoDtDefined );
+   pcu_suite_addTest( suite, AbstractContextSuite_TestRestartFromCheckpoint );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/ConditionFunctionSuite.c
--- a/Base/Context/tests/ConditionFunctionSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "ConditionFunctionSuite.h"
-
-typedef struct {
-} ConditionFunctionSuiteData;
-
-
-#define TEST_CF_RESULT 10
-
-void func(Index index, Variable_Index var_I, void* context, void* result)
-{
-   *((double*)result) = TEST_CF_RESULT;
-}
-
-
-void ConditionFunctionSuite_Setup( ConditionFunctionSuiteData* data ) {
-}
-
-void ConditionFunctionSuite_Teardown( ConditionFunctionSuiteData* data ) {
-}
-   
-
-void ConditionFunctionSuite_TestApply( ConditionFunctionSuiteData* data ) {
-   ConditionFunction*	cf;
-   double               result;
-
-   cf = ConditionFunction_New( func, (Name)"quadratic" );
-
-   ConditionFunction_Apply(cf, 4, 2, NULL, &result);
-   pcu_check_true( TEST_CF_RESULT == result );
-
-   Stg_Class_Delete(cf);
-}
-
-
-void ConditionFunctionSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ConditionFunctionSuiteData );
-   pcu_suite_setFixtures( suite, ConditionFunctionSuite_Setup, ConditionFunctionSuite_Teardown );
-   pcu_suite_addTest( suite, ConditionFunctionSuite_TestApply );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/ConditionFunctionSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/ConditionFunctionSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,82 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "ConditionFunctionSuite.h"
+
+typedef struct {
+} ConditionFunctionSuiteData;
+
+
+#define TEST_CF_RESULT 10
+
+void func(Index index, Variable_Index var_I, void* context, void* result)
+{
+   *((double*)result) = TEST_CF_RESULT;
+}
+
+
+void ConditionFunctionSuite_Setup( ConditionFunctionSuiteData* data ) {
+}
+
+void ConditionFunctionSuite_Teardown( ConditionFunctionSuiteData* data ) {
+}
+   
+
+void ConditionFunctionSuite_TestApply( ConditionFunctionSuiteData* data ) {
+   ConditionFunction*	cf;
+   double               result;
+
+   cf = ConditionFunction_New( func, (Name)"quadratic" );
+
+   ConditionFunction_Apply(cf, 4, 2, NULL, &result);
+   pcu_check_true( TEST_CF_RESULT == result );
+
+   Stg_Class_Delete(cf);
+}
+
+
+void ConditionFunctionSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ConditionFunctionSuiteData );
+   pcu_suite_setFixtures( suite, ConditionFunctionSuite_Setup, ConditionFunctionSuite_Teardown );
+   pcu_suite_addTest( suite, ConditionFunctionSuite_TestApply );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/DictionaryCheckSuite.c
--- a/Base/Context/tests/DictionaryCheckSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "DictionaryCheckSuite.h"
-
-typedef struct {
-   int rank;
-} DictionaryCheckSuiteData;
-
-void DictionaryCheckSuite_Setup( DictionaryCheckSuiteData* data ) {
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-}
-
-void DictionaryCheckSuite_Teardown( DictionaryCheckSuiteData* data ) {
-}
-
-  
-void DictionaryCheckSuite_TestCheckKeys( DictionaryCheckSuiteData* data ) {
-   Dictionary*       dictionary = Dictionary_New();
-   Dictionary*       dictionary2 = Dictionary_New();
-   const Name       testFilename1 = "testDictionaryCheck-1.txt";
-   const Name       testFilename2 = "testDictionaryCheck-2.txt";
-   char              expectedFilename[PCU_PATH_MAX];
-   Name       errMessage = "Component dictionary must have unique names\n";
-   
-   Stream_RedirectFile(Journal_Register( Error_Type, (Name)"DictionaryCheck" ), testFilename1 );
-   Stream_SetPrintingRank(Journal_Register( Error_Type, (Name)"DictionaryCheck" ), 0 );
-   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)"DictionaryCheck")  );
-
-   /* Create a set of Dictionary entries */
-   /* For dictionary */
-   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "hello" )  );
-   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_double", Dictionary_Entry_Value_FromDouble( 45.567 )  );
-   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "goodbye" )  );   
-   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "hello" )  );
-   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string2", Dictionary_Entry_Value_FromString( "hello" )  );
-   
-   CheckDictionaryKeys(dictionary,  errMessage);
-
-   if ( data->rank==0 ) {
-      pcu_filename_expected( testFilename1, expectedFilename );
-      pcu_check_fileEq( testFilename1, expectedFilename );
-      remove( testFilename1 );
-   }
-
-   /* For dictionary2 */
-   Dictionary_Add( dictionary2, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "hello" )  );
-   Dictionary_Add( dictionary2, (Dictionary_Entry_Key)"test_dict_double", Dictionary_Entry_Value_FromDouble( 45.567 )  );
-   Dictionary_Add( dictionary2, (Dictionary_Entry_Key)"test_dict_stuff", Dictionary_Entry_Value_FromString( "hello")  );
-
-   /* Call DictionaryCheck function */
-   Stream_RedirectFile(Journal_Register( Error_Type, (Name)"DictionaryCheck" ), testFilename2 );
-   CheckDictionaryKeys(dictionary2, errMessage);
-
-   /* This file expected to be empty */
-   if ( data->rank==0 ) {
-      pcu_filename_expected( testFilename2, expectedFilename );
-      pcu_check_fileEq( testFilename2, expectedFilename );
-      remove( testFilename2 );
-   }
-   
-   Stg_Class_Delete( dictionary );
-   Stg_Class_Delete( dictionary2 );
-
-   if ( data->rank==0 ) {
-      remove( testFilename1 );
-      remove( testFilename2 );
-   }
-}
-
-
-void DictionaryCheckSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, DictionaryCheckSuiteData );
-   pcu_suite_setFixtures( suite, DictionaryCheckSuite_Setup, DictionaryCheckSuite_Teardown );
-   pcu_suite_addTest( suite, DictionaryCheckSuite_TestCheckKeys );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/DictionaryCheckSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/DictionaryCheckSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,116 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "DictionaryCheckSuite.h"
+
+typedef struct {
+   int rank;
+} DictionaryCheckSuiteData;
+
+void DictionaryCheckSuite_Setup( DictionaryCheckSuiteData* data ) {
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+}
+
+void DictionaryCheckSuite_Teardown( DictionaryCheckSuiteData* data ) {
+}
+
+  
+void DictionaryCheckSuite_TestCheckKeys( DictionaryCheckSuiteData* data ) {
+   Dictionary*       dictionary = Dictionary_New();
+   Dictionary*       dictionary2 = Dictionary_New();
+   const Name       testFilename1 = "testDictionaryCheck-1.txt";
+   const Name       testFilename2 = "testDictionaryCheck-2.txt";
+   char              expectedFilename[PCU_PATH_MAX];
+   Name       errMessage = "Component dictionary must have unique names\n";
+   
+   Stream_RedirectFile(Journal_Register( Error_Type, (Name)"DictionaryCheck" ), testFilename1 );
+   Stream_SetPrintingRank(Journal_Register( Error_Type, (Name)"DictionaryCheck" ), 0 );
+   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)"DictionaryCheck")  );
+
+   /* Create a set of Dictionary entries */
+   /* For dictionary */
+   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "hello" )  );
+   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_double", Dictionary_Entry_Value_FromDouble( 45.567 )  );
+   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "goodbye" )  );   
+   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "hello" )  );
+   Dictionary_Add( dictionary, (Dictionary_Entry_Key)"test_dict_string2", Dictionary_Entry_Value_FromString( "hello" )  );
+   
+   CheckDictionaryKeys(dictionary,  errMessage);
+
+   if ( data->rank==0 ) {
+      pcu_filename_expected( testFilename1, expectedFilename );
+      pcu_check_fileEq( testFilename1, expectedFilename );
+      remove( testFilename1 );
+   }
+
+   /* For dictionary2 */
+   Dictionary_Add( dictionary2, (Dictionary_Entry_Key)"test_dict_string", Dictionary_Entry_Value_FromString( "hello" )  );
+   Dictionary_Add( dictionary2, (Dictionary_Entry_Key)"test_dict_double", Dictionary_Entry_Value_FromDouble( 45.567 )  );
+   Dictionary_Add( dictionary2, (Dictionary_Entry_Key)"test_dict_stuff", Dictionary_Entry_Value_FromString( "hello")  );
+
+   /* Call DictionaryCheck function */
+   Stream_RedirectFile(Journal_Register( Error_Type, (Name)"DictionaryCheck" ), testFilename2 );
+   CheckDictionaryKeys(dictionary2, errMessage);
+
+   /* This file expected to be empty */
+   if ( data->rank==0 ) {
+      pcu_filename_expected( testFilename2, expectedFilename );
+      pcu_check_fileEq( testFilename2, expectedFilename );
+      remove( testFilename2 );
+   }
+   
+   Stg_Class_Delete( dictionary );
+   Stg_Class_Delete( dictionary2 );
+
+   if ( data->rank==0 ) {
+      remove( testFilename1 );
+      remove( testFilename2 );
+   }
+}
+
+
+void DictionaryCheckSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, DictionaryCheckSuiteData );
+   pcu_suite_setFixtures( suite, DictionaryCheckSuite_Setup, DictionaryCheckSuite_Teardown );
+   pcu_suite_addTest( suite, DictionaryCheckSuite_TestCheckKeys );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/LiveComponentRegisterSuite.c
--- a/Base/Context/tests/LiveComponentRegisterSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "LiveComponentRegisterSuite.h"
-
-typedef struct {
-   LiveComponentRegister*  lcRegister;
-} LiveComponentRegisterSuiteData;
-
-
-void LiveComponentRegisterSuite_Setup( LiveComponentRegisterSuiteData* data ) {
-   data->lcRegister = LiveComponentRegister_New( );
-}
-
-void LiveComponentRegisterSuite_Teardown( LiveComponentRegisterSuiteData* data ) {
-   Stg_Class_Delete( data->lcRegister );
-}
-   
-
-void LiveComponentRegisterSuite_TestGet( LiveComponentRegisterSuiteData* data ) {
-   typedef float Triple[3];
-
-   float* array;
-   Triple* structArray;
-
-   Variable* var;
-   Variable* vec;
-   Variable* vecVar[3];
-   Variable* tempVar = NULL;
-   Index length = 10;
-
-   Variable_Register* reg;
-
-   array = Memory_Alloc_Array( float, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   reg = Variable_Register_New();
-
-   var = Variable_NewScalar(
-      "Scalar",
-		NULL,
-      Variable_DataType_Float,
-      &length,
-      NULL,
-      (void**)&array,
-      reg );
-
-   vec = Variable_NewVector(
-      "Three",
-		NULL,
-      Variable_DataType_Float,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      reg,
-      "a",
-      "b",
-      "c" );
-
-   vecVar[0] = Variable_Register_GetByName( reg, "a" );
-   vecVar[1] = Variable_Register_GetByName( reg, "b" );
-   vecVar[2] = Variable_Register_GetByName( reg, "c" );
-
-   Variable_Register_BuildAll( reg );
-
-   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) var );
-   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vec );
-   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vecVar[0] );
-   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vecVar[1] );
-   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vecVar[2] );
-
-   tempVar = (Variable*) LiveComponentRegister_Get( data->lcRegister, (Name)"Scalar" );
-   pcu_check_true( tempVar == var );
-
-   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"Three" );
-   pcu_check_true( tempVar == vec );
-
-   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"a" );
-   pcu_check_true( tempVar == vecVar[0] );
-
-   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"b" );
-   pcu_check_true( tempVar == vecVar[1] );
-
-   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"c" );
-   pcu_check_true( tempVar == vecVar[2] );
-}
-
-
-void LiveComponentRegisterSuite( pcu_suite_t* suite  ) {
-   pcu_suite_setData( suite, LiveComponentRegisterSuiteData );
-   pcu_suite_setFixtures( suite, LiveComponentRegisterSuite_Setup, LiveComponentRegisterSuite_Teardown );
-   pcu_suite_addTest( suite, LiveComponentRegisterSuite_TestGet );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/LiveComponentRegisterSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/LiveComponentRegisterSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,134 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "LiveComponentRegisterSuite.h"
+
+typedef struct {
+   LiveComponentRegister*  lcRegister;
+} LiveComponentRegisterSuiteData;
+
+
+void LiveComponentRegisterSuite_Setup( LiveComponentRegisterSuiteData* data ) {
+   data->lcRegister = LiveComponentRegister_New( );
+}
+
+void LiveComponentRegisterSuite_Teardown( LiveComponentRegisterSuiteData* data ) {
+   Stg_Class_Delete( data->lcRegister );
+}
+   
+
+void LiveComponentRegisterSuite_TestGet( LiveComponentRegisterSuiteData* data ) {
+   typedef float Triple[3];
+
+   float* array;
+   Triple* structArray;
+
+   Variable* var;
+   Variable* vec;
+   Variable* vecVar[3];
+   Variable* tempVar = NULL;
+   Index length = 10;
+
+   Variable_Register* reg;
+
+   array = Memory_Alloc_Array( float, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   reg = Variable_Register_New();
+
+   var = Variable_NewScalar(
+      "Scalar",
+		NULL,
+      Variable_DataType_Float,
+      &length,
+      NULL,
+      (void**)&array,
+      reg );
+
+   vec = Variable_NewVector(
+      "Three",
+		NULL,
+      Variable_DataType_Float,
+      3,
+      &length,
+      NULL,
+      (void**)&structArray,
+      reg,
+      "a",
+      "b",
+      "c" );
+
+   vecVar[0] = Variable_Register_GetByName( reg, "a" );
+   vecVar[1] = Variable_Register_GetByName( reg, "b" );
+   vecVar[2] = Variable_Register_GetByName( reg, "c" );
+
+   Variable_Register_BuildAll( reg );
+
+   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) var );
+   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vec );
+   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vecVar[0] );
+   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vecVar[1] );
+   LiveComponentRegister_Add( data->lcRegister, (Stg_Component*) vecVar[2] );
+
+   tempVar = (Variable*) LiveComponentRegister_Get( data->lcRegister, (Name)"Scalar" );
+   pcu_check_true( tempVar == var );
+
+   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"Three" );
+   pcu_check_true( tempVar == vec );
+
+   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"a" );
+   pcu_check_true( tempVar == vecVar[0] );
+
+   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"b" );
+   pcu_check_true( tempVar == vecVar[1] );
+
+   tempVar = (Variable* ) LiveComponentRegister_Get( data->lcRegister, (Name)"c" );
+   pcu_check_true( tempVar == vecVar[2] );
+}
+
+
+void LiveComponentRegisterSuite( pcu_suite_t* suite  ) {
+   pcu_suite_setData( suite, LiveComponentRegisterSuiteData );
+   pcu_suite_setFixtures( suite, LiveComponentRegisterSuite_Setup, LiveComponentRegisterSuite_Teardown );
+   pcu_suite_addTest( suite, LiveComponentRegisterSuite_TestGet );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/SetVC_Suite.c
--- a/Base/Context/tests/SetVC_Suite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "SetVC_Suite.h"
-
-/* Note that these params below must match up with setVC.xml input file for the test to work */
-#define NUM_VARS 7
-#define X_INDEX 0
-#define Y_INDEX 1
-#define Z_INDEX 2
-#define VX_INDEX 3
-#define VY_INDEX 4
-#define VZ_INDEX 5
-#define TEMP_INDEX 6
-
-#define NUM_NODES 64
-#define LAST_VC_NODE_INDEX 26
-#define TEMP_VAR_ARRAYSIZE 5
-
-#define VX_CONDVALUE 2
-#define VY_CONDVALUE 20.0
-#define VZ_CONDVALUE 1
-#define TEMP_CONDVALUE_BASE 5
-
-
-typedef struct {
-   Variable_Register*            vr;
-   ConditionFunction_Register*   conFunc_Register;
-   Dictionary*                   dict;
-   ConditionFunction*            quadCF;
-   double*                       array[NUM_VARS];
-   Index                         arraySize;
-   char*                         varNames[NUM_VARS];
-   Variable*                     var[NUM_VARS];
-   VariableCondition*            vc;
-} SetVC_SuiteData;
-
-
-void quadratic(Index index, Variable_Index var_I, void* context, void* result)
-{
-	*(double *)result = 20.0;
-}
-
-
-void SetVC_Suite_Setup( SetVC_SuiteData* data ) {
-   Index             ii=0;
-   char              setVC_XMLFilename[PCU_PATH_MAX];
-   XML_IO_Handler*   io_handler = XML_IO_Handler_New();
-
-   data->vr = Variable_Register_New();
-   data->conFunc_Register = ConditionFunction_Register_New();
-   data->dict = Dictionary_New();
-   data->arraySize = NUM_NODES;
-
-   Stg_asprintf( &data->varNames[X_INDEX], "x" );
-   Stg_asprintf( &data->varNames[Y_INDEX], "y" );
-   Stg_asprintf( &data->varNames[Z_INDEX], "z" );
-   Stg_asprintf( &data->varNames[VX_INDEX], "vx" );
-   Stg_asprintf( &data->varNames[VY_INDEX], "vy" );
-   Stg_asprintf( &data->varNames[VZ_INDEX], "vz" );
-   Stg_asprintf( &data->varNames[TEMP_INDEX], "temp" );
-
-   /* Load the definition of the SetVC from XML */
-   pcu_filename_input( "setVC.xml", setVC_XMLFilename );
-   IO_Handler_ReadAllFromFile( io_handler, setVC_XMLFilename, data->dict );
-   
-   /* Create CF stuff */
-   data->quadCF = ConditionFunction_New( quadratic, (Name)"quadratic"  );
-   ConditionFunction_Register_Add( data->conFunc_Register, data->quadCF );
-   
-   /* 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], 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], 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", 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 */
-   for (ii = 0; ii < (TEMP_INDEX); ii++) {
-      memset(data->array[ii], 0, sizeof(double)*NUM_NODES);
-   }
-   memset(data->array[TEMP_INDEX], 0, sizeof(double)*NUM_NODES*TEMP_VAR_ARRAYSIZE);
-
-   Memory_Free( io_handler );
-}
-
-
-void SetVC_Suite_Teardown( SetVC_SuiteData* data ) {
-   Index    ii=0;
-
-   Stg_Class_Delete(data->vr);
-   Stg_Class_Delete(data->conFunc_Register);
-   Stg_Class_Delete(data->dict);
-
-   Stg_Class_Delete(data->quadCF);
-
-   for (ii = 0; ii < NUM_VARS; ii++) {
-      if (data->array[ii]) Memory_Free(data->array[ii]);
-      Stg_Class_Delete( data->var[ii] );
-   }
-
-   Stg_Class_Delete(data->vc);
-}
-
-
-void SetVC_Suite_TestIsCondition( SetVC_SuiteData* data ) {
-   Index      var_I=0, node_I=0;
-
-   /* remember varName[] = {"x", "y", "z", "vx", "vy", "vz", "temp"}*/
-
-   /* X, Y, and Z shouldn't have Conditions applied to them */
-   for( var_I = 0; var_I < VX_INDEX; var_I++ ) {
-      for (node_I = 0; node_I < NUM_NODES; node_I++) {
-         pcu_check_true( False == VariableCondition_IsCondition(data->vc, node_I, var_I) );
-      }
-   }
-   /* VX, VY, VZ, and temp should have Conditions applied to them, at even indices */
-   for( var_I = VX_INDEX; var_I < NUM_VARS; var_I++ ) {
-      for (node_I = 0; node_I < NUM_NODES; node_I++) {
-         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
-            pcu_check_true( True == VariableCondition_IsCondition(data->vc, node_I, var_I) );
-         }
-         else {
-            pcu_check_true( False == VariableCondition_IsCondition(data->vc, node_I, var_I) );
-         }
-      }
-   }
-}
-
-
-void SetVC_Suite_TestGetValueIndex( SetVC_SuiteData* data ) {
-   Index      var_I=0, node_I=0;
-
-   /* remember varName[] = {"x", "y", "z", "vx", "vy", "vz", "temp"}*/
-   /* These results are dependent on the order the conditions are added in the dictionary */
-
-   for( var_I = 0; var_I < VX_INDEX; var_I++ ) {
-      for (node_I = 0; node_I < NUM_NODES; node_I++) {
-         pcu_check_true( (unsigned)-1 == VariableCondition_GetValueIndex(data->vc, node_I, var_I) );
-      }
-   }
-   for( var_I = VX_INDEX; var_I < NUM_VARS; var_I++ ) {
-      for (node_I = 0; node_I < NUM_NODES; node_I++) {
-         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
-            /* Condition indices will start at 0, starting at condition 3 "vx" */
-            pcu_check_true( (var_I-VX_INDEX) == VariableCondition_GetValueIndex(data->vc, node_I, var_I) );
-         }
-         else {
-            pcu_check_true( (unsigned)-1 == VariableCondition_GetValueIndex(data->vc, node_I, var_I) );
-         }
-      }
-   }
-}
-
-
-void SetVC_Suite_TestApply( SetVC_SuiteData* data ) {
-   Index      var_I=0, node_I=0, array_I=0;
-   
-   /* remember varName[] = {"x", "y", "z", "vx", "vy", "vz", "temp"}; */
-
-   VariableCondition_Apply(data->vc, NULL);
-   
-   for( var_I = 0; var_I < VX_INDEX; var_I++ ) {
-      for (node_I = 0; node_I < NUM_NODES; node_I++) {
-         pcu_check_true( 0 == data->array[var_I][node_I] );
-      }
-   }
-   for( var_I = VX_INDEX; var_I < TEMP_INDEX; var_I++ ) {
-      for (node_I = 0; node_I < NUM_NODES; node_I++) {
-         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
-            if (var_I == VX_INDEX) {
-               pcu_check_true( VX_CONDVALUE == data->array[var_I][node_I] );
-            }
-            else if (var_I == VY_INDEX) {
-               pcu_check_true( VY_CONDVALUE == data->array[var_I][node_I] );
-            }
-            else if (var_I == VZ_INDEX) {
-               pcu_check_true( VZ_CONDVALUE == data->array[var_I][node_I] );
-            }
-         }
-         else {
-            pcu_check_true( 0 == data->array[var_I][node_I] );
-         }
-      }
-   }
-   /* Now for the "temp" variable */
-   for (node_I = 0; node_I < NUM_NODES; node_I++) {
-      for( array_I = 0; array_I < TEMP_VAR_ARRAYSIZE; array_I++ ) {
-         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
-            pcu_check_true( (TEMP_CONDVALUE_BASE+array_I) == data->array[TEMP_INDEX][node_I*TEMP_VAR_ARRAYSIZE + array_I] );
-         }
-         else {
-            pcu_check_true( 0 == data->array[TEMP_INDEX][node_I*TEMP_VAR_ARRAYSIZE + array_I] );
-         }
-      }
-   }
-}
-
-
-void SetVC_Suite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, SetVC_SuiteData );
-   pcu_suite_setFixtures( suite, SetVC_Suite_Setup, SetVC_Suite_Teardown );
-   pcu_suite_addTest( suite, SetVC_Suite_TestIsCondition );
-   pcu_suite_addTest( suite, SetVC_Suite_TestGetValueIndex );
-   pcu_suite_addTest( suite, SetVC_Suite_TestApply );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/SetVC_Suite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/SetVC_Suite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,259 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "SetVC_Suite.h"
+
+/* Note that these params below must match up with setVC.xml input file for the test to work */
+#define NUM_VARS 7
+#define X_INDEX 0
+#define Y_INDEX 1
+#define Z_INDEX 2
+#define VX_INDEX 3
+#define VY_INDEX 4
+#define VZ_INDEX 5
+#define TEMP_INDEX 6
+
+#define NUM_NODES 64
+#define LAST_VC_NODE_INDEX 26
+#define TEMP_VAR_ARRAYSIZE 5
+
+#define VX_CONDVALUE 2
+#define VY_CONDVALUE 20.0
+#define VZ_CONDVALUE 1
+#define TEMP_CONDVALUE_BASE 5
+
+
+typedef struct {
+   Variable_Register*            vr;
+   ConditionFunction_Register*   conFunc_Register;
+   Dictionary*                   dict;
+   ConditionFunction*            quadCF;
+   double*                       array[NUM_VARS];
+   Index                         arraySize;
+   char*                         varNames[NUM_VARS];
+   Variable*                     var[NUM_VARS];
+   VariableCondition*            vc;
+} SetVC_SuiteData;
+
+
+void quadratic(Index index, Variable_Index var_I, void* context, void* result)
+{
+	*(double *)result = 20.0;
+}
+
+
+void SetVC_Suite_Setup( SetVC_SuiteData* data ) {
+   Index             ii=0;
+   char              setVC_XMLFilename[PCU_PATH_MAX];
+   XML_IO_Handler*   io_handler = XML_IO_Handler_New();
+
+   data->vr = Variable_Register_New();
+   data->conFunc_Register = ConditionFunction_Register_New();
+   data->dict = Dictionary_New();
+   data->arraySize = NUM_NODES;
+
+   Stg_asprintf( &data->varNames[X_INDEX], "x" );
+   Stg_asprintf( &data->varNames[Y_INDEX], "y" );
+   Stg_asprintf( &data->varNames[Z_INDEX], "z" );
+   Stg_asprintf( &data->varNames[VX_INDEX], "vx" );
+   Stg_asprintf( &data->varNames[VY_INDEX], "vy" );
+   Stg_asprintf( &data->varNames[VZ_INDEX], "vz" );
+   Stg_asprintf( &data->varNames[TEMP_INDEX], "temp" );
+
+   /* Load the definition of the SetVC from XML */
+   pcu_filename_input( "setVC.xml", setVC_XMLFilename );
+   IO_Handler_ReadAllFromFile( io_handler, setVC_XMLFilename, data->dict );
+   
+   /* Create CF stuff */
+   data->quadCF = ConditionFunction_New( quadratic, (Name)"quadratic"  );
+   ConditionFunction_Register_Add( data->conFunc_Register, data->quadCF );
+   
+   /* 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], 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], 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", 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 */
+   for (ii = 0; ii < (TEMP_INDEX); ii++) {
+      memset(data->array[ii], 0, sizeof(double)*NUM_NODES);
+   }
+   memset(data->array[TEMP_INDEX], 0, sizeof(double)*NUM_NODES*TEMP_VAR_ARRAYSIZE);
+
+   Memory_Free( io_handler );
+}
+
+
+void SetVC_Suite_Teardown( SetVC_SuiteData* data ) {
+   Index    ii=0;
+
+   Stg_Class_Delete(data->vr);
+   Stg_Class_Delete(data->conFunc_Register);
+   Stg_Class_Delete(data->dict);
+
+   Stg_Class_Delete(data->quadCF);
+
+   for (ii = 0; ii < NUM_VARS; ii++) {
+      if (data->array[ii]) Memory_Free(data->array[ii]);
+      Stg_Class_Delete( data->var[ii] );
+   }
+
+   Stg_Class_Delete(data->vc);
+}
+
+
+void SetVC_Suite_TestIsCondition( SetVC_SuiteData* data ) {
+   Index      var_I=0, node_I=0;
+
+   /* remember varName[] = {"x", "y", "z", "vx", "vy", "vz", "temp"}*/
+
+   /* X, Y, and Z shouldn't have Conditions applied to them */
+   for( var_I = 0; var_I < VX_INDEX; var_I++ ) {
+      for (node_I = 0; node_I < NUM_NODES; node_I++) {
+         pcu_check_true( False == VariableCondition_IsCondition(data->vc, node_I, var_I) );
+      }
+   }
+   /* VX, VY, VZ, and temp should have Conditions applied to them, at even indices */
+   for( var_I = VX_INDEX; var_I < NUM_VARS; var_I++ ) {
+      for (node_I = 0; node_I < NUM_NODES; node_I++) {
+         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
+            pcu_check_true( True == VariableCondition_IsCondition(data->vc, node_I, var_I) );
+         }
+         else {
+            pcu_check_true( False == VariableCondition_IsCondition(data->vc, node_I, var_I) );
+         }
+      }
+   }
+}
+
+
+void SetVC_Suite_TestGetValueIndex( SetVC_SuiteData* data ) {
+   Index      var_I=0, node_I=0;
+
+   /* remember varName[] = {"x", "y", "z", "vx", "vy", "vz", "temp"}*/
+   /* These results are dependent on the order the conditions are added in the dictionary */
+
+   for( var_I = 0; var_I < VX_INDEX; var_I++ ) {
+      for (node_I = 0; node_I < NUM_NODES; node_I++) {
+         pcu_check_true( (unsigned)-1 == VariableCondition_GetValueIndex(data->vc, node_I, var_I) );
+      }
+   }
+   for( var_I = VX_INDEX; var_I < NUM_VARS; var_I++ ) {
+      for (node_I = 0; node_I < NUM_NODES; node_I++) {
+         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
+            /* Condition indices will start at 0, starting at condition 3 "vx" */
+            pcu_check_true( (var_I-VX_INDEX) == VariableCondition_GetValueIndex(data->vc, node_I, var_I) );
+         }
+         else {
+            pcu_check_true( (unsigned)-1 == VariableCondition_GetValueIndex(data->vc, node_I, var_I) );
+         }
+      }
+   }
+}
+
+
+void SetVC_Suite_TestApply( SetVC_SuiteData* data ) {
+   Index      var_I=0, node_I=0, array_I=0;
+   
+   /* remember varName[] = {"x", "y", "z", "vx", "vy", "vz", "temp"}; */
+
+   VariableCondition_Apply(data->vc, NULL);
+   
+   for( var_I = 0; var_I < VX_INDEX; var_I++ ) {
+      for (node_I = 0; node_I < NUM_NODES; node_I++) {
+         pcu_check_true( 0 == data->array[var_I][node_I] );
+      }
+   }
+   for( var_I = VX_INDEX; var_I < TEMP_INDEX; var_I++ ) {
+      for (node_I = 0; node_I < NUM_NODES; node_I++) {
+         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
+            if (var_I == VX_INDEX) {
+               pcu_check_true( VX_CONDVALUE == data->array[var_I][node_I] );
+            }
+            else if (var_I == VY_INDEX) {
+               pcu_check_true( VY_CONDVALUE == data->array[var_I][node_I] );
+            }
+            else if (var_I == VZ_INDEX) {
+               pcu_check_true( VZ_CONDVALUE == data->array[var_I][node_I] );
+            }
+         }
+         else {
+            pcu_check_true( 0 == data->array[var_I][node_I] );
+         }
+      }
+   }
+   /* Now for the "temp" variable */
+   for (node_I = 0; node_I < NUM_NODES; node_I++) {
+      for( array_I = 0; array_I < TEMP_VAR_ARRAYSIZE; array_I++ ) {
+         if ( (node_I % 2 == 0) && node_I <= LAST_VC_NODE_INDEX ) {
+            pcu_check_true( (TEMP_CONDVALUE_BASE+array_I) == data->array[TEMP_INDEX][node_I*TEMP_VAR_ARRAYSIZE + array_I] );
+         }
+         else {
+            pcu_check_true( 0 == data->array[TEMP_INDEX][node_I*TEMP_VAR_ARRAYSIZE + array_I] );
+         }
+      }
+   }
+}
+
+
+void SetVC_Suite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, SetVC_SuiteData );
+   pcu_suite_setFixtures( suite, SetVC_Suite_Setup, SetVC_Suite_Teardown );
+   pcu_suite_addTest( suite, SetVC_Suite_TestIsCondition );
+   pcu_suite_addTest( suite, SetVC_Suite_TestGetValueIndex );
+   pcu_suite_addTest( suite, SetVC_Suite_TestApply );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/Stg_MetaSuite.c
--- a/Base/Context/tests/Stg_MetaSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "Stg_MetaSuite.h"
-
-
-typedef struct {
-   XML_IO_Handler*         io;
-   Dictionary*             metaDict;
-   LiveComponentRegister*  lcRegister;
-} Stg_MetaSuiteData;
-
-
-void Stg_MetaSuite_Setup( Stg_MetaSuiteData* data ) {
-   data->io = XML_IO_Handler_New();
-   data->metaDict = Dictionary_New();
-   data->lcRegister = LiveComponentRegister_New( );
-}
-
-
-void Stg_MetaSuite_Teardown( Stg_MetaSuiteData* data ) {
-   Stg_Class_Delete( data->io );
-   Stg_Class_Delete( data->metaDict );
-   Stg_Class_Delete( data->lcRegister );
-}
-
-
-/* Use this function if you need to regenerate the testing .xml file */
-void Stg_MetaSuite_RegenerateComponentVC_MetaFile( Stg_MetaSuiteData* data ) {
-   Stg_Class_Delete( data->metaDict );
-   data->metaDict = Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), CompositeVC_Type, "0" );
-   IO_Handler_WriteAllToFile( data->io, "ComponentVCMetaDict.xml", data->metaDict );
-}
-
-
-void Stg_MetaSuite_TestGetFunctions( Stg_MetaSuiteData* data ) {
-   char     metaFilename[PCU_PATH_MAX];
-   Index    paramCount=0;
-   Index    assocCount=0;
-
-   pcu_filename_input( "ComponentVCMetaDict.xml", metaFilename );
-   IO_Handler_ReadAllFromFile( data->io, metaFilename, data->metaDict );
-
-   pcu_check_streq( Stg_Meta_GetType( data->metaDict ), "CompositeVC" );
-	pcu_check_streq( Stg_Meta_GetCreator( data->metaDict ), "VPAC" );
-	pcu_check_streq( Stg_Meta_GetPublisher( data->metaDict ), "VPAC" );
-	pcu_check_streq( Stg_Meta_GetRights( data->metaDict ), "The Gnu Lesser General Public License v2.1 - http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" );
-	pcu_check_streq( Stg_Meta_GetSource( data->metaDict ), "./StGermain/Base/Automation/src/" );
-	pcu_check_streq( Stg_Meta_GetSubject( data->metaDict ), "StGermain" );
-	pcu_check_streq( Stg_Meta_GetDescription( data->metaDict ), "CompositeVC is used as a container to combine multiple variable conditions." );
-	pcu_check_streq( Stg_Meta_GetExampleDocumentation( data->metaDict ), "" );
-	pcu_check_streq( Stg_Meta_GetExampleCode( data->metaDict ), "Refer to ./StgFEM/Apps/StokesMomentumUzawa/lidDrivenBCs.xml" );
-	pcu_check_streq( Stg_Meta_GetInherits( data->metaDict ), "VariableCondition" );
-
-	pcu_check_streq( Stg_Meta_GetReference( data->metaDict ), "" );
-	pcu_check_streq( Stg_Meta_GetEquation( data->metaDict ), "" );
-
-	paramCount = Stg_Meta_GetParameterCount( data->metaDict );
-   pcu_check_true( paramCount == 2 );
-	pcu_check_streq( Stg_Meta_GetParameterName( data->metaDict, 0 ), "vcName" );
-	pcu_check_streq( Stg_Meta_GetParameterType( data->metaDict, 0 ), "xsd:string" );
-	pcu_check_streq( Stg_Meta_GetParameterDefault( data->metaDict, 0 ), "self->name" );
-	pcu_check_streq( Stg_Meta_GetParameterDocumentation( data->metaDict, 0 ), "Deprecated; should not be used." );
-	pcu_check_streq( Stg_Meta_GetParameterName( data->metaDict, 1 ), "vcList" );
-	pcu_check_streq( Stg_Meta_GetParameterType( data->metaDict, 1 ), "stg:list" );
-	pcu_check_streq( Stg_Meta_GetParameterDefault( data->metaDict, 1 ), "" );
-	pcu_check_streq( Stg_Meta_GetParameterDocumentation( data->metaDict, 1 ), "A list of other VariableCondition definitions." );
-
-	assocCount = Stg_Meta_GetAssociationCount( data->metaDict ); 
-   pcu_check_true( assocCount == 1 );
-	pcu_check_streq( Stg_Meta_GetAssociationName( data->metaDict, 0 ), "Data" );
-	pcu_check_streq( Stg_Meta_GetAssociationType( data->metaDict, 0 ), "Stg_Component" );
-	pcu_check_streq( Stg_Meta_GetAssociationNillable( data->metaDict, 0 ), "true" );
-	pcu_check_streq( Stg_Meta_GetAssociationDocumentation( data->metaDict, 0 ), "User defined data in the form of a Stg_Component." );
-} 
-
-
-void Stg_MetaSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, Stg_MetaSuiteData );
-   pcu_suite_setFixtures( suite, Stg_MetaSuite_Setup, Stg_MetaSuite_Teardown );
-   pcu_suite_addTest( suite, Stg_MetaSuite_TestGetFunctions );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/Stg_MetaSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/Stg_MetaSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,123 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "Stg_MetaSuite.h"
+
+
+typedef struct {
+   XML_IO_Handler*         io;
+   Dictionary*             metaDict;
+   LiveComponentRegister*  lcRegister;
+} Stg_MetaSuiteData;
+
+
+void Stg_MetaSuite_Setup( Stg_MetaSuiteData* data ) {
+   data->io = XML_IO_Handler_New();
+   data->metaDict = Dictionary_New();
+   data->lcRegister = LiveComponentRegister_New( );
+}
+
+
+void Stg_MetaSuite_Teardown( Stg_MetaSuiteData* data ) {
+   Stg_Class_Delete( data->io );
+   Stg_Class_Delete( data->metaDict );
+   Stg_Class_Delete( data->lcRegister );
+}
+
+
+/* Use this function if you need to regenerate the testing .xml file */
+void Stg_MetaSuite_RegenerateComponentVC_MetaFile( Stg_MetaSuiteData* data ) {
+   Stg_Class_Delete( data->metaDict );
+   data->metaDict = Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), CompositeVC_Type, "0" );
+   IO_Handler_WriteAllToFile( data->io, "ComponentVCMetaDict.xml", data->metaDict );
+}
+
+
+void Stg_MetaSuite_TestGetFunctions( Stg_MetaSuiteData* data ) {
+   char     metaFilename[PCU_PATH_MAX];
+   Index    paramCount=0;
+   Index    assocCount=0;
+
+   pcu_filename_input( "ComponentVCMetaDict.xml", metaFilename );
+   IO_Handler_ReadAllFromFile( data->io, metaFilename, data->metaDict );
+
+   pcu_check_streq( Stg_Meta_GetType( data->metaDict ), "CompositeVC" );
+	pcu_check_streq( Stg_Meta_GetCreator( data->metaDict ), "VPAC" );
+	pcu_check_streq( Stg_Meta_GetPublisher( data->metaDict ), "VPAC" );
+	pcu_check_streq( Stg_Meta_GetRights( data->metaDict ), "The Gnu Lesser General Public License v2.1 - http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" );
+	pcu_check_streq( Stg_Meta_GetSource( data->metaDict ), "./StGermain/Base/Automation/src/" );
+	pcu_check_streq( Stg_Meta_GetSubject( data->metaDict ), "StGermain" );
+	pcu_check_streq( Stg_Meta_GetDescription( data->metaDict ), "CompositeVC is used as a container to combine multiple variable conditions." );
+	pcu_check_streq( Stg_Meta_GetExampleDocumentation( data->metaDict ), "" );
+	pcu_check_streq( Stg_Meta_GetExampleCode( data->metaDict ), "Refer to ./StgFEM/Apps/StokesMomentumUzawa/lidDrivenBCs.xml" );
+	pcu_check_streq( Stg_Meta_GetInherits( data->metaDict ), "VariableCondition" );
+
+	pcu_check_streq( Stg_Meta_GetReference( data->metaDict ), "" );
+	pcu_check_streq( Stg_Meta_GetEquation( data->metaDict ), "" );
+
+	paramCount = Stg_Meta_GetParameterCount( data->metaDict );
+   pcu_check_true( paramCount == 2 );
+	pcu_check_streq( Stg_Meta_GetParameterName( data->metaDict, 0 ), "vcName" );
+	pcu_check_streq( Stg_Meta_GetParameterType( data->metaDict, 0 ), "xsd:string" );
+	pcu_check_streq( Stg_Meta_GetParameterDefault( data->metaDict, 0 ), "self->name" );
+	pcu_check_streq( Stg_Meta_GetParameterDocumentation( data->metaDict, 0 ), "Deprecated; should not be used." );
+	pcu_check_streq( Stg_Meta_GetParameterName( data->metaDict, 1 ), "vcList" );
+	pcu_check_streq( Stg_Meta_GetParameterType( data->metaDict, 1 ), "stg:list" );
+	pcu_check_streq( Stg_Meta_GetParameterDefault( data->metaDict, 1 ), "" );
+	pcu_check_streq( Stg_Meta_GetParameterDocumentation( data->metaDict, 1 ), "A list of other VariableCondition definitions." );
+
+	assocCount = Stg_Meta_GetAssociationCount( data->metaDict ); 
+   pcu_check_true( assocCount == 1 );
+	pcu_check_streq( Stg_Meta_GetAssociationName( data->metaDict, 0 ), "Data" );
+	pcu_check_streq( Stg_Meta_GetAssociationType( data->metaDict, 0 ), "Stg_Component" );
+	pcu_check_streq( Stg_Meta_GetAssociationNillable( data->metaDict, 0 ), "true" );
+	pcu_check_streq( Stg_Meta_GetAssociationDocumentation( data->metaDict, 0 ), "User defined data in the form of a Stg_Component." );
+} 
+
+
+void Stg_MetaSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, Stg_MetaSuiteData );
+   pcu_suite_setFixtures( suite, Stg_MetaSuite_Setup, Stg_MetaSuite_Teardown );
+   pcu_suite_addTest( suite, Stg_MetaSuite_TestGetFunctions );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/VariableAllVC_Suite.c
--- a/Base/Context/tests/VariableAllVC_Suite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "VariableAllVC_Suite.h"
-
-#define TEST_CONDVALUE 2.0
-
-
-typedef struct {
-   Variable_Register*            vr;
-   ConditionFunction_Register*   conFunc_Register;
-   Dictionary*                   dict;
-   double*                       testArray;
-   Index                         arraySize;
-   Variable*                     var;
-   char*                         vcKey;
-   VariableCondition*            vc;
-} VariableAllVC_SuiteData;
-
-
-void VariableAllVC_Suite_CreateDictEntries( VariableAllVC_SuiteData* data ) {
-   Dictionary_Entry_Value* info;
-   Dictionary_Entry_Value* varList;
-   Dictionary_Entry_Value* varValue;
-
-   info = Dictionary_Entry_Value_NewStruct();
-   varList = Dictionary_Entry_Value_NewList();
-   varValue = Dictionary_Entry_Value_NewStruct();
-
-   Dictionary_Entry_Value_AddMember( varValue, (Dictionary_Entry_Key)"name", Dictionary_Entry_Value_FromString( "test" )  );
-   Dictionary_Entry_Value_AddMember( varValue, (Dictionary_Entry_Key)"type", Dictionary_Entry_Value_FromString( "double" )  );
-   Dictionary_Entry_Value_AddMember( varValue, (Dictionary_Entry_Key)"value", Dictionary_Entry_Value_FromDouble( TEST_CONDVALUE )  );
-
-   Dictionary_Entry_Value_AddElement( varList, varValue );
-   Dictionary_Entry_Value_AddMember( info, (Dictionary_Entry_Key)"variables", varList  );
-   Dictionary_Add( data->dict, (Dictionary_Entry_Key)data->vcKey, info );
-}
-
-
-void VariableAllVC_Suite_Setup( VariableAllVC_SuiteData* data  ) {
-   data->arraySize = 10;
-   data->testArray = Memory_Alloc_Array( double, data->arraySize, "test" );
-
-   data->dict = Dictionary_New();
-   data->conFunc_Register = ConditionFunction_Register_New();
-   data->vr = Variable_Register_New();
-   
-   Stg_asprintf( &data->vcKey, "VariableAllVC" );
-   VariableAllVC_Suite_CreateDictEntries( data );
-
-   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", NULL, "VariableAllVC", data->vr, data->conFunc_Register, data->dict, NULL );
-   
-   Stg_Component_Build( data->vc, 0, False );
-}
-
-
-void VariableAllVC_Suite_Teardown( VariableAllVC_SuiteData* data ) {
-   Stg_Class_Delete(data->vr);
-   Stg_Class_Delete(data->conFunc_Register);
-   Stg_Class_Delete(data->dict);
-
-   Memory_Free( data->testArray );
-   Stg_Class_Delete( data->var );
-
-   _Stg_Component_Delete(data->vc);
-}
-
-
-void VariableAllVC_Suite_TestIsCondition( VariableAllVC_SuiteData* data ) {
-   Index node_I=0;
-
-   for (node_I = 0; node_I < data->arraySize; node_I++) {
-      pcu_check_true( True == VariableCondition_IsCondition(data->vc, node_I, 0) );
-   }
-}
-
-
-void VariableAllVC_Suite_TestGetValueIndex( VariableAllVC_SuiteData* data ) {
-   Index node_I=0;
-
-   for (node_I = 0; node_I < data->arraySize; node_I++) {
-      pcu_check_true( 0 == VariableCondition_GetValueIndex(data->vc, node_I, 0) );
-   }
-}
-
-
-void VariableAllVC_Suite_TestApply( VariableAllVC_SuiteData* data ) {
-   Index node_I=0;
-   
-   VariableCondition_Apply(data->vc, NULL);
-
-   for (node_I = 0; node_I < data->arraySize; node_I++) {
-      pcu_check_true( TEST_CONDVALUE == data->testArray[node_I] );
-   }
-}
-
-
-void VariableAllVC_Suite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, VariableAllVC_SuiteData );
-   pcu_suite_setFixtures( suite, VariableAllVC_Suite_Setup, VariableAllVC_Suite_Teardown );
-   pcu_suite_addTest( suite, VariableAllVC_Suite_TestIsCondition );
-   pcu_suite_addTest( suite, VariableAllVC_Suite_TestGetValueIndex );
-   pcu_suite_addTest( suite, VariableAllVC_Suite_TestApply );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/VariableAllVC_Suite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/VariableAllVC_Suite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,149 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "VariableAllVC_Suite.h"
+
+#define TEST_CONDVALUE 2.0
+
+
+typedef struct {
+   Variable_Register*            vr;
+   ConditionFunction_Register*   conFunc_Register;
+   Dictionary*                   dict;
+   double*                       testArray;
+   Index                         arraySize;
+   Variable*                     var;
+   char*                         vcKey;
+   VariableCondition*            vc;
+} VariableAllVC_SuiteData;
+
+
+void VariableAllVC_Suite_CreateDictEntries( VariableAllVC_SuiteData* data ) {
+   Dictionary_Entry_Value* info;
+   Dictionary_Entry_Value* varList;
+   Dictionary_Entry_Value* varValue;
+
+   info = Dictionary_Entry_Value_NewStruct();
+   varList = Dictionary_Entry_Value_NewList();
+   varValue = Dictionary_Entry_Value_NewStruct();
+
+   Dictionary_Entry_Value_AddMember( varValue, (Dictionary_Entry_Key)"name", Dictionary_Entry_Value_FromString( "test" )  );
+   Dictionary_Entry_Value_AddMember( varValue, (Dictionary_Entry_Key)"type", Dictionary_Entry_Value_FromString( "double" )  );
+   Dictionary_Entry_Value_AddMember( varValue, (Dictionary_Entry_Key)"value", Dictionary_Entry_Value_FromDouble( TEST_CONDVALUE )  );
+
+   Dictionary_Entry_Value_AddElement( varList, varValue );
+   Dictionary_Entry_Value_AddMember( info, (Dictionary_Entry_Key)"variables", varList  );
+   Dictionary_Add( data->dict, (Dictionary_Entry_Key)data->vcKey, info );
+}
+
+
+void VariableAllVC_Suite_Setup( VariableAllVC_SuiteData* data  ) {
+   data->arraySize = 10;
+   data->testArray = Memory_Alloc_Array( double, data->arraySize, "test" );
+
+   data->dict = Dictionary_New();
+   data->conFunc_Register = ConditionFunction_Register_New();
+   data->vr = Variable_Register_New();
+   
+   Stg_asprintf( &data->vcKey, "VariableAllVC" );
+   VariableAllVC_Suite_CreateDictEntries( data );
+
+   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", NULL, "VariableAllVC", data->vr, data->conFunc_Register, data->dict, NULL );
+   
+   Stg_Component_Build( data->vc, 0, False );
+}
+
+
+void VariableAllVC_Suite_Teardown( VariableAllVC_SuiteData* data ) {
+   Stg_Class_Delete(data->vr);
+   Stg_Class_Delete(data->conFunc_Register);
+   Stg_Class_Delete(data->dict);
+
+   Memory_Free( data->testArray );
+   Stg_Class_Delete( data->var );
+
+   _Stg_Component_Delete(data->vc);
+}
+
+
+void VariableAllVC_Suite_TestIsCondition( VariableAllVC_SuiteData* data ) {
+   Index node_I=0;
+
+   for (node_I = 0; node_I < data->arraySize; node_I++) {
+      pcu_check_true( True == VariableCondition_IsCondition(data->vc, node_I, 0) );
+   }
+}
+
+
+void VariableAllVC_Suite_TestGetValueIndex( VariableAllVC_SuiteData* data ) {
+   Index node_I=0;
+
+   for (node_I = 0; node_I < data->arraySize; node_I++) {
+      pcu_check_true( 0 == VariableCondition_GetValueIndex(data->vc, node_I, 0) );
+   }
+}
+
+
+void VariableAllVC_Suite_TestApply( VariableAllVC_SuiteData* data ) {
+   Index node_I=0;
+   
+   VariableCondition_Apply(data->vc, NULL);
+
+   for (node_I = 0; node_I < data->arraySize; node_I++) {
+      pcu_check_true( TEST_CONDVALUE == data->testArray[node_I] );
+   }
+}
+
+
+void VariableAllVC_Suite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, VariableAllVC_SuiteData );
+   pcu_suite_setFixtures( suite, VariableAllVC_Suite_Setup, VariableAllVC_Suite_Teardown );
+   pcu_suite_addTest( suite, VariableAllVC_Suite_TestIsCondition );
+   pcu_suite_addTest( suite, VariableAllVC_Suite_TestGetValueIndex );
+   pcu_suite_addTest( suite, VariableAllVC_Suite_TestApply );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/VariableDumpStreamSuite.c
--- a/Base/Context/tests/VariableDumpStreamSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "VariableDumpStreamSuite.h"
-
-typedef struct {
-   Variable_Register*      vr;
-} VariableDumpStreamSuiteData;
-
-
-void VariableDumpStreamSuite_Setup( VariableDumpStreamSuiteData* data ) {
-   /* Construction phase --------------------------------------------------------------------------------------------*/
-   data->vr = Variable_Register_New();
-}
-
-
-void VariableDumpStreamSuite_Teardown( VariableDumpStreamSuiteData* data ) {
-   Variable_Index          var_I;
-
-   /* manually delete all the created Variables */
-   for( var_I = 0; var_I < data->vr->count; var_I++ ) {
-      Stg_Class_Delete( data->vr->_variable[var_I] );
-   }
-
-   Stg_Class_Delete( data->vr );
-}
-
-
-void VariableDumpStreamSuite_TestDump( VariableDumpStreamSuiteData* data ) {
-   typedef double Triple[3];
-   double*        array;
-   Triple*        structArray;
-   Index          length = 10;
-   Variable*      var;
-   Variable*      vec;
-   Stream*        dumpStream = NULL;
-   Stream*        dumpStream2 = NULL;
-   Index            i;
-   const Name     scalarDumpFilename = "./scalardump.dat" ;
-   const Name     vectorDumpFilename = "./vectordump.dat" ;
-   FILE*          scalarDumpFile = NULL;
-   FILE*          vectorDumpFile = NULL;
-   float          scalarCheck = 0;
-   float          vectorCheck[3] = {0,0,0};
-
-   array = Memory_Alloc_Array( double, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   data->vr = Variable_Register_New();
-
-   var = Variable_NewScalar(
-      "Scalar",
-		NULL,
-      Variable_DataType_Double,
-      &length,
-      NULL,
-      (void**)&array,
-      data->vr );
-
-   vec = Variable_NewVector(
-      "Three",
-		NULL,
-      Variable_DataType_Double,
-      3,
-      &length,
-      NULL,
-      (void**)&structArray,
-      data->vr,
-      "a",
-      "b",
-      "c" );
-
-   Variable_Register_BuildAll( data->vr );
-
-   for ( i = 0; i < length; ++i ) {
-      Variable_SetValueDouble( var, i, 123.456 );
-
-      Variable_SetValueAtDouble( vec, i, 0, 1.2 );
-      Variable_SetValueAtDouble( vec, i, 1, 3.4 );
-      Variable_SetValueAtDouble( vec, i, 2, 5.6 );
-   }
-
-   dumpStream = Journal_Register( VariableDumpStream_Type, (Name)"scalar dump"  );
-   VariableDumpStream_SetVariable( dumpStream, var, 1, 0, scalarDumpFilename );
-   pcu_check_true( Journal_Dump( dumpStream, NULL ) );
-   Stream_Flush( dumpStream );
-
-   dumpStream2 = Journal_Register( VariableDumpStream_Type, (Name)"vector dump"  );
-   VariableDumpStream_SetVariable( dumpStream2, vec, 1, 0, vectorDumpFilename );
-   pcu_check_true( Journal_Dump( dumpStream2, NULL ) );
-   Stream_Flush( dumpStream2 );
-
-   /* Really, you'd think there'd be a function to read a dumpStream. Anyway, hard-code for now */
-   /* Don't want to use expected files here, since we need to continually check the writing ability
-    * of these dump streams */ 
-   scalarDumpFile = fopen( scalarDumpFilename, "r" );
-   vectorDumpFile = fopen( vectorDumpFilename, "r" );
-   for ( i = 0; i < length; ++i ) {
-      /* See VariableDumpStream.c:166 */
-      pcu_check_true( fread( &scalarCheck, sizeof(float), 1, scalarDumpFile ));
-      pcu_check_true( fabs( scalarCheck - 123.456) < 0.0001 );
-
-      pcu_check_true( fread( vectorCheck, sizeof(float), 3, vectorDumpFile ));
-      pcu_check_true( fabs( vectorCheck[0] - 1.2 ) < 0.001 );
-      pcu_check_true( fabs( vectorCheck[1] - 3.4 ) < 0.001 );
-      pcu_check_true( fabs( vectorCheck[2] - 5.6 ) < 0.001 );
-   }
-
-   Memory_Free( array );
-   Memory_Free( structArray );
-
-   fclose( scalarDumpFile );
-   fclose( vectorDumpFile );
-   remove( scalarDumpFilename );
-   remove( vectorDumpFilename );
-}
-
-
-void VariableDumpStreamSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, VariableDumpStreamSuiteData );
-   pcu_suite_setFixtures( suite, VariableDumpStreamSuite_Setup, VariableDumpStreamSuite_Teardown );
-   pcu_suite_addTest( suite, VariableDumpStreamSuite_TestDump );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/VariableDumpStreamSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/VariableDumpStreamSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,164 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "VariableDumpStreamSuite.h"
+
+typedef struct {
+   Variable_Register*      vr;
+} VariableDumpStreamSuiteData;
+
+
+void VariableDumpStreamSuite_Setup( VariableDumpStreamSuiteData* data ) {
+   /* Construction phase --------------------------------------------------------------------------------------------*/
+   data->vr = Variable_Register_New();
+}
+
+
+void VariableDumpStreamSuite_Teardown( VariableDumpStreamSuiteData* data ) {
+   Variable_Index          var_I;
+
+   /* manually delete all the created Variables */
+   for( var_I = 0; var_I < data->vr->count; var_I++ ) {
+      Stg_Class_Delete( data->vr->_variable[var_I] );
+   }
+
+   Stg_Class_Delete( data->vr );
+}
+
+
+void VariableDumpStreamSuite_TestDump( VariableDumpStreamSuiteData* data ) {
+   typedef double Triple[3];
+   double*        array;
+   Triple*        structArray;
+   Index          length = 10;
+   Variable*      var;
+   Variable*      vec;
+   Stream*        dumpStream = NULL;
+   Stream*        dumpStream2 = NULL;
+   Index            i;
+   const Name     scalarDumpFilename = "./scalardump.dat" ;
+   const Name     vectorDumpFilename = "./vectordump.dat" ;
+   FILE*          scalarDumpFile = NULL;
+   FILE*          vectorDumpFile = NULL;
+   float          scalarCheck = 0;
+   float          vectorCheck[3] = {0,0,0};
+
+   array = Memory_Alloc_Array( double, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   data->vr = Variable_Register_New();
+
+   var = Variable_NewScalar(
+      "Scalar",
+		NULL,
+      Variable_DataType_Double,
+      &length,
+      NULL,
+      (void**)&array,
+      data->vr );
+
+   vec = Variable_NewVector(
+      "Three",
+		NULL,
+      Variable_DataType_Double,
+      3,
+      &length,
+      NULL,
+      (void**)&structArray,
+      data->vr,
+      "a",
+      "b",
+      "c" );
+
+   Variable_Register_BuildAll( data->vr );
+
+   for ( i = 0; i < length; ++i ) {
+      Variable_SetValueDouble( var, i, 123.456 );
+
+      Variable_SetValueAtDouble( vec, i, 0, 1.2 );
+      Variable_SetValueAtDouble( vec, i, 1, 3.4 );
+      Variable_SetValueAtDouble( vec, i, 2, 5.6 );
+   }
+
+   dumpStream = Journal_Register( VariableDumpStream_Type, (Name)"scalar dump"  );
+   VariableDumpStream_SetVariable( dumpStream, var, 1, 0, scalarDumpFilename );
+   pcu_check_true( Journal_Dump( dumpStream, NULL ) );
+   Stream_Flush( dumpStream );
+
+   dumpStream2 = Journal_Register( VariableDumpStream_Type, (Name)"vector dump"  );
+   VariableDumpStream_SetVariable( dumpStream2, vec, 1, 0, vectorDumpFilename );
+   pcu_check_true( Journal_Dump( dumpStream2, NULL ) );
+   Stream_Flush( dumpStream2 );
+
+   /* Really, you'd think there'd be a function to read a dumpStream. Anyway, hard-code for now */
+   /* Don't want to use expected files here, since we need to continually check the writing ability
+    * of these dump streams */ 
+   scalarDumpFile = fopen( scalarDumpFilename, "r" );
+   vectorDumpFile = fopen( vectorDumpFilename, "r" );
+   for ( i = 0; i < length; ++i ) {
+      /* See VariableDumpStream.c:166 */
+      pcu_check_true( fread( &scalarCheck, sizeof(float), 1, scalarDumpFile ));
+      pcu_check_true( fabs( scalarCheck - 123.456) < 0.0001 );
+
+      pcu_check_true( fread( vectorCheck, sizeof(float), 3, vectorDumpFile ));
+      pcu_check_true( fabs( vectorCheck[0] - 1.2 ) < 0.001 );
+      pcu_check_true( fabs( vectorCheck[1] - 3.4 ) < 0.001 );
+      pcu_check_true( fabs( vectorCheck[2] - 5.6 ) < 0.001 );
+   }
+
+   Memory_Free( array );
+   Memory_Free( structArray );
+
+   fclose( scalarDumpFile );
+   fclose( vectorDumpFile );
+   remove( scalarDumpFilename );
+   remove( vectorDumpFilename );
+}
+
+
+void VariableDumpStreamSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, VariableDumpStreamSuiteData );
+   pcu_suite_setFixtures( suite, VariableDumpStreamSuite_Setup, VariableDumpStreamSuite_Teardown );
+   pcu_suite_addTest( suite, VariableDumpStreamSuite_TestDump );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/VariableSuite.c
--- a/Base/Context/tests/VariableSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,830 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "VariableSuite.h"
-
-typedef double VectorD[3];
-typedef double VectorF[3];
-
-typedef struct {
-   int      mass;
-   VectorF  force;
-   short    num;
-   char*    info;
-} Particle;
-
-typedef struct {
-   Variable_Register*      vr;
-   Index                   aSize[3];
-   double*                 temperature;
-   VectorD*                velocity;
-   Particle*               particle;
-} VariableSuiteData;
-
-
-
-void VariableSuite_Setup( VariableSuiteData* data ) {
-   Particle                tmpParticle;
-   const char*                    pNames[] = { "mass", "force", "info" };
-   SizeT                   pOffsets[] = { 0, 0, 0 };   /* Init later... */
-   Variable_DataType       pDataTypes[] = {
-                              Variable_DataType_Int,
-                              Variable_DataType_Float,
-                              Variable_DataType_Pointer, };
-   Index                   pDtCounts[] = { 1, 3, 1 };
-   static SizeT            pSize = sizeof(Particle);
-   
-   data->aSize[0] = 16;
-   data->aSize[1] = 16;
-   data->aSize[2] = 16;
-
-   pOffsets[0] = (ArithPointer)&tmpParticle.mass - (ArithPointer)&tmpParticle;
-   pOffsets[1] = (ArithPointer)&tmpParticle.force - (ArithPointer)&tmpParticle;
-   pOffsets[2] = (ArithPointer)&tmpParticle.info - (ArithPointer)&tmpParticle;
-
-   /* Construction phase --------------------------------------------------------------------------------------------*/
-   data->vr = Variable_Register_New();
-   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, (Name*)pNames, &pSize, &data->aSize[2], NULL, (void**)&data->particle, data->vr );
-   
-   /* Build phase ---------------------------------------------------------------------------------------------------*/
-   data->temperature = Memory_Alloc_Array( double, data->aSize[0], "temperature" );
-   data->velocity = Memory_Alloc_Array( VectorD, data->aSize[1], "velocity" );
-   data->particle = Memory_Alloc_Array( Particle, data->aSize[2], "array" );
-   
-   Variable_Register_BuildAll( data->vr );
-}
-
-
-void VariableSuite_Teardown( VariableSuiteData* data ) {
-   Variable_Index          var_I;
-
-   /* manually delete all the created Variables */
-   for( var_I = 0; var_I < data->vr->count; var_I++ ) {
-      Stg_Class_Delete( data->vr->_variable[var_I] );
-   }
-   
-   Memory_Free( data->particle );
-   Memory_Free( data->velocity );
-   Memory_Free( data->temperature );
-}
-
-
-void VariableSuite_TestGetValueDouble( VariableSuiteData* data ) {
-   Index                   ii;
-   double tmp;
-   Variable*      var = Variable_Register_GetByName( data->vr, "temperature" );
-
-   /* Test the Get and Set of a scalar double....................................................................... */
-   /* Fill the temperature array with a known pattern of kinda random (bit filling) numbers. */
-   for( ii = 0; ii < data->aSize[0]; ii++ ) {
-      data->temperature[ii] = 1.0f / (data->aSize[0]+2) * (ii+1); 
-   }
-   
-   /* Check that Variable_GetValueDouble on the temperature Variable returns the right numbers */
-   for( ii = 0; ii < data->aSize[0]; ii++ ) {
-      tmp = 1.0f / (data->aSize[0]+2) * (ii+1);
-
-      pcu_check_true( fabs(Variable_GetValueDouble( var, ii ) - tmp ) < 1e-12);
-   }
-}
-   
-
-void VariableSuite_TestSetValueDouble( VariableSuiteData* data ) {
-   Index                   ii;
-   double tmp;
-   Variable*      var = Variable_Register_GetByName( data->vr, "temperature" );
-
-   /* Fill the temperature Variable with another known pattern of kinda random (bit filling) numbers */
-   for( ii = 0; ii < data->aSize[0]; ii++ ) {
-      
-      Variable_SetValueDouble( var, ii, 1.0f - ( 1.0f / (data->aSize[0]+2) * (ii+1) ) );
-   }
-   
-   /* Check that Variable_SetValueDouble on the temperature Variable set the right numbers */
-   for( ii = 0; ii < data->aSize[0]; ii++ ) {
-      tmp = 1.0f - 1.0f / (data->aSize[0]+2) * (ii+1);
-      
-      pcu_check_true( fabs(data->temperature[ii] - tmp ) < 1e-12);
-   }
-}
-   
-
-/* Test the Get and Set of a vector double....................................................................... */
-void VariableSuite_TestGetValueAtDouble( VariableSuiteData* data ) {
-   Index                   ii;
-   double tmp;
-   Variable*      var = Variable_Register_GetByName( data->vr, "velocity" );
-
-/* Fill the velocity array with a known pattern of kinda random (bit filling) numbers. */
-   for( ii = 0; ii < data->aSize[1]; ii++ ) {
-      int         d;
-      
-      for( d = 0; d < 3; d++ ) {
-         data->velocity[ii][d] = 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1); 
-      }
-   }
-   
-   /* Check that Variable_GetPtrDouble on the velocity Variable returns the right numbers */
-   for( ii = 0; ii < data->aSize[1]; ii++ ) {
-      int         d;
-      
-      for( d = 0; d < 3; d++ ) {
-         tmp = 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1);
-         
-         pcu_check_true( fabs(Variable_GetValueAtDouble(var, ii, d ) - tmp) < 1e-12);
-      }
-   }
-}
-
-
-void VariableSuite_TestSetValueAtDouble( VariableSuiteData* data ) {
-   Index                   ii;
-   double tmp;
-   int d;
-   Variable*      var = Variable_Register_GetByName( data->vr, "velocity" );
-
-   /* Fill the variable Variable with another known pattern of kinda random (bit filling) numbers */
-   for( ii = 0; ii < data->aSize[1]; ii++ ) {
-      
-      for( d = 0; d < 3; d++ ) {
-         Variable_SetValueAtDouble( var, ii, d, 1.0 - ( 1.0 / ((data->aSize[1]*3)+2) * (ii*3+d+1) ) );
-      }
-   }
-   
-   /* Check that Variable_SetValueDouble on the velocity Variable set the right numbers */
-   for( ii = 0; ii < data->aSize[1]; ii++ ) {
-      
-      for( d = 0; d < 3; d++ ) {
-         tmp = 1.0 - ( 1.0 / ((data->aSize[1]*3)+2) * (ii*3+d+1) );
-         
-         pcu_check_true( data->velocity[ii][d]-tmp < 1e-12 );
-      }
-   }
-}
-
-   
-/* TODO: try out vx, vy, vz, complex tests */
-
-void VariableSuite_TestVariable_Char( VariableSuiteData* data ) {
-   typedef char Triple[3];
-   char* array;
-   Triple* structArray;
-   Index length = 10;
-   /* List of values to test the variable with.
-    * Values to test are hex 5's and a's because they are a series of 0101 and 1010 respectively so they test
-    * each bit in memory to read/set.
-    */
-   long int testValues[] = { 0x55, 0xaa };
-   Index testValueCount = 2;
-   Index test_I;
-   long int testValue;
-   Variable* var;
-   Variable* vec;
-   Variable* vecVar[3];
-   Index i, j;
-
-   array = Memory_Alloc_Array( char, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   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" );
-
-   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
-   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
-   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
-
-   Variable_Register_BuildAll( data->vr );
-
-   for ( test_I = 0; test_I < testValueCount; ++test_I ) {
-
-      testValue = testValues[test_I];
-
-      for ( i = 0; i < length; ++i ) {
-         Variable_SetValueChar( var, i, testValue );
-         Variable_SetValueAtChar( vec, i, 0, testValue );
-         Variable_SetValueAtChar( vec, i, 1, testValue );
-         Variable_SetValueAtChar( vec, i, 2, testValue );
-      }
-
-      /* ~~~Scalar~~~*/
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueChar( var, i ) == (char)(char)testValue );
-         pcu_check_true( Variable_GetValueCharAsShort( var, i ) == (short)(char)testValue );
-         pcu_check_true( Variable_GetValueCharAsInt( var, i ) == (int)(char)testValue );
-         pcu_check_true( Variable_GetValueCharAsFloat( var, i ) == (float)(char)testValue );
-         pcu_check_true( Variable_GetValueCharAsDouble( var, i ) == (double)(char)testValue );
-      }
-
-      /*~~~Vector~~~*/
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueAtChar( vec, i, 0 ) == (char)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsShort( vec, i, 0 ) == (short)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsInt( vec, i, 0 ) == (int)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsFloat( vec, i, 0 ) == (float)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsDouble( vec, i, 0 ) == (double)(char)testValue );
-
-         pcu_check_true( Variable_GetPtrAtChar( vec, i, 0 ) == &structArray[i][0] );
-
-         pcu_check_true( Variable_GetValueAtChar( vec, i, 1 ) == (char)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsShort( vec, i, 1 ) == (short)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsInt( vec, i, 1 ) == (int)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsFloat( vec, i, 1 ) == (float)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsDouble( vec, i, 1 ) == (double)(char)testValue );
-         pcu_check_true( Variable_GetPtrAtChar( vec, i, 1 ) == &structArray[i][1] );
-
-         pcu_check_true( Variable_GetValueAtChar( vec, i, 2 ) == (char)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsShort( vec, i, 2 ) == (short)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsInt( vec, i, 2 ) == (int)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsFloat( vec, i, 2 ) == (float)(char)testValue );
-         pcu_check_true( Variable_GetValueAtCharAsDouble( vec, i, 2 ) == (double)(char)testValue );
-         pcu_check_true( Variable_GetPtrAtChar( vec, i, 2 ) == &structArray[i][2] );
-      }
-
-      /*~~~Vector: Sub-Variable~~~*/
-      for ( i = 0; i < length; ++i ) {
-         for ( j = 0; j < 3; ++j ) {
-            pcu_check_true( _Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
-         }
-      }
-   }
-}
-
-
-void VariableSuite_TestVariable_Double( VariableSuiteData* data ) {
-   typedef double Triple[3];
-
-   double* array;
-   Triple* structArray;
-   Index length = 10;
-
-   double testValues[] = { 123456789.0, 0.987654321 };
-   Index testValueCount = 2;
-   Index test_I;
-   double testValue;
-
-   Variable* var;
-   Variable* vec;
-   Variable* vecVar[3];
-
-   Index i, j;
-
-   array = Memory_Alloc_Array( double, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   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" );
-
-   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
-   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
-   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
-
-   Variable_Register_BuildAll( data->vr );
-
-
-   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
-
-      testValue = testValues[test_I];
-
-      for ( i = 0; i < length; ++i ) {
-         Variable_SetValueDouble( var, i, testValue );
-
-         Variable_SetValueAtDouble( vec, i, 0, testValue );
-         Variable_SetValueAtDouble( vec, i, 1, testValue );
-         Variable_SetValueAtDouble( vec, i, 2, testValue );
-      }
-
-      /* "~~~Scalar~~~\n" */
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueDouble( var, i ) == (double)(double)testValue );
-         pcu_check_true( Variable_GetValueDoubleAsChar( var, i ) == (char)(double)testValue );
-         pcu_check_true( Variable_GetValueDoubleAsShort( var, i ) == (short)(double)testValue );
-         pcu_check_true( Variable_GetValueDoubleAsInt( var, i ) == (int)(double)testValue );
-         pcu_check_true( Variable_GetValueDoubleAsFloat( var, i ) == (float)(double)testValue );
-      }
-
-      /*~~~Vector~~~*/
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueAtDouble( vec, i, 0 ) == (double)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsChar( vec, i, 0 ) == (char)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsShort( vec, i, 0 ) == (short)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsInt( vec, i, 0 ) == (int)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsFloat( vec, i, 0 ) == (float)(double)testValue );
-         pcu_check_true( Variable_GetPtrAtDouble( vec, i, 0 ) == &structArray[i][0] );
-
-         pcu_check_true( Variable_GetValueAtDouble( vec, i, 1 ) == (double)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsChar( vec, i, 1 ) == (char)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsShort( vec, i, 1 ) == (short)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsInt( vec, i, 1 ) == (int)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsFloat( vec, i, 1 ) == (float)(double)testValue );
-         pcu_check_true( Variable_GetPtrAtDouble( vec, i, 1 ) == &structArray[i][1] );
-
-         pcu_check_true( Variable_GetValueAtDouble( vec, i, 2 ) == (double)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsChar( vec, i, 2 ) == (char)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsShort( vec, i, 2 ) == (short)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsInt( vec, i, 2 ) == (int)(double)testValue );
-         pcu_check_true( Variable_GetValueAtDoubleAsFloat( vec, i, 2 ) == (float)(double)testValue );
-         pcu_check_true( Variable_GetPtrAtDouble( vec, i, 2 ) == &structArray[i][2] );
-      }
-
-      /*~~~Vector: Sub-Variable~~~*/
-      for ( i = 0; i < length; ++i ) {
-         for ( j = 0; j < 3; ++j ) {
-            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
-         }
-      }
-   }
-}
-
-
-void VariableSuite_TestVariable_Float( VariableSuiteData* data ) {
-   typedef float Triple[3];
-
-   float* array;
-   Triple* structArray;
-   Index length = 10;
-
-   float testValues[] = { 123456789.0, 0.987654321 };
-   Index testValueCount = 2;
-   Index test_I;
-   float testValue;
-
-   Variable* var;
-   Variable* vec;
-   Variable* vecVar[3];
-
-   Index i, j;
-
-   array = Memory_Alloc_Array( float, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   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" );
-
-   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
-   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
-   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
-
-   Variable_Register_BuildAll( data->vr );
-
-   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
-      testValue = testValues[test_I];
-
-      for ( i = 0; i < length; ++i ) {
-         Variable_SetValueFloat( var, i, testValue );
-
-         Variable_SetValueAtFloat( vec, i, 0, testValue );
-         Variable_SetValueAtFloat( vec, i, 1, testValue );
-         Variable_SetValueAtFloat( vec, i, 2, testValue );
-      }
-      
-      /* "~~~Scalar~~~\n" */
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueFloat( var, i ) == (float)(float)testValue );
-         pcu_check_true( Variable_GetValueFloatAsChar( var, i ) == (float)(char)testValue );
-         pcu_check_true( Variable_GetValueFloatAsShort( var, i ) == (float)(short)testValue );
-         pcu_check_true( Variable_GetValueFloatAsInt( var, i ) == (float)(int)testValue );
-         pcu_check_true( Variable_GetValueFloatAsDouble( var, i ) == (double)(float)testValue );
-      }
-
-      /*~~~Vector~~~*/
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueAtFloat( vec, i, 0 ) == (float)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsChar( vec, i, 0 ) == (char)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsShort( vec, i, 0 ) == (short)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsInt( vec, i, 0 ) == (int)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsDouble( vec, i, 0 ) == (double)(float)testValue );
-         pcu_check_true( Variable_GetPtrAtFloat( vec, i, 0 ) == &structArray[i][0] );
-
-         pcu_check_true( Variable_GetValueAtFloat( vec, i, 1 ) == (float)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsChar( vec, i, 1 ) == (char)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsShort( vec, i, 1 ) == (short)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsInt( vec, i, 1 ) == (int)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsDouble( vec, i, 1 ) == (double)(float)testValue );
-         pcu_check_true( Variable_GetPtrAtFloat( vec, i, 1 ) == &structArray[i][1] );
-
-         pcu_check_true( Variable_GetValueAtFloat( vec, i, 2 ) == (float)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsChar( vec, i, 2 ) == (char)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsShort( vec, i, 2 ) == (short)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsInt( vec, i, 2 ) == (int)(float)testValue );
-         pcu_check_true( Variable_GetValueAtFloatAsDouble( vec, i, 2 ) == (double)(float)testValue );
-         pcu_check_true( Variable_GetPtrAtFloat( vec, i, 2 ) == &structArray[i][2] );
-      }
-
-      /*~~~Vector: Sub-Variable~~~*/
-      for ( i = 0; i < length; ++i ) {
-         for ( j = 0; j < 3; ++j ) {
-            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
-         }
-      }
-   }
-}
-
-
-void VariableSuite_TestVariable_Int( VariableSuiteData* data ) {
-   typedef int Triple[3];
-
-   int* array;
-   Triple* structArray;
-   Index length = 10;
-
-   /* List of values to test the variable with.
-    * Values to test are hex 5's and a's because they are a series of 0101 and 1010 respectively so they test
-    * each bit in memory to read/set.
-    */
-   long int testValues[] = { 0x55555555, 0xaaaaaaaa };
-   Index testValueCount = 2;
-   Index test_I;
-   long int testValue;
-
-   Variable* var;
-   Variable* vec;
-   Variable* vecVar[3];
-
-   Index i, j;
-
-   array = Memory_Alloc_Array( int, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   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" );
-
-   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
-   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
-   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
-
-   Variable_Register_BuildAll( data->vr );
-
-   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
-
-      testValue = testValues[test_I];
-
-      for ( i = 0; i < length; ++i ) {
-         Variable_SetValueInt( var, i, testValue );
-
-         Variable_SetValueAtInt( vec, i, 0, testValue );
-         Variable_SetValueAtInt( vec, i, 1, testValue );
-         Variable_SetValueAtInt( vec, i, 2, testValue );
-      }
-
-      /*~~~Scalar~~~*/
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueInt( var, i ) == (int)(int)testValue );
-         pcu_check_true( Variable_GetValueIntAsChar( var, i ) == (char)(int)testValue );
-         pcu_check_true( Variable_GetValueIntAsShort( var, i ) == (short)(int)testValue );
-         pcu_check_true( fabsf(Variable_GetValueIntAsFloat( var, i ) - (float)(int)testValue) < fabsf(0.00001*testValue) );
-         pcu_check_true( fabs(Variable_GetValueIntAsDouble( var, i ) - (double)(int)testValue) < fabs(0.00001*testValue) );
-      }
-
-      /*~~~Vector~~~*/
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueAtInt( vec, i, 0 ) == (int)(int)testValue );
-         pcu_check_true( Variable_GetValueAtIntAsChar( vec, i, 0 ) == (char)(int)testValue );
-         pcu_check_true( Variable_GetValueAtIntAsShort( vec, i, 0 ) == (short)(int)testValue );
-         pcu_check_true( fabsf(Variable_GetValueAtIntAsFloat( vec, i, 0 ) - (float)(int)testValue) < fabsf(0.00001*testValue) );
-         pcu_check_true( fabs(Variable_GetValueAtIntAsDouble( vec, i, 0 ) - (double)(int)testValue) < fabs(0.00001*testValue));
-         pcu_check_true( Variable_GetPtrAtInt( vec, i, 0 ) == &structArray[i][0] );
-
-         pcu_check_true( Variable_GetValueAtInt( vec, i, 1 ) == (int)(int)testValue );
-         pcu_check_true( Variable_GetValueAtIntAsChar( vec, i, 1 ) == (char)(int)testValue );
-         pcu_check_true( Variable_GetValueAtIntAsShort( vec, i, 1 ) == (short)(int)testValue );
-         pcu_check_true( fabsf(Variable_GetValueAtIntAsFloat( vec, i, 1 ) - (float)(int)testValue) < fabsf(0.00001*testValue) );
-         pcu_check_true( fabs(Variable_GetValueAtIntAsDouble( vec, i, 1 ) - (double)(int)testValue) < fabs(0.00001*testValue));
-         pcu_check_true( Variable_GetPtrAtInt( vec, i, 1 ) == &structArray[i][1] );
-
-         pcu_check_true( Variable_GetValueAtInt( vec, i, 2 ) == (int)(int)testValue );
-         pcu_check_true( Variable_GetValueAtIntAsChar( vec, i, 2 ) == (char)(int)testValue );
-         pcu_check_true( Variable_GetValueAtIntAsShort( vec, i, 2 ) == (short)(int)testValue );
-         pcu_check_true( fabsf(Variable_GetValueAtIntAsFloat( vec, i, 2 ) - (float)(int)testValue) < fabsf(0.00001*testValue));
-         pcu_check_true( fabs(Variable_GetValueAtIntAsDouble( vec, i, 2 ) - (double)(int)testValue) < fabs(0.0001*testValue));
-         pcu_check_true( Variable_GetPtrAtInt( vec, i, 2 ) == &structArray[i][2] );
-      }
-
-      /*~~~Vector: Sub-Variable~~~*/
-      for ( i = 0; i < length; ++i ) {
-         for ( j = 0; j < 3; ++j ) {
-            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
-         }
-      }
-   }
-}
-
-
-void VariableSuite_TestVariable_Short( VariableSuiteData* data ) {
-   typedef short Triple[3];
-
-   short* array;
-   Triple* structArray;
-   Index length = 10;
-
-   /* List of values to test the variable with.
-    * Values to test are hex 5's and a's because they are a series of 0101 and 1010 respectively so they test
-    * each bit in memory to read/set.
-    */
-   long int testValues[] = { 0x5555, 0xaaaa };
-   Index testValueCount = 2;
-   Index test_I;
-   long int testValue;
-
-   Variable* var;
-   Variable* vec;
-   Variable* vecVar[3];
-
-   Index i, j;
-
-   array = Memory_Alloc_Array( short, length, "test" );
-   structArray = Memory_Alloc_Array( Triple, length, "test" );
-
-   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" );
-
-   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
-   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
-   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
-
-   Variable_Register_BuildAll( data->vr );
-
-
-   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
-
-      testValue = testValues[test_I];
-
-
-      for ( i = 0; i < length; ++i ) {
-         Variable_SetValueShort( var, i, testValue );
-
-         Variable_SetValueAtShort( vec, i, 0, testValue );
-         Variable_SetValueAtShort( vec, i, 1, testValue );
-         Variable_SetValueAtShort( vec, i, 2, testValue );
-      }
-
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueShort( var, i ) == (short)(short)testValue );
-         pcu_check_true( Variable_GetValueShortAsChar( var, i ) == (char)(short)testValue );
-         pcu_check_true( Variable_GetValueShortAsInt( var, i ) == (int)(short)testValue );
-         pcu_check_true( Variable_GetValueShortAsFloat( var, i ) == (float)(short)testValue );
-         pcu_check_true( Variable_GetValueShortAsDouble( var, i ) == (double)(short)testValue );
-      }
-
-      for ( i = 0; i < length; ++i ) {
-         pcu_check_true( Variable_GetValueAtShort( vec, i, 0 ) == (short)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsChar( vec, i, 0 ) == (char)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsInt( vec, i, 0 ) == (int)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsFloat( vec, i, 0 ) == (float)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsDouble( vec, i, 0 ) == (double)(short)testValue );
-         pcu_check_true( Variable_GetPtrAtShort( vec, i, 0 ) == &structArray[i][0] );
-
-         pcu_check_true( Variable_GetValueAtShort( vec, i, 1 ) == (short)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsChar( vec, i, 1 ) == (char)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsInt( vec, i, 1 ) == (int)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsFloat( vec, i, 1 ) == (float)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsDouble( vec, i, 1 ) == (double)(short)testValue );
-         pcu_check_true( Variable_GetPtrAtShort( vec, i, 1 ) == &structArray[i][1] );
-
-         pcu_check_true( Variable_GetValueAtShort( vec, i, 2 ) == (short)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsChar( vec, i, 2 ) == (char)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsInt( vec, i, 2 ) == (int)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsFloat( vec, i, 2 ) == (float)(short)testValue );
-         pcu_check_true( Variable_GetValueAtShortAsDouble( vec, i, 2 ) == (double)(short)testValue );
-         pcu_check_true( Variable_GetPtrAtShort( vec, i, 2 ) == &structArray[i][2] );
-      }
-
-      for ( i = 0; i < length; ++i ) {
-         for ( j = 0; j < 3; ++j ) {
-            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
-         }
-      }
-   }
-}
-
-
-/* A few typedefs needed for the next test */
-#define VECTOR_DATA_COUNT 3
-typedef double Triple[VECTOR_DATA_COUNT];
-
-struct ComplexStuff {
-	int x;
-	float y;
-	char z; /* variablise the y and z member */
-};
-typedef struct ComplexStuff ComplexStuff;
-
-struct MockContext {
-	float*               scalars;
-	Index                scalarCount;
-	Triple*              vectors;
-	Index                vectorCount;
-	ComplexStuff*        stuff;
-	Index                stuffCount;
-	SizeT                complexStuffSize;
-   Variable_Register*   vr;
-};
-typedef struct MockContext MockContext;
-
-void VariableSuite_TestVariableCopy( VariableSuiteData* data ) {
-   MockContext*         ctx1 = NULL;
-   MockContext*         ctx2 = NULL;
-	Variable*            scalar = NULL;
-	Variable*            vector = NULL;
-	Variable*            complexStuff = NULL;
-   PtrMap*              ptrMap = PtrMap_New( 10 );
-   Index                ii=0;
-   Index                jj=0;
-   Index                var_I=0;
-
-
-   ctx1 = Memory_Alloc( MockContext, "ctx1" );
-   ctx2 = Memory_Alloc( MockContext, "ctx2" );
-
-	ctx1->scalarCount = 10;
-	ctx1->vectorCount = 10;
-	ctx1->stuffCount = 10;
-	ctx1->complexStuffSize = sizeof( ComplexStuff );
-
-	ctx1->scalars = Memory_Alloc_Array( float, ctx1->scalarCount, "ctx1->scalars" );
-	ctx1->vectors = Memory_Alloc_Array( Triple, ctx1->vectorCount, "ctx1->vectors" );
-	ctx1->stuff = Memory_Alloc_Array( ComplexStuff, ctx1->stuffCount, "ctx1->stuff" );
-
-   ctx1->vr = Variable_Register_New();
-
-	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 };
-		Variable_DataType dataTypes[] = { Variable_DataType_Float, Variable_DataType_Char };
-		Index dataTypeCounts[] = { 1, 1 };
-		const char* dataNames[] = { "complexY", "complexZ" };
-		
-		dataOffsets[0] = (ArithPointer)&tmp.y - (ArithPointer)&tmp;
-		dataOffsets[1] = (ArithPointer)&tmp.z - (ArithPointer)&tmp;
-
-		Variable_New( "Complex", NULL, 2, dataOffsets, dataTypes, dataTypeCounts, (Name*)dataNames, &(ctx1->complexStuffSize), &(ctx1->stuffCount), NULL, (void**)&(ctx1->stuff), ctx1->vr );
-	}
-
-	Variable_Register_BuildAll( ctx1->vr );
-
-   scalar = Variable_Register_GetByName( ctx1->vr, "Scalar" );
-	vector = Variable_Register_GetByName( ctx1->vr, "Vector" );
-	complexStuff = Variable_Register_GetByName( ctx1->vr, "Complex" );
-
-   for ( ii = 0; ii < ctx1->scalarCount; ++ii ) {
-      Variable_SetValueFloat( scalar, ii, (float)ii );
-   }
-   for ( ii = 0; ii < ctx1->vectorCount; ++ii ) {
-      Variable_SetValueAtDouble( vector, ii, 0, (double)ii );
-      Variable_SetValueAtDouble( vector, ii, 1, (double)ii );
-      Variable_SetValueAtDouble( vector, ii, 2, (double)ii );
-   }
-   for ( ii = 0; ii < ctx1->stuffCount; ++ii ) {
-     ComplexStuff* stuff = (ComplexStuff*)Variable_GetStructPtr( complexStuff, ii );
-      stuff->y = (float)ii;
-      stuff->z = '0' + ii;
-   }
-
-	/* Indicate the area of memory which is given for data so that Variables can attach to it */
-	PtrMap_Append( ptrMap, &(ctx1->scalars), &(ctx2->scalars) );
-	PtrMap_Append( ptrMap, &(ctx1->vectors), &(ctx2->vectors) );
-	PtrMap_Append( ptrMap, &(ctx1->stuff), &(ctx2->stuff) );
-	
-	PtrMap_Append( ptrMap, &(ctx1->scalarCount), &(ctx2->scalarCount) );
-	PtrMap_Append( ptrMap, &(ctx1->vectorCount), &(ctx2->vectorCount) );
-	PtrMap_Append( ptrMap, &(ctx1->stuffCount), &(ctx2->stuffCount) );
-	PtrMap_Append( ptrMap, &(ctx1->complexStuffSize), &(ctx2->complexStuffSize) );
-
-	ctx2->scalars = Memory_Alloc_Array( float, ctx1->scalarCount, "scalars" );
-	ctx2->vectors = Memory_Alloc_Array( Triple, ctx1->vectorCount, "vectors" );
-	ctx2->stuff = Memory_Alloc_Array( ComplexStuff, ctx1->stuffCount, "stuff" );
-	PtrMap_Append( ptrMap, ctx1->scalars, ctx2->scalars );
-	PtrMap_Append( ptrMap, ctx1->vectors, ctx2->vectors );
-	PtrMap_Append( ptrMap, ctx1->stuff, ctx2->stuff );
-
-   /* Doing a copy of the whole Variable Register, should trigger a copy of the values in all the variables */
-	ctx2->vr = (Variable_Register*)Stg_Class_Copy( ctx1->vr, NULL, True, NULL, ptrMap );
-
-   /* test equality of copy */
-   for ( ii = 0; ii < ctx1->scalarCount; ++ii ) {
-      pcu_check_true( ctx1->scalars[ii] == ctx2->scalars[ii] );
-   }
-   for ( ii = 0; ii < ctx1->vectorCount; ++ii ) {
-      for ( jj = 0; jj < VECTOR_DATA_COUNT; ++jj ) {
-         pcu_check_true( ctx1->vectors[ii][jj] == ctx2->vectors[ii][jj] );
-      }
-   }
-   for ( ii = 0; ii < ctx1->stuffCount; ++ii ) {
-      pcu_check_true( ctx1->stuff->y == ctx2->stuff->y );
-      pcu_check_true( ctx1->stuff->z == ctx2->stuff->z );
-   }
-
-   /* Clean up */
-	for ( var_I = 0; var_I < ctx1->vr->count; ++var_I ) {
-		Stg_Class_Delete( ctx1->vr->_variable[var_I] );
-	}
-	Memory_Free( ctx1->scalars );
-	Memory_Free( ctx1->vectors );
-	Memory_Free( ctx1->stuff );
-	Stg_Class_Delete( ctx1->vr );
-	Memory_Free( ctx1 );
-	for ( var_I = 0; var_I < ctx2->vr->count; ++var_I ) {
-		Stg_Class_Delete( ctx2->vr->_variable[var_I] );
-	}
-	Memory_Free( ctx2->scalars );
-	Memory_Free( ctx2->vectors );
-	Memory_Free( ctx2->stuff );
-	Stg_Class_Delete( ctx2->vr );
-	Memory_Free( ctx2 );
-}
-
-
-void VariableSuite_TestVariableValueCompare( VariableSuiteData* data ) {
-   Variable*           orig;
-   Variable*           compare;
-   double*             dataArray;
-   double*             dataArray2;
-   Index               arrayCount      = 150;
-   Index               componentCount  = 4;
-   Index               index;
-   double              amp             = 0.1;
-   double              tolerance       = 0.04;
-
-   dataArray = Memory_Alloc_Array( double, arrayCount * componentCount, "test" );
-   dataArray2 = Memory_Alloc_Array( double, arrayCount * componentCount, "test" );
-   for( index = 0; index < arrayCount * componentCount; index++ ) {
-      dataArray[index] = 1.0f / (arrayCount+2) * (index+1); 
-      dataArray2[ index ] = dataArray[ index ] + amp * cos( index );
-   }		
-   
-   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 );
-
-   pcu_check_true( abs( 0.030987 - Variable_ValueCompare( orig, compare ) ) < 0.00001 );
-   pcu_check_true( True == Variable_ValueCompareWithinTolerance( orig, compare, tolerance ) );
-
-   Memory_Free( dataArray );
-   Memory_Free( dataArray2 );
-}
-
-
-void VariableSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, VariableSuiteData );
-   pcu_suite_setFixtures( suite, VariableSuite_Setup, VariableSuite_Teardown );
-   pcu_suite_addTest( suite, VariableSuite_TestGetValueDouble );
-   pcu_suite_addTest( suite, VariableSuite_TestSetValueDouble );
-   pcu_suite_addTest( suite, VariableSuite_TestGetValueAtDouble );
-   pcu_suite_addTest( suite, VariableSuite_TestSetValueAtDouble );
-   pcu_suite_addTest( suite, VariableSuite_TestVariable_Char );
-   pcu_suite_addTest( suite, VariableSuite_TestVariable_Double );
-   pcu_suite_addTest( suite, VariableSuite_TestVariable_Float );
-   pcu_suite_addTest( suite, VariableSuite_TestVariable_Int );
-   pcu_suite_addTest( suite, VariableSuite_TestVariable_Short );
-   pcu_suite_addTest( suite, VariableSuite_TestVariableCopy );
-   pcu_suite_addTest( suite, VariableSuite_TestVariableValueCompare );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/VariableSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/VariableSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,830 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "VariableSuite.h"
+
+typedef double VectorD[3];
+typedef double VectorF[3];
+
+typedef struct {
+   int      mass;
+   VectorF  force;
+   short    num;
+   char*    info;
+} Particle;
+
+typedef struct {
+   Variable_Register*      vr;
+   Index                   aSize[3];
+   double*                 temperature;
+   VectorD*                velocity;
+   Particle*               particle;
+} VariableSuiteData;
+
+
+
+void VariableSuite_Setup( VariableSuiteData* data ) {
+   Particle                tmpParticle;
+   const char*                    pNames[] = { "mass", "force", "info" };
+   SizeT                   pOffsets[] = { 0, 0, 0 };   /* Init later... */
+   Variable_DataType       pDataTypes[] = {
+                              Variable_DataType_Int,
+                              Variable_DataType_Float,
+                              Variable_DataType_Pointer, };
+   Index                   pDtCounts[] = { 1, 3, 1 };
+   static SizeT            pSize = sizeof(Particle);
+   
+   data->aSize[0] = 16;
+   data->aSize[1] = 16;
+   data->aSize[2] = 16;
+
+   pOffsets[0] = (ArithPointer)&tmpParticle.mass - (ArithPointer)&tmpParticle;
+   pOffsets[1] = (ArithPointer)&tmpParticle.force - (ArithPointer)&tmpParticle;
+   pOffsets[2] = (ArithPointer)&tmpParticle.info - (ArithPointer)&tmpParticle;
+
+   /* Construction phase --------------------------------------------------------------------------------------------*/
+   data->vr = Variable_Register_New();
+   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, (Name*)pNames, &pSize, &data->aSize[2], NULL, (void**)&data->particle, data->vr );
+   
+   /* Build phase ---------------------------------------------------------------------------------------------------*/
+   data->temperature = Memory_Alloc_Array( double, data->aSize[0], "temperature" );
+   data->velocity = Memory_Alloc_Array( VectorD, data->aSize[1], "velocity" );
+   data->particle = Memory_Alloc_Array( Particle, data->aSize[2], "array" );
+   
+   Variable_Register_BuildAll( data->vr );
+}
+
+
+void VariableSuite_Teardown( VariableSuiteData* data ) {
+   Variable_Index          var_I;
+
+   /* manually delete all the created Variables */
+   for( var_I = 0; var_I < data->vr->count; var_I++ ) {
+      Stg_Class_Delete( data->vr->_variable[var_I] );
+   }
+   
+   Memory_Free( data->particle );
+   Memory_Free( data->velocity );
+   Memory_Free( data->temperature );
+}
+
+
+void VariableSuite_TestGetValueDouble( VariableSuiteData* data ) {
+   Index                   ii;
+   double tmp;
+   Variable*      var = Variable_Register_GetByName( data->vr, "temperature" );
+
+   /* Test the Get and Set of a scalar double....................................................................... */
+   /* Fill the temperature array with a known pattern of kinda random (bit filling) numbers. */
+   for( ii = 0; ii < data->aSize[0]; ii++ ) {
+      data->temperature[ii] = 1.0f / (data->aSize[0]+2) * (ii+1); 
+   }
+   
+   /* Check that Variable_GetValueDouble on the temperature Variable returns the right numbers */
+   for( ii = 0; ii < data->aSize[0]; ii++ ) {
+      tmp = 1.0f / (data->aSize[0]+2) * (ii+1);
+
+      pcu_check_true( fabs(Variable_GetValueDouble( var, ii ) - tmp ) < 1e-12);
+   }
+}
+   
+
+void VariableSuite_TestSetValueDouble( VariableSuiteData* data ) {
+   Index                   ii;
+   double tmp;
+   Variable*      var = Variable_Register_GetByName( data->vr, "temperature" );
+
+   /* Fill the temperature Variable with another known pattern of kinda random (bit filling) numbers */
+   for( ii = 0; ii < data->aSize[0]; ii++ ) {
+      
+      Variable_SetValueDouble( var, ii, 1.0f - ( 1.0f / (data->aSize[0]+2) * (ii+1) ) );
+   }
+   
+   /* Check that Variable_SetValueDouble on the temperature Variable set the right numbers */
+   for( ii = 0; ii < data->aSize[0]; ii++ ) {
+      tmp = 1.0f - 1.0f / (data->aSize[0]+2) * (ii+1);
+      
+      pcu_check_true( fabs(data->temperature[ii] - tmp ) < 1e-12);
+   }
+}
+   
+
+/* Test the Get and Set of a vector double....................................................................... */
+void VariableSuite_TestGetValueAtDouble( VariableSuiteData* data ) {
+   Index                   ii;
+   double tmp;
+   Variable*      var = Variable_Register_GetByName( data->vr, "velocity" );
+
+/* Fill the velocity array with a known pattern of kinda random (bit filling) numbers. */
+   for( ii = 0; ii < data->aSize[1]; ii++ ) {
+      int         d;
+      
+      for( d = 0; d < 3; d++ ) {
+         data->velocity[ii][d] = 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1); 
+      }
+   }
+   
+   /* Check that Variable_GetPtrDouble on the velocity Variable returns the right numbers */
+   for( ii = 0; ii < data->aSize[1]; ii++ ) {
+      int         d;
+      
+      for( d = 0; d < 3; d++ ) {
+         tmp = 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1);
+         
+         pcu_check_true( fabs(Variable_GetValueAtDouble(var, ii, d ) - tmp) < 1e-12);
+      }
+   }
+}
+
+
+void VariableSuite_TestSetValueAtDouble( VariableSuiteData* data ) {
+   Index                   ii;
+   double tmp;
+   int d;
+   Variable*      var = Variable_Register_GetByName( data->vr, "velocity" );
+
+   /* Fill the variable Variable with another known pattern of kinda random (bit filling) numbers */
+   for( ii = 0; ii < data->aSize[1]; ii++ ) {
+      
+      for( d = 0; d < 3; d++ ) {
+         Variable_SetValueAtDouble( var, ii, d, 1.0 - ( 1.0 / ((data->aSize[1]*3)+2) * (ii*3+d+1) ) );
+      }
+   }
+   
+   /* Check that Variable_SetValueDouble on the velocity Variable set the right numbers */
+   for( ii = 0; ii < data->aSize[1]; ii++ ) {
+      
+      for( d = 0; d < 3; d++ ) {
+         tmp = 1.0 - ( 1.0 / ((data->aSize[1]*3)+2) * (ii*3+d+1) );
+         
+         pcu_check_true( data->velocity[ii][d]-tmp < 1e-12 );
+      }
+   }
+}
+
+   
+/* TODO: try out vx, vy, vz, complex tests */
+
+void VariableSuite_TestVariable_Char( VariableSuiteData* data ) {
+   typedef char Triple[3];
+   char* array;
+   Triple* structArray;
+   Index length = 10;
+   /* List of values to test the variable with.
+    * Values to test are hex 5's and a's because they are a series of 0101 and 1010 respectively so they test
+    * each bit in memory to read/set.
+    */
+   long int testValues[] = { 0x55, 0xaa };
+   Index testValueCount = 2;
+   Index test_I;
+   long int testValue;
+   Variable* var;
+   Variable* vec;
+   Variable* vecVar[3];
+   Index i, j;
+
+   array = Memory_Alloc_Array( char, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   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" );
+
+   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
+   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
+   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
+
+   Variable_Register_BuildAll( data->vr );
+
+   for ( test_I = 0; test_I < testValueCount; ++test_I ) {
+
+      testValue = testValues[test_I];
+
+      for ( i = 0; i < length; ++i ) {
+         Variable_SetValueChar( var, i, testValue );
+         Variable_SetValueAtChar( vec, i, 0, testValue );
+         Variable_SetValueAtChar( vec, i, 1, testValue );
+         Variable_SetValueAtChar( vec, i, 2, testValue );
+      }
+
+      /* ~~~Scalar~~~*/
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueChar( var, i ) == (char)(char)testValue );
+         pcu_check_true( Variable_GetValueCharAsShort( var, i ) == (short)(char)testValue );
+         pcu_check_true( Variable_GetValueCharAsInt( var, i ) == (int)(char)testValue );
+         pcu_check_true( Variable_GetValueCharAsFloat( var, i ) == (float)(char)testValue );
+         pcu_check_true( Variable_GetValueCharAsDouble( var, i ) == (double)(char)testValue );
+      }
+
+      /*~~~Vector~~~*/
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueAtChar( vec, i, 0 ) == (char)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsShort( vec, i, 0 ) == (short)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsInt( vec, i, 0 ) == (int)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsFloat( vec, i, 0 ) == (float)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsDouble( vec, i, 0 ) == (double)(char)testValue );
+
+         pcu_check_true( Variable_GetPtrAtChar( vec, i, 0 ) == &structArray[i][0] );
+
+         pcu_check_true( Variable_GetValueAtChar( vec, i, 1 ) == (char)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsShort( vec, i, 1 ) == (short)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsInt( vec, i, 1 ) == (int)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsFloat( vec, i, 1 ) == (float)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsDouble( vec, i, 1 ) == (double)(char)testValue );
+         pcu_check_true( Variable_GetPtrAtChar( vec, i, 1 ) == &structArray[i][1] );
+
+         pcu_check_true( Variable_GetValueAtChar( vec, i, 2 ) == (char)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsShort( vec, i, 2 ) == (short)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsInt( vec, i, 2 ) == (int)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsFloat( vec, i, 2 ) == (float)(char)testValue );
+         pcu_check_true( Variable_GetValueAtCharAsDouble( vec, i, 2 ) == (double)(char)testValue );
+         pcu_check_true( Variable_GetPtrAtChar( vec, i, 2 ) == &structArray[i][2] );
+      }
+
+      /*~~~Vector: Sub-Variable~~~*/
+      for ( i = 0; i < length; ++i ) {
+         for ( j = 0; j < 3; ++j ) {
+            pcu_check_true( _Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
+         }
+      }
+   }
+}
+
+
+void VariableSuite_TestVariable_Double( VariableSuiteData* data ) {
+   typedef double Triple[3];
+
+   double* array;
+   Triple* structArray;
+   Index length = 10;
+
+   double testValues[] = { 123456789.0, 0.987654321 };
+   Index testValueCount = 2;
+   Index test_I;
+   double testValue;
+
+   Variable* var;
+   Variable* vec;
+   Variable* vecVar[3];
+
+   Index i, j;
+
+   array = Memory_Alloc_Array( double, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   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" );
+
+   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
+   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
+   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
+
+   Variable_Register_BuildAll( data->vr );
+
+
+   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
+
+      testValue = testValues[test_I];
+
+      for ( i = 0; i < length; ++i ) {
+         Variable_SetValueDouble( var, i, testValue );
+
+         Variable_SetValueAtDouble( vec, i, 0, testValue );
+         Variable_SetValueAtDouble( vec, i, 1, testValue );
+         Variable_SetValueAtDouble( vec, i, 2, testValue );
+      }
+
+      /* "~~~Scalar~~~\n" */
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueDouble( var, i ) == (double)(double)testValue );
+         pcu_check_true( Variable_GetValueDoubleAsChar( var, i ) == (char)(double)testValue );
+         pcu_check_true( Variable_GetValueDoubleAsShort( var, i ) == (short)(double)testValue );
+         pcu_check_true( Variable_GetValueDoubleAsInt( var, i ) == (int)(double)testValue );
+         pcu_check_true( Variable_GetValueDoubleAsFloat( var, i ) == (float)(double)testValue );
+      }
+
+      /*~~~Vector~~~*/
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueAtDouble( vec, i, 0 ) == (double)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsChar( vec, i, 0 ) == (char)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsShort( vec, i, 0 ) == (short)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsInt( vec, i, 0 ) == (int)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsFloat( vec, i, 0 ) == (float)(double)testValue );
+         pcu_check_true( Variable_GetPtrAtDouble( vec, i, 0 ) == &structArray[i][0] );
+
+         pcu_check_true( Variable_GetValueAtDouble( vec, i, 1 ) == (double)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsChar( vec, i, 1 ) == (char)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsShort( vec, i, 1 ) == (short)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsInt( vec, i, 1 ) == (int)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsFloat( vec, i, 1 ) == (float)(double)testValue );
+         pcu_check_true( Variable_GetPtrAtDouble( vec, i, 1 ) == &structArray[i][1] );
+
+         pcu_check_true( Variable_GetValueAtDouble( vec, i, 2 ) == (double)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsChar( vec, i, 2 ) == (char)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsShort( vec, i, 2 ) == (short)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsInt( vec, i, 2 ) == (int)(double)testValue );
+         pcu_check_true( Variable_GetValueAtDoubleAsFloat( vec, i, 2 ) == (float)(double)testValue );
+         pcu_check_true( Variable_GetPtrAtDouble( vec, i, 2 ) == &structArray[i][2] );
+      }
+
+      /*~~~Vector: Sub-Variable~~~*/
+      for ( i = 0; i < length; ++i ) {
+         for ( j = 0; j < 3; ++j ) {
+            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
+         }
+      }
+   }
+}
+
+
+void VariableSuite_TestVariable_Float( VariableSuiteData* data ) {
+   typedef float Triple[3];
+
+   float* array;
+   Triple* structArray;
+   Index length = 10;
+
+   float testValues[] = { 123456789.0, 0.987654321 };
+   Index testValueCount = 2;
+   Index test_I;
+   float testValue;
+
+   Variable* var;
+   Variable* vec;
+   Variable* vecVar[3];
+
+   Index i, j;
+
+   array = Memory_Alloc_Array( float, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   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" );
+
+   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
+   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
+   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
+
+   Variable_Register_BuildAll( data->vr );
+
+   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
+      testValue = testValues[test_I];
+
+      for ( i = 0; i < length; ++i ) {
+         Variable_SetValueFloat( var, i, testValue );
+
+         Variable_SetValueAtFloat( vec, i, 0, testValue );
+         Variable_SetValueAtFloat( vec, i, 1, testValue );
+         Variable_SetValueAtFloat( vec, i, 2, testValue );
+      }
+      
+      /* "~~~Scalar~~~\n" */
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueFloat( var, i ) == (float)(float)testValue );
+         pcu_check_true( Variable_GetValueFloatAsChar( var, i ) == (float)(char)testValue );
+         pcu_check_true( Variable_GetValueFloatAsShort( var, i ) == (float)(short)testValue );
+         pcu_check_true( Variable_GetValueFloatAsInt( var, i ) == (float)(int)testValue );
+         pcu_check_true( Variable_GetValueFloatAsDouble( var, i ) == (double)(float)testValue );
+      }
+
+      /*~~~Vector~~~*/
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueAtFloat( vec, i, 0 ) == (float)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsChar( vec, i, 0 ) == (char)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsShort( vec, i, 0 ) == (short)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsInt( vec, i, 0 ) == (int)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsDouble( vec, i, 0 ) == (double)(float)testValue );
+         pcu_check_true( Variable_GetPtrAtFloat( vec, i, 0 ) == &structArray[i][0] );
+
+         pcu_check_true( Variable_GetValueAtFloat( vec, i, 1 ) == (float)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsChar( vec, i, 1 ) == (char)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsShort( vec, i, 1 ) == (short)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsInt( vec, i, 1 ) == (int)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsDouble( vec, i, 1 ) == (double)(float)testValue );
+         pcu_check_true( Variable_GetPtrAtFloat( vec, i, 1 ) == &structArray[i][1] );
+
+         pcu_check_true( Variable_GetValueAtFloat( vec, i, 2 ) == (float)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsChar( vec, i, 2 ) == (char)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsShort( vec, i, 2 ) == (short)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsInt( vec, i, 2 ) == (int)(float)testValue );
+         pcu_check_true( Variable_GetValueAtFloatAsDouble( vec, i, 2 ) == (double)(float)testValue );
+         pcu_check_true( Variable_GetPtrAtFloat( vec, i, 2 ) == &structArray[i][2] );
+      }
+
+      /*~~~Vector: Sub-Variable~~~*/
+      for ( i = 0; i < length; ++i ) {
+         for ( j = 0; j < 3; ++j ) {
+            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
+         }
+      }
+   }
+}
+
+
+void VariableSuite_TestVariable_Int( VariableSuiteData* data ) {
+   typedef int Triple[3];
+
+   int* array;
+   Triple* structArray;
+   Index length = 10;
+
+   /* List of values to test the variable with.
+    * Values to test are hex 5's and a's because they are a series of 0101 and 1010 respectively so they test
+    * each bit in memory to read/set.
+    */
+   long int testValues[] = { 0x55555555, 0xaaaaaaaa };
+   Index testValueCount = 2;
+   Index test_I;
+   long int testValue;
+
+   Variable* var;
+   Variable* vec;
+   Variable* vecVar[3];
+
+   Index i, j;
+
+   array = Memory_Alloc_Array( int, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   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" );
+
+   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
+   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
+   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
+
+   Variable_Register_BuildAll( data->vr );
+
+   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
+
+      testValue = testValues[test_I];
+
+      for ( i = 0; i < length; ++i ) {
+         Variable_SetValueInt( var, i, testValue );
+
+         Variable_SetValueAtInt( vec, i, 0, testValue );
+         Variable_SetValueAtInt( vec, i, 1, testValue );
+         Variable_SetValueAtInt( vec, i, 2, testValue );
+      }
+
+      /*~~~Scalar~~~*/
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueInt( var, i ) == (int)(int)testValue );
+         pcu_check_true( Variable_GetValueIntAsChar( var, i ) == (char)(int)testValue );
+         pcu_check_true( Variable_GetValueIntAsShort( var, i ) == (short)(int)testValue );
+         pcu_check_true( fabsf(Variable_GetValueIntAsFloat( var, i ) - (float)(int)testValue) < fabsf(0.00001*testValue) );
+         pcu_check_true( fabs(Variable_GetValueIntAsDouble( var, i ) - (double)(int)testValue) < fabs(0.00001*testValue) );
+      }
+
+      /*~~~Vector~~~*/
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueAtInt( vec, i, 0 ) == (int)(int)testValue );
+         pcu_check_true( Variable_GetValueAtIntAsChar( vec, i, 0 ) == (char)(int)testValue );
+         pcu_check_true( Variable_GetValueAtIntAsShort( vec, i, 0 ) == (short)(int)testValue );
+         pcu_check_true( fabsf(Variable_GetValueAtIntAsFloat( vec, i, 0 ) - (float)(int)testValue) < fabsf(0.00001*testValue) );
+         pcu_check_true( fabs(Variable_GetValueAtIntAsDouble( vec, i, 0 ) - (double)(int)testValue) < fabs(0.00001*testValue));
+         pcu_check_true( Variable_GetPtrAtInt( vec, i, 0 ) == &structArray[i][0] );
+
+         pcu_check_true( Variable_GetValueAtInt( vec, i, 1 ) == (int)(int)testValue );
+         pcu_check_true( Variable_GetValueAtIntAsChar( vec, i, 1 ) == (char)(int)testValue );
+         pcu_check_true( Variable_GetValueAtIntAsShort( vec, i, 1 ) == (short)(int)testValue );
+         pcu_check_true( fabsf(Variable_GetValueAtIntAsFloat( vec, i, 1 ) - (float)(int)testValue) < fabsf(0.00001*testValue) );
+         pcu_check_true( fabs(Variable_GetValueAtIntAsDouble( vec, i, 1 ) - (double)(int)testValue) < fabs(0.00001*testValue));
+         pcu_check_true( Variable_GetPtrAtInt( vec, i, 1 ) == &structArray[i][1] );
+
+         pcu_check_true( Variable_GetValueAtInt( vec, i, 2 ) == (int)(int)testValue );
+         pcu_check_true( Variable_GetValueAtIntAsChar( vec, i, 2 ) == (char)(int)testValue );
+         pcu_check_true( Variable_GetValueAtIntAsShort( vec, i, 2 ) == (short)(int)testValue );
+         pcu_check_true( fabsf(Variable_GetValueAtIntAsFloat( vec, i, 2 ) - (float)(int)testValue) < fabsf(0.00001*testValue));
+         pcu_check_true( fabs(Variable_GetValueAtIntAsDouble( vec, i, 2 ) - (double)(int)testValue) < fabs(0.0001*testValue));
+         pcu_check_true( Variable_GetPtrAtInt( vec, i, 2 ) == &structArray[i][2] );
+      }
+
+      /*~~~Vector: Sub-Variable~~~*/
+      for ( i = 0; i < length; ++i ) {
+         for ( j = 0; j < 3; ++j ) {
+            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
+         }
+      }
+   }
+}
+
+
+void VariableSuite_TestVariable_Short( VariableSuiteData* data ) {
+   typedef short Triple[3];
+
+   short* array;
+   Triple* structArray;
+   Index length = 10;
+
+   /* List of values to test the variable with.
+    * Values to test are hex 5's and a's because they are a series of 0101 and 1010 respectively so they test
+    * each bit in memory to read/set.
+    */
+   long int testValues[] = { 0x5555, 0xaaaa };
+   Index testValueCount = 2;
+   Index test_I;
+   long int testValue;
+
+   Variable* var;
+   Variable* vec;
+   Variable* vecVar[3];
+
+   Index i, j;
+
+   array = Memory_Alloc_Array( short, length, "test" );
+   structArray = Memory_Alloc_Array( Triple, length, "test" );
+
+   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" );
+
+   vecVar[0] = Variable_Register_GetByName( data->vr, "a" );
+   vecVar[1] = Variable_Register_GetByName( data->vr, "b" );
+   vecVar[2] = Variable_Register_GetByName( data->vr, "c" );
+
+   Variable_Register_BuildAll( data->vr );
+
+
+   for ( test_I = 0; test_I < testValueCount; ++test_I ) {	
+
+      testValue = testValues[test_I];
+
+
+      for ( i = 0; i < length; ++i ) {
+         Variable_SetValueShort( var, i, testValue );
+
+         Variable_SetValueAtShort( vec, i, 0, testValue );
+         Variable_SetValueAtShort( vec, i, 1, testValue );
+         Variable_SetValueAtShort( vec, i, 2, testValue );
+      }
+
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueShort( var, i ) == (short)(short)testValue );
+         pcu_check_true( Variable_GetValueShortAsChar( var, i ) == (char)(short)testValue );
+         pcu_check_true( Variable_GetValueShortAsInt( var, i ) == (int)(short)testValue );
+         pcu_check_true( Variable_GetValueShortAsFloat( var, i ) == (float)(short)testValue );
+         pcu_check_true( Variable_GetValueShortAsDouble( var, i ) == (double)(short)testValue );
+      }
+
+      for ( i = 0; i < length; ++i ) {
+         pcu_check_true( Variable_GetValueAtShort( vec, i, 0 ) == (short)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsChar( vec, i, 0 ) == (char)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsInt( vec, i, 0 ) == (int)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsFloat( vec, i, 0 ) == (float)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsDouble( vec, i, 0 ) == (double)(short)testValue );
+         pcu_check_true( Variable_GetPtrAtShort( vec, i, 0 ) == &structArray[i][0] );
+
+         pcu_check_true( Variable_GetValueAtShort( vec, i, 1 ) == (short)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsChar( vec, i, 1 ) == (char)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsInt( vec, i, 1 ) == (int)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsFloat( vec, i, 1 ) == (float)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsDouble( vec, i, 1 ) == (double)(short)testValue );
+         pcu_check_true( Variable_GetPtrAtShort( vec, i, 1 ) == &structArray[i][1] );
+
+         pcu_check_true( Variable_GetValueAtShort( vec, i, 2 ) == (short)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsChar( vec, i, 2 ) == (char)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsInt( vec, i, 2 ) == (int)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsFloat( vec, i, 2 ) == (float)(short)testValue );
+         pcu_check_true( Variable_GetValueAtShortAsDouble( vec, i, 2 ) == (double)(short)testValue );
+         pcu_check_true( Variable_GetPtrAtShort( vec, i, 2 ) == &structArray[i][2] );
+      }
+
+      for ( i = 0; i < length; ++i ) {
+         for ( j = 0; j < 3; ++j ) {
+            pcu_check_true( Variable_GetStructPtr( vecVar[j], i ) == &structArray[i][j] );
+         }
+      }
+   }
+}
+
+
+/* A few typedefs needed for the next test */
+#define VECTOR_DATA_COUNT 3
+typedef double Triple[VECTOR_DATA_COUNT];
+
+struct ComplexStuff {
+	int x;
+	float y;
+	char z; /* variablise the y and z member */
+};
+typedef struct ComplexStuff ComplexStuff;
+
+struct MockContext {
+	float*               scalars;
+	Index                scalarCount;
+	Triple*              vectors;
+	Index                vectorCount;
+	ComplexStuff*        stuff;
+	Index                stuffCount;
+	SizeT                complexStuffSize;
+   Variable_Register*   vr;
+};
+typedef struct MockContext MockContext;
+
+void VariableSuite_TestVariableCopy( VariableSuiteData* data ) {
+   MockContext*         ctx1 = NULL;
+   MockContext*         ctx2 = NULL;
+	Variable*            scalar = NULL;
+	Variable*            vector = NULL;
+	Variable*            complexStuff = NULL;
+   PtrMap*              ptrMap = PtrMap_New( 10 );
+   Index                ii=0;
+   Index                jj=0;
+   Index                var_I=0;
+
+
+   ctx1 = Memory_Alloc( MockContext, "ctx1" );
+   ctx2 = Memory_Alloc( MockContext, "ctx2" );
+
+	ctx1->scalarCount = 10;
+	ctx1->vectorCount = 10;
+	ctx1->stuffCount = 10;
+	ctx1->complexStuffSize = sizeof( ComplexStuff );
+
+	ctx1->scalars = Memory_Alloc_Array( float, ctx1->scalarCount, "ctx1->scalars" );
+	ctx1->vectors = Memory_Alloc_Array( Triple, ctx1->vectorCount, "ctx1->vectors" );
+	ctx1->stuff = Memory_Alloc_Array( ComplexStuff, ctx1->stuffCount, "ctx1->stuff" );
+
+   ctx1->vr = Variable_Register_New();
+
+	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 };
+		Variable_DataType dataTypes[] = { Variable_DataType_Float, Variable_DataType_Char };
+		Index dataTypeCounts[] = { 1, 1 };
+		const char* dataNames[] = { "complexY", "complexZ" };
+		
+		dataOffsets[0] = (ArithPointer)&tmp.y - (ArithPointer)&tmp;
+		dataOffsets[1] = (ArithPointer)&tmp.z - (ArithPointer)&tmp;
+
+		Variable_New( "Complex", NULL, 2, dataOffsets, dataTypes, dataTypeCounts, (Name*)dataNames, &(ctx1->complexStuffSize), &(ctx1->stuffCount), NULL, (void**)&(ctx1->stuff), ctx1->vr );
+	}
+
+	Variable_Register_BuildAll( ctx1->vr );
+
+   scalar = Variable_Register_GetByName( ctx1->vr, "Scalar" );
+	vector = Variable_Register_GetByName( ctx1->vr, "Vector" );
+	complexStuff = Variable_Register_GetByName( ctx1->vr, "Complex" );
+
+   for ( ii = 0; ii < ctx1->scalarCount; ++ii ) {
+      Variable_SetValueFloat( scalar, ii, (float)ii );
+   }
+   for ( ii = 0; ii < ctx1->vectorCount; ++ii ) {
+      Variable_SetValueAtDouble( vector, ii, 0, (double)ii );
+      Variable_SetValueAtDouble( vector, ii, 1, (double)ii );
+      Variable_SetValueAtDouble( vector, ii, 2, (double)ii );
+   }
+   for ( ii = 0; ii < ctx1->stuffCount; ++ii ) {
+     ComplexStuff* stuff = (ComplexStuff*)Variable_GetStructPtr( complexStuff, ii );
+      stuff->y = (float)ii;
+      stuff->z = '0' + ii;
+   }
+
+	/* Indicate the area of memory which is given for data so that Variables can attach to it */
+	PtrMap_Append( ptrMap, &(ctx1->scalars), &(ctx2->scalars) );
+	PtrMap_Append( ptrMap, &(ctx1->vectors), &(ctx2->vectors) );
+	PtrMap_Append( ptrMap, &(ctx1->stuff), &(ctx2->stuff) );
+	
+	PtrMap_Append( ptrMap, &(ctx1->scalarCount), &(ctx2->scalarCount) );
+	PtrMap_Append( ptrMap, &(ctx1->vectorCount), &(ctx2->vectorCount) );
+	PtrMap_Append( ptrMap, &(ctx1->stuffCount), &(ctx2->stuffCount) );
+	PtrMap_Append( ptrMap, &(ctx1->complexStuffSize), &(ctx2->complexStuffSize) );
+
+	ctx2->scalars = Memory_Alloc_Array( float, ctx1->scalarCount, "scalars" );
+	ctx2->vectors = Memory_Alloc_Array( Triple, ctx1->vectorCount, "vectors" );
+	ctx2->stuff = Memory_Alloc_Array( ComplexStuff, ctx1->stuffCount, "stuff" );
+	PtrMap_Append( ptrMap, ctx1->scalars, ctx2->scalars );
+	PtrMap_Append( ptrMap, ctx1->vectors, ctx2->vectors );
+	PtrMap_Append( ptrMap, ctx1->stuff, ctx2->stuff );
+
+   /* Doing a copy of the whole Variable Register, should trigger a copy of the values in all the variables */
+	ctx2->vr = (Variable_Register*)Stg_Class_Copy( ctx1->vr, NULL, True, NULL, ptrMap );
+
+   /* test equality of copy */
+   for ( ii = 0; ii < ctx1->scalarCount; ++ii ) {
+      pcu_check_true( ctx1->scalars[ii] == ctx2->scalars[ii] );
+   }
+   for ( ii = 0; ii < ctx1->vectorCount; ++ii ) {
+      for ( jj = 0; jj < VECTOR_DATA_COUNT; ++jj ) {
+         pcu_check_true( ctx1->vectors[ii][jj] == ctx2->vectors[ii][jj] );
+      }
+   }
+   for ( ii = 0; ii < ctx1->stuffCount; ++ii ) {
+      pcu_check_true( ctx1->stuff->y == ctx2->stuff->y );
+      pcu_check_true( ctx1->stuff->z == ctx2->stuff->z );
+   }
+
+   /* Clean up */
+	for ( var_I = 0; var_I < ctx1->vr->count; ++var_I ) {
+		Stg_Class_Delete( ctx1->vr->_variable[var_I] );
+	}
+	Memory_Free( ctx1->scalars );
+	Memory_Free( ctx1->vectors );
+	Memory_Free( ctx1->stuff );
+	Stg_Class_Delete( ctx1->vr );
+	Memory_Free( ctx1 );
+	for ( var_I = 0; var_I < ctx2->vr->count; ++var_I ) {
+		Stg_Class_Delete( ctx2->vr->_variable[var_I] );
+	}
+	Memory_Free( ctx2->scalars );
+	Memory_Free( ctx2->vectors );
+	Memory_Free( ctx2->stuff );
+	Stg_Class_Delete( ctx2->vr );
+	Memory_Free( ctx2 );
+}
+
+
+void VariableSuite_TestVariableValueCompare( VariableSuiteData* data ) {
+   Variable*           orig;
+   Variable*           compare;
+   double*             dataArray;
+   double*             dataArray2;
+   Index               arrayCount      = 150;
+   Index               componentCount  = 4;
+   Index               index;
+   double              amp             = 0.1;
+   double              tolerance       = 0.04;
+
+   dataArray = Memory_Alloc_Array( double, arrayCount * componentCount, "test" );
+   dataArray2 = Memory_Alloc_Array( double, arrayCount * componentCount, "test" );
+   for( index = 0; index < arrayCount * componentCount; index++ ) {
+      dataArray[index] = 1.0f / (arrayCount+2) * (index+1); 
+      dataArray2[ index ] = dataArray[ index ] + amp * cos( index );
+   }		
+   
+   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 );
+
+   pcu_check_true( abs( 0.030987 - Variable_ValueCompare( orig, compare ) ) < 0.00001 );
+   pcu_check_true( True == Variable_ValueCompareWithinTolerance( orig, compare, tolerance ) );
+
+   Memory_Free( dataArray );
+   Memory_Free( dataArray2 );
+}
+
+
+void VariableSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, VariableSuiteData );
+   pcu_suite_setFixtures( suite, VariableSuite_Setup, VariableSuite_Teardown );
+   pcu_suite_addTest( suite, VariableSuite_TestGetValueDouble );
+   pcu_suite_addTest( suite, VariableSuite_TestSetValueDouble );
+   pcu_suite_addTest( suite, VariableSuite_TestGetValueAtDouble );
+   pcu_suite_addTest( suite, VariableSuite_TestSetValueAtDouble );
+   pcu_suite_addTest( suite, VariableSuite_TestVariable_Char );
+   pcu_suite_addTest( suite, VariableSuite_TestVariable_Double );
+   pcu_suite_addTest( suite, VariableSuite_TestVariable_Float );
+   pcu_suite_addTest( suite, VariableSuite_TestVariable_Int );
+   pcu_suite_addTest( suite, VariableSuite_TestVariable_Short );
+   pcu_suite_addTest( suite, VariableSuite_TestVariableCopy );
+   pcu_suite_addTest( suite, VariableSuite_TestVariableValueCompare );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/Variable_RegisterSuite.c
--- a/Base/Context/tests/Variable_RegisterSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "StGermain/Base/Context/Context.h"
-#include "Variable_RegisterSuite.h"
-
-typedef struct {
-   Variable_Register*	reg;
-} Variable_RegisterSuiteData;
-
-
-void Variable_RegisterSuite_Setup( Variable_RegisterSuiteData* data ) {
-   data->reg = Variable_Register_New();
-}
-
-void Variable_RegisterSuite_Teardown( Variable_RegisterSuiteData* data ) {
-   Stg_Class_Delete( data->reg );
-}
-   
-
-void Variable_RegisterSuite_TestAddGet( Variable_RegisterSuiteData* data ) {
-   Variable*		var[10];
-   #define ARRAY_SIZE	4
-   #define STRUCT_SIZE	4
-   double			array[ARRAY_SIZE];
-   Index			   arraySize = ARRAY_SIZE;
-   Name			   name[10] = {"testVar0", "testVar1", "testVar2", "testVar3",
-                  "testVar4", "testVar5", "testVar6", "testVar7",
-                  "testVar8", "testVar9"};
-   Index		   	i;
-
-   for (i = 0; i < 10; i++) {
-     var[i] = Variable_NewVector( (char*)(name[i]), NULL, Variable_DataType_Double, 4, &arraySize, NULL, (void**)&array, 0 );
-   }
-
-   for (i = 0; i < 10; i++)
-   {
-      Variable_Register_Add(data->reg, var[i]);
-   }
-
-   for (i = 0; i < 10; i++) {
-      pcu_check_true( i == Variable_Register_GetIndex(data->reg, name[i]));
-   }
-
-   for (i = 0; i < 10; i++) {
-      pcu_check_true( var[i] == Variable_Register_GetByName(data->reg, name[i]));
-   }
-
-   for (i = 0; i < 10; i++) {
-      Stg_Class_Delete(var[i]);
-   }
-}
-
-
-void Variable_RegisterSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, Variable_RegisterSuiteData );
-   pcu_suite_setFixtures( suite, Variable_RegisterSuite_Setup, Variable_RegisterSuite_Teardown );
-   pcu_suite_addTest( suite, Variable_RegisterSuite_TestAddGet );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Context/tests/Variable_RegisterSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Context/tests/Variable_RegisterSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,98 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "StGermain/Base/Context/Context.h"
+#include "Variable_RegisterSuite.h"
+
+typedef struct {
+   Variable_Register*	reg;
+} Variable_RegisterSuiteData;
+
+
+void Variable_RegisterSuite_Setup( Variable_RegisterSuiteData* data ) {
+   data->reg = Variable_Register_New();
+}
+
+void Variable_RegisterSuite_Teardown( Variable_RegisterSuiteData* data ) {
+   Stg_Class_Delete( data->reg );
+}
+   
+
+void Variable_RegisterSuite_TestAddGet( Variable_RegisterSuiteData* data ) {
+   Variable*		var[10];
+   #define ARRAY_SIZE	4
+   #define STRUCT_SIZE	4
+   double			array[ARRAY_SIZE];
+   Index			   arraySize = ARRAY_SIZE;
+   Name			   name[10] = {"testVar0", "testVar1", "testVar2", "testVar3",
+                  "testVar4", "testVar5", "testVar6", "testVar7",
+                  "testVar8", "testVar9"};
+   Index		   	i;
+
+   for (i = 0; i < 10; i++) {
+     var[i] = Variable_NewVector( (char*)(name[i]), NULL, Variable_DataType_Double, 4, &arraySize, NULL, (void**)&array, 0 );
+   }
+
+   for (i = 0; i < 10; i++)
+   {
+      Variable_Register_Add(data->reg, var[i]);
+   }
+
+   for (i = 0; i < 10; i++) {
+      pcu_check_true( i == Variable_Register_GetIndex(data->reg, name[i]));
+   }
+
+   for (i = 0; i < 10; i++) {
+      pcu_check_true( var[i] == Variable_Register_GetByName(data->reg, name[i]));
+   }
+
+   for (i = 0; i < 10; i++) {
+      Stg_Class_Delete(var[i]);
+   }
+}
+
+
+void Variable_RegisterSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, Variable_RegisterSuiteData );
+   pcu_suite_setFixtures( suite, Variable_RegisterSuite_Setup, Variable_RegisterSuite_Teardown );
+   pcu_suite_addTest( suite, Variable_RegisterSuite_TestAddGet );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/MockContext.c
--- a/Base/Extensibility/distributedtests/MockContext.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Plugins.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-
-#include "MockContext.h"
-
-const Type MockContext_Type = "MockContext";
-
-void* _MockContext_DefaultNew( Name name ) {
-	return NULL;
-}
-void _MockContext_AssignFromXML( void* c, Stg_ComponentFactory* cf, void* data ) {
-
-}
-void _MockContext_Build( void* c, void* data ) {
-
-}
-void _MockContext_Initialise( void* c, void* data ) {
-
-}
-void _MockContext_Execute( void* c, void* data ) {
-
-}
-void _MockContext_Destroy( void* c, void* data ) {
-
-}
-
-MockContext* MockContext_New( Dictionary* dictionary ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( MockContext );
-	Type                                                      type = "MockContext";
-	Stg_Class_DeleteFunction*                              _delete = _MockContext_Delete;
-	Stg_Class_PrintFunction*                                _print = NULL;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _MockContext_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _MockContext_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _MockContext_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _MockContext_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _MockContext_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _MockContext_Destroy;
-	Name                                                      name = "context";
-	AllocationType                              nameAllocationType = NON_GLOBAL;
-
-	MockContext* self;
-
-	self = (MockContext*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	self->plugins = PluginsManager_New();
-	ModulesManager_AddDirectory( "StGermain", LIB_DIR );
-	self->ep = EntryPoint_New( "TestEP", EntryPoint_VoidPtr_CastType );
-	self->em = ExtensionManager_New_OfExistingObject( "Context", self );
-
-	return self;
-}
-
-void _MockContext_Delete( void* context ) {
-	MockContext* self = (MockContext*)context;
-
-	Stg_Class_Delete( self->plugins );
-	Stg_Class_Delete( self->ep );
-	Stg_Class_Delete( self->em );
-	
-	_Stg_Class_Delete( self );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/MockContext.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/MockContext.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,102 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Plugins.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+
+#include "MockContext.h"
+
+const Type MockContext_Type = "MockContext";
+
+void* _MockContext_DefaultNew( Name name ) {
+	return NULL;
+}
+void _MockContext_AssignFromXML( void* c, Stg_ComponentFactory* cf, void* data ) {
+
+}
+void _MockContext_Build( void* c, void* data ) {
+
+}
+void _MockContext_Initialise( void* c, void* data ) {
+
+}
+void _MockContext_Execute( void* c, void* data ) {
+
+}
+void _MockContext_Destroy( void* c, void* data ) {
+
+}
+
+MockContext* MockContext_New( Dictionary* dictionary ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( MockContext );
+	Type                                                      type = "MockContext";
+	Stg_Class_DeleteFunction*                              _delete = _MockContext_Delete;
+	Stg_Class_PrintFunction*                                _print = NULL;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _MockContext_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _MockContext_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _MockContext_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _MockContext_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _MockContext_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _MockContext_Destroy;
+	Name                                                      name = "context";
+	AllocationType                              nameAllocationType = NON_GLOBAL;
+
+	MockContext* self;
+
+	self = (MockContext*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	self->plugins = PluginsManager_New();
+	ModulesManager_AddDirectory( "StGermain", LIB_DIR );
+	self->ep = EntryPoint_New( "TestEP", EntryPoint_VoidPtr_CastType );
+	self->em = ExtensionManager_New_OfExistingObject( "Context", self );
+
+	return self;
+}
+
+void _MockContext_Delete( void* context ) {
+	MockContext* self = (MockContext*)context;
+
+	Stg_Class_Delete( self->plugins );
+	Stg_Class_Delete( self->ep );
+	Stg_Class_Delete( self->em );
+	
+	_Stg_Class_Delete( self );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testDistributedPlugin.c
--- a/Base/Extensibility/distributedtests/testDistributedPlugin.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Plugins.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-                                                                                                                                    
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-
-#include "MockContext.h"
-
-
-int main( int argc, char* argv[] ) {
-	MPI_Comm CommWorld;
-	int rank;
-	int numProcessors;
-	Stream* stream;
-
-	MockContext* context;
-
-	Dictionary* dictionary;
-	IO_Handler* ioHandler;
-
-	Stg_ComponentFactory* cf;
-
-	/* Initialise MPI, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-
-	BaseFoundation_Init( &argc, &argv );
-	BaseIO_Init( &argc, &argv );
-	BaseContainer_Init( &argc, &argv );
-	BaseAutomation_Init( &argc, &argv );
-	BaseExtensibility_Init( &argc, &argv );
-
-        RegisterParent( MockContext_Type, Stg_Component_Type );
-
-	/* creating a stream */
-	stream =  Journal_Register( InfoStream_Type, __FILE__ );
-
-	dictionary = Dictionary_New();
-	ioHandler = (IO_Handler*)XML_IO_Handler_New();
-
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-
-	context = MockContext_New( dictionary );
-
-	/* Reuse our entry point as our context as well */
-
-	cf = Stg_ComponentFactory_New( dictionary, Dictionary_GetDictionary( dictionary, "components" ), Stg_ObjectList_New() );
-	LiveComponentRegister_Add( cf->LCRegister, (Stg_Component*)context );
-	ModulesManager_Load( context->plugins, dictionary );
-
-	Stg_ComponentFactory_CreateComponents( cf );
-	Stg_ComponentFactory_ConstructComponents( cf, 0 /* dummy */ );
-	ModulesManager_ConstructModules( context->plugins, cf, 0 /* dummy */ );
-
-	((EntryPoint_VoidPtr_CallCast*) context->ep->run)( context->ep, context );
-
-	Stg_Class_Print( context->plugins, stream );
-
-	Stg_Class_Delete( ioHandler );
-	Stg_Class_Delete( context );
-
-	BaseExtensibility_Finalise();
-	BaseAutomation_Finalise();
-	BaseContainer_Finalise();
-	BaseIO_Finalise();
-	BaseFoundation_Finalise();
-
-	/* Close off MPI */
-	MPI_Finalize();
-                                                                                                                                    
-
-	return 0;
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testDistributedPlugin.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/testDistributedPlugin.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,113 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Plugins.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+                                                                                                                                    
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+
+#include "MockContext.h"
+
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm CommWorld;
+	int rank;
+	int numProcessors;
+	Stream* stream;
+
+	MockContext* context;
+
+	Dictionary* dictionary;
+	IO_Handler* ioHandler;
+
+	Stg_ComponentFactory* cf;
+
+	/* Initialise MPI, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+
+	BaseFoundation_Init( &argc, &argv );
+	BaseIO_Init( &argc, &argv );
+	BaseContainer_Init( &argc, &argv );
+	BaseAutomation_Init( &argc, &argv );
+	BaseExtensibility_Init( &argc, &argv );
+
+        RegisterParent( MockContext_Type, Stg_Component_Type );
+
+	/* creating a stream */
+	stream =  Journal_Register( InfoStream_Type, __FILE__ );
+
+	dictionary = Dictionary_New();
+	ioHandler = (IO_Handler*)XML_IO_Handler_New();
+
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+
+	context = MockContext_New( dictionary );
+
+	/* Reuse our entry point as our context as well */
+
+	cf = Stg_ComponentFactory_New( dictionary, Dictionary_GetDictionary( dictionary, "components" ), Stg_ObjectList_New() );
+	LiveComponentRegister_Add( cf->LCRegister, (Stg_Component*)context );
+	ModulesManager_Load( context->plugins, dictionary );
+
+	Stg_ComponentFactory_CreateComponents( cf );
+	Stg_ComponentFactory_ConstructComponents( cf, 0 /* dummy */ );
+	ModulesManager_ConstructModules( context->plugins, cf, 0 /* dummy */ );
+
+	((EntryPoint_VoidPtr_CallCast*) context->ep->run)( context->ep, context );
+
+	Stg_Class_Print( context->plugins, stream );
+
+	Stg_Class_Delete( ioHandler );
+	Stg_Class_Delete( context );
+
+	BaseExtensibility_Finalise();
+	BaseAutomation_Finalise();
+	BaseContainer_Finalise();
+	BaseIO_Finalise();
+	BaseFoundation_Finalise();
+
+	/* Close off MPI */
+	MPI_Finalize();
+                                                                                                                                    
+
+	return 0;
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testPlugin.c
--- a/Base/Extensibility/distributedtests/testPlugin.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Plugins.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-                                                                                                                                    
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-
-#include <string.h>
-
-int main( int argc, char* argv[] ) {
-	MPI_Comm CommWorld;
-	int rank;
-	int numProcessors;
-	Stream* stream;
-
-	Stg_ObjectList* directories;
-	Plugin* plugin;
-
-	/* Initialise MPI, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-
-	BaseFoundation_Init( &argc, &argv );
-	BaseIO_Init( &argc, &argv );
-	BaseContainer_Init( &argc, &argv );
-	BaseAutomation_Init( &argc, &argv );
-	BaseExtensibility_Init( &argc, &argv );
-
-	/* creating a stream */
-	stream =  Journal_Register( Info_Type, __FILE__ );
-
-	directories = Stg_ObjectList_New();
-	Stg_ObjectList_PointerAppend( directories, StG_Strdup(LIB_DIR), "default dir", 0, 0, 0 );
-	
-	plugin = Plugin_New( "LocalPlugin", directories );
-
-	Journal_Firewall( plugin != NULL, stream, "Failed!\n" );
-
-	Journal_Printf( stream, "PluginLoader_GetName(): %s\n", Module_GetName( plugin ) );
-	Stg_Class_Print( plugin, stream );
-
-	Stg_Class_Delete( plugin );
-	Stg_Class_Delete( directories );
-	
-	BaseExtensibility_Finalise();
-	BaseAutomation_Finalise();
-	BaseContainer_Finalise();
-	BaseIO_Finalise();
-	BaseFoundation_Finalise();
-
-	/* Close off MPI */
-	MPI_Finalize();
-                                                                                                                                    
-
-	return 0;
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testPlugin.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/testPlugin.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,95 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Plugins.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+                                                                                                                                    
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+
+#include <string.h>
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm CommWorld;
+	int rank;
+	int numProcessors;
+	Stream* stream;
+
+	Stg_ObjectList* directories;
+	Plugin* plugin;
+
+	/* Initialise MPI, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+
+	BaseFoundation_Init( &argc, &argv );
+	BaseIO_Init( &argc, &argv );
+	BaseContainer_Init( &argc, &argv );
+	BaseAutomation_Init( &argc, &argv );
+	BaseExtensibility_Init( &argc, &argv );
+
+	/* creating a stream */
+	stream =  Journal_Register( Info_Type, __FILE__ );
+
+	directories = Stg_ObjectList_New();
+	Stg_ObjectList_PointerAppend( directories, StG_Strdup(LIB_DIR), "default dir", 0, 0, 0 );
+	
+	plugin = Plugin_New( "LocalPlugin", directories );
+
+	Journal_Firewall( plugin != NULL, stream, "Failed!\n" );
+
+	Journal_Printf( stream, "PluginLoader_GetName(): %s\n", Module_GetName( plugin ) );
+	Stg_Class_Print( plugin, stream );
+
+	Stg_Class_Delete( plugin );
+	Stg_Class_Delete( directories );
+	
+	BaseExtensibility_Finalise();
+	BaseAutomation_Finalise();
+	BaseContainer_Finalise();
+	BaseIO_Finalise();
+	BaseFoundation_Finalise();
+
+	/* Close off MPI */
+	MPI_Finalize();
+                                                                                                                                    
+
+	return 0;
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/LocalPlugin/LocalPlugin.c
--- a/Base/Extensibility/distributedtests/testplugins/LocalPlugin/LocalPlugin.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: LocalPlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "../../MockContext.h"
-
-/* Plugins/Codelets need a Type string. */
-const Type LocalPlugin_Type = "LocalPlugin";
-
-/* Define the plugin's class */
-typedef struct { __Codelet } LocalPlugin;
-
-
-/* This is what the plugin does */
-void LocalPlugin_Function( void* context ) {
-	printf( "%s\n", __func__ );
-}
-
-
-/* Plugins are components, so they need a Construct() function. This is where you add the entry points and extensions */
-void _LocalPlugin_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data );
-
-	EP_Append( context->ep, LocalPlugin_Function );
-}
-
-/* Plugins are compnents, so they need a DefaultNew() function. */
-void* _LocalPlugin_DefaultNew( Name name ) {
-	return Codelet_New(
-		LocalPlugin_Type,
-		_LocalPlugin_DefaultNew,
-		_LocalPlugin_AssignFromXML,
-		_Codelet_Build,
-		_Codelet_Initialise,
-		_Codelet_Execute,
-		_Codelet_Destroy,
-		name );
-}
-
-/* Plugins require a _Register() function for the plugin to be loaded. */
-
-Index LocalPlugin_Register( PluginsManager* pluginsManager ) {
-	return ModulesManager_Submit( pluginsManager, LocalPlugin_Type, "0", _LocalPlugin_DefaultNew );
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/LocalPlugin/LocalPlugin.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/testplugins/LocalPlugin/LocalPlugin.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,78 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: LocalPlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "../../MockContext.h"
+
+/* Plugins/Codelets need a Type string. */
+const Type LocalPlugin_Type = "LocalPlugin";
+
+/* Define the plugin's class */
+typedef struct { __Codelet } LocalPlugin;
+
+
+/* This is what the plugin does */
+void LocalPlugin_Function( void* context ) {
+	printf( "%s\n", __func__ );
+}
+
+
+/* Plugins are components, so they need a Construct() function. This is where you add the entry points and extensions */
+void _LocalPlugin_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data );
+
+	EP_Append( context->ep, LocalPlugin_Function );
+}
+
+/* Plugins are compnents, so they need a DefaultNew() function. */
+void* _LocalPlugin_DefaultNew( Name name ) {
+	return Codelet_New(
+		LocalPlugin_Type,
+		_LocalPlugin_DefaultNew,
+		_LocalPlugin_AssignFromXML,
+		_Codelet_Build,
+		_Codelet_Initialise,
+		_Codelet_Execute,
+		_Codelet_Destroy,
+		name );
+}
+
+/* Plugins require a _Register() function for the plugin to be loaded. */
+
+Index LocalPlugin_Register( PluginsManager* pluginsManager ) {
+	return ModulesManager_Submit( pluginsManager, LocalPlugin_Type, "0", _LocalPlugin_DefaultNew );
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin1.c
--- a/Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin1.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: LocalPlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "../../MockContext.h"
-
-const Type LocalPlugin1_Type = "LocalPlugin1";
-typedef struct { __Codelet } LocalPlugin1;
-
-void LocalPlugin1_Function( void* context ) {
-	MockContext* mockContext = (MockContext*)context;
-	int* ext2;
-
-	ext2 = ExtensionManager_Get(
-		mockContext->em,
-		mockContext,
-		ExtensionManager_GetHandle( mockContext->em, "LocalPlugin2" ) );
-	
-	printf( "%s()\n", __func__ );
-	printf( "LocalPlugin2 value: %d\n", *ext2 );
-}
-
-void _LocalPlugin1_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data );
-	
-	EP_Append( context->ep, LocalPlugin1_Function );
-}
-
-void* _LocalPlugin1_DefaultNew( Name name ) {
-	return Codelet_New(
-			LocalPlugin1_Type,
-			_LocalPlugin1_DefaultNew,
-			_LocalPlugin1_AssignFromXML,
-			_Codelet_Build,
-			_Codelet_Initialise,
-			_Codelet_Execute,
-			_Codelet_Destroy,
-			name );
-}
-
-Index LocalPlugin1_Register( PluginsManager* pluginsManager ) {
-	return ModulesManager_Submit( pluginsManager, LocalPlugin1_Type, "0", _LocalPlugin1_DefaultNew );
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin1.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin1.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,77 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: LocalPlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "../../MockContext.h"
+
+const Type LocalPlugin1_Type = "LocalPlugin1";
+typedef struct { __Codelet } LocalPlugin1;
+
+void LocalPlugin1_Function( void* context ) {
+	MockContext* mockContext = (MockContext*)context;
+	int* ext2;
+
+	ext2 = ExtensionManager_Get(
+		mockContext->em,
+		mockContext,
+		ExtensionManager_GetHandle( mockContext->em, "LocalPlugin2" ) );
+	
+	printf( "%s()\n", __func__ );
+	printf( "LocalPlugin2 value: %d\n", *ext2 );
+}
+
+void _LocalPlugin1_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data );
+	
+	EP_Append( context->ep, LocalPlugin1_Function );
+}
+
+void* _LocalPlugin1_DefaultNew( Name name ) {
+	return Codelet_New(
+			LocalPlugin1_Type,
+			_LocalPlugin1_DefaultNew,
+			_LocalPlugin1_AssignFromXML,
+			_Codelet_Build,
+			_Codelet_Initialise,
+			_Codelet_Execute,
+			_Codelet_Destroy,
+			name );
+}
+
+Index LocalPlugin1_Register( PluginsManager* pluginsManager ) {
+	return ModulesManager_Submit( pluginsManager, LocalPlugin1_Type, "0", _LocalPlugin1_DefaultNew );
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin2.c
--- a/Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin2.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: LocalPlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-#include "../../MockContext.h"
-
-const Type LocalPlugin2_Type = "LocalPlugin2";
-typedef struct { __Codelet } LocalPlugin2;
-
-void LocalPlugin2_Function() {
-	printf( "%s\n", __func__ );
-}
-
-void _LocalPlugin2_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data );
-	int* ext;
-
-	ExtensionManager_Add( context->em, "LocalPlugin2", sizeof(int) );
-
-	ext = ExtensionManager_Get(
-		context->em, 
-		context,
-		ExtensionManager_GetHandle( context->em, "LocalPlugin2" ) );
-	*ext = 2;
-	
-	EP_Append( context->ep, LocalPlugin2_Function );
-}
-
-void* _LocalPlugin2_DefaultNew( Name name ) {
-	return Codelet_New(
-		LocalPlugin2_Type,
-		_LocalPlugin2_DefaultNew,
-		_LocalPlugin2_AssignFromXML,
-		_Codelet_Build,
-		_Codelet_Initialise,
-		_Codelet_Execute,
-		_Codelet_Destroy,
-		name );
-}
-
-Index LocalPlugin2_Register( PluginsManager* pluginsManager ) {
-	return ModulesManager_Submit( pluginsManager, LocalPlugin2_Type, "0", _LocalPlugin2_DefaultNew );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin2.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/testplugins/LocalPluginDep/LocalPlugin2.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,76 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: LocalPlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+#include "../../MockContext.h"
+
+const Type LocalPlugin2_Type = "LocalPlugin2";
+typedef struct { __Codelet } LocalPlugin2;
+
+void LocalPlugin2_Function() {
+	printf( "%s\n", __func__ );
+}
+
+void _LocalPlugin2_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data );
+	int* ext;
+
+	ExtensionManager_Add( context->em, "LocalPlugin2", sizeof(int) );
+
+	ext = ExtensionManager_Get(
+		context->em, 
+		context,
+		ExtensionManager_GetHandle( context->em, "LocalPlugin2" ) );
+	*ext = 2;
+	
+	EP_Append( context->ep, LocalPlugin2_Function );
+}
+
+void* _LocalPlugin2_DefaultNew( Name name ) {
+	return Codelet_New(
+		LocalPlugin2_Type,
+		_LocalPlugin2_DefaultNew,
+		_LocalPlugin2_AssignFromXML,
+		_Codelet_Build,
+		_Codelet_Initialise,
+		_Codelet_Execute,
+		_Codelet_Destroy,
+		name );
+}
+
+Index LocalPlugin2_Register( PluginsManager* pluginsManager ) {
+	return ModulesManager_Submit( pluginsManager, LocalPlugin2_Type, "0", _LocalPlugin2_DefaultNew );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/RemotePlugin1.c
--- a/Base/Extensibility/distributedtests/testplugins/RemotePlugin1.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: RemotePlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-
-void RemotePlugin1_Function() {
-	printf( "%s\n", __func__ );
-}
-
-
-void RemotePlugin1_Register( void* entryPoint ) {
-
-	EP_Append( entryPoint, RemotePlugin1_Function );
-
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/distributedtests/testplugins/RemotePlugin1.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/distributedtests/testplugins/RemotePlugin1.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,48 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: RemotePlugin.c 3081 2005-07-08 08:24:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+
+void RemotePlugin1_Function() {
+	printf( "%s\n", __func__ );
+}
+
+
+void RemotePlugin1_Register( void* entryPoint ) {
+
+	EP_Append( entryPoint, RemotePlugin1_Function );
+
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ClassHook.c
--- a/Base/Extensibility/src/ClassHook.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ClassHook.c 2940 2005-05-15 00:53:19Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Hook.h"
-#include "ClassHook.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Textual name of this class */
-const Type ClassHook_Type = "ClassHook";
-
-/** allocate and initialise a new ClassHook. */
-ClassHook* ClassHook_New( Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(ClassHook);
-	Type                              type = ClassHook_Type;
-	Stg_Class_DeleteFunction*      _delete = _ClassHook_Delete;
-	Stg_Class_PrintFunction*        _print = _ClassHook_Print;
-	Stg_Class_CopyFunction*          _copy = _ClassHook_Copy;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _ClassHook_New(  CLASSHOOK_PASSARGS  );
-}
-
-void ClassHook_Init( void* hook, Name name, Func_Ptr funcPtr, const char* addedBy, void* reference ) {
-	ClassHook* self = (ClassHook*)hook;
-
-	/* General info */
-	self->type = ClassHook_Type;
-	self->_sizeOfSelf = sizeof(ClassHook);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ClassHook_Delete;
-	self->_print = _ClassHook_Print;
-	self->_copy = _ClassHook_Copy;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	_ClassHook_Init( self, funcPtr, addedBy, reference );
-}
-
-
-ClassHook* _ClassHook_New(  CLASSHOOK_DEFARGS  )
-{
-	ClassHook* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ClassHook) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (ClassHook*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* ClassHook info */
-	_ClassHook_Init( self, funcPtr, addedBy, reference );
-	
-	return self;
-}
-
-
-void _ClassHook_Init( ClassHook* self, Func_Ptr funcPtr, Name addedBy, void* reference ) {
-	/* General and Virtual info should already be set */
-	
-	/* ClassHook info */
-	_Hook_Init( (Hook*)self, funcPtr, addedBy );
-
-	self->reference = reference;
-}
-
-
-void _ClassHook_Delete( void* hook ) {
-	ClassHook* self = (ClassHook*)hook;
-	#if DEBUG
-		assert( self );
-	#endif	
-	
-	_Hook_Delete( self );
-}
-
-void _ClassHook_Print( void* hook, Stream* stream ) {
-	ClassHook* self = (ClassHook*)hook;
-	#if DEBUG
-		assert( self );
-		assert( stream );
-	#endif	
-	
-	/* General info */
-	_Hook_Print( self, stream );
-	Journal_Printf( (void*) stream, "\treference(ptr): %p\n", self->reference );
-	
-}
-
-
-void* _ClassHook_Copy( const void* hook, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	ClassHook*	self = (ClassHook*)hook;
-	ClassHook*	newClassHook;
-	
-	newClassHook = (ClassHook*)_Hook_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newClassHook->reference = Stg_Class_Copy( self->reference, dest, deep, nameExt, ptrMap );
-	
-	return (void*)newClassHook;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ClassHook.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ClassHook.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,154 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ClassHook.c 2940 2005-05-15 00:53:19Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Hook.h"
+#include "ClassHook.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Textual name of this class */
+const Type ClassHook_Type = "ClassHook";
+
+/** allocate and initialise a new ClassHook. */
+ClassHook* ClassHook_New( Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(ClassHook);
+	Type                              type = ClassHook_Type;
+	Stg_Class_DeleteFunction*      _delete = _ClassHook_Delete;
+	Stg_Class_PrintFunction*        _print = _ClassHook_Print;
+	Stg_Class_CopyFunction*          _copy = _ClassHook_Copy;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _ClassHook_New(  CLASSHOOK_PASSARGS  );
+}
+
+void ClassHook_Init( void* hook, Name name, Func_Ptr funcPtr, const char* addedBy, void* reference ) {
+	ClassHook* self = (ClassHook*)hook;
+
+	/* General info */
+	self->type = ClassHook_Type;
+	self->_sizeOfSelf = sizeof(ClassHook);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ClassHook_Delete;
+	self->_print = _ClassHook_Print;
+	self->_copy = _ClassHook_Copy;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	_ClassHook_Init( self, funcPtr, addedBy, reference );
+}
+
+
+ClassHook* _ClassHook_New(  CLASSHOOK_DEFARGS  )
+{
+	ClassHook* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ClassHook) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (ClassHook*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* ClassHook info */
+	_ClassHook_Init( self, funcPtr, addedBy, reference );
+	
+	return self;
+}
+
+
+void _ClassHook_Init( ClassHook* self, Func_Ptr funcPtr, Name addedBy, void* reference ) {
+	/* General and Virtual info should already be set */
+	
+	/* ClassHook info */
+	_Hook_Init( (Hook*)self, funcPtr, addedBy );
+
+	self->reference = reference;
+}
+
+
+void _ClassHook_Delete( void* hook ) {
+	ClassHook* self = (ClassHook*)hook;
+	#if DEBUG
+		assert( self );
+	#endif	
+	
+	_Hook_Delete( self );
+}
+
+void _ClassHook_Print( void* hook, Stream* stream ) {
+	ClassHook* self = (ClassHook*)hook;
+	#if DEBUG
+		assert( self );
+		assert( stream );
+	#endif	
+	
+	/* General info */
+	_Hook_Print( self, stream );
+	Journal_Printf( (void*) stream, "\treference(ptr): %p\n", self->reference );
+	
+}
+
+
+void* _ClassHook_Copy( const void* hook, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	ClassHook*	self = (ClassHook*)hook;
+	ClassHook*	newClassHook;
+	
+	newClassHook = (ClassHook*)_Hook_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newClassHook->reference = Stg_Class_Copy( self->reference, dest, deep, nameExt, ptrMap );
+	
+	return (void*)newClassHook;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ClassPtrExtensionInfo.c
--- a/Base/Extensibility/src/ClassPtrExtensionInfo.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ClassPtrExtensionInfo.c 2915 2005-05-08 12:51:46Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ExtensionManager.h"
-#include "ExtensionInfo.h"
-#include "ClassPtrExtensionInfo.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-/* Textual name of this class */
-const Type ClassPtrExtensionInfo_Type = "ClassPtrExtensionInfo";
-
-
-/** allocate and initialise a new ClassPtrExtensionInfo. */
-ClassPtrExtensionInfo* ClassPtrExtensionInfo_New( Name name, Stg_Class_CopyFunction* copyFunc, Index count ) {
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(ClassPtrExtensionInfo);
-	Type                                    type = ClassPtrExtensionInfo_Type;
-	Stg_Class_DeleteFunction*            _delete = _ClassPtrExtensionInfo_Delete;
-	Stg_Class_PrintFunction*              _print = _ClassPtrExtensionInfo_Print;
-	Stg_Class_CopyFunction*                _copy = _ClassPtrExtensionInfo_Copy;
-	ExtensionInfo_DataCopyFunction*    _dataCopy = _ClassPtrExtensionInfo_DataCopy;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-	SizeT                         size = ZERO;
-
-	return _ClassPtrExtensionInfo_New(  CLASSPTREXTENSIONINFO_PASSARGS  );
-}
-
-
-void ClassPtrExtensionInfo_Init( void* arrayExtensionInfo, Name name, Stg_Class_CopyFunction* copyFunc, Index count ) {
-	ClassPtrExtensionInfo* self = (ClassPtrExtensionInfo*)arrayExtensionInfo;
-
-	/* General info */
-	self->type = ClassPtrExtensionInfo_Type;
-	self->_sizeOfSelf = sizeof(ClassPtrExtensionInfo);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ClassPtrExtensionInfo_Delete;
-	self->_print = _ClassPtrExtensionInfo_Print;
-	self->_copy = _ClassPtrExtensionInfo_Copy;
-	self->_dataCopy = _ClassPtrExtensionInfo_DataCopy;
-	
-	/* ClassPtrExtensionInfo info */
-	_ClassPtrExtensionInfo_Init( self, name, copyFunc, count );
-}
-
-
-ClassPtrExtensionInfo* _ClassPtrExtensionInfo_New(  CLASSPTREXTENSIONINFO_DEFARGS  )
-{
-	ClassPtrExtensionInfo* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ClassPtrExtensionInfo) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	size = sizeof(ClassPtrExtensionInfo_PtrClass);
-
-	self = (ClassPtrExtensionInfo*)_ExtensionInfo_New(  EXTENSIONINFO_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* ClassPtrExtensionInfo info */
-	_ClassPtrExtensionInfo_Init( self, name, copyFunc, count );
-	
-	return self;
-}
-
-
-void _ClassPtrExtensionInfo_Init( ClassPtrExtensionInfo* self, Name name, Stg_Class_CopyFunction* copyFunc, Index count ) {
-	/* General and Virtual info should already be set */
-	/* ClassPtrExtensionInfo info */
-	_ExtensionInfo_Init( (ExtensionInfo*)self, name, sizeof(ClassPtrExtensionInfo_PtrClass), count );
-}
-
-
-void _ClassPtrExtensionInfo_Delete( void* arrayExtensionInfo ) {
-	ClassPtrExtensionInfo*	self = (ClassPtrExtensionInfo*)arrayExtensionInfo;
-		
-	Journal_Firewall( 
-		self != NULL,  
-		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-		"Attempting to \"%s\" delete a pointer of value NULL\n", ClassPtrExtensionInfo_Type );
-	
-	/* Delete parent */
-	_ExtensionInfo_Delete( self );
-}
-
-
-void _ClassPtrExtensionInfo_Print( void* arrayExtensionInfo, Stream* stream ) {
-	ClassPtrExtensionInfo* self = (ClassPtrExtensionInfo*)arrayExtensionInfo;
-		
-	Journal_Firewall( 
-		self != NULL,  
-		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-		"Attempting to \"%s\" print a pointer of value NULL\n", ClassPtrExtensionInfo_Type );
-	
-	/* General info */
-	Journal_Printf( (void*)stream, "ClassPtrExtensionInfo (%p):\n", self );
-	_ExtensionInfo_Print( self, stream );
-}
-
-
-void* _ClassPtrExtensionInfo_Copy( const void* extensionInfo, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap  ) {
-	ClassPtrExtensionInfo*	self = (ClassPtrExtensionInfo*)extensionInfo;
-	ClassPtrExtensionInfo*	newClassPtrExtensionInfo;
-
-	/* Copy parent */
-	newClassPtrExtensionInfo = (ClassPtrExtensionInfo*)_ExtensionInfo_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newClassPtrExtensionInfo->copyFunc = self->copyFunc;
-	
-	return newClassPtrExtensionInfo;
-}
-
-void* _ClassPtrExtensionInfo_DataCopy(
-		void* extensionInfo,
-		void* source,
-		void* dest,
-		Bool deep,
-		Name nameExt,
-		PtrMap* ptrMap )
-{
-	ClassPtrExtensionInfo* self = (ClassPtrExtensionInfo*) extensionInfo;
-	ClassPtrExtensionInfo_PtrClass* srcArray = (ClassPtrExtensionInfo_PtrClass*)source;
-	ClassPtrExtensionInfo_PtrClass* destArray = (ClassPtrExtensionInfo_PtrClass*)dest;
-	Index item_I;
-
-	for ( item_I = 0; item_I < self->count; ++item_I ) {
-		destArray[item_I].ptr = Stg_Generic_Copy( self->copyFunc, srcArray[item_I].ptr, NULL, deep, nameExt, ptrMap );
-	}
-
-	return dest;
-}
-
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ClassPtrExtensionInfo.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ClassPtrExtensionInfo.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,187 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ClassPtrExtensionInfo.c 2915 2005-05-08 12:51:46Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ExtensionManager.h"
+#include "ExtensionInfo.h"
+#include "ClassPtrExtensionInfo.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+/* Textual name of this class */
+const Type ClassPtrExtensionInfo_Type = "ClassPtrExtensionInfo";
+
+
+/** allocate and initialise a new ClassPtrExtensionInfo. */
+ClassPtrExtensionInfo* ClassPtrExtensionInfo_New( Name name, Stg_Class_CopyFunction* copyFunc, Index count ) {
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(ClassPtrExtensionInfo);
+	Type                                    type = ClassPtrExtensionInfo_Type;
+	Stg_Class_DeleteFunction*            _delete = _ClassPtrExtensionInfo_Delete;
+	Stg_Class_PrintFunction*              _print = _ClassPtrExtensionInfo_Print;
+	Stg_Class_CopyFunction*                _copy = _ClassPtrExtensionInfo_Copy;
+	ExtensionInfo_DataCopyFunction*    _dataCopy = _ClassPtrExtensionInfo_DataCopy;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+	SizeT                         size = ZERO;
+
+	return _ClassPtrExtensionInfo_New(  CLASSPTREXTENSIONINFO_PASSARGS  );
+}
+
+
+void ClassPtrExtensionInfo_Init( void* arrayExtensionInfo, Name name, Stg_Class_CopyFunction* copyFunc, Index count ) {
+	ClassPtrExtensionInfo* self = (ClassPtrExtensionInfo*)arrayExtensionInfo;
+
+	/* General info */
+	self->type = ClassPtrExtensionInfo_Type;
+	self->_sizeOfSelf = sizeof(ClassPtrExtensionInfo);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ClassPtrExtensionInfo_Delete;
+	self->_print = _ClassPtrExtensionInfo_Print;
+	self->_copy = _ClassPtrExtensionInfo_Copy;
+	self->_dataCopy = _ClassPtrExtensionInfo_DataCopy;
+	
+	/* ClassPtrExtensionInfo info */
+	_ClassPtrExtensionInfo_Init( self, name, copyFunc, count );
+}
+
+
+ClassPtrExtensionInfo* _ClassPtrExtensionInfo_New(  CLASSPTREXTENSIONINFO_DEFARGS  )
+{
+	ClassPtrExtensionInfo* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ClassPtrExtensionInfo) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	size = sizeof(ClassPtrExtensionInfo_PtrClass);
+
+	self = (ClassPtrExtensionInfo*)_ExtensionInfo_New(  EXTENSIONINFO_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* ClassPtrExtensionInfo info */
+	_ClassPtrExtensionInfo_Init( self, name, copyFunc, count );
+	
+	return self;
+}
+
+
+void _ClassPtrExtensionInfo_Init( ClassPtrExtensionInfo* self, Name name, Stg_Class_CopyFunction* copyFunc, Index count ) {
+	/* General and Virtual info should already be set */
+	/* ClassPtrExtensionInfo info */
+	_ExtensionInfo_Init( (ExtensionInfo*)self, name, sizeof(ClassPtrExtensionInfo_PtrClass), count );
+}
+
+
+void _ClassPtrExtensionInfo_Delete( void* arrayExtensionInfo ) {
+	ClassPtrExtensionInfo*	self = (ClassPtrExtensionInfo*)arrayExtensionInfo;
+		
+	Journal_Firewall( 
+		self != NULL,  
+		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+		"Attempting to \"%s\" delete a pointer of value NULL\n", ClassPtrExtensionInfo_Type );
+	
+	/* Delete parent */
+	_ExtensionInfo_Delete( self );
+}
+
+
+void _ClassPtrExtensionInfo_Print( void* arrayExtensionInfo, Stream* stream ) {
+	ClassPtrExtensionInfo* self = (ClassPtrExtensionInfo*)arrayExtensionInfo;
+		
+	Journal_Firewall( 
+		self != NULL,  
+		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+		"Attempting to \"%s\" print a pointer of value NULL\n", ClassPtrExtensionInfo_Type );
+	
+	/* General info */
+	Journal_Printf( (void*)stream, "ClassPtrExtensionInfo (%p):\n", self );
+	_ExtensionInfo_Print( self, stream );
+}
+
+
+void* _ClassPtrExtensionInfo_Copy( const void* extensionInfo, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap  ) {
+	ClassPtrExtensionInfo*	self = (ClassPtrExtensionInfo*)extensionInfo;
+	ClassPtrExtensionInfo*	newClassPtrExtensionInfo;
+
+	/* Copy parent */
+	newClassPtrExtensionInfo = (ClassPtrExtensionInfo*)_ExtensionInfo_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newClassPtrExtensionInfo->copyFunc = self->copyFunc;
+	
+	return newClassPtrExtensionInfo;
+}
+
+void* _ClassPtrExtensionInfo_DataCopy(
+		void* extensionInfo,
+		void* source,
+		void* dest,
+		Bool deep,
+		Name nameExt,
+		PtrMap* ptrMap )
+{
+	ClassPtrExtensionInfo* self = (ClassPtrExtensionInfo*) extensionInfo;
+	ClassPtrExtensionInfo_PtrClass* srcArray = (ClassPtrExtensionInfo_PtrClass*)source;
+	ClassPtrExtensionInfo_PtrClass* destArray = (ClassPtrExtensionInfo_PtrClass*)dest;
+	Index item_I;
+
+	for ( item_I = 0; item_I < self->count; ++item_I ) {
+		destArray[item_I].ptr = Stg_Generic_Copy( self->copyFunc, srcArray[item_I].ptr, NULL, deep, nameExt, ptrMap );
+	}
+
+	return dest;
+}
+
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/EntryPoint.c
--- a/Base/Extensibility/src/EntryPoint.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,925 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: EntryPoint.c 4197 2007-11-01 06:23:48Z DavidMay $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "EntryPoint.h"
-#include "Hook.h"
-#include "ClassHook.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <math.h>
-#ifndef HUGE_VAL
-	#define HUGE_VAL 1.0e99
-#endif
-
-
-/* Textual name of this class */
-const Type EntryPoint_Type = "EntryPoint";
-
-static const Type _EntryPoint_Run_Type = "EntryPoint->Run";
-
-/* VIRTUAL FUNCTIONS */
-
-/** allocate and initialise a new EntryPoint.
- * \param name textual name of the entry point (useful if its to be stored in a list).
- * \return the allocated entry point. */
-EntryPoint* EntryPoint_New( Name name, unsigned int castType ) {
-	/* Variables set in this function */
-	SizeT                       _sizeOfSelf = sizeof(EntryPoint);
-	Type                               type = EntryPoint_Type;
-	Stg_Class_DeleteFunction*       _delete = _EntryPoint_Delete;
-	Stg_Class_PrintFunction*         _print = _EntryPoint_Print;
-	Stg_Class_CopyFunction*           _copy = _EntryPoint_Copy;
-	EntryPoint_GetRunFunction*      _getRun = _EntryPoint_GetRun;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _EntryPoint_New(  ENTRYPOINT_PASSARGS  );
-}
-
-/** Initialise an existing entry point. See EntryPoint_New() for argument descriptions. */
-void EntryPoint_Init( void* entryPoint, Name name, unsigned int castType ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	/* General info */
-	self->type = EntryPoint_Type;
-	self->_sizeOfSelf = sizeof(EntryPoint);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _EntryPoint_Delete;
-	self->_print = _EntryPoint_Print;
-	self->_copy = _EntryPoint_Copy;
-	self->_getRun = _EntryPoint_GetRun;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, GLOBAL );
-	
-	/* EntryPoint info */
-	_EntryPoint_Init( self, castType );
-}
-
-EntryPoint* _EntryPoint_New(  ENTRYPOINT_DEFARGS  )
-{
-	EntryPoint* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(EntryPoint) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = GLOBAL;
-
-	self = (EntryPoint*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	self->_getRun = _getRun;
-	
-	/* EntryPoint info */
-	_EntryPoint_Init( self, castType );
-	
-	return self;
-}
-
-void _EntryPoint_Init( EntryPoint* self, unsigned int castType ){
-	/* General and Virtual info should already be set */
-	
-	/* EntryPoint info */
-	self->castType = castType;
-	self->run = self->_getRun( self );
-	
-	/* Initialise the hooklist */
-	self->hooks = Stg_ObjectList_New(); 
-	self->alwaysFirstHook = NULL;
-	self->alwaysLastHook = NULL;
-}
-
-
-void _EntryPoint_Delete( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	#if DEBUG
-		assert( self );
-	#endif	
-	
-	Stg_ObjectList_DeleteAllObjects( self->hooks );
-	Stg_Class_Delete( self->hooks );
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Object_Delete( self );
-}
-
-void _EntryPoint_Print( void* entryPoint, Stream* stream ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	#if DEBUG
-		assert( self );
-		assert( stream );
-	#endif	
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "EntryPoint (ptr) (%p):\n", self );
-	
-	/* Virtual info */
-	Journal_Printf( (void*) stream, "\t_getRun (ptr): %p\n", self->_getRun );
-	
-	/* EntryPoint info */
-	Journal_Printf( (void*) stream, "\tname: %s\n", self->name );
-	Journal_Printf( (void*) stream, "\tcastType: %u\n", self->castType );
-	Journal_Printf( (void*) stream, "\trun (ptr): %p\n", self->run );
-	Journal_Printf( (void*) stream, "\thooks: \n" );
-	Stg_Class_Print( self->hooks, stream );
-	Journal_Printf( (void*) stream, "\n" );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-}
-
-
-void* _EntryPoint_Copy( const void* entryPoint, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	EntryPoint*	self = (EntryPoint*)entryPoint;
-	EntryPoint*	newEntryPoint;
-	PtrMap*		map = ptrMap;
-	Bool		ownMap = False;
-	
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newEntryPoint = (EntryPoint*)_Stg_Object_Copy( self, dest, deep, nameExt, map );
-	
-	/* Virtual methods */
-	newEntryPoint->_getRun = self->_getRun;
-	
-	newEntryPoint->castType = self->castType;
-	newEntryPoint->run = self->run;
-	
-	if( deep ) {
-		newEntryPoint->hooks = (HookList*)Stg_Class_Copy( self->hooks, NULL, deep, nameExt, map );
-		
-		if( newEntryPoint->hooks ) {
-			if( self->alwaysFirstHook ) {
-				if( nameExt ) {
-					char*	tmpName;
-					
-					tmpName = Memory_Alloc_Array( char, strlen( Stg_Object_GetName( self->alwaysFirstHook ) ) + strlen( nameExt ) + 1, "tmpName" );
-					strcpy( tmpName, Stg_Object_GetName( self->alwaysFirstHook ) );
-					strcpy( &tmpName[strlen( Stg_Object_GetName( self->alwaysFirstHook ) )], nameExt );
-					
-					newEntryPoint->alwaysFirstHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, tmpName );
-					Memory_Free( tmpName );
-				}
-				else {
-					newEntryPoint->alwaysFirstHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, Stg_Object_GetName( self->alwaysFirstHook ) );
-				}
-			}
-			else {
-				self->alwaysFirstHook = NULL;
-			}
-			
-			if( self->alwaysLastHook ) {
-				if( nameExt ) {
-					char*	tmpName;
-					
-					tmpName = Memory_Alloc_Array( char, strlen( Stg_Object_GetName( self->alwaysLastHook ) ) + strlen( nameExt ) + 1, "tmpName" );
-					strcpy( tmpName, Stg_Object_GetName( self->alwaysLastHook ) );
-					strcpy( &tmpName[strlen( Stg_Object_GetName( self->alwaysLastHook ) )], nameExt );
-					
-					newEntryPoint->alwaysLastHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, tmpName );
-					Memory_Free( tmpName );
-				}
-				else {
-					newEntryPoint->alwaysLastHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, Stg_Object_GetName( self->alwaysLastHook ) );
-				}
-			}
-			else {
-				self->alwaysLastHook = NULL;
-			}
-		}
-		else {
-			self->alwaysFirstHook = NULL;
-			self->alwaysLastHook = NULL;
-		}
-	}
-	else {
-		newEntryPoint->hooks = self->hooks;
-		newEntryPoint->alwaysFirstHook = self->alwaysFirstHook;
-		newEntryPoint->alwaysLastHook = self->alwaysLastHook;
-	}
-	
-	if( ownMap ) {
-		Stg_Class_Delete( map );
-	}
-	
-	return (void*)newEntryPoint;
-}
-
-
-Func_Ptr EntryPoint_GetRun( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	return self->_getRun( self );
-}
-
-
-Func_Ptr _EntryPoint_GetRun( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	
-	switch( self->castType ) {
-		case EntryPoint_0_CastType:
-			return (void*) _EntryPoint_Run;
-		
-		case EntryPoint_VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_VoidPtr;
-		
-		case EntryPoint_2VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_2VoidPtr;
-		
-		case EntryPoint_3VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_3VoidPtr;
-		
-		case EntryPoint_Minimum_VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_Minimum_VoidPtr;
-		
-		case EntryPoint_Maximum_VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_Maximum_VoidPtr;
-		
-		case EntryPoint_Class_0_CastType:
-			return (void*) _EntryPoint_Run_Class;
-		
-		case EntryPoint_Class_VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_Class_VoidPtr;
-		
-		case EntryPoint_Class_Minimum_VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_Class_Minimum_VoidPtr;
-		
-		case EntryPoint_Class_Maximum_VoidPtr_CastType:
-			return (void*) _EntryPoint_Run_Class_Maximum_VoidPtr;
-		
-		default:
-			assert( 0 /* castType unknown */ );
-			/* Decendant versions of this function should call the parent's getrun here instead */
-	}
-	return 0;
-}
-
-
-void _EntryPoint_Run( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook_Index hookIndex;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		((EntryPoint_0_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)();
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-
-
-
-
-void _EntryPoint_Run_VoidPtr( void* entryPoint, void* data0 ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook_Index hookIndex;
-	double wallTime;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		wallTime = MPI_Wtime();
-
-		((EntryPoint_VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
-		
-		stg_profile_EntryPoint( self->name, self->hooks->data[hookIndex]->name, MPI_Wtime() - wallTime );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-void _EntryPoint_Run_2VoidPtr( void* entryPoint, void* data0, void* data1 ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook_Index hookIndex;
-        double wallTime;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_2VoidPtr, self->name );
-	#endif
-
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		wallTime = MPI_Wtime();
-		
-		((EntryPoint_2VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0, data1 );
-	
-		stg_profile_EntryPoint( self->name, self->hooks->data[hookIndex]->name, MPI_Wtime() - wallTime );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-void _EntryPoint_Run_3VoidPtr( void* entryPoint, void* data0, void* data1, void* data2 ) {
-	EntryPoint* self      = (EntryPoint*)entryPoint;
-	Hook_Index  hookIndex;
-	double wallTime; 
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_3VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0 ; hookIndex < self->hooks->count; hookIndex++ ) {
-		wallTime = MPI_Wtime();
-
-		((EntryPoint_3VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0, data1, data2 );
-		
-		stg_profile_EntryPoint( self->name, self->hooks->data[hookIndex]->name, MPI_Wtime() - wallTime );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-double _EntryPoint_Run_Minimum_VoidPtr( void* entryPoint, void* data0 ) {
-	EntryPoint* self       = (EntryPoint*)entryPoint;
-	Hook_Index  hookIndex;
-	double      minValue   = HUGE_VAL;
-	double      value;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Minimum_VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		value = ((EntryPoint_Minimum_VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
-		/* Get Minimum out of currently stored value and one from this hook */
-		if ( minValue > value )
-			minValue = value;
-	}
-
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-	return minValue;
-}
-
-double _EntryPoint_Run_Maximum_VoidPtr( void* entryPoint, void* data0 ) {
-	EntryPoint* self       = (EntryPoint*)entryPoint;
-	Hook_Index  hookIndex;
-	double      maxValue   = -HUGE_VAL;
-	double      value;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Maximum_VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		value = ((EntryPoint_Maximum_VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
-		/* Get Maximum out of currently stored value and one from this hook */
-		if ( maxValue < value )
-			maxValue = value;
-	}
-
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-	return maxValue;
-}
-
-
-double _EntryPoint_Run_Class_Minimum_VoidPtr( void* entryPoint, void* data0 ) {
-	EntryPoint* self       = (EntryPoint*)entryPoint;
-	ClassHook*  hook;
-	Hook_Index  hookIndex;
-	double      minValue   = HUGE_VAL;
-	double      value;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class_Minimum_VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		hook  = (ClassHook*) self->hooks->data[hookIndex];
-		value = ((EntryPoint_Class_Minimum_VoidPtr_Cast*)(hook->funcPtr))( hook->reference, data0 );
-
-		/* Get Minimum out of currently stored value and one from this hook */
-		if ( minValue > value )
-			minValue = value;
-	}
-
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-	return minValue;
-}
-
-double _EntryPoint_Run_Class_Maximum_VoidPtr( void* entryPoint, void* data0 ) {
-	EntryPoint* self       = (EntryPoint*)entryPoint;
-	ClassHook*  hook;
-	Hook_Index  hookIndex;
-	double      maxValue   = -HUGE_VAL;
-	double      value;
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class_Maximum_VoidPtr, self->name );
-	#endif
-	
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		hook  = (ClassHook*) self->hooks->data[hookIndex];
-		value = ((EntryPoint_Class_Maximum_VoidPtr_Cast*)(hook->funcPtr))( hook->reference, data0 );
-		
-		/* Get Maximum out of currently stored value and one from this hook */
-		if ( maxValue < value )
-			maxValue = value;
-	}
-
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-	return maxValue;
-}
-
-void _EntryPoint_Run_Class( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	ClassHook* hook;
-	Hook_Index hookIndex;
-
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class, self->name );
-	#endif
-	
-	for ( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		hook = (ClassHook*)self->hooks->data[hookIndex];
-		((EntryPoint_Class_0_Cast*)(hook->funcPtr))( hook->reference );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-void _EntryPoint_Run_Class_VoidPtr( void* entryPoint, void* data0 ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	ClassHook* hook;
-	Hook_Index hookIndex;
-
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class_VoidPtr, self->name );
-	#endif
-	
-	for ( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		hook = (ClassHook*)self->hooks->data[hookIndex];
-		((EntryPoint_Class_VoidPtr_Cast*)(hook->funcPtr))( hook->reference, data0 );
-	}
-	
-	#ifdef USE_PROFILE
-		Stg_CallGraph_Pop( stgCallGraph );
-	#endif
-}
-
-/* Functions for Adding hooks */
-
-void _EntryPoint_PrependHook( void* entryPoint, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( NULL == self->alwaysFirstHook ) {
-		Stg_ObjectList_Prepend( self->hooks, hook );
-	}
-	else {
-		Stg_ObjectList_InsertAfter( self->hooks, self->alwaysFirstHook->name, hook );
-	}	
-}
-
-
-void _EntryPoint_PrependHook_AlwaysFirst( void* entryPoint, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( self->alwaysFirstHook ) {
-		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
-		Journal_Printf( error, "Error: tried to prepend a new hook \"%s\" to entry point "
-			"%s to always come first, but hook \"%s\" already specified to always be first.\n",
-			hook->name, self->name, self->alwaysFirstHook->name ); 
-		assert( 0 );
-	}
-
-	Stg_ObjectList_Prepend( self->hooks, hook );
-	self->alwaysFirstHook = hook;
-}
-
-
-void _EntryPoint_AppendHook( void* entryPoint, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( NULL == self->alwaysLastHook ) {
-		Stg_ObjectList_Append( self->hooks, hook );
-	}
-	else {
-		Stg_ObjectList_InsertBefore( self->hooks, self->alwaysLastHook->name, hook );
-	}	
-}
-
-
-void _EntryPoint_AppendHook_AlwaysLast( void* entryPoint, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( self->alwaysLastHook ) {
-		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
-		Journal_Printf( error, "Error: tried to append a new hook \"%s\" to entry point "
-			"%s to always come last, but hook \"%s\" already specified to always be last.\n",
-			hook->name, self->name, self->alwaysLastHook->name ); 
-		assert( 0 );
-	}
-
-	Stg_ObjectList_Append( self->hooks, hook );
-	self->alwaysLastHook = hook;
-}
-
-
-void _EntryPoint_InsertHookBefore( void* entryPoint, Name hookToInsertBefore, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( self->alwaysFirstHook && ( 0 == strcmp( hookToInsertBefore, self->alwaysFirstHook->name ) ) ) {
-		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
-		Journal_Printf( error, "Error: tried to insert a new hook \"%s\" to entry point "
-			"%s before a hook specified to always be first, \"%s\".\n",
-			hook->name, self->name, self->alwaysFirstHook->name ); 
-		assert( 0 );
-	}
-
-	Stg_ObjectList_InsertBefore( self->hooks, hookToInsertBefore, hook );
-}
-
-
-void _EntryPoint_InsertHookAfter( void* entryPoint, Name hookToInsertAfter, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( self->alwaysLastHook && ( 0 == strcmp( hookToInsertAfter, self->alwaysLastHook->name ) ) ) {
-		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
-		Journal_Printf( error, "Error: tried to insert a new hook \"%s\" to entry point "
-			"%s after a hook specified to always be last, \"%s\".\n",
-			hook->name, self->name, self->alwaysLastHook->name ); 
-		assert( 0 );
-	}
-	
-	Stg_ObjectList_InsertAfter( self->hooks, hookToInsertAfter, hook );
-}
-
-void _EntryPoint_ReplaceAllHook( void* entryPoint, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	/* Purge the EP first. */
-	EntryPoint_Purge( self );
-	Stg_ObjectList_ReplaceAll( self->hooks, DELETE, hook );
-}
-
-
-void _EntryPoint_ReplaceHook( void* entryPoint, Name hookToReplace, Hook* hook ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if ( self->alwaysFirstHook && ( 0 == strcmp( hookToReplace, self->alwaysFirstHook->name ) ) ) {
-		self->alwaysFirstHook = NULL;
-	}
-	else if ( self->alwaysLastHook && ( 0 == strcmp( hookToReplace, self->alwaysLastHook->name ) ) ) {
-		self->alwaysLastHook = NULL;
-	}
-
-	Stg_ObjectList_Replace( self->hooks, hookToReplace, DELETE, hook );
-}
-
-
-/* PUBLIC FUNCTIONS */
-
-void EntryPoint_PrintConcise( void* entryPoint, Stream* stream ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook_Index hookIndex;
-	Hook_Ptr hook;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	Journal_Printf( stream, "\tEP: %s\n", self->name );
-	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
-		hook = (Hook*) self->hooks->data[hookIndex];
-		Journal_Printf( stream, "\t\tH: \"%s\"", hook->name );
-		if ( 0 != strcmp( "", hook->addedBy ) ) {
-			Journal_Printf( stream, " (%s)", hook->addedBy );
-		}
-		Journal_Printf( stream, "\n" );
-	}
-}
-
-
-void EntryPoint_Prepend( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr , addedBy );
-
-	_EntryPoint_PrependHook( self, hook );
-}
-
-void EntryPoint_Prepend_AlwaysFirst( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr, addedBy );
-
-	_EntryPoint_PrependHook_AlwaysFirst( self, hook );
-}
-
-void EntryPoint_Append( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr, addedBy );
-
-	_EntryPoint_AppendHook( self, hook );
-}
-
-
-void EntryPoint_Append_AlwaysLast( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr, addedBy );
-
-	_EntryPoint_AppendHook_AlwaysLast( self, hook );
-}
-
-
-void EntryPoint_InsertBefore( void* entryPoint, Name hookToInsertBefore, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr , addedBy );
-
-	_EntryPoint_InsertHookBefore( self, hookToInsertBefore, hook );
-}
-
-
-void EntryPoint_InsertAfter( void* entryPoint, Name hookToInsertAfter, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr , addedBy );
-
-	_EntryPoint_InsertHookAfter( self, hookToInsertAfter, hook );
-}
-
-
-void EntryPoint_ReplaceAll( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr , addedBy );
-
-	_EntryPoint_ReplaceAllHook( self, hook );
-}
-
-
-void EntryPoint_Replace( void* entryPoint, Name hookToReplace, Name name, Func_Ptr funcPtr, Name addedBy ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = Hook_New( name, funcPtr , addedBy );
-
-	_EntryPoint_ReplaceHook( self, hookToReplace, hook );
-}
-
-void EntryPoint_PrependClassHook( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_PrependHook( self, hook );
-}
-	
-void EntryPoint_PrependClassHook_AlwaysFirst( 
-	void* entryPoint, 
-	Name name, 
-	Func_Ptr funcPtr, 
-	Name addedBy, 
-	void* reference ) {
-	
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_PrependHook_AlwaysFirst( self, hook );
-}
-	
-void EntryPoint_AppendClassHook( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_AppendHook( self, hook );
-
-}
-	
-void EntryPoint_AppendClassHook_AlwaysLast( 
-	void* entryPoint, 
-	Name name, 
-	Func_Ptr funcPtr, 
-	Name addedBy, 
-	void* reference ) {
-
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_AppendHook_AlwaysLast( self, hook );
-}
-
-void EntryPoint_InsertClassHookBefore( 
-	void* entryPoint, 
-	Name hookToInsertBefore, 
-	Name name, 
-	Func_Ptr funcPtr, 
-	Name addedBy, 
-	void* reference ) {
-	
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_InsertHookBefore( self, hookToInsertBefore, hook );
-
-}
-	
-void EntryPoint_InsertClassHookAfter( 
-	void* entryPoint, 
-	Name hookToInsertAfter, 
-	Name name, 
-	Func_Ptr funcPtr, 
-	Name addedBy, 
-	void* reference ) {
-
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_InsertHookAfter( self, hookToInsertAfter, hook );
-}
-
-void EntryPoint_ReplaceClassHook( 
-	void* entryPoint, 
-	Name hookToReplace, 
-	Name name, 
-	Func_Ptr funcPtr, 
-	Name addedBy, 
-	void* reference ) {
-	
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_ReplaceHook( self, hookToReplace, hook );
-}
-	
-void EntryPoint_ReplaceAllClassHook( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
-
-	_EntryPoint_ReplaceAllHook( self, hook );
-
-}
-
-
-
-void EntryPoint_Remove( void* entryPoint, Name name ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	Stg_ObjectList_Remove( self->hooks, name, DELETE );
-}
-
-void EntryPoint_Purge( void* entryPoint ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	/* Stg_Class_Delete the existing hook information structures. Note: this won't try and delete the func ptrs themselves */
-	Stg_ObjectList_DeleteAllObjects( self->hooks );
-	self->hooks->count = 0;
-	self->alwaysFirstHook = NULL;
-	self->alwaysLastHook = NULL;
-}
-
-
-void EntryPoint_WarnIfNoHooks( void* entryPoint, Name parentFunction ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if (0 == self->hooks->count ) {
-		Name epName = self->name;
-		Stream* stream = Journal_Register (Debug_Type, self->name );
-		Journal_Printf( (void*) stream, "Warning: No hooks defined for E.P. \"%s\". Calling parent function "
-			"%s() usually implies at least one %s hook defined.\n",
-			epName, parentFunction, epName );
-	}
-}
-
-
-void EntryPoint_ErrorIfNoHooks( void* entryPoint, Name parentFunction ) {
-	EntryPoint* self = (EntryPoint*)entryPoint;
-
-	Journal_Firewall( 
-			self != NULL, 
-			Journal_Register( Error_Type, EntryPoint_Type ),
-			"Entry Point is NULL in %s\n", __func__ );
-
-	if (0 == self->hooks->count ) {
-		Name epName = self->name;
-		Stream* stream = Journal_Register (Error_Type, self->name );
-		Journal_Firewall( 0, (void*) stream, "Error: No hooks defined for E.P. \"%s\". Calling parent function "
-			"%s() requires at least one %s hook defined.\n",
-			epName, parentFunction, epName );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/EntryPoint.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/EntryPoint.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,925 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: EntryPoint.c 4197 2007-11-01 06:23:48Z DavidMay $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "EntryPoint.h"
+#include "Hook.h"
+#include "ClassHook.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <math.h>
+#ifndef HUGE_VAL
+	#define HUGE_VAL 1.0e99
+#endif
+
+
+/* Textual name of this class */
+const Type EntryPoint_Type = "EntryPoint";
+
+static const Type _EntryPoint_Run_Type = "EntryPoint->Run";
+
+/* VIRTUAL FUNCTIONS */
+
+/** allocate and initialise a new EntryPoint.
+ * \param name textual name of the entry point (useful if its to be stored in a list).
+ * \return the allocated entry point. */
+EntryPoint* EntryPoint_New( Name name, unsigned int castType ) {
+	/* Variables set in this function */
+	SizeT                       _sizeOfSelf = sizeof(EntryPoint);
+	Type                               type = EntryPoint_Type;
+	Stg_Class_DeleteFunction*       _delete = _EntryPoint_Delete;
+	Stg_Class_PrintFunction*         _print = _EntryPoint_Print;
+	Stg_Class_CopyFunction*           _copy = _EntryPoint_Copy;
+	EntryPoint_GetRunFunction*      _getRun = _EntryPoint_GetRun;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _EntryPoint_New(  ENTRYPOINT_PASSARGS  );
+}
+
+/** Initialise an existing entry point. See EntryPoint_New() for argument descriptions. */
+void EntryPoint_Init( void* entryPoint, Name name, unsigned int castType ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	/* General info */
+	self->type = EntryPoint_Type;
+	self->_sizeOfSelf = sizeof(EntryPoint);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _EntryPoint_Delete;
+	self->_print = _EntryPoint_Print;
+	self->_copy = _EntryPoint_Copy;
+	self->_getRun = _EntryPoint_GetRun;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_Object_Init( (Stg_Object*)self, name, GLOBAL );
+	
+	/* EntryPoint info */
+	_EntryPoint_Init( self, castType );
+}
+
+EntryPoint* _EntryPoint_New(  ENTRYPOINT_DEFARGS  )
+{
+	EntryPoint* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(EntryPoint) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = GLOBAL;
+
+	self = (EntryPoint*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	self->_getRun = _getRun;
+	
+	/* EntryPoint info */
+	_EntryPoint_Init( self, castType );
+	
+	return self;
+}
+
+void _EntryPoint_Init( EntryPoint* self, unsigned int castType ){
+	/* General and Virtual info should already be set */
+	
+	/* EntryPoint info */
+	self->castType = castType;
+	self->run = self->_getRun( self );
+	
+	/* Initialise the hooklist */
+	self->hooks = Stg_ObjectList_New(); 
+	self->alwaysFirstHook = NULL;
+	self->alwaysLastHook = NULL;
+}
+
+
+void _EntryPoint_Delete( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	#if DEBUG
+		assert( self );
+	#endif	
+	
+	Stg_ObjectList_DeleteAllObjects( self->hooks );
+	Stg_Class_Delete( self->hooks );
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Object_Delete( self );
+}
+
+void _EntryPoint_Print( void* entryPoint, Stream* stream ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	#if DEBUG
+		assert( self );
+		assert( stream );
+	#endif	
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "EntryPoint (ptr) (%p):\n", self );
+	
+	/* Virtual info */
+	Journal_Printf( (void*) stream, "\t_getRun (ptr): %p\n", self->_getRun );
+	
+	/* EntryPoint info */
+	Journal_Printf( (void*) stream, "\tname: %s\n", self->name );
+	Journal_Printf( (void*) stream, "\tcastType: %u\n", self->castType );
+	Journal_Printf( (void*) stream, "\trun (ptr): %p\n", self->run );
+	Journal_Printf( (void*) stream, "\thooks: \n" );
+	Stg_Class_Print( self->hooks, stream );
+	Journal_Printf( (void*) stream, "\n" );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+}
+
+
+void* _EntryPoint_Copy( const void* entryPoint, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	EntryPoint*	self = (EntryPoint*)entryPoint;
+	EntryPoint*	newEntryPoint;
+	PtrMap*		map = ptrMap;
+	Bool		ownMap = False;
+	
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newEntryPoint = (EntryPoint*)_Stg_Object_Copy( self, dest, deep, nameExt, map );
+	
+	/* Virtual methods */
+	newEntryPoint->_getRun = self->_getRun;
+	
+	newEntryPoint->castType = self->castType;
+	newEntryPoint->run = self->run;
+	
+	if( deep ) {
+		newEntryPoint->hooks = (HookList*)Stg_Class_Copy( self->hooks, NULL, deep, nameExt, map );
+		
+		if( newEntryPoint->hooks ) {
+			if( self->alwaysFirstHook ) {
+				if( nameExt ) {
+					char*	tmpName;
+					
+					tmpName = Memory_Alloc_Array( char, strlen( Stg_Object_GetName( self->alwaysFirstHook ) ) + strlen( nameExt ) + 1, "tmpName" );
+					strcpy( tmpName, Stg_Object_GetName( self->alwaysFirstHook ) );
+					strcpy( &tmpName[strlen( Stg_Object_GetName( self->alwaysFirstHook ) )], nameExt );
+					
+					newEntryPoint->alwaysFirstHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, tmpName );
+					Memory_Free( tmpName );
+				}
+				else {
+					newEntryPoint->alwaysFirstHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, Stg_Object_GetName( self->alwaysFirstHook ) );
+				}
+			}
+			else {
+				self->alwaysFirstHook = NULL;
+			}
+			
+			if( self->alwaysLastHook ) {
+				if( nameExt ) {
+					char*	tmpName;
+					
+					tmpName = Memory_Alloc_Array( char, strlen( Stg_Object_GetName( self->alwaysLastHook ) ) + strlen( nameExt ) + 1, "tmpName" );
+					strcpy( tmpName, Stg_Object_GetName( self->alwaysLastHook ) );
+					strcpy( &tmpName[strlen( Stg_Object_GetName( self->alwaysLastHook ) )], nameExt );
+					
+					newEntryPoint->alwaysLastHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, tmpName );
+					Memory_Free( tmpName );
+				}
+				else {
+					newEntryPoint->alwaysLastHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, Stg_Object_GetName( self->alwaysLastHook ) );
+				}
+			}
+			else {
+				self->alwaysLastHook = NULL;
+			}
+		}
+		else {
+			self->alwaysFirstHook = NULL;
+			self->alwaysLastHook = NULL;
+		}
+	}
+	else {
+		newEntryPoint->hooks = self->hooks;
+		newEntryPoint->alwaysFirstHook = self->alwaysFirstHook;
+		newEntryPoint->alwaysLastHook = self->alwaysLastHook;
+	}
+	
+	if( ownMap ) {
+		Stg_Class_Delete( map );
+	}
+	
+	return (void*)newEntryPoint;
+}
+
+
+Func_Ptr EntryPoint_GetRun( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	return self->_getRun( self );
+}
+
+
+Func_Ptr _EntryPoint_GetRun( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	
+	switch( self->castType ) {
+		case EntryPoint_0_CastType:
+			return (void*) _EntryPoint_Run;
+		
+		case EntryPoint_VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_VoidPtr;
+		
+		case EntryPoint_2VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_2VoidPtr;
+		
+		case EntryPoint_3VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_3VoidPtr;
+		
+		case EntryPoint_Minimum_VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_Minimum_VoidPtr;
+		
+		case EntryPoint_Maximum_VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_Maximum_VoidPtr;
+		
+		case EntryPoint_Class_0_CastType:
+			return (void*) _EntryPoint_Run_Class;
+		
+		case EntryPoint_Class_VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_Class_VoidPtr;
+		
+		case EntryPoint_Class_Minimum_VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_Class_Minimum_VoidPtr;
+		
+		case EntryPoint_Class_Maximum_VoidPtr_CastType:
+			return (void*) _EntryPoint_Run_Class_Maximum_VoidPtr;
+		
+		default:
+			assert( 0 /* castType unknown */ );
+			/* Decendant versions of this function should call the parent's getrun here instead */
+	}
+	return 0;
+}
+
+
+void _EntryPoint_Run( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook_Index hookIndex;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		((EntryPoint_0_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)();
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+
+
+
+
+void _EntryPoint_Run_VoidPtr( void* entryPoint, void* data0 ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook_Index hookIndex;
+	double wallTime;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		wallTime = MPI_Wtime();
+
+		((EntryPoint_VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
+		
+		stg_profile_EntryPoint( self->name, self->hooks->data[hookIndex]->name, MPI_Wtime() - wallTime );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+void _EntryPoint_Run_2VoidPtr( void* entryPoint, void* data0, void* data1 ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook_Index hookIndex;
+        double wallTime;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_2VoidPtr, self->name );
+	#endif
+
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		wallTime = MPI_Wtime();
+		
+		((EntryPoint_2VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0, data1 );
+	
+		stg_profile_EntryPoint( self->name, self->hooks->data[hookIndex]->name, MPI_Wtime() - wallTime );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+void _EntryPoint_Run_3VoidPtr( void* entryPoint, void* data0, void* data1, void* data2 ) {
+	EntryPoint* self      = (EntryPoint*)entryPoint;
+	Hook_Index  hookIndex;
+	double wallTime; 
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_3VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0 ; hookIndex < self->hooks->count; hookIndex++ ) {
+		wallTime = MPI_Wtime();
+
+		((EntryPoint_3VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0, data1, data2 );
+		
+		stg_profile_EntryPoint( self->name, self->hooks->data[hookIndex]->name, MPI_Wtime() - wallTime );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+double _EntryPoint_Run_Minimum_VoidPtr( void* entryPoint, void* data0 ) {
+	EntryPoint* self       = (EntryPoint*)entryPoint;
+	Hook_Index  hookIndex;
+	double      minValue   = HUGE_VAL;
+	double      value;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Minimum_VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		value = ((EntryPoint_Minimum_VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
+		/* Get Minimum out of currently stored value and one from this hook */
+		if ( minValue > value )
+			minValue = value;
+	}
+
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+	return minValue;
+}
+
+double _EntryPoint_Run_Maximum_VoidPtr( void* entryPoint, void* data0 ) {
+	EntryPoint* self       = (EntryPoint*)entryPoint;
+	Hook_Index  hookIndex;
+	double      maxValue   = -HUGE_VAL;
+	double      value;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Maximum_VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		value = ((EntryPoint_Maximum_VoidPtr_Cast*)((Hook*)self->hooks->data[hookIndex])->funcPtr)( data0 );
+		/* Get Maximum out of currently stored value and one from this hook */
+		if ( maxValue < value )
+			maxValue = value;
+	}
+
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+	return maxValue;
+}
+
+
+double _EntryPoint_Run_Class_Minimum_VoidPtr( void* entryPoint, void* data0 ) {
+	EntryPoint* self       = (EntryPoint*)entryPoint;
+	ClassHook*  hook;
+	Hook_Index  hookIndex;
+	double      minValue   = HUGE_VAL;
+	double      value;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class_Minimum_VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		hook  = (ClassHook*) self->hooks->data[hookIndex];
+		value = ((EntryPoint_Class_Minimum_VoidPtr_Cast*)(hook->funcPtr))( hook->reference, data0 );
+
+		/* Get Minimum out of currently stored value and one from this hook */
+		if ( minValue > value )
+			minValue = value;
+	}
+
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+	return minValue;
+}
+
+double _EntryPoint_Run_Class_Maximum_VoidPtr( void* entryPoint, void* data0 ) {
+	EntryPoint* self       = (EntryPoint*)entryPoint;
+	ClassHook*  hook;
+	Hook_Index  hookIndex;
+	double      maxValue   = -HUGE_VAL;
+	double      value;
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class_Maximum_VoidPtr, self->name );
+	#endif
+	
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		hook  = (ClassHook*) self->hooks->data[hookIndex];
+		value = ((EntryPoint_Class_Maximum_VoidPtr_Cast*)(hook->funcPtr))( hook->reference, data0 );
+		
+		/* Get Maximum out of currently stored value and one from this hook */
+		if ( maxValue < value )
+			maxValue = value;
+	}
+
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+	return maxValue;
+}
+
+void _EntryPoint_Run_Class( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	ClassHook* hook;
+	Hook_Index hookIndex;
+
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class, self->name );
+	#endif
+	
+	for ( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		hook = (ClassHook*)self->hooks->data[hookIndex];
+		((EntryPoint_Class_0_Cast*)(hook->funcPtr))( hook->reference );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+void _EntryPoint_Run_Class_VoidPtr( void* entryPoint, void* data0 ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	ClassHook* hook;
+	Hook_Index hookIndex;
+
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Push( stgCallGraph, _EntryPoint_Run_Class_VoidPtr, self->name );
+	#endif
+	
+	for ( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		hook = (ClassHook*)self->hooks->data[hookIndex];
+		((EntryPoint_Class_VoidPtr_Cast*)(hook->funcPtr))( hook->reference, data0 );
+	}
+	
+	#ifdef USE_PROFILE
+		Stg_CallGraph_Pop( stgCallGraph );
+	#endif
+}
+
+/* Functions for Adding hooks */
+
+void _EntryPoint_PrependHook( void* entryPoint, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( NULL == self->alwaysFirstHook ) {
+		Stg_ObjectList_Prepend( self->hooks, hook );
+	}
+	else {
+		Stg_ObjectList_InsertAfter( self->hooks, self->alwaysFirstHook->name, hook );
+	}	
+}
+
+
+void _EntryPoint_PrependHook_AlwaysFirst( void* entryPoint, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( self->alwaysFirstHook ) {
+		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
+		Journal_Printf( error, "Error: tried to prepend a new hook \"%s\" to entry point "
+			"%s to always come first, but hook \"%s\" already specified to always be first.\n",
+			hook->name, self->name, self->alwaysFirstHook->name ); 
+		assert( 0 );
+	}
+
+	Stg_ObjectList_Prepend( self->hooks, hook );
+	self->alwaysFirstHook = hook;
+}
+
+
+void _EntryPoint_AppendHook( void* entryPoint, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( NULL == self->alwaysLastHook ) {
+		Stg_ObjectList_Append( self->hooks, hook );
+	}
+	else {
+		Stg_ObjectList_InsertBefore( self->hooks, self->alwaysLastHook->name, hook );
+	}	
+}
+
+
+void _EntryPoint_AppendHook_AlwaysLast( void* entryPoint, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( self->alwaysLastHook ) {
+		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
+		Journal_Printf( error, "Error: tried to append a new hook \"%s\" to entry point "
+			"%s to always come last, but hook \"%s\" already specified to always be last.\n",
+			hook->name, self->name, self->alwaysLastHook->name ); 
+		assert( 0 );
+	}
+
+	Stg_ObjectList_Append( self->hooks, hook );
+	self->alwaysLastHook = hook;
+}
+
+
+void _EntryPoint_InsertHookBefore( void* entryPoint, Name hookToInsertBefore, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( self->alwaysFirstHook && ( 0 == strcmp( hookToInsertBefore, self->alwaysFirstHook->name ) ) ) {
+		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
+		Journal_Printf( error, "Error: tried to insert a new hook \"%s\" to entry point "
+			"%s before a hook specified to always be first, \"%s\".\n",
+			hook->name, self->name, self->alwaysFirstHook->name ); 
+		assert( 0 );
+	}
+
+	Stg_ObjectList_InsertBefore( self->hooks, hookToInsertBefore, hook );
+}
+
+
+void _EntryPoint_InsertHookAfter( void* entryPoint, Name hookToInsertAfter, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( self->alwaysLastHook && ( 0 == strcmp( hookToInsertAfter, self->alwaysLastHook->name ) ) ) {
+		Stream* error = Journal_Register( ErrorStream_Type, EntryPoint_Type );
+		Journal_Printf( error, "Error: tried to insert a new hook \"%s\" to entry point "
+			"%s after a hook specified to always be last, \"%s\".\n",
+			hook->name, self->name, self->alwaysLastHook->name ); 
+		assert( 0 );
+	}
+	
+	Stg_ObjectList_InsertAfter( self->hooks, hookToInsertAfter, hook );
+}
+
+void _EntryPoint_ReplaceAllHook( void* entryPoint, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	/* Purge the EP first. */
+	EntryPoint_Purge( self );
+	Stg_ObjectList_ReplaceAll( self->hooks, DELETE, hook );
+}
+
+
+void _EntryPoint_ReplaceHook( void* entryPoint, Name hookToReplace, Hook* hook ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if ( self->alwaysFirstHook && ( 0 == strcmp( hookToReplace, self->alwaysFirstHook->name ) ) ) {
+		self->alwaysFirstHook = NULL;
+	}
+	else if ( self->alwaysLastHook && ( 0 == strcmp( hookToReplace, self->alwaysLastHook->name ) ) ) {
+		self->alwaysLastHook = NULL;
+	}
+
+	Stg_ObjectList_Replace( self->hooks, hookToReplace, DELETE, hook );
+}
+
+
+/* PUBLIC FUNCTIONS */
+
+void EntryPoint_PrintConcise( void* entryPoint, Stream* stream ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook_Index hookIndex;
+	Hook_Ptr hook;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	Journal_Printf( stream, "\tEP: %s\n", self->name );
+	for( hookIndex = 0; hookIndex < self->hooks->count; hookIndex++ ) {
+		hook = (Hook*) self->hooks->data[hookIndex];
+		Journal_Printf( stream, "\t\tH: \"%s\"", hook->name );
+		if ( 0 != strcmp( "", hook->addedBy ) ) {
+			Journal_Printf( stream, " (%s)", hook->addedBy );
+		}
+		Journal_Printf( stream, "\n" );
+	}
+}
+
+
+void EntryPoint_Prepend( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr , addedBy );
+
+	_EntryPoint_PrependHook( self, hook );
+}
+
+void EntryPoint_Prepend_AlwaysFirst( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr, addedBy );
+
+	_EntryPoint_PrependHook_AlwaysFirst( self, hook );
+}
+
+void EntryPoint_Append( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr, addedBy );
+
+	_EntryPoint_AppendHook( self, hook );
+}
+
+
+void EntryPoint_Append_AlwaysLast( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr, addedBy );
+
+	_EntryPoint_AppendHook_AlwaysLast( self, hook );
+}
+
+
+void EntryPoint_InsertBefore( void* entryPoint, Name hookToInsertBefore, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr , addedBy );
+
+	_EntryPoint_InsertHookBefore( self, hookToInsertBefore, hook );
+}
+
+
+void EntryPoint_InsertAfter( void* entryPoint, Name hookToInsertAfter, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr , addedBy );
+
+	_EntryPoint_InsertHookAfter( self, hookToInsertAfter, hook );
+}
+
+
+void EntryPoint_ReplaceAll( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr , addedBy );
+
+	_EntryPoint_ReplaceAllHook( self, hook );
+}
+
+
+void EntryPoint_Replace( void* entryPoint, Name hookToReplace, Name name, Func_Ptr funcPtr, Name addedBy ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = Hook_New( name, funcPtr , addedBy );
+
+	_EntryPoint_ReplaceHook( self, hookToReplace, hook );
+}
+
+void EntryPoint_PrependClassHook( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_PrependHook( self, hook );
+}
+	
+void EntryPoint_PrependClassHook_AlwaysFirst( 
+	void* entryPoint, 
+	Name name, 
+	Func_Ptr funcPtr, 
+	Name addedBy, 
+	void* reference ) {
+	
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_PrependHook_AlwaysFirst( self, hook );
+}
+	
+void EntryPoint_AppendClassHook( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_AppendHook( self, hook );
+
+}
+	
+void EntryPoint_AppendClassHook_AlwaysLast( 
+	void* entryPoint, 
+	Name name, 
+	Func_Ptr funcPtr, 
+	Name addedBy, 
+	void* reference ) {
+
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_AppendHook_AlwaysLast( self, hook );
+}
+
+void EntryPoint_InsertClassHookBefore( 
+	void* entryPoint, 
+	Name hookToInsertBefore, 
+	Name name, 
+	Func_Ptr funcPtr, 
+	Name addedBy, 
+	void* reference ) {
+	
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_InsertHookBefore( self, hookToInsertBefore, hook );
+
+}
+	
+void EntryPoint_InsertClassHookAfter( 
+	void* entryPoint, 
+	Name hookToInsertAfter, 
+	Name name, 
+	Func_Ptr funcPtr, 
+	Name addedBy, 
+	void* reference ) {
+
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_InsertHookAfter( self, hookToInsertAfter, hook );
+}
+
+void EntryPoint_ReplaceClassHook( 
+	void* entryPoint, 
+	Name hookToReplace, 
+	Name name, 
+	Func_Ptr funcPtr, 
+	Name addedBy, 
+	void* reference ) {
+	
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_ReplaceHook( self, hookToReplace, hook );
+}
+	
+void EntryPoint_ReplaceAllClassHook( void* entryPoint, Name name, Func_Ptr funcPtr, Name addedBy, void* reference ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+	Hook* hook = (Hook*)ClassHook_New( name, funcPtr, addedBy, reference );
+
+	_EntryPoint_ReplaceAllHook( self, hook );
+
+}
+
+
+
+void EntryPoint_Remove( void* entryPoint, Name name ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	Stg_ObjectList_Remove( self->hooks, name, DELETE );
+}
+
+void EntryPoint_Purge( void* entryPoint ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	/* Stg_Class_Delete the existing hook information structures. Note: this won't try and delete the func ptrs themselves */
+	Stg_ObjectList_DeleteAllObjects( self->hooks );
+	self->hooks->count = 0;
+	self->alwaysFirstHook = NULL;
+	self->alwaysLastHook = NULL;
+}
+
+
+void EntryPoint_WarnIfNoHooks( void* entryPoint, Name parentFunction ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if (0 == self->hooks->count ) {
+		Name epName = self->name;
+		Stream* stream = Journal_Register (Debug_Type, self->name );
+		Journal_Printf( (void*) stream, "Warning: No hooks defined for E.P. \"%s\". Calling parent function "
+			"%s() usually implies at least one %s hook defined.\n",
+			epName, parentFunction, epName );
+	}
+}
+
+
+void EntryPoint_ErrorIfNoHooks( void* entryPoint, Name parentFunction ) {
+	EntryPoint* self = (EntryPoint*)entryPoint;
+
+	Journal_Firewall( 
+			self != NULL, 
+			Journal_Register( Error_Type, EntryPoint_Type ),
+			"Entry Point is NULL in %s\n", __func__ );
+
+	if (0 == self->hooks->count ) {
+		Name epName = self->name;
+		Stream* stream = Journal_Register (Error_Type, self->name );
+		Journal_Firewall( 0, (void*) stream, "Error: No hooks defined for E.P. \"%s\". Calling parent function "
+			"%s() requires at least one %s hook defined.\n",
+			epName, parentFunction, epName );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/EntryPoint_Register.c
--- a/Base/Extensibility/src/EntryPoint_Register.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: EntryPoint_Register.c 4120 2007-05-23 10:43:41Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "EntryPoint.h"
-#include "EntryPoint_Register.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type EntryPoint_Register_Type = "EntryPoint_Register";
-
-
-EntryPoint_Register* EntryPoint_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(EntryPoint_Register);
-	Type                              type = EntryPoint_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _EntryPoint_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _EntryPoint_Register_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return _EntryPoint_Register_New(  ENTRYPOINT_REGISTER_PASSARGS  );
-}
-
-void EntryPoint_Register_Init( void* entryPoint_Register ) {
-	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
-	
-	/* General info */
-	self->type = EntryPoint_Register_Type;
-	self->_sizeOfSelf = sizeof(EntryPoint_Register);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _EntryPoint_Register_Delete;
-	self->_print = _EntryPoint_Register_Print;
-	self->_copy = NULL;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* EntryPoint_Register info */
-	_EntryPoint_Register_Init( self );
-}
-
-EntryPoint_Register* _EntryPoint_Register_New(  ENTRYPOINT_REGISTER_DEFARGS  )
-{
-	EntryPoint_Register* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(EntryPoint_Register) );
-	self = (EntryPoint_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	_EntryPoint_Register_Init( self );
-	
-	return self;
-}
-
-void _EntryPoint_Register_Init( void* entryPoint_Register ) {
-	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
-	
-	/* General and Virtual info should already be set */
-	
-	/* EntryPoint_Register info */
-	self->count = 0;
-	self->_size = 8;
-	self->_delta = 8;
-	self->entryPoint = Memory_Alloc_Array( EntryPoint*, self->_size, "EntryPoint_Register->entryPoint" );
-	memset( self->entryPoint, 0, sizeof(EntryPoint*) * self->_size );
-}
-
-void _EntryPoint_Register_Delete( void* entryPoint_Register ) {
-	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
-	
-	/* Assumes ownerships of the element types */
-	if( self->entryPoint ) {
-		EntryPoint_Index entryPoint_I;
-		
-		for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
-			Stg_Class_Delete( self->entryPoint[entryPoint_I] );
-		}
-		
-		Memory_Free( self->entryPoint );
-	}
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-void _EntryPoint_Register_Print( void* entryPoint_Register, Stream* stream ) {
-	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
-	#ifdef DEBUG
-		EntryPoint_Index entryPoint_I;
-	#endif
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "EntryPoint_Register (ptr): %p\n", self );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-	
-	/* Virtual info */
-	
-	/* EntryPoint_Register info */
-	Journal_Printf( (void*) stream, "\tcount: %u\n", self->count );
-	Journal_Printf( (void*) stream, "\t_size: %lu\n", self->_size );
-	Journal_Printf( (void*) stream, "\t_delta: %lu\n", self->_delta );
-	
-	Journal_Printf( (void*) stream, "\tentryPoint (ptr): %p\n", self->entryPoint );
-	Journal_Printf( (void*) stream, "\tentryPoint[0-%u]:\n", self->count );
-	#ifdef DEBUG
-		for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
-			Journal_Printf( (void*) stream, "entryPoint[%u]: ", entryPoint_I );
-			Stg_Class_Print( self->entryPoint[entryPoint_I], stream);
-		}
-	#else
-		Journal_Printf( (void*) stream, "...\n" );
-	#endif
-	Journal_Printf( (void*) stream, "\t]\n" );
-}
-
-EntryPoint_Index EntryPoint_Register_Add( void* entryPoint_Register, void* entryPoint ) {
-	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
-	EntryPoint_Index	handle;
-	
-	if( self->count >= self->_size ) {
-		/*EntryPoint**	newEntryPoint;*/
-		
-		self->_size += self->_delta;
-		self->entryPoint = Memory_Realloc_Array( self->entryPoint, EntryPoint*, self->_size );
-	}
-	
-	handle = self->count;
-	self->entryPoint[handle] = (EntryPoint*) entryPoint;
-	self->count++;
-	
-	return handle;
-}
-
-EntryPoint_Index EntryPoint_Register_GetHandle( void* entryPoint_Register, Type type ) {
-	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
-	EntryPoint_Index entryPoint_I;
-	
-	for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
-		if( self->entryPoint[entryPoint_I]->name == type ) {
-			return entryPoint_I;
-		}
-	}
-	for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
-		if( strcmp( self->entryPoint[entryPoint_I]->name, type ) == 0 ) {
-			return entryPoint_I;
-		}
-	}
-	return (unsigned)-1;
-}
-
-EntryPoint* _EntryPoint_Register_At( void* entryPoint_Register, EntryPoint_Index handle ) {
-	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
-	
-	return EntryPoint_Register_At( self, handle );
-}
-
-
-EntryPoint_Index EntryPoint_Register_Find( void* entryPoint_Register, void* entryPoint ) {
-	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
-	EntryPoint_Index	ep_I;
-	
-	for( ep_I = 0; ep_I < self->count; ep_I++ ) {
-		if( self->entryPoint[ep_I] == (EntryPoint*)entryPoint ) {
-			return ep_I;
-		}
-	}
-	
-	return (EntryPoint_Index)-1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/EntryPoint_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/EntryPoint_Register.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,215 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: EntryPoint_Register.c 4120 2007-05-23 10:43:41Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "EntryPoint.h"
+#include "EntryPoint_Register.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type EntryPoint_Register_Type = "EntryPoint_Register";
+
+
+EntryPoint_Register* EntryPoint_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(EntryPoint_Register);
+	Type                              type = EntryPoint_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _EntryPoint_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _EntryPoint_Register_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return _EntryPoint_Register_New(  ENTRYPOINT_REGISTER_PASSARGS  );
+}
+
+void EntryPoint_Register_Init( void* entryPoint_Register ) {
+	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
+	
+	/* General info */
+	self->type = EntryPoint_Register_Type;
+	self->_sizeOfSelf = sizeof(EntryPoint_Register);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _EntryPoint_Register_Delete;
+	self->_print = _EntryPoint_Register_Print;
+	self->_copy = NULL;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* EntryPoint_Register info */
+	_EntryPoint_Register_Init( self );
+}
+
+EntryPoint_Register* _EntryPoint_Register_New(  ENTRYPOINT_REGISTER_DEFARGS  )
+{
+	EntryPoint_Register* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(EntryPoint_Register) );
+	self = (EntryPoint_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	_EntryPoint_Register_Init( self );
+	
+	return self;
+}
+
+void _EntryPoint_Register_Init( void* entryPoint_Register ) {
+	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
+	
+	/* General and Virtual info should already be set */
+	
+	/* EntryPoint_Register info */
+	self->count = 0;
+	self->_size = 8;
+	self->_delta = 8;
+	self->entryPoint = Memory_Alloc_Array( EntryPoint*, self->_size, "EntryPoint_Register->entryPoint" );
+	memset( self->entryPoint, 0, sizeof(EntryPoint*) * self->_size );
+}
+
+void _EntryPoint_Register_Delete( void* entryPoint_Register ) {
+	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
+	
+	/* Assumes ownerships of the element types */
+	if( self->entryPoint ) {
+		EntryPoint_Index entryPoint_I;
+		
+		for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
+			Stg_Class_Delete( self->entryPoint[entryPoint_I] );
+		}
+		
+		Memory_Free( self->entryPoint );
+	}
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+void _EntryPoint_Register_Print( void* entryPoint_Register, Stream* stream ) {
+	EntryPoint_Register* self = (EntryPoint_Register*)entryPoint_Register;
+	#ifdef DEBUG
+		EntryPoint_Index entryPoint_I;
+	#endif
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "EntryPoint_Register (ptr): %p\n", self );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+	
+	/* Virtual info */
+	
+	/* EntryPoint_Register info */
+	Journal_Printf( (void*) stream, "\tcount: %u\n", self->count );
+	Journal_Printf( (void*) stream, "\t_size: %lu\n", self->_size );
+	Journal_Printf( (void*) stream, "\t_delta: %lu\n", self->_delta );
+	
+	Journal_Printf( (void*) stream, "\tentryPoint (ptr): %p\n", self->entryPoint );
+	Journal_Printf( (void*) stream, "\tentryPoint[0-%u]:\n", self->count );
+	#ifdef DEBUG
+		for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
+			Journal_Printf( (void*) stream, "entryPoint[%u]: ", entryPoint_I );
+			Stg_Class_Print( self->entryPoint[entryPoint_I], stream);
+		}
+	#else
+		Journal_Printf( (void*) stream, "...\n" );
+	#endif
+	Journal_Printf( (void*) stream, "\t]\n" );
+}
+
+EntryPoint_Index EntryPoint_Register_Add( void* entryPoint_Register, void* entryPoint ) {
+	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
+	EntryPoint_Index	handle;
+	
+	if( self->count >= self->_size ) {
+		/*EntryPoint**	newEntryPoint;*/
+		
+		self->_size += self->_delta;
+		self->entryPoint = Memory_Realloc_Array( self->entryPoint, EntryPoint*, self->_size );
+	}
+	
+	handle = self->count;
+	self->entryPoint[handle] = (EntryPoint*) entryPoint;
+	self->count++;
+	
+	return handle;
+}
+
+EntryPoint_Index EntryPoint_Register_GetHandle( void* entryPoint_Register, Type type ) {
+	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
+	EntryPoint_Index entryPoint_I;
+	
+	for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
+		if( self->entryPoint[entryPoint_I]->name == type ) {
+			return entryPoint_I;
+		}
+	}
+	for( entryPoint_I = 0; entryPoint_I < self->count; entryPoint_I++ ) {
+		if( strcmp( self->entryPoint[entryPoint_I]->name, type ) == 0 ) {
+			return entryPoint_I;
+		}
+	}
+	return (unsigned)-1;
+}
+
+EntryPoint* _EntryPoint_Register_At( void* entryPoint_Register, EntryPoint_Index handle ) {
+	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
+	
+	return EntryPoint_Register_At( self, handle );
+}
+
+
+EntryPoint_Index EntryPoint_Register_Find( void* entryPoint_Register, void* entryPoint ) {
+	EntryPoint_Register*	self = (EntryPoint_Register*)entryPoint_Register;
+	EntryPoint_Index	ep_I;
+	
+	for( ep_I = 0; ep_I < self->count; ep_I++ ) {
+		if( self->entryPoint[ep_I] == (EntryPoint*)entryPoint ) {
+			return ep_I;
+		}
+	}
+	
+	return (EntryPoint_Index)-1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ExtensionInfo.c
--- a/Base/Extensibility/src/ExtensionInfo.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ExtensionInfo.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ExtensionManager.h"
-#include "ExtensionInfo.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <limits.h>
-
-/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-/* Textual name of this class */
-const Type ExtensionInfo_Type = "ExtensionInfo";
-
-ExtensionInfo* _ExtensionInfo_New(  EXTENSIONINFO_DEFARGS  )
-{
-	ExtensionInfo* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ExtensionInfo) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (ExtensionInfo*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	self->_dataCopy = _dataCopy;
-	
-	/* ExtensionInfo info */
-	_ExtensionInfo_Init( self, name, size, count );
-	
-	return self;
-}
-
-
-void _ExtensionInfo_Init( ExtensionInfo* self, Name name, SizeT size, Index count ) {
-	/* General and Virtual info should already be set */
-	
-	/* ExtensionInfo info */
-
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-
-	self->key = name;
-	
-	self->originalSize = size * count;
-	self->size = ExtensionManager_Align( self->originalSize );
-	self->isRegistered = False;
-	self->itemSize = size;
-	self->count = count;
-	
-	/* These are set via ExtensionInfo_Register (ie. after it is added to the ExtensionManager */
-	self->offset = 0;
-	self->extensionManager = NULL;
-	self->handle = -1;
-
-	self->data = NULL;
-}
-
-
-void _ExtensionInfo_Delete( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-	
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s\" delete a pointer of value NULL\n", ExtensionInfo_Type );
-
-	if ( self->data ) {
-		Memory_Free( self->data );
-	}
-	
-	/* Delete parent */
-	_Stg_Object_Delete( self );
-}
-
-
-void _ExtensionInfo_Print( void* extensionInfo, Stream* stream ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-		
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s\" print a pointer of value NULL\n", ExtensionInfo_Type );
-	
-	/* General info */
-	Journal_Printf( (void*)stream, "ExtensionInfo (%p):\n", self );
-	_Stg_Object_Print( self, stream );
-	Journal_Printf( (void*)stream, "\toriginalSize: %u\n", (unsigned int)self->originalSize );
-	Journal_Printf( (void*)stream, "\tsize: %u\n", (unsigned int)self->size );
-	Journal_Printf( (void*)stream, "\tisRegistered: %s\n", self->isRegistered ? "Yes" : "No" );
-	Journal_Printf( (void*)stream, "\toffset: %u\n", (unsigned int)self->offset );
-	Journal_Printf( (void*)stream, "\textensionManager: %p (ptr)\n", self->extensionManager );
-	Journal_Printf( (void*)stream, "\thandle: %u\n", self->handle );
-}
-
-void* _ExtensionInfo_Copy( const void* extensionInfo, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap  ) {
-	ExtensionInfo*		self = (ExtensionInfo*)extensionInfo;
-	ExtensionInfo*		newExtensionInfo;
-	
-	/* Copy parent */
-	newExtensionInfo = (ExtensionInfo*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	newExtensionInfo->_dataCopy = self->_dataCopy;
-	newExtensionInfo->key = self->key;
-	newExtensionInfo->originalSize = self->originalSize;
-	newExtensionInfo->size = self->size;
-	newExtensionInfo->isRegistered = self->isRegistered;
-	newExtensionInfo->itemSize = self->itemSize;
-	newExtensionInfo->count = self->count;
-	newExtensionInfo->offset = self->offset;
-	newExtensionInfo->handle = self->handle;	
-
-	newExtensionInfo->extensionManager = (ExtensionManager*)Stg_Class_Copy( self->extensionManager, NULL, deep, nameExt, ptrMap );
-
-	if ( self->data ) {
-		newExtensionInfo->data = PtrMap_Find( ptrMap, self->data );
-		Journal_Firewall(
-			newExtensionInfo->data != NULL ,
-			Journal_Register( Error_Type, __FILE__ ),
-			"Copy Error: Attempting to copy ExtensionInfo before data\n" );
-	}
-	else {
-		newExtensionInfo->data = NULL;
-	}
-	
-	return newExtensionInfo;
-}
-
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-SizeT ExtensionInfo_OriginalSizeFunc( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-	
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_OriginalSize\" a pointer of value NULL\n", ExtensionInfo_Type );
-	
-	return ExtensionInfo_OriginalSizeMacro( self );
-}
-
-
-SizeT ExtensionInfo_SizeFunc( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-	
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_Size\" a pointer of value NULL\n", ExtensionInfo_Type );
-	
-	return ExtensionInfo_SizeMacro( self );
-}
-
-SizeT ExtensionInfo_ItemSizeFunc( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-		
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_ItemSize \" a pointer of value NULL\n", ExtensionInfo_Type );
-	
-	return ExtensionInfo_ItemSizeMacro( self );
-}
-
-SizeT ExtensionInfo_CountFunc( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-		
-	Journal_Firewall( 
-			self != NULL,
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_Count \" a pointer of value NULL\n", ExtensionInfo_Type );
-	
-	return ExtensionInfo_CountMacro( self );
-}
-
-SizeT ExtensionInfo_OffsetFunc( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-		
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_Offset\" a pointer of value NULL\n", ExtensionInfo_Type );
-	Journal_DFirewall( 
-			self->isRegistered,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_Offset\" a non registered extension info\n", ExtensionInfo_Type );	
-	
-	return ExtensionInfo_OffsetMacro( self );
-}
-
-Bool ExtensionInfo_IsRegisteredFunc( void* extensionInfo ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-		
-	Journal_DFirewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_IsRegistered\" a pointer of value NULL\n", ExtensionInfo_Type );
-	
-	return ExtensionInfo_IsRegisteredMacro( self );
-}
-
-
-void* ExtensionInfo_DataCopy( void* extensionInfo, void* source, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-
-	return self->_dataCopy( self, source, dest, deep, nameExt, ptrMap );
-}
-
-void ExtensionInfo_Register( 
-	void*				extensionInfo,
-	SizeT				offset,
-	ExtensionManager*		extensionManager,
-	ExtensionInfo_Index		handle,
-	void*				data )
-{
-	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
-		
-	Journal_Firewall( 
-			self != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to \"%s_Register\" a pointer of value NULL\n", ExtensionInfo_Type );
-
-	self->isRegistered = True;
-	self->offset = offset;
-	self->extensionManager = extensionManager;
-	self->handle = handle;
-	self->data = data;
-	
-	Journal_DFirewall( 
-			self->extensionManager != NULL,  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to register an ExtensionInfo with an ExtensionManager that is NULL\n" );
-	Journal_DFirewall( 
-			self->handle != (unsigned)(-1),  
-			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-			"Attempting to register an ExtensionInfo with a handle that is invalid\n" );
-	
-	/* To consider... is there a way of checking that the handle is a sane value? SQ20050505 */
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ExtensionInfo.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ExtensionInfo.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,286 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ExtensionInfo.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ExtensionManager.h"
+#include "ExtensionInfo.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <limits.h>
+
+/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+/* Textual name of this class */
+const Type ExtensionInfo_Type = "ExtensionInfo";
+
+ExtensionInfo* _ExtensionInfo_New(  EXTENSIONINFO_DEFARGS  )
+{
+	ExtensionInfo* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ExtensionInfo) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (ExtensionInfo*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	self->_dataCopy = _dataCopy;
+	
+	/* ExtensionInfo info */
+	_ExtensionInfo_Init( self, name, size, count );
+	
+	return self;
+}
+
+
+void _ExtensionInfo_Init( ExtensionInfo* self, Name name, SizeT size, Index count ) {
+	/* General and Virtual info should already be set */
+	
+	/* ExtensionInfo info */
+
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+
+	self->key = name;
+	
+	self->originalSize = size * count;
+	self->size = ExtensionManager_Align( self->originalSize );
+	self->isRegistered = False;
+	self->itemSize = size;
+	self->count = count;
+	
+	/* These are set via ExtensionInfo_Register (ie. after it is added to the ExtensionManager */
+	self->offset = 0;
+	self->extensionManager = NULL;
+	self->handle = -1;
+
+	self->data = NULL;
+}
+
+
+void _ExtensionInfo_Delete( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+	
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s\" delete a pointer of value NULL\n", ExtensionInfo_Type );
+
+	if ( self->data ) {
+		Memory_Free( self->data );
+	}
+	
+	/* Delete parent */
+	_Stg_Object_Delete( self );
+}
+
+
+void _ExtensionInfo_Print( void* extensionInfo, Stream* stream ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+		
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s\" print a pointer of value NULL\n", ExtensionInfo_Type );
+	
+	/* General info */
+	Journal_Printf( (void*)stream, "ExtensionInfo (%p):\n", self );
+	_Stg_Object_Print( self, stream );
+	Journal_Printf( (void*)stream, "\toriginalSize: %u\n", (unsigned int)self->originalSize );
+	Journal_Printf( (void*)stream, "\tsize: %u\n", (unsigned int)self->size );
+	Journal_Printf( (void*)stream, "\tisRegistered: %s\n", self->isRegistered ? "Yes" : "No" );
+	Journal_Printf( (void*)stream, "\toffset: %u\n", (unsigned int)self->offset );
+	Journal_Printf( (void*)stream, "\textensionManager: %p (ptr)\n", self->extensionManager );
+	Journal_Printf( (void*)stream, "\thandle: %u\n", self->handle );
+}
+
+void* _ExtensionInfo_Copy( const void* extensionInfo, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap  ) {
+	ExtensionInfo*		self = (ExtensionInfo*)extensionInfo;
+	ExtensionInfo*		newExtensionInfo;
+	
+	/* Copy parent */
+	newExtensionInfo = (ExtensionInfo*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	newExtensionInfo->_dataCopy = self->_dataCopy;
+	newExtensionInfo->key = self->key;
+	newExtensionInfo->originalSize = self->originalSize;
+	newExtensionInfo->size = self->size;
+	newExtensionInfo->isRegistered = self->isRegistered;
+	newExtensionInfo->itemSize = self->itemSize;
+	newExtensionInfo->count = self->count;
+	newExtensionInfo->offset = self->offset;
+	newExtensionInfo->handle = self->handle;	
+
+	newExtensionInfo->extensionManager = (ExtensionManager*)Stg_Class_Copy( self->extensionManager, NULL, deep, nameExt, ptrMap );
+
+	if ( self->data ) {
+		newExtensionInfo->data = PtrMap_Find( ptrMap, self->data );
+		Journal_Firewall(
+			newExtensionInfo->data != NULL ,
+			Journal_Register( Error_Type, __FILE__ ),
+			"Copy Error: Attempting to copy ExtensionInfo before data\n" );
+	}
+	else {
+		newExtensionInfo->data = NULL;
+	}
+	
+	return newExtensionInfo;
+}
+
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+SizeT ExtensionInfo_OriginalSizeFunc( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+	
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_OriginalSize\" a pointer of value NULL\n", ExtensionInfo_Type );
+	
+	return ExtensionInfo_OriginalSizeMacro( self );
+}
+
+
+SizeT ExtensionInfo_SizeFunc( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+	
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_Size\" a pointer of value NULL\n", ExtensionInfo_Type );
+	
+	return ExtensionInfo_SizeMacro( self );
+}
+
+SizeT ExtensionInfo_ItemSizeFunc( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+		
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_ItemSize \" a pointer of value NULL\n", ExtensionInfo_Type );
+	
+	return ExtensionInfo_ItemSizeMacro( self );
+}
+
+SizeT ExtensionInfo_CountFunc( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+		
+	Journal_Firewall( 
+			self != NULL,
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_Count \" a pointer of value NULL\n", ExtensionInfo_Type );
+	
+	return ExtensionInfo_CountMacro( self );
+}
+
+SizeT ExtensionInfo_OffsetFunc( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+		
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_Offset\" a pointer of value NULL\n", ExtensionInfo_Type );
+	Journal_DFirewall( 
+			self->isRegistered,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_Offset\" a non registered extension info\n", ExtensionInfo_Type );	
+	
+	return ExtensionInfo_OffsetMacro( self );
+}
+
+Bool ExtensionInfo_IsRegisteredFunc( void* extensionInfo ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+		
+	Journal_DFirewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_IsRegistered\" a pointer of value NULL\n", ExtensionInfo_Type );
+	
+	return ExtensionInfo_IsRegisteredMacro( self );
+}
+
+
+void* ExtensionInfo_DataCopy( void* extensionInfo, void* source, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+
+	return self->_dataCopy( self, source, dest, deep, nameExt, ptrMap );
+}
+
+void ExtensionInfo_Register( 
+	void*				extensionInfo,
+	SizeT				offset,
+	ExtensionManager*		extensionManager,
+	ExtensionInfo_Index		handle,
+	void*				data )
+{
+	ExtensionInfo* self = (ExtensionInfo*)extensionInfo;
+		
+	Journal_Firewall( 
+			self != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to \"%s_Register\" a pointer of value NULL\n", ExtensionInfo_Type );
+
+	self->isRegistered = True;
+	self->offset = offset;
+	self->extensionManager = extensionManager;
+	self->handle = handle;
+	self->data = data;
+	
+	Journal_DFirewall( 
+			self->extensionManager != NULL,  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to register an ExtensionInfo with an ExtensionManager that is NULL\n" );
+	Journal_DFirewall( 
+			self->handle != (unsigned)(-1),  
+			Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+			"Attempting to register an ExtensionInfo with a handle that is invalid\n" );
+	
+	/* To consider... is there a way of checking that the handle is a sane value? SQ20050505 */
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ExtensionManager.c
--- a/Base/Extensibility/src/ExtensionManager.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,959 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ExtensionManager.c 4099 2007-05-16 01:01:12Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ExtensionManager.h"
-
-#include "ExtensionInfo.h"
-#include "SimpleExtensionInfo.h"
-#include "ClassPtrExtensionInfo.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-
-
-/* Textual name of this class */
-const Type ExtensionManager_Type = "Extension";
-
-
-ExtensionManager* ExtensionManager_New_OfStruct( 
-		Name				name, 
-		SizeT				initialSize )
-{
-	/* Variables set in this function */
-	SizeT                          _sizeOfSelf = sizeof(ExtensionManager);
-	Type                                  type = ExtensionManager_Type;
-	Stg_Class_DeleteFunction*          _delete = _ExtensionManager_Delete;
-	Stg_Class_PrintFunction*            _print = _ExtensionManager_Print;
-	Stg_Class_CopyFunction*              _copy = _ExtensionManager_Copy;
-	void*                      _existingObject = NULL;
-	void*                               _array = NULL;
-	SizeT                             itemSize = 0;
-	ExtensionManager*                       em = NULL;
-	Index                                count = 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
-}
-
-ExtensionManager* ExtensionManager_New_OfExistingObject( 
-		Name				name, 
-		void*				_existingObject )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(ExtensionManager);
-	Type                              type = ExtensionManager_Type;
-	Stg_Class_DeleteFunction*      _delete = _ExtensionManager_Delete;
-	Stg_Class_PrintFunction*        _print = _ExtensionManager_Print;
-	Stg_Class_CopyFunction*          _copy = _ExtensionManager_Copy;
-	SizeT                      initialSize = 0;
-	void*                           _array = NULL;
-	SizeT                         itemSize = 0;
-	ExtensionManager*                   em = NULL;
-	Index                            count = 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
-}
-
-ExtensionManager* ExtensionManager_New_OfArray(
-		Name                            name,
-		void*                           _array,
-		SizeT                           itemSize,
-		Index                           count )
-{
-	/* Variables set in this function */
-	SizeT                          _sizeOfSelf = sizeof( ExtensionManager );
-	Type                                  type = ExtensionManager_Type;
-	Stg_Class_DeleteFunction*          _delete = _ExtensionManager_Delete;
-	Stg_Class_PrintFunction*            _print = _ExtensionManager_Print;
-	Stg_Class_CopyFunction*              _copy = _ExtensionManager_Copy;
-	SizeT                          initialSize = 0;
-	void*                      _existingObject = NULL;
-	ExtensionManager*                       em = NULL;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
-}
-
-ExtensionManager* ExtensionManager_New_OfExtendedArray(
-		Name                            name,
-		void*                           _array,
-		ExtensionManager*               em,
-		Index                           count )
-{
-	/* Variables set in this function */
-	SizeT                          _sizeOfSelf = sizeof(ExtensionManager);
-	Type                                  type = ExtensionManager_Type;
-	Stg_Class_DeleteFunction*          _delete = _ExtensionManager_Delete;
-	Stg_Class_PrintFunction*            _print = _ExtensionManager_Print;
-	Stg_Class_CopyFunction*              _copy = _ExtensionManager_Copy;
-	SizeT                          initialSize = 0;
-	void*                      _existingObject = NULL;
-	SizeT                             itemSize = 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
-}
-
-void ExtensionManager_Init_OfStruct( 
-		void*				extension,
-		Name				name, 
-		SizeT				initialSize )
-{
-	ExtensionManager* self = (ExtensionManager*)extension;
-	
-	/* General info */
-	self->type = ExtensionManager_Type;
-	self->_sizeOfSelf = sizeof(ExtensionManager);
-	self->_deleteSelf = False;
-		/** Ptr to extensions to existing object. */ \
-
-	/* Virtual info */
-	self->_delete = _ExtensionManager_Delete;
-	self->_print = _ExtensionManager_Print;
-	self->_copy = _ExtensionManager_Copy;
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	/* Extension info */
-	_ExtensionManager_Init( 
-		self, 
-		initialSize, 
-		NULL,		/* no existing object */
-		NULL,		/* no arrays */
-		0,
-		NULL,
-		0 );
-}
-
-void ExtensionManager_Init_OfExistingObject( 
-		void*				extension,
-		Name				name, 
-		void*				_existingObject )
-{
-	ExtensionManager* self = (ExtensionManager*)extension;
-	
-	/* General info */
-	self->type = ExtensionManager_Type;
-	self->_sizeOfSelf = sizeof(ExtensionManager);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ExtensionManager_Delete;
-	self->_print = _ExtensionManager_Print;
-	self->_copy = _ExtensionManager_Copy;
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	/* Extension info */
-	_ExtensionManager_Init( 
-		self, 
-		0, 		/* not extending struct here */
-		_existingObject,
-		NULL,		/* no arrays */
-		0,
-		NULL,
-		0 );
-}
-
-void ExtensionManager_Init_OfArray(
-		void*                           extension,
-		Name                            name,
-		void*                           _array,
-		SizeT                           itemSize,
-		Index                           count )
-{
-	ExtensionManager* self = (ExtensionManager*)extension;
-	
-	/* General info */
-	self->type = ExtensionManager_Type;
-	self->_sizeOfSelf = sizeof(ExtensionManager);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ExtensionManager_Delete;
-	self->_print = _ExtensionManager_Print;
-	self->_copy = _ExtensionManager_Copy;
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	/* Extension info */
-	_ExtensionManager_Init( 
-		self,
-		0,		/* not extending struct here */
-		NULL,		/* no existing item */
-		_array,
-		itemSize,
-		NULL,		/* items are not extended */
-		count );
-}
-
-void ExtensionManager_Init_OfExtendedArray(
-		void*                           extension,
-		Name                            name,
-		void*                           _array,
-		ExtensionManager*               em,
-		Index                           count )
-{
-	ExtensionManager* self = (ExtensionManager*)extension;
-	
-	/* General info */
-	self->type = ExtensionManager_Type;
-	self->_sizeOfSelf = sizeof(ExtensionManager);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ExtensionManager_Delete;
-	self->_print = _ExtensionManager_Print;
-	self->_copy = _ExtensionManager_Copy;
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	/* Extension info */
-	_ExtensionManager_Init( 
-		self,
-		0,		/* not extending struct here */
-		NULL,		/* no existing item */
-		_array,
-		0,		/* get itemSize from em */
-		em,
-		count );
-}
-
-ExtensionManager* _ExtensionManager_New(  EXTENSIONMANAGER_DEFARGS  )
-{
-	ExtensionManager* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ExtensionManager) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (ExtensionManager*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	_ExtensionManager_Init( self, initialSize, _existingObject, _array, itemSize, em, count );
-	
-	return self;
-}
-
-void _ExtensionManager_Init(
-		void*				extension,
-		SizeT				initialSize,
-		void*				_existingObject,
-		void*				_array,
-		SizeT				itemSize,
-		ExtensionManager*		em,
-		Index				count )
-{
-	ExtensionManager* self = (ExtensionManager*)extension;
-	/* General and Virtual info should already be set */
-
-	if ( _array ) {
-		if ( em ) {
-			/* arrays of extended structs take item size from em */
-			itemSize = ExtensionManager_GetFinalSize( em );
-		}
-
-		/* if its an array, all sizes should be item size */
-		initialSize = itemSize;
-	}
-	
-	self->extInfos = Stg_ObjectList_New();
-	/*self->objToExtensionMapper = HashTable_New( Stg_Class_Copy, NULL, Stg_Class_Delete, HASHTABLE_POINTER_KEY );*/
-
-	/* Extension info */
-	self->initialSize = initialSize;
-	self->finalSize = self->initialSize;
-	self->dataCopyFunc = NULL;
-
-	self->_existingObject = _existingObject;
-	self->_extensionsToExisting = NULL;
-	/*
-	if ( self->_existingObject ) {
-		HashTable_InsertEntry( 
-			self->objToExtensionMapper, 
-			self->_existingObject, 
-			sizeof(void*),
-			HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY ),
-			sizeof(HashTable) );
-	}
-	*/
-	self->_array = _array;
-	self->itemSize = itemSize;
-	self->em = em;
-	self->count = count;
-}
-
-
-void _ExtensionManager_Delete( void* extension ) {
-	ExtensionManager* self = (ExtensionManager*)extension;
-	
-	if( self->_extensionsToExisting ) {
-		Memory_Free( self->_extensionsToExisting );
-	}
-	
-	Stg_Class_Delete( self->extInfos );
-	/*Stg_Class_Delete( self->objToExtensionMapper );*/
-
-	/* Stg_Class_Delete parent */
-	_Stg_Object_Delete( self );
-}
-
-void _ExtensionManager_Print( void* extension, Stream* stream ) {
-	ExtensionManager* self = (ExtensionManager*)extension;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Extension (ptr):%p\n", self );
-	
-	/* Print parent */
-	_Stg_Object_Print( self, stream );
-	
-	/* Virtual info */
-	
-	/* Extension info */
-	Journal_Printf( (void*) stream, "\tinitialSize %lu\n", self->initialSize );
-	Journal_Printf( (void*) stream, "\tfinalSize %lu\n", self->finalSize );
-	Journal_Printf( (void*) stream, "\tcount: %u\n", self->extInfos->count );
-	
-	Journal_Printf( (void*) stream, "\textInfos (ptr): %p\n", (void*)self->extInfos );
-	Stg_Class_Print( self->extInfos, stream );
-	
-	Journal_Printf( (void*)stream, "\t_extensionsToExisting (ptr): %p\n", self->_extensionsToExisting );
-	Journal_Printf( (void*)stream, "\t_existingObject (ptr): %p\n", self->_existingObject );
-
-	Journal_Printf( (void*)stream, "\t_array (ptr): %p\n", self->_array );
-	Journal_Printf( (void*)stream, "\titemSize %lu\n", self->itemSize );
-	Journal_Printf( (void*)stream, "\tem (ptr) %p\n", self->em );
-	Journal_Printf( (void*)stream, "\tcount %u\n", self->count );
-}
-
-
-void* _ExtensionManager_Copy( const void* extensionManager, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	ExtensionManager*	self = (ExtensionManager*)extensionManager;
-	ExtensionManager*	newExtensionManager;
-	PtrMap*			map = ptrMap;
-	Index item_I;
-	Index ext_I;
-	void* data;
-	ExtensionInfo* srcInfo;
-
-	newExtensionManager = (ExtensionManager*)_Stg_Object_Copy( self, dest, deep, nameExt, map );
-	
-	newExtensionManager->initialSize = self->initialSize;
-	newExtensionManager->finalSize = self->finalSize;
-	newExtensionManager->dataCopyFunc = self->dataCopyFunc;
-
-	/* Of Existing */
-	if ( self->_existingObject ) {
-		/* ExtensionManager assumes the object is already copied */
-		newExtensionManager->_existingObject = PtrMap_Find( map, self->_existingObject );
-		Journal_Firewall(
-			newExtensionManager->_existingObject != NULL,
-			Journal_Register( Error_Type, __FILE__ ),
-			"Copy Error: ExtensionManager copied before _existingObject\n" );
-	}
-	else {
-		newExtensionManager->_existingObject = NULL;
-	}
-	
-	if ( self->_extensionsToExisting ) {
-		/* OfObject case */
-		if( (newExtensionManager->_extensionsToExisting = PtrMap_Find( map, self->_extensionsToExisting )) == NULL && 
-			self->_extensionsToExisting )
-		{
-			Index ext_I;
-			ArithPointer offset;
-			newExtensionManager->_extensionsToExisting = Memory_Alloc_Bytes( 
-				self->finalSize, 
-				"Extended data", 
-				self->name );
-			PtrMap_Append( map, self->_extensionsToExisting, newExtensionManager->_extensionsToExisting );
-			offset = 0;
-			for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
-				ExtensionInfo* eInfo = (ExtensionInfo*)Stg_ObjectList_At( self->extInfos, ext_I );
-				ExtensionInfo_DataCopy(
-					eInfo,
-					(void*)((ArithPointer)self->_extensionsToExisting + offset),
-					(void*)((ArithPointer)newExtensionManager->_extensionsToExisting + offset ),
-					True,
-					nameExt,
-					map );
-
-				offset += ExtensionInfo_Size( eInfo );
-				PtrMap_Append(
-					map,
-					(void*)((ArithPointer)self->_extensionsToExisting + offset),
-					(void*)((ArithPointer)newExtensionManager->_extensionsToExisting + offset ) );
-			}
-		}
-	}
-	else {
-		newExtensionManager->_extensionsToExisting = NULL;
-	}
-
-	if ( self->_array ) {
-		/* Array case */
-		newExtensionManager->_array = PtrMap_Find( map, self->_array );
-		if ( newExtensionManager->_array == NULL ) {
-			if ( self->em ) {
-				/* ExtendedArray case */
-				newExtensionManager->_array = ExtensionManager_CopyAllocation(
-					self->em,
-					self->_array,
-					NULL,
-					deep,
-					nameExt,
-					ptrMap,
-					self->count );
-				
-			}
-			else {
-				/* OfArray case */
-				newExtensionManager->_array = Memory_Alloc_Bytes( 
-					self->itemSize * self->count, 
-					"Base Type", 
-					self->name );
-				PtrMap_Append( map, self->_array, newExtensionManager->_array );
-
-			}
-		}
-
-		/* Add each item of array to pointer map */
-		for ( item_I = 0; item_I < self->count; ++item_I ) {
-			PtrMap_Append(
-				map,
-				(void*)( ((ArithPointer)self->_array) + (self->itemSize * item_I) ),
-				(void*)( ((ArithPointer)newExtensionManager->_array) +
-					 (self->itemSize * item_I) ) );
-		}
-		
-		/* Copy each item of the array */
-		if ( self->dataCopyFunc ) {
-			for ( item_I = 0; item_I < self->count; ++item_I ) {
-				Stg_Generic_Copy( 
-					self->dataCopyFunc,
-					(void*)( ((ArithPointer)self->_array) + (self->itemSize * item_I) ),
-					(void*)( ((ArithPointer)newExtensionManager->_array) + 
-						(self->itemSize * item_I) ),
-					deep,
-					nameExt,
-					ptrMap );
-			}
-		}
-		else {
-			memcpy( newExtensionManager->_array, self->_array, self->itemSize * self->count );
-		}
-
-		/* Copy the extensions */
-		for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
-			srcInfo = ExtensionInfo_At( self->extInfos, ext_I );
-			data = PtrMap_Find( map, srcInfo->data );
-			if ( data == NULL ) {
-				data = Memory_Alloc_Bytes( 
-					srcInfo->size * self->count, 
-					"Extended data",
-					self->name );
-				PtrMap_Append( map, srcInfo->data, data );
-			}
-			for ( item_I = 0; item_I < self->count; ++item_I ) {
-				ExtensionInfo_DataCopy( 
-					srcInfo, 
-					((void*)((ArithPointer)srcInfo->data + (srcInfo->itemSize * item_I) )),
-					((void*)((ArithPointer)data + (srcInfo->itemSize * item_I) )),
-					deep,
-					nameExt,
-					map );
-				PtrMap_Append(
-					map,
-					((void*)((ArithPointer)srcInfo->data + (srcInfo->itemSize * item_I) )),
-					((void*)((ArithPointer)data + (srcInfo->itemSize * item_I) )) );
-			}
-		}
-	}
-	else {
-		newExtensionManager->_array = NULL;
-	}
-
-	newExtensionManager->itemSize = self->itemSize;
-	newExtensionManager->em = (ExtensionManager*)Stg_Class_Copy( self->em, NULL, deep, nameExt, ptrMap );
-	newExtensionManager->count = self->count;
-
-	/* Must be copied after all the data ptrs have been appended to map */
-	newExtensionManager->objToExtensionMapper = (HashTable*)Stg_Class_Copy( self->objToExtensionMapper, NULL, deep, nameExt, ptrMap );
-	
-	/* must be copied last bacause of array case */
-	newExtensionManager->extInfos = (ExtensionInfoList*)Stg_Class_Copy( self->extInfos, NULL, deep, nameExt, ptrMap );
-
-	return (void*)newExtensionManager;
-}
-
-void ExtensionManager_SetDataCopyFunc( void* extensionManager, Stg_Class_CopyFunction* dataCopyFunc ) {
-	ExtensionManager* self = (ExtensionManager*)extensionManager;
-
-	self->dataCopyFunc = dataCopyFunc;
-}
-
-ExtensionInfo_Index ExtensionManager_AddExtensionInfo( void* extensionManager, void* extensionInfo ) {
-	ExtensionManager* self = (ExtensionManager*)extensionManager;
-	ExtensionInfo* newExtension = (ExtensionInfo*) extensionInfo;
-
-	ExtensionInfo_Index	handle;
-	SizeT			offset;
-	SizeT			oldFinalSize;
-
-	Journal_Firewall(
-		self->lockDown == False,
-		Journal_MyStream( Error_Type, self ),
-		"Error in func %s: Trying to add extension \"%s\" to ExtensionManager \"%s\" when it is in lock down mode "
-		"(No more extensions can be added).\n"
-		"Please ensure that the source code is not adding to the wrong ExtensionManager or contact the developer.\n",
-		__func__,
-		newExtension->key,
-		self->name );
-	
-	handle = self->extInfos->count;
-	offset = ExtensionManager_Size( self ); /* aligned, size of everything */
-	
-	if ( self->_array == NULL ) {
-		/* Struct or Object case */
-		oldFinalSize = ExtensionManager_Size( self );
-		
-		Stg_ObjectList_Append( self->extInfos, newExtension ); 
-		ExtensionInfo_Register( newExtension, offset, self, handle, NULL );
-
-		self->finalSize = ExtensionManager_Size( self );
-	
-		/* if we are extending an existing object, allocate more memory */
-		if( self->_existingObject ) {
-			/*
-			HashTable* ht = HashTable_FindEntry( self->objToExtensionMapper, self->_existingObject, sizeof(HashTable), HashTable );
-			*/
-			if (! self->_extensionsToExisting ) {
-				self->_extensionsToExisting = Memory_Alloc_Bytes( self->finalSize, "Extended data", self->name );
-				/* Use 0 as size of data because its a don't care */
-				/*HashTable_InsertEntry( ht, newExtension->key, sizeof(Name), self->_extensionsToExisting, 0 ); */
-			} 
-			else {
-				/* 
-				HashTable* newHt;
-				Index ext_I;
-				void* curPointer;
-				*/
-				
-				self->_extensionsToExisting = Memory_Realloc( self->_extensionsToExisting, self->finalSize );
-				memset( 
-					(void*)((ArithPointer)self->_extensionsToExisting + (ArithPointer)oldFinalSize), 
-					0, 
-					self->finalSize - oldFinalSize );
-				/* rehash the lot */
-				/*
-				newHt = HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY );
-				curPointer = self->_extensionsToExisting;
-				for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
-					ExtensionInfo* eInfo = (ExtensionInfo*)Stg_ObjectList_At( self->extInfos, ext_I );
-					HashTable_InsertEntry( newHt, eInfo->key, sizeof(Name), curPointer, 0 );
-					curPointer = (void*)((ArithPointer)curPointer + (ArithPointer)ExtensionInfo_Size( eInfo ));
-				}
-				HashTable_ReplaceEntry( self->objToExtensionMapper, self->_existingObject, sizeof(void*), newHt, sizeof(HashTable) );
-				*/
-			}
-			
-		}
-		return handle;
-	}
-	else {
-		/* Array or ExtendedArray case */
-		void* data;
-
-		/*HashTable* ht;*/
-		void* curObj;
-		void* curExtData;
-		Index obj_I;
-		
-		/* each extension stores a pointer to array of extended memory */
-		/* created the array of extended data */
-		data = Memory_Alloc_Bytes( newExtension->size * self->count, "Extended data", self->name );
-	
-		/* Add the extension.
-		 * Note that in this case, offset convention is retained for the purpose of
-		 * size calculation and is NOT to be used */
-		Stg_ObjectList_Append( self->extInfos, newExtension );
-		ExtensionInfo_Register( newExtension, offset, self, handle, data );
-
-		/*
-		if ( ExtensionManager_OfExtendedArray( self ) ) {
-			ht = self->em->objToExtensionMapper;
-		}
-		else {
-			ht = self->objToExtensionMapper;
-		}
-		*/
-		
-		curObj = self->_array;
-		curExtData = data;
-		for ( obj_I = 0; obj_I < self->count; ++obj_I ) {
-			/*
-			HashTable* extHt = HashTable_FindEntry( ht, curObj, sizeof(void*), HashTable );
-			HashTable_InsertEntry( extHt, newExtension->key, sizeof(Name), curExtData, 0 );
-			*/
-
-			curObj = (void*)((ArithPointer)curObj + (ArithPointer)self->itemSize);
-			curExtData = (void*)((ArithPointer)curExtData + (ArithPointer)ExtensionInfo_Size( newExtension ) );
-		}
-
-		if ( self->em ) {
-			return handle + self->em->extInfos->count;
-		}
-		
-		return handle;
-	}
-		
-}
-	
-
-ExtensionInfo_Index ExtensionManager_AddArray( 
-	void* extension, 
-	Name extensionName, 
-	SizeT size, 
-	Index count )
-{
-	ExtensionInfo* newExtInfo = (ExtensionInfo*)SimpleExtensionInfo_New( extensionName, ExtensionManager_Align( size ), count );
-	return ExtensionManager_AddExtensionInfo( extension, newExtInfo );
-}
-
-ExtensionInfo_Index ExtensionManager_AddClassPtrArray( 
-	void* extension, 
-	Name extensionName, 
-	Stg_Class_CopyFunction* copyFunc, 
-	Index count ) {
-
-	ExtensionInfo* newExtInfo = (ExtensionInfo*)ClassPtrExtensionInfo_New( extensionName, copyFunc, count );
-	return ExtensionManager_AddExtensionInfo( extension, newExtInfo );
-}
-
-ExtensionInfo_Index ExtensionManager_GetHandle( void* extension, const Name extensionName ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	ExtensionInfo_Index			result = 0;
-	ExtensionInfo_Index			offset_I;
-
-	if ( self->em ) {
-		result = ExtensionManager_GetHandle( self->em, extensionName );
-		if ( result != (unsigned)-1 ) {
-			return result;
-		}
-		/* not found, so the result must be the prev + current extInfos handle if any */
-		result = self->em->extInfos->count;
-	}
-	
-	for( offset_I = 0; offset_I < self->extInfos->count; offset_I++ ) {
-		if( strcmp( extensionName, ExtensionInfo_At( self->extInfos, offset_I )->key ) == 0 ) {
-			return result + offset_I;
-		}
-	}
-	
-	return (unsigned)-1;
-}
-
-void* ExtensionManager_GetOFunc( void* extension, void* ptr, ExtensionInfo_Index handle ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_GetOMacro( self, ptr, handle );
-}
-
-void* ExtensionManager_GetCFunc( void* extension, void* ptr, ExtensionInfo_Index handle ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_GetCMacro( self, ptr, handle );
-}
-
-void* ExtensionManager_GetAFunc( void* extension, void* itemPtr, ExtensionInfo_Index handle ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_GetAMacro( self, itemPtr, handle );
-}
-
-void* ExtensionManager_GetExtendedAFunc( void* extension, void* itemPtr, ExtensionInfo_Index handle ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_GetExtendedAMacro( self, itemPtr, handle );
-}
-
-void* ExtensionManager_GetFunc( void* extension, void* ptr, ExtensionInfo_Index handle ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_GetMacro( self, ptr, handle );
-}
-
-void* ExtensionManager_HashGet( void* extension, void* ptr, Name key ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	/*
-
-	HashTable* extHt;
-	void* result;
-	
-	if ( ExtensionManager_OfExtendedArray( self ) ) {
-		return ExtensionManager_HashGet( self->em, ptr, key );
-	}
-	extHt = HashTable_FindEntry( self->objToExtensionMapper, ptr, sizeof(void*), HashTable );
-	if ( extHt == NULL ) {
-		return NULL;
-	}
-	result = HashTable_FindEntry( extHt, key, sizeof(Name), void);
-	*/
-/* Uncomment this code to allow string compare to work */
-/*
-	if ( result == NULL && key != NULL ) {
-		Index ext_I;
-		for ( ext_I = 0; ext_I == self->extInfos->count; ++ext_I ) {
-			if ( strcmp( key, ExtensionInfo_At( self->extInfos, ext_I )->key ) == 0 ) {
-				result = HashTable_FindEntry( self->objToExtensionMapper, ExtensionInfo_At( self->extInfos, ext_I )->key, sizeof(void*), HashTable );
-				break;
-			}
-		}
-	}
-*/
-/*
-	return result;
-*/
-	Journal_Firewall( False, Journal_Register( ErrorStream_Type, self->type ),
-		"%s() currently disabled.\n", __func__ );
-	return NULL;
-}
-
-SizeT ExtensionManager_SizeFunc( void* extension ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-
-	return ExtensionManager_SizeMacro( self );
-}
-
-Bool ExtensionManager_OfExistingFunc( void* extension ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-
-	return ExtensionManager_OfExistingMacro( self ) ? True : False;
-}
-
-Bool ExtensionManager_OfArrayFunc( void* extension ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-
-	return ExtensionManager_OfArrayMacro( self ) ? True : False;
-}
-
-Bool ExtensionManager_OfExtendedArrayFunc( void* extension ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-
-	return ExtensionManager_OfExtendedArrayMacro( self ) ? True : False;
-}
-
-SizeT ExtensionManager_GetFinalSizeFunc( void* extension ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-
-	return ExtensionManager_GetFinalSizeMacro( self );
-}
-
-SizeT ExtensionManager_AlignFunc( SizeT size ) {
-	return ExtensionManager_AlignMacro( size );
-}
-
-void* ExtensionManager_Malloc( void* extension, Index count ) {
-	ExtensionManager* self = (ExtensionManager*)extension;
-	void* result;
-
-	/*Index obj_I;*/
-	/*Index ext_I;*/
-	void* curObj;
-
-	if ( ExtensionManager_OfExisting( self ) ) {
-		return NULL;
-	}
-	
-	result = Memory_Alloc_Array_Bytes( ExtensionManager_GetFinalSize( (self) ), (count), "Extended object", (self)->name );
-	memset( result, 0, ExtensionManager_GetFinalSize( self ) * count );
-
-	if ( ExtensionManager_GetFinalSize( self ) > 0 ) {
-		curObj = result;
-		/*
-		for ( obj_I = 0; obj_I < count; ++obj_I ) {
-			HashTable* objHt = HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY );
-			HashTable_InsertEntry( self->objToExtensionMapper, curObj, sizeof(void*), objHt, sizeof(HashTable ) );
-
-			HashTable_InsertEntry( objHt, NULL, sizeof(Name), curObj, 0 );
-			curObj = (void*)((ArithPointer)curObj + (ArithPointer)self->initialSize);
-			
-			for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
-				ExtensionInfo* eInfo = (ExtensionInfo*)Stg_ObjectList_At( self->extInfos, ext_I );
-
-				HashTable_InsertEntry( objHt, eInfo->key, sizeof(Name), curObj, 0 );
-
-				curObj = (void*)((ArithPointer)curObj + (ArithPointer)ExtensionInfo_Size( eInfo ));
-			}
-		}
-		*/
-	}
-	
-	return result;
-}
-
-void* ExtensionManager_CopyAllocation(
-		void* extension,
-		void* array,
-		void* dest,
-		Bool deep,
-		Name nameExt,
-		PtrMap* ptrMap,
-		Index count )
-{
-	ExtensionManager* self = (ExtensionManager*)extension;
-	Bool ownMap = False;
-	void* srcCurrent;
-	void* destCurrent;
-	Index item_I;
-	Index ext_I;
-
-	ArithPointer offset;
-
-	if ( array == NULL ) {
-		return NULL;
-	}
-	if ( !ptrMap ) {
-		ptrMap = PtrMap_New( 1 );
-		ownMap = True;
-	}
-	
-	if ( dest == NULL ) {
-		dest = PtrMap_Find( ptrMap, array );
-		if ( dest == NULL ) {
-			dest = Memory_Alloc_Bytes( 
-				ExtensionManager_GetFinalSizeFunc( self ) * count, 
-				"Extended object", 
-				self->name );
-			PtrMap_Append( ptrMap, array, dest );
-		}
-	}
-
-	for ( item_I = 0; item_I < count; ++item_I ) {
-		if ( self->dataCopyFunc ) {
-			Stg_Generic_Copy(
-				self->dataCopyFunc,
-				(void*)(((ArithPointer)array) + (ExtensionManager_GetFinalSize(self) * item_I)),
-				(void*)(((ArithPointer)dest) + (ExtensionManager_GetFinalSize(self)* item_I)),
-				deep,
-				nameExt,
-				ptrMap );
-		}
-		else {
-			memcpy(
-				(void*)(((ArithPointer)dest) + (ExtensionManager_GetFinalSize(self)* item_I)),
-				(void*)(((ArithPointer)array) + (ExtensionManager_GetFinalSize(self) * item_I)),
-				self->initialSize );
-		}
-		PtrMap_Append( 
-			ptrMap,
-			(void*)(((ArithPointer)array) + (ExtensionManager_GetFinalSize(self) * item_I)),
-			(void*)(((ArithPointer)dest) + (ExtensionManager_GetFinalSize(self)* item_I)) );
-
-		srcCurrent = ExtensionManager_At( self, array, item_I );
-		destCurrent = ExtensionManager_At( self, dest, item_I );
-		
-		/* each extension */
-		offset = self->initialSize;
-		for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ){
-			ExtensionInfo_DataCopy( 
-				Stg_ObjectList_At( self->extInfos, ext_I ),
-				(void*)((ArithPointer)srcCurrent + (ArithPointer)offset),
-				(void*)((ArithPointer)destCurrent + (ArithPointer)offset),
-				deep,
-				nameExt,
-				ptrMap );
-
-			offset += ExtensionInfo_At( self->extInfos, ext_I )->size;
-		}
-	}
-
-	if ( ownMap ) {
-		Stg_Class_Delete( ptrMap );
-	}
-
-	return dest;
-}
-
-
-void* ExtensionManager_MemsetFunc( void* extension, void* ptr, int value, Index count ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_MemsetMacro( self, ptr, value, count );
-}
-
-void ExtensionManager_FreeFunc( void* extension, void* ptr ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	ExtensionManager_FreeMacro( self, ptr );
-}
-
-void* ExtensionManager_AtFunc( void* extension, void* ptr, Index index ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	return ExtensionManager_AtMacro( self, ptr, index );
-}
-
-void ExtensionManager_SetLockDown( void* extension, Bool lockDown ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-	
-	self->lockDown = lockDown;
-}
-Bool ExtensionManager_GetLockDown( void* extension ) {
-	ExtensionManager*			self = (ExtensionManager*)extension;
-
-	return self->lockDown;
-}
-
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ExtensionManager.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ExtensionManager.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,959 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ExtensionManager.c 4099 2007-05-16 01:01:12Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ExtensionManager.h"
+
+#include "ExtensionInfo.h"
+#include "SimpleExtensionInfo.h"
+#include "ClassPtrExtensionInfo.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+
+
+/* Textual name of this class */
+const Type ExtensionManager_Type = "Extension";
+
+
+ExtensionManager* ExtensionManager_New_OfStruct( 
+		Name				name, 
+		SizeT				initialSize )
+{
+	/* Variables set in this function */
+	SizeT                          _sizeOfSelf = sizeof(ExtensionManager);
+	Type                                  type = ExtensionManager_Type;
+	Stg_Class_DeleteFunction*          _delete = _ExtensionManager_Delete;
+	Stg_Class_PrintFunction*            _print = _ExtensionManager_Print;
+	Stg_Class_CopyFunction*              _copy = _ExtensionManager_Copy;
+	void*                      _existingObject = NULL;
+	void*                               _array = NULL;
+	SizeT                             itemSize = 0;
+	ExtensionManager*                       em = NULL;
+	Index                                count = 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
+}
+
+ExtensionManager* ExtensionManager_New_OfExistingObject( 
+		Name				name, 
+		void*				_existingObject )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(ExtensionManager);
+	Type                              type = ExtensionManager_Type;
+	Stg_Class_DeleteFunction*      _delete = _ExtensionManager_Delete;
+	Stg_Class_PrintFunction*        _print = _ExtensionManager_Print;
+	Stg_Class_CopyFunction*          _copy = _ExtensionManager_Copy;
+	SizeT                      initialSize = 0;
+	void*                           _array = NULL;
+	SizeT                         itemSize = 0;
+	ExtensionManager*                   em = NULL;
+	Index                            count = 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
+}
+
+ExtensionManager* ExtensionManager_New_OfArray(
+		Name                            name,
+		void*                           _array,
+		SizeT                           itemSize,
+		Index                           count )
+{
+	/* Variables set in this function */
+	SizeT                          _sizeOfSelf = sizeof( ExtensionManager );
+	Type                                  type = ExtensionManager_Type;
+	Stg_Class_DeleteFunction*          _delete = _ExtensionManager_Delete;
+	Stg_Class_PrintFunction*            _print = _ExtensionManager_Print;
+	Stg_Class_CopyFunction*              _copy = _ExtensionManager_Copy;
+	SizeT                          initialSize = 0;
+	void*                      _existingObject = NULL;
+	ExtensionManager*                       em = NULL;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
+}
+
+ExtensionManager* ExtensionManager_New_OfExtendedArray(
+		Name                            name,
+		void*                           _array,
+		ExtensionManager*               em,
+		Index                           count )
+{
+	/* Variables set in this function */
+	SizeT                          _sizeOfSelf = sizeof(ExtensionManager);
+	Type                                  type = ExtensionManager_Type;
+	Stg_Class_DeleteFunction*          _delete = _ExtensionManager_Delete;
+	Stg_Class_PrintFunction*            _print = _ExtensionManager_Print;
+	Stg_Class_CopyFunction*              _copy = _ExtensionManager_Copy;
+	SizeT                          initialSize = 0;
+	void*                      _existingObject = NULL;
+	SizeT                             itemSize = 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _ExtensionManager_New(  EXTENSIONMANAGER_PASSARGS  );
+}
+
+void ExtensionManager_Init_OfStruct( 
+		void*				extension,
+		Name				name, 
+		SizeT				initialSize )
+{
+	ExtensionManager* self = (ExtensionManager*)extension;
+	
+	/* General info */
+	self->type = ExtensionManager_Type;
+	self->_sizeOfSelf = sizeof(ExtensionManager);
+	self->_deleteSelf = False;
+		/** Ptr to extensions to existing object. */ \
+
+	/* Virtual info */
+	self->_delete = _ExtensionManager_Delete;
+	self->_print = _ExtensionManager_Print;
+	self->_copy = _ExtensionManager_Copy;
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	/* Extension info */
+	_ExtensionManager_Init( 
+		self, 
+		initialSize, 
+		NULL,		/* no existing object */
+		NULL,		/* no arrays */
+		0,
+		NULL,
+		0 );
+}
+
+void ExtensionManager_Init_OfExistingObject( 
+		void*				extension,
+		Name				name, 
+		void*				_existingObject )
+{
+	ExtensionManager* self = (ExtensionManager*)extension;
+	
+	/* General info */
+	self->type = ExtensionManager_Type;
+	self->_sizeOfSelf = sizeof(ExtensionManager);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ExtensionManager_Delete;
+	self->_print = _ExtensionManager_Print;
+	self->_copy = _ExtensionManager_Copy;
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	/* Extension info */
+	_ExtensionManager_Init( 
+		self, 
+		0, 		/* not extending struct here */
+		_existingObject,
+		NULL,		/* no arrays */
+		0,
+		NULL,
+		0 );
+}
+
+void ExtensionManager_Init_OfArray(
+		void*                           extension,
+		Name                            name,
+		void*                           _array,
+		SizeT                           itemSize,
+		Index                           count )
+{
+	ExtensionManager* self = (ExtensionManager*)extension;
+	
+	/* General info */
+	self->type = ExtensionManager_Type;
+	self->_sizeOfSelf = sizeof(ExtensionManager);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ExtensionManager_Delete;
+	self->_print = _ExtensionManager_Print;
+	self->_copy = _ExtensionManager_Copy;
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	/* Extension info */
+	_ExtensionManager_Init( 
+		self,
+		0,		/* not extending struct here */
+		NULL,		/* no existing item */
+		_array,
+		itemSize,
+		NULL,		/* items are not extended */
+		count );
+}
+
+void ExtensionManager_Init_OfExtendedArray(
+		void*                           extension,
+		Name                            name,
+		void*                           _array,
+		ExtensionManager*               em,
+		Index                           count )
+{
+	ExtensionManager* self = (ExtensionManager*)extension;
+	
+	/* General info */
+	self->type = ExtensionManager_Type;
+	self->_sizeOfSelf = sizeof(ExtensionManager);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ExtensionManager_Delete;
+	self->_print = _ExtensionManager_Print;
+	self->_copy = _ExtensionManager_Copy;
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	/* Extension info */
+	_ExtensionManager_Init( 
+		self,
+		0,		/* not extending struct here */
+		NULL,		/* no existing item */
+		_array,
+		0,		/* get itemSize from em */
+		em,
+		count );
+}
+
+ExtensionManager* _ExtensionManager_New(  EXTENSIONMANAGER_DEFARGS  )
+{
+	ExtensionManager* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ExtensionManager) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (ExtensionManager*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	_ExtensionManager_Init( self, initialSize, _existingObject, _array, itemSize, em, count );
+	
+	return self;
+}
+
+void _ExtensionManager_Init(
+		void*				extension,
+		SizeT				initialSize,
+		void*				_existingObject,
+		void*				_array,
+		SizeT				itemSize,
+		ExtensionManager*		em,
+		Index				count )
+{
+	ExtensionManager* self = (ExtensionManager*)extension;
+	/* General and Virtual info should already be set */
+
+	if ( _array ) {
+		if ( em ) {
+			/* arrays of extended structs take item size from em */
+			itemSize = ExtensionManager_GetFinalSize( em );
+		}
+
+		/* if its an array, all sizes should be item size */
+		initialSize = itemSize;
+	}
+	
+	self->extInfos = Stg_ObjectList_New();
+	/*self->objToExtensionMapper = HashTable_New( Stg_Class_Copy, NULL, Stg_Class_Delete, HASHTABLE_POINTER_KEY );*/
+
+	/* Extension info */
+	self->initialSize = initialSize;
+	self->finalSize = self->initialSize;
+	self->dataCopyFunc = NULL;
+
+	self->_existingObject = _existingObject;
+	self->_extensionsToExisting = NULL;
+	/*
+	if ( self->_existingObject ) {
+		HashTable_InsertEntry( 
+			self->objToExtensionMapper, 
+			self->_existingObject, 
+			sizeof(void*),
+			HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY ),
+			sizeof(HashTable) );
+	}
+	*/
+	self->_array = _array;
+	self->itemSize = itemSize;
+	self->em = em;
+	self->count = count;
+}
+
+
+void _ExtensionManager_Delete( void* extension ) {
+	ExtensionManager* self = (ExtensionManager*)extension;
+	
+	if( self->_extensionsToExisting ) {
+		Memory_Free( self->_extensionsToExisting );
+	}
+	
+	Stg_Class_Delete( self->extInfos );
+	/*Stg_Class_Delete( self->objToExtensionMapper );*/
+
+	/* Stg_Class_Delete parent */
+	_Stg_Object_Delete( self );
+}
+
+void _ExtensionManager_Print( void* extension, Stream* stream ) {
+	ExtensionManager* self = (ExtensionManager*)extension;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Extension (ptr):%p\n", self );
+	
+	/* Print parent */
+	_Stg_Object_Print( self, stream );
+	
+	/* Virtual info */
+	
+	/* Extension info */
+	Journal_Printf( (void*) stream, "\tinitialSize %lu\n", self->initialSize );
+	Journal_Printf( (void*) stream, "\tfinalSize %lu\n", self->finalSize );
+	Journal_Printf( (void*) stream, "\tcount: %u\n", self->extInfos->count );
+	
+	Journal_Printf( (void*) stream, "\textInfos (ptr): %p\n", (void*)self->extInfos );
+	Stg_Class_Print( self->extInfos, stream );
+	
+	Journal_Printf( (void*)stream, "\t_extensionsToExisting (ptr): %p\n", self->_extensionsToExisting );
+	Journal_Printf( (void*)stream, "\t_existingObject (ptr): %p\n", self->_existingObject );
+
+	Journal_Printf( (void*)stream, "\t_array (ptr): %p\n", self->_array );
+	Journal_Printf( (void*)stream, "\titemSize %lu\n", self->itemSize );
+	Journal_Printf( (void*)stream, "\tem (ptr) %p\n", self->em );
+	Journal_Printf( (void*)stream, "\tcount %u\n", self->count );
+}
+
+
+void* _ExtensionManager_Copy( const void* extensionManager, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	ExtensionManager*	self = (ExtensionManager*)extensionManager;
+	ExtensionManager*	newExtensionManager;
+	PtrMap*			map = ptrMap;
+	Index item_I;
+	Index ext_I;
+	void* data;
+	ExtensionInfo* srcInfo;
+
+	newExtensionManager = (ExtensionManager*)_Stg_Object_Copy( self, dest, deep, nameExt, map );
+	
+	newExtensionManager->initialSize = self->initialSize;
+	newExtensionManager->finalSize = self->finalSize;
+	newExtensionManager->dataCopyFunc = self->dataCopyFunc;
+
+	/* Of Existing */
+	if ( self->_existingObject ) {
+		/* ExtensionManager assumes the object is already copied */
+		newExtensionManager->_existingObject = PtrMap_Find( map, self->_existingObject );
+		Journal_Firewall(
+			newExtensionManager->_existingObject != NULL,
+			Journal_Register( Error_Type, __FILE__ ),
+			"Copy Error: ExtensionManager copied before _existingObject\n" );
+	}
+	else {
+		newExtensionManager->_existingObject = NULL;
+	}
+	
+	if ( self->_extensionsToExisting ) {
+		/* OfObject case */
+		if( (newExtensionManager->_extensionsToExisting = PtrMap_Find( map, self->_extensionsToExisting )) == NULL && 
+			self->_extensionsToExisting )
+		{
+			Index ext_I;
+			ArithPointer offset;
+			newExtensionManager->_extensionsToExisting = Memory_Alloc_Bytes( 
+				self->finalSize, 
+				"Extended data", 
+				self->name );
+			PtrMap_Append( map, self->_extensionsToExisting, newExtensionManager->_extensionsToExisting );
+			offset = 0;
+			for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
+				ExtensionInfo* eInfo = (ExtensionInfo*)Stg_ObjectList_At( self->extInfos, ext_I );
+				ExtensionInfo_DataCopy(
+					eInfo,
+					(void*)((ArithPointer)self->_extensionsToExisting + offset),
+					(void*)((ArithPointer)newExtensionManager->_extensionsToExisting + offset ),
+					True,
+					nameExt,
+					map );
+
+				offset += ExtensionInfo_Size( eInfo );
+				PtrMap_Append(
+					map,
+					(void*)((ArithPointer)self->_extensionsToExisting + offset),
+					(void*)((ArithPointer)newExtensionManager->_extensionsToExisting + offset ) );
+			}
+		}
+	}
+	else {
+		newExtensionManager->_extensionsToExisting = NULL;
+	}
+
+	if ( self->_array ) {
+		/* Array case */
+		newExtensionManager->_array = PtrMap_Find( map, self->_array );
+		if ( newExtensionManager->_array == NULL ) {
+			if ( self->em ) {
+				/* ExtendedArray case */
+				newExtensionManager->_array = ExtensionManager_CopyAllocation(
+					self->em,
+					self->_array,
+					NULL,
+					deep,
+					nameExt,
+					ptrMap,
+					self->count );
+				
+			}
+			else {
+				/* OfArray case */
+				newExtensionManager->_array = Memory_Alloc_Bytes( 
+					self->itemSize * self->count, 
+					"Base Type", 
+					self->name );
+				PtrMap_Append( map, self->_array, newExtensionManager->_array );
+
+			}
+		}
+
+		/* Add each item of array to pointer map */
+		for ( item_I = 0; item_I < self->count; ++item_I ) {
+			PtrMap_Append(
+				map,
+				(void*)( ((ArithPointer)self->_array) + (self->itemSize * item_I) ),
+				(void*)( ((ArithPointer)newExtensionManager->_array) +
+					 (self->itemSize * item_I) ) );
+		}
+		
+		/* Copy each item of the array */
+		if ( self->dataCopyFunc ) {
+			for ( item_I = 0; item_I < self->count; ++item_I ) {
+				Stg_Generic_Copy( 
+					self->dataCopyFunc,
+					(void*)( ((ArithPointer)self->_array) + (self->itemSize * item_I) ),
+					(void*)( ((ArithPointer)newExtensionManager->_array) + 
+						(self->itemSize * item_I) ),
+					deep,
+					nameExt,
+					ptrMap );
+			}
+		}
+		else {
+			memcpy( newExtensionManager->_array, self->_array, self->itemSize * self->count );
+		}
+
+		/* Copy the extensions */
+		for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
+			srcInfo = ExtensionInfo_At( self->extInfos, ext_I );
+			data = PtrMap_Find( map, srcInfo->data );
+			if ( data == NULL ) {
+				data = Memory_Alloc_Bytes( 
+					srcInfo->size * self->count, 
+					"Extended data",
+					self->name );
+				PtrMap_Append( map, srcInfo->data, data );
+			}
+			for ( item_I = 0; item_I < self->count; ++item_I ) {
+				ExtensionInfo_DataCopy( 
+					srcInfo, 
+					((void*)((ArithPointer)srcInfo->data + (srcInfo->itemSize * item_I) )),
+					((void*)((ArithPointer)data + (srcInfo->itemSize * item_I) )),
+					deep,
+					nameExt,
+					map );
+				PtrMap_Append(
+					map,
+					((void*)((ArithPointer)srcInfo->data + (srcInfo->itemSize * item_I) )),
+					((void*)((ArithPointer)data + (srcInfo->itemSize * item_I) )) );
+			}
+		}
+	}
+	else {
+		newExtensionManager->_array = NULL;
+	}
+
+	newExtensionManager->itemSize = self->itemSize;
+	newExtensionManager->em = (ExtensionManager*)Stg_Class_Copy( self->em, NULL, deep, nameExt, ptrMap );
+	newExtensionManager->count = self->count;
+
+	/* Must be copied after all the data ptrs have been appended to map */
+	newExtensionManager->objToExtensionMapper = (HashTable*)Stg_Class_Copy( self->objToExtensionMapper, NULL, deep, nameExt, ptrMap );
+	
+	/* must be copied last bacause of array case */
+	newExtensionManager->extInfos = (ExtensionInfoList*)Stg_Class_Copy( self->extInfos, NULL, deep, nameExt, ptrMap );
+
+	return (void*)newExtensionManager;
+}
+
+void ExtensionManager_SetDataCopyFunc( void* extensionManager, Stg_Class_CopyFunction* dataCopyFunc ) {
+	ExtensionManager* self = (ExtensionManager*)extensionManager;
+
+	self->dataCopyFunc = dataCopyFunc;
+}
+
+ExtensionInfo_Index ExtensionManager_AddExtensionInfo( void* extensionManager, void* extensionInfo ) {
+	ExtensionManager* self = (ExtensionManager*)extensionManager;
+	ExtensionInfo* newExtension = (ExtensionInfo*) extensionInfo;
+
+	ExtensionInfo_Index	handle;
+	SizeT			offset;
+	SizeT			oldFinalSize;
+
+	Journal_Firewall(
+		self->lockDown == False,
+		Journal_MyStream( Error_Type, self ),
+		"Error in func %s: Trying to add extension \"%s\" to ExtensionManager \"%s\" when it is in lock down mode "
+		"(No more extensions can be added).\n"
+		"Please ensure that the source code is not adding to the wrong ExtensionManager or contact the developer.\n",
+		__func__,
+		newExtension->key,
+		self->name );
+	
+	handle = self->extInfos->count;
+	offset = ExtensionManager_Size( self ); /* aligned, size of everything */
+	
+	if ( self->_array == NULL ) {
+		/* Struct or Object case */
+		oldFinalSize = ExtensionManager_Size( self );
+		
+		Stg_ObjectList_Append( self->extInfos, newExtension ); 
+		ExtensionInfo_Register( newExtension, offset, self, handle, NULL );
+
+		self->finalSize = ExtensionManager_Size( self );
+	
+		/* if we are extending an existing object, allocate more memory */
+		if( self->_existingObject ) {
+			/*
+			HashTable* ht = HashTable_FindEntry( self->objToExtensionMapper, self->_existingObject, sizeof(HashTable), HashTable );
+			*/
+			if (! self->_extensionsToExisting ) {
+				self->_extensionsToExisting = Memory_Alloc_Bytes( self->finalSize, "Extended data", self->name );
+				/* Use 0 as size of data because its a don't care */
+				/*HashTable_InsertEntry( ht, newExtension->key, sizeof(Name), self->_extensionsToExisting, 0 ); */
+			} 
+			else {
+				/* 
+				HashTable* newHt;
+				Index ext_I;
+				void* curPointer;
+				*/
+				
+				self->_extensionsToExisting = Memory_Realloc( self->_extensionsToExisting, self->finalSize );
+				memset( 
+					(void*)((ArithPointer)self->_extensionsToExisting + (ArithPointer)oldFinalSize), 
+					0, 
+					self->finalSize - oldFinalSize );
+				/* rehash the lot */
+				/*
+				newHt = HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY );
+				curPointer = self->_extensionsToExisting;
+				for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
+					ExtensionInfo* eInfo = (ExtensionInfo*)Stg_ObjectList_At( self->extInfos, ext_I );
+					HashTable_InsertEntry( newHt, eInfo->key, sizeof(Name), curPointer, 0 );
+					curPointer = (void*)((ArithPointer)curPointer + (ArithPointer)ExtensionInfo_Size( eInfo ));
+				}
+				HashTable_ReplaceEntry( self->objToExtensionMapper, self->_existingObject, sizeof(void*), newHt, sizeof(HashTable) );
+				*/
+			}
+			
+		}
+		return handle;
+	}
+	else {
+		/* Array or ExtendedArray case */
+		void* data;
+
+		/*HashTable* ht;*/
+		void* curObj;
+		void* curExtData;
+		Index obj_I;
+		
+		/* each extension stores a pointer to array of extended memory */
+		/* created the array of extended data */
+		data = Memory_Alloc_Bytes( newExtension->size * self->count, "Extended data", self->name );
+	
+		/* Add the extension.
+		 * Note that in this case, offset convention is retained for the purpose of
+		 * size calculation and is NOT to be used */
+		Stg_ObjectList_Append( self->extInfos, newExtension );
+		ExtensionInfo_Register( newExtension, offset, self, handle, data );
+
+		/*
+		if ( ExtensionManager_OfExtendedArray( self ) ) {
+			ht = self->em->objToExtensionMapper;
+		}
+		else {
+			ht = self->objToExtensionMapper;
+		}
+		*/
+		
+		curObj = self->_array;
+		curExtData = data;
+		for ( obj_I = 0; obj_I < self->count; ++obj_I ) {
+			/*
+			HashTable* extHt = HashTable_FindEntry( ht, curObj, sizeof(void*), HashTable );
+			HashTable_InsertEntry( extHt, newExtension->key, sizeof(Name), curExtData, 0 );
+			*/
+
+			curObj = (void*)((ArithPointer)curObj + (ArithPointer)self->itemSize);
+			curExtData = (void*)((ArithPointer)curExtData + (ArithPointer)ExtensionInfo_Size( newExtension ) );
+		}
+
+		if ( self->em ) {
+			return handle + self->em->extInfos->count;
+		}
+		
+		return handle;
+	}
+		
+}
+	
+
+ExtensionInfo_Index ExtensionManager_AddArray( 
+	void* extension, 
+	Name extensionName, 
+	SizeT size, 
+	Index count )
+{
+	ExtensionInfo* newExtInfo = (ExtensionInfo*)SimpleExtensionInfo_New( extensionName, ExtensionManager_Align( size ), count );
+	return ExtensionManager_AddExtensionInfo( extension, newExtInfo );
+}
+
+ExtensionInfo_Index ExtensionManager_AddClassPtrArray( 
+	void* extension, 
+	Name extensionName, 
+	Stg_Class_CopyFunction* copyFunc, 
+	Index count ) {
+
+	ExtensionInfo* newExtInfo = (ExtensionInfo*)ClassPtrExtensionInfo_New( extensionName, copyFunc, count );
+	return ExtensionManager_AddExtensionInfo( extension, newExtInfo );
+}
+
+ExtensionInfo_Index ExtensionManager_GetHandle( void* extension, const Name extensionName ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	ExtensionInfo_Index			result = 0;
+	ExtensionInfo_Index			offset_I;
+
+	if ( self->em ) {
+		result = ExtensionManager_GetHandle( self->em, extensionName );
+		if ( result != (unsigned)-1 ) {
+			return result;
+		}
+		/* not found, so the result must be the prev + current extInfos handle if any */
+		result = self->em->extInfos->count;
+	}
+	
+	for( offset_I = 0; offset_I < self->extInfos->count; offset_I++ ) {
+		if( strcmp( extensionName, ExtensionInfo_At( self->extInfos, offset_I )->key ) == 0 ) {
+			return result + offset_I;
+		}
+	}
+	
+	return (unsigned)-1;
+}
+
+void* ExtensionManager_GetOFunc( void* extension, void* ptr, ExtensionInfo_Index handle ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_GetOMacro( self, ptr, handle );
+}
+
+void* ExtensionManager_GetCFunc( void* extension, void* ptr, ExtensionInfo_Index handle ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_GetCMacro( self, ptr, handle );
+}
+
+void* ExtensionManager_GetAFunc( void* extension, void* itemPtr, ExtensionInfo_Index handle ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_GetAMacro( self, itemPtr, handle );
+}
+
+void* ExtensionManager_GetExtendedAFunc( void* extension, void* itemPtr, ExtensionInfo_Index handle ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_GetExtendedAMacro( self, itemPtr, handle );
+}
+
+void* ExtensionManager_GetFunc( void* extension, void* ptr, ExtensionInfo_Index handle ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_GetMacro( self, ptr, handle );
+}
+
+void* ExtensionManager_HashGet( void* extension, void* ptr, Name key ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	/*
+
+	HashTable* extHt;
+	void* result;
+	
+	if ( ExtensionManager_OfExtendedArray( self ) ) {
+		return ExtensionManager_HashGet( self->em, ptr, key );
+	}
+	extHt = HashTable_FindEntry( self->objToExtensionMapper, ptr, sizeof(void*), HashTable );
+	if ( extHt == NULL ) {
+		return NULL;
+	}
+	result = HashTable_FindEntry( extHt, key, sizeof(Name), void);
+	*/
+/* Uncomment this code to allow string compare to work */
+/*
+	if ( result == NULL && key != NULL ) {
+		Index ext_I;
+		for ( ext_I = 0; ext_I == self->extInfos->count; ++ext_I ) {
+			if ( strcmp( key, ExtensionInfo_At( self->extInfos, ext_I )->key ) == 0 ) {
+				result = HashTable_FindEntry( self->objToExtensionMapper, ExtensionInfo_At( self->extInfos, ext_I )->key, sizeof(void*), HashTable );
+				break;
+			}
+		}
+	}
+*/
+/*
+	return result;
+*/
+	Journal_Firewall( False, Journal_Register( ErrorStream_Type, self->type ),
+		"%s() currently disabled.\n", __func__ );
+	return NULL;
+}
+
+SizeT ExtensionManager_SizeFunc( void* extension ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+
+	return ExtensionManager_SizeMacro( self );
+}
+
+Bool ExtensionManager_OfExistingFunc( void* extension ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+
+	return ExtensionManager_OfExistingMacro( self ) ? True : False;
+}
+
+Bool ExtensionManager_OfArrayFunc( void* extension ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+
+	return ExtensionManager_OfArrayMacro( self ) ? True : False;
+}
+
+Bool ExtensionManager_OfExtendedArrayFunc( void* extension ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+
+	return ExtensionManager_OfExtendedArrayMacro( self ) ? True : False;
+}
+
+SizeT ExtensionManager_GetFinalSizeFunc( void* extension ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+
+	return ExtensionManager_GetFinalSizeMacro( self );
+}
+
+SizeT ExtensionManager_AlignFunc( SizeT size ) {
+	return ExtensionManager_AlignMacro( size );
+}
+
+void* ExtensionManager_Malloc( void* extension, Index count ) {
+	ExtensionManager* self = (ExtensionManager*)extension;
+	void* result;
+
+	/*Index obj_I;*/
+	/*Index ext_I;*/
+	void* curObj;
+
+	if ( ExtensionManager_OfExisting( self ) ) {
+		return NULL;
+	}
+	
+	result = Memory_Alloc_Array_Bytes( ExtensionManager_GetFinalSize( (self) ), (count), "Extended object", (self)->name );
+	memset( result, 0, ExtensionManager_GetFinalSize( self ) * count );
+
+	if ( ExtensionManager_GetFinalSize( self ) > 0 ) {
+		curObj = result;
+		/*
+		for ( obj_I = 0; obj_I < count; ++obj_I ) {
+			HashTable* objHt = HashTable_New( NULL, NULL, NULL, HASHTABLE_POINTER_KEY );
+			HashTable_InsertEntry( self->objToExtensionMapper, curObj, sizeof(void*), objHt, sizeof(HashTable ) );
+
+			HashTable_InsertEntry( objHt, NULL, sizeof(Name), curObj, 0 );
+			curObj = (void*)((ArithPointer)curObj + (ArithPointer)self->initialSize);
+			
+			for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ) {
+				ExtensionInfo* eInfo = (ExtensionInfo*)Stg_ObjectList_At( self->extInfos, ext_I );
+
+				HashTable_InsertEntry( objHt, eInfo->key, sizeof(Name), curObj, 0 );
+
+				curObj = (void*)((ArithPointer)curObj + (ArithPointer)ExtensionInfo_Size( eInfo ));
+			}
+		}
+		*/
+	}
+	
+	return result;
+}
+
+void* ExtensionManager_CopyAllocation(
+		void* extension,
+		void* array,
+		void* dest,
+		Bool deep,
+		Name nameExt,
+		PtrMap* ptrMap,
+		Index count )
+{
+	ExtensionManager* self = (ExtensionManager*)extension;
+	Bool ownMap = False;
+	void* srcCurrent;
+	void* destCurrent;
+	Index item_I;
+	Index ext_I;
+
+	ArithPointer offset;
+
+	if ( array == NULL ) {
+		return NULL;
+	}
+	if ( !ptrMap ) {
+		ptrMap = PtrMap_New( 1 );
+		ownMap = True;
+	}
+	
+	if ( dest == NULL ) {
+		dest = PtrMap_Find( ptrMap, array );
+		if ( dest == NULL ) {
+			dest = Memory_Alloc_Bytes( 
+				ExtensionManager_GetFinalSizeFunc( self ) * count, 
+				"Extended object", 
+				self->name );
+			PtrMap_Append( ptrMap, array, dest );
+		}
+	}
+
+	for ( item_I = 0; item_I < count; ++item_I ) {
+		if ( self->dataCopyFunc ) {
+			Stg_Generic_Copy(
+				self->dataCopyFunc,
+				(void*)(((ArithPointer)array) + (ExtensionManager_GetFinalSize(self) * item_I)),
+				(void*)(((ArithPointer)dest) + (ExtensionManager_GetFinalSize(self)* item_I)),
+				deep,
+				nameExt,
+				ptrMap );
+		}
+		else {
+			memcpy(
+				(void*)(((ArithPointer)dest) + (ExtensionManager_GetFinalSize(self)* item_I)),
+				(void*)(((ArithPointer)array) + (ExtensionManager_GetFinalSize(self) * item_I)),
+				self->initialSize );
+		}
+		PtrMap_Append( 
+			ptrMap,
+			(void*)(((ArithPointer)array) + (ExtensionManager_GetFinalSize(self) * item_I)),
+			(void*)(((ArithPointer)dest) + (ExtensionManager_GetFinalSize(self)* item_I)) );
+
+		srcCurrent = ExtensionManager_At( self, array, item_I );
+		destCurrent = ExtensionManager_At( self, dest, item_I );
+		
+		/* each extension */
+		offset = self->initialSize;
+		for ( ext_I = 0; ext_I < self->extInfos->count; ++ext_I ){
+			ExtensionInfo_DataCopy( 
+				Stg_ObjectList_At( self->extInfos, ext_I ),
+				(void*)((ArithPointer)srcCurrent + (ArithPointer)offset),
+				(void*)((ArithPointer)destCurrent + (ArithPointer)offset),
+				deep,
+				nameExt,
+				ptrMap );
+
+			offset += ExtensionInfo_At( self->extInfos, ext_I )->size;
+		}
+	}
+
+	if ( ownMap ) {
+		Stg_Class_Delete( ptrMap );
+	}
+
+	return dest;
+}
+
+
+void* ExtensionManager_MemsetFunc( void* extension, void* ptr, int value, Index count ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_MemsetMacro( self, ptr, value, count );
+}
+
+void ExtensionManager_FreeFunc( void* extension, void* ptr ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	ExtensionManager_FreeMacro( self, ptr );
+}
+
+void* ExtensionManager_AtFunc( void* extension, void* ptr, Index index ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	return ExtensionManager_AtMacro( self, ptr, index );
+}
+
+void ExtensionManager_SetLockDown( void* extension, Bool lockDown ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+	
+	self->lockDown = lockDown;
+}
+Bool ExtensionManager_GetLockDown( void* extension ) {
+	ExtensionManager*			self = (ExtensionManager*)extension;
+
+	return self->lockDown;
+}
+
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ExtensionManager_Register.c
--- a/Base/Extensibility/src/ExtensionManager_Register.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ExtensionManager_Register.c 4099 2007-05-16 01:01:12Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ExtensionManager.h"
-#include "ExtensionManager_Register.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type ExtensionManager_Register_Type = "ExtensionManager_Register";
-
-ExtensionManager_Register* extensionMgr_Register = 0;
-
-ExtensionManager_Register* ExtensionManager_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(ExtensionManager_Register);
-	Type                              type = ExtensionManager_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _ExtensionManager_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _ExtensionManager_Register_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return _ExtensionManager_Register_New(  EXTENSIONMANAGER_REGISTER_PASSARGS  );
-}
-
-void ExtensionManager_Register_Init( void* extensionManager_Register ) {
-	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	/* General info */
-	self->type = ExtensionManager_Register_Type;
-	self->_sizeOfSelf = sizeof(ExtensionManager_Register);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _ExtensionManager_Register_Delete;
-	self->_print = _ExtensionManager_Register_Print;
-	self->_copy = NULL;
-	_Stg_Class_Init( (Stg_Class*)self );
-	
-	/* ExtensionManager_Register info */
-	_ExtensionManager_Register_Init( self );
-}
-
-ExtensionManager_Register* _ExtensionManager_Register_New(  EXTENSIONMANAGER_REGISTER_DEFARGS  )
-{
-	ExtensionManager_Register* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ExtensionManager_Register) );
-	self = (ExtensionManager_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	_ExtensionManager_Register_Init( self );
-	
-	return self;
-}
-
-void _ExtensionManager_Register_Init( void* extensionManager_Register ) {
-	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	/* General and Virtual info should already be set */
-	
-	/* ExtensionManager_Register info */
-	self->extensions = Stg_ObjectList_New();
-}
-
-void _ExtensionManager_Register_Delete( void* extensionManager_Register ) {
-	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	/* Assumes ownerships of the element types */
-	Stg_Class_Delete( self->extensions );
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-void _ExtensionManager_Register_Print( void* extensionManager_Register, Stream* stream ) {
-	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "ExtensionManager_Register (ptr): %p\n", self );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-	
-	/* Virtual info */
-	
-	/* ExtensionManager_Register info */
-	Journal_Printf( (void*)stream, "\tcount: %u\n", self->extensions->count );
-	
-	Journal_Printf( (void*)stream, "\textensions (ptr): %p\n", self->extensions );
-	Stg_Class_Print( self->extensions, stream );
-}
-
-ExtensionManager_Index ExtensionManager_Register_Add( void* extensionManager_Register, void* extension ) {
-	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	return Stg_ObjectList_Append( self->extensions, extension );
-}
-
-ExtensionManager_Index ExtensionManager_Register_Remove( void* extensionManager_Register, void* extension ) {
-	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	return Stg_ObjectList_Remove( self->extensions, ((ExtensionManager*)extension)->name, KEEP );
-}
-
-ExtensionManager_Index ExtensionManager_Register_GetExtensionHandle( void* extensionManager_Register, Name toGet ) {
-	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	return Stg_ObjectList_GetIndex( self->extensions, toGet );
-}
-
-ExtensionManager* _ExtensionManager_Register_GetExtension( void* extensionManager_Register, ExtensionManager_Index handle ) {
-	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
-	
-	return ExtensionManager_Register_GetExtension( self, handle );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ExtensionManager_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ExtensionManager_Register.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,159 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ExtensionManager_Register.c 4099 2007-05-16 01:01:12Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ExtensionManager.h"
+#include "ExtensionManager_Register.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type ExtensionManager_Register_Type = "ExtensionManager_Register";
+
+ExtensionManager_Register* extensionMgr_Register = 0;
+
+ExtensionManager_Register* ExtensionManager_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(ExtensionManager_Register);
+	Type                              type = ExtensionManager_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _ExtensionManager_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _ExtensionManager_Register_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return _ExtensionManager_Register_New(  EXTENSIONMANAGER_REGISTER_PASSARGS  );
+}
+
+void ExtensionManager_Register_Init( void* extensionManager_Register ) {
+	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	/* General info */
+	self->type = ExtensionManager_Register_Type;
+	self->_sizeOfSelf = sizeof(ExtensionManager_Register);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _ExtensionManager_Register_Delete;
+	self->_print = _ExtensionManager_Register_Print;
+	self->_copy = NULL;
+	_Stg_Class_Init( (Stg_Class*)self );
+	
+	/* ExtensionManager_Register info */
+	_ExtensionManager_Register_Init( self );
+}
+
+ExtensionManager_Register* _ExtensionManager_Register_New(  EXTENSIONMANAGER_REGISTER_DEFARGS  )
+{
+	ExtensionManager_Register* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ExtensionManager_Register) );
+	self = (ExtensionManager_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	_ExtensionManager_Register_Init( self );
+	
+	return self;
+}
+
+void _ExtensionManager_Register_Init( void* extensionManager_Register ) {
+	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	/* General and Virtual info should already be set */
+	
+	/* ExtensionManager_Register info */
+	self->extensions = Stg_ObjectList_New();
+}
+
+void _ExtensionManager_Register_Delete( void* extensionManager_Register ) {
+	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	/* Assumes ownerships of the element types */
+	Stg_Class_Delete( self->extensions );
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+void _ExtensionManager_Register_Print( void* extensionManager_Register, Stream* stream ) {
+	ExtensionManager_Register* self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "ExtensionManager_Register (ptr): %p\n", self );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+	
+	/* Virtual info */
+	
+	/* ExtensionManager_Register info */
+	Journal_Printf( (void*)stream, "\tcount: %u\n", self->extensions->count );
+	
+	Journal_Printf( (void*)stream, "\textensions (ptr): %p\n", self->extensions );
+	Stg_Class_Print( self->extensions, stream );
+}
+
+ExtensionManager_Index ExtensionManager_Register_Add( void* extensionManager_Register, void* extension ) {
+	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	return Stg_ObjectList_Append( self->extensions, extension );
+}
+
+ExtensionManager_Index ExtensionManager_Register_Remove( void* extensionManager_Register, void* extension ) {
+	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	return Stg_ObjectList_Remove( self->extensions, ((ExtensionManager*)extension)->name, KEEP );
+}
+
+ExtensionManager_Index ExtensionManager_Register_GetExtensionHandle( void* extensionManager_Register, Name toGet ) {
+	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	return Stg_ObjectList_GetIndex( self->extensions, toGet );
+}
+
+ExtensionManager* _ExtensionManager_Register_GetExtension( void* extensionManager_Register, ExtensionManager_Index handle ) {
+	ExtensionManager_Register*	self = (ExtensionManager_Register*)extensionManager_Register;
+	
+	return ExtensionManager_Register_GetExtension( self, handle );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Finalise.c
--- a/Base/Extensibility/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 4163 2007-08-02 08:32:40Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ExtensionManager_Register.h"
-#include "Init.h"
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool BaseExtensibility_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	Stg_Class_Delete( stgToolboxesManager );
-	Stg_Class_Delete( extensionMgr_Register );
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,54 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 4163 2007-08-02 08:32:40Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ExtensionManager_Register.h"
+#include "Init.h"
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool BaseExtensibility_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	Stg_Class_Delete( stgToolboxesManager );
+	Stg_Class_Delete( extensionMgr_Register );
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Hook.c
--- a/Base/Extensibility/src/Hook.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Hook.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Hook.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Textual name of this class */
-const Type Hook_Type = "Hook";
-
-/** allocate and initialise a new Hook. */
-Hook* Hook_New( Name name, Func_Ptr funcPtr, Name addedBy ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(Hook);
-	Type                              type = Hook_Type;
-	Stg_Class_DeleteFunction*      _delete = _Hook_Delete;
-	Stg_Class_PrintFunction*        _print = _Hook_Print;
-	Stg_Class_CopyFunction*          _copy = _Hook_Copy;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Hook_New(  HOOK_PASSARGS  );
-}
-
-void Hook_Init( void* hook, Name name, Func_Ptr funcPtr, const char* addedBy ) {
-	Hook* self = (Hook*)hook;
-
-	/* General info */
-	self->type = Hook_Type;
-	self->_sizeOfSelf = sizeof(Hook);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _Hook_Delete;
-	self->_print = _Hook_Print;
-	self->_copy = _Hook_Copy;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	/* Hook info */
-	_Hook_Init( self, funcPtr, addedBy );
-}
-
-
-Hook* _Hook_New(  HOOK_DEFARGS  )
-{
-	Hook* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Hook) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (Hook*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* Hook info */
-	_Hook_Init( self, funcPtr, addedBy );
-	
-	return self;
-}
-
-
-void _Hook_Init( Hook* self, Func_Ptr funcPtr, Name addedBy ) {
-	/* General and Virtual info should already be set */
-	
-	/* Hook info */
-	self->funcPtr = funcPtr;
-	self->addedBy = StG_Strdup( addedBy );
-}
-
-
-void _Hook_Delete( void* hook ) {
-	Hook* self = (Hook*)hook;
-	#if DEBUG
-		assert( self );
-	#endif	
-	
-	Memory_Free( self->addedBy );
-	/* Stg_Class_Delete parent */
-	_Stg_Object_Delete( self );
-}
-
-void _Hook_Print( void* hook, Stream* stream ) {
-	Hook* self = (Hook*)hook;
-	#if DEBUG
-		assert( self );
-		assert( stream );
-	#endif	
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Hook (ptr) - %p:\n", self );
-	_Stg_Object_Print( self, stream );
-	Journal_Printf( (void*) stream, "\tfuncPtr (func ptr): %p\n", self->funcPtr );
-	Journal_Printf( (void*) stream, "\taddedBy: %s\n", self->addedBy );
-	
-}
-
-
-void* _Hook_Copy( const void* hook, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	Hook*	self = (Hook*)hook;
-	Hook*	newHook;
-	
-	newHook = (Hook*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	newHook->funcPtr = self->funcPtr;
-	
-	if( self->addedBy ) {
-		if( nameExt ) {
-			char*	tmpName;
-			
-			tmpName = Memory_Alloc_Array( char, strlen( self->addedBy ) + strlen( nameExt ) + 1, "newHook->addedBy" );
-			strcpy( tmpName, self->addedBy );
-			strcpy( &tmpName[strlen( self->addedBy )], nameExt );
-			newHook->addedBy = tmpName;
-		}
-		else {
-			newHook->addedBy = StG_Strdup( self->addedBy );
-		}
-	}
-	else {
-		newHook->addedBy = NULL;
-	}
-	
-	return (void*)newHook;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Hook.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/Hook.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,173 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Hook.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Hook.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Textual name of this class */
+const Type Hook_Type = "Hook";
+
+/** allocate and initialise a new Hook. */
+Hook* Hook_New( Name name, Func_Ptr funcPtr, Name addedBy ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(Hook);
+	Type                              type = Hook_Type;
+	Stg_Class_DeleteFunction*      _delete = _Hook_Delete;
+	Stg_Class_PrintFunction*        _print = _Hook_Print;
+	Stg_Class_CopyFunction*          _copy = _Hook_Copy;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Hook_New(  HOOK_PASSARGS  );
+}
+
+void Hook_Init( void* hook, Name name, Func_Ptr funcPtr, const char* addedBy ) {
+	Hook* self = (Hook*)hook;
+
+	/* General info */
+	self->type = Hook_Type;
+	self->_sizeOfSelf = sizeof(Hook);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _Hook_Delete;
+	self->_print = _Hook_Print;
+	self->_copy = _Hook_Copy;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	/* Hook info */
+	_Hook_Init( self, funcPtr, addedBy );
+}
+
+
+Hook* _Hook_New(  HOOK_DEFARGS  )
+{
+	Hook* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Hook) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (Hook*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* Hook info */
+	_Hook_Init( self, funcPtr, addedBy );
+	
+	return self;
+}
+
+
+void _Hook_Init( Hook* self, Func_Ptr funcPtr, Name addedBy ) {
+	/* General and Virtual info should already be set */
+	
+	/* Hook info */
+	self->funcPtr = funcPtr;
+	self->addedBy = StG_Strdup( addedBy );
+}
+
+
+void _Hook_Delete( void* hook ) {
+	Hook* self = (Hook*)hook;
+	#if DEBUG
+		assert( self );
+	#endif	
+	
+	Memory_Free( self->addedBy );
+	/* Stg_Class_Delete parent */
+	_Stg_Object_Delete( self );
+}
+
+void _Hook_Print( void* hook, Stream* stream ) {
+	Hook* self = (Hook*)hook;
+	#if DEBUG
+		assert( self );
+		assert( stream );
+	#endif	
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Hook (ptr) - %p:\n", self );
+	_Stg_Object_Print( self, stream );
+	Journal_Printf( (void*) stream, "\tfuncPtr (func ptr): %p\n", self->funcPtr );
+	Journal_Printf( (void*) stream, "\taddedBy: %s\n", self->addedBy );
+	
+}
+
+
+void* _Hook_Copy( const void* hook, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	Hook*	self = (Hook*)hook;
+	Hook*	newHook;
+	
+	newHook = (Hook*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	newHook->funcPtr = self->funcPtr;
+	
+	if( self->addedBy ) {
+		if( nameExt ) {
+			char*	tmpName;
+			
+			tmpName = Memory_Alloc_Array( char, strlen( self->addedBy ) + strlen( nameExt ) + 1, "newHook->addedBy" );
+			strcpy( tmpName, self->addedBy );
+			strcpy( &tmpName[strlen( self->addedBy )], nameExt );
+			newHook->addedBy = tmpName;
+		}
+		else {
+			newHook->addedBy = StG_Strdup( self->addedBy );
+		}
+	}
+	else {
+		newHook->addedBy = NULL;
+	}
+	
+	return (void*)newHook;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Init.c
--- a/Base/Extensibility/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 4163 2007-08-02 08:32:40Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "EntryPoint.h"
-#include "EntryPoint_Register.h"
-#include "ExtensionInfo.h"
-#include "ClassPtrExtensionInfo.h"
-#include "ExtensionManager.h"
-#include "ExtensionManager_Register.h"
-#include "Hook.h"
-#include "ClassHook.h"
-#include "Module.h"
-#include "Plugin.h"
-#include "Toolbox.h"
-#include "ModulesManager.h"
-#include "PluginsManager.h"
-#include "ToolboxesManager.h"
-#include "SimpleExtensionInfo.h"
-#include "Init.h"
-#include "Finalise.h"
-
-#include <stdio.h>
-
-
-
-ToolboxesManager* stgToolboxesManager = 0;
-
-Bool BaseExtensibility_Init( int* argc, char** argv[] ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-	extensionMgr_Register = ExtensionManager_Register_New();
-
-	RegisterParent( Hook_Type,                      Stg_Object_Type );
-	RegisterParent( ClassHook_Type,                 Hook_Type );
-
-	RegisterParent( EntryPoint_Type,                Stg_Object_Type );
-	RegisterParent( EntryPoint_Register_Type,       Stg_Class_Type );
-	
-	RegisterParent( ExtensionManager_Type,          Stg_Object_Type );
-	RegisterParent( ExtensionManager_Register_Type, Stg_Class_Type );
-
-	RegisterParent( ExtensionInfo_Type,             Stg_Object_Type );
-	RegisterParent( SimpleExtensionInfo_Type,       ExtensionInfo_Type );
-	RegisterParent( ClassPtrExtensionInfo_Type,     ExtensionInfo_Type );
-
-	RegisterParent( Module_Type,                    Stg_Object_Type );
-	RegisterParent( Plugin_Type,                    Module_Type );
-	RegisterParent( Toolbox_Type,                   Module_Type );
-	RegisterParent( ModulesManager_Type,            Stg_Class_Type );
-	RegisterParent( PluginsManager_Type,            ModulesManager_Type );
-	RegisterParent( ToolboxesManager_Type,          ModulesManager_Type );
-	
-	stgToolboxesManager = ToolboxesManager_New( argc, argv );
-		
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,93 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 4163 2007-08-02 08:32:40Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "EntryPoint.h"
+#include "EntryPoint_Register.h"
+#include "ExtensionInfo.h"
+#include "ClassPtrExtensionInfo.h"
+#include "ExtensionManager.h"
+#include "ExtensionManager_Register.h"
+#include "Hook.h"
+#include "ClassHook.h"
+#include "Module.h"
+#include "Plugin.h"
+#include "Toolbox.h"
+#include "ModulesManager.h"
+#include "PluginsManager.h"
+#include "ToolboxesManager.h"
+#include "SimpleExtensionInfo.h"
+#include "Init.h"
+#include "Finalise.h"
+
+#include <stdio.h>
+
+
+
+ToolboxesManager* stgToolboxesManager = 0;
+
+Bool BaseExtensibility_Init( int* argc, char** argv[] ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+	extensionMgr_Register = ExtensionManager_Register_New();
+
+	RegisterParent( Hook_Type,                      Stg_Object_Type );
+	RegisterParent( ClassHook_Type,                 Hook_Type );
+
+	RegisterParent( EntryPoint_Type,                Stg_Object_Type );
+	RegisterParent( EntryPoint_Register_Type,       Stg_Class_Type );
+	
+	RegisterParent( ExtensionManager_Type,          Stg_Object_Type );
+	RegisterParent( ExtensionManager_Register_Type, Stg_Class_Type );
+
+	RegisterParent( ExtensionInfo_Type,             Stg_Object_Type );
+	RegisterParent( SimpleExtensionInfo_Type,       ExtensionInfo_Type );
+	RegisterParent( ClassPtrExtensionInfo_Type,     ExtensionInfo_Type );
+
+	RegisterParent( Module_Type,                    Stg_Object_Type );
+	RegisterParent( Plugin_Type,                    Module_Type );
+	RegisterParent( Toolbox_Type,                   Module_Type );
+	RegisterParent( ModulesManager_Type,            Stg_Class_Type );
+	RegisterParent( PluginsManager_Type,            ModulesManager_Type );
+	RegisterParent( ToolboxesManager_Type,          ModulesManager_Type );
+	
+	stgToolboxesManager = ToolboxesManager_New( argc, argv );
+		
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Module.c
--- a/Base/Extensibility/src/Module.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-*/
-/** \file
-**  Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: Module.c 3192 2005-08-25 01:45:42Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Module.h"
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-
-#ifndef NOSHARED
-#include <dlfcn.h>
-#else
-extern int stg_num_modules;
-extern char **stg_module_names;
-extern int *stg_num_module_syms;
-extern char ***stg_module_syms;
-extern void ***stg_module_funcs;
-
-Bool Module_CheckStaticName(Module *self);
-void* Module_MapStaticSymbol(Module *self, const char *sym);
-#endif
-
-#include <limits.h>
-
-
-const Type Module_Type = "Module";
-
-static Name MODULE_GETMETADATA_SUFFIX = "_MetaAsDictionary";
-static Name MODULE_GETNAME_SUFFIX = "_GetName";
-static Name MODULE_GETVERSION_SUFFIX = "_GetVersion";
-
-#ifdef MEMORY_STATS
-	static Name MODULE_FILENAME = "fileName";
-	static Name MODULE_SYMBOLNAME = "symbolName";
-#endif
-
-#ifdef NOSHARED
-int stg_num_modules = 0;
-char **stg_module_names = NULL;
-int *stg_num_module_syms = NULL;
-char ***stg_module_syms = NULL;
-void ***stg_module_funcs = NULL;
-#endif
-
-Module* _Module_New(  MODULE_DEFARGS  )
-{
-	Module* self;
-
-	assert( _sizeOfSelf >= sizeof(Module) );
-
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (Module*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	_Module_Init( self, MangleName, directories );
-
-	return self;
-}
-	
-void _Module_Init(
-		Module*                      self,
-		Module_MangleNameFunction    MangleName,
-		Stg_ObjectList*              directories )
-{
-	char*                           fileName = NULL;
-	char*                           fullPathName = NULL;
-
-	Stream*                         stream;
-	Stream*                         debug;
-	Stream*                         error;
-
-#ifndef NOSHARED
-	int                             fullPathLength = 0;
-	int                             length;
-	Index                           dir_i;
-#endif
-	
-	stream =  Journal_Register( Info_Type, self->type );
-	debug =  Journal_Register( Debug_Type, self->type );
-	error =  Journal_Register( Error_Type, self->type );
-	
-	self->MangleName = MangleName;
-	
-	
-	Journal_Printf( debug, "Finding module: \"%s\"... ", self->name );
-
-	/* Try the plugin name by itself (allows LD_LIBRARY_PATH) to take precendence */
-	self->mangledName = self->MangleName( self->name );
-#ifndef NOSHARED
-	fileName = Memory_Alloc_Array( char, strlen(self->mangledName) + strlen(MODULE_SUFFIX) + strlen(MODULE_EXT) +1, MODULE_FILENAME );
-	sprintf( fileName, "%s%s%s", self->mangledName, MODULE_SUFFIX, MODULE_EXT );
-		
-	self->dllPtr = dlopen( fileName, RTLD_LAZY | RTLD_GLOBAL );
-	if( self->dllPtr ) {
-		Journal_RPrintf( stream, "%s \"%s\" found using %s\n", self->type, self->name, fileName );
-	}
-	else {
-		Journal_RPrintf( stream, "%s \"%s\" failed: %s\n", self->type, self->name, dlerror() );
-		
-		for ( dir_i = 0; dir_i < directories->count; ++dir_i ) {
-			length = strlen(Stg_ObjectList_ObjectAt( directories, dir_i )) + 1 + strlen(fileName) + 1;
-			if ( fullPathLength < length ) {
-				fullPathLength = length;
-				fullPathName = Memory_Realloc_Array( fullPathName, char, fullPathLength );
-			}
-			PathJoin( fullPathName, 2, Stg_ObjectList_ObjectAt( directories, dir_i ), fileName );
-			self->dllPtr = dlopen( fullPathName, RTLD_LAZY | RTLD_GLOBAL );
-			if( self->dllPtr ) {
-				Journal_RPrintf( stream, "%s \"%s\" found using %s\n", self->type, self->name, fileName );
-				break;
-			}
-			else {
-				Journal_RPrintf( stream, "%s \"%s\" failed: %s\n", self->type, self->name, dlerror() );
-			}
-		}
-		/* If it failed alltogether, print a error message. */
-		if ( dir_i == directories->count) {
-			Journal_Printf( debug, "failed to find in any of directories above, or had error.\n" );
-		}
-	}
-#else
-	/* This is a static build, so we just need to make sure we can find the name
-	   of the module in the module list. */
-	self->dllPtr = (DLL_Handle)Module_CheckStaticName(self);
-#endif
-
-	/* Load the symbols */
-	if( self->dllPtr ) {
-		self->GetMetadata = (Module_GetMetadataFunction*)Module_LoadSymbol( self, MODULE_GETMETADATA_SUFFIX );
-		self->GetName = (Module_GetNameFunction*)Module_LoadSymbol( self, MODULE_GETNAME_SUFFIX );
-		self->GetVersion = (Module_GetVersionFunction*)Module_LoadSymbol( self, MODULE_GETVERSION_SUFFIX );
-	}
-	
-	/* Load the meta data */
-	if( self->GetMetadata ) {
-		self->_meta = self->GetMetadata();
-	}
-	else {
-		self->_meta = Dictionary_New();
-	}
-
-	if ( fullPathName ) {
-		Memory_Free( fullPathName );
-	}
-	Memory_Free( fileName );
-}
-	
-void _Module_Delete( void* module ) {
-	Module* self = (Module*)module;
-
-	Module_UnLoad( self );
-	Stg_Class_Delete( self->_meta );
-	Memory_Free( self->mangledName );
-	
-	/* Delete parent */
-	_Stg_Object_Delete( self );
-}
-	
-void _Module_Print( void* module, Stream* stream ) {
-	Module* self = (Module*)module;
-
-	Index count = 0;
-	Index i;
-	Name version;
-
-	Journal_RPrintf( stream, "Module: %s\n", self->name );
-	Stream_Indent( stream );
-	
-	version = Module_GetVersion( self );
-	if ( version == NULL ) {
-		version = "Unknown";
-	}
-	Journal_Printf( stream, "Version: (version) %s\n", version );
-
-	count = Stg_Meta_GetAssociationCount( self->_meta );
-	for( i = 0; i < count; ++i ) {
-		char* name;
-		
-		name = Stg_Meta_GetAssociationType( self->_meta, i );
-		Journal_RPrintf( stream, "Depends on: %s\n", name ? name : "(type missing - erronous meta data)" );
-	}
-	
-	/* Print parent */
-	_Stg_Object_Print( self, stream );
-	
-	Stream_UnIndent( stream );
-}
-
-
-Dictionary* Module_GetMetadata( void* module ) {
-	Module* self = (Module*)module;
-	
-	return self->_meta;
-}
-
-Name Module_GetName( void* module ) {
-	Module* self = (Module*)module;
-
-	if ( self->GetName ) {
-		return self->GetName();
-	}
-	return self->name;
-}
-
-Name Module_GetVersion( void* module ) {
-	Module* self = (Module*)module;
-
-	if ( self->GetVersion ) {
-		return self->GetVersion();
-	}
-	return NULL;
-}
-
-
-void* Module_LoadSymbol( void* module, Name suffix ) {
-	Module* self = (Module*)module;
-	char*   mangledName;
-	char*   symbolText;
-	void*   result;
-	
-	mangledName = self->MangleName( self->name );
-	symbolText = Memory_Alloc_Array( char, strlen( mangledName ) + strlen( suffix ) + 3, MODULE_SYMBOLNAME );
-
-	sprintf( symbolText, "%s%s",  mangledName, suffix );
-
-#ifndef NOSHARED
-	result = dlsym( self->dllPtr, symbolText );
-#else
-	/* Try to map the symbol. */
-	result = Module_MapStaticSymbol(self, symbolText);
-#endif
-
-	if( result == NULL ) {
-		/* Try with a leading "_"... this is because on macx the dlcompat library can work either placing
-		   this "_" for you and without and there is no easy way to know */
-		sprintf( symbolText, "_%s%s", mangledName, suffix );
-#ifndef NOSHARED
-		result = dlsym( self->dllPtr, symbolText );
-#else
-		result = Module_MapStaticSymbol(self, symbolText);
-#endif
-	}
-
-	Memory_Free( symbolText );
-	Memory_Free( mangledName );
-
-	return result;
-}
-
-
-void Module_UnLoad( void* module ) {
-	Module* self = (Module*)module;
-	
-#ifndef NOSHARED
-	if( self->dllPtr ) {
-		dlclose( self->dllPtr );
-	}
-#endif
-	self->dllPtr = 0;
-	self->GetMetadata = 0;
-	self->GetName = 0;
-	self->GetVersion = 0;
-}
-
-char* Module_MangledName( void* module ) {
-	Module* self = (Module*)module;
-	
-	return self->MangleName( self->name );
-}
-
-#ifdef NOSHARED
-Bool Module_CheckStaticName(Module *self) {
-    int ii;
-
-    for(ii = 0; ii < stg_num_modules; ii++) {
-	if(!strcmp(self->mangledName, stg_module_names[ii]))
-	    break;
-    }
-    if(ii == stg_num_modules)
-	return False;
-    return True;
-}
-
-void* Module_MapStaticSymbol(Module *self, const char *sym) {
-    int ii, jj;
-
-    for(ii = 0; ii < stg_num_modules; ii++) {
-	if(!strcmp(self->mangledName, stg_module_names[ii]))
-	    break;
-    }
-    if(ii == stg_num_modules)
-	return NULL;
-
-    for(jj = 0; jj < stg_num_module_syms[ii]; jj++) {
-	if(!strcmp(sym, stg_module_syms[ii][jj]))
-	    break;
-    }
-    if(jj == stg_num_module_syms[ii])
-	return NULL;
-
-    return stg_module_funcs[ii][jj];
-}
-#endif
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Module.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/Module.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,356 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Module.c 3192 2005-08-25 01:45:42Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Module.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+
+#ifndef NOSHARED
+#include <dlfcn.h>
+#else
+extern int stg_num_modules;
+extern char **stg_module_names;
+extern int *stg_num_module_syms;
+extern char ***stg_module_syms;
+extern void ***stg_module_funcs;
+
+Bool Module_CheckStaticName(Module *self);
+void* Module_MapStaticSymbol(Module *self, const char *sym);
+#endif
+
+#include <limits.h>
+
+
+const Type Module_Type = "Module";
+
+static Name MODULE_GETMETADATA_SUFFIX = "_MetaAsDictionary";
+static Name MODULE_GETNAME_SUFFIX = "_GetName";
+static Name MODULE_GETVERSION_SUFFIX = "_GetVersion";
+
+#ifdef MEMORY_STATS
+	static Name MODULE_FILENAME = "fileName";
+	static Name MODULE_SYMBOLNAME = "symbolName";
+#endif
+
+#ifdef NOSHARED
+int stg_num_modules = 0;
+char **stg_module_names = NULL;
+int *stg_num_module_syms = NULL;
+char ***stg_module_syms = NULL;
+void ***stg_module_funcs = NULL;
+#endif
+
+Module* _Module_New(  MODULE_DEFARGS  )
+{
+	Module* self;
+
+	assert( _sizeOfSelf >= sizeof(Module) );
+
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (Module*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	_Module_Init( self, MangleName, directories );
+
+	return self;
+}
+	
+void _Module_Init(
+		Module*                      self,
+		Module_MangleNameFunction    MangleName,
+		Stg_ObjectList*              directories )
+{
+	char*                           fileName = NULL;
+	char*                           fullPathName = NULL;
+
+	Stream*                         stream;
+	Stream*                         debug;
+	Stream*                         error;
+
+#ifndef NOSHARED
+	int                             fullPathLength = 0;
+	int                             length;
+	Index                           dir_i;
+#endif
+	
+	stream =  Journal_Register( Info_Type, self->type );
+	debug =  Journal_Register( Debug_Type, self->type );
+	error =  Journal_Register( Error_Type, self->type );
+	
+	self->MangleName = MangleName;
+	
+	
+	Journal_Printf( debug, "Finding module: \"%s\"... ", self->name );
+
+	/* Try the plugin name by itself (allows LD_LIBRARY_PATH) to take precendence */
+	self->mangledName = self->MangleName( self->name );
+#ifndef NOSHARED
+	fileName = Memory_Alloc_Array( char, strlen(self->mangledName) + strlen(MODULE_SUFFIX) + strlen(MODULE_EXT) +1, MODULE_FILENAME );
+	sprintf( fileName, "%s%s%s", self->mangledName, MODULE_SUFFIX, MODULE_EXT );
+		
+	self->dllPtr = dlopen( fileName, RTLD_LAZY | RTLD_GLOBAL );
+	if( self->dllPtr ) {
+		Journal_RPrintf( stream, "%s \"%s\" found using %s\n", self->type, self->name, fileName );
+	}
+	else {
+		Journal_RPrintf( stream, "%s \"%s\" failed: %s\n", self->type, self->name, dlerror() );
+		
+		for ( dir_i = 0; dir_i < directories->count; ++dir_i ) {
+			length = strlen(Stg_ObjectList_ObjectAt( directories, dir_i )) + 1 + strlen(fileName) + 1;
+			if ( fullPathLength < length ) {
+				fullPathLength = length;
+				fullPathName = Memory_Realloc_Array( fullPathName, char, fullPathLength );
+			}
+			PathJoin( fullPathName, 2, Stg_ObjectList_ObjectAt( directories, dir_i ), fileName );
+			self->dllPtr = dlopen( fullPathName, RTLD_LAZY | RTLD_GLOBAL );
+			if( self->dllPtr ) {
+				Journal_RPrintf( stream, "%s \"%s\" found using %s\n", self->type, self->name, fileName );
+				break;
+			}
+			else {
+				Journal_RPrintf( stream, "%s \"%s\" failed: %s\n", self->type, self->name, dlerror() );
+			}
+		}
+		/* If it failed alltogether, print a error message. */
+		if ( dir_i == directories->count) {
+			Journal_Printf( debug, "failed to find in any of directories above, or had error.\n" );
+		}
+	}
+#else
+	/* This is a static build, so we just need to make sure we can find the name
+	   of the module in the module list. */
+	self->dllPtr = (DLL_Handle)Module_CheckStaticName(self);
+#endif
+
+	/* Load the symbols */
+	if( self->dllPtr ) {
+		self->GetMetadata = (Module_GetMetadataFunction*)Module_LoadSymbol( self, MODULE_GETMETADATA_SUFFIX );
+		self->GetName = (Module_GetNameFunction*)Module_LoadSymbol( self, MODULE_GETNAME_SUFFIX );
+		self->GetVersion = (Module_GetVersionFunction*)Module_LoadSymbol( self, MODULE_GETVERSION_SUFFIX );
+	}
+	
+	/* Load the meta data */
+	if( self->GetMetadata ) {
+		self->_meta = self->GetMetadata();
+	}
+	else {
+		self->_meta = Dictionary_New();
+	}
+
+	if ( fullPathName ) {
+		Memory_Free( fullPathName );
+	}
+	Memory_Free( fileName );
+}
+	
+void _Module_Delete( void* module ) {
+	Module* self = (Module*)module;
+
+	Module_UnLoad( self );
+	Stg_Class_Delete( self->_meta );
+	Memory_Free( self->mangledName );
+	
+	/* Delete parent */
+	_Stg_Object_Delete( self );
+}
+	
+void _Module_Print( void* module, Stream* stream ) {
+	Module* self = (Module*)module;
+
+	Index count = 0;
+	Index i;
+	Name version;
+
+	Journal_RPrintf( stream, "Module: %s\n", self->name );
+	Stream_Indent( stream );
+	
+	version = Module_GetVersion( self );
+	if ( version == NULL ) {
+		version = "Unknown";
+	}
+	Journal_Printf( stream, "Version: (version) %s\n", version );
+
+	count = Stg_Meta_GetAssociationCount( self->_meta );
+	for( i = 0; i < count; ++i ) {
+		char* name;
+		
+		name = Stg_Meta_GetAssociationType( self->_meta, i );
+		Journal_RPrintf( stream, "Depends on: %s\n", name ? name : "(type missing - erronous meta data)" );
+	}
+	
+	/* Print parent */
+	_Stg_Object_Print( self, stream );
+	
+	Stream_UnIndent( stream );
+}
+
+
+Dictionary* Module_GetMetadata( void* module ) {
+	Module* self = (Module*)module;
+	
+	return self->_meta;
+}
+
+Name Module_GetName( void* module ) {
+	Module* self = (Module*)module;
+
+	if ( self->GetName ) {
+		return self->GetName();
+	}
+	return self->name;
+}
+
+Name Module_GetVersion( void* module ) {
+	Module* self = (Module*)module;
+
+	if ( self->GetVersion ) {
+		return self->GetVersion();
+	}
+	return NULL;
+}
+
+
+void* Module_LoadSymbol( void* module, Name suffix ) {
+	Module* self = (Module*)module;
+	char*   mangledName;
+	char*   symbolText;
+	void*   result;
+	
+	mangledName = self->MangleName( self->name );
+	symbolText = Memory_Alloc_Array( char, strlen( mangledName ) + strlen( suffix ) + 3, MODULE_SYMBOLNAME );
+
+	sprintf( symbolText, "%s%s",  mangledName, suffix );
+
+#ifndef NOSHARED
+	result = dlsym( self->dllPtr, symbolText );
+#else
+	/* Try to map the symbol. */
+	result = Module_MapStaticSymbol(self, symbolText);
+#endif
+
+	if( result == NULL ) {
+		/* Try with a leading "_"... this is because on macx the dlcompat library can work either placing
+		   this "_" for you and without and there is no easy way to know */
+		sprintf( symbolText, "_%s%s", mangledName, suffix );
+#ifndef NOSHARED
+		result = dlsym( self->dllPtr, symbolText );
+#else
+		result = Module_MapStaticSymbol(self, symbolText);
+#endif
+	}
+
+	Memory_Free( symbolText );
+	Memory_Free( mangledName );
+
+	return result;
+}
+
+
+void Module_UnLoad( void* module ) {
+	Module* self = (Module*)module;
+	
+#ifndef NOSHARED
+	if( self->dllPtr ) {
+		dlclose( self->dllPtr );
+	}
+#endif
+	self->dllPtr = 0;
+	self->GetMetadata = 0;
+	self->GetName = 0;
+	self->GetVersion = 0;
+}
+
+char* Module_MangledName( void* module ) {
+	Module* self = (Module*)module;
+	
+	return self->MangleName( self->name );
+}
+
+#ifdef NOSHARED
+Bool Module_CheckStaticName(Module *self) {
+    int ii;
+
+    for(ii = 0; ii < stg_num_modules; ii++) {
+	if(!strcmp(self->mangledName, stg_module_names[ii]))
+	    break;
+    }
+    if(ii == stg_num_modules)
+	return False;
+    return True;
+}
+
+void* Module_MapStaticSymbol(Module *self, const char *sym) {
+    int ii, jj;
+
+    for(ii = 0; ii < stg_num_modules; ii++) {
+	if(!strcmp(self->mangledName, stg_module_names[ii]))
+	    break;
+    }
+    if(ii == stg_num_modules)
+	return NULL;
+
+    for(jj = 0; jj < stg_num_module_syms[ii]; jj++) {
+	if(!strcmp(sym, stg_module_syms[ii][jj]))
+	    break;
+    }
+    if(jj == stg_num_module_syms[ii])
+	return NULL;
+
+    return stg_module_funcs[ii][jj];
+}
+#endif
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ModulesManager.c
--- a/Base/Extensibility/src/ModulesManager.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,493 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ModulesManager.c 4081 2007-04-27 06:20:07Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Module.h"
-#include "ModulesManager.h"
-#include "ToolboxesManager.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#if NOSHARED
-        #define dlopen( x, y ) (NULL)
-	#define dlsym( x, y ) (NULL)
-        #define dlclose( x )
-        #define dlerror() "blah"
-        #define RTLD_LAZY 0
-        #define RTLD_GLOBAL 0
-#else
-        #include <dlfcn.h>
-#endif
-
-#include <limits.h>
-
-/* Textual name of this class */
-const Type ModulesManager_Type = "ModulesManager";
-
-/* For when compiling a single a single executable (no loading of modules at runtime */
-/* This is mainly for platforms which does not support dynamic libs */
-void SingleRegister();
-
-
-Name Codelet_GetMetadata();
-
-/* Define memory for global pointer to moduleDirectories */
-Stg_ObjectList*  moduleDirectories = NULL;	
-
-ModulesManager* _ModulesManager_New(  MODULESMANAGER_DEFARGS  )
-{
-	ModulesManager* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ModulesManager) );
-	self = (ModulesManager*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	self->_getModulesList = _getModulesList;
-	self->_loadModule = _loadModule;
-	self->_unloadModule = _unloadModule;
-	self->_moduleFactory = _moduleFactory;
-	self->_checkContext = _checkContext;
-	self->_getModuleName = _getModuleName;
-	
-	_ModulesManager_Init( self );
-	
-	return self;
-}
-
-void _ModulesManager_Init( void* modulesManager ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-	
-	/* General and Virtual info should already be set */
-	/* Modules info */
-
-	self->modules = Stg_ObjectList_New();
-	self->codelets = Stg_ObjectList_New();
-}
-
-void _ModulesManager_Delete( void* modulesManager ) {
-	ModulesManager*         self = (ModulesManager*)modulesManager;
-	LiveComponentRegister*  lcRegister = NULL;
-
-	/* Note : We have to delete the codelets here rather than let the 
-		component factory do it as they refer to static data inside the
-		loaded module dlls, which are no longer available once we delete
-		all in self->modules. -- Main.PatrickSunter 18 May 2006 */
-	if ( (lcRegister = LiveComponentRegister_GetLiveComponentRegister()) ) {
-		/* sweep through codelets list and delete each from the lcRegister */
-		Index codelet_I;
-		
-		for ( codelet_I = 0; codelet_I < self->codelets->count; ++codelet_I ) {
-			LiveComponentRegister_RemoveOneComponentsEntry( lcRegister,
-				((Stg_Object*)self->codelets->data[codelet_I])->name );
-		}
-	}
-	Stg_ObjectList_DeleteAllObjects( self->codelets );
-	Stg_Class_Delete( self->codelets );
-	ModulesManager_Unload( self ); 
-	Stg_Class_Delete( self->modules );
-	
-	/* Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-void _ModulesManager_Print( void* modulesManager, Stream* stream ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-	Index i;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "%s (ptr): %p\n", ModulesManager_Type, self );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-
-	if ( moduleDirectories->count > 0 ) {
-		Journal_Printf( stream, "Search Path:\n" );
-		Stream_Indent( stream );
-		for ( i = 0; i < moduleDirectories->count; ++i ) {
-			Journal_Printf( stream, "(path) %s\n", Stg_ObjectList_ObjectAt( moduleDirectories, i ) );
-		}
-		Stream_UnIndent( stream );
-	}
-
-	if ( self->modules->count > 0 ) {
-		Journal_Printf( stream, "Loaded modules:\n" );
-		Stream_Indent( stream );
-		for ( i = 0; i < self->modules->count; ++i ) {
-			Module* module = (Module*)Stg_ObjectList_At( self->modules, i );
-			Journal_Printf( stream, "%s\n", module->name );
-			if ( Module_GetVersion( module ) ) {
-				Journal_Printf( stream, "\t(version) %s\n", Module_GetVersion( module ) );
-			}
-		}
-		Stream_UnIndent( stream );
-	}
-}
-
-Dictionary_Entry_Value* ModulesManager_GetModulesList( void* modulesManager, void* _dictionary ) {
-	ModulesManager*			self = (ModulesManager*)modulesManager;
-	Dictionary*			dictionary = (Dictionary*)_dictionary;
-	
-	return self->_getModulesList( self, dictionary );
-}
-
-Bool ModulesManager_CheckContext( void* modulesManager, Dictionary_Entry_Value* modulesVal, unsigned int entry_I, Name contextName ) {
-	ModulesManager*			self 		= (ModulesManager*)modulesManager;
-
-	return self->_checkContext( self, modulesVal, entry_I, contextName );
-}
-
-Name ModulesManager_GetModuleName( void* modulesManager, Dictionary_Entry_Value* moduleVal, unsigned int entry_I ) {
-	ModulesManager*			self 		= (ModulesManager*)modulesManager;
-
-	return self->_getModuleName( self, moduleVal, entry_I );
-}
-
-void ModulesManager_Load( void* modulesManager, void* _dictionary, Name contextName ) {
-	ModulesManager*			self = (ModulesManager*)modulesManager;
-	Dictionary*					dictionary = (Dictionary*)_dictionary;
-	unsigned int				entryCount;
-	unsigned int				entry_I;
-	Dictionary_Entry_Value*	modulesVal;
-
-	/* First add the directory list onto LD_LIBRARY_PATH so that it can potentially
-	 * resolve the unknown symbols */
-#ifndef NOSHARED
-	char* curEnvPath;
-	char* newEnvPath;
-	Index newEnvPathLength;
-	Index dir_I;
-
-	newEnvPathLength = 0;
-
-	if( dictionary ) {
-		Dictionary_Entry_Value* localLibDirList = Dictionary_Get( dictionary, "LD_LIBRARY_PATH" );
-		if( localLibDirList ) {
-			Index i, count;
-			char* dir;
-			count = Dictionary_Entry_Value_GetCount( localLibDirList );
-			for ( i = 0; i < count; ++i ) {
-				dir = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( localLibDirList, i ) );
-				ModulesManager_AddDirectory( "FromDictionary", dir );
-			}
-		}
-	}
-	
-	for ( dir_I = 0; dir_I < moduleDirectories->count; ++dir_I ) {
-		newEnvPathLength += strlen( Stg_ObjectList_ObjectAt( moduleDirectories, dir_I ) );
-		/* Add one make space for the ':' inbetween the directories */
-		newEnvPathLength += 1; 
-	}
-	curEnvPath = getenv("LD_LIBRARY_PATH");
-	if ( curEnvPath ) {
-		newEnvPathLength += strlen( curEnvPath );
-	}
-
-	if ( newEnvPathLength > 0 ) {
-		/* Add one to make space for the Null Terminator '\0' */
-		newEnvPathLength += 1;
-		
-		newEnvPath = Memory_Alloc_Array( char, newEnvPathLength, "LD_LIBRARY_PATH" );
-		newEnvPath[0] = '\0';
-		for ( dir_I = 0; dir_I < moduleDirectories->count; ++dir_I ) {
-			strcat( newEnvPath, Stg_ObjectList_ObjectAt( moduleDirectories, dir_I ) );
-			strcat( newEnvPath, ":" );
-		}
-		if ( curEnvPath ) {
-			strcat( newEnvPath, curEnvPath );
-		}
-		setenv( "LD_LIBRARY_PATH", newEnvPath, 1 );
-		Journal_Printf(
-			Journal_Register( Debug_Type, self->type ),
-			"Using LD_LIBRARY_PATH=%s\n",
-			newEnvPath );
-		Memory_Free( newEnvPath );
-	}
-#endif
-
-	modulesVal = ModulesManager_GetModulesList( self, dictionary );
-	
-	if( !modulesVal ) {
-		entryCount = 0;
-	}
-	else {
-		entryCount = Dictionary_Entry_Value_GetCount( modulesVal );
-	}
-	
-	for( entry_I = 0; entry_I < entryCount; entry_I++ ) {
-		Name		moduleName;
-		moduleName = ModulesManager_GetModuleName( self, modulesVal, entry_I );
-		//moduleName = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( modulesVal, entry_I ) );
-
-		if( !ModulesManager_CheckContext( self, modulesVal, entry_I, contextName ) )
-			continue;
-
-		if ( ! ModulesManager_LoadModule( self, moduleName ) ) {
-#ifndef NOSHARED
-			Journal_Firewall(
-				0,
-				Journal_Register( Info_Type, self->type ),
-				"Error. Unable to load module %s\n"
-				"Please check that:-\n"
-				"   1. Module %s(%smodule.so) is built\n"
-				"   2. Module has function 'Index %s_Register( ... )'\n"
-				"   3. Module does not have undefined symbols.\n"
-				"   4. $LD_LIBRARY_PATH is set\n"
-				"   5. $LD_LIBRARY_PATH is set correctly\n"
-				"You can get more information about what went wrong by adding the following two lines to your input file:\n"
-				"	<param name=\"journal.debug\">true</param>\n"
-				"	<param name=\"journal.debug.%s\">true</param>\n"
-				"For more help visit http://csd.vpac.org/twiki/bin/view/Stgermain/FrequentlyAskedQuestions#Plugins_Won_t_Load_in_Parallel\n",
-				moduleName, moduleName, moduleName, moduleName, self->type );
-		}
-#else
-			Journal_Firewall(
-				0,
-				Journal_Register( Info_Type, self->type ),
-				"Error. Unable to load module %s\n"
-				"As this is a static build, it is likely that the requested\n"
-				"module was not built into the binaries.\n"
-				"You can get more information about what went wrong by adding the following two lines to your input file:\n"
-				"	<param name=\"journal.debug\">true</param>\n"
-				"	<param name=\"journal.debug.%s\">true</param>\n"
-				"For more help visit http://csd.vpac.org/twiki/bin/view/Stgermain/FrequentlyAskedQuestions#Plugins_Won_t_Load_in_Parallel\n",
-				moduleName, moduleName, moduleName, moduleName, self->type );
-		}
-#endif
-	}
-}
-
-Bool ModulesManager_LoadModule( void* modulesManager, Name moduleName ) {
-	ModulesManager*	self = (ModulesManager*)modulesManager;
-	Module* theModule;
-
-	Dictionary* metadata;
-	Index depCount = 0;
-	Index dep_I;
-	
-	Stream* stream;
-	Stream* debug;
-	Stream* error;
-
-    
-	stream =  Journal_Register( Info_Type, self->type );
-	debug =  Journal_Register( Debug_Type, self->type );
-	error =  Journal_Register( Error_Type, self->type );
-
-	if ( Stg_ObjectList_Get( self->modules, moduleName ) != NULL ) {
-		Journal_Printf( debug, "Module %s already loaded\n", moduleName );
-		return True;
-	}
-
-	/* Try local search first */
-	theModule = ModulesManager_CreateModule( self, moduleName, moduleDirectories );
-
-	/* remote search? */
-
-	if ( theModule == NULL ) {
-		return False;
-	}
-
-	/* version check? */
-	
-	metadata = Module_GetMetadata( theModule );
-	depCount = metadata ? Stg_Meta_GetAssociationCount( metadata ) : 0;
-	for( dep_I = 0; dep_I < depCount; ++dep_I ) {
-		char* name;
-
-		name = Stg_Meta_GetAssociationType( metadata, dep_I );
-		Journal_Firewall( name!=NULL, stream, "Module name/type not found in dependency/associations meta entry\n" );
-
-		if( !ModulesManager_LoadModule( self, name ) ) {
-			Journal_Printf( stream, "Dependency %s failed to load\n", name );
-			Stg_Class_Delete( theModule );
-			return False;
-		}
-	}
-	
-	/* Do the actual loading of the module */
-	if( self->_loadModule( self, theModule ) ) {
-		Stg_ObjectList_Append( self->modules, theModule );
-	}
-	else {
-		return False;
-	}
-
-	return True;
-}
-
-
-Bool ModulesManager_UnloadModule( void* modulesManager, Name moduleName ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-	
-	if( self->_unloadModule( self, (Module*)Stg_ObjectList_Get( self->modules, moduleName ) ) ) {
-		if( Stg_ObjectList_Remove( self->modules, moduleName, DELETE ) ) {
-			return True;
-		}
-	}
-	return False;
-}
-
-void ModulesManager_Unload( void* modulesManager ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-	
-	while( self->modules->count ) {
-		Module* module = (Module*)Stg_ObjectList_At( self->modules, self->modules->count - 1 ); /* reverse order deletion */
-		
-		ModulesManager_UnloadModule( self, module->name );
-	}
-}
-
-void ModulesManager_AddDirectory( Name name, Name directory ) {
-	Bool				found;
-	Index				i;
-	
-	/* Check if global list is initialised */
-	if (moduleDirectories == NULL) {
-		moduleDirectories = Stg_ObjectList_New();
-	}
-	
-	/* Check that the directory isn't already added */
-	found = False;
-	for( i =  0; i < moduleDirectories->count; i++ ){
-          if( strcmp( directory, (Name)Stg_ObjectList_ObjectAt( moduleDirectories, i ) ) == 0 ) {
-			found = True;
-		}
-	}
-	
-	if( !found ) {
-		Stg_ObjectList_PointerAppend( moduleDirectories, StG_Strdup( directory ), name, 0, 0, 0 ); 
-	}
-}
-
-/* This prototype is provided here as its generated by the build system from the meta files, and the call to 
-   ModulesManager_Add in the function below is the raw one, and hence more info is needed */
-Dictionary* Codelet_MetaAsDictionary();
-
-Index ModulesManager_Submit( 
-		void* modulesManager, 
-		Name codeletName, 
-		Name version,
-		Stg_Component_DefaultConstructorFunction* defaultNew ) 
-{
-	ModulesManager* self = (ModulesManager*)modulesManager;
-
-	void* codeletInstance = NULL;
-	Index result;
-	Stg_ComponentRegister* componentRegister;
-	Stg_Component_DefaultConstructorFunction*  functionCheck=NULL;
-	
-	/* Check whether the module has already been added to the component register */
-	
-	componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-	functionCheck = Stg_ComponentRegister_Get(componentRegister, codeletName, version);
-	
-	/* Add module if it isn't already there. */
-	if( functionCheck == NULL ) {
-		Stg_ComponentRegister_AddFunc( 
-			Stg_ComponentRegister_Get_ComponentRegister(),
-			codeletName,
-			version,
-			defaultNew,
-			Codelet_MetaAsDictionary );
-	
-		codeletInstance = defaultNew( (char*)codeletName );
-		result = Stg_ObjectList_Append( self->codelets, codeletInstance );
-
-		/* only submit if not a toolbox */
-		if( LiveComponentRegister_GetLiveComponentRegister() && strcmp( self->type, ToolboxesManager_Type ) ) {
-                  LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)codeletInstance );
-		}
-		
-		return result;
-	}
-	else {
-		// TODO check if an existing self->codelets has the same Type - if so error & exit
-		
-		/* Otherwise since this Codelet has already been added to the global ComponentRegister,
-		 * but not to this ModulesManager instance, then just instantiate another Codelet instance
-		 * and add it to this ModulesManager's codelet array. */
-          codeletInstance = defaultNew( (char*)codeletName );
-		result = Stg_ObjectList_Append( self->codelets, codeletInstance );
-		
-		return result;
-	}
-}
-
-Module* ModulesManager_CreateModule( void* modulesManager, Name name, Stg_ObjectList* directories ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-	Module* module = self->_moduleFactory( name, directories );
-
-	if( module->dllPtr ) {
-		return module;
-	}
-	else {
-		return 0;
-	}
-}
-
-
-void ModulesManager_ConstructModules( void* modulesManager, Stg_ComponentFactory* cf, void* data ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-	Index i;
-
-	for( i = 0; i < self->codelets->count; ++i ) {
-		Stg_Component_AssignFromXML( self->codelets->data[i], cf, data, False );
-	}
-}
-
-
-Bool ModulesManager_ConstructModule( void* modulesManager, Name moduleName, Stg_ComponentFactory* cf, void* data ) {
-	ModulesManager* self = (ModulesManager*)modulesManager;
-
-	/* Get the codelet for the module we're wanting to construct. */
-	void* codelet = Stg_ObjectList_Get( self->codelets, moduleName );
-				
-	if( codelet == NULL )
-		return False;
-	else
-		Stg_Component_AssignFromXML( codelet, cf, data, False );
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ModulesManager.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ModulesManager.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,493 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ModulesManager.c 4081 2007-04-27 06:20:07Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Module.h"
+#include "ModulesManager.h"
+#include "ToolboxesManager.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#if NOSHARED
+        #define dlopen( x, y ) (NULL)
+	#define dlsym( x, y ) (NULL)
+        #define dlclose( x )
+        #define dlerror() "blah"
+        #define RTLD_LAZY 0
+        #define RTLD_GLOBAL 0
+#else
+        #include <dlfcn.h>
+#endif
+
+#include <limits.h>
+
+/* Textual name of this class */
+const Type ModulesManager_Type = "ModulesManager";
+
+/* For when compiling a single a single executable (no loading of modules at runtime */
+/* This is mainly for platforms which does not support dynamic libs */
+void SingleRegister();
+
+
+Name Codelet_GetMetadata();
+
+/* Define memory for global pointer to moduleDirectories */
+Stg_ObjectList*  moduleDirectories = NULL;	
+
+ModulesManager* _ModulesManager_New(  MODULESMANAGER_DEFARGS  )
+{
+	ModulesManager* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ModulesManager) );
+	self = (ModulesManager*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	self->_getModulesList = _getModulesList;
+	self->_loadModule = _loadModule;
+	self->_unloadModule = _unloadModule;
+	self->_moduleFactory = _moduleFactory;
+	self->_checkContext = _checkContext;
+	self->_getModuleName = _getModuleName;
+	
+	_ModulesManager_Init( self );
+	
+	return self;
+}
+
+void _ModulesManager_Init( void* modulesManager ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+	
+	/* General and Virtual info should already be set */
+	/* Modules info */
+
+	self->modules = Stg_ObjectList_New();
+	self->codelets = Stg_ObjectList_New();
+}
+
+void _ModulesManager_Delete( void* modulesManager ) {
+	ModulesManager*         self = (ModulesManager*)modulesManager;
+	LiveComponentRegister*  lcRegister = NULL;
+
+	/* Note : We have to delete the codelets here rather than let the 
+		component factory do it as they refer to static data inside the
+		loaded module dlls, which are no longer available once we delete
+		all in self->modules. -- Main.PatrickSunter 18 May 2006 */
+	if ( (lcRegister = LiveComponentRegister_GetLiveComponentRegister()) ) {
+		/* sweep through codelets list and delete each from the lcRegister */
+		Index codelet_I;
+		
+		for ( codelet_I = 0; codelet_I < self->codelets->count; ++codelet_I ) {
+			LiveComponentRegister_RemoveOneComponentsEntry( lcRegister,
+				((Stg_Object*)self->codelets->data[codelet_I])->name );
+		}
+	}
+	Stg_ObjectList_DeleteAllObjects( self->codelets );
+	Stg_Class_Delete( self->codelets );
+	ModulesManager_Unload( self ); 
+	Stg_Class_Delete( self->modules );
+	
+	/* Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+void _ModulesManager_Print( void* modulesManager, Stream* stream ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+	Index i;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "%s (ptr): %p\n", ModulesManager_Type, self );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+
+	if ( moduleDirectories->count > 0 ) {
+		Journal_Printf( stream, "Search Path:\n" );
+		Stream_Indent( stream );
+		for ( i = 0; i < moduleDirectories->count; ++i ) {
+			Journal_Printf( stream, "(path) %s\n", Stg_ObjectList_ObjectAt( moduleDirectories, i ) );
+		}
+		Stream_UnIndent( stream );
+	}
+
+	if ( self->modules->count > 0 ) {
+		Journal_Printf( stream, "Loaded modules:\n" );
+		Stream_Indent( stream );
+		for ( i = 0; i < self->modules->count; ++i ) {
+			Module* module = (Module*)Stg_ObjectList_At( self->modules, i );
+			Journal_Printf( stream, "%s\n", module->name );
+			if ( Module_GetVersion( module ) ) {
+				Journal_Printf( stream, "\t(version) %s\n", Module_GetVersion( module ) );
+			}
+		}
+		Stream_UnIndent( stream );
+	}
+}
+
+Dictionary_Entry_Value* ModulesManager_GetModulesList( void* modulesManager, void* _dictionary ) {
+	ModulesManager*			self = (ModulesManager*)modulesManager;
+	Dictionary*			dictionary = (Dictionary*)_dictionary;
+	
+	return self->_getModulesList( self, dictionary );
+}
+
+Bool ModulesManager_CheckContext( void* modulesManager, Dictionary_Entry_Value* modulesVal, unsigned int entry_I, Name contextName ) {
+	ModulesManager*			self 		= (ModulesManager*)modulesManager;
+
+	return self->_checkContext( self, modulesVal, entry_I, contextName );
+}
+
+Name ModulesManager_GetModuleName( void* modulesManager, Dictionary_Entry_Value* moduleVal, unsigned int entry_I ) {
+	ModulesManager*			self 		= (ModulesManager*)modulesManager;
+
+	return self->_getModuleName( self, moduleVal, entry_I );
+}
+
+void ModulesManager_Load( void* modulesManager, void* _dictionary, Name contextName ) {
+	ModulesManager*			self = (ModulesManager*)modulesManager;
+	Dictionary*					dictionary = (Dictionary*)_dictionary;
+	unsigned int				entryCount;
+	unsigned int				entry_I;
+	Dictionary_Entry_Value*	modulesVal;
+
+	/* First add the directory list onto LD_LIBRARY_PATH so that it can potentially
+	 * resolve the unknown symbols */
+#ifndef NOSHARED
+	char* curEnvPath;
+	char* newEnvPath;
+	Index newEnvPathLength;
+	Index dir_I;
+
+	newEnvPathLength = 0;
+
+	if( dictionary ) {
+		Dictionary_Entry_Value* localLibDirList = Dictionary_Get( dictionary, "LD_LIBRARY_PATH" );
+		if( localLibDirList ) {
+			Index i, count;
+			char* dir;
+			count = Dictionary_Entry_Value_GetCount( localLibDirList );
+			for ( i = 0; i < count; ++i ) {
+				dir = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( localLibDirList, i ) );
+				ModulesManager_AddDirectory( "FromDictionary", dir );
+			}
+		}
+	}
+	
+	for ( dir_I = 0; dir_I < moduleDirectories->count; ++dir_I ) {
+		newEnvPathLength += strlen( Stg_ObjectList_ObjectAt( moduleDirectories, dir_I ) );
+		/* Add one make space for the ':' inbetween the directories */
+		newEnvPathLength += 1; 
+	}
+	curEnvPath = getenv("LD_LIBRARY_PATH");
+	if ( curEnvPath ) {
+		newEnvPathLength += strlen( curEnvPath );
+	}
+
+	if ( newEnvPathLength > 0 ) {
+		/* Add one to make space for the Null Terminator '\0' */
+		newEnvPathLength += 1;
+		
+		newEnvPath = Memory_Alloc_Array( char, newEnvPathLength, "LD_LIBRARY_PATH" );
+		newEnvPath[0] = '\0';
+		for ( dir_I = 0; dir_I < moduleDirectories->count; ++dir_I ) {
+			strcat( newEnvPath, Stg_ObjectList_ObjectAt( moduleDirectories, dir_I ) );
+			strcat( newEnvPath, ":" );
+		}
+		if ( curEnvPath ) {
+			strcat( newEnvPath, curEnvPath );
+		}
+		setenv( "LD_LIBRARY_PATH", newEnvPath, 1 );
+		Journal_Printf(
+			Journal_Register( Debug_Type, self->type ),
+			"Using LD_LIBRARY_PATH=%s\n",
+			newEnvPath );
+		Memory_Free( newEnvPath );
+	}
+#endif
+
+	modulesVal = ModulesManager_GetModulesList( self, dictionary );
+	
+	if( !modulesVal ) {
+		entryCount = 0;
+	}
+	else {
+		entryCount = Dictionary_Entry_Value_GetCount( modulesVal );
+	}
+	
+	for( entry_I = 0; entry_I < entryCount; entry_I++ ) {
+		Name		moduleName;
+		moduleName = ModulesManager_GetModuleName( self, modulesVal, entry_I );
+		//moduleName = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( modulesVal, entry_I ) );
+
+		if( !ModulesManager_CheckContext( self, modulesVal, entry_I, contextName ) )
+			continue;
+
+		if ( ! ModulesManager_LoadModule( self, moduleName ) ) {
+#ifndef NOSHARED
+			Journal_Firewall(
+				0,
+				Journal_Register( Info_Type, self->type ),
+				"Error. Unable to load module %s\n"
+				"Please check that:-\n"
+				"   1. Module %s(%smodule.so) is built\n"
+				"   2. Module has function 'Index %s_Register( ... )'\n"
+				"   3. Module does not have undefined symbols.\n"
+				"   4. $LD_LIBRARY_PATH is set\n"
+				"   5. $LD_LIBRARY_PATH is set correctly\n"
+				"You can get more information about what went wrong by adding the following two lines to your input file:\n"
+				"	<param name=\"journal.debug\">true</param>\n"
+				"	<param name=\"journal.debug.%s\">true</param>\n"
+				"For more help visit http://csd.vpac.org/twiki/bin/view/Stgermain/FrequentlyAskedQuestions#Plugins_Won_t_Load_in_Parallel\n",
+				moduleName, moduleName, moduleName, moduleName, self->type );
+		}
+#else
+			Journal_Firewall(
+				0,
+				Journal_Register( Info_Type, self->type ),
+				"Error. Unable to load module %s\n"
+				"As this is a static build, it is likely that the requested\n"
+				"module was not built into the binaries.\n"
+				"You can get more information about what went wrong by adding the following two lines to your input file:\n"
+				"	<param name=\"journal.debug\">true</param>\n"
+				"	<param name=\"journal.debug.%s\">true</param>\n"
+				"For more help visit http://csd.vpac.org/twiki/bin/view/Stgermain/FrequentlyAskedQuestions#Plugins_Won_t_Load_in_Parallel\n",
+				moduleName, moduleName, moduleName, moduleName, self->type );
+		}
+#endif
+	}
+}
+
+Bool ModulesManager_LoadModule( void* modulesManager, Name moduleName ) {
+	ModulesManager*	self = (ModulesManager*)modulesManager;
+	Module* theModule;
+
+	Dictionary* metadata;
+	Index depCount = 0;
+	Index dep_I;
+	
+	Stream* stream;
+	Stream* debug;
+	Stream* error;
+
+    
+	stream =  Journal_Register( Info_Type, self->type );
+	debug =  Journal_Register( Debug_Type, self->type );
+	error =  Journal_Register( Error_Type, self->type );
+
+	if ( Stg_ObjectList_Get( self->modules, moduleName ) != NULL ) {
+		Journal_Printf( debug, "Module %s already loaded\n", moduleName );
+		return True;
+	}
+
+	/* Try local search first */
+	theModule = ModulesManager_CreateModule( self, moduleName, moduleDirectories );
+
+	/* remote search? */
+
+	if ( theModule == NULL ) {
+		return False;
+	}
+
+	/* version check? */
+	
+	metadata = Module_GetMetadata( theModule );
+	depCount = metadata ? Stg_Meta_GetAssociationCount( metadata ) : 0;
+	for( dep_I = 0; dep_I < depCount; ++dep_I ) {
+		char* name;
+
+		name = Stg_Meta_GetAssociationType( metadata, dep_I );
+		Journal_Firewall( name!=NULL, stream, "Module name/type not found in dependency/associations meta entry\n" );
+
+		if( !ModulesManager_LoadModule( self, name ) ) {
+			Journal_Printf( stream, "Dependency %s failed to load\n", name );
+			Stg_Class_Delete( theModule );
+			return False;
+		}
+	}
+	
+	/* Do the actual loading of the module */
+	if( self->_loadModule( self, theModule ) ) {
+		Stg_ObjectList_Append( self->modules, theModule );
+	}
+	else {
+		return False;
+	}
+
+	return True;
+}
+
+
+Bool ModulesManager_UnloadModule( void* modulesManager, Name moduleName ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+	
+	if( self->_unloadModule( self, (Module*)Stg_ObjectList_Get( self->modules, moduleName ) ) ) {
+		if( Stg_ObjectList_Remove( self->modules, moduleName, DELETE ) ) {
+			return True;
+		}
+	}
+	return False;
+}
+
+void ModulesManager_Unload( void* modulesManager ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+	
+	while( self->modules->count ) {
+		Module* module = (Module*)Stg_ObjectList_At( self->modules, self->modules->count - 1 ); /* reverse order deletion */
+		
+		ModulesManager_UnloadModule( self, module->name );
+	}
+}
+
+void ModulesManager_AddDirectory( Name name, Name directory ) {
+	Bool				found;
+	Index				i;
+	
+	/* Check if global list is initialised */
+	if (moduleDirectories == NULL) {
+		moduleDirectories = Stg_ObjectList_New();
+	}
+	
+	/* Check that the directory isn't already added */
+	found = False;
+	for( i =  0; i < moduleDirectories->count; i++ ){
+          if( strcmp( directory, (Name)Stg_ObjectList_ObjectAt( moduleDirectories, i ) ) == 0 ) {
+			found = True;
+		}
+	}
+	
+	if( !found ) {
+		Stg_ObjectList_PointerAppend( moduleDirectories, StG_Strdup( directory ), name, 0, 0, 0 ); 
+	}
+}
+
+/* This prototype is provided here as its generated by the build system from the meta files, and the call to 
+   ModulesManager_Add in the function below is the raw one, and hence more info is needed */
+Dictionary* Codelet_MetaAsDictionary();
+
+Index ModulesManager_Submit( 
+		void* modulesManager, 
+		Name codeletName, 
+		Name version,
+		Stg_Component_DefaultConstructorFunction* defaultNew ) 
+{
+	ModulesManager* self = (ModulesManager*)modulesManager;
+
+	void* codeletInstance = NULL;
+	Index result;
+	Stg_ComponentRegister* componentRegister;
+	Stg_Component_DefaultConstructorFunction*  functionCheck=NULL;
+	
+	/* Check whether the module has already been added to the component register */
+	
+	componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+	functionCheck = Stg_ComponentRegister_Get(componentRegister, codeletName, version);
+	
+	/* Add module if it isn't already there. */
+	if( functionCheck == NULL ) {
+		Stg_ComponentRegister_AddFunc( 
+			Stg_ComponentRegister_Get_ComponentRegister(),
+			codeletName,
+			version,
+			defaultNew,
+			Codelet_MetaAsDictionary );
+	
+		codeletInstance = defaultNew( (char*)codeletName );
+		result = Stg_ObjectList_Append( self->codelets, codeletInstance );
+
+		/* only submit if not a toolbox */
+		if( LiveComponentRegister_GetLiveComponentRegister() && strcmp( self->type, ToolboxesManager_Type ) ) {
+                  LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)codeletInstance );
+		}
+		
+		return result;
+	}
+	else {
+		// TODO check if an existing self->codelets has the same Type - if so error & exit
+		
+		/* Otherwise since this Codelet has already been added to the global ComponentRegister,
+		 * but not to this ModulesManager instance, then just instantiate another Codelet instance
+		 * and add it to this ModulesManager's codelet array. */
+          codeletInstance = defaultNew( (char*)codeletName );
+		result = Stg_ObjectList_Append( self->codelets, codeletInstance );
+		
+		return result;
+	}
+}
+
+Module* ModulesManager_CreateModule( void* modulesManager, Name name, Stg_ObjectList* directories ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+	Module* module = self->_moduleFactory( name, directories );
+
+	if( module->dllPtr ) {
+		return module;
+	}
+	else {
+		return 0;
+	}
+}
+
+
+void ModulesManager_ConstructModules( void* modulesManager, Stg_ComponentFactory* cf, void* data ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+	Index i;
+
+	for( i = 0; i < self->codelets->count; ++i ) {
+		Stg_Component_AssignFromXML( self->codelets->data[i], cf, data, False );
+	}
+}
+
+
+Bool ModulesManager_ConstructModule( void* modulesManager, Name moduleName, Stg_ComponentFactory* cf, void* data ) {
+	ModulesManager* self = (ModulesManager*)modulesManager;
+
+	/* Get the codelet for the module we're wanting to construct. */
+	void* codelet = Stg_ObjectList_Get( self->codelets, moduleName );
+				
+	if( codelet == NULL )
+		return False;
+	else
+		Stg_Component_AssignFromXML( codelet, cf, data, False );
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Plugin.c
--- a/Base/Extensibility/src/Plugin.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-*/
-/** \file
-**  Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: Plugin.c 3192 2005-08-25 01:45:42Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Module.h"
-#include "Plugin.h"
-
-#include <string.h>
-
-
-const Type Plugin_Type = "Plugin";
-
-static Name PLUGIN_REGISTER_SUFFIX = "_Register";
-#ifdef MEMORY_STATS
-	static Name PLUGIN_MANGLEDNAME = "mangledName";
-#endif
-
-
-Plugin* Plugin_New( Name name, Stg_ObjectList* directories ) {
-	/* Variables set in this function */
-	SizeT                       _sizeOfSelf = sizeof(Plugin);
-	Type                               type = Plugin_Type;
-	Stg_Class_DeleteFunction*       _delete = _Plugin_Delete;
-	Stg_Class_PrintFunction*         _print = _Plugin_Print;
-	Stg_Class_CopyFunction*           _copy = NULL;
-	Module_MangleNameFunction*   MangleName = _Plugin_MangleName;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Plugin_New(  PLUGIN_PASSARGS  );
-}
-
-Module* Plugin_Factory( Name name, Stg_ObjectList* directories ) {
-	return (Module*)Plugin_New( name, directories );
-}
-	
-Plugin* _Plugin_New(  PLUGIN_DEFARGS  )
-{
-	Plugin* self;
-
-	assert( _sizeOfSelf >= sizeof(Plugin) );
-
-	self = (Plugin*)_Module_New(  MODULE_PASSARGS  );
-	
-	_Plugin_Init( self );
-
-	return self;
-}
-	
-void _Plugin_Init( Plugin* self ) {
-	Stream* debug = Journal_Register( Debug_Type, self->type );
-
-	if( self->dllPtr != NULL ) {
-		self->Register = (Plugin_RegisterFunction*)Module_LoadSymbol( self, PLUGIN_REGISTER_SUFFIX );
-		
-		/* If the register function is not found, then unload the module... it's not a plugin. */
-		if( self->Register == NULL ) {
-			Journal_Printf( debug, "Plugin %s is not a plugin, unloading.\n", self->name );
-			Module_UnLoad( self );
-		}
-	}
-}
-	
-void _Plugin_Delete( void* plugin ) {
-	Plugin* self = (Plugin*)plugin;
-
-	/* Delete parent */
-	_Module_Delete( self );
-}
-	
-void _Plugin_Print( void* plugin, Stream* stream ) {
-	Plugin* self = (Plugin*)plugin;
-
-	Journal_Printf( stream, "Plugin: %s\n", self->name );
-	Stream_Indent( stream );
-	
-	/* Print parent */
-	_Module_Print( self, stream );
-	
-	Stream_UnIndent( stream );
-}
-
-char* _Plugin_MangleName( Name name ) {
-	char* mangledName = Memory_Alloc_Array( char, strlen( name ) + 1, PLUGIN_MANGLEDNAME );
-	sprintf( mangledName, "%s", name );
-	return mangledName;
-}
-
-
-Plugin_RegisterFunction* Plugin_GetRegisterFunc( void* plugin ) {
-	Plugin* self = (Plugin*)plugin;
-
-	return self->Register;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Plugin.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/Plugin.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,139 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Plugin.c 3192 2005-08-25 01:45:42Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Module.h"
+#include "Plugin.h"
+
+#include <string.h>
+
+
+const Type Plugin_Type = "Plugin";
+
+static Name PLUGIN_REGISTER_SUFFIX = "_Register";
+#ifdef MEMORY_STATS
+	static Name PLUGIN_MANGLEDNAME = "mangledName";
+#endif
+
+
+Plugin* Plugin_New( Name name, Stg_ObjectList* directories ) {
+	/* Variables set in this function */
+	SizeT                       _sizeOfSelf = sizeof(Plugin);
+	Type                               type = Plugin_Type;
+	Stg_Class_DeleteFunction*       _delete = _Plugin_Delete;
+	Stg_Class_PrintFunction*         _print = _Plugin_Print;
+	Stg_Class_CopyFunction*           _copy = NULL;
+	Module_MangleNameFunction*   MangleName = _Plugin_MangleName;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Plugin_New(  PLUGIN_PASSARGS  );
+}
+
+Module* Plugin_Factory( Name name, Stg_ObjectList* directories ) {
+	return (Module*)Plugin_New( name, directories );
+}
+	
+Plugin* _Plugin_New(  PLUGIN_DEFARGS  )
+{
+	Plugin* self;
+
+	assert( _sizeOfSelf >= sizeof(Plugin) );
+
+	self = (Plugin*)_Module_New(  MODULE_PASSARGS  );
+	
+	_Plugin_Init( self );
+
+	return self;
+}
+	
+void _Plugin_Init( Plugin* self ) {
+	Stream* debug = Journal_Register( Debug_Type, self->type );
+
+	if( self->dllPtr != NULL ) {
+		self->Register = (Plugin_RegisterFunction*)Module_LoadSymbol( self, PLUGIN_REGISTER_SUFFIX );
+		
+		/* If the register function is not found, then unload the module... it's not a plugin. */
+		if( self->Register == NULL ) {
+			Journal_Printf( debug, "Plugin %s is not a plugin, unloading.\n", self->name );
+			Module_UnLoad( self );
+		}
+	}
+}
+	
+void _Plugin_Delete( void* plugin ) {
+	Plugin* self = (Plugin*)plugin;
+
+	/* Delete parent */
+	_Module_Delete( self );
+}
+	
+void _Plugin_Print( void* plugin, Stream* stream ) {
+	Plugin* self = (Plugin*)plugin;
+
+	Journal_Printf( stream, "Plugin: %s\n", self->name );
+	Stream_Indent( stream );
+	
+	/* Print parent */
+	_Module_Print( self, stream );
+	
+	Stream_UnIndent( stream );
+}
+
+char* _Plugin_MangleName( Name name ) {
+	char* mangledName = Memory_Alloc_Array( char, strlen( name ) + 1, PLUGIN_MANGLEDNAME );
+	sprintf( mangledName, "%s", name );
+	return mangledName;
+}
+
+
+Plugin_RegisterFunction* Plugin_GetRegisterFunc( void* plugin ) {
+	Plugin* self = (Plugin*)plugin;
+
+	return self->Register;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/PluginsManager.c
--- a/Base/Extensibility/src/PluginsManager.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: PluginsManager.c 4163 2007-08-02 08:32:40Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <string.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Module.h"
-#include "Plugin.h"
-#include "ModulesManager.h"
-#include "PluginsManager.h"
-
-
-/* Textual name of this class */
-const Type PluginsManager_Type = "PluginsManager";
-
-
-PluginsManager* PluginsManager_New( void ) {
-	/* Variables set in this function */
-	SizeT                                       _sizeOfSelf = sizeof(PluginsManager);
-	Type                                               type = PluginsManager_Type;
-	Stg_Class_DeleteFunction*                       _delete = _PluginsManager_Delete;
-	Stg_Class_PrintFunction*                         _print = _PluginsManager_Print;
-	Stg_Class_CopyFunction*                           _copy = NULL;
-	ModulesManager_GetModulesListFunction*  _getModulesList = _PluginsManager_GetPluginsList;
-	ModulesManager_LoadModuleFunction*          _loadModule = _PluginsManager_LoadPlugin;
-	ModulesManager_UnloadModuleFunction*      _unloadModule = _PluginsManager_UnloadPlugin;
-	ModulesManager_ModuleFactoryFunction*    _moduleFactory = Plugin_Factory;
-	ModulesManager_CheckContextFunction*      _checkContext = _PluginsManager_CheckContext;
-	ModulesManager_GetModuleNameFunction*    _getModuleName = _PluginsManager_GetModuleName;
-
-	return _PluginsManager_New(  PLUGINSMANAGER_PASSARGS  );
-}
-
-PluginsManager* _PluginsManager_New(  PLUGINSMANAGER_DEFARGS  )
-{
-	PluginsManager* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(PluginsManager) );
-	self = (PluginsManager*)_ModulesManager_New(  MODULESMANAGER_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	_PluginsManager_Init( self );
-	
-	return self;
-}
-
-void _PluginsManager_Init( void* pluginsManager ) {
-}
-
-
-void _PluginsManager_Delete( void* pluginsManager ) {
-	PluginsManager*         self = (PluginsManager*)pluginsManager;
-
-	/* Delete parent */
-	_ModulesManager_Delete( self );
-}
-
-void _PluginsManager_Print( void* pluginsManager, Stream* stream ) {
-	PluginsManager* self = (PluginsManager*)pluginsManager;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Plugins (ptr): %p\n", self );
-	
-	/* Print parent */
-	_ModulesManager_Print( self, stream );
-}
-
-
-Dictionary_Entry_Value* _PluginsManager_GetPluginsList( void* pluginsManager, void* _dictionary ) {
-	/*PluginsManager*			self = (PluginsManager*)pluginsManager;*/
-	Dictionary*			dictionary = (Dictionary*)_dictionary;
-	Dictionary_Entry_Value*		pluginsList = NULL;
-	
-	pluginsList = Dictionary_Get( dictionary, "plugins" );
-
-	return pluginsList;
-}
-
-Bool _PluginsManager_LoadPlugin( void* pluginsManager, Module* plugin ) {
-	PluginsManager* self = (PluginsManager*)pluginsManager;
-	
-	((Plugin*)plugin)->Register( self );
-    
-	return True;
-}
-
-Bool PluginsManager_UnloadAll( void* pluginsManager ) {
-	PluginsManager* self = (PluginsManager*)pluginsManager;
-   Module* module = NULL;
-
-   while( self->modules->count ) {
-      module = (Module*)Stg_ObjectList_At( self->modules, self->modules->count - 1 ); /* reverse order deletion */
-      _PluginsManager_UnloadPlugin( self, module );
-   }
-
-   return True;
-}
-Bool _PluginsManager_UnloadPlugin( void* pluginsManager, Module* plugin ) {
-	PluginsManager* self = (PluginsManager*)pluginsManager;
-
-   Module_UnLoad( plugin );
-   self->modules->count--;
-
-	return True;
-}
-
-void PluginsManager_RemoveAllFromComponentRegister( void* pluginsManager ) {
-	PluginsManager*			self = (PluginsManager*)pluginsManager;
-   Stg_ComponentRegister*	componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-   Index							i;
-
-   for (i=0; i<Stg_ObjectList_Count(self->codelets); i++) {
-      Stg_Object *codelet = self->codelets->data[i];
-      Stg_ComponentRegister_RemoveEntry(componentRegister, codelet->type, "0");
-   }
-}
-
-Bool _PluginsManager_CheckContext( void* pluginsManager, Dictionary_Entry_Value* modulesVal, unsigned int entry_I, Name contextName ) {
-	PluginsManager*			self;
-	Dictionary_Entry_Value*	pluginDEV = Dictionary_Entry_Value_GetElement( modulesVal, entry_I );
-	Dictionary*					pluginDict;
-	Name							componentName;
-
-	self = (PluginsManager*)pluginsManager;
-
-	pluginDict = Dictionary_Entry_Value_AsDictionary( pluginDEV );
-	if( !pluginDict )
-		return False;
-
-	componentName = Dictionary_GetString_WithDefault( pluginDict, "Context", "context" );
-
-	if( !strcmp( componentName, contextName ) )
-		return True;
-
-	return False;
-}
-
-Name _PluginsManager_GetModuleName( void* pluginsManager, Dictionary_Entry_Value* moduleVal, unsigned int entry_I ) {
-	PluginsManager*			self;
-	Dictionary_Entry_Value*	pluginDEV = Dictionary_Entry_Value_GetElement( moduleVal, entry_I );
-	Dictionary*					pluginDict = Dictionary_Entry_Value_AsDictionary( pluginDEV );
-	Name							pluginName = Dictionary_GetString( pluginDict, "Type" );
-
-	self = (PluginsManager*)pluginsManager;
-
-	return pluginName;	
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/PluginsManager.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/PluginsManager.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,188 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: PluginsManager.c 4163 2007-08-02 08:32:40Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <string.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Module.h"
+#include "Plugin.h"
+#include "ModulesManager.h"
+#include "PluginsManager.h"
+
+
+/* Textual name of this class */
+const Type PluginsManager_Type = "PluginsManager";
+
+
+PluginsManager* PluginsManager_New( void ) {
+	/* Variables set in this function */
+	SizeT                                       _sizeOfSelf = sizeof(PluginsManager);
+	Type                                               type = PluginsManager_Type;
+	Stg_Class_DeleteFunction*                       _delete = _PluginsManager_Delete;
+	Stg_Class_PrintFunction*                         _print = _PluginsManager_Print;
+	Stg_Class_CopyFunction*                           _copy = NULL;
+	ModulesManager_GetModulesListFunction*  _getModulesList = _PluginsManager_GetPluginsList;
+	ModulesManager_LoadModuleFunction*          _loadModule = _PluginsManager_LoadPlugin;
+	ModulesManager_UnloadModuleFunction*      _unloadModule = _PluginsManager_UnloadPlugin;
+	ModulesManager_ModuleFactoryFunction*    _moduleFactory = Plugin_Factory;
+	ModulesManager_CheckContextFunction*      _checkContext = _PluginsManager_CheckContext;
+	ModulesManager_GetModuleNameFunction*    _getModuleName = _PluginsManager_GetModuleName;
+
+	return _PluginsManager_New(  PLUGINSMANAGER_PASSARGS  );
+}
+
+PluginsManager* _PluginsManager_New(  PLUGINSMANAGER_DEFARGS  )
+{
+	PluginsManager* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(PluginsManager) );
+	self = (PluginsManager*)_ModulesManager_New(  MODULESMANAGER_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	_PluginsManager_Init( self );
+	
+	return self;
+}
+
+void _PluginsManager_Init( void* pluginsManager ) {
+}
+
+
+void _PluginsManager_Delete( void* pluginsManager ) {
+	PluginsManager*         self = (PluginsManager*)pluginsManager;
+
+	/* Delete parent */
+	_ModulesManager_Delete( self );
+}
+
+void _PluginsManager_Print( void* pluginsManager, Stream* stream ) {
+	PluginsManager* self = (PluginsManager*)pluginsManager;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Plugins (ptr): %p\n", self );
+	
+	/* Print parent */
+	_ModulesManager_Print( self, stream );
+}
+
+
+Dictionary_Entry_Value* _PluginsManager_GetPluginsList( void* pluginsManager, void* _dictionary ) {
+	/*PluginsManager*			self = (PluginsManager*)pluginsManager;*/
+	Dictionary*			dictionary = (Dictionary*)_dictionary;
+	Dictionary_Entry_Value*		pluginsList = NULL;
+	
+	pluginsList = Dictionary_Get( dictionary, "plugins" );
+
+	return pluginsList;
+}
+
+Bool _PluginsManager_LoadPlugin( void* pluginsManager, Module* plugin ) {
+	PluginsManager* self = (PluginsManager*)pluginsManager;
+	
+	((Plugin*)plugin)->Register( self );
+    
+	return True;
+}
+
+Bool PluginsManager_UnloadAll( void* pluginsManager ) {
+	PluginsManager* self = (PluginsManager*)pluginsManager;
+   Module* module = NULL;
+
+   while( self->modules->count ) {
+      module = (Module*)Stg_ObjectList_At( self->modules, self->modules->count - 1 ); /* reverse order deletion */
+      _PluginsManager_UnloadPlugin( self, module );
+   }
+
+   return True;
+}
+Bool _PluginsManager_UnloadPlugin( void* pluginsManager, Module* plugin ) {
+	PluginsManager* self = (PluginsManager*)pluginsManager;
+
+   Module_UnLoad( plugin );
+   self->modules->count--;
+
+	return True;
+}
+
+void PluginsManager_RemoveAllFromComponentRegister( void* pluginsManager ) {
+	PluginsManager*			self = (PluginsManager*)pluginsManager;
+   Stg_ComponentRegister*	componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+   Index							i;
+
+   for (i=0; i<Stg_ObjectList_Count(self->codelets); i++) {
+      Stg_Object *codelet = self->codelets->data[i];
+      Stg_ComponentRegister_RemoveEntry(componentRegister, codelet->type, "0");
+   }
+}
+
+Bool _PluginsManager_CheckContext( void* pluginsManager, Dictionary_Entry_Value* modulesVal, unsigned int entry_I, Name contextName ) {
+	PluginsManager*			self;
+	Dictionary_Entry_Value*	pluginDEV = Dictionary_Entry_Value_GetElement( modulesVal, entry_I );
+	Dictionary*					pluginDict;
+	Name							componentName;
+
+	self = (PluginsManager*)pluginsManager;
+
+	pluginDict = Dictionary_Entry_Value_AsDictionary( pluginDEV );
+	if( !pluginDict )
+		return False;
+
+	componentName = Dictionary_GetString_WithDefault( pluginDict, "Context", "context" );
+
+	if( !strcmp( componentName, contextName ) )
+		return True;
+
+	return False;
+}
+
+Name _PluginsManager_GetModuleName( void* pluginsManager, Dictionary_Entry_Value* moduleVal, unsigned int entry_I ) {
+	PluginsManager*			self;
+	Dictionary_Entry_Value*	pluginDEV = Dictionary_Entry_Value_GetElement( moduleVal, entry_I );
+	Dictionary*					pluginDict = Dictionary_Entry_Value_AsDictionary( pluginDEV );
+	Name							pluginName = Dictionary_GetString( pluginDict, "Type" );
+
+	self = (PluginsManager*)pluginsManager;
+
+	return pluginName;	
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/SimpleExtensionInfo.c
--- a/Base/Extensibility/src/SimpleExtensionInfo.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: SimpleExtensionInfo.c 2915 2005-05-08 12:51:46Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "ExtensionManager.h"
-#include "ExtensionInfo.h"
-#include "SimpleExtensionInfo.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-/* Textual name of this class */
-const Type SimpleExtensionInfo_Type = "SimpleExtensionInfo";
-
-
-/** allocate and initialise a new SimpleExtensionInfo. */
-SimpleExtensionInfo* SimpleExtensionInfo_New( Name name, SizeT size, Index count ) {
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(SimpleExtensionInfo);
-	Type                                    type = SimpleExtensionInfo_Type;
-	Stg_Class_DeleteFunction*            _delete = _SimpleExtensionInfo_Delete;
-	Stg_Class_PrintFunction*              _print = _SimpleExtensionInfo_Print;
-	Stg_Class_CopyFunction*                _copy = _SimpleExtensionInfo_Copy;
-	ExtensionInfo_DataCopyFunction*    _dataCopy = _SimpleExtensionInfo_DataCopy;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _SimpleExtensionInfo_New(  SIMPLEEXTENSIONINFO_PASSARGS  );
-}
-
-
-void SimpleExtensionInfo_Init( void* simpleExtensionInfo, Name name, SizeT size, Index count ) {
-	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
-
-	/* General info */
-	self->type = SimpleExtensionInfo_Type;
-	self->_sizeOfSelf = sizeof(SimpleExtensionInfo);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _SimpleExtensionInfo_Delete;
-	self->_print = _SimpleExtensionInfo_Print;
-	self->_copy = _SimpleExtensionInfo_Copy;
-	self->_dataCopy = _SimpleExtensionInfo_DataCopy;
-	
-	/* SimpleExtensionInfo info */
-	_SimpleExtensionInfo_Init( self, (Name)name, size, count );
-}
-
-
-SimpleExtensionInfo* _SimpleExtensionInfo_New(  SIMPLEEXTENSIONINFO_DEFARGS  )
-{
-	SimpleExtensionInfo* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(SimpleExtensionInfo) );
-	self = (SimpleExtensionInfo*)_ExtensionInfo_New(  EXTENSIONINFO_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	/* SimpleExtensionInfo info */
-	_SimpleExtensionInfo_Init( self, name, size, count );
-	
-	return self;
-}
-
-
-void _SimpleExtensionInfo_Init( SimpleExtensionInfo* self, Name name, SizeT size, Index count ) {
-	/* General and Virtual info should already be set */
-	/* SimpleExtensionInfo info */
-	_ExtensionInfo_Init( (ExtensionInfo*)self, name, size, count );
-}
-
-
-void _SimpleExtensionInfo_Delete( void* simpleExtensionInfo ) {
-	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
-
-	Journal_DFirewall( 
-		self != NULL,  
-		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-		"Attempting to \"%s\" delete a pointer of value NULL\n", SimpleExtensionInfo_Type );
-	
-	/* Purposely do nothing... the extension is assumed to be static (non-pointer) data */
-	
-	/* Delete parent */
-	_ExtensionInfo_Delete( self );
-}
-
-
-void _SimpleExtensionInfo_Print( void* simpleExtensionInfo, Stream* stream ) {
-	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
-		
-	Journal_Firewall( 
-		self != NULL,  
-		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
-		"Attempting to \"%s\" print a pointer of value NULL\n", SimpleExtensionInfo_Type );
-	
-	/* General info */
-	Journal_Printf( (void*)stream, "SimpleExtensionInfo (%p):\n", self );
-	_ExtensionInfo_Print( self, stream );
-	Journal_Printf( (void*)stream, "\tNo print function implemented/assigned for this extension\n" );
-}
-
-
-void* _SimpleExtensionInfo_Copy( const void* simpleExtensionInfo, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap  ) {
-	SimpleExtensionInfo*	self = (SimpleExtensionInfo*)simpleExtensionInfo;
-	SimpleExtensionInfo*	newSimpleExtensionInfo;
-		
-	Journal_Firewall( 
-		self != NULL,  
-		Journal_Register( ErrorStream_Type, SimpleExtensionInfo_Type ), 
-		"Attempting to \"%s\" copy a pointer of value NULL\n", SimpleExtensionInfo_Type );
-	
-	/* Copy parent */
-	newSimpleExtensionInfo = (SimpleExtensionInfo*)_ExtensionInfo_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	return newSimpleExtensionInfo;
-}
-
-void* _SimpleExtensionInfo_DataCopy( 
-	void* simpleExtensionInfo, 
-	void* source,
-	void* dest, 
-	Bool deep, 
-	Name nameExt, 
-	PtrMap* ptrMap )
-{
-	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
-	
-	memcpy( dest, source, self->size );
-
-	return dest;
-}
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/SimpleExtensionInfo.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/SimpleExtensionInfo.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,181 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: SimpleExtensionInfo.c 2915 2005-05-08 12:51:46Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "ExtensionManager.h"
+#include "ExtensionInfo.h"
+#include "SimpleExtensionInfo.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+/* Textual name of this class */
+const Type SimpleExtensionInfo_Type = "SimpleExtensionInfo";
+
+
+/** allocate and initialise a new SimpleExtensionInfo. */
+SimpleExtensionInfo* SimpleExtensionInfo_New( Name name, SizeT size, Index count ) {
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(SimpleExtensionInfo);
+	Type                                    type = SimpleExtensionInfo_Type;
+	Stg_Class_DeleteFunction*            _delete = _SimpleExtensionInfo_Delete;
+	Stg_Class_PrintFunction*              _print = _SimpleExtensionInfo_Print;
+	Stg_Class_CopyFunction*                _copy = _SimpleExtensionInfo_Copy;
+	ExtensionInfo_DataCopyFunction*    _dataCopy = _SimpleExtensionInfo_DataCopy;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _SimpleExtensionInfo_New(  SIMPLEEXTENSIONINFO_PASSARGS  );
+}
+
+
+void SimpleExtensionInfo_Init( void* simpleExtensionInfo, Name name, SizeT size, Index count ) {
+	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
+
+	/* General info */
+	self->type = SimpleExtensionInfo_Type;
+	self->_sizeOfSelf = sizeof(SimpleExtensionInfo);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _SimpleExtensionInfo_Delete;
+	self->_print = _SimpleExtensionInfo_Print;
+	self->_copy = _SimpleExtensionInfo_Copy;
+	self->_dataCopy = _SimpleExtensionInfo_DataCopy;
+	
+	/* SimpleExtensionInfo info */
+	_SimpleExtensionInfo_Init( self, (Name)name, size, count );
+}
+
+
+SimpleExtensionInfo* _SimpleExtensionInfo_New(  SIMPLEEXTENSIONINFO_DEFARGS  )
+{
+	SimpleExtensionInfo* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(SimpleExtensionInfo) );
+	self = (SimpleExtensionInfo*)_ExtensionInfo_New(  EXTENSIONINFO_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	/* SimpleExtensionInfo info */
+	_SimpleExtensionInfo_Init( self, name, size, count );
+	
+	return self;
+}
+
+
+void _SimpleExtensionInfo_Init( SimpleExtensionInfo* self, Name name, SizeT size, Index count ) {
+	/* General and Virtual info should already be set */
+	/* SimpleExtensionInfo info */
+	_ExtensionInfo_Init( (ExtensionInfo*)self, name, size, count );
+}
+
+
+void _SimpleExtensionInfo_Delete( void* simpleExtensionInfo ) {
+	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
+
+	Journal_DFirewall( 
+		self != NULL,  
+		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+		"Attempting to \"%s\" delete a pointer of value NULL\n", SimpleExtensionInfo_Type );
+	
+	/* Purposely do nothing... the extension is assumed to be static (non-pointer) data */
+	
+	/* Delete parent */
+	_ExtensionInfo_Delete( self );
+}
+
+
+void _SimpleExtensionInfo_Print( void* simpleExtensionInfo, Stream* stream ) {
+	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
+		
+	Journal_Firewall( 
+		self != NULL,  
+		Journal_Register( ErrorStream_Type, ExtensionInfo_Type ), 
+		"Attempting to \"%s\" print a pointer of value NULL\n", SimpleExtensionInfo_Type );
+	
+	/* General info */
+	Journal_Printf( (void*)stream, "SimpleExtensionInfo (%p):\n", self );
+	_ExtensionInfo_Print( self, stream );
+	Journal_Printf( (void*)stream, "\tNo print function implemented/assigned for this extension\n" );
+}
+
+
+void* _SimpleExtensionInfo_Copy( const void* simpleExtensionInfo, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap  ) {
+	SimpleExtensionInfo*	self = (SimpleExtensionInfo*)simpleExtensionInfo;
+	SimpleExtensionInfo*	newSimpleExtensionInfo;
+		
+	Journal_Firewall( 
+		self != NULL,  
+		Journal_Register( ErrorStream_Type, SimpleExtensionInfo_Type ), 
+		"Attempting to \"%s\" copy a pointer of value NULL\n", SimpleExtensionInfo_Type );
+	
+	/* Copy parent */
+	newSimpleExtensionInfo = (SimpleExtensionInfo*)_ExtensionInfo_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	return newSimpleExtensionInfo;
+}
+
+void* _SimpleExtensionInfo_DataCopy( 
+	void* simpleExtensionInfo, 
+	void* source,
+	void* dest, 
+	Bool deep, 
+	Name nameExt, 
+	PtrMap* ptrMap )
+{
+	SimpleExtensionInfo* self = (SimpleExtensionInfo*)simpleExtensionInfo;
+	
+	memcpy( dest, source, self->size );
+
+	return dest;
+}
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Toolbox.c
--- a/Base/Extensibility/src/Toolbox.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-*/
-/** \file
-**  Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: Toolbox.c 3192 2005-08-25 01:45:42Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Module.h"
-#include "Toolbox.h"
-
-#include <string.h>
-
-const Type Toolbox_Type = "Toolbox";
-
-static Name TOOLBOX_REGISTER_SUFFIX = "_Register";
-static Name TOOLBOX_INITIALISE_SUFFIX = "_Initialise";
-static Name TOOLBOX_FINALISE_SUFFIX = "_Finalise";
-static Name TOOLBOX_MODULE_SUFFIX = "_Toolbox";
-#ifdef MEMORY_STATS
-	static Name TOOLBOX_MANGLEDNAME = "mangledName";
-#endif
-
-Toolbox* Toolbox_New( Name name, Stg_ObjectList* directories ) {
-	/* Variables set in this function */
-	SizeT                       _sizeOfSelf = sizeof(Toolbox);
-	Type                               type = Toolbox_Type;
-	Stg_Class_DeleteFunction*       _delete = _Toolbox_Delete;
-	Stg_Class_PrintFunction*         _print = _Toolbox_Print;
-	Stg_Class_CopyFunction*           _copy = NULL;
-	Module_MangleNameFunction*   MangleName = _Toolbox_MangleName;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Toolbox_New(  TOOLBOX_PASSARGS  );
-}
-
-Module* Toolbox_Factory( Name name, Stg_ObjectList* directories ) {
-	return (Module*)Toolbox_New( name, directories );
-}
-	
-Toolbox* _Toolbox_New(  TOOLBOX_DEFARGS  )
-{
-	Toolbox* self;
-
-	assert( _sizeOfSelf >= sizeof(Toolbox) );
-
-	self = (Toolbox*)_Module_New(  MODULE_PASSARGS  );
-	
-	_Toolbox_Init( self );
-
-	return self;
-}
-	
-void _Toolbox_Init( Toolbox* self ) {
-	Stream* stream = Journal_Register( Info_Type, self->type );
-
-	if( self->dllPtr != NULL ) {
-		self->Register = (Toolbox_RegisterFunction*)Module_LoadSymbol( self, TOOLBOX_REGISTER_SUFFIX );
-		self->Initialise = (Toolbox_InitialiseFunction*)Module_LoadSymbol( self, TOOLBOX_INITIALISE_SUFFIX );
-		self->Finalise = (Toolbox_FinaliseFunction*)Module_LoadSymbol( self, TOOLBOX_FINALISE_SUFFIX );
-	}
-	/* If the register function is not found, then unload the module... it's not a toolbox. */
-	if( self->Register == NULL || self->Initialise == NULL || self->Finalise == NULL ) {
-		Journal_Printf( stream, "Toolbox %s is not a toolbox, unloading.\n", self->name );
-		Module_UnLoad( self );
-	}
-}
-	
-void _Toolbox_Delete( void* toolbox ) {
-	Toolbox* self = (Toolbox*)toolbox;
-
-	/* Delete parent */
-/* This is a hack. It would seem that PETSc gives MPI/MPICH something along the lines of a pointer to a symbol in the PETSc library,
-   when StgFEM's toolbox is loaded (which links to PETSc and init and finalises it), a seg fault occours on MPI's finalise because 
-   the PETSc symbols are gone. The following line will cause dlclose not to be called, but is ok otherwise for the the toolboxes
-   deletion */
-self->dllPtr = 0;
-	_Module_Delete( self );
-}
-	
-void _Toolbox_Print( void* toolbox, Stream* stream ) {
-	Toolbox* self = (Toolbox*)toolbox;
-
-	Journal_Printf( stream, "Toolbox: %s\n", self->name );
-	Stream_Indent( stream );
-	
-	/* Print parent */
-	_Module_Print( self, stream );
-	
-	Stream_UnIndent( stream );
-}
-
-char* _Toolbox_MangleName( Name name ) {
-	char* mangledName = Memory_Alloc_Array( char, strlen( name ) + strlen( TOOLBOX_MODULE_SUFFIX ) + 1, TOOLBOX_MANGLEDNAME );
-	sprintf( mangledName, "%s%s", name, TOOLBOX_MODULE_SUFFIX );
-	return mangledName;
-}
-
-
-Toolbox_RegisterFunction* Toolbox_GetRegisterFunc( void* toolbox ) {
-	Toolbox* self = (Toolbox*)toolbox;
-
-	return self->Register;
-}
-
-Toolbox_InitialiseFunction* Toolbox_GetInitialiseFunc( void* toolbox ) {
-	Toolbox* self = (Toolbox*)toolbox;
-
-	return self->Initialise;
-}
-
-Toolbox_FinaliseFunction* Toolbox_GetFinaliseFunc( void* toolbox ) {
-	Toolbox* self = (Toolbox*)toolbox;
-
-	return self->Finalise;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/Toolbox.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/Toolbox.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,158 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Toolbox.c 3192 2005-08-25 01:45:42Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Module.h"
+#include "Toolbox.h"
+
+#include <string.h>
+
+const Type Toolbox_Type = "Toolbox";
+
+static Name TOOLBOX_REGISTER_SUFFIX = "_Register";
+static Name TOOLBOX_INITIALISE_SUFFIX = "_Initialise";
+static Name TOOLBOX_FINALISE_SUFFIX = "_Finalise";
+static Name TOOLBOX_MODULE_SUFFIX = "_Toolbox";
+#ifdef MEMORY_STATS
+	static Name TOOLBOX_MANGLEDNAME = "mangledName";
+#endif
+
+Toolbox* Toolbox_New( Name name, Stg_ObjectList* directories ) {
+	/* Variables set in this function */
+	SizeT                       _sizeOfSelf = sizeof(Toolbox);
+	Type                               type = Toolbox_Type;
+	Stg_Class_DeleteFunction*       _delete = _Toolbox_Delete;
+	Stg_Class_PrintFunction*         _print = _Toolbox_Print;
+	Stg_Class_CopyFunction*           _copy = NULL;
+	Module_MangleNameFunction*   MangleName = _Toolbox_MangleName;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Toolbox_New(  TOOLBOX_PASSARGS  );
+}
+
+Module* Toolbox_Factory( Name name, Stg_ObjectList* directories ) {
+	return (Module*)Toolbox_New( name, directories );
+}
+	
+Toolbox* _Toolbox_New(  TOOLBOX_DEFARGS  )
+{
+	Toolbox* self;
+
+	assert( _sizeOfSelf >= sizeof(Toolbox) );
+
+	self = (Toolbox*)_Module_New(  MODULE_PASSARGS  );
+	
+	_Toolbox_Init( self );
+
+	return self;
+}
+	
+void _Toolbox_Init( Toolbox* self ) {
+	Stream* stream = Journal_Register( Info_Type, self->type );
+
+	if( self->dllPtr != NULL ) {
+		self->Register = (Toolbox_RegisterFunction*)Module_LoadSymbol( self, TOOLBOX_REGISTER_SUFFIX );
+		self->Initialise = (Toolbox_InitialiseFunction*)Module_LoadSymbol( self, TOOLBOX_INITIALISE_SUFFIX );
+		self->Finalise = (Toolbox_FinaliseFunction*)Module_LoadSymbol( self, TOOLBOX_FINALISE_SUFFIX );
+	}
+	/* If the register function is not found, then unload the module... it's not a toolbox. */
+	if( self->Register == NULL || self->Initialise == NULL || self->Finalise == NULL ) {
+		Journal_Printf( stream, "Toolbox %s is not a toolbox, unloading.\n", self->name );
+		Module_UnLoad( self );
+	}
+}
+	
+void _Toolbox_Delete( void* toolbox ) {
+	Toolbox* self = (Toolbox*)toolbox;
+
+	/* Delete parent */
+/* This is a hack. It would seem that PETSc gives MPI/MPICH something along the lines of a pointer to a symbol in the PETSc library,
+   when StgFEM's toolbox is loaded (which links to PETSc and init and finalises it), a seg fault occours on MPI's finalise because 
+   the PETSc symbols are gone. The following line will cause dlclose not to be called, but is ok otherwise for the the toolboxes
+   deletion */
+self->dllPtr = 0;
+	_Module_Delete( self );
+}
+	
+void _Toolbox_Print( void* toolbox, Stream* stream ) {
+	Toolbox* self = (Toolbox*)toolbox;
+
+	Journal_Printf( stream, "Toolbox: %s\n", self->name );
+	Stream_Indent( stream );
+	
+	/* Print parent */
+	_Module_Print( self, stream );
+	
+	Stream_UnIndent( stream );
+}
+
+char* _Toolbox_MangleName( Name name ) {
+	char* mangledName = Memory_Alloc_Array( char, strlen( name ) + strlen( TOOLBOX_MODULE_SUFFIX ) + 1, TOOLBOX_MANGLEDNAME );
+	sprintf( mangledName, "%s%s", name, TOOLBOX_MODULE_SUFFIX );
+	return mangledName;
+}
+
+
+Toolbox_RegisterFunction* Toolbox_GetRegisterFunc( void* toolbox ) {
+	Toolbox* self = (Toolbox*)toolbox;
+
+	return self->Register;
+}
+
+Toolbox_InitialiseFunction* Toolbox_GetInitialiseFunc( void* toolbox ) {
+	Toolbox* self = (Toolbox*)toolbox;
+
+	return self->Initialise;
+}
+
+Toolbox_FinaliseFunction* Toolbox_GetFinaliseFunc( void* toolbox ) {
+	Toolbox* self = (Toolbox*)toolbox;
+
+	return self->Finalise;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ToolboxesManager.c
--- a/Base/Extensibility/src/ToolboxesManager.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ToolboxesManager.c 4081 2007-04-27 06:20:07Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Module.h"
-#include "Toolbox.h"
-#include "ModulesManager.h"
-#include "ToolboxesManager.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type ToolboxesManager_Type = "ToolboxesManager";
-
-
-ToolboxesManager* ToolboxesManager_New( int* argc, char*** argv ) {
-	/* Variables set in this function */
-	SizeT                                       _sizeOfSelf = sizeof(ToolboxesManager);
-	Type                                               type = ToolboxesManager_Type;
-	Stg_Class_DeleteFunction*                       _delete = _ToolboxesManager_Delete;
-	Stg_Class_PrintFunction*                         _print = _ToolboxesManager_Print;
-	Stg_Class_CopyFunction*                           _copy = NULL;
-	ModulesManager_GetModulesListFunction*  _getModulesList = _ToolboxesManager_GetToolboxesList;
-	ModulesManager_LoadModuleFunction*          _loadModule = _ToolboxesManager_LoadToolbox;
-	ModulesManager_UnloadModuleFunction*      _unloadModule = _ToolboxesManager_UnloadToolbox;
-	ModulesManager_ModuleFactoryFunction*    _moduleFactory = Toolbox_Factory;
-	ModulesManager_CheckContextFunction*      _checkContext = _ToolboxesManager_CheckContext;
-	ModulesManager_GetModuleNameFunction*    _getModuleName = _ToolboxesManager_GetModuleName;
-
-	return _ToolboxesManager_New(  TOOLBOXESMANAGER_PASSARGS  );
-}
-
-ToolboxesManager* _ToolboxesManager_New(  TOOLBOXESMANAGER_DEFARGS  )
-{
-	ToolboxesManager* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(ToolboxesManager) );
-	self = (ToolboxesManager*)_ModulesManager_New(  MODULESMANAGER_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	
-	_ToolboxesManager_Init( self, argc, argv );
-	
-	return self;
-}
-
-void _ToolboxesManager_Init( void* toolboxesManager, int* argc, char*** argv ) {
-	ToolboxesManager*         self = (ToolboxesManager*)toolboxesManager;
-	
-   self->initTB = Stg_ObjectList_New();
-	self->argc = argc;
-	self->argv = argv;
-}
-
-
-void _ToolboxesManager_Delete( void* toolboxesManager ) {
-   ToolboxesManager*         self = (ToolboxesManager*)toolboxesManager;
-
-	Stg_ObjectList_DeleteAllObjects( self->codelets );
-	Stg_Class_Delete( self->codelets );
-	ModulesManager_Unload( self );  /* this will unload all toolboxes implicitly */
-	Stg_Class_Delete( self->modules );
-	
-	/* Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-void _ToolboxesManager_Print( void* toolboxesManager, Stream* stream ) {
-	ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;
-	
-	/* General info */
-	Journal_Printf( (void*) stream, "Toolboxes (ptr): %p\n", self );
-	
-	if( Stg_ObjectList_Count(self->initTB) > 0 ) {
-		Index i;
-		
-		Journal_Printf( stream, "Initialised Modules:\n" );
-		Stream_Indent( stream );
-		for( i = 0; i < Stg_ObjectList_Count(self->initTB) ; ++i ) {
-			Journal_Printf( stream, "%s\n", self->initTB->data[i]->name );
-		}
-		Stream_UnIndent( stream );
-	}
-	
-	/* Print parent */
-	_ModulesManager_Print( self, stream );
-}
-
-
-Dictionary_Entry_Value* _ToolboxesManager_GetToolboxesList( void* toolboxesManager, void* _dictionary ) {
-	/*ToolboxesManager*		self = (ToolboxesManager*)toolboxesManager;*/
-	Dictionary*			dictionary = (Dictionary*)_dictionary;
-	Dictionary_Entry_Value*		pluginsList = NULL;
-	
-	pluginsList = Dictionary_Get( dictionary, "import" );
-
-	return pluginsList;
-}
-
-Bool _ToolboxesManager_LoadToolbox( void* toolboxesManager, Module* toolbox ) {
-	ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;
-	
-   /* if not Loaded call the Initialise() and Register() */
-   if( !Stg_ObjectList_Get( self->initTB, toolbox->name ) ) {
-
-      ((Toolbox*)toolbox)->Initialise( self, self->argc, self->argv );
-      ((Toolbox*)toolbox)->Register( self );
-
-      Stg_ObjectList_Append( self->initTB, toolbox );
-   }
-	return True;
-}
-
-Bool _ToolboxesManager_UnloadToolbox( void* toolboxesManager, Module* toolbox ) {
-	ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;
-	
-   if( Stg_ObjectList_Get( self->initTB, toolbox->name ) ) {
-      ((Toolbox*)toolbox)->Finalise( self );
-
-      /* remove the toolbox from the initTB list, but don't actually Delete it's memory */
-      Stg_ObjectList_Remove( self->initTB, toolbox->name, KEEP );
-   }
-    
-	return True;
-}
-
-/* toolboxes do not need to be associated with contexts, so just return true */
-Bool _ToolboxesManager_CheckContext( void* toolboxesManager, Dictionary_Entry_Value* modulesVal, unsigned int entry_I, Name contextName ) {
-	return True;
-}
-
-Name _ToolboxesManager_GetModuleName( void* toolboxesManager, Dictionary_Entry_Value* moduleVal, unsigned int entry_I ) {
-	return Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( moduleVal, entry_I ) );
-}
-
-Bool ToolboxesManager_IsInitialised( void* initRegister, Name label ) {
-	ToolboxesManager* self = (ToolboxesManager*)initRegister;
-
-   if( Stg_ObjectList_Get( self->initTB, label ) )
-      return True;
-   else
-      return False;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/src/ToolboxesManager.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/src/ToolboxesManager.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,184 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ToolboxesManager.c 4081 2007-04-27 06:20:07Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Module.h"
+#include "Toolbox.h"
+#include "ModulesManager.h"
+#include "ToolboxesManager.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type ToolboxesManager_Type = "ToolboxesManager";
+
+
+ToolboxesManager* ToolboxesManager_New( int* argc, char*** argv ) {
+	/* Variables set in this function */
+	SizeT                                       _sizeOfSelf = sizeof(ToolboxesManager);
+	Type                                               type = ToolboxesManager_Type;
+	Stg_Class_DeleteFunction*                       _delete = _ToolboxesManager_Delete;
+	Stg_Class_PrintFunction*                         _print = _ToolboxesManager_Print;
+	Stg_Class_CopyFunction*                           _copy = NULL;
+	ModulesManager_GetModulesListFunction*  _getModulesList = _ToolboxesManager_GetToolboxesList;
+	ModulesManager_LoadModuleFunction*          _loadModule = _ToolboxesManager_LoadToolbox;
+	ModulesManager_UnloadModuleFunction*      _unloadModule = _ToolboxesManager_UnloadToolbox;
+	ModulesManager_ModuleFactoryFunction*    _moduleFactory = Toolbox_Factory;
+	ModulesManager_CheckContextFunction*      _checkContext = _ToolboxesManager_CheckContext;
+	ModulesManager_GetModuleNameFunction*    _getModuleName = _ToolboxesManager_GetModuleName;
+
+	return _ToolboxesManager_New(  TOOLBOXESMANAGER_PASSARGS  );
+}
+
+ToolboxesManager* _ToolboxesManager_New(  TOOLBOXESMANAGER_DEFARGS  )
+{
+	ToolboxesManager* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(ToolboxesManager) );
+	self = (ToolboxesManager*)_ModulesManager_New(  MODULESMANAGER_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	
+	_ToolboxesManager_Init( self, argc, argv );
+	
+	return self;
+}
+
+void _ToolboxesManager_Init( void* toolboxesManager, int* argc, char*** argv ) {
+	ToolboxesManager*         self = (ToolboxesManager*)toolboxesManager;
+	
+   self->initTB = Stg_ObjectList_New();
+	self->argc = argc;
+	self->argv = argv;
+}
+
+
+void _ToolboxesManager_Delete( void* toolboxesManager ) {
+   ToolboxesManager*         self = (ToolboxesManager*)toolboxesManager;
+
+	Stg_ObjectList_DeleteAllObjects( self->codelets );
+	Stg_Class_Delete( self->codelets );
+	ModulesManager_Unload( self );  /* this will unload all toolboxes implicitly */
+	Stg_Class_Delete( self->modules );
+	
+	/* Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+void _ToolboxesManager_Print( void* toolboxesManager, Stream* stream ) {
+	ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;
+	
+	/* General info */
+	Journal_Printf( (void*) stream, "Toolboxes (ptr): %p\n", self );
+	
+	if( Stg_ObjectList_Count(self->initTB) > 0 ) {
+		Index i;
+		
+		Journal_Printf( stream, "Initialised Modules:\n" );
+		Stream_Indent( stream );
+		for( i = 0; i < Stg_ObjectList_Count(self->initTB) ; ++i ) {
+			Journal_Printf( stream, "%s\n", self->initTB->data[i]->name );
+		}
+		Stream_UnIndent( stream );
+	}
+	
+	/* Print parent */
+	_ModulesManager_Print( self, stream );
+}
+
+
+Dictionary_Entry_Value* _ToolboxesManager_GetToolboxesList( void* toolboxesManager, void* _dictionary ) {
+	/*ToolboxesManager*		self = (ToolboxesManager*)toolboxesManager;*/
+	Dictionary*			dictionary = (Dictionary*)_dictionary;
+	Dictionary_Entry_Value*		pluginsList = NULL;
+	
+	pluginsList = Dictionary_Get( dictionary, "import" );
+
+	return pluginsList;
+}
+
+Bool _ToolboxesManager_LoadToolbox( void* toolboxesManager, Module* toolbox ) {
+	ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;
+	
+   /* if not Loaded call the Initialise() and Register() */
+   if( !Stg_ObjectList_Get( self->initTB, toolbox->name ) ) {
+
+      ((Toolbox*)toolbox)->Initialise( self, self->argc, self->argv );
+      ((Toolbox*)toolbox)->Register( self );
+
+      Stg_ObjectList_Append( self->initTB, toolbox );
+   }
+	return True;
+}
+
+Bool _ToolboxesManager_UnloadToolbox( void* toolboxesManager, Module* toolbox ) {
+	ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;
+	
+   if( Stg_ObjectList_Get( self->initTB, toolbox->name ) ) {
+      ((Toolbox*)toolbox)->Finalise( self );
+
+      /* remove the toolbox from the initTB list, but don't actually Delete it's memory */
+      Stg_ObjectList_Remove( self->initTB, toolbox->name, KEEP );
+   }
+    
+	return True;
+}
+
+/* toolboxes do not need to be associated with contexts, so just return true */
+Bool _ToolboxesManager_CheckContext( void* toolboxesManager, Dictionary_Entry_Value* modulesVal, unsigned int entry_I, Name contextName ) {
+	return True;
+}
+
+Name _ToolboxesManager_GetModuleName( void* toolboxesManager, Dictionary_Entry_Value* moduleVal, unsigned int entry_I ) {
+	return Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( moduleVal, entry_I ) );
+}
+
+Bool ToolboxesManager_IsInitialised( void* initRegister, Name label ) {
+	ToolboxesManager* self = (ToolboxesManager*)initRegister;
+
+   if( Stg_ObjectList_Get( self->initTB, label ) )
+      return True;
+   else
+      return False;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/tests/EntryPointSuite.c
--- a/Base/Extensibility/tests/EntryPointSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "EntryPointSuite.h"
-
-Stream* stream;
-
-#define NUM_TEST_FUNCS 10
-
-typedef struct {
-   EntryPoint*	ep;
-   Bool			testFuncsRan[NUM_TEST_FUNCS];
-   int			rank;
-} EntryPointSuiteData;
-
-void TestHook0( EntryPointSuiteData* data ) {
-   data->testFuncsRan[0] = True;
-}
-
-void TestHook1( EntryPointSuiteData* data ) {
-   data->testFuncsRan[1] = True;
-}
-
-void TestHook2( EntryPointSuiteData* data ) {
-   data->testFuncsRan[2] = True;
-}
-
-void TestHook3( EntryPointSuiteData* data ) {
-   data->testFuncsRan[3] = True;
-}
-
-void TestHook4( EntryPointSuiteData* data ) {
-   data->testFuncsRan[4] = True;
-}
-
-void TestHook5( EntryPointSuiteData* data ) {
-   data->testFuncsRan[5] = True;
-}
-
-void TestHook6( EntryPointSuiteData* data ) {
-   data->testFuncsRan[6] = True;
-}
-
-void TestHook7( EntryPointSuiteData* data ) {
-   data->testFuncsRan[7] = True;
-}
-
-void TestHook8( EntryPointSuiteData* data ) {
-   data->testFuncsRan[8] = True;
-}
-
-void TestHook9( EntryPointSuiteData* data ) {
-   data->testFuncsRan[9] = True;
-}
-
-
-void EntryPointSuite_Setup( EntryPointSuiteData* data ) {
-   Index ii;
-
-   data->ep = NULL;
-   for (ii=0; ii < NUM_TEST_FUNCS; ii++ ) {
-      data->testFuncsRan[ii] = False;
-   }
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-}
-
-
-void EntryPointSuite_Teardown( EntryPointSuiteData* data ) {
-   Stg_Class_Delete( data->ep );
-}
-
-
-void EntryPointSuite_TestRunEmpty( EntryPointSuiteData* data ) {
-   data->ep = EntryPoint_New( "test", EntryPoint_VoidPtr_CastType );
-   pcu_check_true( data->ep->hooks->count == 0 );
-   ((EntryPoint_VoidPtr_CallCast*) data->ep->run)( data->ep, NULL );
-}
-
-
-void EntryPointSuite_TestAppendPrepend( EntryPointSuiteData* data ) {
-   Index    ii=0;
-
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
-   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
-   /* TestHook0 */
-   EntryPoint_Prepend( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
-   /* TestHook1, TestHook0 */
-
-   pcu_check_true( data->ep->hooks->count == 2 );
-   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook1" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook1 );
-   pcu_check_streq( data->ep->hooks->data[1]->name, "TestHook0" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[1])->funcPtr == TestHook0 );
-   for (ii=0; ii < data->ep->hooks->count; ii++ ) {
-      pcu_check_streq( ((Hook*)data->ep->hooks->data[ii])->addedBy, "testCode" );
-   }
-}
-
-
-void EntryPointSuite_TestInsertBeforeAfterReplace( EntryPointSuiteData* data ) {
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
-   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
-   /* TestHook2, TestHook3 */
-   EntryPoint_Prepend( data->ep, "TestHook4", (void*)TestHook4, "testCode" );
-   /* TestHook4, TestHook2, TestHook3 */
-   EntryPoint_InsertBefore( data->ep, "TestHook3", "TestHook5", (void*)TestHook5, "testCode" );
-   /* TestHook4, TestHook2, TestHook5, TestHook3 */
-   EntryPoint_InsertAfter( data->ep, "TestHook4", "TestHook6", (void*)TestHook6, "testCode" );
-   /* TestHook4, TestHook6, TestHook2, TestHook5, TestHook3 */
-   EntryPoint_Replace( data->ep, "TestHook5", "TestHook7", (void*)TestHook7, "testCode" );
-   /* TestHook4, TestHook6, TestHook2, TestHook7, TestHook3 */
-
-   pcu_check_true( data->ep->hooks->count == 5 );
-   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook4" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook4 );
-   pcu_check_streq( data->ep->hooks->data[1]->name, "TestHook6" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[1])->funcPtr == TestHook6 );
-   pcu_check_streq( data->ep->hooks->data[2]->name, "TestHook2" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[2])->funcPtr == TestHook2 );
-   pcu_check_streq( data->ep->hooks->data[3]->name, "TestHook7" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[3])->funcPtr == TestHook7 );
-   pcu_check_streq( data->ep->hooks->data[4]->name, "TestHook3" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[4])->funcPtr == TestHook3 );
-}
-
-
-void EntryPointSuite_TestAlwaysFirstLast( EntryPointSuiteData* data ) {
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
-   EntryPoint_Append_AlwaysLast( data->ep, "TestHook8", (void*)TestHook8, "testCode" );
-   /* - TestHook8 */
-   EntryPoint_Append( data->ep, "TestHook9", (void*)TestHook9, "testCode" );
-   /* TestHook9 - TestHook8 */
-   EntryPoint_Prepend_AlwaysFirst( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
-   /* TestHook0 - TestHook9 - TestHook8 */
-   EntryPoint_Prepend( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
-   /* TestHook0 - TestHook1, TestHook9 - TestHook8 */
-
-   pcu_check_true( data->ep->hooks->count == 4 );
-   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook0" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook0 );
-   pcu_check_streq( data->ep->hooks->data[1]->name, "TestHook1" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[1])->funcPtr == TestHook1 );
-   pcu_check_streq( data->ep->hooks->data[2]->name, "TestHook9" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[2])->funcPtr == TestHook9 );
-   pcu_check_streq( data->ep->hooks->data[3]->name, "TestHook8" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[3])->funcPtr == TestHook8 );
-   pcu_check_streq( data->ep->alwaysFirstHook->name, "TestHook0" );
-   pcu_check_true( ((Hook*)data->ep->alwaysFirstHook)->funcPtr == TestHook0 );
-   pcu_check_streq( data->ep->alwaysLastHook->name, "TestHook8" );
-   pcu_check_true( ((Hook*)data->ep->alwaysLastHook)->funcPtr == TestHook8 );
-}
-
-
-void EntryPointSuite_TestReplaceAll( EntryPointSuiteData* data ) {
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
-   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook1", (void*)TestHook0, "testCode" );
-   /* TestHook0, TestHook1 */
-   EntryPoint_ReplaceAll( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
-   /* TestHook2 */
-   pcu_check_true( data->ep->hooks->count == 1 );
-   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook2" );
-   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook2 );
-}
-
-
-void EntryPointSuite_TestPurge( EntryPointSuiteData* data ) {
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
-   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
-   /* TestHook2, TestHook3 */
-   EntryPoint_Purge( data->ep );
-   /* */
-   pcu_check_true( data->ep->hooks->count == 0 );
-}
-
-
-void EntryPointSuite_TestRun( EntryPointSuiteData* data ) {
-   Hook_Index hookIndex;
-
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_VoidPtr_CastType );
-   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook4", (void*)TestHook4, "testCode" );
-   
-   pcu_check_true( data->ep->hooks->count == 5 );
-
-   ((EntryPoint_VoidPtr_CallCast*) data->ep->run)( data->ep, data );
-
-   for (hookIndex = 0; hookIndex < data->ep->hooks->count; hookIndex++ ) {
-      pcu_check_true( data->testFuncsRan[hookIndex] == True );
-   }
-   for (hookIndex = data->ep->hooks->count; hookIndex < NUM_TEST_FUNCS; hookIndex++ ) {
-      pcu_check_true( data->testFuncsRan[hookIndex] == False );
-   }
-}
-
-
-void EntryPointSuite_TestPrintConcise( EntryPointSuiteData* data ) {
-   Stream*        stream = NULL;
-   const Name    testFilename = "testEP-PrintConcise.txt";
-
-   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_VoidPtr_CastType );
-   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
-   EntryPoint_Append( data->ep, "TestHook4", (void*)TestHook4, "testCode" );
-   
-   pcu_check_true( data->ep->hooks->count == 5 );
-
-   stream = Journal_Register( InfoStream_Type, (Name)EntryPoint_Type  );
-   Stream_RedirectFile( stream, testFilename );
-   EntryPoint_PrintConcise( data->ep, stream );
-
-   if (data->rank==0) {
-      char        expectedFilename[PCU_PATH_MAX];
-
-      pcu_filename_expected( testFilename, expectedFilename );
-      pcu_check_fileEq( testFilename, expectedFilename );
-      remove( testFilename );
-   }
-}
-
-/***** For the ClassHook test ************************/
-
-#define __Listener \
-   __Stg_Class \
-   int   number; \
-   Bool  hasRun_0_func; \
-   Bool  hasRun_VoidPtr_func; \
-   int   calcVal;
-struct Listener { __Listener };
-typedef struct Listener Listener;
-
-Listener* Listener_New( int number ) {
-   Listener* result = (Listener*)_Stg_Class_New(
-      sizeof( Listener ),
-      "Listener",
-      _Stg_Class_Delete,
-      NULL,
-      NULL );
-   result->number = number;
-   result->hasRun_0_func = False;
-   result->hasRun_VoidPtr_func = False;
-   result->calcVal = -1;
-   return result;
-}
-
-void Listener_0_Func( void* ref ) {
-   Listener* self = (Listener*) ref;
-   self->hasRun_0_func = True;
-}
-void Listener_VoidPtr_Func( void* ref, void* data0 ) {
-   Listener* self = (Listener*) ref;
-   int* data = (int*)data0;
-   self->hasRun_VoidPtr_func = True;
-   self->calcVal = self->number * (*data);
-}
-
-void EntryPointSuite_TestClassHook( EntryPointSuiteData* data ) {
-   EntryPoint*    classVoidPtr;
-   #define        NUM_LISTENERS 3
-   Listener*      listeners[NUM_LISTENERS];
-   char           hookName[100];
-   int            ii;
-   int            inputData = 5;
-
-   data->ep = EntryPoint_New( "Class0", EntryPoint_Class_0_CastType );
-   classVoidPtr = EntryPoint_New( "Class_VoidPtr", EntryPoint_Class_VoidPtr_CastType );
-
-   for ( ii = 0; ii < NUM_LISTENERS; ++ii ) {
-      listeners[ii] = Listener_New( ii );
-      sprintf( hookName, "hook%d", ii );
-      EntryPoint_AppendClassHook( data->ep, hookName, (void*)Listener_0_Func,
-          __FILE__, listeners[ii] );
-      EntryPoint_AppendClassHook( classVoidPtr, hookName, (void*)Listener_VoidPtr_Func,
-          __FILE__, listeners[ii] );
-   }
-
-   pcu_check_true(
-      data->ep->hooks->count == NUM_LISTENERS &&
-      classVoidPtr->hooks->count ==  NUM_LISTENERS );
-
-   /* Run the entry points */
-   ((EntryPoint_Class_0_CallCast*) data->ep->run)( data->ep );
-   ((EntryPoint_Class_VoidPtr_CallCast*) classVoidPtr->run)( classVoidPtr, &inputData );
-
-   for ( ii = 0; ii < NUM_LISTENERS; ++ii ) {
-      pcu_check_true( listeners[ii]->hasRun_0_func == True );
-      pcu_check_true( listeners[ii]->hasRun_VoidPtr_func == True );
-      pcu_check_true( listeners[ii]->calcVal == ii*inputData );
-   }
-
-   for ( ii = 0; ii < NUM_LISTENERS; ++ii ) {
-      Stg_Class_Delete( listeners[ii] );
-   }
-
-   /* the second EntryPoint won't be automatically deleted by the tearDown func, so delete here */
-   Stg_Class_Delete( classVoidPtr );
-}
-
-/******** For the MinMax test *****************/
-double Return1( Stream* stream ) {
-   Journal_Printf( stream, "In func %s\n", __func__ );
-   return 1.0;
-}
-   
-double Return89( Stream* stream ) {
-   Journal_Printf( stream, "In func %s\n", __func__ );
-   return 89.0;
-}
-
-double ReturnNeg43( Stream* stream ) {
-   Journal_Printf( stream, "In func %s\n", __func__ );
-   return -43;
-}
-double ReturnZero( Stream* stream ) {
-   Journal_Printf( stream, "In func %s\n", __func__ );
-   return 0.0;
-}
-
-
-void EntryPointSuite_TestMinMax( EntryPointSuiteData* data ) {
-   const Name  testEpName = "testEntryPoint";
-   double      result;
-   Stream*     stream;
-
-   stream = Journal_Register( InfoStream_Type, (Name)"myStream"  );
-   Stream_Enable( stream, False );
-
-   data->ep = EntryPoint_New( testEpName, EntryPoint_Maximum_VoidPtr_CastType );
-   EntryPoint_Append( data->ep, "TestHook0", (void*)Return1, "testMinMaxFunc" );
-   EntryPoint_Append( data->ep, "TestHook1", (void*)Return89, "testMinMaxFunc" );
-   EntryPoint_Append( data->ep, "TestHook2", (void*)ReturnNeg43,"testMinMaxFunc");
-   EntryPoint_Append( data->ep, "TestHook3", (void*)ReturnZero, "testMinMaxFunc");
-   result = ((EntryPoint_Maximum_VoidPtr_CallCast*) data->ep->run)( data->ep, stream );
-   pcu_check_true( result == 89.0 );
-   Stg_Class_Delete( data->ep );
-
-   /* Get Minimum of Values */
-   data->ep = EntryPoint_New( testEpName, EntryPoint_Minimum_VoidPtr_CastType );
-   EntryPoint_Append( data->ep, "TestHook0", (void*)Return1, "testMinMaxFunc" );
-   EntryPoint_Append( data->ep, "TestHook1", (void*)Return89, "testMinMaxFunc" );
-   EntryPoint_Append( data->ep, "TestHook2", (void*)ReturnNeg43,"testMinMaxFunc");
-   EntryPoint_Append( data->ep, "TestHook3", (void*)ReturnZero,"testMinMaxFunc" );
-   result = ((EntryPoint_Minimum_VoidPtr_CallCast*) data->ep->run)( data->ep, stream );
-   pcu_check_true( result == -43 );
-}
-
-
-void EntryPointSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, EntryPointSuiteData );
-   pcu_suite_setFixtures( suite, EntryPointSuite_Setup, EntryPointSuite_Teardown );
-   pcu_suite_addTest( suite, EntryPointSuite_TestRunEmpty );
-   pcu_suite_addTest( suite, EntryPointSuite_TestAppendPrepend );
-   pcu_suite_addTest( suite, EntryPointSuite_TestInsertBeforeAfterReplace );
-   pcu_suite_addTest( suite, EntryPointSuite_TestAlwaysFirstLast );
-   pcu_suite_addTest( suite, EntryPointSuite_TestReplaceAll );
-   pcu_suite_addTest( suite, EntryPointSuite_TestPurge );
-   pcu_suite_addTest( suite, EntryPointSuite_TestRun );
-   pcu_suite_addTest( suite, EntryPointSuite_TestPrintConcise );
-   pcu_suite_addTest( suite, EntryPointSuite_TestClassHook );
-   pcu_suite_addTest( suite, EntryPointSuite_TestMinMax );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/tests/EntryPointSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/tests/EntryPointSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,407 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "EntryPointSuite.h"
+
+Stream* stream;
+
+#define NUM_TEST_FUNCS 10
+
+typedef struct {
+   EntryPoint*	ep;
+   Bool			testFuncsRan[NUM_TEST_FUNCS];
+   int			rank;
+} EntryPointSuiteData;
+
+void TestHook0( EntryPointSuiteData* data ) {
+   data->testFuncsRan[0] = True;
+}
+
+void TestHook1( EntryPointSuiteData* data ) {
+   data->testFuncsRan[1] = True;
+}
+
+void TestHook2( EntryPointSuiteData* data ) {
+   data->testFuncsRan[2] = True;
+}
+
+void TestHook3( EntryPointSuiteData* data ) {
+   data->testFuncsRan[3] = True;
+}
+
+void TestHook4( EntryPointSuiteData* data ) {
+   data->testFuncsRan[4] = True;
+}
+
+void TestHook5( EntryPointSuiteData* data ) {
+   data->testFuncsRan[5] = True;
+}
+
+void TestHook6( EntryPointSuiteData* data ) {
+   data->testFuncsRan[6] = True;
+}
+
+void TestHook7( EntryPointSuiteData* data ) {
+   data->testFuncsRan[7] = True;
+}
+
+void TestHook8( EntryPointSuiteData* data ) {
+   data->testFuncsRan[8] = True;
+}
+
+void TestHook9( EntryPointSuiteData* data ) {
+   data->testFuncsRan[9] = True;
+}
+
+
+void EntryPointSuite_Setup( EntryPointSuiteData* data ) {
+   Index ii;
+
+   data->ep = NULL;
+   for (ii=0; ii < NUM_TEST_FUNCS; ii++ ) {
+      data->testFuncsRan[ii] = False;
+   }
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+}
+
+
+void EntryPointSuite_Teardown( EntryPointSuiteData* data ) {
+   Stg_Class_Delete( data->ep );
+}
+
+
+void EntryPointSuite_TestRunEmpty( EntryPointSuiteData* data ) {
+   data->ep = EntryPoint_New( "test", EntryPoint_VoidPtr_CastType );
+   pcu_check_true( data->ep->hooks->count == 0 );
+   ((EntryPoint_VoidPtr_CallCast*) data->ep->run)( data->ep, NULL );
+}
+
+
+void EntryPointSuite_TestAppendPrepend( EntryPointSuiteData* data ) {
+   Index    ii=0;
+
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
+   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
+   /* TestHook0 */
+   EntryPoint_Prepend( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
+   /* TestHook1, TestHook0 */
+
+   pcu_check_true( data->ep->hooks->count == 2 );
+   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook1" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook1 );
+   pcu_check_streq( data->ep->hooks->data[1]->name, "TestHook0" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[1])->funcPtr == TestHook0 );
+   for (ii=0; ii < data->ep->hooks->count; ii++ ) {
+      pcu_check_streq( ((Hook*)data->ep->hooks->data[ii])->addedBy, "testCode" );
+   }
+}
+
+
+void EntryPointSuite_TestInsertBeforeAfterReplace( EntryPointSuiteData* data ) {
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
+   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
+   /* TestHook2, TestHook3 */
+   EntryPoint_Prepend( data->ep, "TestHook4", (void*)TestHook4, "testCode" );
+   /* TestHook4, TestHook2, TestHook3 */
+   EntryPoint_InsertBefore( data->ep, "TestHook3", "TestHook5", (void*)TestHook5, "testCode" );
+   /* TestHook4, TestHook2, TestHook5, TestHook3 */
+   EntryPoint_InsertAfter( data->ep, "TestHook4", "TestHook6", (void*)TestHook6, "testCode" );
+   /* TestHook4, TestHook6, TestHook2, TestHook5, TestHook3 */
+   EntryPoint_Replace( data->ep, "TestHook5", "TestHook7", (void*)TestHook7, "testCode" );
+   /* TestHook4, TestHook6, TestHook2, TestHook7, TestHook3 */
+
+   pcu_check_true( data->ep->hooks->count == 5 );
+   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook4" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook4 );
+   pcu_check_streq( data->ep->hooks->data[1]->name, "TestHook6" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[1])->funcPtr == TestHook6 );
+   pcu_check_streq( data->ep->hooks->data[2]->name, "TestHook2" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[2])->funcPtr == TestHook2 );
+   pcu_check_streq( data->ep->hooks->data[3]->name, "TestHook7" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[3])->funcPtr == TestHook7 );
+   pcu_check_streq( data->ep->hooks->data[4]->name, "TestHook3" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[4])->funcPtr == TestHook3 );
+}
+
+
+void EntryPointSuite_TestAlwaysFirstLast( EntryPointSuiteData* data ) {
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
+   EntryPoint_Append_AlwaysLast( data->ep, "TestHook8", (void*)TestHook8, "testCode" );
+   /* - TestHook8 */
+   EntryPoint_Append( data->ep, "TestHook9", (void*)TestHook9, "testCode" );
+   /* TestHook9 - TestHook8 */
+   EntryPoint_Prepend_AlwaysFirst( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
+   /* TestHook0 - TestHook9 - TestHook8 */
+   EntryPoint_Prepend( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
+   /* TestHook0 - TestHook1, TestHook9 - TestHook8 */
+
+   pcu_check_true( data->ep->hooks->count == 4 );
+   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook0" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook0 );
+   pcu_check_streq( data->ep->hooks->data[1]->name, "TestHook1" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[1])->funcPtr == TestHook1 );
+   pcu_check_streq( data->ep->hooks->data[2]->name, "TestHook9" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[2])->funcPtr == TestHook9 );
+   pcu_check_streq( data->ep->hooks->data[3]->name, "TestHook8" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[3])->funcPtr == TestHook8 );
+   pcu_check_streq( data->ep->alwaysFirstHook->name, "TestHook0" );
+   pcu_check_true( ((Hook*)data->ep->alwaysFirstHook)->funcPtr == TestHook0 );
+   pcu_check_streq( data->ep->alwaysLastHook->name, "TestHook8" );
+   pcu_check_true( ((Hook*)data->ep->alwaysLastHook)->funcPtr == TestHook8 );
+}
+
+
+void EntryPointSuite_TestReplaceAll( EntryPointSuiteData* data ) {
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
+   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook1", (void*)TestHook0, "testCode" );
+   /* TestHook0, TestHook1 */
+   EntryPoint_ReplaceAll( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
+   /* TestHook2 */
+   pcu_check_true( data->ep->hooks->count == 1 );
+   pcu_check_streq( data->ep->hooks->data[0]->name, "TestHook2" );
+   pcu_check_true( ((Hook*)data->ep->hooks->data[0])->funcPtr == TestHook2 );
+}
+
+
+void EntryPointSuite_TestPurge( EntryPointSuiteData* data ) {
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_0_CastType );
+   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
+   /* TestHook2, TestHook3 */
+   EntryPoint_Purge( data->ep );
+   /* */
+   pcu_check_true( data->ep->hooks->count == 0 );
+}
+
+
+void EntryPointSuite_TestRun( EntryPointSuiteData* data ) {
+   Hook_Index hookIndex;
+
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_VoidPtr_CastType );
+   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook4", (void*)TestHook4, "testCode" );
+   
+   pcu_check_true( data->ep->hooks->count == 5 );
+
+   ((EntryPoint_VoidPtr_CallCast*) data->ep->run)( data->ep, data );
+
+   for (hookIndex = 0; hookIndex < data->ep->hooks->count; hookIndex++ ) {
+      pcu_check_true( data->testFuncsRan[hookIndex] == True );
+   }
+   for (hookIndex = data->ep->hooks->count; hookIndex < NUM_TEST_FUNCS; hookIndex++ ) {
+      pcu_check_true( data->testFuncsRan[hookIndex] == False );
+   }
+}
+
+
+void EntryPointSuite_TestPrintConcise( EntryPointSuiteData* data ) {
+   Stream*        stream = NULL;
+   const Name    testFilename = "testEP-PrintConcise.txt";
+
+   data->ep = EntryPoint_New( "testEntryPoint", EntryPoint_VoidPtr_CastType );
+   EntryPoint_Append( data->ep, "TestHook0", (void*)TestHook0, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook1", (void*)TestHook1, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook2", (void*)TestHook2, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook3", (void*)TestHook3, "testCode" );
+   EntryPoint_Append( data->ep, "TestHook4", (void*)TestHook4, "testCode" );
+   
+   pcu_check_true( data->ep->hooks->count == 5 );
+
+   stream = Journal_Register( InfoStream_Type, (Name)EntryPoint_Type  );
+   Stream_RedirectFile( stream, testFilename );
+   EntryPoint_PrintConcise( data->ep, stream );
+
+   if (data->rank==0) {
+      char        expectedFilename[PCU_PATH_MAX];
+
+      pcu_filename_expected( testFilename, expectedFilename );
+      pcu_check_fileEq( testFilename, expectedFilename );
+      remove( testFilename );
+   }
+}
+
+/***** For the ClassHook test ************************/
+
+#define __Listener \
+   __Stg_Class \
+   int   number; \
+   Bool  hasRun_0_func; \
+   Bool  hasRun_VoidPtr_func; \
+   int   calcVal;
+struct Listener { __Listener };
+typedef struct Listener Listener;
+
+Listener* Listener_New( int number ) {
+   Listener* result = (Listener*)_Stg_Class_New(
+      sizeof( Listener ),
+      "Listener",
+      _Stg_Class_Delete,
+      NULL,
+      NULL );
+   result->number = number;
+   result->hasRun_0_func = False;
+   result->hasRun_VoidPtr_func = False;
+   result->calcVal = -1;
+   return result;
+}
+
+void Listener_0_Func( void* ref ) {
+   Listener* self = (Listener*) ref;
+   self->hasRun_0_func = True;
+}
+void Listener_VoidPtr_Func( void* ref, void* data0 ) {
+   Listener* self = (Listener*) ref;
+   int* data = (int*)data0;
+   self->hasRun_VoidPtr_func = True;
+   self->calcVal = self->number * (*data);
+}
+
+void EntryPointSuite_TestClassHook( EntryPointSuiteData* data ) {
+   EntryPoint*    classVoidPtr;
+   #define        NUM_LISTENERS 3
+   Listener*      listeners[NUM_LISTENERS];
+   char           hookName[100];
+   int            ii;
+   int            inputData = 5;
+
+   data->ep = EntryPoint_New( "Class0", EntryPoint_Class_0_CastType );
+   classVoidPtr = EntryPoint_New( "Class_VoidPtr", EntryPoint_Class_VoidPtr_CastType );
+
+   for ( ii = 0; ii < NUM_LISTENERS; ++ii ) {
+      listeners[ii] = Listener_New( ii );
+      sprintf( hookName, "hook%d", ii );
+      EntryPoint_AppendClassHook( data->ep, hookName, (void*)Listener_0_Func,
+          __FILE__, listeners[ii] );
+      EntryPoint_AppendClassHook( classVoidPtr, hookName, (void*)Listener_VoidPtr_Func,
+          __FILE__, listeners[ii] );
+   }
+
+   pcu_check_true(
+      data->ep->hooks->count == NUM_LISTENERS &&
+      classVoidPtr->hooks->count ==  NUM_LISTENERS );
+
+   /* Run the entry points */
+   ((EntryPoint_Class_0_CallCast*) data->ep->run)( data->ep );
+   ((EntryPoint_Class_VoidPtr_CallCast*) classVoidPtr->run)( classVoidPtr, &inputData );
+
+   for ( ii = 0; ii < NUM_LISTENERS; ++ii ) {
+      pcu_check_true( listeners[ii]->hasRun_0_func == True );
+      pcu_check_true( listeners[ii]->hasRun_VoidPtr_func == True );
+      pcu_check_true( listeners[ii]->calcVal == ii*inputData );
+   }
+
+   for ( ii = 0; ii < NUM_LISTENERS; ++ii ) {
+      Stg_Class_Delete( listeners[ii] );
+   }
+
+   /* the second EntryPoint won't be automatically deleted by the tearDown func, so delete here */
+   Stg_Class_Delete( classVoidPtr );
+}
+
+/******** For the MinMax test *****************/
+double Return1( Stream* stream ) {
+   Journal_Printf( stream, "In func %s\n", __func__ );
+   return 1.0;
+}
+   
+double Return89( Stream* stream ) {
+   Journal_Printf( stream, "In func %s\n", __func__ );
+   return 89.0;
+}
+
+double ReturnNeg43( Stream* stream ) {
+   Journal_Printf( stream, "In func %s\n", __func__ );
+   return -43;
+}
+double ReturnZero( Stream* stream ) {
+   Journal_Printf( stream, "In func %s\n", __func__ );
+   return 0.0;
+}
+
+
+void EntryPointSuite_TestMinMax( EntryPointSuiteData* data ) {
+   const Name  testEpName = "testEntryPoint";
+   double      result;
+   Stream*     stream;
+
+   stream = Journal_Register( InfoStream_Type, (Name)"myStream"  );
+   Stream_Enable( stream, False );
+
+   data->ep = EntryPoint_New( testEpName, EntryPoint_Maximum_VoidPtr_CastType );
+   EntryPoint_Append( data->ep, "TestHook0", (void*)Return1, "testMinMaxFunc" );
+   EntryPoint_Append( data->ep, "TestHook1", (void*)Return89, "testMinMaxFunc" );
+   EntryPoint_Append( data->ep, "TestHook2", (void*)ReturnNeg43,"testMinMaxFunc");
+   EntryPoint_Append( data->ep, "TestHook3", (void*)ReturnZero, "testMinMaxFunc");
+   result = ((EntryPoint_Maximum_VoidPtr_CallCast*) data->ep->run)( data->ep, stream );
+   pcu_check_true( result == 89.0 );
+   Stg_Class_Delete( data->ep );
+
+   /* Get Minimum of Values */
+   data->ep = EntryPoint_New( testEpName, EntryPoint_Minimum_VoidPtr_CastType );
+   EntryPoint_Append( data->ep, "TestHook0", (void*)Return1, "testMinMaxFunc" );
+   EntryPoint_Append( data->ep, "TestHook1", (void*)Return89, "testMinMaxFunc" );
+   EntryPoint_Append( data->ep, "TestHook2", (void*)ReturnNeg43,"testMinMaxFunc");
+   EntryPoint_Append( data->ep, "TestHook3", (void*)ReturnZero,"testMinMaxFunc" );
+   result = ((EntryPoint_Minimum_VoidPtr_CallCast*) data->ep->run)( data->ep, stream );
+   pcu_check_true( result == -43 );
+}
+
+
+void EntryPointSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, EntryPointSuiteData );
+   pcu_suite_setFixtures( suite, EntryPointSuite_Setup, EntryPointSuite_Teardown );
+   pcu_suite_addTest( suite, EntryPointSuite_TestRunEmpty );
+   pcu_suite_addTest( suite, EntryPointSuite_TestAppendPrepend );
+   pcu_suite_addTest( suite, EntryPointSuite_TestInsertBeforeAfterReplace );
+   pcu_suite_addTest( suite, EntryPointSuite_TestAlwaysFirstLast );
+   pcu_suite_addTest( suite, EntryPointSuite_TestReplaceAll );
+   pcu_suite_addTest( suite, EntryPointSuite_TestPurge );
+   pcu_suite_addTest( suite, EntryPointSuite_TestRun );
+   pcu_suite_addTest( suite, EntryPointSuite_TestPrintConcise );
+   pcu_suite_addTest( suite, EntryPointSuite_TestClassHook );
+   pcu_suite_addTest( suite, EntryPointSuite_TestMinMax );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/tests/ExtensionSuite.c
--- a/Base/Extensibility/tests/ExtensionSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,701 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "StGermain/Base/Container/Container.h"
-#include "StGermain/Base/Automation/Automation.h"
-#include "StGermain/Base/Extensibility/Extensibility.h"
-#include "ExtensionSuite.h"
-
-typedef struct {
-} ExtensionSuiteData;
-
-typedef struct {
-   double x;
-   double y;
-   double z;
-   char dim;
-} BaseClass;
-
-typedef struct {
-   char type;
-} ExtensionStruct0;
-const Type Type0 = "Type0";
-const Type Type1 = "Type1";
-
-typedef struct {
-   double temp;
-} ExtensionStruct1;
-const Type Temp0 = "Temp0";
-const Type Temp1 = "Temp1";
-
-typedef struct {
-   double pres;
-   char flag;
-} ExtensionStruct2;
-const Type Pres0 = "Pres0";
-const Type Pres1 = "Pres1";
-
-typedef struct {
-   char dd;
-   char cc;
-   int bc;
-} ExtensionStruct3;
-const Type BC_Set0 = "BC_Set0";
-const Type BC_Set1 = "BC_Set1";
-
-typedef struct {
-   float wf;
-} ExtensionStruct4;
-const Type Weight0 = "Weight0";
-const Type Weight1 = "Weight1";
-
-void ExtensionSuite_Setup( ExtensionSuiteData* data ) {
-}
-
-void ExtensionSuite_Teardown( ExtensionSuiteData* data ) {
-}
-
-void ExtensionSuite_TestOfStruct( ExtensionSuiteData* data ) {
-   ExtensionManager*    extensionMgr;
-   BaseClass*           nArray;
-   BaseClass*           n;
-   ExtensionStruct0*    nType0;
-   ExtensionStruct1*    nTemp0;
-   ExtensionStruct2*    nPres0;
-   ExtensionStruct3*    nBC_Set0;
-   ExtensionStruct4*    nWeight0;
-   ExtensionStruct0*    nType1;
-   ExtensionStruct1*    nTemp1;
-   ExtensionStruct2*    nPres1;
-   ExtensionStruct3*    nBC_Set1;
-   ExtensionStruct4*    nWeight1;
-   Index                ii;
-   const Index          ArraySize = 100;
-   Index                numExtensions = 0;      /* variable to check number of extensions */
-   SizeT                size0;
-   SizeT                size1;
-   SizeT                size2;
-   SizeT                size3;
-   SizeT                size4;
-
-   size0 = ExtensionManager_Align( sizeof(ExtensionStruct0) );
-   size1 = ExtensionManager_Align( sizeof(ExtensionStruct1) );
-   size2 = ExtensionManager_Align( sizeof(ExtensionStruct2) );
-   size3 = ExtensionManager_Align( sizeof(ExtensionStruct3) );
-   size4 = ExtensionManager_Align( sizeof(ExtensionStruct4) );
-
-   /* Build the extensionMgr */
-   extensionMgr = ExtensionManager_New_OfStruct( "Node", sizeof(BaseClass) );
-   ExtensionManager_Add( extensionMgr, (Name)Type0, sizeof(ExtensionStruct0)  );     numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Temp0, sizeof(ExtensionStruct1)  );     numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Pres0, sizeof(ExtensionStruct2)  );     numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)BC_Set0, sizeof(ExtensionStruct3)  );   numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Weight0, sizeof(ExtensionStruct4)  );   numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Type1, sizeof(ExtensionStruct0)  );     numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Temp1, sizeof(ExtensionStruct1)  );     numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Pres1, sizeof(ExtensionStruct2)  );     numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)BC_Set1, sizeof(ExtensionStruct3)  );   numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Weight1, sizeof(ExtensionStruct4) );   numExtensions++;
-
-   /* "Is the initial size correct" */
-   pcu_check_true( extensionMgr->initialSize == sizeof(BaseClass)  );
-
-   /* Is the first offset at the correct position */
-   pcu_check_true( ExtensionInfo_At( extensionMgr->extInfos, 0 )->offset == sizeof(BaseClass) );
-
-   /* Is the final size correct */
-   pcu_check_true( extensionMgr->finalSize == 
-         sizeof(BaseClass) + 
-         size0 + size1 + size2 + size3 + size4 +
-         size0 + size1 + size2 + size3 + size4 );
-
-   /* Is the number of extensions correct */
-   pcu_check_true( extensionMgr->extInfos->count == numExtensions );
-
-   /* Alloc, initialise and view*/
-   nArray = (BaseClass*)ExtensionManager_Malloc( extensionMgr, ArraySize );
-
-   /* Can we malloc the extension */
-   pcu_check_true( nArray != NULL );
-
-   n = (BaseClass*)ExtensionManager_At( extensionMgr, nArray, 0 );
-
-   nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nType0->type - (ArithPointer)n) == sizeof(BaseClass) );
-
-   nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nTemp0->temp - (ArithPointer)n) == sizeof(BaseClass) + size0 );
-   
-   nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );      
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nPres0->pres - (ArithPointer)n) == sizeof(BaseClass) + size0 + size1 );
-
-   nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nBC_Set0->dd - (ArithPointer)n) == sizeof(BaseClass) + size0 + size1 + size2 );
-
-   nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n,
-      ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ));
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nWeight0->wf - (ArithPointer)n) == 
-         sizeof(BaseClass) + size0 + size1 + size2 + size3 );
-
-   nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n,
-      ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nType1->type - (ArithPointer)n) == 
-         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 );
-
-   nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n,
-      ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nTemp1->temp - (ArithPointer)n) == 
-         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 );
-
-   nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n,
-      ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nPres1->pres - (ArithPointer)n) == 
-         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 + size1 );
-
-   nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n,
-      ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nBC_Set1->dd - (ArithPointer)n) == 
-         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 );
-
-   nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n,
-      ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nWeight1->wf - (ArithPointer)n) == 
-         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 + size3 );
-
-   for( ii = 0; ii < ArraySize; ii++ ) {
-      n = (BaseClass* )ExtensionManager_At( extensionMgr, nArray, ii );
-      
-      n->x = 1.0f;
-      n->y = 2.0f;
-      n->z = 3.0f;
-      n->dim = 4;
-      
-      nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
-      nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
-      nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
-      nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
-      nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ) );
-      nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
-      nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
-      nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
-      nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
-      nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
-
-      nType0->type = 5;
-      nTemp0->temp = 6.0f;
-      nPres0->pres = 7.0f;
-      nPres0->flag = 8;
-      nBC_Set0->dd = 9;
-      nBC_Set0->cc = 10;
-      nBC_Set0->bc = 11;
-      nWeight0->wf = 12.0f;
-      nType1->type = 13;
-      nTemp1->temp = 14.0f;
-      nPres1->pres = 15.0f;
-      nPres1->flag = 16;
-      nBC_Set1->dd = 17;
-      nBC_Set1->cc = 18;
-      nBC_Set1->bc = 19;
-      nWeight1->wf = 20.0f;
-   }
-
-   for( ii = 0; ii < ArraySize; ii++ ) {
-      n = (BaseClass* )ExtensionManager_At( extensionMgr, nArray, ii );
-
-      nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
-      nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
-      nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
-      nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
-      nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ) );
-      nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
-      nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
-      nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
-      nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
-      nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
-
-      pcu_check_true( n->x == 1.0f );
-      pcu_check_true( n->y == 2.0f );
-      pcu_check_true( n->z == 3.0f );
-      pcu_check_true( n->dim == 4 );
-
-      pcu_check_true( nType0->type == 5 );
-      pcu_check_true( nTemp0->temp == 6.0f );
-      pcu_check_true( nPres0->pres == 7.0f );
-      pcu_check_true( nPres0->flag == 8 );
-      pcu_check_true( nBC_Set0->dd == 9 );
-      pcu_check_true( nBC_Set0->cc == 10 );
-      pcu_check_true( nBC_Set0->bc == 11 );
-      pcu_check_true( nWeight0->wf == 12.0f );
-      pcu_check_true( nType1->type == 13 );
-      pcu_check_true( nTemp1->temp == 14.0f );
-      pcu_check_true( nPres1->pres == 15.0f );
-      pcu_check_true( nPres1->flag == 16 );
-      pcu_check_true( nBC_Set1->dd == 17 );
-      pcu_check_true( nBC_Set1->cc == 18 );
-      pcu_check_true( nBC_Set1->bc == 19 );
-      pcu_check_true( nWeight1->wf == 20.0f  );
-   }
-   
-   /* Stg_Class_Delete stuff */
-   ExtensionManager_Free( extensionMgr, nArray );
-   Stg_Class_Delete( extensionMgr );
-}
-
-
-void ExtensionSuite_TestOfExistingObject( ExtensionSuiteData* data ) {
-   ExtensionManager*    extensionMgr;
-   BaseClass*           n;
-   ExtensionStruct0*    nType0;
-   ExtensionStruct1*    nTemp0;
-   ExtensionStruct2*    nPres0;
-   ExtensionStruct3*    nBC_Set0;
-   ExtensionStruct4*    nWeight0;
-   ExtensionStruct0*    nType1;
-   ExtensionStruct1*    nTemp1;
-   ExtensionStruct2*    nPres1;
-   ExtensionStruct3*    nBC_Set1;
-   ExtensionStruct4*    nWeight1;
-   Index                numExtensions = 0;  /* variable to check number of extensions */
-   SizeT                size0;
-   SizeT                size1;
-   SizeT                size2;
-   SizeT                size3;
-   SizeT                size4;
-
-   size0 = ExtensionManager_Align( sizeof(ExtensionStruct0) );
-   size1 = ExtensionManager_Align( sizeof(ExtensionStruct1) );
-   size2 = ExtensionManager_Align( sizeof(ExtensionStruct2) );
-   size3 = ExtensionManager_Align( sizeof(ExtensionStruct3) );
-   size4 = ExtensionManager_Align( sizeof(ExtensionStruct4) );
-
-   /* Build the extensionMgr */
-   n = Memory_Alloc_Unnamed( BaseClass );
-   extensionMgr = ExtensionManager_New_OfExistingObject( "Node", n );
-   ExtensionManager_Add( extensionMgr, (Name)Type0, sizeof(ExtensionStruct0)  );      numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Temp0, sizeof(ExtensionStruct1)  );      numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Pres0, sizeof(ExtensionStruct2)  );      numExtensions++; 
-   ExtensionManager_Add( extensionMgr, (Name)BC_Set0, sizeof(ExtensionStruct3)  );   numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Weight0, sizeof(ExtensionStruct4)  );   numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Type1, sizeof(ExtensionStruct0)  );      numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Temp1, sizeof(ExtensionStruct1)  );      numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Pres1, sizeof(ExtensionStruct2)  );      numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)BC_Set1, sizeof(ExtensionStruct3)  );   numExtensions++;
-   ExtensionManager_Add( extensionMgr, (Name)Weight1, sizeof(ExtensionStruct4) );   numExtensions++;
-
-   /* Is the initial size correct */
-   pcu_check_true( extensionMgr->initialSize == 0  );
-
-   /* Is the first offset at the correct position */
-   pcu_check_true( ExtensionInfo_At( extensionMgr->extInfos, 0 )->offset == 0 );
-
-   /* Is the final size correct */
-   pcu_check_true( extensionMgr->finalSize ==
-         size0 + size1 + size2 + size3 + size4 +
-         size0 + size1 + size2 + size3 + size4 );
-
-   /* Is the number of extensions correct */
-   pcu_check_true( extensionMgr->extInfos->count == numExtensions );
-
-   n->x = 1.0f;
-   n->y = 2.0f;
-   n->z = 3.0f;
-   n->dim = 4;
-   
-   nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
-   /* Is offset correct */
-   pcu_check_true( ((ArithPointer)&nType0->type - (ArithPointer)extensionMgr->_extensionsToExisting) ==  0 );
-   nType0->type = 5;
-   
-   nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nTemp0->temp - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 );
-   nTemp0->temp = 6.0f;
-   
-   nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nPres0->pres - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-              size0 + size1 );
-   nPres0->pres = 7.0f;
-   nPres0->flag = 8;
-   
-   nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nBC_Set0->dd - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 );
-   nBC_Set0->dd = 9;
-   nBC_Set0->cc = 10;
-   nBC_Set0->bc = 11;
-   
-   nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ) );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nWeight0->wf - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 + size3 );
-   nWeight0->wf = 12.0f;
-   
-   nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nType1->type - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 + size3 + size4 );
-   nType1->type = 13;
-   
-   nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nTemp1->temp - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 + size3 + size4 + size0 );
-   nTemp1->temp = 14.0f;
-   
-   nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nPres1->pres - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 + size3 + size4 + size0 + size1 );
-   nPres1->pres = 15.0f;
-   nPres1->flag = 16;
-   
-   nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
-   /* Is offset correct */
-   pcu_check_true(
-      ((ArithPointer)&nBC_Set1->dd - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 );
-   nBC_Set1->dd = 17;
-   nBC_Set1->cc = 18;
-   nBC_Set1->bc = 19;
-   
-   /* Is offset correct */
-   nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
-   pcu_check_true(
-      ((ArithPointer)&nWeight1->wf - (ArithPointer)extensionMgr->_extensionsToExisting) ==
-         size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 + size3  );
-
-   nWeight1->wf = 20.0f;
-   
-   /* Now check we can get them all over again, and read the values correctly */
-   nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
-   nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
-   nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
-   nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
-   nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, 4 );
-   nType1 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 5 );
-   nTemp1 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 6 );
-   nPres1 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 7 );
-   nBC_Set1 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 8 );
-   nWeight1 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, 9 );
-   pcu_check_true( n->x == 1.0f );
-   pcu_check_true( n->y == 2.0f );
-   pcu_check_true( n->z == 3.0f );
-   pcu_check_true( n->dim == 4 );
-   pcu_check_true( nType0->type == 5 );
-   pcu_check_true( nTemp0->temp == 6.0f );
-   pcu_check_true( nPres0->pres == 7.0f );
-   pcu_check_true( nPres0->flag == 8 );
-   pcu_check_true( nBC_Set0->dd == 9 );
-   pcu_check_true( nBC_Set0->cc == 10 );
-   pcu_check_true( nBC_Set0->bc == 11 );
-   pcu_check_true( nWeight0->wf == 12.0f );
-   pcu_check_true( nType1->type == 13 );
-   pcu_check_true( nTemp1->temp == 14.0f );
-   pcu_check_true( nPres1->pres == 15.0f );
-   pcu_check_true( nPres1->flag == 16 );
-   pcu_check_true( nBC_Set1->dd == 17 );
-   pcu_check_true( nBC_Set1->cc == 18 );
-   pcu_check_true( nBC_Set1->bc == 19 );
-   pcu_check_true( nWeight1->wf == 20.0f );
-
-   /* Stg_Class_Delete stuff */
-   Stg_Class_Delete( extensionMgr );
-   Memory_Free( n );
-}
-
-
-void ExtensionSuite_TestAddArrayToExistingObject( ExtensionSuiteData* data ) {
-   ExtensionManager*    objExtension=NULL;
-   BaseClass*           baseObject=NULL;
-   Index                ii=0;
-   ExtensionStruct0*    objType0=NULL;
-   ExtensionStruct1*    objTemp0=NULL;
-
-   baseObject = Memory_Alloc( BaseClass, "BaseObject" );
-   objExtension = ExtensionManager_New_OfExistingObject( "obj", baseObject );
-
-   ExtensionManager_Add( objExtension, (Name)Type0, sizeof(ExtensionStruct0)  );
-   ExtensionManager_AddArray( objExtension, Temp0, sizeof(ExtensionStruct1), 10 );
-   
-   {
-      objType0 = (ExtensionStruct0*)ExtensionManager_Get(
-         objExtension, 
-         baseObject, 
-         ExtensionManager_GetHandle( objExtension, (Name)"Type0" ) );
-      
-      objTemp0 = (ExtensionStruct1* )ExtensionManager_Get( 
-         objExtension, 
-         baseObject, 
-         ExtensionManager_GetHandle( objExtension, (Name)"Temp0" ) );
-
-      objType0->type = 'a';
-      for ( ii = 0; ii < 10; ++ii ) {
-         objTemp0[ii].temp = (double)ii;
-      }
-   }
-
-   objTemp0 = (ExtensionStruct1* )ExtensionManager_Get( 
-      objExtension, 
-      baseObject, 
-      ExtensionManager_GetHandle( objExtension, (Name)"Temp0" ) );
-
-   for ( ii = 0; ii < 10; ++ii ) {
-      pcu_check_true( objTemp0[ii].temp == ii );
-   }
-
-   Memory_Free( baseObject );
-   Stg_Class_Delete( objExtension );
-}
-
-
-void ExtensionSuite_TestExtendOfExtendedArray( ExtensionSuiteData* data  ) {
-   ExtensionManager*       structExtension=NULL;
-   ExtensionManager*       arrayExtension=NULL;
-   BaseClass*              nArray=NULL;
-   BaseClass*              current=NULL;
-   ExtensionStruct0*       nType0=NULL;
-   ExtensionStruct1*       nTemp0=NULL;
-   ExtensionStruct2*       nPres0=NULL;
-   Index                   array_I=0;
-   const Index             ArraySize = 8;
-   Index                   ii=0;
-
-   structExtension = ExtensionManager_New_OfStruct( "Node", sizeof(BaseClass) );
-
-   ExtensionManager_Add( structExtension, (Name)Type0, sizeof(ExtensionStruct0)  );
-   ExtensionManager_AddArray( structExtension, Temp0, sizeof(ExtensionStruct1), 10 );
-   
-   nArray = (BaseClass*)ExtensionManager_Malloc( structExtension, ArraySize );
-
-   /* Testing "Simple" extension on allocated extended struct */
-   arrayExtension = ExtensionManager_New_OfExtendedArray( "Ext", nArray, structExtension, ArraySize );
-
-   /* Since the nArray is already allocated, this function should realloc it to put the extended array
-    * at the end */
-   ExtensionManager_Add( arrayExtension, (Name)Pres0, sizeof(ExtensionStruct2) );
-
-   for ( array_I = 0; array_I < ArraySize; ++array_I  ) {
-     current = (BaseClass*)ExtensionManager_At( structExtension, nArray, array_I );
-
-      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
-         structExtension,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
-      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
-         structExtension,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
-
-      nType0->type = 'a';
-      for ( ii = 0; ii < 10; ++ii ) {
-         nTemp0[ii].temp = (double)((array_I * 10) + ii);
-      }
-      
-      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
-         arrayExtension,
-         ExtensionManager_At( arrayExtension, nArray, array_I ),
-         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
-      
-      nPres0->pres = (double)array_I;
-      nPres0->flag = 'b';
-   }
-   
-   for ( array_I = 0; array_I < ArraySize; ++array_I  ) {
-     current = (BaseClass*)ExtensionManager_At( structExtension, nArray, array_I );
-      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
-         structExtension,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
-      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
-         structExtension,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
-
-      pcu_check_true( nType0->type == 'a' );
-      for ( ii = 0; ii < 10; ++ii ) {
-         pcu_check_true( nTemp0[ii].temp == (double)((array_I * 10) + ii) );
-      }
-
-      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
-         arrayExtension,
-         ExtensionManager_At( arrayExtension, nArray, array_I ),
-         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
-   
-      pcu_check_true( nPres0->pres == (double)array_I );
-      pcu_check_true( nPres0->flag == 'b'  );
-   }
-
-   ExtensionManager_Free( structExtension, nArray );
-
-   Stg_Class_Delete( structExtension );
-   Stg_Class_Delete( arrayExtension );
-}
-
-
-void ExtensionSuite_TestCopyExtendedArray( ExtensionSuiteData* data ) {
-   ExtensionManager*       structExtension=NULL;
-   ExtensionManager*       arrayExtension=NULL;
-   BaseClass*              nArray=NULL;
-   BaseClass*              current=NULL;
-   ExtensionStruct0*       nType0=NULL;
-   ExtensionStruct1*       nTemp0=NULL;
-   ExtensionStruct2*       nPres0=NULL;
-   Index                   array_I=0;
-   const Index             ArraySize = 8;
-   Index                   ii=0;
-   ExtensionManager*       structExtensionCopy=NULL;
-   ExtensionManager*       arrayExtensionCopy=NULL;
-   BaseClass*              nArrayCopy=NULL;
-   PtrMap*                 copyMap=NULL;
-
-   structExtension = ExtensionManager_New_OfStruct( "Node", sizeof(BaseClass) );
-
-   ExtensionManager_Add( structExtension, (Name)Type0, sizeof(ExtensionStruct0)  );
-   ExtensionManager_AddArray( structExtension, Temp0, sizeof(ExtensionStruct1), 10 );
-   
-   nArray = (BaseClass*)ExtensionManager_Malloc( structExtension, ArraySize );
-
-   /* Testing "Simple" extension on allocated extended struct */
-   arrayExtension = ExtensionManager_New_OfExtendedArray( "Ext", nArray, structExtension, ArraySize );
-
-   /* Since the nArray is already allocated, this function should realloc it to put the extended array
-    * at the end */
-   ExtensionManager_Add( arrayExtension, (Name)Pres0, sizeof(ExtensionStruct2) );
-
-   for ( array_I = 0; array_I < ArraySize; ++array_I  ) {
-     current = (BaseClass*)ExtensionManager_At( structExtension, nArray, array_I );
-
-      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
-         structExtension,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
-      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
-         structExtension,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
-
-      nType0->type = 'a';
-      for ( ii = 0; ii < 10; ++ii ) {
-         nTemp0[ii].temp = (double)((array_I * 10) + ii);
-      }
-      
-      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
-         arrayExtension,
-         ExtensionManager_At( arrayExtension, nArray, array_I ),
-         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
-      
-      nPres0->pres = (double)array_I;
-      nPres0->flag = 'b';
-   }
-
-   /* Copy time! */
-   
-   copyMap = PtrMap_New( 1  );
-   arrayExtensionCopy = (ExtensionManager*)Stg_Class_Copy( arrayExtension, NULL, True, "_dup", copyMap );
-   structExtensionCopy = (ExtensionManager*)Stg_Class_Copy( structExtension, NULL, True, "_dup", copyMap );
-   nArrayCopy = (BaseClass*)PtrMap_Find( copyMap, arrayExtension->_array );
-
-   pcu_check_true( nArrayCopy != NULL && nArrayCopy == arrayExtensionCopy->_array );
-
-   for ( array_I = 0; array_I < ArraySize; ++array_I ) {
-     current = (BaseClass*)ExtensionManager_At( arrayExtensionCopy, nArrayCopy, array_I );
-
-      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
-         arrayExtensionCopy,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
-      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
-         arrayExtensionCopy,
-         current,
-         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
-   
-      pcu_check_true( nType0->type == 'a' );
-      for ( ii = 0; ii < 10; ++ii ) {
-         pcu_check_true( nTemp0[ii].temp == (double)((array_I * 10) + ii) );
-      }
-
-      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
-         arrayExtension,
-         ExtensionManager_At( arrayExtension, nArray, array_I ),
-         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
-   
-      pcu_check_true( nPres0->pres == (double)array_I );
-      pcu_check_true( nPres0->flag == 'b'  );
-   }
-
-   ExtensionManager_Free( structExtension, nArray );
-   Stg_Class_Delete( structExtension );
-   Stg_Class_Delete( arrayExtension );
-
-   ExtensionManager_Free( structExtensionCopy, nArrayCopy );
-   Stg_Class_Delete( structExtensionCopy );
-   Stg_Class_Delete( arrayExtensionCopy );
-   Stg_Class_Delete( copyMap );
-}
-
-
-void ExtensionSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ExtensionSuiteData );
-   pcu_suite_setFixtures( suite, ExtensionSuite_Setup, ExtensionSuite_Teardown );
-   pcu_suite_addTest( suite, ExtensionSuite_TestOfStruct );
-   pcu_suite_addTest( suite, ExtensionSuite_TestOfExistingObject );
-   pcu_suite_addTest( suite, ExtensionSuite_TestAddArrayToExistingObject );
-   pcu_suite_addTest( suite, ExtensionSuite_TestExtendOfExtendedArray );
-   pcu_suite_addTest( suite, ExtensionSuite_TestCopyExtendedArray );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Extensibility/tests/ExtensionSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Extensibility/tests/ExtensionSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,701 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "StGermain/Base/Container/Container.h"
+#include "StGermain/Base/Automation/Automation.h"
+#include "StGermain/Base/Extensibility/Extensibility.h"
+#include "ExtensionSuite.h"
+
+typedef struct {
+} ExtensionSuiteData;
+
+typedef struct {
+   double x;
+   double y;
+   double z;
+   char dim;
+} BaseClass;
+
+typedef struct {
+   char type;
+} ExtensionStruct0;
+const Type Type0 = "Type0";
+const Type Type1 = "Type1";
+
+typedef struct {
+   double temp;
+} ExtensionStruct1;
+const Type Temp0 = "Temp0";
+const Type Temp1 = "Temp1";
+
+typedef struct {
+   double pres;
+   char flag;
+} ExtensionStruct2;
+const Type Pres0 = "Pres0";
+const Type Pres1 = "Pres1";
+
+typedef struct {
+   char dd;
+   char cc;
+   int bc;
+} ExtensionStruct3;
+const Type BC_Set0 = "BC_Set0";
+const Type BC_Set1 = "BC_Set1";
+
+typedef struct {
+   float wf;
+} ExtensionStruct4;
+const Type Weight0 = "Weight0";
+const Type Weight1 = "Weight1";
+
+void ExtensionSuite_Setup( ExtensionSuiteData* data ) {
+}
+
+void ExtensionSuite_Teardown( ExtensionSuiteData* data ) {
+}
+
+void ExtensionSuite_TestOfStruct( ExtensionSuiteData* data ) {
+   ExtensionManager*    extensionMgr;
+   BaseClass*           nArray;
+   BaseClass*           n;
+   ExtensionStruct0*    nType0;
+   ExtensionStruct1*    nTemp0;
+   ExtensionStruct2*    nPres0;
+   ExtensionStruct3*    nBC_Set0;
+   ExtensionStruct4*    nWeight0;
+   ExtensionStruct0*    nType1;
+   ExtensionStruct1*    nTemp1;
+   ExtensionStruct2*    nPres1;
+   ExtensionStruct3*    nBC_Set1;
+   ExtensionStruct4*    nWeight1;
+   Index                ii;
+   const Index          ArraySize = 100;
+   Index                numExtensions = 0;      /* variable to check number of extensions */
+   SizeT                size0;
+   SizeT                size1;
+   SizeT                size2;
+   SizeT                size3;
+   SizeT                size4;
+
+   size0 = ExtensionManager_Align( sizeof(ExtensionStruct0) );
+   size1 = ExtensionManager_Align( sizeof(ExtensionStruct1) );
+   size2 = ExtensionManager_Align( sizeof(ExtensionStruct2) );
+   size3 = ExtensionManager_Align( sizeof(ExtensionStruct3) );
+   size4 = ExtensionManager_Align( sizeof(ExtensionStruct4) );
+
+   /* Build the extensionMgr */
+   extensionMgr = ExtensionManager_New_OfStruct( "Node", sizeof(BaseClass) );
+   ExtensionManager_Add( extensionMgr, (Name)Type0, sizeof(ExtensionStruct0)  );     numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Temp0, sizeof(ExtensionStruct1)  );     numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Pres0, sizeof(ExtensionStruct2)  );     numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)BC_Set0, sizeof(ExtensionStruct3)  );   numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Weight0, sizeof(ExtensionStruct4)  );   numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Type1, sizeof(ExtensionStruct0)  );     numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Temp1, sizeof(ExtensionStruct1)  );     numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Pres1, sizeof(ExtensionStruct2)  );     numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)BC_Set1, sizeof(ExtensionStruct3)  );   numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Weight1, sizeof(ExtensionStruct4) );   numExtensions++;
+
+   /* "Is the initial size correct" */
+   pcu_check_true( extensionMgr->initialSize == sizeof(BaseClass)  );
+
+   /* Is the first offset at the correct position */
+   pcu_check_true( ExtensionInfo_At( extensionMgr->extInfos, 0 )->offset == sizeof(BaseClass) );
+
+   /* Is the final size correct */
+   pcu_check_true( extensionMgr->finalSize == 
+         sizeof(BaseClass) + 
+         size0 + size1 + size2 + size3 + size4 +
+         size0 + size1 + size2 + size3 + size4 );
+
+   /* Is the number of extensions correct */
+   pcu_check_true( extensionMgr->extInfos->count == numExtensions );
+
+   /* Alloc, initialise and view*/
+   nArray = (BaseClass*)ExtensionManager_Malloc( extensionMgr, ArraySize );
+
+   /* Can we malloc the extension */
+   pcu_check_true( nArray != NULL );
+
+   n = (BaseClass*)ExtensionManager_At( extensionMgr, nArray, 0 );
+
+   nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nType0->type - (ArithPointer)n) == sizeof(BaseClass) );
+
+   nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nTemp0->temp - (ArithPointer)n) == sizeof(BaseClass) + size0 );
+   
+   nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );      
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nPres0->pres - (ArithPointer)n) == sizeof(BaseClass) + size0 + size1 );
+
+   nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nBC_Set0->dd - (ArithPointer)n) == sizeof(BaseClass) + size0 + size1 + size2 );
+
+   nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n,
+      ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ));
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nWeight0->wf - (ArithPointer)n) == 
+         sizeof(BaseClass) + size0 + size1 + size2 + size3 );
+
+   nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n,
+      ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nType1->type - (ArithPointer)n) == 
+         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 );
+
+   nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n,
+      ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nTemp1->temp - (ArithPointer)n) == 
+         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 );
+
+   nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n,
+      ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nPres1->pres - (ArithPointer)n) == 
+         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 + size1 );
+
+   nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n,
+      ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nBC_Set1->dd - (ArithPointer)n) == 
+         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 );
+
+   nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n,
+      ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nWeight1->wf - (ArithPointer)n) == 
+         sizeof(BaseClass) + size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 + size3 );
+
+   for( ii = 0; ii < ArraySize; ii++ ) {
+      n = (BaseClass* )ExtensionManager_At( extensionMgr, nArray, ii );
+      
+      n->x = 1.0f;
+      n->y = 2.0f;
+      n->z = 3.0f;
+      n->dim = 4;
+      
+      nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
+      nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
+      nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
+      nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
+      nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ) );
+      nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
+      nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
+      nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
+      nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
+      nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
+
+      nType0->type = 5;
+      nTemp0->temp = 6.0f;
+      nPres0->pres = 7.0f;
+      nPres0->flag = 8;
+      nBC_Set0->dd = 9;
+      nBC_Set0->cc = 10;
+      nBC_Set0->bc = 11;
+      nWeight0->wf = 12.0f;
+      nType1->type = 13;
+      nTemp1->temp = 14.0f;
+      nPres1->pres = 15.0f;
+      nPres1->flag = 16;
+      nBC_Set1->dd = 17;
+      nBC_Set1->cc = 18;
+      nBC_Set1->bc = 19;
+      nWeight1->wf = 20.0f;
+   }
+
+   for( ii = 0; ii < ArraySize; ii++ ) {
+      n = (BaseClass* )ExtensionManager_At( extensionMgr, nArray, ii );
+
+      nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
+      nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
+      nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
+      nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
+      nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ) );
+      nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
+      nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
+      nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
+      nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
+      nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
+
+      pcu_check_true( n->x == 1.0f );
+      pcu_check_true( n->y == 2.0f );
+      pcu_check_true( n->z == 3.0f );
+      pcu_check_true( n->dim == 4 );
+
+      pcu_check_true( nType0->type == 5 );
+      pcu_check_true( nTemp0->temp == 6.0f );
+      pcu_check_true( nPres0->pres == 7.0f );
+      pcu_check_true( nPres0->flag == 8 );
+      pcu_check_true( nBC_Set0->dd == 9 );
+      pcu_check_true( nBC_Set0->cc == 10 );
+      pcu_check_true( nBC_Set0->bc == 11 );
+      pcu_check_true( nWeight0->wf == 12.0f );
+      pcu_check_true( nType1->type == 13 );
+      pcu_check_true( nTemp1->temp == 14.0f );
+      pcu_check_true( nPres1->pres == 15.0f );
+      pcu_check_true( nPres1->flag == 16 );
+      pcu_check_true( nBC_Set1->dd == 17 );
+      pcu_check_true( nBC_Set1->cc == 18 );
+      pcu_check_true( nBC_Set1->bc == 19 );
+      pcu_check_true( nWeight1->wf == 20.0f  );
+   }
+   
+   /* Stg_Class_Delete stuff */
+   ExtensionManager_Free( extensionMgr, nArray );
+   Stg_Class_Delete( extensionMgr );
+}
+
+
+void ExtensionSuite_TestOfExistingObject( ExtensionSuiteData* data ) {
+   ExtensionManager*    extensionMgr;
+   BaseClass*           n;
+   ExtensionStruct0*    nType0;
+   ExtensionStruct1*    nTemp0;
+   ExtensionStruct2*    nPres0;
+   ExtensionStruct3*    nBC_Set0;
+   ExtensionStruct4*    nWeight0;
+   ExtensionStruct0*    nType1;
+   ExtensionStruct1*    nTemp1;
+   ExtensionStruct2*    nPres1;
+   ExtensionStruct3*    nBC_Set1;
+   ExtensionStruct4*    nWeight1;
+   Index                numExtensions = 0;  /* variable to check number of extensions */
+   SizeT                size0;
+   SizeT                size1;
+   SizeT                size2;
+   SizeT                size3;
+   SizeT                size4;
+
+   size0 = ExtensionManager_Align( sizeof(ExtensionStruct0) );
+   size1 = ExtensionManager_Align( sizeof(ExtensionStruct1) );
+   size2 = ExtensionManager_Align( sizeof(ExtensionStruct2) );
+   size3 = ExtensionManager_Align( sizeof(ExtensionStruct3) );
+   size4 = ExtensionManager_Align( sizeof(ExtensionStruct4) );
+
+   /* Build the extensionMgr */
+   n = Memory_Alloc_Unnamed( BaseClass );
+   extensionMgr = ExtensionManager_New_OfExistingObject( "Node", n );
+   ExtensionManager_Add( extensionMgr, (Name)Type0, sizeof(ExtensionStruct0)  );      numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Temp0, sizeof(ExtensionStruct1)  );      numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Pres0, sizeof(ExtensionStruct2)  );      numExtensions++; 
+   ExtensionManager_Add( extensionMgr, (Name)BC_Set0, sizeof(ExtensionStruct3)  );   numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Weight0, sizeof(ExtensionStruct4)  );   numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Type1, sizeof(ExtensionStruct0)  );      numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Temp1, sizeof(ExtensionStruct1)  );      numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Pres1, sizeof(ExtensionStruct2)  );      numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)BC_Set1, sizeof(ExtensionStruct3)  );   numExtensions++;
+   ExtensionManager_Add( extensionMgr, (Name)Weight1, sizeof(ExtensionStruct4) );   numExtensions++;
+
+   /* Is the initial size correct */
+   pcu_check_true( extensionMgr->initialSize == 0  );
+
+   /* Is the first offset at the correct position */
+   pcu_check_true( ExtensionInfo_At( extensionMgr->extInfos, 0 )->offset == 0 );
+
+   /* Is the final size correct */
+   pcu_check_true( extensionMgr->finalSize ==
+         size0 + size1 + size2 + size3 + size4 +
+         size0 + size1 + size2 + size3 + size4 );
+
+   /* Is the number of extensions correct */
+   pcu_check_true( extensionMgr->extInfos->count == numExtensions );
+
+   n->x = 1.0f;
+   n->y = 2.0f;
+   n->z = 3.0f;
+   n->dim = 4;
+   
+   nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
+   /* Is offset correct */
+   pcu_check_true( ((ArithPointer)&nType0->type - (ArithPointer)extensionMgr->_extensionsToExisting) ==  0 );
+   nType0->type = 5;
+   
+   nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nTemp0->temp - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 );
+   nTemp0->temp = 6.0f;
+   
+   nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nPres0->pres - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+              size0 + size1 );
+   nPres0->pres = 7.0f;
+   nPres0->flag = 8;
+   
+   nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nBC_Set0->dd - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 );
+   nBC_Set0->dd = 9;
+   nBC_Set0->cc = 10;
+   nBC_Set0->bc = 11;
+   
+   nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight0" ) );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nWeight0->wf - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 + size3 );
+   nWeight0->wf = 12.0f;
+   
+   nType1 = (ExtensionStruct0* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Type1" ) );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nType1->type - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 + size3 + size4 );
+   nType1->type = 13;
+   
+   nTemp1 = (ExtensionStruct1* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Temp1" ) );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nTemp1->temp - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 + size3 + size4 + size0 );
+   nTemp1->temp = 14.0f;
+   
+   nPres1 = (ExtensionStruct2* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Pres1" ) );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nPres1->pres - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 + size3 + size4 + size0 + size1 );
+   nPres1->pres = 15.0f;
+   nPres1->flag = 16;
+   
+   nBC_Set1 = (ExtensionStruct3* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"BC_Set1" ) );
+   /* Is offset correct */
+   pcu_check_true(
+      ((ArithPointer)&nBC_Set1->dd - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 );
+   nBC_Set1->dd = 17;
+   nBC_Set1->cc = 18;
+   nBC_Set1->bc = 19;
+   
+   /* Is offset correct */
+   nWeight1 = (ExtensionStruct4* )ExtensionManager_Get( extensionMgr, n, ExtensionManager_GetHandle( extensionMgr, (Name)"Weight1" ) );
+   pcu_check_true(
+      ((ArithPointer)&nWeight1->wf - (ArithPointer)extensionMgr->_extensionsToExisting) ==
+         size0 + size1 + size2 + size3 + size4 + size0 + size1 + size2 + size3  );
+
+   nWeight1->wf = 20.0f;
+   
+   /* Now check we can get them all over again, and read the values correctly */
+   nType0 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 0 );
+   nTemp0 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 1 );
+   nPres0 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 2 );
+   nBC_Set0 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 3 );
+   nWeight0 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, 4 );
+   nType1 = (ExtensionStruct0*)ExtensionManager_Get( extensionMgr, n, 5 );
+   nTemp1 = (ExtensionStruct1*)ExtensionManager_Get( extensionMgr, n, 6 );
+   nPres1 = (ExtensionStruct2*)ExtensionManager_Get( extensionMgr, n, 7 );
+   nBC_Set1 = (ExtensionStruct3*)ExtensionManager_Get( extensionMgr, n, 8 );
+   nWeight1 = (ExtensionStruct4*)ExtensionManager_Get( extensionMgr, n, 9 );
+   pcu_check_true( n->x == 1.0f );
+   pcu_check_true( n->y == 2.0f );
+   pcu_check_true( n->z == 3.0f );
+   pcu_check_true( n->dim == 4 );
+   pcu_check_true( nType0->type == 5 );
+   pcu_check_true( nTemp0->temp == 6.0f );
+   pcu_check_true( nPres0->pres == 7.0f );
+   pcu_check_true( nPres0->flag == 8 );
+   pcu_check_true( nBC_Set0->dd == 9 );
+   pcu_check_true( nBC_Set0->cc == 10 );
+   pcu_check_true( nBC_Set0->bc == 11 );
+   pcu_check_true( nWeight0->wf == 12.0f );
+   pcu_check_true( nType1->type == 13 );
+   pcu_check_true( nTemp1->temp == 14.0f );
+   pcu_check_true( nPres1->pres == 15.0f );
+   pcu_check_true( nPres1->flag == 16 );
+   pcu_check_true( nBC_Set1->dd == 17 );
+   pcu_check_true( nBC_Set1->cc == 18 );
+   pcu_check_true( nBC_Set1->bc == 19 );
+   pcu_check_true( nWeight1->wf == 20.0f );
+
+   /* Stg_Class_Delete stuff */
+   Stg_Class_Delete( extensionMgr );
+   Memory_Free( n );
+}
+
+
+void ExtensionSuite_TestAddArrayToExistingObject( ExtensionSuiteData* data ) {
+   ExtensionManager*    objExtension=NULL;
+   BaseClass*           baseObject=NULL;
+   Index                ii=0;
+   ExtensionStruct0*    objType0=NULL;
+   ExtensionStruct1*    objTemp0=NULL;
+
+   baseObject = Memory_Alloc( BaseClass, "BaseObject" );
+   objExtension = ExtensionManager_New_OfExistingObject( "obj", baseObject );
+
+   ExtensionManager_Add( objExtension, (Name)Type0, sizeof(ExtensionStruct0)  );
+   ExtensionManager_AddArray( objExtension, Temp0, sizeof(ExtensionStruct1), 10 );
+   
+   {
+      objType0 = (ExtensionStruct0*)ExtensionManager_Get(
+         objExtension, 
+         baseObject, 
+         ExtensionManager_GetHandle( objExtension, (Name)"Type0" ) );
+      
+      objTemp0 = (ExtensionStruct1* )ExtensionManager_Get( 
+         objExtension, 
+         baseObject, 
+         ExtensionManager_GetHandle( objExtension, (Name)"Temp0" ) );
+
+      objType0->type = 'a';
+      for ( ii = 0; ii < 10; ++ii ) {
+         objTemp0[ii].temp = (double)ii;
+      }
+   }
+
+   objTemp0 = (ExtensionStruct1* )ExtensionManager_Get( 
+      objExtension, 
+      baseObject, 
+      ExtensionManager_GetHandle( objExtension, (Name)"Temp0" ) );
+
+   for ( ii = 0; ii < 10; ++ii ) {
+      pcu_check_true( objTemp0[ii].temp == ii );
+   }
+
+   Memory_Free( baseObject );
+   Stg_Class_Delete( objExtension );
+}
+
+
+void ExtensionSuite_TestExtendOfExtendedArray( ExtensionSuiteData* data  ) {
+   ExtensionManager*       structExtension=NULL;
+   ExtensionManager*       arrayExtension=NULL;
+   BaseClass*              nArray=NULL;
+   BaseClass*              current=NULL;
+   ExtensionStruct0*       nType0=NULL;
+   ExtensionStruct1*       nTemp0=NULL;
+   ExtensionStruct2*       nPres0=NULL;
+   Index                   array_I=0;
+   const Index             ArraySize = 8;
+   Index                   ii=0;
+
+   structExtension = ExtensionManager_New_OfStruct( "Node", sizeof(BaseClass) );
+
+   ExtensionManager_Add( structExtension, (Name)Type0, sizeof(ExtensionStruct0)  );
+   ExtensionManager_AddArray( structExtension, Temp0, sizeof(ExtensionStruct1), 10 );
+   
+   nArray = (BaseClass*)ExtensionManager_Malloc( structExtension, ArraySize );
+
+   /* Testing "Simple" extension on allocated extended struct */
+   arrayExtension = ExtensionManager_New_OfExtendedArray( "Ext", nArray, structExtension, ArraySize );
+
+   /* Since the nArray is already allocated, this function should realloc it to put the extended array
+    * at the end */
+   ExtensionManager_Add( arrayExtension, (Name)Pres0, sizeof(ExtensionStruct2) );
+
+   for ( array_I = 0; array_I < ArraySize; ++array_I  ) {
+     current = (BaseClass*)ExtensionManager_At( structExtension, nArray, array_I );
+
+      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
+         structExtension,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
+      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
+         structExtension,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
+
+      nType0->type = 'a';
+      for ( ii = 0; ii < 10; ++ii ) {
+         nTemp0[ii].temp = (double)((array_I * 10) + ii);
+      }
+      
+      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
+         arrayExtension,
+         ExtensionManager_At( arrayExtension, nArray, array_I ),
+         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
+      
+      nPres0->pres = (double)array_I;
+      nPres0->flag = 'b';
+   }
+   
+   for ( array_I = 0; array_I < ArraySize; ++array_I  ) {
+     current = (BaseClass*)ExtensionManager_At( structExtension, nArray, array_I );
+      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
+         structExtension,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
+      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
+         structExtension,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
+
+      pcu_check_true( nType0->type == 'a' );
+      for ( ii = 0; ii < 10; ++ii ) {
+         pcu_check_true( nTemp0[ii].temp == (double)((array_I * 10) + ii) );
+      }
+
+      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
+         arrayExtension,
+         ExtensionManager_At( arrayExtension, nArray, array_I ),
+         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
+   
+      pcu_check_true( nPres0->pres == (double)array_I );
+      pcu_check_true( nPres0->flag == 'b'  );
+   }
+
+   ExtensionManager_Free( structExtension, nArray );
+
+   Stg_Class_Delete( structExtension );
+   Stg_Class_Delete( arrayExtension );
+}
+
+
+void ExtensionSuite_TestCopyExtendedArray( ExtensionSuiteData* data ) {
+   ExtensionManager*       structExtension=NULL;
+   ExtensionManager*       arrayExtension=NULL;
+   BaseClass*              nArray=NULL;
+   BaseClass*              current=NULL;
+   ExtensionStruct0*       nType0=NULL;
+   ExtensionStruct1*       nTemp0=NULL;
+   ExtensionStruct2*       nPres0=NULL;
+   Index                   array_I=0;
+   const Index             ArraySize = 8;
+   Index                   ii=0;
+   ExtensionManager*       structExtensionCopy=NULL;
+   ExtensionManager*       arrayExtensionCopy=NULL;
+   BaseClass*              nArrayCopy=NULL;
+   PtrMap*                 copyMap=NULL;
+
+   structExtension = ExtensionManager_New_OfStruct( "Node", sizeof(BaseClass) );
+
+   ExtensionManager_Add( structExtension, (Name)Type0, sizeof(ExtensionStruct0)  );
+   ExtensionManager_AddArray( structExtension, Temp0, sizeof(ExtensionStruct1), 10 );
+   
+   nArray = (BaseClass*)ExtensionManager_Malloc( structExtension, ArraySize );
+
+   /* Testing "Simple" extension on allocated extended struct */
+   arrayExtension = ExtensionManager_New_OfExtendedArray( "Ext", nArray, structExtension, ArraySize );
+
+   /* Since the nArray is already allocated, this function should realloc it to put the extended array
+    * at the end */
+   ExtensionManager_Add( arrayExtension, (Name)Pres0, sizeof(ExtensionStruct2) );
+
+   for ( array_I = 0; array_I < ArraySize; ++array_I  ) {
+     current = (BaseClass*)ExtensionManager_At( structExtension, nArray, array_I );
+
+      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
+         structExtension,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
+      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
+         structExtension,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
+
+      nType0->type = 'a';
+      for ( ii = 0; ii < 10; ++ii ) {
+         nTemp0[ii].temp = (double)((array_I * 10) + ii);
+      }
+      
+      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
+         arrayExtension,
+         ExtensionManager_At( arrayExtension, nArray, array_I ),
+         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
+      
+      nPres0->pres = (double)array_I;
+      nPres0->flag = 'b';
+   }
+
+   /* Copy time! */
+   
+   copyMap = PtrMap_New( 1  );
+   arrayExtensionCopy = (ExtensionManager*)Stg_Class_Copy( arrayExtension, NULL, True, "_dup", copyMap );
+   structExtensionCopy = (ExtensionManager*)Stg_Class_Copy( structExtension, NULL, True, "_dup", copyMap );
+   nArrayCopy = (BaseClass*)PtrMap_Find( copyMap, arrayExtension->_array );
+
+   pcu_check_true( nArrayCopy != NULL && nArrayCopy == arrayExtensionCopy->_array );
+
+   for ( array_I = 0; array_I < ArraySize; ++array_I ) {
+     current = (BaseClass*)ExtensionManager_At( arrayExtensionCopy, nArrayCopy, array_I );
+
+      nType0 = (ExtensionStruct0*)ExtensionManager_Get(
+         arrayExtensionCopy,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Type0" ) );
+      nTemp0 = (ExtensionStruct1* )ExtensionManager_Get(
+         arrayExtensionCopy,
+         current,
+         ExtensionManager_GetHandle( structExtension, (Name)"Temp0" ) );
+   
+      pcu_check_true( nType0->type == 'a' );
+      for ( ii = 0; ii < 10; ++ii ) {
+         pcu_check_true( nTemp0[ii].temp == (double)((array_I * 10) + ii) );
+      }
+
+      nPres0 = (ExtensionStruct2* )ExtensionManager_Get(
+         arrayExtension,
+         ExtensionManager_At( arrayExtension, nArray, array_I ),
+         ExtensionManager_GetHandle( arrayExtension, (Name)"Pres0" ) );
+   
+      pcu_check_true( nPres0->pres == (double)array_I );
+      pcu_check_true( nPres0->flag == 'b'  );
+   }
+
+   ExtensionManager_Free( structExtension, nArray );
+   Stg_Class_Delete( structExtension );
+   Stg_Class_Delete( arrayExtension );
+
+   ExtensionManager_Free( structExtensionCopy, nArrayCopy );
+   Stg_Class_Delete( structExtensionCopy );
+   Stg_Class_Delete( arrayExtensionCopy );
+   Stg_Class_Delete( copyMap );
+}
+
+
+void ExtensionSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ExtensionSuiteData );
+   pcu_suite_setFixtures( suite, ExtensionSuite_Setup, ExtensionSuite_Teardown );
+   pcu_suite_addTest( suite, ExtensionSuite_TestOfStruct );
+   pcu_suite_addTest( suite, ExtensionSuite_TestOfExistingObject );
+   pcu_suite_addTest( suite, ExtensionSuite_TestAddArrayToExistingObject );
+   pcu_suite_addTest( suite, ExtensionSuite_TestExtendOfExtendedArray );
+   pcu_suite_addTest( suite, ExtensionSuite_TestCopyExtendedArray );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/FlattenXML/src/main.c
--- a/Base/FlattenXML/src/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	David May, PhD Student Monash University, VPAC. (davidm at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**	Reads an XML file (potentially with includes) and then outputs as a single file
-**
-** $Id: main.c 190 2005-06-20 04:56:57Z RobertTurnbull $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <mpi.h>
-
-#include "StGermain/Base/Base.h"
-
-#define OUTPUT_FILE_FLAG "-output_file="
-#define DEFAULT_OUTPUT_FILE "./output.xml"
-
-int main( int argc, char* argv[] ) 
-{
-	Dictionary*			dictionary;
-	XML_IO_Handler*			ioHandler;
-	Stream*				msgs;
-
-	char* 				outputFilename=NULL;
-
-	int ii;
-
-	MPI_Init( &argc, &argv );
-	if( !StGermainBase_Init( &argc, &argv ) ) {
-		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
-		exit( EXIT_FAILURE );
-	}
-	msgs = Journal_Register( Info_Type, "Messages" );
-	
-	for( ii = 0; ii < argc; ++ii ) {
-		if ( strstr( argv[ii], OUTPUT_FILE_FLAG ) == argv[ii] ) {
-			outputFilename = argv[ii] + strlen( OUTPUT_FILE_FLAG );
-			if ( strlen( outputFilename ) < 1 ) {
-				Journal_Printf( msgs, "Invalid outputfile name: %s\n", outputFilename );
-				Journal_Printf( msgs, "Exiting...\n" );
-				StGermainBase_Finalise();
-				return 1;
-			}
-			argv[ii][0] = '\0'; /* remove it from the arg list */
-		}
-	}
-
-	dictionary = Dictionary_New();
-
-	/* Read input */
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-
-	IO_Handler_WriteAllToFile( ioHandler,
-                                   outputFilename!=NULL ? outputFilename :
-                                   DEFAULT_OUTPUT_FILE,
-                                   dictionary );
-
-	Stg_Class_Delete( dictionary );
-	Stg_Class_Delete( ioHandler );
-
-	StGermainBase_Finalise();
-	MPI_Finalize();
-
-	return 0; /* success */
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/FlattenXML/src/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/FlattenXML/src/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,96 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student Monash University, VPAC. (davidm at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**	Reads an XML file (potentially with includes) and then outputs as a single file
+**
+** $Id: main.c 190 2005-06-20 04:56:57Z RobertTurnbull $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <mpi.h>
+
+#include "StGermain/Base/Base.h"
+
+#define OUTPUT_FILE_FLAG "-output_file="
+#define DEFAULT_OUTPUT_FILE "./output.xml"
+
+int main( int argc, char* argv[] ) 
+{
+	Dictionary*			dictionary;
+	XML_IO_Handler*			ioHandler;
+	Stream*				msgs;
+
+	char* 				outputFilename=NULL;
+
+	int ii;
+
+	MPI_Init( &argc, &argv );
+	if( !StGermainBase_Init( &argc, &argv ) ) {
+		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
+		exit( EXIT_FAILURE );
+	}
+	msgs = Journal_Register( Info_Type, "Messages" );
+	
+	for( ii = 0; ii < argc; ++ii ) {
+		if ( strstr( argv[ii], OUTPUT_FILE_FLAG ) == argv[ii] ) {
+			outputFilename = argv[ii] + strlen( OUTPUT_FILE_FLAG );
+			if ( strlen( outputFilename ) < 1 ) {
+				Journal_Printf( msgs, "Invalid outputfile name: %s\n", outputFilename );
+				Journal_Printf( msgs, "Exiting...\n" );
+				StGermainBase_Finalise();
+				return 1;
+			}
+			argv[ii][0] = '\0'; /* remove it from the arg list */
+		}
+	}
+
+	dictionary = Dictionary_New();
+
+	/* Read input */
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+
+	IO_Handler_WriteAllToFile( ioHandler,
+                                   outputFilename!=NULL ? outputFilename :
+                                   DEFAULT_OUTPUT_FILE,
+                                   dictionary );
+
+	Stg_Class_Delete( dictionary );
+	Stg_Class_Delete( ioHandler );
+
+	StGermainBase_Finalise();
+	MPI_Finalize();
+
+	return 0; /* success */
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Class.c
--- a/Base/Foundation/src/Class.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 4081 2007-04-27 06:20:07Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "MemoryTag.h"
-#include "Memory.h"
-#include "Class.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Stg_Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Textual name of this class */
-const Type Stg_Class_Type = "Stg_Class";
-
-
-Stg_Class* _Stg_Class_New( SizeT _sizeOfSelf, 
-		Type				type, 
-		Stg_Class_DeleteFunction*	_delete, 
-		Stg_Class_PrintFunction*	_print, 
-		Stg_Class_CopyFunction*		_copy )
-{
-	Stg_Class*		self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stg_Class) );
-	self = (Stg_Class*)Memory_Alloc_Bytes_Unnamed( _sizeOfSelf, type );
-	memset( self, 0, _sizeOfSelf );
-	self->_sizeOfSelf = _sizeOfSelf;
-	self->_deleteSelf = True;
-
-	/* Init count to for this pointer to one. */
-	Memory_CountInc( self );
-	
-	/* General info */
-	self->type = type;
-	
-	/* Virtual functions */
-	self->_delete = _delete;
-	self->_print = _print;
-	self->_copy = _copy;
-	
-	/* Stg_Class info */
-	_Stg_Class_Init( self );
-	
-	return self;
-}
-
-
-
-void _Stg_Class_Init( Stg_Class* self ) {
-	/* General and Virtual info should already be set */
-	
-	/* Stg_Class info */
-	self->nRefs = 0;
-}
-
-void Stg_Class_Delete( void* _class ) {
-	Stg_Class* self = (Stg_Class*)_class;
-	self->_delete( _class );
-}
-
-void _Stg_Class_Delete( void* _class ) {
-	Stg_Class* self = (Stg_Class*)_class;
-	
-	if( self->_deleteSelf ) {
-		Memory_CountDec( self );
-
-      Memory_Free( self );
-		if ( Memory_CountGet( self ) <= 0 ) {
-			//Memory_Free( self );
-		}
-	}
-}
-
-void Stg_Class_Print( void* _class, struct Stream* stream ) {
-	Stg_Class* self = (Stg_Class*)_class;
-	self->_print( _class, stream );
-}
-
-void _Stg_Class_Print( void* _class, struct Stream* stream ) {
-	Stg_Class* self = (Stg_Class*)_class;
-	
-	Journal_Firewall( stream!=NULL, stream, "Attempting to Print to stream that is NULL\n" );
-	Journal_Firewall( self!=NULL, stream, "Attempting to Print class that is NULL\n" );
-	
-	Journal_Printf( stream, "Stg_Class (ptr): %p\n", self );
-	Stream_Indent( stream );
-	Journal_Printf( stream, "_sizeOfSelf: %lu\n", self->_sizeOfSelf );
-	Journal_Printf( stream, "_deleteSelf: %s\n", self->_deleteSelf ? "Yes" : "No" );
-	Journal_Printf( stream, "type: %s\n", self->type == Type_Invalid ? "Invalid" : self->type );
-	Journal_Printf( stream, "_delete (func ptr): %p\n", self->_delete );
-	Journal_Printf( stream, "_print (func ptr): %p\n", self->_print );
-	Journal_Printf( stream, "_copy (func ptr): %p\n", self->_copy );
-	Stream_UnIndent( stream );
-}
-
-void* Stg_Generic_Copy( 
-	Stg_Class_CopyFunction* copyFunc,
-	const void* obj, 
-	void* dest, 
-	Bool deep, 
-	Name nameExt, 
-	struct PtrMap* ptrMap ) 
-{
-	void*		newObj;
-	Bool		ownPtrMap = False;
-
-	if ( obj == NULL ) {
-		return NULL;
-	}
-
-	if ( copyFunc == NULL ) {
-		/* TODO: change to Journal */
-		printf( "Warning: attempting to copy a class with no copy method, return 'self'.\n" );
-		return (void*)obj;
-	}
-
-	if( !ptrMap ) {
-		ptrMap = PtrMap_New( 1 );
-		ownPtrMap = True;
-	}
-	
-	if ( (newObj = PtrMap_Find( ptrMap, obj )) == NULL ) {
-		newObj = copyFunc( obj, dest, deep, nameExt, ptrMap );
-	}
-
-	if ( newObj != dest ) {
-		/* Whether this is a new instance existing ptr map fetch, inc the counter because its being used again */
-		/* But only do it when its not a destination copy because we can't assume that it is a single dynamic obj */
-		Memory_CountInc( newObj );
-	}
-
-	if ( ownPtrMap && ptrMap ) {
-		Stg_Class_Delete( ptrMap );
-	}
-	
-	return (void*)newObj;
-}
-
-void* Stg_Class_Copy( const void* clss, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_Class* self = (Stg_Class*)clss;
-	
-	if ( !self ) {
-		return NULL;
-	}
-	if ( !self->_copy ) {
-		return NULL;
-	}
-
-	return Stg_Generic_Copy( self->_copy, clss, dest, deep, nameExt, ptrMap );
-}
-
-void* _Stg_Class_Copy( const void* _class, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_Class*	self = (Stg_Class*)_class;
-	Stg_Class*	newClass;
-	
-	if( !dest ) {
-		newClass = (Stg_Class*)Memory_Alloc_Bytes_Unnamed( self->_sizeOfSelf, self->type );
-	}
-	else {
-		newClass = (Stg_Class*)dest;
-	}
-	PtrMap_Append( ptrMap, self, newClass );
-	
-	newClass->_sizeOfSelf = self->_sizeOfSelf;
-	newClass->_deleteSelf = self->_deleteSelf;
-	newClass->type = self->type;
-	newClass->_delete = self->_delete;
-	newClass->_print = self->_print;
-	newClass->_copy = self->_copy;
-	newClass->nRefs = self->nRefs;
-	
-	return (void*)newClass;
-}
-
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-Type Stg_Class_GetTypeFunc( void* _class ) {
-	Stg_Class* self = (Stg_Class*)_class;
-	
-	return Stg_Class_GetTypeMacro( self );
-}
-
-
-void Stg_Class_AddRef( void* _class ) {
-	Stg_Class*	self = (Stg_Class*)_class;
-
-	assert( self );
-
-	self->nRefs++;
-}
-
-void Stg_Class_RemoveRef( void* _class ) {
-	Stg_Class*	self = (Stg_Class*)_class;
-
-	assert( self );
-
-	if( !(--self->nRefs) )
-		Stg_Class_Delete( self );
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Class.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Class.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,241 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 4081 2007-04-27 06:20:07Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "MemoryTag.h"
+#include "Memory.h"
+#include "Class.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Stg_Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Textual name of this class */
+const Type Stg_Class_Type = "Stg_Class";
+
+
+Stg_Class* _Stg_Class_New( SizeT _sizeOfSelf, 
+		Type				type, 
+		Stg_Class_DeleteFunction*	_delete, 
+		Stg_Class_PrintFunction*	_print, 
+		Stg_Class_CopyFunction*		_copy )
+{
+	Stg_Class*		self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stg_Class) );
+	self = (Stg_Class*)Memory_Alloc_Bytes_Unnamed( _sizeOfSelf, type );
+	memset( self, 0, _sizeOfSelf );
+	self->_sizeOfSelf = _sizeOfSelf;
+	self->_deleteSelf = True;
+
+	/* Init count to for this pointer to one. */
+	Memory_CountInc( self );
+	
+	/* General info */
+	self->type = type;
+	
+	/* Virtual functions */
+	self->_delete = _delete;
+	self->_print = _print;
+	self->_copy = _copy;
+	
+	/* Stg_Class info */
+	_Stg_Class_Init( self );
+	
+	return self;
+}
+
+
+
+void _Stg_Class_Init( Stg_Class* self ) {
+	/* General and Virtual info should already be set */
+	
+	/* Stg_Class info */
+	self->nRefs = 0;
+}
+
+void Stg_Class_Delete( void* _class ) {
+	Stg_Class* self = (Stg_Class*)_class;
+	self->_delete( _class );
+}
+
+void _Stg_Class_Delete( void* _class ) {
+	Stg_Class* self = (Stg_Class*)_class;
+	
+	if( self->_deleteSelf ) {
+		Memory_CountDec( self );
+
+      Memory_Free( self );
+		if ( Memory_CountGet( self ) <= 0 ) {
+			//Memory_Free( self );
+		}
+	}
+}
+
+void Stg_Class_Print( void* _class, struct Stream* stream ) {
+	Stg_Class* self = (Stg_Class*)_class;
+	self->_print( _class, stream );
+}
+
+void _Stg_Class_Print( void* _class, struct Stream* stream ) {
+	Stg_Class* self = (Stg_Class*)_class;
+	
+	Journal_Firewall( stream!=NULL, stream, "Attempting to Print to stream that is NULL\n" );
+	Journal_Firewall( self!=NULL, stream, "Attempting to Print class that is NULL\n" );
+	
+	Journal_Printf( stream, "Stg_Class (ptr): %p\n", self );
+	Stream_Indent( stream );
+	Journal_Printf( stream, "_sizeOfSelf: %lu\n", self->_sizeOfSelf );
+	Journal_Printf( stream, "_deleteSelf: %s\n", self->_deleteSelf ? "Yes" : "No" );
+	Journal_Printf( stream, "type: %s\n", self->type == Type_Invalid ? "Invalid" : self->type );
+	Journal_Printf( stream, "_delete (func ptr): %p\n", self->_delete );
+	Journal_Printf( stream, "_print (func ptr): %p\n", self->_print );
+	Journal_Printf( stream, "_copy (func ptr): %p\n", self->_copy );
+	Stream_UnIndent( stream );
+}
+
+void* Stg_Generic_Copy( 
+	Stg_Class_CopyFunction* copyFunc,
+	const void* obj, 
+	void* dest, 
+	Bool deep, 
+	Name nameExt, 
+	struct PtrMap* ptrMap ) 
+{
+	void*		newObj;
+	Bool		ownPtrMap = False;
+
+	if ( obj == NULL ) {
+		return NULL;
+	}
+
+	if ( copyFunc == NULL ) {
+		/* TODO: change to Journal */
+		printf( "Warning: attempting to copy a class with no copy method, return 'self'.\n" );
+		return (void*)obj;
+	}
+
+	if( !ptrMap ) {
+		ptrMap = PtrMap_New( 1 );
+		ownPtrMap = True;
+	}
+	
+	if ( (newObj = PtrMap_Find( ptrMap, obj )) == NULL ) {
+		newObj = copyFunc( obj, dest, deep, nameExt, ptrMap );
+	}
+
+	if ( newObj != dest ) {
+		/* Whether this is a new instance existing ptr map fetch, inc the counter because its being used again */
+		/* But only do it when its not a destination copy because we can't assume that it is a single dynamic obj */
+		Memory_CountInc( newObj );
+	}
+
+	if ( ownPtrMap && ptrMap ) {
+		Stg_Class_Delete( ptrMap );
+	}
+	
+	return (void*)newObj;
+}
+
+void* Stg_Class_Copy( const void* clss, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_Class* self = (Stg_Class*)clss;
+	
+	if ( !self ) {
+		return NULL;
+	}
+	if ( !self->_copy ) {
+		return NULL;
+	}
+
+	return Stg_Generic_Copy( self->_copy, clss, dest, deep, nameExt, ptrMap );
+}
+
+void* _Stg_Class_Copy( const void* _class, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_Class*	self = (Stg_Class*)_class;
+	Stg_Class*	newClass;
+	
+	if( !dest ) {
+		newClass = (Stg_Class*)Memory_Alloc_Bytes_Unnamed( self->_sizeOfSelf, self->type );
+	}
+	else {
+		newClass = (Stg_Class*)dest;
+	}
+	PtrMap_Append( ptrMap, self, newClass );
+	
+	newClass->_sizeOfSelf = self->_sizeOfSelf;
+	newClass->_deleteSelf = self->_deleteSelf;
+	newClass->type = self->type;
+	newClass->_delete = self->_delete;
+	newClass->_print = self->_print;
+	newClass->_copy = self->_copy;
+	newClass->nRefs = self->nRefs;
+	
+	return (void*)newClass;
+}
+
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+Type Stg_Class_GetTypeFunc( void* _class ) {
+	Stg_Class* self = (Stg_Class*)_class;
+	
+	return Stg_Class_GetTypeMacro( self );
+}
+
+
+void Stg_Class_AddRef( void* _class ) {
+	Stg_Class*	self = (Stg_Class*)_class;
+
+	assert( self );
+
+	self->nRefs++;
+}
+
+void Stg_Class_RemoveRef( void* _class ) {
+	Stg_Class*	self = (Stg_Class*)_class;
+
+	assert( self );
+
+	if( !(--self->nRefs) )
+		Stg_Class_Delete( self );
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/CommonRoutines.c
--- a/Base/Foundation/src/CommonRoutines.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: CommonRoutines.c 2276 2004-11-04 02:01:18Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "types.h"
-#include "forwardDecl.h"
-                                                                                                                                    
-#include "MemoryField.h"
-#include "MemoryPointer.h"
-#include "Memory.h"
-#include "shortcuts.h"
-                                                                                                                                    
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <ctype.h>
-#include <math.h>
-
-Name StG_BoolToStringMap[2] = { "False", "True" };
-
-
-double StG_RoundDoubleToNSigFigs( double value, unsigned int nSigFigs ) {
-	double divisorPower;
-	double sign = 1.0;
-	double toleranceAroundZero = 1e-60;
-
-	assert( nSigFigs >= 1 );
-	
-	/* Log goes to infinity at 0. Hence, we have to give up rounding if it gets too small */
-	if ( (value > (0.0 - toleranceAroundZero)) && (value < (0.0 + toleranceAroundZero)) ) {
-		return value;
-	}	
-	
-	/* Since logs can't deal with negatives, need to save the sign */
-	if ( value < 0 ) {
-		sign = -1.0;
-		value = fabs(value);
-	}
-
-	/* Since interested in significant figures, need to work out the number of 
-	zeros in the answer */
-	divisorPower = log10( value );
-	divisorPower = floor( divisorPower );
-
-	/* We now have the divisorPower to use if nSigFigs == 1. So adjust if this isn't
-	the case */
-	divisorPower -= ( nSigFigs - 1 );
-
-	/* Similar approach to the decimal places rounder from here, except we use
-	the divisorPower we've just calculated */
-	return sign * floor( value / pow( 10., divisorPower ) + 0.5 ) * pow(10., divisorPower);
-}
-
-
-double StG_RoundDoubleToNDecimalPlaces( double value, unsigned int nDecimalPlaces ) {
-	return floor( value * pow(10., nDecimalPlaces) + .5) / pow(10., nDecimalPlaces);
-}
-
-
-unsigned int StG_IntegerLength( int number ) {
-	int tmpNumber;
-	int numDigits;
-	Bool isNegative;
-
-	tmpNumber = abs( number );
-	numDigits = 0;
-	isNegative = ( number < 0 ) ? True : False;
-	
-	do {
-		++numDigits;
-		tmpNumber /= 10; /* Base 10 */
-	} while ( tmpNumber > 0 );
-
-	if ( isNegative )
-		++numDigits;
-
-	return numDigits;
-}
-	
-
-
-char* StG_Strdup( Name const str ) {
-	int length;
-	char* result;
-
-        if( !str ) return NULL;
-	length = strlen( str ) + 1;
-	result = Memory_Alloc_Array_Unnamed( char, length );
-
-	strcpy( result, str );
-
-	return result;
-}
-
-
-int Stg_vasprintf( char** string, Name format, va_list ap ) {
-	int       allocStringSize = 100;
-	int       sizeOfString;
-
-	va_list   apCopy;
-
-	Bool      trying = True;
-
-	/* Allocate Memory For String */
-	*string = Memory_Alloc_Array( char, allocStringSize, "string" );
-
-	while ( trying ) {
-		/* See is we can print to this string with this size */
-#ifdef NO_VA_COPY
-                apCopy=ap;
-#else
-		va_copy( apCopy, ap );
-#endif
-		sizeOfString = vsnprintf( *string, allocStringSize, format, apCopy );
-		va_end( apCopy );
-
-		/* Check if string was truncated */
-		if ( sizeOfString > -1 && sizeOfString < allocStringSize ) {
-			return sizeOfString;
-		}
-		/* String was truncated - resize array and try again */
-		if ( sizeOfString > -1 ) {
-			/* glibc > 2.1 */
-			allocStringSize = sizeOfString + 1;
-		}
-		else {
-			/* glibc <= 2.0 */
-			allocStringSize = sizeOfString * 2;
-		}
-		*string = Memory_Realloc_Array( *string, char, allocStringSize );
-		if ( string == NULL ) {
-			#ifdef DEBUG
-				assert( string != NULL );
-			#endif
-			trying = False;
-		}
-	}
-		
-	return sizeOfString;
-}
-
-
-int Stg_asprintf( char** string, Name format, ... ) {
-	int       sizeOfString;
-	va_list   ap;
-	
-	va_start( ap, format );
-	sizeOfString = Stg_vasprintf( string, format, ap ) ;
-	va_end( ap );
-
-	return sizeOfString;
-}
-
-Bool Stg_StringIsEmpty( Name string ) {
-	size_t     length;
-	const char whiteSpaceChars[] = " \t\n";
-
-	if ( string == NULL ) 
-		return True;
-	
-	/* Check if the length is Zero */
-	length = strlen( string );
-	if ( length == 0 )
-		return True;
-
-	/* Check if there are only white space characters */
-	if ( length == strspn( string, whiteSpaceChars ) )
-		return True;
-
-	return False;
-}
-
-Bool Stg_StringIsNumeric( Name string ) {
-	size_t         length;
-	Index          char_I;
-	char           ch;
-	unsigned int   eCount            = 0;
-	unsigned int   decimalPointCount = 0;
-	unsigned int   digitCount        = 0;
-
-	if ( string == NULL ) 
-		return False;
-
-	length = strlen( string );
-	if ( length == 0 ) 
-		return False;
-
-	/* The conversion of HUGE_VAL by printf is 'inf' which requires this line to 
-	 * pick up that this is actually a numerical string */
-	if ( strcmp( string, "-inf" ) == 0 || strcmp( string, "inf" ) == 0  )
-		return True;
-
-	for ( char_I = 0 ; char_I < length ; char_I++ ) {
-		ch = string[ char_I ];
-
-		/* Check for digits from 0 - 9 */
-		if ( isdigit( ch ) ) {
-			digitCount++;
-			continue;
-		}
-
-		/* Check for 'e' or 'E' for scientific notation - only one allowed */
-		if ( ( ch == 'e' || ch == 'E' ) && eCount == 0 ) {
-			eCount++;
-
-			/* Reset counters because another number is allowed */
-			decimalPointCount = 0;
-			digitCount        = 0;
-			continue;
-		}
-		
-		/* Check for decimal point - one allowed before 'e' and one allowed after 'e' */
-		if ( ch == '.' && decimalPointCount == 0 ) {
-			decimalPointCount++;
-			continue;
-		}
-
-		/* Check for plus for minus sign - only allowed at beginning of number */
-		if ( (ch == '+' || ch == '-') && (digitCount == 0 && decimalPointCount == 0) )
-			continue;
-
-		return False;
-	}
-
-	/* If all chars pass - then return happy */
-	return True;
-}
-
-/** This function calculates the of the longest matching subsequence between string1 and string2.
- *  A subsequence of a string is when all the characters of the subsequence appear in order within the string,
- *  but possibly with gaps between occurrences of each character. */
-unsigned int Stg_LongestMatchingSubsequenceLength( Name string1, const char* string2, Bool caseSensitive ) {
-	size_t         stringLength1 = strlen( string1 );
-	size_t         stringLength2 = strlen( string2 );
-	unsigned int** lmsArray;
-	Index          charString1_I;
-	Index          charString2_I;
-	char           charString1;
-	char           charString2;
-	Bool           areEqual;
-	unsigned int   lmsLength;
-
-	/* This array 'lmsArray' is defined as follows: 
-	 * lmsArray[i][j] = the length of the longest matching subsequence in string1[ 0 ... (i-1) ] and string[ 0 ... (j-1) ]
-	 * lmsArray[0][j] and lmsArray[i][0] are initialised to zero for all i, j */
-	lmsArray = Memory_Alloc_2DArray( unsigned int, stringLength1 + 1, stringLength2 + 1, "lmsArray" );
-	memset( lmsArray[0], 0, sizeof( unsigned int ) * (stringLength1 + 1) * (stringLength2 + 1) );
-
-	for ( charString1_I = 1 ; charString1_I <= stringLength1 ; charString1_I++ ) {
-		charString1 = string1[ charString1_I - 1 ];
-		for ( charString2_I = 1 ; charString2_I <= stringLength2 ; charString2_I++ ) {
-			charString2 = string2[ charString2_I - 1 ];
-
-			areEqual = ( caseSensitive ? charString1 == charString2 :  tolower( charString1 ) == tolower( charString2 ) ) ? True : False;
-
-			/* If the two characters are equal then this character is the last in the longest subsequence of 
-			 * string1[0 ... charString1_I - 1 ] and string2[0 ... charString2_I - 1 ] therefore the length is 
-			 * one more than the previous longest subsequence - 
-			 * namely lmsArray[ charString1_I - 1 ][ charString2_I - 1 ] + 1 
-			 *
-			 * If the characters arn't equal then the length is the longest subseqence from 
-			 * string1[0 ... charString1_I - 1 ] or string2[0 ... charString2_I - 1 ] */
-			
-			lmsArray[ charString1_I ][ charString2_I ] = 
-				( areEqual )
-					? lmsArray[ charString1_I - 1 ][ charString2_I - 1 ] + 1
-					: MAX( lmsArray[ charString1_I - 1 ][ charString2_I ], lmsArray[ charString1_I ][ charString2_I - 1 ] );
-		}
-	}
-
-	lmsLength = lmsArray[ stringLength1 ][ stringLength2 ];
-	Memory_Free( lmsArray );
-
-	return lmsLength;
-}
-					
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/CommonRoutines.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/CommonRoutines.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,307 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: CommonRoutines.c 2276 2004-11-04 02:01:18Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "types.h"
+#include "forwardDecl.h"
+                                                                                                                                    
+#include "MemoryField.h"
+#include "MemoryPointer.h"
+#include "Memory.h"
+#include "shortcuts.h"
+                                                                                                                                    
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <math.h>
+
+Name StG_BoolToStringMap[2] = { "False", "True" };
+
+
+double StG_RoundDoubleToNSigFigs( double value, unsigned int nSigFigs ) {
+	double divisorPower;
+	double sign = 1.0;
+	double toleranceAroundZero = 1e-60;
+
+	assert( nSigFigs >= 1 );
+	
+	/* Log goes to infinity at 0. Hence, we have to give up rounding if it gets too small */
+	if ( (value > (0.0 - toleranceAroundZero)) && (value < (0.0 + toleranceAroundZero)) ) {
+		return value;
+	}	
+	
+	/* Since logs can't deal with negatives, need to save the sign */
+	if ( value < 0 ) {
+		sign = -1.0;
+		value = fabs(value);
+	}
+
+	/* Since interested in significant figures, need to work out the number of 
+	zeros in the answer */
+	divisorPower = log10( value );
+	divisorPower = floor( divisorPower );
+
+	/* We now have the divisorPower to use if nSigFigs == 1. So adjust if this isn't
+	the case */
+	divisorPower -= ( nSigFigs - 1 );
+
+	/* Similar approach to the decimal places rounder from here, except we use
+	the divisorPower we've just calculated */
+	return sign * floor( value / pow( 10., divisorPower ) + 0.5 ) * pow(10., divisorPower);
+}
+
+
+double StG_RoundDoubleToNDecimalPlaces( double value, unsigned int nDecimalPlaces ) {
+	return floor( value * pow(10., nDecimalPlaces) + .5) / pow(10., nDecimalPlaces);
+}
+
+
+unsigned int StG_IntegerLength( int number ) {
+	int tmpNumber;
+	int numDigits;
+	Bool isNegative;
+
+	tmpNumber = abs( number );
+	numDigits = 0;
+	isNegative = ( number < 0 ) ? True : False;
+	
+	do {
+		++numDigits;
+		tmpNumber /= 10; /* Base 10 */
+	} while ( tmpNumber > 0 );
+
+	if ( isNegative )
+		++numDigits;
+
+	return numDigits;
+}
+	
+
+
+char* StG_Strdup( Name const str ) {
+	int length;
+	char* result;
+
+        if( !str ) return NULL;
+	length = strlen( str ) + 1;
+	result = Memory_Alloc_Array_Unnamed( char, length );
+
+	strcpy( result, str );
+
+	return result;
+}
+
+
+int Stg_vasprintf( char** string, Name format, va_list ap ) {
+	int       allocStringSize = 100;
+	int       sizeOfString;
+
+	va_list   apCopy;
+
+	Bool      trying = True;
+
+	/* Allocate Memory For String */
+	*string = Memory_Alloc_Array( char, allocStringSize, "string" );
+
+	while ( trying ) {
+		/* See is we can print to this string with this size */
+#ifdef NO_VA_COPY
+                apCopy=ap;
+#else
+		va_copy( apCopy, ap );
+#endif
+		sizeOfString = vsnprintf( *string, allocStringSize, format, apCopy );
+		va_end( apCopy );
+
+		/* Check if string was truncated */
+		if ( sizeOfString > -1 && sizeOfString < allocStringSize ) {
+			return sizeOfString;
+		}
+		/* String was truncated - resize array and try again */
+		if ( sizeOfString > -1 ) {
+			/* glibc > 2.1 */
+			allocStringSize = sizeOfString + 1;
+		}
+		else {
+			/* glibc <= 2.0 */
+			allocStringSize = sizeOfString * 2;
+		}
+		*string = Memory_Realloc_Array( *string, char, allocStringSize );
+		if ( string == NULL ) {
+			#ifdef DEBUG
+				assert( string != NULL );
+			#endif
+			trying = False;
+		}
+	}
+		
+	return sizeOfString;
+}
+
+
+int Stg_asprintf( char** string, Name format, ... ) {
+	int       sizeOfString;
+	va_list   ap;
+	
+	va_start( ap, format );
+	sizeOfString = Stg_vasprintf( string, format, ap ) ;
+	va_end( ap );
+
+	return sizeOfString;
+}
+
+Bool Stg_StringIsEmpty( Name string ) {
+	size_t     length;
+	const char whiteSpaceChars[] = " \t\n";
+
+	if ( string == NULL ) 
+		return True;
+	
+	/* Check if the length is Zero */
+	length = strlen( string );
+	if ( length == 0 )
+		return True;
+
+	/* Check if there are only white space characters */
+	if ( length == strspn( string, whiteSpaceChars ) )
+		return True;
+
+	return False;
+}
+
+Bool Stg_StringIsNumeric( Name string ) {
+	size_t         length;
+	Index          char_I;
+	char           ch;
+	unsigned int   eCount            = 0;
+	unsigned int   decimalPointCount = 0;
+	unsigned int   digitCount        = 0;
+
+	if ( string == NULL ) 
+		return False;
+
+	length = strlen( string );
+	if ( length == 0 ) 
+		return False;
+
+	/* The conversion of HUGE_VAL by printf is 'inf' which requires this line to 
+	 * pick up that this is actually a numerical string */
+	if ( strcmp( string, "-inf" ) == 0 || strcmp( string, "inf" ) == 0  )
+		return True;
+
+	for ( char_I = 0 ; char_I < length ; char_I++ ) {
+		ch = string[ char_I ];
+
+		/* Check for digits from 0 - 9 */
+		if ( isdigit( ch ) ) {
+			digitCount++;
+			continue;
+		}
+
+		/* Check for 'e' or 'E' for scientific notation - only one allowed */
+		if ( ( ch == 'e' || ch == 'E' ) && eCount == 0 ) {
+			eCount++;
+
+			/* Reset counters because another number is allowed */
+			decimalPointCount = 0;
+			digitCount        = 0;
+			continue;
+		}
+		
+		/* Check for decimal point - one allowed before 'e' and one allowed after 'e' */
+		if ( ch == '.' && decimalPointCount == 0 ) {
+			decimalPointCount++;
+			continue;
+		}
+
+		/* Check for plus for minus sign - only allowed at beginning of number */
+		if ( (ch == '+' || ch == '-') && (digitCount == 0 && decimalPointCount == 0) )
+			continue;
+
+		return False;
+	}
+
+	/* If all chars pass - then return happy */
+	return True;
+}
+
+/** This function calculates the of the longest matching subsequence between string1 and string2.
+ *  A subsequence of a string is when all the characters of the subsequence appear in order within the string,
+ *  but possibly with gaps between occurrences of each character. */
+unsigned int Stg_LongestMatchingSubsequenceLength( Name string1, const char* string2, Bool caseSensitive ) {
+	size_t         stringLength1 = strlen( string1 );
+	size_t         stringLength2 = strlen( string2 );
+	unsigned int** lmsArray;
+	Index          charString1_I;
+	Index          charString2_I;
+	char           charString1;
+	char           charString2;
+	Bool           areEqual;
+	unsigned int   lmsLength;
+
+	/* This array 'lmsArray' is defined as follows: 
+	 * lmsArray[i][j] = the length of the longest matching subsequence in string1[ 0 ... (i-1) ] and string[ 0 ... (j-1) ]
+	 * lmsArray[0][j] and lmsArray[i][0] are initialised to zero for all i, j */
+	lmsArray = Memory_Alloc_2DArray( unsigned int, stringLength1 + 1, stringLength2 + 1, "lmsArray" );
+	memset( lmsArray[0], 0, sizeof( unsigned int ) * (stringLength1 + 1) * (stringLength2 + 1) );
+
+	for ( charString1_I = 1 ; charString1_I <= stringLength1 ; charString1_I++ ) {
+		charString1 = string1[ charString1_I - 1 ];
+		for ( charString2_I = 1 ; charString2_I <= stringLength2 ; charString2_I++ ) {
+			charString2 = string2[ charString2_I - 1 ];
+
+			areEqual = ( caseSensitive ? charString1 == charString2 :  tolower( charString1 ) == tolower( charString2 ) ) ? True : False;
+
+			/* If the two characters are equal then this character is the last in the longest subsequence of 
+			 * string1[0 ... charString1_I - 1 ] and string2[0 ... charString2_I - 1 ] therefore the length is 
+			 * one more than the previous longest subsequence - 
+			 * namely lmsArray[ charString1_I - 1 ][ charString2_I - 1 ] + 1 
+			 *
+			 * If the characters arn't equal then the length is the longest subseqence from 
+			 * string1[0 ... charString1_I - 1 ] or string2[0 ... charString2_I - 1 ] */
+			
+			lmsArray[ charString1_I ][ charString2_I ] = 
+				( areEqual )
+					? lmsArray[ charString1_I - 1 ][ charString2_I - 1 ] + 1
+					: MAX( lmsArray[ charString1_I - 1 ][ charString2_I ], lmsArray[ charString1_I ][ charString2_I - 1 ] );
+		}
+	}
+
+	lmsLength = lmsArray[ stringLength1 ][ stringLength2 ];
+	Memory_Free( lmsArray );
+
+	return lmsLength;
+}
+					
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Finalise.c
--- a/Base/Foundation/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "types.h"
-#include "Memory.h"
-#include "TimeMonitor.h"
-#include "MemMonitor.h"
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool BaseFoundation_Finalise( void ) {
-	Memory_Delete();
-
-	Stg_TimeMonitor_Finalise();
-	Stg_MemMonitor_Finalise();
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,49 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "types.h"
+#include "Memory.h"
+#include "TimeMonitor.h"
+#include "MemMonitor.h"
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool BaseFoundation_Finalise( void ) {
+	Memory_Delete();
+
+	Stg_TimeMonitor_Finalise();
+	Stg_MemMonitor_Finalise();
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Init.c
--- a/Base/Foundation/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "types.h"
-#include "MemoryField.h"
-#include "MemoryPointer.h"
-#include "Memory.h"
-#include "TimeMonitor.h"
-#include "MemMonitor.h"
-#include "Init.h"
-
-#include <stdio.h>
-#include <assert.h>
-
-Bool BaseFoundation_Init( int* argc, char** argv[] ) {
-	stgMemory = Memory_Init();
-   assert( stgMemory );
-
-	Stg_TimeMonitor_Initialise();
-	Stg_MemMonitor_Initialise();
-	
-	return True;
-}
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,51 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "types.h"
+#include "MemoryField.h"
+#include "MemoryPointer.h"
+#include "Memory.h"
+#include "TimeMonitor.h"
+#include "MemMonitor.h"
+#include "Init.h"
+
+#include <stdio.h>
+#include <assert.h>
+
+Bool BaseFoundation_Init( int* argc, char** argv[] ) {
+	stgMemory = Memory_Init();
+   assert( stgMemory );
+
+	Stg_TimeMonitor_Initialise();
+	Stg_MemMonitor_Initialise();
+	
+	return True;
+}
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Log.c
--- a/Base/Foundation/src/Log.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2007, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**      Dave A. May, PhD Candidate, Monash University. (dave.mayhem23 at gmail.com)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Log.c 3614 2006-06-01 08:58:48Z DaveMay $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <mpi.h>
-
-#ifndef STGERMAIN_LOGFILE_NAME
-#define STGERMAIN_LOGFILE_NAME "stgermain.log"
-#endif 
-
-/* empty out the file */
-void _init_stg_log_printf( const char *name )
-{
-        FILE *fp;
-        char err[128];
-        int rank, length;
-        char mname[BUFSIZ];
-
-
-        sprintf( err, name );
-        fp = fopen( err, "w" );
-
-		/* It's useful to have a safe fallback here */ 
-		
-		if(fp==NULL) {
-			fp = stderr;
-		}	
-
-        /* write header for log file */
-        MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-        MPI_Get_processor_name( mname, &length );
-
-        fprintf( fp, "=== StGermain Parallel log ===\n" );
-        fprintf( fp, "=== Generated on %s, by rank %d ===\n", mname, rank );
-		
-		if(fp != stderr)
-        	fclose( fp );
-}
-
-void _stg_log_write_filename( char name[] )
-{
-	int rank;
-	
-	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-    sprintf( name, "%s.p%d" , STGERMAIN_LOGFILE_NAME, rank ); 
-}
-
-
-void stg_log_printf( const char *format, ... )
-{
-#ifdef ENABLE_STGERMAIN_LOG
-        FILE *fp;
-        char err[128];
-        va_list ap;
-        static int beenhere = 0;
-
-
-	_stg_log_write_filename( err );
-
-        if( beenhere == 0 ) {
-                _init_stg_log_printf(err);
-        }
-
-	
-        fp = fopen( err, "a" );
-		if(fp==NULL) {
-			fp = stderr;
-		}	
-
-        va_start(ap,format);
-        vfprintf( fp, format, ap );
-        va_end(ap);
-
-		if(fp != stderr)
-        	fclose(fp);
-
-        beenhere = 1;
-#endif
-}
-
-FILE* _get_file_pointer_log_printf( void )
-{
-	FILE *fp;
-	char err[128];
-	
-	
-	_stg_log_write_filename( err );
-	fp = fopen( err, "a" );
-	if(fp==NULL) {
-		fp = stderr;
-	}
-	
-	return fp;
-}
-
-void stg_profile_EntryPoint( const char *ep_name, const char *hk_name, double time )
-{ 
-#ifdef ENABLE_STGERMAIN_LOG
-	int len_ep, len_hk;
-	int max_length = 50;
-	int i;
-	FILE *fp;
-	int cnt;
-	
-	stg_log_printf( "ExecutionTime for - " );
-	
-	len_ep = strlen( ep_name );
-	len_ep = len_ep + 13;
-	cnt = len_ep;
-	if( len_ep < max_length ) {
-		fp = _get_file_pointer_log_printf();
-		
-		fprintf( fp, "%s (EntryPoint)", ep_name );
-		for( i=0; i<(max_length-(len_ep) ); i++ ) {
-			fprintf( fp, " ");
-			cnt++;
-		}
-		
-		fprintf( fp, " : %s (Hook)", hk_name );
-		len_hk = strlen( hk_name );
-		for( i=0; i<(max_length-len_hk); i++ ) {
-			fprintf( fp, " ");
-		}
-		fprintf( fp, " time= %6.6e (sec)\n", time );
-		fclose( fp );
-	}
-	else {
-		/* do an unformatted */
-		stg_log_printf( "%s (EntryPnt) : %s (Hook) - time = %.6g\n", ep_name, hk_name, time );
-	}
-#endif
-}
-
-
-void stg_profile_Func( const char *func_name, double time )
-{
-#ifdef ENABLE_STGERMAIN_LOG
-        int len_ep;
-        int max_length = 50;
-        int i;
-        FILE *fp;
-        int cnt;
-
-        stg_log_printf( "ExecutionTime for - " );
-
-        len_ep = strlen( func_name );
-        len_ep = len_ep + 11;
-        cnt = len_ep;
-        if( len_ep < max_length ) {
-                fp = _get_file_pointer_log_printf();
-
-                fprintf( fp, "%s (Function)", func_name );
-                for( i=0; i<(2*max_length+10-(len_ep) ); i++ ) {
-                        fprintf( fp, " ");
-                        cnt++;
-                }
-
-                fprintf( fp, " time= %6.6e (sec)\n", time );
-				if(fp != stderr)
-                	fclose( fp );
-        }
-        else {
-                /* do an unformatted */
-                stg_log_printf( "%s (Function) - time = %.6g\n", func_name, time );
-        }
-#endif
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Log.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Log.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,196 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2007, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**      Dave A. May, PhD Candidate, Monash University. (dave.mayhem23 at gmail.com)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Log.c 3614 2006-06-01 08:58:48Z DaveMay $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <mpi.h>
+
+#ifndef STGERMAIN_LOGFILE_NAME
+#define STGERMAIN_LOGFILE_NAME "stgermain.log"
+#endif 
+
+/* empty out the file */
+void _init_stg_log_printf( const char *name )
+{
+        FILE *fp;
+        char err[128];
+        int rank, length;
+        char mname[BUFSIZ];
+
+
+        sprintf( err, name );
+        fp = fopen( err, "w" );
+
+		/* It's useful to have a safe fallback here */ 
+		
+		if(fp==NULL) {
+			fp = stderr;
+		}	
+
+        /* write header for log file */
+        MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+        MPI_Get_processor_name( mname, &length );
+
+        fprintf( fp, "=== StGermain Parallel log ===\n" );
+        fprintf( fp, "=== Generated on %s, by rank %d ===\n", mname, rank );
+		
+		if(fp != stderr)
+        	fclose( fp );
+}
+
+void _stg_log_write_filename( char name[] )
+{
+	int rank;
+	
+	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+    sprintf( name, "%s.p%d" , STGERMAIN_LOGFILE_NAME, rank ); 
+}
+
+
+void stg_log_printf( const char *format, ... )
+{
+#ifdef ENABLE_STGERMAIN_LOG
+        FILE *fp;
+        char err[128];
+        va_list ap;
+        static int beenhere = 0;
+
+
+	_stg_log_write_filename( err );
+
+        if( beenhere == 0 ) {
+                _init_stg_log_printf(err);
+        }
+
+	
+        fp = fopen( err, "a" );
+		if(fp==NULL) {
+			fp = stderr;
+		}	
+
+        va_start(ap,format);
+        vfprintf( fp, format, ap );
+        va_end(ap);
+
+		if(fp != stderr)
+        	fclose(fp);
+
+        beenhere = 1;
+#endif
+}
+
+FILE* _get_file_pointer_log_printf( void )
+{
+	FILE *fp;
+	char err[128];
+	
+	
+	_stg_log_write_filename( err );
+	fp = fopen( err, "a" );
+	if(fp==NULL) {
+		fp = stderr;
+	}
+	
+	return fp;
+}
+
+void stg_profile_EntryPoint( const char *ep_name, const char *hk_name, double time )
+{ 
+#ifdef ENABLE_STGERMAIN_LOG
+	int len_ep, len_hk;
+	int max_length = 50;
+	int i;
+	FILE *fp;
+	int cnt;
+	
+	stg_log_printf( "ExecutionTime for - " );
+	
+	len_ep = strlen( ep_name );
+	len_ep = len_ep + 13;
+	cnt = len_ep;
+	if( len_ep < max_length ) {
+		fp = _get_file_pointer_log_printf();
+		
+		fprintf( fp, "%s (EntryPoint)", ep_name );
+		for( i=0; i<(max_length-(len_ep) ); i++ ) {
+			fprintf( fp, " ");
+			cnt++;
+		}
+		
+		fprintf( fp, " : %s (Hook)", hk_name );
+		len_hk = strlen( hk_name );
+		for( i=0; i<(max_length-len_hk); i++ ) {
+			fprintf( fp, " ");
+		}
+		fprintf( fp, " time= %6.6e (sec)\n", time );
+		fclose( fp );
+	}
+	else {
+		/* do an unformatted */
+		stg_log_printf( "%s (EntryPnt) : %s (Hook) - time = %.6g\n", ep_name, hk_name, time );
+	}
+#endif
+}
+
+
+void stg_profile_Func( const char *func_name, double time )
+{
+#ifdef ENABLE_STGERMAIN_LOG
+        int len_ep;
+        int max_length = 50;
+        int i;
+        FILE *fp;
+        int cnt;
+
+        stg_log_printf( "ExecutionTime for - " );
+
+        len_ep = strlen( func_name );
+        len_ep = len_ep + 11;
+        cnt = len_ep;
+        if( len_ep < max_length ) {
+                fp = _get_file_pointer_log_printf();
+
+                fprintf( fp, "%s (Function)", func_name );
+                for( i=0; i<(2*max_length+10-(len_ep) ); i++ ) {
+                        fprintf( fp, " ");
+                        cnt++;
+                }
+
+                fprintf( fp, " time= %6.6e (sec)\n", time );
+				if(fp != stderr)
+                	fclose( fp );
+        }
+        else {
+                /* do an unformatted */
+                stg_log_printf( "%s (Function) - time = %.6g\n", func_name, time );
+        }
+#endif
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemMonitor.c
--- a/Base/Foundation/src/MemMonitor.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,266 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MemMonitor.c 3157 2005-08-07 23:43:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "types.h"
-#include "shortcuts.h"
-#include "forwardDecl.h"
-#include "MemoryPointer.h"
-#include "MemoryField.h"
-#include "Memory.h"
-#include "MemMonitor.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-double Stg_MemoryWatchCriteria = -1;
-
-const Type Stg_MemMonitor_Type = "Stg_MemMonitor";
-const Type Stg_MemMonitor_InfoStreamName = "MemMonitor";
-const Type Stg_MemMonitor_TagType = "Stg_MemMonitor_Tag";
-
-void _Memory_Print_AllocsAboveThreshold_Helper( void* memoryPointer, void* args ) {
-	MemoryPointer* memPtr;
-	void** arguments;
-	SizeT threshold;
-	MemoryOpStamp begin;
-	MemoryOpStamp end;
-
-	assert( memoryPointer );
-	assert( args );
-
-	memPtr = (MemoryPointer*)memoryPointer;
-	arguments = (void**)args;
-	threshold = *((SizeT*)arguments[0]);
-	begin = *((MemoryOpStamp*)arguments[1]);
-	end = *((MemoryOpStamp*)arguments[2]);
-
-	if ( memPtr->ptr != NULL && memPtr->status != MEMORY_POINTER_RELEASED ) {
-		if ( memPtr->totalSize > threshold && memPtr->stamp >= begin && memPtr->stamp <= end ) {
-                  MemoryPointer_Print( memPtr, (MemoryPointerColumn)(MEMORYPOINTER_NAME | MEMORYPOINTER_TOTALSIZE) );
-		}
-	}
-}
-
-void Stg_MemMonitor_Initialise() {
-	Stg_MemoryWatchCriteria = 0.2;
-}
-void Stg_MemMonitor_Finalise() {
-
-}
-void Stg_MemMonitor_SetMemoryWatchCriteria( double ratioOfTotalMemory ) {
-	Stg_MemoryWatchCriteria = ratioOfTotalMemory;
-}
-
-Stg_MemMonitor* Stg_MemMonitor_New(Name tag, Bool criteria, Bool print, MPI_Comm comm ) {
-	Stg_MemMonitor* mm;
-	
-	mm = Memory_Alloc_Unnamed( Stg_MemMonitor );
-	mm->tag = (char*)Memory_Alloc_Bytes_Unnamed( strlen( tag ) + 1, Stg_MemMonitor_TagType );
-	strcpy( mm->tag, tag );
-	mm->criteria = criteria;
-	mm->print = print;
-	mm->comm = comm;
-	
-	return mm;
-}
-
-void Stg_MemMonitor_Delete( Stg_MemMonitor* mm ) {
-	if( mm->tag ) {
-		Memory_Free( mm->tag );
-	}
-	
-	Memory_Free( mm );
-}
-
-
-void Stg_MemMonitor_Begin( Stg_MemMonitor* mm ) {
-#ifdef MEMORY_STATS
-	mm->m1 = stgMemory->stamp;
-	mm->m2 = mm->m1;
-	MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
-	mm->totalMem1 = stgMemory->types->currentAllocation;
-	mm->totalMem2 = mm->totalMem1;
-#endif
-}
-
-double Stg_MemMonitor_End( Stg_MemMonitor* mm, MemMonitorData* mmData ) {
-#ifdef MEMORY_STATS
-	long memSumDiff;
-	int rank;
-	int size;
-#endif
-
-	mmData->avgProcMemDiff = 0;
-
-#ifdef MEMORY_STATS
-	
-	mm->m2 = stgMemory->stamp;
-	MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
-
-	mm->totalMem2 = stgMemory->types->currentAllocation;
-	
-	mmData->memFinal = mm->totalMem2;
-	/* Casts are necessary below because both totalMems are SizeT, and the answer may be negative (IE, have net
-	 *  free'd memory */
-	mmData->memDiff = (int)((int)mm->totalMem2 - (int)mm->totalMem1);
-	
-	MPI_Comm_size( mm->comm, &size );
-
-	/*
-	MPI_Reduce( &mmData->memDiff, &maxProcMemDiff, 1, MPI_LONG, MPI_MAX, 0, mm->comm );
-	MPI_Reduce( &mmData->memDiff, &minProcMemDiff, 1, MPI_LONG, MPI_MIN, 0, mm->comm );
-	MPI_Allreduce( &mmData->memDiff, &memSumDiff, 1, MPI_LONG, MPI_SUM, mm->comm );
-	
-	avgProcMemDiff = (double)memSumDiff / size;
-	*/
-	/* Above is commented and replaced with below. See TimeMonitor.c for reason */
-	memSumDiff = mmData->memDiff;
-
-	mmData->minProcMemDiff = mmData->memDiff;
-	mmData->maxProcMemDiff = mmData->memDiff;
-	mmData->avgProcMemDiff = mmData->memDiff;
-	
-	/* Note: maybe Stg_Components should store rank and comm??? how do the find their comm? */
-	
-	MPI_Comm_rank( mm->comm, &rank );
-	
-	mmData->percentChange = (mmData->avgProcMemDiff / (double)mm->totalMem1) * 100.0;
-
-	mmData->criterionPassed = False;
-	if ( mm->criteria ) {
-		mmData->criterionPassed = fabs( mmData->percentChange/100.0 ) >= Stg_MemoryWatchCriteria;
-	}
-
-	if( (rank == 0) && mm->print && ( (mm->criteria==False) || mmData->criterionPassed ) ) {
-		void*    args[3];
-		SizeT    threshold = (SizeT)(Stg_MemoryWatchCriteria * mmData->memFinal);
-
-		if( size == 1 ) {
-			double   memFinalPrint;
-			char     memFinalUnit[100];
-			double   memDiffPrint;
-			char     memDiffUnit[100];
-
-			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->memFinal, &memFinalPrint, memFinalUnit );
-			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->memDiff, &memDiffPrint, memDiffUnit );
-
-			Journal_Printf( 
-				Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ),
-				"\t%s(%s): memory allocated at end= %.2f%s, of which %.2f%s during monitoring (%.2f%% change)\n", 
-				Stg_MemMonitor_InfoStreamName,
-				mm->tag,
-				memFinalPrint, memFinalUnit,
-				memDiffPrint, memDiffUnit,
-				mmData->percentChange );
-		}
-		else {
-			double   memFinalPrint;
-			char     memFinalUnit[100];
-			double   avgProcMemDiffPrint;
-			char     avgProcMemDiffUnit[100];
-			double   minProcMemDiffPrint;
-			char     minProcMemDiffUnit[100];
-			double   maxProcMemDiffPrint;
-			char     maxProcMemDiffUnit[100];
-
-			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->memFinal, &memFinalPrint, memFinalUnit );
-			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->avgProcMemDiff, &avgProcMemDiffPrint, avgProcMemDiffUnit );
-			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->minProcMemDiff, &minProcMemDiffPrint, minProcMemDiffUnit );
-			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->maxProcMemDiff, &maxProcMemDiffPrint, maxProcMemDiffUnit );
-
-			Journal_Printf( 
-				Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ),
-				"\t%s(%s): memory allocated at end= %.2f%s, of which ave %.2f%s/proc during monitoring (%.2f%% change)\n"
-				"\t\t(individual proc usage during monitoring min/max = %.2f%s/%.2f%s)\n",
-				Stg_MemMonitor_InfoStreamName,
-				mm->tag,
-				memFinalPrint, memFinalUnit,
-				avgProcMemDiffPrint, avgProcMemDiffUnit,
-				mmData->percentChange,
-				minProcMemDiffPrint, minProcMemDiffUnit,
-				maxProcMemDiffPrint, maxProcMemDiffUnit );
-		}
-		args[0] = &threshold;
-		args[1] = &mm->m1;
-		args[2] = &mm->m2;
-		Journal_Printf( Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ), "Allocations after threshold reached were:\n\n" );
-		BTree_ParseTree( stgMemory->pointers, _Memory_Print_AllocsAboveThreshold_Helper, (void*)args );
-	}
-#endif
-	return mmData->avgProcMemDiff;
-}
-
-
-void Stg_MemMonitor_ConvertBytesToPrintingUnit( int bytesInput, double* convertedAmt, char* unitString ) {
-	double    one_kb = 1024.0;
-	double    one_mb = 1024.0*one_kb;
-	double    one_gb = 1024.0*one_mb;
-	double    one_tb = 1024.0*one_gb;
-	unsigned  absBytesInput = abs(bytesInput);
-
-	pcu_assert( unitString != NULL );
-
-	/* Remember, bytesInput may be negative representing a free'd amount */
-
-	if ( absBytesInput < one_kb) {
-		/* leave as bytes */
-		*convertedAmt = bytesInput;
-		sprintf( unitString, "b" );
-	}
-	else if ( absBytesInput < one_mb ) {
-		/* convert to KB */
-		*convertedAmt = bytesInput / one_kb; 
-		sprintf( unitString, "kb" );
-	}
-	else if ( absBytesInput < one_gb ) {
-		/* convert to MB */
-		*convertedAmt = bytesInput / one_mb;
-		sprintf( unitString, "mb" );
-	}
-	else if ( absBytesInput < one_tb ) {
-		/* convert to GB */
-		*convertedAmt = bytesInput / one_gb;
-		sprintf( unitString, "gb" );
-	}
-	else {
-		/* convert to TB - don't think we need to worry about PetaBytes! */
-		*convertedAmt = bytesInput / one_tb;
-		sprintf( unitString, "tb" );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemMonitor.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/MemMonitor.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,266 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MemMonitor.c 3157 2005-08-07 23:43:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "types.h"
+#include "shortcuts.h"
+#include "forwardDecl.h"
+#include "MemoryPointer.h"
+#include "MemoryField.h"
+#include "Memory.h"
+#include "MemMonitor.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+double Stg_MemoryWatchCriteria = -1;
+
+const Type Stg_MemMonitor_Type = "Stg_MemMonitor";
+const Type Stg_MemMonitor_InfoStreamName = "MemMonitor";
+const Type Stg_MemMonitor_TagType = "Stg_MemMonitor_Tag";
+
+void _Memory_Print_AllocsAboveThreshold_Helper( void* memoryPointer, void* args ) {
+	MemoryPointer* memPtr;
+	void** arguments;
+	SizeT threshold;
+	MemoryOpStamp begin;
+	MemoryOpStamp end;
+
+	assert( memoryPointer );
+	assert( args );
+
+	memPtr = (MemoryPointer*)memoryPointer;
+	arguments = (void**)args;
+	threshold = *((SizeT*)arguments[0]);
+	begin = *((MemoryOpStamp*)arguments[1]);
+	end = *((MemoryOpStamp*)arguments[2]);
+
+	if ( memPtr->ptr != NULL && memPtr->status != MEMORY_POINTER_RELEASED ) {
+		if ( memPtr->totalSize > threshold && memPtr->stamp >= begin && memPtr->stamp <= end ) {
+                  MemoryPointer_Print( memPtr, (MemoryPointerColumn)(MEMORYPOINTER_NAME | MEMORYPOINTER_TOTALSIZE) );
+		}
+	}
+}
+
+void Stg_MemMonitor_Initialise() {
+	Stg_MemoryWatchCriteria = 0.2;
+}
+void Stg_MemMonitor_Finalise() {
+
+}
+void Stg_MemMonitor_SetMemoryWatchCriteria( double ratioOfTotalMemory ) {
+	Stg_MemoryWatchCriteria = ratioOfTotalMemory;
+}
+
+Stg_MemMonitor* Stg_MemMonitor_New(Name tag, Bool criteria, Bool print, MPI_Comm comm ) {
+	Stg_MemMonitor* mm;
+	
+	mm = Memory_Alloc_Unnamed( Stg_MemMonitor );
+	mm->tag = (char*)Memory_Alloc_Bytes_Unnamed( strlen( tag ) + 1, Stg_MemMonitor_TagType );
+	strcpy( mm->tag, tag );
+	mm->criteria = criteria;
+	mm->print = print;
+	mm->comm = comm;
+	
+	return mm;
+}
+
+void Stg_MemMonitor_Delete( Stg_MemMonitor* mm ) {
+	if( mm->tag ) {
+		Memory_Free( mm->tag );
+	}
+	
+	Memory_Free( mm );
+}
+
+
+void Stg_MemMonitor_Begin( Stg_MemMonitor* mm ) {
+#ifdef MEMORY_STATS
+	mm->m1 = stgMemory->stamp;
+	mm->m2 = mm->m1;
+	MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
+	mm->totalMem1 = stgMemory->types->currentAllocation;
+	mm->totalMem2 = mm->totalMem1;
+#endif
+}
+
+double Stg_MemMonitor_End( Stg_MemMonitor* mm, MemMonitorData* mmData ) {
+#ifdef MEMORY_STATS
+	long memSumDiff;
+	int rank;
+	int size;
+#endif
+
+	mmData->avgProcMemDiff = 0;
+
+#ifdef MEMORY_STATS
+	
+	mm->m2 = stgMemory->stamp;
+	MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
+
+	mm->totalMem2 = stgMemory->types->currentAllocation;
+	
+	mmData->memFinal = mm->totalMem2;
+	/* Casts are necessary below because both totalMems are SizeT, and the answer may be negative (IE, have net
+	 *  free'd memory */
+	mmData->memDiff = (int)((int)mm->totalMem2 - (int)mm->totalMem1);
+	
+	MPI_Comm_size( mm->comm, &size );
+
+	/*
+	MPI_Reduce( &mmData->memDiff, &maxProcMemDiff, 1, MPI_LONG, MPI_MAX, 0, mm->comm );
+	MPI_Reduce( &mmData->memDiff, &minProcMemDiff, 1, MPI_LONG, MPI_MIN, 0, mm->comm );
+	MPI_Allreduce( &mmData->memDiff, &memSumDiff, 1, MPI_LONG, MPI_SUM, mm->comm );
+	
+	avgProcMemDiff = (double)memSumDiff / size;
+	*/
+	/* Above is commented and replaced with below. See TimeMonitor.c for reason */
+	memSumDiff = mmData->memDiff;
+
+	mmData->minProcMemDiff = mmData->memDiff;
+	mmData->maxProcMemDiff = mmData->memDiff;
+	mmData->avgProcMemDiff = mmData->memDiff;
+	
+	/* Note: maybe Stg_Components should store rank and comm??? how do the find their comm? */
+	
+	MPI_Comm_rank( mm->comm, &rank );
+	
+	mmData->percentChange = (mmData->avgProcMemDiff / (double)mm->totalMem1) * 100.0;
+
+	mmData->criterionPassed = False;
+	if ( mm->criteria ) {
+		mmData->criterionPassed = fabs( mmData->percentChange/100.0 ) >= Stg_MemoryWatchCriteria;
+	}
+
+	if( (rank == 0) && mm->print && ( (mm->criteria==False) || mmData->criterionPassed ) ) {
+		void*    args[3];
+		SizeT    threshold = (SizeT)(Stg_MemoryWatchCriteria * mmData->memFinal);
+
+		if( size == 1 ) {
+			double   memFinalPrint;
+			char     memFinalUnit[100];
+			double   memDiffPrint;
+			char     memDiffUnit[100];
+
+			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->memFinal, &memFinalPrint, memFinalUnit );
+			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->memDiff, &memDiffPrint, memDiffUnit );
+
+			Journal_Printf( 
+				Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ),
+				"\t%s(%s): memory allocated at end= %.2f%s, of which %.2f%s during monitoring (%.2f%% change)\n", 
+				Stg_MemMonitor_InfoStreamName,
+				mm->tag,
+				memFinalPrint, memFinalUnit,
+				memDiffPrint, memDiffUnit,
+				mmData->percentChange );
+		}
+		else {
+			double   memFinalPrint;
+			char     memFinalUnit[100];
+			double   avgProcMemDiffPrint;
+			char     avgProcMemDiffUnit[100];
+			double   minProcMemDiffPrint;
+			char     minProcMemDiffUnit[100];
+			double   maxProcMemDiffPrint;
+			char     maxProcMemDiffUnit[100];
+
+			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->memFinal, &memFinalPrint, memFinalUnit );
+			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->avgProcMemDiff, &avgProcMemDiffPrint, avgProcMemDiffUnit );
+			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->minProcMemDiff, &minProcMemDiffPrint, minProcMemDiffUnit );
+			Stg_MemMonitor_ConvertBytesToPrintingUnit( mmData->maxProcMemDiff, &maxProcMemDiffPrint, maxProcMemDiffUnit );
+
+			Journal_Printf( 
+				Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ),
+				"\t%s(%s): memory allocated at end= %.2f%s, of which ave %.2f%s/proc during monitoring (%.2f%% change)\n"
+				"\t\t(individual proc usage during monitoring min/max = %.2f%s/%.2f%s)\n",
+				Stg_MemMonitor_InfoStreamName,
+				mm->tag,
+				memFinalPrint, memFinalUnit,
+				avgProcMemDiffPrint, avgProcMemDiffUnit,
+				mmData->percentChange,
+				minProcMemDiffPrint, minProcMemDiffUnit,
+				maxProcMemDiffPrint, maxProcMemDiffUnit );
+		}
+		args[0] = &threshold;
+		args[1] = &mm->m1;
+		args[2] = &mm->m2;
+		Journal_Printf( Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ), "Allocations after threshold reached were:\n\n" );
+		BTree_ParseTree( stgMemory->pointers, _Memory_Print_AllocsAboveThreshold_Helper, (void*)args );
+	}
+#endif
+	return mmData->avgProcMemDiff;
+}
+
+
+void Stg_MemMonitor_ConvertBytesToPrintingUnit( int bytesInput, double* convertedAmt, char* unitString ) {
+	double    one_kb = 1024.0;
+	double    one_mb = 1024.0*one_kb;
+	double    one_gb = 1024.0*one_mb;
+	double    one_tb = 1024.0*one_gb;
+	unsigned  absBytesInput = abs(bytesInput);
+
+	pcu_assert( unitString != NULL );
+
+	/* Remember, bytesInput may be negative representing a free'd amount */
+
+	if ( absBytesInput < one_kb) {
+		/* leave as bytes */
+		*convertedAmt = bytesInput;
+		sprintf( unitString, "b" );
+	}
+	else if ( absBytesInput < one_mb ) {
+		/* convert to KB */
+		*convertedAmt = bytesInput / one_kb; 
+		sprintf( unitString, "kb" );
+	}
+	else if ( absBytesInput < one_gb ) {
+		/* convert to MB */
+		*convertedAmt = bytesInput / one_mb;
+		sprintf( unitString, "mb" );
+	}
+	else if ( absBytesInput < one_tb ) {
+		/* convert to GB */
+		*convertedAmt = bytesInput / one_gb;
+		sprintf( unitString, "gb" );
+	}
+	else {
+		/* convert to TB - don't think we need to worry about PetaBytes! */
+		*convertedAmt = bytesInput / one_tb;
+		sprintf( unitString, "tb" );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Memory.c
--- a/Base/Foundation/src/Memory.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1865 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Memory.c 4109 2007-05-17 06:22:56Z RaquibulHassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-
-#include "pcu/pcu.h"
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "MemoryTag.h"
-#include "MemoryField.h"
-#include "MemoryPointer.h"
-#include "Memory.h"
-
-
-#ifndef MAX
-#define MAX( x, y ) ((x > y) ? x : y)
-#endif
-
-const Type Memory_Type = "Memory";
-
-Memory* stgMemory = 0;
-
-const int MEMORY_INITIAL_SIZE = 4;	/**< Number of pointers the array begins with. */
-const int MEMORY_DELTA_SIZE = 4;	/**< Number of pointers to extend array by. */
-
-/** Adds a MemoryPointer to the database. */
-void Memory_Add_Pointer( MemoryPointer* memoryPointer );
-
-/** Frees the allocation associated with MemoryPointer, but not the pointer itself. */
-void Memory_Free_Pointer( MemoryPointer* memoryPointer );
-
-/** Attempts to find the pointer in database. */
-MemoryPointer* Memory_Find_Pointer( Pointer ptr );
-
-/** Setups the pointer locations in a 2D array. */
-void Memory_SetupPointer_2DArray(
-	void* ptr,
-	SizeT itemSize,
-	Index xLength,
-	Index yLength );
-
-/** Setups the pointer locations in a 3D array. */
-void Memory_SetupPointer_3DArray(
-	void* ptr,
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Index zLength );
-
-/** Moves data inside an enlarged 2D array to the appropriate position.
- * Note that it just moves the data of the array - in the case of a traditional
- * 2D array, will also need to separately update the pointer indices. */
-void Memory_Relocate_2DArrayData(
-	void* destPtr, 
-	void* srcPtr,
-	SizeT itemSize, 
-	Index oldX, 
-	Index oldY, 
-	Index newX, 
-	Index newY );
-
-/** Moves data inside an enlarged 3D array to the appropriate position.
- * Note that it just moves the data of the array - in the case of a traditional
- * 2D array, will also need to separately update the pointer indices. */
-void Memory_Relocate_3DArrayData( 
-	void* destPtr, 
-	void* srcPtr,
-	SizeT itemSize, 
-	Index oldX, 
-	Index oldY, 
-	Index oldZ,
-	Index newX, 
-	Index newY,
-	Index newZ );
-
-#define Memory_OutOfMemoryError( size ) \
-	_Memory_OutOfMemoryErrorFunc( __func__, __LINE__, size )
-
-/** Display an out of memory error after an alloc call */
-void _Memory_OutOfMemoryErrorFunc( Name func, int line, SizeT size );
-
-
-int compareFunction_NodeData_To_NodeData (void *nodeData1, void *nodeData2){
-	
-	MemoryPointer *memPtr1;
-	MemoryPointer *memPtr2;
-	
-	memPtr1 = (MemoryPointer*) nodeData1;
-	memPtr2 = (MemoryPointer*) nodeData2;
-	
-	#if 0
-		printf ("comparing node data %p with data %p\t", memPtr->ptr, data2);
-		if (memPtr->ptr == data2){
-			printf (";pointers are equal");
-		}
-		printf ("\n");
-	#endif
-	
-	if ( memPtr1->ptrReference > memPtr2->ptrReference ){
-		return 1;
-	}
-	else if ( memPtr1->ptrReference == memPtr2->ptrReference && memPtr1->status != MEMORY_POINTER_RELEASED ){
-		return 0;
-	}
-	else{
-		return -1;
-	}
-}
-
-int compareFunction_NodeData_To_Value (void *nodeData, void *value){
-	
-	MemoryPointer *memPtr;
-	
-	memPtr = (MemoryPointer*) nodeData;
-	
-	#if 0
-		printf ("comparing node data %p with data %p\t", memPtr->ptrReference, value);
-		if (memPtr->ptrReference == value){
-			printf (";pointers are equal");
-		}
-		printf ("\n");
-	#endif
-	
-	if ( memPtr->ptrReference > value ){
-		return 1;
-	}
-	else if ( memPtr->ptrReference == value && memPtr->status != MEMORY_POINTER_RELEASED ){
-		return 0;
-	}
-	else{
-		return -1;
-	}
-}
-
-Memory* Memory_Init()
-{
-	Memory* result;
-	
-	
-	result = (Memory*) malloc( sizeof(Memory) );
-	if ( result == NULL ) {
-		Memory_OutOfMemoryError( sizeof(Memory) );
-	}
-	
-	result->enable = True;
-	result->stamp = 0;
-	
-	result->types = MemoryField_New( "Memory Statistics" );
-	result->files = MemoryField_New( "Memory Statistics" );
-	
-	result->ptrCount = 0;
-	result->ptrSize = MEMORY_INITIAL_SIZE;
-	
-	result->pointers = BTree_New ( compareFunction_NodeData_To_NodeData, NULL, NULL, NULL, BTREE_ALLOW_DUPLICATES );
-	
-	result->ptrCache = NULL;
-	result->memCache = NULL;
-	
-	result->infoStream = NULL;
-	result->errorStream = NULL;
-	result->debugStream = NULL;
-
-	result->stgCurrentMemory = 0;
-	result->stgPeakMemory = 0;
-   stgMemory = result;
-	
-	return result;
-}
-
-void Memory_Delete()
-{
-	if ( stgMemory == NULL )
-	{
-		return;
-	}
-	
-	MemoryField_Delete( stgMemory->types );
-	MemoryField_Delete( stgMemory->files );
-	
-	/* Releasing the memory in the tree, that might not have been released by the user, before deleting the tree */
-	BTree_ParseTree ( stgMemory->pointers, MemoryPointer_Delete_Helper, NULL );
-	
-	/** Checking whether the memory module has been initialised before trying to delete it */
-	if( stgMemory->pointers != NULL){
-		BTree_Delete( stgMemory->pointers );
-	}
-   free( stgMemory );
-}
-
-
-void* _Memory_Alloc_Func(
-	SizeT size,
-	Type type,
-	Name const name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	
-	MemoryPointer* memoryPointer;
-	
-	result = _Memory_InternalMalloc( size );
-	
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_OBJECT, size, size );
-		memoryPointer->length.oneD = 1;
-		
-		Memory_Add_Pointer( memoryPointer );
-	}
-	return result;
-}
-
-void* _Memory_Alloc_Array_Func(
-	SizeT itemSize,
-	Index arrayLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	SizeT size;
-	
-	MemoryPointer* memoryPointer;
-	
-	size = Memory_Length_1DArray( itemSize, arrayLength );
-	result = _Memory_InternalMalloc( size );
-	
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_1DARRAY, itemSize, size );
-		memoryPointer->length.oneD = arrayLength;
-		
-		Memory_Add_Pointer( memoryPointer );
-	}
-	return result;
-}
-
-void* _Memory_Alloc_2DArray_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	SizeT size;
-	
-	
-	#ifdef MEMORY_STATS
-		MemoryPointer* memoryPointer;
-	#endif
-	
-	size = Memory_Length_2DArray( itemSize, xLength, yLength );
-	result = _Memory_InternalMalloc( size );
-	
-	
-	Memory_SetupPointer_2DArray( result, itemSize, xLength, yLength );
-	
-	#ifdef MEMORY_STATS
-		if ( stgMemory->enable ) {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_2DARRAY, itemSize, size );
-			memoryPointer->length.twoD[0] = xLength;
-			memoryPointer->length.twoD[1] = yLength;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	#endif
-	
-	return result;
-}
-
-void* _Memory_Alloc_3DArray_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Index zLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	SizeT size;
-	
-	#ifdef MEMORY_STATS
-		MemoryPointer* memoryPointer;
-	#endif
-	
-	size = Memory_Length_3DArray( itemSize, xLength, yLength, zLength );
-	result = _Memory_InternalMalloc( size );
-	
-	Memory_SetupPointer_3DArray( result, itemSize, xLength, yLength, zLength );
-	
-	#ifdef MEMORY_STATS
-		if ( stgMemory->enable ) {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DARRAY, itemSize, size );
-			memoryPointer->length.threeD[0] = xLength;
-			memoryPointer->length.threeD[1] = yLength;
-			memoryPointer->length.threeD[2] = zLength;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	#endif
-	
-	return result;
-
-}
-		
-void* _Memory_Alloc_4DArray_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Index zLength,
-	Index wLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer		result;
-	Pointer*	array1;
-	Pointer**	array2;
-	Pointer***	array3;
-	SizeT size;
-	Index i, j, k;
-	int ptrHeader1, ptrHeader2, ptrHeader3;
-	int ySize, yzProduct, yzwProduct, zwProduct;
-	
-	#ifdef MEMORY_STATS
-		MemoryPointer* memoryPointer;
-	#endif
-	
-	size = Memory_Length_4DArray( itemSize, xLength, yLength, zLength, wLength );
-	result = _Memory_InternalMalloc( size );
-	
-	ptrHeader1 = sizeof(Pointer) * xLength;
-	ptrHeader2 = sizeof(Pointer) * xLength * yLength;
-	ptrHeader3 = sizeof(Pointer) * xLength * yLength * zLength;
-	
-	ySize = sizeof(Pointer) * yLength;
-	yzProduct = yLength * zLength;
-	yzwProduct = yLength * zLength * wLength;
-	zwProduct = zLength * wLength;
-	
-	array1 = (Pointer*) result;
-	for ( i = 0; i < xLength; ++i )
-	{
-		array1[i] = (Pointer)( (ArithPointer)result + ptrHeader1 + ( i * ySize ) );
-	}
-	
-	array2 = (Pointer**) result;
-	for ( i = 0; i < xLength; ++i )
-	{
-		for ( j = 0; j < yLength; ++j )
-		{
-			array2[i][j] = (Pointer)( (ArithPointer)result
-				+ ptrHeader1
-				+ ptrHeader2
-				+ ( ( (i * yzProduct) + (j * zLength) ) * sizeof(Pointer) ) );
-		}
-	}
-	
-	array3 = (Pointer***) result;
-	for ( i = 0; i < xLength; ++i )
-	{
-		for ( j = 0; j < yLength; ++j )
-		{
-			for ( k = 0; k < zLength; ++k )
-			{
-				array3[i][j][k] = (Pointer)( (ArithPointer)result
-					+ ptrHeader1
-					+ ptrHeader2
-					+ ptrHeader3
-					+ ( ( (i * yzwProduct) + (j * zwProduct) + (k * wLength) ) * itemSize ) );
-			}
-		}
-	}
-	
-	#ifdef MEMORY_STATS
-		if ( stgMemory->enable ) {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DARRAY, itemSize, size );
-			memoryPointer->length.fourD[0] = xLength;
-			memoryPointer->length.fourD[1] = yLength;
-			memoryPointer->length.fourD[2] = zLength;
-			memoryPointer->length.fourD[3] = wLength;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	#endif
-	
-	return result;
-}
-
-
-void* _Memory_Alloc_2DArrayAs1D_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	SizeT size;
-	
-	MemoryPointer* memoryPointer;
-	
-	size = Memory_Length_2DAs1D( itemSize, xLength, yLength );
-	result = _Memory_InternalMalloc( size );
-	
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_2DAS1D, itemSize, size );
-		memoryPointer->length.twoD[0] = xLength;
-		memoryPointer->length.twoD[1] = yLength;
-		
-		Memory_Add_Pointer( memoryPointer );
-	}
-	return result;
-}
-
-void* _Memory_Alloc_3DArrayAs1D_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Index zLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	SizeT size;
-	
-	MemoryPointer* memoryPointer;
-	
-	size = Memory_Length_3DAs1D( itemSize, xLength, yLength, zLength );
-	result = _Memory_InternalMalloc( size );
-	
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DAS1D, itemSize, size );
-		memoryPointer->length.threeD[0] = xLength;
-		memoryPointer->length.threeD[1] = yLength;
-		memoryPointer->length.threeD[2] = zLength;
-		
-		Memory_Add_Pointer( memoryPointer );
-	}
-	
-	return result;
-}
-
-void* _Memory_Alloc_4DArrayAs1D_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Index zLength,
-	Index wLength,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer result;
-	SizeT size;
-	
-	MemoryPointer* memoryPointer;
-	
-	size = Memory_Length_4DAs1D( itemSize, xLength, yLength, zLength, wLength );
-	result = _Memory_InternalMalloc( size );
-	
-	
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_4DAS1D, itemSize, size );
-		memoryPointer->length.fourD[0] = xLength;
-		memoryPointer->length.fourD[1] = yLength;
-		memoryPointer->length.fourD[2] = zLength;
-		memoryPointer->length.fourD[3] = wLength;
-	
-		Memory_Add_Pointer( memoryPointer );
-	}
-	
-	return result;
-}
-
-#if 0
-void parseFunc (void *object, void *args){
-
-	MemoryPointer *memPtr = (MemoryPointer*)object;
-	printf ("\tdata - %p\n", memPtr->ptr);
-}
-#endif
-
-void* _Memory_Alloc_2DComplex_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index* yLengths,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer		result;
-	Pointer*	array;
-	SizeT size;
-	Index i;
-	
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer;
-	#endif
-	
-	size = Memory_Length_2DComplex( itemSize, xLength, yLengths );
-	
-	if ( 0 == size ) {
-		Journal_Printf( stgMemory->errorStream, "Warning: () called to allocate a 2D variable "
-			"length array where the total size calculated was 0. Returning NULL.\n", __func__ );
-		return NULL;
-	}
-	
-	result = _Memory_InternalMalloc( size );
-	
-	
-	array = (Pointer*) result;
-	
-	/* Start of data area for the first array */
-	array[0] = (Pointer) ( (ArithPointer)array + sizeof(Pointer) * xLength);
-	
-	for ( i = 1; i < xLength; ++i )
-	{
-		/* The previous array plus the previous length offset */
-		array[i] = (Pointer)( (ArithPointer)array[i - 1] + ( itemSize * yLengths[i - 1] ) );
-	}
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_2DCOMPLEX, itemSize, size );
-		memoryPointer->length.xyz.x = xLength;
-		memoryPointer->length.xyz.y = (Index*) malloc( sizeof(Index) * xLength );
-		if ( memoryPointer->length.xyz.y == NULL ) {
-			Memory_OutOfMemoryError( sizeof(Index) * xLength );
-		}
-		
-		for ( i = 0; i < xLength; ++i )
-		{
-			memoryPointer->length.xyz.y[i] = yLengths[i];
-		}
-		
-		Memory_Add_Pointer( memoryPointer );
-	}
-	#endif
-	
-	return result;
-}
-
-
-Index** _Memory_Alloc_3DSetup_Func(
-	Index xLength,
-	Index* yLengths,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Index** result;
-	#ifdef MEMORY_STATS
-	MemoryPointer *memPtr;
-	#endif
-	
-	result = (Index**) _Memory_Alloc_2DComplex_Func( sizeof(Index), xLength, yLengths,
-		"Index", "MEMORY_SETUP", fileName, funcName, lineNumber );
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memPtr = Memory_Find_Pointer ( result );
-		assert( memPtr );
-		memPtr->allocType = MEMORY_3DSETUP;
-	}
-	#endif
-	
-	return result;
-}
-
-
-void* _Memory_Alloc_3DComplex_Func(
-	SizeT itemSize,
-	Index xLength,
-	Index* yLengths,
-	Index** zLengths,
-	Type type,
-	Name name,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	Pointer		result;
-	Pointer*	array1;
-	Pointer**	array2;
-	SizeT size;
-	Index i, j;
-	ArithPointer startPos, diffSize;
-	
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer;
-	#endif
-	
-	size = Memory_Length_3DComplex( itemSize, xLength, yLengths, zLengths );
-	result = _Memory_InternalMalloc( size );
-	
-	
-	array1 = (Pointer*) result;
-	
-	/* Start of data area for the first array */
-	startPos = (ArithPointer)result;
-	diffSize = (ArithPointer)( sizeof(Pointer) * xLength );
-	for (i = 0; i < xLength; ++i)
-	{
-		array1[i] = (Pointer)( startPos + diffSize );
-		
-		/* The previous array plus the previous length offset */
-		startPos = (ArithPointer)array1[i];
-		diffSize = (ArithPointer)( sizeof(Pointer) * yLengths[i] );
-	}
-	
-	array2 = (Pointer**)result;
-	
-	for ( i = 0; i < xLength; ++i )
-	{
-		for ( j = 0; j < yLengths[i]; ++j )
-		{
-			array2[i][j] = (Pointer)( startPos + diffSize );
-			startPos = (ArithPointer)array2[i][j];
-			diffSize = (ArithPointer)( zLengths[i][j] * itemSize );
-		}
-	}
-	
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DCOMPLEX, itemSize, size );
-		memoryPointer->length.xyz.x = xLength;
-		memoryPointer->length.xyz.y = (Index*) malloc( sizeof(Index) * xLength );
-		if ( memoryPointer->length.xyz.y == NULL ) {
-			Memory_OutOfMemoryError( sizeof(Index) * xLength );
-		}
-		
-		for ( i = 0; i < xLength; ++i )
-		{
-			memoryPointer->length.xyz.y[i] = yLengths[i];
-		}
-		
-		memoryPointer->length.xyz.z = (Index**) malloc( Memory_Length_2DComplex( sizeof(Index), xLength, yLengths ) );
-		if ( memoryPointer->length.xyz.z == NULL ) {
-			Memory_OutOfMemoryError( Memory_Length_2DComplex( sizeof(Index), xLength, yLengths ) );
-		}
-		array1 = (Pointer*) memoryPointer->length.xyz.z;
-		
-		/* Start of data area for the first array */	
-		startPos = (ArithPointer)memoryPointer->length.xyz.z;
-		diffSize = (ArithPointer)( sizeof(Pointer) * xLength );
-		for (i = 0; i < xLength; ++i)
-		{
-			array1[i] = (Pointer)( startPos + diffSize );
-			
-			/* The previous array plus the previous length offset */
-			startPos = (ArithPointer)array1[i];
-			diffSize = (ArithPointer)( sizeof(Index) * yLengths[i] );
-		}
-		
-		/* Copy the z values */
-		for (i = 0; i < xLength; ++i)
-			{
-			for (j = 0; j < yLengths[i]; ++j)
-			{
-				memoryPointer->length.xyz.z[i][j] = zLengths[i][j];
-			}
-		}
-		
-		Memory_Add_Pointer( memoryPointer );
-	}
-	#endif
-	
-	return result;
-}
-
-
-void* _Memory_Realloc_Func( 
-	void* ptr, 
-	SizeT newSize,
-	Type type,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	MemoryPointer* memoryPointer;
-	BTreeNode *node;
-	SizeT diffBytes;
-	
-	Pointer result = NULL;
-	
-	memoryPointer = Memory_Find_Pointer( ptr );
-
-	result = _Memory_InternalRealloc( ptr, newSize );
-	
-	if ( stgMemory->enable ) {
-		if ( memoryPointer ) {
-			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
-			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
-			pcu_assert( memoryPointer->allocType == MEMORY_OBJECT );
-
-			if ( result != NULL ) {
-				if (stgMemory->pointers){
-					node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
-					assert( node );
-				
-					BTree_DeleteNode( stgMemory->pointers, (BTreeNode*) node );
-				}
-				
-				diffBytes = newSize - memoryPointer->totalSize;
-				MemoryField_Update( memoryPointer->name, diffBytes );
-				MemoryField_Update( memoryPointer->func, diffBytes );
-				memoryPointer->ptr = result;
-				memoryPointer->ptrReference = result;
-				memoryPointer->stamp = stgMemory->stamp++;
-				
-				memoryPointer->itemSize = newSize;
-				memoryPointer->totalSize = newSize;
-				stgMemory->ptrCache = result;
-				stgMemory->memCache = memoryPointer;
-	
-				if (stgMemory->pointers){
-					BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-				}
-			}
-			else {
-				memoryPointer->ptr = NULL;
-				memoryPointer->status = MEMORY_POINTER_RELEASED;
-				memoryPointer->stamp = stgMemory->stamp++;
-			}
-		}
-		else {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
-				fileName, funcName, lineNumber, MEMORY_OBJECT, newSize, newSize );
-			memoryPointer->length.oneD = 1;
-			Memory_Add_Pointer( memoryPointer );
-		}
-	}
-	
-	return result;
-}
-
-
-void* _Memory_Realloc_Array_Func( 
-	void* ptr, 
-	SizeT itemSize, 
-	Index newLength,
-	Type type,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	MemoryPointer* memoryPointer;
-	BTreeNode *node;
-	SizeT newSize;
-	SizeT diffBytes;
-	
-	Pointer result = NULL;
-	
-	memoryPointer = Memory_Find_Pointer( ptr );
-	
-	newSize = itemSize * newLength;
-	result = _Memory_InternalRealloc( ptr, newSize );
-	
-	if ( stgMemory->enable ) {
-		if ( memoryPointer ) {
-			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
-			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
-			pcu_assert( memoryPointer->allocType == MEMORY_1DARRAY );
-			if ( result != NULL )
-			{
-				MemoryPointer* copy;
-				
-				if (stgMemory->pointers){
-					node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
-					assert( node );
-				
-					BTree_DeleteNode( stgMemory->pointers, (BTreeNode*) node );
-				}
-				
-				diffBytes = newSize - memoryPointer->totalSize;
-				MemoryField_Update( memoryPointer->name, diffBytes );
-				MemoryField_Update( memoryPointer->func, diffBytes );
-				
-				memoryPointer->ptr = result;
-				memoryPointer->ptrReference = result;
-				memoryPointer->stamp = stgMemory->stamp++;
-				memoryPointer->itemSize = itemSize;
-				memoryPointer->totalSize = newSize;
-				memoryPointer->length.oneD = newLength;
-				
-				copy = (MemoryPointer*)_Memory_InternalMalloc( sizeof( MemoryPointer ) );
-				memcpy( copy, memoryPointer, sizeof( MemoryPointer) );
-				
-				copy->ptr = result;
-				copy->ptrReference = result;
-				
-				
-				stgMemory->ptrCache = result;
-				stgMemory->memCache = memoryPointer;
-				
-				if (stgMemory->pointers){
-					BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-				}
-				
-			}
-			else
-			{
-				memoryPointer->ptr = NULL;
-				memoryPointer->status = MEMORY_POINTER_RELEASED;
-				memoryPointer->stamp = stgMemory->stamp++;
-			}
-		}
-		else {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
-				fileName, funcName, lineNumber, MEMORY_1DARRAY, itemSize, newSize );
-			memoryPointer->length.oneD = newLength;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	}
-	return result;
-}
-
-
-void* _Memory_Realloc_2DArray_Func(
-	void* ptr,
-	SizeT itemSize, 
-	Index oldX,
-	Index oldY,
-	Index newX, 
-	Index newY,
-	Type type,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer;
-	SizeT diffBytes;
-	BTreeNode *node;
-	#endif
-	
-	SizeT newSize = 0;
-	Pointer result = NULL;
-	Pointer* array;
-	
-	if ( ptr != NULL ) {
-		array = (Pointer*)ptr;
-		oldX = ( (ArithPointer)array[0] - (ArithPointer)ptr ) / sizeof(Pointer);
-		oldY = ( (ArithPointer)array[1] - (ArithPointer)array[0] ) / itemSize;
-	}
-	
-	newSize = Memory_Length_2DArray( itemSize, newX, newY );
-	result = _Memory_InternalRealloc( ptr, newSize );
-	
-	if ( ptr != NULL ) {
-		Memory_Relocate_2DArrayData( (Pointer)( (ArithPointer)result + (newX * sizeof(Pointer)) ),
-					 (Pointer)( (ArithPointer)result + (oldX * sizeof(Pointer)) ),
-					 itemSize, oldX, oldY, newX, newY );
-	}
-	
-	Memory_SetupPointer_2DArray( result, itemSize, newX, newY );
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memoryPointer = Memory_Find_Pointer( ptr );
-		if ( memoryPointer ) {
-			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
-			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
-			pcu_assert( memoryPointer->allocType == MEMORY_2DARRAY );
-			
-			if (stgMemory->pointers){
-				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
-				assert( node );
-			
-				BTree_DeleteNode( stgMemory->pointers, (void*) node );
-			}
-			
-			diffBytes = newSize - memoryPointer->totalSize;
-			MemoryField_Update( memoryPointer->name, diffBytes );
-			MemoryField_Update( memoryPointer->func, diffBytes );
-			memoryPointer->ptr = result;
-			memoryPointer->ptrReference = result;
-			memoryPointer->stamp = stgMemory->stamp++;
-			memoryPointer->itemSize = itemSize;
-			memoryPointer->totalSize = newSize;
-			memoryPointer->length.twoD[0] = newX;
-			memoryPointer->length.twoD[1] = newY;
-			stgMemory->ptrCache = result;
-			stgMemory->memCache = memoryPointer;
-			
-			if (stgMemory->pointers){
-				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-			}
-		}
-		else {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
-				fileName, funcName, lineNumber, MEMORY_2DARRAY, itemSize, newSize );
-			memoryPointer->length.twoD[0] = newX;
-			memoryPointer->length.twoD[1] = newY;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	}
-	#endif
-	
-	return result;
-}
-
-void* _Memory_Realloc_3DArray_Func( 
-	void* ptr, 
-	SizeT itemSize, 
-	Index oldX,
-	Index oldY,
-	Index oldZ,
-	Index newX, 
-	Index newY, 
-	Index newZ,
-	Type type,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer;
-	SizeT diffBytes;
-	BTreeNode *node;
-	#endif
-	
-	SizeT newSize = 0;
-	Pointer result = NULL;
-	Pointer* array;
-	Pointer** array2;
-	
-	if ( ptr != NULL ) {
-		array = (Pointer*)ptr;
-		array2 = (Pointer**)ptr;
-		
-		oldX = ( (ArithPointer)array[0] - (ArithPointer)ptr ) / sizeof(Pointer);
-		oldY = ( (ArithPointer)array[1] - (ArithPointer)array[0] ) / sizeof(Pointer);
-		oldZ = ( (ArithPointer)array2[0][1] - (ArithPointer)array2[0][0] ) / itemSize;
-	}
-	
-	newSize = Memory_Length_3DArray( itemSize, newX, newY, newZ );
-	result = _Memory_InternalRealloc( ptr, newSize );
-	
-	if ( ptr != NULL ) {
-		Memory_Relocate_3DArrayData( (Pointer)( (ArithPointer)result + ( (newX + (newX * newY)) * sizeof(Pointer) ) ),
-					 (Pointer)( (ArithPointer)result + ( (oldX + (oldX * oldY)) * sizeof(Pointer) ) ),
-					 itemSize, oldX, oldY, oldZ, newX, newY, newZ );
-	}
-	
-	Memory_SetupPointer_3DArray( result, itemSize, newX, newY, newZ );
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memoryPointer = Memory_Find_Pointer( ptr );
-		if ( memoryPointer ) {
-			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
-			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
-			pcu_assert( memoryPointer->allocType == MEMORY_3DARRAY );
-			
-			if (stgMemory->pointers){
-				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
-				assert( node );
-			
-				BTree_DeleteNode( stgMemory->pointers, (void*) node );
-			}
-			
-			diffBytes = newSize - memoryPointer->totalSize;
-			MemoryField_Update( memoryPointer->name, diffBytes );
-			MemoryField_Update( memoryPointer->func, diffBytes );
-			memoryPointer->ptr = result;
-			memoryPointer->ptrReference = result;
-			memoryPointer->stamp = stgMemory->stamp++;
-			memoryPointer->itemSize = itemSize;
-			memoryPointer->totalSize = newSize;
-			memoryPointer->length.threeD[0] = newX;
-			memoryPointer->length.threeD[1] = newY;
-			memoryPointer->length.threeD[2] = newZ;
-			stgMemory->ptrCache = result;
-			stgMemory->memCache = memoryPointer;
-			
-			if (stgMemory->pointers){
-				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-			}
-		}
-		else {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
-				fileName, funcName, lineNumber, MEMORY_3DARRAY, itemSize, newSize );
-			memoryPointer->length.twoD[0] = newX;
-			memoryPointer->length.twoD[1] = newY;
-			memoryPointer->length.twoD[2] = newY;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	}
-	#endif
-	
-	return result;
-}
-
-void* _Memory_Realloc_2DArrayAs1D_Func( 
-	void* ptr, 
-	SizeT itemSize, 
-	Index oldX, 
-	Index oldY, 
-	Index newX, 
-	Index newY,
-	Type type,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer;
-	BTreeNode *node;
-	SizeT diffBytes;
-	#endif
-	
-	SizeT newSize;
-	Pointer result = NULL;
-	
-	newSize = itemSize * newX * newY;
-	result = _Memory_InternalRealloc( ptr, newSize );
-	
-	if ( ptr != NULL )
-	{
-		Memory_Relocate_2DArrayData( result, result, itemSize, oldX, oldY, newX, newY );
-	}
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memoryPointer = Memory_Find_Pointer( ptr );
-		if ( memoryPointer ) {
-			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
-			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
-			pcu_assert( memoryPointer->allocType == MEMORY_2DAS1D );
-
-			if (stgMemory->pointers){
-				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
-				assert( node );
-			
-				BTree_DeleteNode( stgMemory->pointers, (void*) node );
-			}
-			
-			diffBytes = newSize - memoryPointer->totalSize;
-			MemoryField_Update( memoryPointer->name, diffBytes );
-			MemoryField_Update( memoryPointer->func, diffBytes );
-			memoryPointer->ptr = result;
-			memoryPointer->ptrReference = result;
-			memoryPointer->stamp = stgMemory->stamp;
-			memoryPointer->itemSize = itemSize;
-			memoryPointer->totalSize = newSize;
-			memoryPointer->length.twoD[0] = newX;
-			memoryPointer->length.twoD[1] = newY;
-			stgMemory->ptrCache = result;
-			stgMemory->memCache = memoryPointer;
-			
-			if (stgMemory->pointers){
-				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-			}
-		}
-		else {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
-				fileName, funcName, lineNumber, MEMORY_2DAS1D, itemSize, newSize );
-			memoryPointer->length.twoD[0] = newX;
-			memoryPointer->length.twoD[1] = newY;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	}
-	#endif
-	
-	return result;
-}
-
-void* _Memory_Realloc_3DArrayAs1D_Func( 
-	void* ptr, 
-	SizeT itemSize,
-	Index oldX, 
-	Index oldY, 
-	Index oldZ, 
-	Index newX, 
-	Index newY, 
-	Index newZ,
-	Type type,
-	Name fileName,
-	Name funcName,
-	int lineNumber )
-{
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer;
-	BTreeNode *node;
-	SizeT diffBytes;
-	#endif
-	
-	SizeT newSize;
-	Pointer result = NULL;
-	
-	newSize = itemSize * newX * newY * newZ;
-	result = _Memory_InternalRealloc( ptr, newSize );
-	
-	if ( ptr != NULL ) {
-		Memory_Relocate_3DArrayData( result, result, itemSize, oldX, oldY, oldZ, newX, newY, newZ );
-	}
-	
-	#ifdef MEMORY_STATS
-	if ( stgMemory->enable ) {
-		memoryPointer = Memory_Find_Pointer( ptr );
-		if ( memoryPointer ) {
-			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
-			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
-			pcu_assert( memoryPointer->allocType == MEMORY_3DAS1D );
-
-			if (stgMemory->pointers){
-				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
-				assert( node );
-			
-				BTree_DeleteNode( stgMemory->pointers, (void*) node );
-			}
-			
-			diffBytes = newSize - memoryPointer->totalSize;
-			MemoryField_Update( memoryPointer->name, diffBytes );
-			MemoryField_Update( memoryPointer->func, diffBytes );
-			memoryPointer->ptr = result;
-			memoryPointer->ptrReference = result;
-			memoryPointer->stamp = stgMemory->stamp++;
-			memoryPointer->itemSize = itemSize;
-			memoryPointer->totalSize = newSize;
-			memoryPointer->length.threeD[0] = newX;
-			memoryPointer->length.threeD[1] = newY;
-			memoryPointer->length.threeD[2] = newZ;
-			stgMemory->ptrCache = result;
-			stgMemory->memCache = memoryPointer;
-			
-			if (stgMemory->pointers){
-				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-			}
-		}
-		else {
-			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
-				fileName, funcName, lineNumber, MEMORY_3DAS1D, itemSize, newSize );
-			memoryPointer->length.twoD[0] = newX;
-			memoryPointer->length.twoD[1] = newY;
-			memoryPointer->length.twoD[2] = newY;
-			
-			Memory_Add_Pointer( memoryPointer );
-		}
-	}
-	#endif
-	
-	return result;
-}
-
-
-/* This function should only be called on ptrs allocated by StGermain's Memory routines */
-void _Memory_Free_Func( void* ptr ) {
-	#ifdef MEMORY_STATS
-	MemoryPointer* memoryPointer = NULL;
-	#endif
-
-	if( !ptr ) return;
-	
-	#ifdef MEMORY_STATS
-	memoryPointer = Memory_Find_Pointer( ptr );
-	/* If memory stats is enabled, then any pointer allocated using the Stg memory system should _always_ have a MemoryPointer
-	 * associated with it, and findable */
-	pcu_assert( memoryPointer );
-	Memory_Free_Pointer( memoryPointer );
-	#else
-	_Memory_InternalFree( ptr );
-	#endif
-}
-	
-SizeT Memory_Length_1DArray( SizeT itemSize, Index length )
-{
-	return itemSize * length;
-}
-
-SizeT Memory_Length_2DArray( SizeT itemSize, Index xLength, Index yLength )
-{
-	return ( sizeof(Pointer) * xLength ) + ( itemSize * xLength * yLength );
-}
-
-SizeT Memory_Length_3DArray( SizeT itemSize, Index xLength, Index yLength, Index zLength )
-{
-	return ( sizeof(Pointer) * ( xLength + xLength * yLength ) ) + ( itemSize * xLength * yLength * zLength );
-}
-
-
-SizeT Memory_Length_4DArray( SizeT itemSize, Index xLength, Index yLength, Index zLength, Index wLength )
-{
-	return ( sizeof(Pointer) * ( xLength + xLength * yLength + xLength * yLength * zLength ) )
-		 + ( itemSize * xLength * yLength * zLength * wLength );
-}
-
-SizeT Memory_Length_2DComplex( SizeT itemSize, Index xLength, Index* yLengths )
-{
-	Index i;
-	SizeT result = 0;
-	for ( i = 0; i < xLength; ++i )
-	{
-		result += yLengths[i];
-	}
-	result *= itemSize;
-	result += sizeof(Pointer) * xLength;
-	
-	return result;
-	
-}
-
-SizeT Memory_Length_3DComplex( SizeT itemSize, Index xLength, Index* yLengths, Index** zLengths )
-{
-	Index i, j;
-	SizeT result = 0;
-	SizeT ptrSize = xLength;
-	
-	for ( i = 0; i < xLength; ++i )
-	{
-		for ( j = 0; j < yLengths[i]; ++j )
-		{
-			result += zLengths[i][j];
-		}
-		ptrSize += yLengths[i];
-	}
-	result *= itemSize;
-	result += sizeof(Pointer) * ptrSize; 
-	
-	return result;
-}
-
-SizeT Memory_Length_2DAs1D( SizeT itemSize, Index xLength, Index yLength )
-{
-	return itemSize * xLength * yLength;
-}
-
-SizeT Memory_Length_3DAs1D( SizeT itemSize, Index xLength, Index yLength, Index zLength )
-{
-	return itemSize * xLength * yLength * zLength;
-}
-
-SizeT Memory_Length_4DAs1D( SizeT itemSize, Index xLength, Index yLength, Index zLength, Index wLength )
-{
-	return itemSize * xLength * yLength * zLength * wLength;
-}
-
-void Memory_Print_Summary()
-{
-	Index i;
-	
-	MemoryField_PrintSummary( stgMemory->types, "Type", MEMORYFIELD_ALL );
-	
-	Stream_Indent( stgMemory->infoStream );
-	
-	for ( i = 0; i < stgMemory->types->subCount; ++i )
-	{
-		Journal_Printf( stgMemory->infoStream, "\n" );
-		MemoryField_PrintSummary( stgMemory->types->subFields[i], "Name", MEMORYFIELD_ALL );
-	}
-	
-	Stream_UnIndent( stgMemory->infoStream );
-}
-
-void Memory_Print()
-{
-	Memory_Print_Summary();
-}
-
-void Memory_Print_Leak()
-{
-	Memory_Print_Leak_Helper_Arg arguments;
-	
-	arguments.printOptions = MEMORYPOINTER_ALL;
-	arguments.numLeaks = 0;
-	arguments.warningPrinted = False;
-	
-	BTree_ParseTree ( stgMemory->pointers, Memory_Print_Leak_Helper,  (void*)( &arguments ) );
-	
-	if ( arguments.numLeaks > 0 )
-	{
-		printf( "\nPossible leaks detected: %d\n", arguments.numLeaks );
-	}
-	
-}
-
-void Memory_Print_Leak_Helper( void *memoryPointer, void *args )
-{
-	MemoryPointer *memPtr = NULL;
-	Memory_Print_Leak_Helper_Arg *arguments = NULL;
-	
-	assert( memoryPointer );
-	assert( args );
-	
-	memPtr = (MemoryPointer*) memoryPointer;
-	arguments = (Memory_Print_Leak_Helper_Arg*) args;
-	
-	if ( memPtr->ptr != NULL && memPtr->status != MEMORY_POINTER_RELEASED ){
-		if ( !arguments->warningPrinted )
-		{
-			/* A leak exists, so print warning title. */
-			Journal_Printf( stgMemory->infoStream, "Warning. Possible memory leak:\n" );
-			arguments->warningPrinted = True;
-		}
-		
-		MemoryPointer_PrintAll( memPtr );
-		++arguments->numLeaks;
-	}
-}
-
-
-void Memory_Print_Type_Func( Type type )
-{
-	MemoryField* typeField;
-	
-	typeField = MemoryField_Register( stgMemory->types, type );
-	
-	MemoryField_PrintSummary( typeField, "Name", MEMORYFIELD_ALL );
-}
-
-void Memory_Print_Type_Name_Func( Type type, Name name )
-{
-	MemoryField* typeField;
-	MemoryField* nameField;
-	MemoryPointer* memPtr;
-	MemoryPointer_Print_Type_Name_Func_Helper_Arg arguments;
-	
-	
-	typeField = MemoryField_Register( stgMemory->types, type );
-	nameField = MemoryField_Register( typeField, name );
-	
-	Journal_PrintfL( stgMemory->infoStream, 1, "Type: %s\n", type );
-	MemoryField_PrintHeader( "Name", MEMORYFIELD_ALL, strlen(name) );
-	MemoryField_Print( nameField, MEMORYFIELD_ALL, strlen(name) );
-	
-	Stream_Indent( stgMemory->infoStream );
-	
-	memPtr = NULL;
-	arguments.printOptions = (MemoryPointerColumn)(
-				MEMORYPOINTER_PTR |
-				MEMORYPOINTER_FILE |
-				MEMORYPOINTER_FUNC |
-				MEMORYPOINTER_LINE |
-				MEMORYPOINTER_ALLOCTYPE |
-				MEMORYPOINTER_ITEMSIZE |
-				MEMORYPOINTER_TOTALSIZE |
-				MEMORYPOINTER_LENGTH);
-	arguments.type = type;
-	arguments.name = name;
-	
-	BTree_ParseTree ( stgMemory->pointers, MemoryPointer_Print_Type_Name_Func_Helper, (void *) ( &arguments ) );
-	
-	Stream_UnIndent( stgMemory->infoStream );
-}
-
-
-void Memory_Print_File( char* fileName )
-{
-	MemoryField* fileField;
-	
-	fileField = MemoryField_Register( stgMemory->files, fileName );
-	
-	MemoryField_PrintSummary( fileField, "Function", MEMORYFIELD_ALL );
-}
-
-void Memory_Print_File_Function( char* fileName, char* funcName )
-{
-	MemoryField* fileField;
-	MemoryField* funcField;
-	MemoryPointer* memPtr;
-	MemoryPointer_Print_File_Func_Helper_Arg arguments;
-	
-	fileField = MemoryField_Register( stgMemory->files, fileName );
-	funcField = MemoryField_Register( fileField, funcName );
-	
-	Journal_PrintfL( stgMemory->infoStream, 1, "File: %s\n", fileName );
-
-	_MemoryField_CalcLongestSubFieldNameLen( funcField );
-	MemoryField_PrintHeader( "Function", MEMORYFIELD_ALL, strlen(funcName) );
-	MemoryField_Print( funcField, MEMORYFIELD_ALL, strlen(funcName) );
-	
-	Stream_Indent( stgMemory->infoStream );
-	
-	memPtr = NULL;
-	arguments.printOptions = (MemoryPointerColumn)(
-				MEMORYPOINTER_PTR |
-				MEMORYPOINTER_TYPE |
-				MEMORYPOINTER_NAME |
-				MEMORYPOINTER_LINE |
-				MEMORYPOINTER_ALLOCTYPE |
-				MEMORYPOINTER_ITEMSIZE |
-				MEMORYPOINTER_TOTALSIZE |
-				MEMORYPOINTER_LENGTH);
-	arguments.fileName = fileName;
-	arguments.funcName = funcName;
-		
-	BTree_ParseTree ( stgMemory->pointers, MemoryPointer_Print_File_Func_Helper, (void*) ( &arguments ) );
-	
-	Stream_UnIndent( stgMemory->infoStream );
-
-}
-
-void Memory_Print_Pointer( void* ptr )
-{
-	MemoryPointer* memoryPointer;
-	
-	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_Value );
-	memoryPointer = Memory_Find_Pointer( ptr );
-	if ( memoryPointer )
-	{
-		MemoryPointer_PrintAll( memoryPointer );
-	}
-	else
-	{
-		Journal_Printf( stgMemory->infoStream, "No entry exists for (ptr) %p\n", ptr );
-	}
-	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_NodeData );
-}
-
-
-
-void _Memory_Free_Type_Name_Func( Type type, Name name )
-{
-	Memory_Free_Type_Name_Func_Helper_Arg arguments;
-	
-	arguments.name = name;
-	arguments.type = type;
-	
-	BTree_ParseTree ( stgMemory->pointers, _Memory_Free_Type_Name_Func_Helper, &arguments );
-}
-
-void _Memory_Free_Type_Name_Func_Helper( void *memoryPointer, void *args ){
-	MemoryPointer *memPtr = NULL;
-	MemoryField* typeField;
-	MemoryField* nameField;
-	Memory_Free_Type_Name_Func_Helper_Arg *arguments;
-	
-	assert ( memoryPointer );
-	assert ( args );
-	
-	arguments = (Memory_Free_Type_Name_Func_Helper_Arg *) args;
-	memPtr = (MemoryPointer*) memoryPointer;
-	
-	typeField = MemoryField_Register( stgMemory->types, arguments->type );
-	nameField = MemoryField_Register( typeField, arguments->name );
-	
-	
-	if ( memPtr->ptr != NULL
-			&& memPtr->type == typeField
-			&& memPtr->name == nameField )
-	{
-		Memory_Free_Pointer( memPtr );
-	}
-}
-
-void _Memory_Free_Type_Func( Type type )
-{
-	BTree_ParseTree( stgMemory->pointers, _Memory_Free_Type_Func_Helper, (void*) type );
-}
-
-void _Memory_Free_Type_Func_Helper ( void *memoryPointer, void *args )
-{
-	MemoryPointer *memPtr = NULL;
-	MemoryField* typeField;
-	Type type;
-	
-	assert ( memoryPointer );
-	assert ( args );
-	
-	type = (Type) args;
-	memPtr = (MemoryPointer*) memoryPointer;
-	
-	typeField = MemoryField_Register( stgMemory->types, type );
-	
-	if ( memPtr->ptr != NULL
-		&& memPtr->type == typeField )
-	{
-		Memory_Free_Pointer( memPtr );
-	}
-}
-
-Bool Memory_IsAllocated( void* ptr ) {
-
-	#ifdef MEMORY_STATS
-		if ( stgMemory->enable ) {
-			MemoryPointer *memPtr = NULL;
-
-			memPtr = Memory_Find_Pointer( ptr );
-			if ( (memPtr == NULL) || (memPtr->status == MEMORY_POINTER_RELEASED) ) {
-				return False;
-			}
-			else {
-				return True;
-			}
-		}
-		else {
-			#ifdef DEBUG
-				Journal_Printf( 
-					stgMemory->debugStream,
-					"Warning: Memory module not enabled. Memory_IsAllocated() is meaningless\n" );
-			#endif
-			return True;
-		}
-	#else
-		#ifdef DEBUG
-			Journal_Printf(
-				stgMemory->debugStream,
-				"Warning: Memory module not compiled - Memory_IsAllocated() is meaningless\n" );
-		#endif
-		return True;
-	#endif
-}
-
-
-/* Begin private functions */
-
-void Memory_Add_Pointer( MemoryPointer* memoryPointer )
-{
-	assert ( memoryPointer );
-	
-	stgMemory->ptrCache = memoryPointer->ptr;
-	stgMemory->memCache = memoryPointer;
-	
-		if ( !memoryPointer->ptr ){
-#if 0 			
-			printf ("trying to insert a null pointer\n");
-#endif
-			return;
-		}
-
-	BTree_InsertNode ( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
-}
-
-void Memory_Free_Pointer( MemoryPointer* memoryPointer )
-{
-	_Memory_InternalFree( memoryPointer->ptr );
-	memoryPointer->ptr = NULL;
-	memoryPointer->status = MEMORY_POINTER_RELEASED;
-	memoryPointer->stamp = stgMemory->stamp++;
-	
-	memoryPointer->name->freeCount++;
-	memoryPointer->func->freeCount++;
-	
-	MemoryField_Update( memoryPointer->name, -(memoryPointer->totalSize) );
-	MemoryField_Update( memoryPointer->func, -(memoryPointer->totalSize) );
-}
-
-MemoryPointer* Memory_Find_Pointer( Pointer ptr )
-{
-	BTreeNode *node = NULL;
-	MemoryPointer *result = NULL;
-	
-	/* Added on 3/6/2009: a NULL ptr should always return as not found, yet in some cases
-	 * it was returning a MemoryPointer (perhaps from a free'd array) */
-	if ( ptr == NULL ) {
-		return NULL;
-	}
-
-	if ( stgMemory->ptrCache == ptr ){
-		return stgMemory->memCache;
-	}
-	
-	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_Value );
-	
-	node = BTree_FindNode( stgMemory->pointers, (void*) ptr);
-	
-	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_NodeData );
-	
-	if ( node != NULL ){
-		result = (MemoryPointer*) BTree_GetData( node );
-	}
-	else{
-		result = NULL;
-	}
-	
-	return result;
-}
-
-void Memory_SetupPointer_2DArray(
-	void* ptr,
-	SizeT itemSize,
-	Index xLength,
-	Index yLength )
-{
-	Pointer* array;
-	int ptrHeaderSize;
-	int ySize;
-	Index i;
-	
-	ptrHeaderSize = sizeof(Pointer) * xLength;
-	ySize = itemSize * yLength;
-	
-	array = (Pointer*) ptr;
-	for (i = 0; i < xLength; ++i )
-	{
-		array[i] = (Pointer)( (ArithPointer)ptr + ptrHeaderSize + ( i * ySize ) ) ;
-	}
-
-}
-
-void Memory_SetupPointer_3DArray(
-	void* ptr,
-	SizeT itemSize,
-	Index xLength,
-	Index yLength,
-	Index zLength )
-{
-	Pointer*	array1;
-	Pointer**	array2;
-	Index i, j;
-	int ptrHeader1, ptrHeader2;
-	int ySize, yzProduct;
-	
-	ptrHeader1 = sizeof(Pointer) * xLength;
-	ptrHeader2 = sizeof(Pointer) * xLength * yLength;
-	
-	ySize = sizeof(Pointer) * yLength;
-	yzProduct = yLength * zLength;
-	
-	array1 = (Pointer*) ptr;
-	for ( i = 0; i < xLength; ++i )
-	{
-		array1[i] = (Pointer)( (ArithPointer)ptr + ptrHeader1 + ( i * ySize ) );
-	}
-	
-	array2 = (Pointer**) ptr;
-	for ( i = 0; i < xLength; ++i )
-	{
-		for ( j = 0; j < yLength; ++j )
-		{
-			array2[i][j] = (Pointer)( (ArithPointer)ptr
-				+ ptrHeader1
-				+ ptrHeader2
-				+ ( ( (i * yzProduct) + (j * zLength) ) * itemSize ) );
-		}
-	}
-}
-
-
-void Memory_Relocate_2DArrayData(
-	void* destPtr, 
-	void* srcPtr,
-	SizeT itemSize, 
-	Index oldX, 
-	Index oldY, 
-	Index newX, 
-	Index newY )
-{
-	int i, j;
-	
-	if ( ( oldX > newX ) || ( oldY > newY ) )
-	{
-		/* Cannot handle these combinations yet. */
-		assert( 0 );
-		return;
-	}
-	
-	/* copy in reverse order to avoid overwritting data */
-	/* Note: using memmove because this function is often called to relocate data within an existing
-	 * array that's been resized - thus data may be overlapping */
-	for ( i = oldX - 1; i >= 0; --i ) {
-		for ( j = oldY - 1; j >= 0; --j ) {
-			memmove( (Pointer)((ArithPointer)destPtr + ( ((i * newY) + j) * itemSize ) ),
-				(Pointer)((ArithPointer)srcPtr + (  ((i * oldY) + j) * itemSize ) ),
-				itemSize );
-		}
-	}
-}
-
-void Memory_Relocate_3DArrayData( 
-	void* destPtr, 
-	void* srcPtr,
-	SizeT itemSize, 
-	Index oldX, 
-	Index oldY, 
-	Index oldZ,
-	Index newX, 
-	Index newY,
-	Index newZ )
-{
-	int i, j, k;
-	
-	if ( ( oldX > newX ) || ( oldY > newY ) || ( oldZ > newZ ) )
-	{
-		/* Cannot handle these combinations yet. */
-		return;
-	}
-	
-	/* copy in reverse order to avoid overwritting data */
-	/* Note: using memmove because this function is often called to relocate data within an existing
-	 * array that's been resized - thus data may be overlapping */
-	for ( i = oldX - 1; i >= 0; --i ) {
-		for ( j = oldY - 1; j >= 0; --j ) {
-			for ( k = oldZ - 1; k >= 0; --k ) {
-				memmove( (Pointer)((ArithPointer)destPtr + ( ((i * newY * newZ) + (j * newZ) + k) * itemSize ) ),
-					(Pointer)((ArithPointer)srcPtr  + ( ((i * oldY * oldZ) + (j * oldZ) + k) * itemSize ) ),
-					itemSize );
-			}
-		}
-	}
-}
-
-void* _Memory_InternalMalloc( SizeT size ) {
-	void* result;
-	void* data;
-
-	if( !size )
-	  return NULL;
-
-#ifdef NOEXPERIMENT			
-	result = malloc( size );
-	if ( result == NULL ) {
-		Memory_OutOfMemoryError( size );
-	}
-	return result;
-#else
-
-	if( stgMemory ){
-		unsigned long prev = stgMemory->stgCurrentMemory;
-		stgMemory->stgCurrentMemory += size;
-		stgMemory->stgPeakMemory = MAX( stgMemory->stgCurrentMemory, prev );
-	}
-	
-	result = malloc( size + sizeof( MemoryTag ) );
-	if ( result == NULL ) {
-		result = malloc( size + sizeof( MemoryTag ) );
-		if ( result == NULL ) {
-			if(stgMemory){
-				Memory_OutOfMemoryError( size + sizeof( MemoryTag ) );
-			}
-			else{
-				fprintf( stderr, "Out of memory in %s\n", __func__ );
-			}
-		}
-	}
-	data = (void*)((ArithPointer)result + sizeof( MemoryTag ));
-	
-	Memory_CountGet( data ) = 0;
-	Memory_SizeGet( data ) = size;
-
-	return data;
-#endif
-}
-
-void* _Memory_InternalRealloc( void* ptr, SizeT size ) {
-	void* result;
-	void* data;
-	int count = 0;
-#ifdef NOEXPERIMENT
-	result =  realloc( ptr, size );
-	if ( result == NULL ) {
-		Memory_OutOfMemoryError( size );
-	}
-	return result;
-#else
-	unsigned long prev = stgMemory->stgCurrentMemory;
-
-	if ( ptr == 0 ) {
-		return _Memory_InternalMalloc( size );
-	}
-	if( size == 0 ) {
-		Memory_Free( ptr );
-		return NULL;
-	}
-
-	count = Memory_CountGet( ptr );		/* Store previous count */
-	stgMemory->stgCurrentMemory -= Memory_SizeGet( ptr );
-	
-	result = realloc( (void*)( (ArithPointer)ptr - sizeof(MemoryTag) ), size + sizeof(MemoryTag) );
-	if ( result == NULL ) {
-		/* have second attempt */
-		result = realloc( (void*)( (ArithPointer)ptr - sizeof(MemoryTag) ), size + sizeof(MemoryTag) );
-		if ( result == NULL ) {
-			Memory_OutOfMemoryError( size + sizeof(MemoryTag) );
-		}
-	}
-	data = (void*)((ArithPointer)result + sizeof( MemoryTag ));
-
-	Memory_CountGet( data ) = count;
-	Memory_SizeGet( data )  = size;
-	stgMemory->stgCurrentMemory += size;
-	stgMemory->stgPeakMemory = MAX( stgMemory->stgCurrentMemory, prev );
-
-	return data;
-#endif
-
-}
-
-void _Memory_InternalFree( void* ptr ) {
-	if( !ptr ) return;
-#ifdef NOEXPERIMENT
-	free( ptr );
-#else
-	stgMemory->stgCurrentMemory -= Memory_SizeGet( ptr );
-	free( (void*)((ArithPointer)ptr - sizeof( MemoryTag)) );
-#endif
-}
-
-
-void _Memory_OutOfMemoryErrorFunc( Name func, int line, SizeT size ) {
-	Journal_Firewall(
-		0,
-		Journal_Register( Error_Type, "Memory" ),
-		"StGermain Memory Error!\n"
-		"\tAttempting to allocate %d bytes, in %s() line %d\n"
-		"\tCurrent StGermain memory usage is %d bytes\n",
-		size,
-		func,
-		line,
-		stgMemory->stgCurrentMemory );
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Memory.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Memory.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,1865 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Memory.c 4109 2007-05-17 06:22:56Z RaquibulHassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+
+#include "pcu/pcu.h"
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "MemoryTag.h"
+#include "MemoryField.h"
+#include "MemoryPointer.h"
+#include "Memory.h"
+
+
+#ifndef MAX
+#define MAX( x, y ) ((x > y) ? x : y)
+#endif
+
+const Type Memory_Type = "Memory";
+
+Memory* stgMemory = 0;
+
+const int MEMORY_INITIAL_SIZE = 4;	/**< Number of pointers the array begins with. */
+const int MEMORY_DELTA_SIZE = 4;	/**< Number of pointers to extend array by. */
+
+/** Adds a MemoryPointer to the database. */
+void Memory_Add_Pointer( MemoryPointer* memoryPointer );
+
+/** Frees the allocation associated with MemoryPointer, but not the pointer itself. */
+void Memory_Free_Pointer( MemoryPointer* memoryPointer );
+
+/** Attempts to find the pointer in database. */
+MemoryPointer* Memory_Find_Pointer( Pointer ptr );
+
+/** Setups the pointer locations in a 2D array. */
+void Memory_SetupPointer_2DArray(
+	void* ptr,
+	SizeT itemSize,
+	Index xLength,
+	Index yLength );
+
+/** Setups the pointer locations in a 3D array. */
+void Memory_SetupPointer_3DArray(
+	void* ptr,
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Index zLength );
+
+/** Moves data inside an enlarged 2D array to the appropriate position.
+ * Note that it just moves the data of the array - in the case of a traditional
+ * 2D array, will also need to separately update the pointer indices. */
+void Memory_Relocate_2DArrayData(
+	void* destPtr, 
+	void* srcPtr,
+	SizeT itemSize, 
+	Index oldX, 
+	Index oldY, 
+	Index newX, 
+	Index newY );
+
+/** Moves data inside an enlarged 3D array to the appropriate position.
+ * Note that it just moves the data of the array - in the case of a traditional
+ * 2D array, will also need to separately update the pointer indices. */
+void Memory_Relocate_3DArrayData( 
+	void* destPtr, 
+	void* srcPtr,
+	SizeT itemSize, 
+	Index oldX, 
+	Index oldY, 
+	Index oldZ,
+	Index newX, 
+	Index newY,
+	Index newZ );
+
+#define Memory_OutOfMemoryError( size ) \
+	_Memory_OutOfMemoryErrorFunc( __func__, __LINE__, size )
+
+/** Display an out of memory error after an alloc call */
+void _Memory_OutOfMemoryErrorFunc( Name func, int line, SizeT size );
+
+
+int compareFunction_NodeData_To_NodeData (void *nodeData1, void *nodeData2){
+	
+	MemoryPointer *memPtr1;
+	MemoryPointer *memPtr2;
+	
+	memPtr1 = (MemoryPointer*) nodeData1;
+	memPtr2 = (MemoryPointer*) nodeData2;
+	
+	#if 0
+		printf ("comparing node data %p with data %p\t", memPtr->ptr, data2);
+		if (memPtr->ptr == data2){
+			printf (";pointers are equal");
+		}
+		printf ("\n");
+	#endif
+	
+	if ( memPtr1->ptrReference > memPtr2->ptrReference ){
+		return 1;
+	}
+	else if ( memPtr1->ptrReference == memPtr2->ptrReference && memPtr1->status != MEMORY_POINTER_RELEASED ){
+		return 0;
+	}
+	else{
+		return -1;
+	}
+}
+
+int compareFunction_NodeData_To_Value (void *nodeData, void *value){
+	
+	MemoryPointer *memPtr;
+	
+	memPtr = (MemoryPointer*) nodeData;
+	
+	#if 0
+		printf ("comparing node data %p with data %p\t", memPtr->ptrReference, value);
+		if (memPtr->ptrReference == value){
+			printf (";pointers are equal");
+		}
+		printf ("\n");
+	#endif
+	
+	if ( memPtr->ptrReference > value ){
+		return 1;
+	}
+	else if ( memPtr->ptrReference == value && memPtr->status != MEMORY_POINTER_RELEASED ){
+		return 0;
+	}
+	else{
+		return -1;
+	}
+}
+
+Memory* Memory_Init()
+{
+	Memory* result;
+	
+	
+	result = (Memory*) malloc( sizeof(Memory) );
+	if ( result == NULL ) {
+		Memory_OutOfMemoryError( sizeof(Memory) );
+	}
+	
+	result->enable = True;
+	result->stamp = 0;
+	
+	result->types = MemoryField_New( "Memory Statistics" );
+	result->files = MemoryField_New( "Memory Statistics" );
+	
+	result->ptrCount = 0;
+	result->ptrSize = MEMORY_INITIAL_SIZE;
+	
+	result->pointers = BTree_New ( compareFunction_NodeData_To_NodeData, NULL, NULL, NULL, BTREE_ALLOW_DUPLICATES );
+	
+	result->ptrCache = NULL;
+	result->memCache = NULL;
+	
+	result->infoStream = NULL;
+	result->errorStream = NULL;
+	result->debugStream = NULL;
+
+	result->stgCurrentMemory = 0;
+	result->stgPeakMemory = 0;
+   stgMemory = result;
+	
+	return result;
+}
+
+void Memory_Delete()
+{
+	if ( stgMemory == NULL )
+	{
+		return;
+	}
+	
+	MemoryField_Delete( stgMemory->types );
+	MemoryField_Delete( stgMemory->files );
+	
+	/* Releasing the memory in the tree, that might not have been released by the user, before deleting the tree */
+	BTree_ParseTree ( stgMemory->pointers, MemoryPointer_Delete_Helper, NULL );
+	
+	/** Checking whether the memory module has been initialised before trying to delete it */
+	if( stgMemory->pointers != NULL){
+		BTree_Delete( stgMemory->pointers );
+	}
+   free( stgMemory );
+}
+
+
+void* _Memory_Alloc_Func(
+	SizeT size,
+	Type type,
+	Name const name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	
+	MemoryPointer* memoryPointer;
+	
+	result = _Memory_InternalMalloc( size );
+	
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_OBJECT, size, size );
+		memoryPointer->length.oneD = 1;
+		
+		Memory_Add_Pointer( memoryPointer );
+	}
+	return result;
+}
+
+void* _Memory_Alloc_Array_Func(
+	SizeT itemSize,
+	Index arrayLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	SizeT size;
+	
+	MemoryPointer* memoryPointer;
+	
+	size = Memory_Length_1DArray( itemSize, arrayLength );
+	result = _Memory_InternalMalloc( size );
+	
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_1DARRAY, itemSize, size );
+		memoryPointer->length.oneD = arrayLength;
+		
+		Memory_Add_Pointer( memoryPointer );
+	}
+	return result;
+}
+
+void* _Memory_Alloc_2DArray_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	SizeT size;
+	
+	
+	#ifdef MEMORY_STATS
+		MemoryPointer* memoryPointer;
+	#endif
+	
+	size = Memory_Length_2DArray( itemSize, xLength, yLength );
+	result = _Memory_InternalMalloc( size );
+	
+	
+	Memory_SetupPointer_2DArray( result, itemSize, xLength, yLength );
+	
+	#ifdef MEMORY_STATS
+		if ( stgMemory->enable ) {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_2DARRAY, itemSize, size );
+			memoryPointer->length.twoD[0] = xLength;
+			memoryPointer->length.twoD[1] = yLength;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	#endif
+	
+	return result;
+}
+
+void* _Memory_Alloc_3DArray_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Index zLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	SizeT size;
+	
+	#ifdef MEMORY_STATS
+		MemoryPointer* memoryPointer;
+	#endif
+	
+	size = Memory_Length_3DArray( itemSize, xLength, yLength, zLength );
+	result = _Memory_InternalMalloc( size );
+	
+	Memory_SetupPointer_3DArray( result, itemSize, xLength, yLength, zLength );
+	
+	#ifdef MEMORY_STATS
+		if ( stgMemory->enable ) {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DARRAY, itemSize, size );
+			memoryPointer->length.threeD[0] = xLength;
+			memoryPointer->length.threeD[1] = yLength;
+			memoryPointer->length.threeD[2] = zLength;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	#endif
+	
+	return result;
+
+}
+		
+void* _Memory_Alloc_4DArray_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Index zLength,
+	Index wLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer		result;
+	Pointer*	array1;
+	Pointer**	array2;
+	Pointer***	array3;
+	SizeT size;
+	Index i, j, k;
+	int ptrHeader1, ptrHeader2, ptrHeader3;
+	int ySize, yzProduct, yzwProduct, zwProduct;
+	
+	#ifdef MEMORY_STATS
+		MemoryPointer* memoryPointer;
+	#endif
+	
+	size = Memory_Length_4DArray( itemSize, xLength, yLength, zLength, wLength );
+	result = _Memory_InternalMalloc( size );
+	
+	ptrHeader1 = sizeof(Pointer) * xLength;
+	ptrHeader2 = sizeof(Pointer) * xLength * yLength;
+	ptrHeader3 = sizeof(Pointer) * xLength * yLength * zLength;
+	
+	ySize = sizeof(Pointer) * yLength;
+	yzProduct = yLength * zLength;
+	yzwProduct = yLength * zLength * wLength;
+	zwProduct = zLength * wLength;
+	
+	array1 = (Pointer*) result;
+	for ( i = 0; i < xLength; ++i )
+	{
+		array1[i] = (Pointer)( (ArithPointer)result + ptrHeader1 + ( i * ySize ) );
+	}
+	
+	array2 = (Pointer**) result;
+	for ( i = 0; i < xLength; ++i )
+	{
+		for ( j = 0; j < yLength; ++j )
+		{
+			array2[i][j] = (Pointer)( (ArithPointer)result
+				+ ptrHeader1
+				+ ptrHeader2
+				+ ( ( (i * yzProduct) + (j * zLength) ) * sizeof(Pointer) ) );
+		}
+	}
+	
+	array3 = (Pointer***) result;
+	for ( i = 0; i < xLength; ++i )
+	{
+		for ( j = 0; j < yLength; ++j )
+		{
+			for ( k = 0; k < zLength; ++k )
+			{
+				array3[i][j][k] = (Pointer)( (ArithPointer)result
+					+ ptrHeader1
+					+ ptrHeader2
+					+ ptrHeader3
+					+ ( ( (i * yzwProduct) + (j * zwProduct) + (k * wLength) ) * itemSize ) );
+			}
+		}
+	}
+	
+	#ifdef MEMORY_STATS
+		if ( stgMemory->enable ) {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DARRAY, itemSize, size );
+			memoryPointer->length.fourD[0] = xLength;
+			memoryPointer->length.fourD[1] = yLength;
+			memoryPointer->length.fourD[2] = zLength;
+			memoryPointer->length.fourD[3] = wLength;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	#endif
+	
+	return result;
+}
+
+
+void* _Memory_Alloc_2DArrayAs1D_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	SizeT size;
+	
+	MemoryPointer* memoryPointer;
+	
+	size = Memory_Length_2DAs1D( itemSize, xLength, yLength );
+	result = _Memory_InternalMalloc( size );
+	
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_2DAS1D, itemSize, size );
+		memoryPointer->length.twoD[0] = xLength;
+		memoryPointer->length.twoD[1] = yLength;
+		
+		Memory_Add_Pointer( memoryPointer );
+	}
+	return result;
+}
+
+void* _Memory_Alloc_3DArrayAs1D_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Index zLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	SizeT size;
+	
+	MemoryPointer* memoryPointer;
+	
+	size = Memory_Length_3DAs1D( itemSize, xLength, yLength, zLength );
+	result = _Memory_InternalMalloc( size );
+	
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DAS1D, itemSize, size );
+		memoryPointer->length.threeD[0] = xLength;
+		memoryPointer->length.threeD[1] = yLength;
+		memoryPointer->length.threeD[2] = zLength;
+		
+		Memory_Add_Pointer( memoryPointer );
+	}
+	
+	return result;
+}
+
+void* _Memory_Alloc_4DArrayAs1D_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Index zLength,
+	Index wLength,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer result;
+	SizeT size;
+	
+	MemoryPointer* memoryPointer;
+	
+	size = Memory_Length_4DAs1D( itemSize, xLength, yLength, zLength, wLength );
+	result = _Memory_InternalMalloc( size );
+	
+	
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_4DAS1D, itemSize, size );
+		memoryPointer->length.fourD[0] = xLength;
+		memoryPointer->length.fourD[1] = yLength;
+		memoryPointer->length.fourD[2] = zLength;
+		memoryPointer->length.fourD[3] = wLength;
+	
+		Memory_Add_Pointer( memoryPointer );
+	}
+	
+	return result;
+}
+
+#if 0
+void parseFunc (void *object, void *args){
+
+	MemoryPointer *memPtr = (MemoryPointer*)object;
+	printf ("\tdata - %p\n", memPtr->ptr);
+}
+#endif
+
+void* _Memory_Alloc_2DComplex_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index* yLengths,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer		result;
+	Pointer*	array;
+	SizeT size;
+	Index i;
+	
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer;
+	#endif
+	
+	size = Memory_Length_2DComplex( itemSize, xLength, yLengths );
+	
+	if ( 0 == size ) {
+		Journal_Printf( stgMemory->errorStream, "Warning: () called to allocate a 2D variable "
+			"length array where the total size calculated was 0. Returning NULL.\n", __func__ );
+		return NULL;
+	}
+	
+	result = _Memory_InternalMalloc( size );
+	
+	
+	array = (Pointer*) result;
+	
+	/* Start of data area for the first array */
+	array[0] = (Pointer) ( (ArithPointer)array + sizeof(Pointer) * xLength);
+	
+	for ( i = 1; i < xLength; ++i )
+	{
+		/* The previous array plus the previous length offset */
+		array[i] = (Pointer)( (ArithPointer)array[i - 1] + ( itemSize * yLengths[i - 1] ) );
+	}
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_2DCOMPLEX, itemSize, size );
+		memoryPointer->length.xyz.x = xLength;
+		memoryPointer->length.xyz.y = (Index*) malloc( sizeof(Index) * xLength );
+		if ( memoryPointer->length.xyz.y == NULL ) {
+			Memory_OutOfMemoryError( sizeof(Index) * xLength );
+		}
+		
+		for ( i = 0; i < xLength; ++i )
+		{
+			memoryPointer->length.xyz.y[i] = yLengths[i];
+		}
+		
+		Memory_Add_Pointer( memoryPointer );
+	}
+	#endif
+	
+	return result;
+}
+
+
+Index** _Memory_Alloc_3DSetup_Func(
+	Index xLength,
+	Index* yLengths,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Index** result;
+	#ifdef MEMORY_STATS
+	MemoryPointer *memPtr;
+	#endif
+	
+	result = (Index**) _Memory_Alloc_2DComplex_Func( sizeof(Index), xLength, yLengths,
+		"Index", "MEMORY_SETUP", fileName, funcName, lineNumber );
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memPtr = Memory_Find_Pointer ( result );
+		assert( memPtr );
+		memPtr->allocType = MEMORY_3DSETUP;
+	}
+	#endif
+	
+	return result;
+}
+
+
+void* _Memory_Alloc_3DComplex_Func(
+	SizeT itemSize,
+	Index xLength,
+	Index* yLengths,
+	Index** zLengths,
+	Type type,
+	Name name,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	Pointer		result;
+	Pointer*	array1;
+	Pointer**	array2;
+	SizeT size;
+	Index i, j;
+	ArithPointer startPos, diffSize;
+	
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer;
+	#endif
+	
+	size = Memory_Length_3DComplex( itemSize, xLength, yLengths, zLengths );
+	result = _Memory_InternalMalloc( size );
+	
+	
+	array1 = (Pointer*) result;
+	
+	/* Start of data area for the first array */
+	startPos = (ArithPointer)result;
+	diffSize = (ArithPointer)( sizeof(Pointer) * xLength );
+	for (i = 0; i < xLength; ++i)
+	{
+		array1[i] = (Pointer)( startPos + diffSize );
+		
+		/* The previous array plus the previous length offset */
+		startPos = (ArithPointer)array1[i];
+		diffSize = (ArithPointer)( sizeof(Pointer) * yLengths[i] );
+	}
+	
+	array2 = (Pointer**)result;
+	
+	for ( i = 0; i < xLength; ++i )
+	{
+		for ( j = 0; j < yLengths[i]; ++j )
+		{
+			array2[i][j] = (Pointer)( startPos + diffSize );
+			startPos = (ArithPointer)array2[i][j];
+			diffSize = (ArithPointer)( zLengths[i][j] * itemSize );
+		}
+	}
+	
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, name, fileName, funcName, lineNumber, MEMORY_3DCOMPLEX, itemSize, size );
+		memoryPointer->length.xyz.x = xLength;
+		memoryPointer->length.xyz.y = (Index*) malloc( sizeof(Index) * xLength );
+		if ( memoryPointer->length.xyz.y == NULL ) {
+			Memory_OutOfMemoryError( sizeof(Index) * xLength );
+		}
+		
+		for ( i = 0; i < xLength; ++i )
+		{
+			memoryPointer->length.xyz.y[i] = yLengths[i];
+		}
+		
+		memoryPointer->length.xyz.z = (Index**) malloc( Memory_Length_2DComplex( sizeof(Index), xLength, yLengths ) );
+		if ( memoryPointer->length.xyz.z == NULL ) {
+			Memory_OutOfMemoryError( Memory_Length_2DComplex( sizeof(Index), xLength, yLengths ) );
+		}
+		array1 = (Pointer*) memoryPointer->length.xyz.z;
+		
+		/* Start of data area for the first array */	
+		startPos = (ArithPointer)memoryPointer->length.xyz.z;
+		diffSize = (ArithPointer)( sizeof(Pointer) * xLength );
+		for (i = 0; i < xLength; ++i)
+		{
+			array1[i] = (Pointer)( startPos + diffSize );
+			
+			/* The previous array plus the previous length offset */
+			startPos = (ArithPointer)array1[i];
+			diffSize = (ArithPointer)( sizeof(Index) * yLengths[i] );
+		}
+		
+		/* Copy the z values */
+		for (i = 0; i < xLength; ++i)
+			{
+			for (j = 0; j < yLengths[i]; ++j)
+			{
+				memoryPointer->length.xyz.z[i][j] = zLengths[i][j];
+			}
+		}
+		
+		Memory_Add_Pointer( memoryPointer );
+	}
+	#endif
+	
+	return result;
+}
+
+
+void* _Memory_Realloc_Func( 
+	void* ptr, 
+	SizeT newSize,
+	Type type,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	MemoryPointer* memoryPointer;
+	BTreeNode *node;
+	SizeT diffBytes;
+	
+	Pointer result = NULL;
+	
+	memoryPointer = Memory_Find_Pointer( ptr );
+
+	result = _Memory_InternalRealloc( ptr, newSize );
+	
+	if ( stgMemory->enable ) {
+		if ( memoryPointer ) {
+			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
+			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
+			pcu_assert( memoryPointer->allocType == MEMORY_OBJECT );
+
+			if ( result != NULL ) {
+				if (stgMemory->pointers){
+					node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
+					assert( node );
+				
+					BTree_DeleteNode( stgMemory->pointers, (BTreeNode*) node );
+				}
+				
+				diffBytes = newSize - memoryPointer->totalSize;
+				MemoryField_Update( memoryPointer->name, diffBytes );
+				MemoryField_Update( memoryPointer->func, diffBytes );
+				memoryPointer->ptr = result;
+				memoryPointer->ptrReference = result;
+				memoryPointer->stamp = stgMemory->stamp++;
+				
+				memoryPointer->itemSize = newSize;
+				memoryPointer->totalSize = newSize;
+				stgMemory->ptrCache = result;
+				stgMemory->memCache = memoryPointer;
+	
+				if (stgMemory->pointers){
+					BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+				}
+			}
+			else {
+				memoryPointer->ptr = NULL;
+				memoryPointer->status = MEMORY_POINTER_RELEASED;
+				memoryPointer->stamp = stgMemory->stamp++;
+			}
+		}
+		else {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
+				fileName, funcName, lineNumber, MEMORY_OBJECT, newSize, newSize );
+			memoryPointer->length.oneD = 1;
+			Memory_Add_Pointer( memoryPointer );
+		}
+	}
+	
+	return result;
+}
+
+
+void* _Memory_Realloc_Array_Func( 
+	void* ptr, 
+	SizeT itemSize, 
+	Index newLength,
+	Type type,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	MemoryPointer* memoryPointer;
+	BTreeNode *node;
+	SizeT newSize;
+	SizeT diffBytes;
+	
+	Pointer result = NULL;
+	
+	memoryPointer = Memory_Find_Pointer( ptr );
+	
+	newSize = itemSize * newLength;
+	result = _Memory_InternalRealloc( ptr, newSize );
+	
+	if ( stgMemory->enable ) {
+		if ( memoryPointer ) {
+			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
+			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
+			pcu_assert( memoryPointer->allocType == MEMORY_1DARRAY );
+			if ( result != NULL )
+			{
+				MemoryPointer* copy;
+				
+				if (stgMemory->pointers){
+					node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
+					assert( node );
+				
+					BTree_DeleteNode( stgMemory->pointers, (BTreeNode*) node );
+				}
+				
+				diffBytes = newSize - memoryPointer->totalSize;
+				MemoryField_Update( memoryPointer->name, diffBytes );
+				MemoryField_Update( memoryPointer->func, diffBytes );
+				
+				memoryPointer->ptr = result;
+				memoryPointer->ptrReference = result;
+				memoryPointer->stamp = stgMemory->stamp++;
+				memoryPointer->itemSize = itemSize;
+				memoryPointer->totalSize = newSize;
+				memoryPointer->length.oneD = newLength;
+				
+				copy = (MemoryPointer*)_Memory_InternalMalloc( sizeof( MemoryPointer ) );
+				memcpy( copy, memoryPointer, sizeof( MemoryPointer) );
+				
+				copy->ptr = result;
+				copy->ptrReference = result;
+				
+				
+				stgMemory->ptrCache = result;
+				stgMemory->memCache = memoryPointer;
+				
+				if (stgMemory->pointers){
+					BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+				}
+				
+			}
+			else
+			{
+				memoryPointer->ptr = NULL;
+				memoryPointer->status = MEMORY_POINTER_RELEASED;
+				memoryPointer->stamp = stgMemory->stamp++;
+			}
+		}
+		else {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
+				fileName, funcName, lineNumber, MEMORY_1DARRAY, itemSize, newSize );
+			memoryPointer->length.oneD = newLength;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	}
+	return result;
+}
+
+
+void* _Memory_Realloc_2DArray_Func(
+	void* ptr,
+	SizeT itemSize, 
+	Index oldX,
+	Index oldY,
+	Index newX, 
+	Index newY,
+	Type type,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer;
+	SizeT diffBytes;
+	BTreeNode *node;
+	#endif
+	
+	SizeT newSize = 0;
+	Pointer result = NULL;
+	Pointer* array;
+	
+	if ( ptr != NULL ) {
+		array = (Pointer*)ptr;
+		oldX = ( (ArithPointer)array[0] - (ArithPointer)ptr ) / sizeof(Pointer);
+		oldY = ( (ArithPointer)array[1] - (ArithPointer)array[0] ) / itemSize;
+	}
+	
+	newSize = Memory_Length_2DArray( itemSize, newX, newY );
+	result = _Memory_InternalRealloc( ptr, newSize );
+	
+	if ( ptr != NULL ) {
+		Memory_Relocate_2DArrayData( (Pointer)( (ArithPointer)result + (newX * sizeof(Pointer)) ),
+					 (Pointer)( (ArithPointer)result + (oldX * sizeof(Pointer)) ),
+					 itemSize, oldX, oldY, newX, newY );
+	}
+	
+	Memory_SetupPointer_2DArray( result, itemSize, newX, newY );
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memoryPointer = Memory_Find_Pointer( ptr );
+		if ( memoryPointer ) {
+			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
+			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
+			pcu_assert( memoryPointer->allocType == MEMORY_2DARRAY );
+			
+			if (stgMemory->pointers){
+				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
+				assert( node );
+			
+				BTree_DeleteNode( stgMemory->pointers, (void*) node );
+			}
+			
+			diffBytes = newSize - memoryPointer->totalSize;
+			MemoryField_Update( memoryPointer->name, diffBytes );
+			MemoryField_Update( memoryPointer->func, diffBytes );
+			memoryPointer->ptr = result;
+			memoryPointer->ptrReference = result;
+			memoryPointer->stamp = stgMemory->stamp++;
+			memoryPointer->itemSize = itemSize;
+			memoryPointer->totalSize = newSize;
+			memoryPointer->length.twoD[0] = newX;
+			memoryPointer->length.twoD[1] = newY;
+			stgMemory->ptrCache = result;
+			stgMemory->memCache = memoryPointer;
+			
+			if (stgMemory->pointers){
+				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+			}
+		}
+		else {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
+				fileName, funcName, lineNumber, MEMORY_2DARRAY, itemSize, newSize );
+			memoryPointer->length.twoD[0] = newX;
+			memoryPointer->length.twoD[1] = newY;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	}
+	#endif
+	
+	return result;
+}
+
+void* _Memory_Realloc_3DArray_Func( 
+	void* ptr, 
+	SizeT itemSize, 
+	Index oldX,
+	Index oldY,
+	Index oldZ,
+	Index newX, 
+	Index newY, 
+	Index newZ,
+	Type type,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer;
+	SizeT diffBytes;
+	BTreeNode *node;
+	#endif
+	
+	SizeT newSize = 0;
+	Pointer result = NULL;
+	Pointer* array;
+	Pointer** array2;
+	
+	if ( ptr != NULL ) {
+		array = (Pointer*)ptr;
+		array2 = (Pointer**)ptr;
+		
+		oldX = ( (ArithPointer)array[0] - (ArithPointer)ptr ) / sizeof(Pointer);
+		oldY = ( (ArithPointer)array[1] - (ArithPointer)array[0] ) / sizeof(Pointer);
+		oldZ = ( (ArithPointer)array2[0][1] - (ArithPointer)array2[0][0] ) / itemSize;
+	}
+	
+	newSize = Memory_Length_3DArray( itemSize, newX, newY, newZ );
+	result = _Memory_InternalRealloc( ptr, newSize );
+	
+	if ( ptr != NULL ) {
+		Memory_Relocate_3DArrayData( (Pointer)( (ArithPointer)result + ( (newX + (newX * newY)) * sizeof(Pointer) ) ),
+					 (Pointer)( (ArithPointer)result + ( (oldX + (oldX * oldY)) * sizeof(Pointer) ) ),
+					 itemSize, oldX, oldY, oldZ, newX, newY, newZ );
+	}
+	
+	Memory_SetupPointer_3DArray( result, itemSize, newX, newY, newZ );
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memoryPointer = Memory_Find_Pointer( ptr );
+		if ( memoryPointer ) {
+			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
+			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
+			pcu_assert( memoryPointer->allocType == MEMORY_3DARRAY );
+			
+			if (stgMemory->pointers){
+				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
+				assert( node );
+			
+				BTree_DeleteNode( stgMemory->pointers, (void*) node );
+			}
+			
+			diffBytes = newSize - memoryPointer->totalSize;
+			MemoryField_Update( memoryPointer->name, diffBytes );
+			MemoryField_Update( memoryPointer->func, diffBytes );
+			memoryPointer->ptr = result;
+			memoryPointer->ptrReference = result;
+			memoryPointer->stamp = stgMemory->stamp++;
+			memoryPointer->itemSize = itemSize;
+			memoryPointer->totalSize = newSize;
+			memoryPointer->length.threeD[0] = newX;
+			memoryPointer->length.threeD[1] = newY;
+			memoryPointer->length.threeD[2] = newZ;
+			stgMemory->ptrCache = result;
+			stgMemory->memCache = memoryPointer;
+			
+			if (stgMemory->pointers){
+				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+			}
+		}
+		else {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
+				fileName, funcName, lineNumber, MEMORY_3DARRAY, itemSize, newSize );
+			memoryPointer->length.twoD[0] = newX;
+			memoryPointer->length.twoD[1] = newY;
+			memoryPointer->length.twoD[2] = newY;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	}
+	#endif
+	
+	return result;
+}
+
+void* _Memory_Realloc_2DArrayAs1D_Func( 
+	void* ptr, 
+	SizeT itemSize, 
+	Index oldX, 
+	Index oldY, 
+	Index newX, 
+	Index newY,
+	Type type,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer;
+	BTreeNode *node;
+	SizeT diffBytes;
+	#endif
+	
+	SizeT newSize;
+	Pointer result = NULL;
+	
+	newSize = itemSize * newX * newY;
+	result = _Memory_InternalRealloc( ptr, newSize );
+	
+	if ( ptr != NULL )
+	{
+		Memory_Relocate_2DArrayData( result, result, itemSize, oldX, oldY, newX, newY );
+	}
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memoryPointer = Memory_Find_Pointer( ptr );
+		if ( memoryPointer ) {
+			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
+			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
+			pcu_assert( memoryPointer->allocType == MEMORY_2DAS1D );
+
+			if (stgMemory->pointers){
+				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
+				assert( node );
+			
+				BTree_DeleteNode( stgMemory->pointers, (void*) node );
+			}
+			
+			diffBytes = newSize - memoryPointer->totalSize;
+			MemoryField_Update( memoryPointer->name, diffBytes );
+			MemoryField_Update( memoryPointer->func, diffBytes );
+			memoryPointer->ptr = result;
+			memoryPointer->ptrReference = result;
+			memoryPointer->stamp = stgMemory->stamp;
+			memoryPointer->itemSize = itemSize;
+			memoryPointer->totalSize = newSize;
+			memoryPointer->length.twoD[0] = newX;
+			memoryPointer->length.twoD[1] = newY;
+			stgMemory->ptrCache = result;
+			stgMemory->memCache = memoryPointer;
+			
+			if (stgMemory->pointers){
+				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+			}
+		}
+		else {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
+				fileName, funcName, lineNumber, MEMORY_2DAS1D, itemSize, newSize );
+			memoryPointer->length.twoD[0] = newX;
+			memoryPointer->length.twoD[1] = newY;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	}
+	#endif
+	
+	return result;
+}
+
+void* _Memory_Realloc_3DArrayAs1D_Func( 
+	void* ptr, 
+	SizeT itemSize,
+	Index oldX, 
+	Index oldY, 
+	Index oldZ, 
+	Index newX, 
+	Index newY, 
+	Index newZ,
+	Type type,
+	Name fileName,
+	Name funcName,
+	int lineNumber )
+{
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer;
+	BTreeNode *node;
+	SizeT diffBytes;
+	#endif
+	
+	SizeT newSize;
+	Pointer result = NULL;
+	
+	newSize = itemSize * newX * newY * newZ;
+	result = _Memory_InternalRealloc( ptr, newSize );
+	
+	if ( ptr != NULL ) {
+		Memory_Relocate_3DArrayData( result, result, itemSize, oldX, oldY, oldZ, newX, newY, newZ );
+	}
+	
+	#ifdef MEMORY_STATS
+	if ( stgMemory->enable ) {
+		memoryPointer = Memory_Find_Pointer( ptr );
+		if ( memoryPointer ) {
+			/* Make sure user has called the correct Realloc func for the current ptr type (eg arrays originally
+			 * allocated using Memory_Alloc_XXArray should be realloced with the appropriate array realloc function.*/
+			pcu_assert( memoryPointer->allocType == MEMORY_3DAS1D );
+
+			if (stgMemory->pointers){
+				node = BTree_FindNode( stgMemory->pointers, (void*) memoryPointer );
+				assert( node );
+			
+				BTree_DeleteNode( stgMemory->pointers, (void*) node );
+			}
+			
+			diffBytes = newSize - memoryPointer->totalSize;
+			MemoryField_Update( memoryPointer->name, diffBytes );
+			MemoryField_Update( memoryPointer->func, diffBytes );
+			memoryPointer->ptr = result;
+			memoryPointer->ptrReference = result;
+			memoryPointer->stamp = stgMemory->stamp++;
+			memoryPointer->itemSize = itemSize;
+			memoryPointer->totalSize = newSize;
+			memoryPointer->length.threeD[0] = newX;
+			memoryPointer->length.threeD[1] = newY;
+			memoryPointer->length.threeD[2] = newZ;
+			stgMemory->ptrCache = result;
+			stgMemory->memCache = memoryPointer;
+			
+			if (stgMemory->pointers){
+				BTree_InsertNode( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+			}
+		}
+		else {
+			memoryPointer = MemoryPointer_New( result, stgMemory->stamp++, type, Name_Invalid,
+				fileName, funcName, lineNumber, MEMORY_3DAS1D, itemSize, newSize );
+			memoryPointer->length.twoD[0] = newX;
+			memoryPointer->length.twoD[1] = newY;
+			memoryPointer->length.twoD[2] = newY;
+			
+			Memory_Add_Pointer( memoryPointer );
+		}
+	}
+	#endif
+	
+	return result;
+}
+
+
+/* This function should only be called on ptrs allocated by StGermain's Memory routines */
+void _Memory_Free_Func( void* ptr ) {
+	#ifdef MEMORY_STATS
+	MemoryPointer* memoryPointer = NULL;
+	#endif
+
+	if( !ptr ) return;
+	
+	#ifdef MEMORY_STATS
+	memoryPointer = Memory_Find_Pointer( ptr );
+	/* If memory stats is enabled, then any pointer allocated using the Stg memory system should _always_ have a MemoryPointer
+	 * associated with it, and findable */
+	pcu_assert( memoryPointer );
+	Memory_Free_Pointer( memoryPointer );
+	#else
+	_Memory_InternalFree( ptr );
+	#endif
+}
+	
+SizeT Memory_Length_1DArray( SizeT itemSize, Index length )
+{
+	return itemSize * length;
+}
+
+SizeT Memory_Length_2DArray( SizeT itemSize, Index xLength, Index yLength )
+{
+	return ( sizeof(Pointer) * xLength ) + ( itemSize * xLength * yLength );
+}
+
+SizeT Memory_Length_3DArray( SizeT itemSize, Index xLength, Index yLength, Index zLength )
+{
+	return ( sizeof(Pointer) * ( xLength + xLength * yLength ) ) + ( itemSize * xLength * yLength * zLength );
+}
+
+
+SizeT Memory_Length_4DArray( SizeT itemSize, Index xLength, Index yLength, Index zLength, Index wLength )
+{
+	return ( sizeof(Pointer) * ( xLength + xLength * yLength + xLength * yLength * zLength ) )
+		 + ( itemSize * xLength * yLength * zLength * wLength );
+}
+
+SizeT Memory_Length_2DComplex( SizeT itemSize, Index xLength, Index* yLengths )
+{
+	Index i;
+	SizeT result = 0;
+	for ( i = 0; i < xLength; ++i )
+	{
+		result += yLengths[i];
+	}
+	result *= itemSize;
+	result += sizeof(Pointer) * xLength;
+	
+	return result;
+	
+}
+
+SizeT Memory_Length_3DComplex( SizeT itemSize, Index xLength, Index* yLengths, Index** zLengths )
+{
+	Index i, j;
+	SizeT result = 0;
+	SizeT ptrSize = xLength;
+	
+	for ( i = 0; i < xLength; ++i )
+	{
+		for ( j = 0; j < yLengths[i]; ++j )
+		{
+			result += zLengths[i][j];
+		}
+		ptrSize += yLengths[i];
+	}
+	result *= itemSize;
+	result += sizeof(Pointer) * ptrSize; 
+	
+	return result;
+}
+
+SizeT Memory_Length_2DAs1D( SizeT itemSize, Index xLength, Index yLength )
+{
+	return itemSize * xLength * yLength;
+}
+
+SizeT Memory_Length_3DAs1D( SizeT itemSize, Index xLength, Index yLength, Index zLength )
+{
+	return itemSize * xLength * yLength * zLength;
+}
+
+SizeT Memory_Length_4DAs1D( SizeT itemSize, Index xLength, Index yLength, Index zLength, Index wLength )
+{
+	return itemSize * xLength * yLength * zLength * wLength;
+}
+
+void Memory_Print_Summary()
+{
+	Index i;
+	
+	MemoryField_PrintSummary( stgMemory->types, "Type", MEMORYFIELD_ALL );
+	
+	Stream_Indent( stgMemory->infoStream );
+	
+	for ( i = 0; i < stgMemory->types->subCount; ++i )
+	{
+		Journal_Printf( stgMemory->infoStream, "\n" );
+		MemoryField_PrintSummary( stgMemory->types->subFields[i], "Name", MEMORYFIELD_ALL );
+	}
+	
+	Stream_UnIndent( stgMemory->infoStream );
+}
+
+void Memory_Print()
+{
+	Memory_Print_Summary();
+}
+
+void Memory_Print_Leak()
+{
+	Memory_Print_Leak_Helper_Arg arguments;
+	
+	arguments.printOptions = MEMORYPOINTER_ALL;
+	arguments.numLeaks = 0;
+	arguments.warningPrinted = False;
+	
+	BTree_ParseTree ( stgMemory->pointers, Memory_Print_Leak_Helper,  (void*)( &arguments ) );
+	
+	if ( arguments.numLeaks > 0 )
+	{
+		printf( "\nPossible leaks detected: %d\n", arguments.numLeaks );
+	}
+	
+}
+
+void Memory_Print_Leak_Helper( void *memoryPointer, void *args )
+{
+	MemoryPointer *memPtr = NULL;
+	Memory_Print_Leak_Helper_Arg *arguments = NULL;
+	
+	assert( memoryPointer );
+	assert( args );
+	
+	memPtr = (MemoryPointer*) memoryPointer;
+	arguments = (Memory_Print_Leak_Helper_Arg*) args;
+	
+	if ( memPtr->ptr != NULL && memPtr->status != MEMORY_POINTER_RELEASED ){
+		if ( !arguments->warningPrinted )
+		{
+			/* A leak exists, so print warning title. */
+			Journal_Printf( stgMemory->infoStream, "Warning. Possible memory leak:\n" );
+			arguments->warningPrinted = True;
+		}
+		
+		MemoryPointer_PrintAll( memPtr );
+		++arguments->numLeaks;
+	}
+}
+
+
+void Memory_Print_Type_Func( Type type )
+{
+	MemoryField* typeField;
+	
+	typeField = MemoryField_Register( stgMemory->types, type );
+	
+	MemoryField_PrintSummary( typeField, "Name", MEMORYFIELD_ALL );
+}
+
+void Memory_Print_Type_Name_Func( Type type, Name name )
+{
+	MemoryField* typeField;
+	MemoryField* nameField;
+	MemoryPointer* memPtr;
+	MemoryPointer_Print_Type_Name_Func_Helper_Arg arguments;
+	
+	
+	typeField = MemoryField_Register( stgMemory->types, type );
+	nameField = MemoryField_Register( typeField, name );
+	
+	Journal_PrintfL( stgMemory->infoStream, 1, "Type: %s\n", type );
+	MemoryField_PrintHeader( "Name", MEMORYFIELD_ALL, strlen(name) );
+	MemoryField_Print( nameField, MEMORYFIELD_ALL, strlen(name) );
+	
+	Stream_Indent( stgMemory->infoStream );
+	
+	memPtr = NULL;
+	arguments.printOptions = (MemoryPointerColumn)(
+				MEMORYPOINTER_PTR |
+				MEMORYPOINTER_FILE |
+				MEMORYPOINTER_FUNC |
+				MEMORYPOINTER_LINE |
+				MEMORYPOINTER_ALLOCTYPE |
+				MEMORYPOINTER_ITEMSIZE |
+				MEMORYPOINTER_TOTALSIZE |
+				MEMORYPOINTER_LENGTH);
+	arguments.type = type;
+	arguments.name = name;
+	
+	BTree_ParseTree ( stgMemory->pointers, MemoryPointer_Print_Type_Name_Func_Helper, (void *) ( &arguments ) );
+	
+	Stream_UnIndent( stgMemory->infoStream );
+}
+
+
+void Memory_Print_File( char* fileName )
+{
+	MemoryField* fileField;
+	
+	fileField = MemoryField_Register( stgMemory->files, fileName );
+	
+	MemoryField_PrintSummary( fileField, "Function", MEMORYFIELD_ALL );
+}
+
+void Memory_Print_File_Function( char* fileName, char* funcName )
+{
+	MemoryField* fileField;
+	MemoryField* funcField;
+	MemoryPointer* memPtr;
+	MemoryPointer_Print_File_Func_Helper_Arg arguments;
+	
+	fileField = MemoryField_Register( stgMemory->files, fileName );
+	funcField = MemoryField_Register( fileField, funcName );
+	
+	Journal_PrintfL( stgMemory->infoStream, 1, "File: %s\n", fileName );
+
+	_MemoryField_CalcLongestSubFieldNameLen( funcField );
+	MemoryField_PrintHeader( "Function", MEMORYFIELD_ALL, strlen(funcName) );
+	MemoryField_Print( funcField, MEMORYFIELD_ALL, strlen(funcName) );
+	
+	Stream_Indent( stgMemory->infoStream );
+	
+	memPtr = NULL;
+	arguments.printOptions = (MemoryPointerColumn)(
+				MEMORYPOINTER_PTR |
+				MEMORYPOINTER_TYPE |
+				MEMORYPOINTER_NAME |
+				MEMORYPOINTER_LINE |
+				MEMORYPOINTER_ALLOCTYPE |
+				MEMORYPOINTER_ITEMSIZE |
+				MEMORYPOINTER_TOTALSIZE |
+				MEMORYPOINTER_LENGTH);
+	arguments.fileName = fileName;
+	arguments.funcName = funcName;
+		
+	BTree_ParseTree ( stgMemory->pointers, MemoryPointer_Print_File_Func_Helper, (void*) ( &arguments ) );
+	
+	Stream_UnIndent( stgMemory->infoStream );
+
+}
+
+void Memory_Print_Pointer( void* ptr )
+{
+	MemoryPointer* memoryPointer;
+	
+	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_Value );
+	memoryPointer = Memory_Find_Pointer( ptr );
+	if ( memoryPointer )
+	{
+		MemoryPointer_PrintAll( memoryPointer );
+	}
+	else
+	{
+		Journal_Printf( stgMemory->infoStream, "No entry exists for (ptr) %p\n", ptr );
+	}
+	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_NodeData );
+}
+
+
+
+void _Memory_Free_Type_Name_Func( Type type, Name name )
+{
+	Memory_Free_Type_Name_Func_Helper_Arg arguments;
+	
+	arguments.name = name;
+	arguments.type = type;
+	
+	BTree_ParseTree ( stgMemory->pointers, _Memory_Free_Type_Name_Func_Helper, &arguments );
+}
+
+void _Memory_Free_Type_Name_Func_Helper( void *memoryPointer, void *args ){
+	MemoryPointer *memPtr = NULL;
+	MemoryField* typeField;
+	MemoryField* nameField;
+	Memory_Free_Type_Name_Func_Helper_Arg *arguments;
+	
+	assert ( memoryPointer );
+	assert ( args );
+	
+	arguments = (Memory_Free_Type_Name_Func_Helper_Arg *) args;
+	memPtr = (MemoryPointer*) memoryPointer;
+	
+	typeField = MemoryField_Register( stgMemory->types, arguments->type );
+	nameField = MemoryField_Register( typeField, arguments->name );
+	
+	
+	if ( memPtr->ptr != NULL
+			&& memPtr->type == typeField
+			&& memPtr->name == nameField )
+	{
+		Memory_Free_Pointer( memPtr );
+	}
+}
+
+void _Memory_Free_Type_Func( Type type )
+{
+	BTree_ParseTree( stgMemory->pointers, _Memory_Free_Type_Func_Helper, (void*) type );
+}
+
+void _Memory_Free_Type_Func_Helper ( void *memoryPointer, void *args )
+{
+	MemoryPointer *memPtr = NULL;
+	MemoryField* typeField;
+	Type type;
+	
+	assert ( memoryPointer );
+	assert ( args );
+	
+	type = (Type) args;
+	memPtr = (MemoryPointer*) memoryPointer;
+	
+	typeField = MemoryField_Register( stgMemory->types, type );
+	
+	if ( memPtr->ptr != NULL
+		&& memPtr->type == typeField )
+	{
+		Memory_Free_Pointer( memPtr );
+	}
+}
+
+Bool Memory_IsAllocated( void* ptr ) {
+
+	#ifdef MEMORY_STATS
+		if ( stgMemory->enable ) {
+			MemoryPointer *memPtr = NULL;
+
+			memPtr = Memory_Find_Pointer( ptr );
+			if ( (memPtr == NULL) || (memPtr->status == MEMORY_POINTER_RELEASED) ) {
+				return False;
+			}
+			else {
+				return True;
+			}
+		}
+		else {
+			#ifdef DEBUG
+				Journal_Printf( 
+					stgMemory->debugStream,
+					"Warning: Memory module not enabled. Memory_IsAllocated() is meaningless\n" );
+			#endif
+			return True;
+		}
+	#else
+		#ifdef DEBUG
+			Journal_Printf(
+				stgMemory->debugStream,
+				"Warning: Memory module not compiled - Memory_IsAllocated() is meaningless\n" );
+		#endif
+		return True;
+	#endif
+}
+
+
+/* Begin private functions */
+
+void Memory_Add_Pointer( MemoryPointer* memoryPointer )
+{
+	assert ( memoryPointer );
+	
+	stgMemory->ptrCache = memoryPointer->ptr;
+	stgMemory->memCache = memoryPointer;
+	
+		if ( !memoryPointer->ptr ){
+#if 0 			
+			printf ("trying to insert a null pointer\n");
+#endif
+			return;
+		}
+
+	BTree_InsertNode ( stgMemory->pointers, memoryPointer, sizeof( MemoryPointer* ) );
+}
+
+void Memory_Free_Pointer( MemoryPointer* memoryPointer )
+{
+	_Memory_InternalFree( memoryPointer->ptr );
+	memoryPointer->ptr = NULL;
+	memoryPointer->status = MEMORY_POINTER_RELEASED;
+	memoryPointer->stamp = stgMemory->stamp++;
+	
+	memoryPointer->name->freeCount++;
+	memoryPointer->func->freeCount++;
+	
+	MemoryField_Update( memoryPointer->name, -(memoryPointer->totalSize) );
+	MemoryField_Update( memoryPointer->func, -(memoryPointer->totalSize) );
+}
+
+MemoryPointer* Memory_Find_Pointer( Pointer ptr )
+{
+	BTreeNode *node = NULL;
+	MemoryPointer *result = NULL;
+	
+	/* Added on 3/6/2009: a NULL ptr should always return as not found, yet in some cases
+	 * it was returning a MemoryPointer (perhaps from a free'd array) */
+	if ( ptr == NULL ) {
+		return NULL;
+	}
+
+	if ( stgMemory->ptrCache == ptr ){
+		return stgMemory->memCache;
+	}
+	
+	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_Value );
+	
+	node = BTree_FindNode( stgMemory->pointers, (void*) ptr);
+	
+	BTree_SetCompareFunction( stgMemory->pointers, compareFunction_NodeData_To_NodeData );
+	
+	if ( node != NULL ){
+		result = (MemoryPointer*) BTree_GetData( node );
+	}
+	else{
+		result = NULL;
+	}
+	
+	return result;
+}
+
+void Memory_SetupPointer_2DArray(
+	void* ptr,
+	SizeT itemSize,
+	Index xLength,
+	Index yLength )
+{
+	Pointer* array;
+	int ptrHeaderSize;
+	int ySize;
+	Index i;
+	
+	ptrHeaderSize = sizeof(Pointer) * xLength;
+	ySize = itemSize * yLength;
+	
+	array = (Pointer*) ptr;
+	for (i = 0; i < xLength; ++i )
+	{
+		array[i] = (Pointer)( (ArithPointer)ptr + ptrHeaderSize + ( i * ySize ) ) ;
+	}
+
+}
+
+void Memory_SetupPointer_3DArray(
+	void* ptr,
+	SizeT itemSize,
+	Index xLength,
+	Index yLength,
+	Index zLength )
+{
+	Pointer*	array1;
+	Pointer**	array2;
+	Index i, j;
+	int ptrHeader1, ptrHeader2;
+	int ySize, yzProduct;
+	
+	ptrHeader1 = sizeof(Pointer) * xLength;
+	ptrHeader2 = sizeof(Pointer) * xLength * yLength;
+	
+	ySize = sizeof(Pointer) * yLength;
+	yzProduct = yLength * zLength;
+	
+	array1 = (Pointer*) ptr;
+	for ( i = 0; i < xLength; ++i )
+	{
+		array1[i] = (Pointer)( (ArithPointer)ptr + ptrHeader1 + ( i * ySize ) );
+	}
+	
+	array2 = (Pointer**) ptr;
+	for ( i = 0; i < xLength; ++i )
+	{
+		for ( j = 0; j < yLength; ++j )
+		{
+			array2[i][j] = (Pointer)( (ArithPointer)ptr
+				+ ptrHeader1
+				+ ptrHeader2
+				+ ( ( (i * yzProduct) + (j * zLength) ) * itemSize ) );
+		}
+	}
+}
+
+
+void Memory_Relocate_2DArrayData(
+	void* destPtr, 
+	void* srcPtr,
+	SizeT itemSize, 
+	Index oldX, 
+	Index oldY, 
+	Index newX, 
+	Index newY )
+{
+	int i, j;
+	
+	if ( ( oldX > newX ) || ( oldY > newY ) )
+	{
+		/* Cannot handle these combinations yet. */
+		assert( 0 );
+		return;
+	}
+	
+	/* copy in reverse order to avoid overwritting data */
+	/* Note: using memmove because this function is often called to relocate data within an existing
+	 * array that's been resized - thus data may be overlapping */
+	for ( i = oldX - 1; i >= 0; --i ) {
+		for ( j = oldY - 1; j >= 0; --j ) {
+			memmove( (Pointer)((ArithPointer)destPtr + ( ((i * newY) + j) * itemSize ) ),
+				(Pointer)((ArithPointer)srcPtr + (  ((i * oldY) + j) * itemSize ) ),
+				itemSize );
+		}
+	}
+}
+
+void Memory_Relocate_3DArrayData( 
+	void* destPtr, 
+	void* srcPtr,
+	SizeT itemSize, 
+	Index oldX, 
+	Index oldY, 
+	Index oldZ,
+	Index newX, 
+	Index newY,
+	Index newZ )
+{
+	int i, j, k;
+	
+	if ( ( oldX > newX ) || ( oldY > newY ) || ( oldZ > newZ ) )
+	{
+		/* Cannot handle these combinations yet. */
+		return;
+	}
+	
+	/* copy in reverse order to avoid overwritting data */
+	/* Note: using memmove because this function is often called to relocate data within an existing
+	 * array that's been resized - thus data may be overlapping */
+	for ( i = oldX - 1; i >= 0; --i ) {
+		for ( j = oldY - 1; j >= 0; --j ) {
+			for ( k = oldZ - 1; k >= 0; --k ) {
+				memmove( (Pointer)((ArithPointer)destPtr + ( ((i * newY * newZ) + (j * newZ) + k) * itemSize ) ),
+					(Pointer)((ArithPointer)srcPtr  + ( ((i * oldY * oldZ) + (j * oldZ) + k) * itemSize ) ),
+					itemSize );
+			}
+		}
+	}
+}
+
+void* _Memory_InternalMalloc( SizeT size ) {
+	void* result;
+	void* data;
+
+	if( !size )
+	  return NULL;
+
+#ifdef NOEXPERIMENT			
+	result = malloc( size );
+	if ( result == NULL ) {
+		Memory_OutOfMemoryError( size );
+	}
+	return result;
+#else
+
+	if( stgMemory ){
+		unsigned long prev = stgMemory->stgCurrentMemory;
+		stgMemory->stgCurrentMemory += size;
+		stgMemory->stgPeakMemory = MAX( stgMemory->stgCurrentMemory, prev );
+	}
+	
+	result = malloc( size + sizeof( MemoryTag ) );
+	if ( result == NULL ) {
+		result = malloc( size + sizeof( MemoryTag ) );
+		if ( result == NULL ) {
+			if(stgMemory){
+				Memory_OutOfMemoryError( size + sizeof( MemoryTag ) );
+			}
+			else{
+				fprintf( stderr, "Out of memory in %s\n", __func__ );
+			}
+		}
+	}
+	data = (void*)((ArithPointer)result + sizeof( MemoryTag ));
+	
+	Memory_CountGet( data ) = 0;
+	Memory_SizeGet( data ) = size;
+
+	return data;
+#endif
+}
+
+void* _Memory_InternalRealloc( void* ptr, SizeT size ) {
+	void* result;
+	void* data;
+	int count = 0;
+#ifdef NOEXPERIMENT
+	result =  realloc( ptr, size );
+	if ( result == NULL ) {
+		Memory_OutOfMemoryError( size );
+	}
+	return result;
+#else
+	unsigned long prev = stgMemory->stgCurrentMemory;
+
+	if ( ptr == 0 ) {
+		return _Memory_InternalMalloc( size );
+	}
+	if( size == 0 ) {
+		Memory_Free( ptr );
+		return NULL;
+	}
+
+	count = Memory_CountGet( ptr );		/* Store previous count */
+	stgMemory->stgCurrentMemory -= Memory_SizeGet( ptr );
+	
+	result = realloc( (void*)( (ArithPointer)ptr - sizeof(MemoryTag) ), size + sizeof(MemoryTag) );
+	if ( result == NULL ) {
+		/* have second attempt */
+		result = realloc( (void*)( (ArithPointer)ptr - sizeof(MemoryTag) ), size + sizeof(MemoryTag) );
+		if ( result == NULL ) {
+			Memory_OutOfMemoryError( size + sizeof(MemoryTag) );
+		}
+	}
+	data = (void*)((ArithPointer)result + sizeof( MemoryTag ));
+
+	Memory_CountGet( data ) = count;
+	Memory_SizeGet( data )  = size;
+	stgMemory->stgCurrentMemory += size;
+	stgMemory->stgPeakMemory = MAX( stgMemory->stgCurrentMemory, prev );
+
+	return data;
+#endif
+
+}
+
+void _Memory_InternalFree( void* ptr ) {
+	if( !ptr ) return;
+#ifdef NOEXPERIMENT
+	free( ptr );
+#else
+	stgMemory->stgCurrentMemory -= Memory_SizeGet( ptr );
+	free( (void*)((ArithPointer)ptr - sizeof( MemoryTag)) );
+#endif
+}
+
+
+void _Memory_OutOfMemoryErrorFunc( Name func, int line, SizeT size ) {
+	Journal_Firewall(
+		0,
+		Journal_Register( Error_Type, "Memory" ),
+		"StGermain Memory Error!\n"
+		"\tAttempting to allocate %d bytes, in %s() line %d\n"
+		"\tCurrent StGermain memory usage is %d bytes\n",
+		size,
+		func,
+		line,
+		stgMemory->stgCurrentMemory );
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemoryField.c
--- a/Base/Foundation/src/MemoryField.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MemoryField.c 3803 2006-09-27 03:17:12Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "MemoryPointer.h"
-#include "MemoryField.h"
-#include "Memory.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stddef.h>
-
-#define MAX( x, y ) ((x > y) ? x : y)
-
-const Type MemoryField_Type = "MemoryField";
-const Name Memory_IgnoreName = "Memory_IgnoreName";
-
-const Index MEMORYFIELD_DELTA = 4;	/**< Number of fields to extend by when array resizes. */
-
-
-MemoryField* MemoryField_New( Name value ) {
-	MemoryField* result = (MemoryField*) malloc( sizeof(MemoryField) );
-	_MemoryField_Init( result, value );
-
-	return result;	
-}
-
-
-void _MemoryField_Init( MemoryField* memoryField, Name value ) {
-	if ( value ) {
-		memoryField->value = (char*)malloc( (strlen(value) + 1) * sizeof(char) );
-		strcpy( memoryField->value, value );
-	}
-	else {
-		memoryField->value = NULL;
-	}
-	
-	memoryField->allocCount = 0;
-	memoryField->freeCount = 0;
-	memoryField->currentAllocation = 0;
-	memoryField->peakAllocation = 0;
-	memoryField->totalAllocation = 0;
-	
-	memoryField->subCount = 0;
-	memoryField->subSize = 0;
-	memoryField->subFields = NULL;	
-	
-	memoryField->memCache = NULL;
-}
-
-	
-void MemoryField_Delete( MemoryField* memoryField ) {
-	Index i;
-	
-	if ( memoryField->value ) {
-		free( memoryField->value );	
-	}
-	
-	if ( memoryField->subFields ) {
-		for ( i = 0; i < memoryField->subCount; ++i ) {
-			MemoryField_Delete( memoryField->subFields[i] );
-		}
-		free( memoryField->subFields );
-	}
-	free( memoryField );
-}
-	
-
-MemoryField* MemoryField_Register( MemoryField* memoryField, Name subValue ) {
-	Index i;
-	
-	/* Search cache first for localisation. */
-	if ( memoryField->memCache ) {
-		if ( MemoryField_StringCompare( memoryField->memCache->value, subValue ) == 0 ) {
-			return memoryField->memCache;
-		}
-	}
-	
-	/* Not in cache so linear search. */
-	for ( i = 0; i < memoryField->subCount; ++i ) {
-		if ( MemoryField_StringCompare( memoryField->subFields[i]->value, subValue ) == 0 ) {
-			/* Value exists, update cache and return the field. */
-			memoryField->memCache = memoryField->subFields[i];
-			return memoryField->subFields[i];
-		}
-	}
-	
-	/* Not exist, add to registry. */
-	
-	/* Extend array if needed. */
-	if ( memoryField->subCount == memoryField->subSize ) {
-		memoryField->subSize += MEMORYFIELD_DELTA;
-		memoryField->subFields = (MemoryField**)
-			realloc( memoryField->subFields, sizeof(MemoryField*) * memoryField->subSize );
-	}
-	
-	memoryField->subFields[memoryField->subCount] = MemoryField_New( subValue );
-	memoryField->memCache = memoryField->subFields[memoryField->subCount];
-	
-	memoryField->subCount++;
-	
-	return memoryField->subFields[memoryField->subCount - 1];
-}
-
-
-void MemoryField_Update( MemoryField* memoryField, int bytes ) {
-	memoryField->currentAllocation += bytes;
-	
-	memoryField->peakAllocation = MAX( memoryField->currentAllocation, memoryField->peakAllocation );
-	
-	if ( bytes > 0 ) {
-		memoryField->totalAllocation += bytes;
-	}
-}
-
-
-void MemoryField_UpdateAsSumOfSubFields( MemoryField* memoryField ) {
-	Index i;
-
-	if( memoryField->subCount < 1 ) {
-		return;	
-	}
-	
-	memoryField->allocCount = 0;
-	memoryField->freeCount = 0;
-	memoryField->currentAllocation = 0;
-	memoryField->peakAllocation = 0;
-	memoryField->totalAllocation = 0;
-	
-	for ( i = 0; i < memoryField->subCount; ++i ) {
-		if ( !MemoryField_StringCompare( memoryField->subFields[i]->value, Memory_IgnoreName ) == 0 ) {
-			MemoryField_UpdateAsSumOfSubFields( memoryField->subFields[i] );
-			memoryField->allocCount += memoryField->subFields[i]->allocCount;
-			memoryField->freeCount += memoryField->subFields[i]->freeCount;
-			memoryField->currentAllocation += memoryField->subFields[i]->currentAllocation;
-			memoryField->peakAllocation += memoryField->subFields[i]->peakAllocation;
-			memoryField->totalAllocation += memoryField->subFields[i]->totalAllocation;
-		}
-	}
-}
-
-
-void MemoryField_Print( MemoryField* memoryField, MemoryFieldColumn columns,
-      unsigned int valueFieldWidth )
-{
-	if ( MemoryField_StringCompare( memoryField->value, Memory_IgnoreName ) == 0 ) {
-		return;
-	}
-
-	if ( columns & MEMORYFIELD_VALUE ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%-*s ", valueFieldWidth, memoryField->value );
-	}
-	if ( columns & MEMORYFIELD_ALLOC ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%15d ", memoryField->allocCount );
-	}
-	if ( columns & MEMORYFIELD_FREE ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%10d ", memoryField->freeCount );
-	}
-	if ( columns & MEMORYFIELD_CURRENT ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%13d ", memoryField->currentAllocation );
-	}
-	if ( columns & MEMORYFIELD_PEAK ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%10d ", memoryField->peakAllocation );
-	}
-	if ( columns & MEMORYFIELD_TOTAL ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%11d", memoryField->totalAllocation );
-	}
-	Journal_PrintfL( stgMemory->infoStream, 1, "\n" );
-}
-
-
-void MemoryField_PrintHeader( Name fieldName, MemoryFieldColumn columns,
-		unsigned int valueFieldWidth )
-{
-	if ( columns & MEMORYFIELD_VALUE ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "%-*s ", valueFieldWidth, fieldName );
-	}
-	if ( columns & MEMORYFIELD_ALLOC ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "Times Allocated " );
-	}
-	if ( columns & MEMORYFIELD_FREE ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "Times Free " );
-	}
-	if ( columns & MEMORYFIELD_CURRENT ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "Current bytes " );
-	}
-	if ( columns & MEMORYFIELD_PEAK ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "Peak bytes " );
-	}
-	if ( columns & MEMORYFIELD_TOTAL ) {
-		Journal_PrintfL( stgMemory->infoStream, 1, "Total bytes " );
-	}
-
-	Journal_PrintfL( stgMemory->infoStream, 1, "\n" );
-}
-
-
-void MemoryField_PrintSummary( MemoryField* memoryField, Name tableTitle, MemoryFieldColumn cols ) {
-	Index             i;
-	MemoryFieldColumn colsNoVal;
-	unsigned int      nameFieldWidth = 0;
-
-	colsNoVal = (MemoryFieldColumn)(MEMORYFIELD_ALL - MEMORYFIELD_VALUE);
-
-	if ( MemoryField_StringCompare( memoryField->value, Memory_IgnoreName ) == 0 ) {
-		return;
-	}
-
-	if ( memoryField->subCount > 0 ) {
-		MemoryField_UpdateAsSumOfSubFields( memoryField );
-
-		Journal_Printf( stgMemory->infoStream, "%s\n", memoryField->value );
-
-		Stream_Indent( stgMemory->infoStream );
-		MemoryField_PrintHeader(NULL,
-                                        (MemoryFieldColumn)(cols & colsNoVal),
-                                        0 );
-		MemoryField_Print(memoryField,
-                                  (MemoryFieldColumn)(cols & colsNoVal), 0 );
-
-		Stream_Indent( stgMemory->infoStream );
-		
-		MemoryField_Sort( memoryField );
-		nameFieldWidth = _MemoryField_CalcLongestSubFieldNameLen( memoryField );
-		if ( strlen(tableTitle) > nameFieldWidth ) {
-			nameFieldWidth = strlen(tableTitle);
-		}
-
-		MemoryField_PrintHeader( tableTitle, cols, nameFieldWidth );
-		for ( i = 0; i < memoryField->subCount; ++i ) {
-			if ( memoryField->subFields[i]->allocCount > 0 ) {
-				MemoryField_Print( memoryField->subFields[i], cols, nameFieldWidth );
-			}
-		}
-		
-		Stream_UnIndent( stgMemory->infoStream );
-		Stream_UnIndent( stgMemory->infoStream );
-	}
-}
-
-
-void MemoryField_Sort( MemoryField* memoryField ) {
-	/* insertion sort */
-	Index i, j;
-	MemoryField* tmp;
-
-	for ( i = 0; i < memoryField->subCount; ++i ) {
-		j = i;
-		tmp = memoryField->subFields[j];
-		while ( j > 0 && MemoryField_StringCompare( memoryField->subFields[j - 1]->value, tmp->value ) > 0 ) {
-			memoryField->subFields[j] = memoryField->subFields[j - 1];
-			--j;
-		}
-		memoryField->subFields[j] = tmp;
-	}
-}
-
-
-int MemoryField_StringCompare( Name s1, const char* s2 ) {
-	if ( s1 && s2 ) {
-		return strcmp( s1, s2 );
-	}
-	return (long)s1 - (long)s2;
-}
-
-
-unsigned int _MemoryField_CalcLongestSubFieldNameLen( MemoryField* memoryField ) {
-	/* insertion sort */
-	Index         ii;
-	unsigned int  longestSubFieldNameLen=0;
-	unsigned int  currSubFieldNameLen=0;
-
-	for ( ii = 0; ii < memoryField->subCount; ii++ ) {
-		if ( NULL == memoryField->subFields[ii]->value ) continue;
-
-		currSubFieldNameLen = strlen( memoryField->subFields[ii]->value );
-		if ( currSubFieldNameLen > longestSubFieldNameLen ) {
-			longestSubFieldNameLen = currSubFieldNameLen;
-		}	
-	}
-
-	return longestSubFieldNameLen;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemoryField.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/MemoryField.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,318 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MemoryField.c 3803 2006-09-27 03:17:12Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "MemoryPointer.h"
+#include "MemoryField.h"
+#include "Memory.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stddef.h>
+
+#define MAX( x, y ) ((x > y) ? x : y)
+
+const Type MemoryField_Type = "MemoryField";
+const Name Memory_IgnoreName = "Memory_IgnoreName";
+
+const Index MEMORYFIELD_DELTA = 4;	/**< Number of fields to extend by when array resizes. */
+
+
+MemoryField* MemoryField_New( Name value ) {
+	MemoryField* result = (MemoryField*) malloc( sizeof(MemoryField) );
+	_MemoryField_Init( result, value );
+
+	return result;	
+}
+
+
+void _MemoryField_Init( MemoryField* memoryField, Name value ) {
+	if ( value ) {
+		memoryField->value = (char*)malloc( (strlen(value) + 1) * sizeof(char) );
+		strcpy( memoryField->value, value );
+	}
+	else {
+		memoryField->value = NULL;
+	}
+	
+	memoryField->allocCount = 0;
+	memoryField->freeCount = 0;
+	memoryField->currentAllocation = 0;
+	memoryField->peakAllocation = 0;
+	memoryField->totalAllocation = 0;
+	
+	memoryField->subCount = 0;
+	memoryField->subSize = 0;
+	memoryField->subFields = NULL;	
+	
+	memoryField->memCache = NULL;
+}
+
+	
+void MemoryField_Delete( MemoryField* memoryField ) {
+	Index i;
+	
+	if ( memoryField->value ) {
+		free( memoryField->value );	
+	}
+	
+	if ( memoryField->subFields ) {
+		for ( i = 0; i < memoryField->subCount; ++i ) {
+			MemoryField_Delete( memoryField->subFields[i] );
+		}
+		free( memoryField->subFields );
+	}
+	free( memoryField );
+}
+	
+
+MemoryField* MemoryField_Register( MemoryField* memoryField, Name subValue ) {
+	Index i;
+	
+	/* Search cache first for localisation. */
+	if ( memoryField->memCache ) {
+		if ( MemoryField_StringCompare( memoryField->memCache->value, subValue ) == 0 ) {
+			return memoryField->memCache;
+		}
+	}
+	
+	/* Not in cache so linear search. */
+	for ( i = 0; i < memoryField->subCount; ++i ) {
+		if ( MemoryField_StringCompare( memoryField->subFields[i]->value, subValue ) == 0 ) {
+			/* Value exists, update cache and return the field. */
+			memoryField->memCache = memoryField->subFields[i];
+			return memoryField->subFields[i];
+		}
+	}
+	
+	/* Not exist, add to registry. */
+	
+	/* Extend array if needed. */
+	if ( memoryField->subCount == memoryField->subSize ) {
+		memoryField->subSize += MEMORYFIELD_DELTA;
+		memoryField->subFields = (MemoryField**)
+			realloc( memoryField->subFields, sizeof(MemoryField*) * memoryField->subSize );
+	}
+	
+	memoryField->subFields[memoryField->subCount] = MemoryField_New( subValue );
+	memoryField->memCache = memoryField->subFields[memoryField->subCount];
+	
+	memoryField->subCount++;
+	
+	return memoryField->subFields[memoryField->subCount - 1];
+}
+
+
+void MemoryField_Update( MemoryField* memoryField, int bytes ) {
+	memoryField->currentAllocation += bytes;
+	
+	memoryField->peakAllocation = MAX( memoryField->currentAllocation, memoryField->peakAllocation );
+	
+	if ( bytes > 0 ) {
+		memoryField->totalAllocation += bytes;
+	}
+}
+
+
+void MemoryField_UpdateAsSumOfSubFields( MemoryField* memoryField ) {
+	Index i;
+
+	if( memoryField->subCount < 1 ) {
+		return;	
+	}
+	
+	memoryField->allocCount = 0;
+	memoryField->freeCount = 0;
+	memoryField->currentAllocation = 0;
+	memoryField->peakAllocation = 0;
+	memoryField->totalAllocation = 0;
+	
+	for ( i = 0; i < memoryField->subCount; ++i ) {
+		if ( !MemoryField_StringCompare( memoryField->subFields[i]->value, Memory_IgnoreName ) == 0 ) {
+			MemoryField_UpdateAsSumOfSubFields( memoryField->subFields[i] );
+			memoryField->allocCount += memoryField->subFields[i]->allocCount;
+			memoryField->freeCount += memoryField->subFields[i]->freeCount;
+			memoryField->currentAllocation += memoryField->subFields[i]->currentAllocation;
+			memoryField->peakAllocation += memoryField->subFields[i]->peakAllocation;
+			memoryField->totalAllocation += memoryField->subFields[i]->totalAllocation;
+		}
+	}
+}
+
+
+void MemoryField_Print( MemoryField* memoryField, MemoryFieldColumn columns,
+      unsigned int valueFieldWidth )
+{
+	if ( MemoryField_StringCompare( memoryField->value, Memory_IgnoreName ) == 0 ) {
+		return;
+	}
+
+	if ( columns & MEMORYFIELD_VALUE ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%-*s ", valueFieldWidth, memoryField->value );
+	}
+	if ( columns & MEMORYFIELD_ALLOC ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%15d ", memoryField->allocCount );
+	}
+	if ( columns & MEMORYFIELD_FREE ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%10d ", memoryField->freeCount );
+	}
+	if ( columns & MEMORYFIELD_CURRENT ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%13d ", memoryField->currentAllocation );
+	}
+	if ( columns & MEMORYFIELD_PEAK ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%10d ", memoryField->peakAllocation );
+	}
+	if ( columns & MEMORYFIELD_TOTAL ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%11d", memoryField->totalAllocation );
+	}
+	Journal_PrintfL( stgMemory->infoStream, 1, "\n" );
+}
+
+
+void MemoryField_PrintHeader( Name fieldName, MemoryFieldColumn columns,
+		unsigned int valueFieldWidth )
+{
+	if ( columns & MEMORYFIELD_VALUE ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "%-*s ", valueFieldWidth, fieldName );
+	}
+	if ( columns & MEMORYFIELD_ALLOC ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "Times Allocated " );
+	}
+	if ( columns & MEMORYFIELD_FREE ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "Times Free " );
+	}
+	if ( columns & MEMORYFIELD_CURRENT ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "Current bytes " );
+	}
+	if ( columns & MEMORYFIELD_PEAK ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "Peak bytes " );
+	}
+	if ( columns & MEMORYFIELD_TOTAL ) {
+		Journal_PrintfL( stgMemory->infoStream, 1, "Total bytes " );
+	}
+
+	Journal_PrintfL( stgMemory->infoStream, 1, "\n" );
+}
+
+
+void MemoryField_PrintSummary( MemoryField* memoryField, Name tableTitle, MemoryFieldColumn cols ) {
+	Index             i;
+	MemoryFieldColumn colsNoVal;
+	unsigned int      nameFieldWidth = 0;
+
+	colsNoVal = (MemoryFieldColumn)(MEMORYFIELD_ALL - MEMORYFIELD_VALUE);
+
+	if ( MemoryField_StringCompare( memoryField->value, Memory_IgnoreName ) == 0 ) {
+		return;
+	}
+
+	if ( memoryField->subCount > 0 ) {
+		MemoryField_UpdateAsSumOfSubFields( memoryField );
+
+		Journal_Printf( stgMemory->infoStream, "%s\n", memoryField->value );
+
+		Stream_Indent( stgMemory->infoStream );
+		MemoryField_PrintHeader(NULL,
+                                        (MemoryFieldColumn)(cols & colsNoVal),
+                                        0 );
+		MemoryField_Print(memoryField,
+                                  (MemoryFieldColumn)(cols & colsNoVal), 0 );
+
+		Stream_Indent( stgMemory->infoStream );
+		
+		MemoryField_Sort( memoryField );
+		nameFieldWidth = _MemoryField_CalcLongestSubFieldNameLen( memoryField );
+		if ( strlen(tableTitle) > nameFieldWidth ) {
+			nameFieldWidth = strlen(tableTitle);
+		}
+
+		MemoryField_PrintHeader( tableTitle, cols, nameFieldWidth );
+		for ( i = 0; i < memoryField->subCount; ++i ) {
+			if ( memoryField->subFields[i]->allocCount > 0 ) {
+				MemoryField_Print( memoryField->subFields[i], cols, nameFieldWidth );
+			}
+		}
+		
+		Stream_UnIndent( stgMemory->infoStream );
+		Stream_UnIndent( stgMemory->infoStream );
+	}
+}
+
+
+void MemoryField_Sort( MemoryField* memoryField ) {
+	/* insertion sort */
+	Index i, j;
+	MemoryField* tmp;
+
+	for ( i = 0; i < memoryField->subCount; ++i ) {
+		j = i;
+		tmp = memoryField->subFields[j];
+		while ( j > 0 && MemoryField_StringCompare( memoryField->subFields[j - 1]->value, tmp->value ) > 0 ) {
+			memoryField->subFields[j] = memoryField->subFields[j - 1];
+			--j;
+		}
+		memoryField->subFields[j] = tmp;
+	}
+}
+
+
+int MemoryField_StringCompare( Name s1, const char* s2 ) {
+	if ( s1 && s2 ) {
+		return strcmp( s1, s2 );
+	}
+	return (long)s1 - (long)s2;
+}
+
+
+unsigned int _MemoryField_CalcLongestSubFieldNameLen( MemoryField* memoryField ) {
+	/* insertion sort */
+	Index         ii;
+	unsigned int  longestSubFieldNameLen=0;
+	unsigned int  currSubFieldNameLen=0;
+
+	for ( ii = 0; ii < memoryField->subCount; ii++ ) {
+		if ( NULL == memoryField->subFields[ii]->value ) continue;
+
+		currSubFieldNameLen = strlen( memoryField->subFields[ii]->value );
+		if ( currSubFieldNameLen > longestSubFieldNameLen ) {
+			longestSubFieldNameLen = currSubFieldNameLen;
+		}	
+	}
+
+	return longestSubFieldNameLen;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemoryPointer.c
--- a/Base/Foundation/src/MemoryPointer.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MemoryPointer.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "Memory.h"
-#include "MemoryField.h"
-#include "MemoryPointer.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stddef.h>
-
-
-const Type MemoryPointer_Type = "MemoryPointer";
-
-
-MemoryPointer* MemoryPointer_New(
-	Pointer ptr,
-	MemoryOpStamp stamp,
-	Name type,
-	Name name,
-	Name file,
-	Name func,
-	Index line,
-	MemoryAllocType allocType,
-	SizeT itemSize,
-	SizeT totalSize )
-{
-	MemoryPointer* result = (MemoryPointer*) malloc( sizeof(MemoryPointer) );
-	
-	MemoryPointer_Init( result, ptr, stamp, type, name, file, func, line, allocType, itemSize, totalSize );
-	
-	return result;
-}
-	
-void MemoryPointer_Init(
-	MemoryPointer* memoryPointer,
-	Pointer ptr,
-	MemoryOpStamp stamp,
-	Name type,
-	Name name,
-	Name file,
-	Name func,
-	Index line,
-	MemoryAllocType allocType,
-	SizeT itemSize,
-	SizeT totalSize )
-{
-	memoryPointer->ptr = ptr;
-	memoryPointer->ptrReference = ptr;
-	memoryPointer->status = MEMORY_POINTER_PERSISTENT;
-	memoryPointer->stamp = stamp;
-
-	/* Get/Create records in Memory */
-	memoryPointer->type = MemoryField_Register( stgMemory->types, type );
-	memoryPointer->name = MemoryField_Register( memoryPointer->type, name );
-	memoryPointer->file = MemoryField_Register( stgMemory->files, file );
-	memoryPointer->func = MemoryField_Register( memoryPointer->file, func );
-	
-	memoryPointer->line = line;
-
-	memoryPointer->name->allocCount++;
-	memoryPointer->func->allocCount++;
-	
-	memoryPointer->allocType = allocType;
-	memoryPointer->itemSize = itemSize;
-	memoryPointer->totalSize = totalSize;
-
-	/* Update the statistics of leaf fields. Parent fields can derive values. */
-	MemoryField_Update( memoryPointer->name, totalSize );
-	MemoryField_Update( memoryPointer->func, totalSize );
-}
-	
-void MemoryPointer_Delete( MemoryPointer* memoryPointer )
-{
-	/* Deallocate length according to allocation type */
-	switch ( memoryPointer->allocType )
-	{
-		case MEMORY_OBJECT:
-		case MEMORY_1DARRAY:
-		case MEMORY_2DARRAY:
-		case MEMORY_3DARRAY:
-		case MEMORY_4DARRAY:
-		case MEMORY_2DAS1D:
-		case MEMORY_3DAS1D:
-		case MEMORY_4DAS1D:
-			break;
-		case MEMORY_2DCOMPLEX:
-		case MEMORY_3DSETUP:
-			free( memoryPointer->length.xyz.y );
-			break;
-		case MEMORY_3DCOMPLEX:
-			free( memoryPointer->length.xyz.y );
-			free( memoryPointer->length.xyz.z );
-			break;
-	}
-	
-	if ( memoryPointer ){
-		free( memoryPointer );
-	}
-}
-
-void MemoryPointer_Delete_Helper( void *memoryPointer, void *args )
-{
-	assert( memoryPointer );
-	MemoryPointer_Delete( (MemoryPointer*) memoryPointer );
-}
-
-void MemoryPointer_Print( MemoryPointer* memoryPointer, MemoryPointerColumn columns )
-{
-	Index i, j;
-
-	/*
-	 * Bit compare which flags are set in order.
-	 * Print each field accordingly
-	 */
-	
-	if ( columns & MEMORYPOINTER_ALLOCTYPE )
-	{
-		switch ( memoryPointer->allocType )
-		{
-			case MEMORY_OBJECT:
-				Journal_PrintfL( stgMemory->infoStream, 2, "Object,     " );
-				break;
-			case MEMORY_1DARRAY:
-				Journal_PrintfL( stgMemory->infoStream, 2, "1D Array,   " );
-				break;
-			case MEMORY_2DARRAY:
-				Journal_PrintfL( stgMemory->infoStream, 2, "2D Array,   " );
-				break;
-			case MEMORY_3DARRAY:
-				Journal_PrintfL( stgMemory->infoStream, 2, "3D Array,   " );
-				break;						
-			case MEMORY_4DARRAY:
-				Journal_PrintfL( stgMemory->infoStream, 2, "4D Array,   " );
-				break;				
-			case MEMORY_2DAS1D:
-				Journal_PrintfL( stgMemory->infoStream, 2, "2D as 1D,   " );
-				break;
-			case MEMORY_3DAS1D:
-				Journal_PrintfL( stgMemory->infoStream, 2, "3D as 1D,   " );
-				break;					
-			case MEMORY_4DAS1D:
-				Journal_PrintfL( stgMemory->infoStream, 2, "4D as 1D,   " );
-				break;
-			case MEMORY_2DCOMPLEX:
-				Journal_PrintfL( stgMemory->infoStream, 2, "2D Complex, " );
-				break;
-			case MEMORY_3DSETUP:
-				Journal_PrintfL( stgMemory->infoStream, 2, "3D Setup,   " );
-				break;
-			case MEMORY_3DCOMPLEX:
-				Journal_PrintfL( stgMemory->infoStream, 2, "3D Complex, " );
-				break;
-		}
-	}
-	if ( columns & MEMORYPOINTER_PTR )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "(ptr)%p, ", memoryPointer->ptr );
-	}
-	if ( columns & MEMORYPOINTER_TYPE )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "%s, ", memoryPointer->type->value );
-	}
-	if ( columns & MEMORYPOINTER_NAME )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "%s, ", memoryPointer->name->value );
-	}
-	if ( columns & MEMORYPOINTER_FILE )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "%s, ", memoryPointer->file->value );
-	}
-	if ( columns & MEMORYPOINTER_FUNC )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "%s(), ", memoryPointer->func->value );
-	}
-	if ( columns & MEMORYPOINTER_LINE )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "Line:%d, ", memoryPointer->line );
-	}
-	if ( columns & MEMORYPOINTER_TOTALSIZE )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "Total:%d, ", memoryPointer->totalSize );
-	}
-	if ( columns & MEMORYPOINTER_ITEMSIZE )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "ItemSize:%d, ", memoryPointer->itemSize );
-	}
-	if ( columns & MEMORYPOINTER_LENGTH )
-	{
-		Journal_PrintfL( stgMemory->infoStream, 2, "Count: " );
-		switch ( memoryPointer->allocType )
-		{
-			case MEMORY_OBJECT:
-				Journal_PrintfL( stgMemory->infoStream, 2, "N/A" );
-				break;
-			case MEMORY_1DARRAY:
-				Journal_PrintfL( stgMemory->infoStream, 2, "%d", memoryPointer->length );
-				break;
-			case MEMORY_2DARRAY:
-			case MEMORY_2DAS1D:
-				Journal_PrintfL( stgMemory->infoStream, 2, "%d x %d",
-					memoryPointer->length.twoD[0],
-					memoryPointer->length.twoD[1] );
-				break;
-			case MEMORY_3DARRAY:
-			case MEMORY_3DAS1D:
-				Journal_PrintfL( stgMemory->infoStream, 2, "%d x %d x %d",
-					memoryPointer->length.threeD[0],
-					memoryPointer->length.threeD[1],
-					memoryPointer->length.threeD[2] );
-				break;
-			case MEMORY_4DARRAY:
-			case MEMORY_4DAS1D:
-				Journal_PrintfL( stgMemory->infoStream, 2, "%d x %d x %d x %d",
-					memoryPointer->length.fourD[0],
-					memoryPointer->length.fourD[1],
-					memoryPointer->length.fourD[2],
-					memoryPointer->length.fourD[3] );
-				break;				
-			case MEMORY_2DCOMPLEX:
-			case MEMORY_3DSETUP:
-				Journal_PrintfL( stgMemory->infoStream, 3, "%d by { ", memoryPointer->length.xyz.x );
-				for ( i = 0; i < memoryPointer->length.xyz.x; ++i )
-				{
-					Journal_PrintfL( stgMemory->infoStream, 3, "%d", memoryPointer->length.xyz.y[i] );
-					if ( i != memoryPointer->length.xyz.x - 1 )
-					{
-						Journal_PrintfL( stgMemory->infoStream, 3, ", " );
-					}
-				}
-				Journal_PrintfL( stgMemory->infoStream, 3, " }" );
-				break;
-			case MEMORY_3DCOMPLEX:
-				Journal_PrintfL( stgMemory->infoStream, 3, "\n" );
-				for ( i = 0; i < memoryPointer->length.xyz.x; ++i )
-				{
-					Journal_PrintfL( stgMemory->infoStream, 3, "{ " );
-					for ( j = 0; j < memoryPointer->length.xyz.y[i]; ++j )
-					{
-						Journal_PrintfL( stgMemory->infoStream, 3, "%d", memoryPointer->length.xyz.z[i][j] );
-						if ( j != memoryPointer->length.xyz.y[i] - 1 )
-						{
-							Journal_PrintfL( stgMemory->infoStream, 3, ", " );
-						}
-					}
-					Journal_PrintfL( stgMemory->infoStream, 3, " }\n" );
-				}
-				Journal_PrintfL( stgMemory->infoStream, 3, " }" );
-				break;
-		}
-	}
-	Journal_PrintfL( stgMemory->infoStream, 2, "\n" );
-
-}
-
-void MemoryPointer_Print_Type_Name_Func_Helper( void *memoryPointer, void *args )
-{
-	MemoryPointer_Print_Type_Name_Func_Helper_Arg *arguments;
-	MemoryPointer *memPtr;
-	MemoryField* typeField;
-	MemoryField* nameField;
-	
-	
-	assert( memoryPointer );
-	assert( args );
-
-	memPtr = (MemoryPointer*) memoryPointer;
-	arguments = (MemoryPointer_Print_Type_Name_Func_Helper_Arg*) args;
-	
-	typeField = MemoryField_Register( stgMemory->types, arguments->type );
-	nameField = MemoryField_Register( typeField, arguments->name );	
-	
-	if ( memPtr->type == typeField && memPtr->name == nameField ){
-		MemoryPointer_Print ( (MemoryPointer*) memoryPointer, arguments->printOptions );
-	}
-}
-
-void MemoryPointer_Print_File_Func_Helper( void *memoryPointer, void *args )
-{
-	MemoryPointer_Print_File_Func_Helper_Arg *arguments;
-	MemoryPointer *memPtr;
-	MemoryField* fileField;
-	MemoryField* funcField;
-	
-	
-	assert( memoryPointer );
-	assert( args );
-
-	memPtr = (MemoryPointer*) memoryPointer;
-	arguments = (MemoryPointer_Print_File_Func_Helper_Arg*) args;
-	
-	fileField = MemoryField_Register( stgMemory->types, arguments->fileName );
-	funcField = MemoryField_Register( fileField, arguments->funcName );	
-	
-	if ( memPtr->file == fileField && memPtr->func == funcField ){
-		MemoryPointer_Print ( (MemoryPointer*) memoryPointer, arguments->printOptions );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemoryPointer.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/MemoryPointer.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,333 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MemoryPointer.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "Memory.h"
+#include "MemoryField.h"
+#include "MemoryPointer.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stddef.h>
+
+
+const Type MemoryPointer_Type = "MemoryPointer";
+
+
+MemoryPointer* MemoryPointer_New(
+	Pointer ptr,
+	MemoryOpStamp stamp,
+	Name type,
+	Name name,
+	Name file,
+	Name func,
+	Index line,
+	MemoryAllocType allocType,
+	SizeT itemSize,
+	SizeT totalSize )
+{
+	MemoryPointer* result = (MemoryPointer*) malloc( sizeof(MemoryPointer) );
+	
+	MemoryPointer_Init( result, ptr, stamp, type, name, file, func, line, allocType, itemSize, totalSize );
+	
+	return result;
+}
+	
+void MemoryPointer_Init(
+	MemoryPointer* memoryPointer,
+	Pointer ptr,
+	MemoryOpStamp stamp,
+	Name type,
+	Name name,
+	Name file,
+	Name func,
+	Index line,
+	MemoryAllocType allocType,
+	SizeT itemSize,
+	SizeT totalSize )
+{
+	memoryPointer->ptr = ptr;
+	memoryPointer->ptrReference = ptr;
+	memoryPointer->status = MEMORY_POINTER_PERSISTENT;
+	memoryPointer->stamp = stamp;
+
+	/* Get/Create records in Memory */
+	memoryPointer->type = MemoryField_Register( stgMemory->types, type );
+	memoryPointer->name = MemoryField_Register( memoryPointer->type, name );
+	memoryPointer->file = MemoryField_Register( stgMemory->files, file );
+	memoryPointer->func = MemoryField_Register( memoryPointer->file, func );
+	
+	memoryPointer->line = line;
+
+	memoryPointer->name->allocCount++;
+	memoryPointer->func->allocCount++;
+	
+	memoryPointer->allocType = allocType;
+	memoryPointer->itemSize = itemSize;
+	memoryPointer->totalSize = totalSize;
+
+	/* Update the statistics of leaf fields. Parent fields can derive values. */
+	MemoryField_Update( memoryPointer->name, totalSize );
+	MemoryField_Update( memoryPointer->func, totalSize );
+}
+	
+void MemoryPointer_Delete( MemoryPointer* memoryPointer )
+{
+	/* Deallocate length according to allocation type */
+	switch ( memoryPointer->allocType )
+	{
+		case MEMORY_OBJECT:
+		case MEMORY_1DARRAY:
+		case MEMORY_2DARRAY:
+		case MEMORY_3DARRAY:
+		case MEMORY_4DARRAY:
+		case MEMORY_2DAS1D:
+		case MEMORY_3DAS1D:
+		case MEMORY_4DAS1D:
+			break;
+		case MEMORY_2DCOMPLEX:
+		case MEMORY_3DSETUP:
+			free( memoryPointer->length.xyz.y );
+			break;
+		case MEMORY_3DCOMPLEX:
+			free( memoryPointer->length.xyz.y );
+			free( memoryPointer->length.xyz.z );
+			break;
+	}
+	
+	if ( memoryPointer ){
+		free( memoryPointer );
+	}
+}
+
+void MemoryPointer_Delete_Helper( void *memoryPointer, void *args )
+{
+	assert( memoryPointer );
+	MemoryPointer_Delete( (MemoryPointer*) memoryPointer );
+}
+
+void MemoryPointer_Print( MemoryPointer* memoryPointer, MemoryPointerColumn columns )
+{
+	Index i, j;
+
+	/*
+	 * Bit compare which flags are set in order.
+	 * Print each field accordingly
+	 */
+	
+	if ( columns & MEMORYPOINTER_ALLOCTYPE )
+	{
+		switch ( memoryPointer->allocType )
+		{
+			case MEMORY_OBJECT:
+				Journal_PrintfL( stgMemory->infoStream, 2, "Object,     " );
+				break;
+			case MEMORY_1DARRAY:
+				Journal_PrintfL( stgMemory->infoStream, 2, "1D Array,   " );
+				break;
+			case MEMORY_2DARRAY:
+				Journal_PrintfL( stgMemory->infoStream, 2, "2D Array,   " );
+				break;
+			case MEMORY_3DARRAY:
+				Journal_PrintfL( stgMemory->infoStream, 2, "3D Array,   " );
+				break;						
+			case MEMORY_4DARRAY:
+				Journal_PrintfL( stgMemory->infoStream, 2, "4D Array,   " );
+				break;				
+			case MEMORY_2DAS1D:
+				Journal_PrintfL( stgMemory->infoStream, 2, "2D as 1D,   " );
+				break;
+			case MEMORY_3DAS1D:
+				Journal_PrintfL( stgMemory->infoStream, 2, "3D as 1D,   " );
+				break;					
+			case MEMORY_4DAS1D:
+				Journal_PrintfL( stgMemory->infoStream, 2, "4D as 1D,   " );
+				break;
+			case MEMORY_2DCOMPLEX:
+				Journal_PrintfL( stgMemory->infoStream, 2, "2D Complex, " );
+				break;
+			case MEMORY_3DSETUP:
+				Journal_PrintfL( stgMemory->infoStream, 2, "3D Setup,   " );
+				break;
+			case MEMORY_3DCOMPLEX:
+				Journal_PrintfL( stgMemory->infoStream, 2, "3D Complex, " );
+				break;
+		}
+	}
+	if ( columns & MEMORYPOINTER_PTR )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "(ptr)%p, ", memoryPointer->ptr );
+	}
+	if ( columns & MEMORYPOINTER_TYPE )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "%s, ", memoryPointer->type->value );
+	}
+	if ( columns & MEMORYPOINTER_NAME )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "%s, ", memoryPointer->name->value );
+	}
+	if ( columns & MEMORYPOINTER_FILE )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "%s, ", memoryPointer->file->value );
+	}
+	if ( columns & MEMORYPOINTER_FUNC )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "%s(), ", memoryPointer->func->value );
+	}
+	if ( columns & MEMORYPOINTER_LINE )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "Line:%d, ", memoryPointer->line );
+	}
+	if ( columns & MEMORYPOINTER_TOTALSIZE )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "Total:%d, ", memoryPointer->totalSize );
+	}
+	if ( columns & MEMORYPOINTER_ITEMSIZE )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "ItemSize:%d, ", memoryPointer->itemSize );
+	}
+	if ( columns & MEMORYPOINTER_LENGTH )
+	{
+		Journal_PrintfL( stgMemory->infoStream, 2, "Count: " );
+		switch ( memoryPointer->allocType )
+		{
+			case MEMORY_OBJECT:
+				Journal_PrintfL( stgMemory->infoStream, 2, "N/A" );
+				break;
+			case MEMORY_1DARRAY:
+				Journal_PrintfL( stgMemory->infoStream, 2, "%d", memoryPointer->length );
+				break;
+			case MEMORY_2DARRAY:
+			case MEMORY_2DAS1D:
+				Journal_PrintfL( stgMemory->infoStream, 2, "%d x %d",
+					memoryPointer->length.twoD[0],
+					memoryPointer->length.twoD[1] );
+				break;
+			case MEMORY_3DARRAY:
+			case MEMORY_3DAS1D:
+				Journal_PrintfL( stgMemory->infoStream, 2, "%d x %d x %d",
+					memoryPointer->length.threeD[0],
+					memoryPointer->length.threeD[1],
+					memoryPointer->length.threeD[2] );
+				break;
+			case MEMORY_4DARRAY:
+			case MEMORY_4DAS1D:
+				Journal_PrintfL( stgMemory->infoStream, 2, "%d x %d x %d x %d",
+					memoryPointer->length.fourD[0],
+					memoryPointer->length.fourD[1],
+					memoryPointer->length.fourD[2],
+					memoryPointer->length.fourD[3] );
+				break;				
+			case MEMORY_2DCOMPLEX:
+			case MEMORY_3DSETUP:
+				Journal_PrintfL( stgMemory->infoStream, 3, "%d by { ", memoryPointer->length.xyz.x );
+				for ( i = 0; i < memoryPointer->length.xyz.x; ++i )
+				{
+					Journal_PrintfL( stgMemory->infoStream, 3, "%d", memoryPointer->length.xyz.y[i] );
+					if ( i != memoryPointer->length.xyz.x - 1 )
+					{
+						Journal_PrintfL( stgMemory->infoStream, 3, ", " );
+					}
+				}
+				Journal_PrintfL( stgMemory->infoStream, 3, " }" );
+				break;
+			case MEMORY_3DCOMPLEX:
+				Journal_PrintfL( stgMemory->infoStream, 3, "\n" );
+				for ( i = 0; i < memoryPointer->length.xyz.x; ++i )
+				{
+					Journal_PrintfL( stgMemory->infoStream, 3, "{ " );
+					for ( j = 0; j < memoryPointer->length.xyz.y[i]; ++j )
+					{
+						Journal_PrintfL( stgMemory->infoStream, 3, "%d", memoryPointer->length.xyz.z[i][j] );
+						if ( j != memoryPointer->length.xyz.y[i] - 1 )
+						{
+							Journal_PrintfL( stgMemory->infoStream, 3, ", " );
+						}
+					}
+					Journal_PrintfL( stgMemory->infoStream, 3, " }\n" );
+				}
+				Journal_PrintfL( stgMemory->infoStream, 3, " }" );
+				break;
+		}
+	}
+	Journal_PrintfL( stgMemory->infoStream, 2, "\n" );
+
+}
+
+void MemoryPointer_Print_Type_Name_Func_Helper( void *memoryPointer, void *args )
+{
+	MemoryPointer_Print_Type_Name_Func_Helper_Arg *arguments;
+	MemoryPointer *memPtr;
+	MemoryField* typeField;
+	MemoryField* nameField;
+	
+	
+	assert( memoryPointer );
+	assert( args );
+
+	memPtr = (MemoryPointer*) memoryPointer;
+	arguments = (MemoryPointer_Print_Type_Name_Func_Helper_Arg*) args;
+	
+	typeField = MemoryField_Register( stgMemory->types, arguments->type );
+	nameField = MemoryField_Register( typeField, arguments->name );	
+	
+	if ( memPtr->type == typeField && memPtr->name == nameField ){
+		MemoryPointer_Print ( (MemoryPointer*) memoryPointer, arguments->printOptions );
+	}
+}
+
+void MemoryPointer_Print_File_Func_Helper( void *memoryPointer, void *args )
+{
+	MemoryPointer_Print_File_Func_Helper_Arg *arguments;
+	MemoryPointer *memPtr;
+	MemoryField* fileField;
+	MemoryField* funcField;
+	
+	
+	assert( memoryPointer );
+	assert( args );
+
+	memPtr = (MemoryPointer*) memoryPointer;
+	arguments = (MemoryPointer_Print_File_Func_Helper_Arg*) args;
+	
+	fileField = MemoryField_Register( stgMemory->types, arguments->fileName );
+	funcField = MemoryField_Register( fileField, arguments->funcName );	
+	
+	if ( memPtr->file == fileField && memPtr->func == funcField ){
+		MemoryPointer_Print ( (MemoryPointer*) memoryPointer, arguments->printOptions );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemoryReport.c
--- a/Base/Foundation/src/MemoryReport.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MemoryReport.c 3803 2006-09-27 03:17:12Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "MemoryField.h"
-#include "MemoryPointer.h"
-#include "MemoryReport.h"
-#include "Memory.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stddef.h>
-
-const Type MemoryReport_Type = "MemoryReport";
-
-const int MEMORYREPORT_DELTA = 1;	/**< Number of items to grow by when array resizes. */
-const int MEMORYREPORT_SIZE = 2;	/**< Number of items an array begins with. */
-
-
-/** Returns the index of a given group in an array and -1 if not found. */
-int MemoryReport_Find_Group( int numGroups, MemoryReportGroup* groups, MemoryReportGroup search );
-
-
-MemoryReport* MemoryReport_New( ) {
-	MemoryReport* result = (MemoryReport*) malloc( sizeof(MemoryReport) );
-	
-	_MemoryReport_Init( result );
-	return result;
-}
-	
-
-void _MemoryReport_Init( MemoryReport* memoryReport ) {
-	int ii=0;
-
-	memoryReport->groupCount = 0;
-	memoryReport->groupSize = MEMORYREPORT_SIZE;
-	memoryReport->groups = (MemoryReportGroup*) malloc( sizeof(MemoryReportGroup) * MEMORYREPORT_SIZE );
-	memoryReport->conditionCount = 0;
-	memoryReport->conditionSize = MEMORYREPORT_SIZE;
-	memoryReport->conditionGroups = (MemoryReportGroup*) malloc( sizeof(MemoryReportGroup) * MEMORYREPORT_SIZE );
-	memoryReport->conditionValues = (char**) malloc( sizeof(char*) * MEMORYREPORT_SIZE );
-	for ( ii=0; ii < MEMORYREPORT_SIZE; ii++ ) {
-		memoryReport->conditionValues[ii] = NULL;
-	}
-   
-	memoryReport->memoryManager = stgMemory;   /* Use this as the default, unless user overrides */
-	memoryReport->reportField = MemoryField_New( "Report Query:" );
-}
-	
-
-void MemoryReport_Delete( MemoryReport* memoryReport ) {
-	Index i;
-	
-	MemoryField_Delete( memoryReport->reportField );
-
-	free( memoryReport->groups );
-	free( memoryReport->conditionGroups );
-	
-	for ( i = 0; i < memoryReport->conditionCount; ++i )
-	{
-		if ( memoryReport->conditionValues[i] != NULL )
-		{
-	 		free( memoryReport->conditionValues[i] );
-	 	}
-	}
-	free( memoryReport->conditionValues );
-	free( memoryReport );
-}
-
-
-void MemoryReport_AddGroup( MemoryReport* memoryReport, MemoryReportGroup group )
-{
-	if ( MemoryReport_Find_Group( memoryReport->groupCount, memoryReport->groups, group ) >= 0 ) {
-		return;
-	}
-
-	/* Extend the groups array if needed. */
-	if ( memoryReport->groupCount == memoryReport->groupSize ) {
-		memoryReport->groupSize += MEMORYREPORT_DELTA;
-		memoryReport->groups = (MemoryReportGroup*)
-			realloc( memoryReport->groups, sizeof(MemoryReportGroup) * memoryReport->groupSize );	
-	}
-	
-	memoryReport->groups[memoryReport->groupCount] = group;
-	memoryReport->groupCount++;
-}
-
-void MemoryReport_AddCondition( MemoryReport* memoryReport, MemoryReportGroup group, Name condition )
-{
-	/* Add this group if it does not already exist. */
-	if ( MemoryReport_Find_Group( memoryReport->groupCount, memoryReport->groups, group ) < 0 ) {
-		MemoryReport_AddGroup( memoryReport, group );	
-	}
-	
-	/* Extend the condition arrays if needed. */
-	if ( memoryReport->conditionCount == memoryReport->conditionSize ) {
-		memoryReport->conditionSize += MEMORYREPORT_DELTA;
-		memoryReport->conditionGroups = (MemoryReportGroup*)
-			realloc( memoryReport->conditionGroups, sizeof(MemoryReportGroup) * memoryReport->conditionSize );
-		memoryReport->conditionValues = (char**)
-			realloc( memoryReport->conditionValues, sizeof(char*) * memoryReport->conditionSize );		
-	}
-	
-	memoryReport->conditionGroups[memoryReport->conditionCount] = group;
-	
-	if ( condition ) {
-		char*	ptr = (char*)malloc( (strlen(condition) + 1) * sizeof(char) );
-		strcpy( ptr, condition );
-		memoryReport->conditionValues[memoryReport->conditionCount] = ptr;
-	}
-	else {
-		/* NULL is a condition as well, such as Type_Invalid and Name_Invalid. */
-		memoryReport->conditionValues[memoryReport->conditionCount] = NULL;
-	}
-	
-	memoryReport->conditionCount++;
-}
-
-
-void MemoryReport_SetCustomMemoryManager( void* memoryReport, Memory* memoryManager ) {
-	MemoryReport*  self = (MemoryReport*) memoryReport;
-	
-	self->memoryManager = memoryManager;
-}
-
-
-void MemoryReport_Print( void* memoryReport )
-{
-	MemoryReport*  self = (MemoryReport*) memoryReport;
-
-	if ( self->groupCount == 0 ) {
-		return;
-	}
-	
-
-	/* Algorithm:
-	 * - Iterate through all MemoryPointers recorded.
-	 * - Tuples matching the condition are added to the results.
-	 * - Statistics are derived from tuples.
-	 *
-	 * Reason:
-	 * Allows flexibility to produce any report required. The down side is that the peak bytes used cannot be derived this way.
-	 *
-	 * The alternative is to always record stats for all combinations (useful ones) but that will have a large impact on run
-	 * time as well as memory space.
-	 */
-		
-	/* Derive the statistics, using a BTree parse */
-	BTree_ParseTree( self->memoryManager->pointers, MemoryReport_Print_Helper, self );
-	
-	//prevField = rootField;
-	//while ( prevField->subCount == 1 ) {
-	//	Journal_Printf( stgMemory->infoStream, "%s \n", prevField->value );
-	//	prevField = prevField->subFields[0];
-	//}
-	
-	// TODO: replace reportField->value with a name representative of conditions
-	MemoryField_PrintSummary( self->reportField, "~Report~", (MemoryFieldColumn)(MEMORYFIELD_ALL-MEMORYFIELD_PEAK) );
-}
-
-
-/* Used for a BTree parse to gather statistics */
-void MemoryReport_Print_Helper( void *memoryPointer, void* memoryReport ) {
-	MemoryPointer* memPtr = (MemoryPointer*) memoryPointer;
-	MemoryReport*  memReport = (MemoryReport*)memoryReport;
-	MemoryField*   subField = NULL;
-	Bool           valid;             /* Whether a memory pointer record matches the conditions. */
-	Index          iGroup, iCondition;/* Iterators. */
-	Name    valueStr = NULL;
-
-	assert ( memPtr );
-
-	/* check condition */
-	valid = True;
-	for ( iCondition = 0; iCondition < memReport->conditionCount && valid; ++iCondition ) {
-		valueStr = _MemoryReport_GetValue( memReport, memReport->conditionGroups[iCondition], memPtr );
-		if ( MemoryField_StringCompare( valueStr, memReport->conditionValues[iCondition] ) != 0 ) {
-			valid = False;
-		}
-	}
-		
-	if ( valid ) {
-		/* Add this entry, sorted by the groups of the report. */
-		/* Start at the root field */
-		subField = memReport->reportField;
-		/*  The way MemoryReport is designed, keep adding "sub-fields" of more specialised info. */
-		for ( iGroup = 0; iGroup < memReport->groupCount; ++iGroup ) {
-			valueStr = _MemoryReport_GetValue( memReport, memReport->groups[iGroup], memPtr );
-			subField = MemoryField_Register( subField, valueStr );
-		}
-
-		/* Add statistics for this entry - "subField" will now be most specialised info */
-		subField->allocCount++;
-		if ( memPtr->ptr == NULL ) {
-			subField->freeCount++;
-		}
-		else {
-		       subField->currentAllocation += memPtr->totalSize;
-		}
-		subField->totalAllocation += memPtr->totalSize;
-	}
-}
-
-
-int MemoryReport_Find_Group( int numGroups, MemoryReportGroup* groups, MemoryReportGroup search )
-{
-	int result;
-	
-	for ( result = 0; result < numGroups; ++result )
-	{
-		if ( groups[result] == search )
-		{
-			return result;
-		}
-	}
-	
-	return -1;
-}
-
-
-Name _MemoryReport_GetValue( MemoryReport* memoryReport, MemoryReportGroup reportGroup, MemoryPointer* memPtr ) {
-	Name valueString = NULL;
-
-	switch ( reportGroup ) {
-		case MEMORYREPORT_TYPE:
-			valueString = memPtr->type->value;
-			break;
-		case MEMORYREPORT_NAME:
-			valueString = memPtr->name->value;
-			break;
-		case MEMORYREPORT_FILE:
-			valueString = memPtr->file->value;
-			break;
-		case MEMORYREPORT_FUNC:
-			valueString = memPtr->func->value;
-			break;
-	}
-	return valueString;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/MemoryReport.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/MemoryReport.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,273 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MemoryReport.c 3803 2006-09-27 03:17:12Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "MemoryField.h"
+#include "MemoryPointer.h"
+#include "MemoryReport.h"
+#include "Memory.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stddef.h>
+
+const Type MemoryReport_Type = "MemoryReport";
+
+const int MEMORYREPORT_DELTA = 1;	/**< Number of items to grow by when array resizes. */
+const int MEMORYREPORT_SIZE = 2;	/**< Number of items an array begins with. */
+
+
+/** Returns the index of a given group in an array and -1 if not found. */
+int MemoryReport_Find_Group( int numGroups, MemoryReportGroup* groups, MemoryReportGroup search );
+
+
+MemoryReport* MemoryReport_New( ) {
+	MemoryReport* result = (MemoryReport*) malloc( sizeof(MemoryReport) );
+	
+	_MemoryReport_Init( result );
+	return result;
+}
+	
+
+void _MemoryReport_Init( MemoryReport* memoryReport ) {
+	int ii=0;
+
+	memoryReport->groupCount = 0;
+	memoryReport->groupSize = MEMORYREPORT_SIZE;
+	memoryReport->groups = (MemoryReportGroup*) malloc( sizeof(MemoryReportGroup) * MEMORYREPORT_SIZE );
+	memoryReport->conditionCount = 0;
+	memoryReport->conditionSize = MEMORYREPORT_SIZE;
+	memoryReport->conditionGroups = (MemoryReportGroup*) malloc( sizeof(MemoryReportGroup) * MEMORYREPORT_SIZE );
+	memoryReport->conditionValues = (char**) malloc( sizeof(char*) * MEMORYREPORT_SIZE );
+	for ( ii=0; ii < MEMORYREPORT_SIZE; ii++ ) {
+		memoryReport->conditionValues[ii] = NULL;
+	}
+   
+	memoryReport->memoryManager = stgMemory;   /* Use this as the default, unless user overrides */
+	memoryReport->reportField = MemoryField_New( "Report Query:" );
+}
+	
+
+void MemoryReport_Delete( MemoryReport* memoryReport ) {
+	Index i;
+	
+	MemoryField_Delete( memoryReport->reportField );
+
+	free( memoryReport->groups );
+	free( memoryReport->conditionGroups );
+	
+	for ( i = 0; i < memoryReport->conditionCount; ++i )
+	{
+		if ( memoryReport->conditionValues[i] != NULL )
+		{
+	 		free( memoryReport->conditionValues[i] );
+	 	}
+	}
+	free( memoryReport->conditionValues );
+	free( memoryReport );
+}
+
+
+void MemoryReport_AddGroup( MemoryReport* memoryReport, MemoryReportGroup group )
+{
+	if ( MemoryReport_Find_Group( memoryReport->groupCount, memoryReport->groups, group ) >= 0 ) {
+		return;
+	}
+
+	/* Extend the groups array if needed. */
+	if ( memoryReport->groupCount == memoryReport->groupSize ) {
+		memoryReport->groupSize += MEMORYREPORT_DELTA;
+		memoryReport->groups = (MemoryReportGroup*)
+			realloc( memoryReport->groups, sizeof(MemoryReportGroup) * memoryReport->groupSize );	
+	}
+	
+	memoryReport->groups[memoryReport->groupCount] = group;
+	memoryReport->groupCount++;
+}
+
+void MemoryReport_AddCondition( MemoryReport* memoryReport, MemoryReportGroup group, Name condition )
+{
+	/* Add this group if it does not already exist. */
+	if ( MemoryReport_Find_Group( memoryReport->groupCount, memoryReport->groups, group ) < 0 ) {
+		MemoryReport_AddGroup( memoryReport, group );	
+	}
+	
+	/* Extend the condition arrays if needed. */
+	if ( memoryReport->conditionCount == memoryReport->conditionSize ) {
+		memoryReport->conditionSize += MEMORYREPORT_DELTA;
+		memoryReport->conditionGroups = (MemoryReportGroup*)
+			realloc( memoryReport->conditionGroups, sizeof(MemoryReportGroup) * memoryReport->conditionSize );
+		memoryReport->conditionValues = (char**)
+			realloc( memoryReport->conditionValues, sizeof(char*) * memoryReport->conditionSize );		
+	}
+	
+	memoryReport->conditionGroups[memoryReport->conditionCount] = group;
+	
+	if ( condition ) {
+		char*	ptr = (char*)malloc( (strlen(condition) + 1) * sizeof(char) );
+		strcpy( ptr, condition );
+		memoryReport->conditionValues[memoryReport->conditionCount] = ptr;
+	}
+	else {
+		/* NULL is a condition as well, such as Type_Invalid and Name_Invalid. */
+		memoryReport->conditionValues[memoryReport->conditionCount] = NULL;
+	}
+	
+	memoryReport->conditionCount++;
+}
+
+
+void MemoryReport_SetCustomMemoryManager( void* memoryReport, Memory* memoryManager ) {
+	MemoryReport*  self = (MemoryReport*) memoryReport;
+	
+	self->memoryManager = memoryManager;
+}
+
+
+void MemoryReport_Print( void* memoryReport )
+{
+	MemoryReport*  self = (MemoryReport*) memoryReport;
+
+	if ( self->groupCount == 0 ) {
+		return;
+	}
+	
+
+	/* Algorithm:
+	 * - Iterate through all MemoryPointers recorded.
+	 * - Tuples matching the condition are added to the results.
+	 * - Statistics are derived from tuples.
+	 *
+	 * Reason:
+	 * Allows flexibility to produce any report required. The down side is that the peak bytes used cannot be derived this way.
+	 *
+	 * The alternative is to always record stats for all combinations (useful ones) but that will have a large impact on run
+	 * time as well as memory space.
+	 */
+		
+	/* Derive the statistics, using a BTree parse */
+	BTree_ParseTree( self->memoryManager->pointers, MemoryReport_Print_Helper, self );
+	
+	//prevField = rootField;
+	//while ( prevField->subCount == 1 ) {
+	//	Journal_Printf( stgMemory->infoStream, "%s \n", prevField->value );
+	//	prevField = prevField->subFields[0];
+	//}
+	
+	// TODO: replace reportField->value with a name representative of conditions
+	MemoryField_PrintSummary( self->reportField, "~Report~", (MemoryFieldColumn)(MEMORYFIELD_ALL-MEMORYFIELD_PEAK) );
+}
+
+
+/* Used for a BTree parse to gather statistics */
+void MemoryReport_Print_Helper( void *memoryPointer, void* memoryReport ) {
+	MemoryPointer* memPtr = (MemoryPointer*) memoryPointer;
+	MemoryReport*  memReport = (MemoryReport*)memoryReport;
+	MemoryField*   subField = NULL;
+	Bool           valid;             /* Whether a memory pointer record matches the conditions. */
+	Index          iGroup, iCondition;/* Iterators. */
+	Name    valueStr = NULL;
+
+	assert ( memPtr );
+
+	/* check condition */
+	valid = True;
+	for ( iCondition = 0; iCondition < memReport->conditionCount && valid; ++iCondition ) {
+		valueStr = _MemoryReport_GetValue( memReport, memReport->conditionGroups[iCondition], memPtr );
+		if ( MemoryField_StringCompare( valueStr, memReport->conditionValues[iCondition] ) != 0 ) {
+			valid = False;
+		}
+	}
+		
+	if ( valid ) {
+		/* Add this entry, sorted by the groups of the report. */
+		/* Start at the root field */
+		subField = memReport->reportField;
+		/*  The way MemoryReport is designed, keep adding "sub-fields" of more specialised info. */
+		for ( iGroup = 0; iGroup < memReport->groupCount; ++iGroup ) {
+			valueStr = _MemoryReport_GetValue( memReport, memReport->groups[iGroup], memPtr );
+			subField = MemoryField_Register( subField, valueStr );
+		}
+
+		/* Add statistics for this entry - "subField" will now be most specialised info */
+		subField->allocCount++;
+		if ( memPtr->ptr == NULL ) {
+			subField->freeCount++;
+		}
+		else {
+		       subField->currentAllocation += memPtr->totalSize;
+		}
+		subField->totalAllocation += memPtr->totalSize;
+	}
+}
+
+
+int MemoryReport_Find_Group( int numGroups, MemoryReportGroup* groups, MemoryReportGroup search )
+{
+	int result;
+	
+	for ( result = 0; result < numGroups; ++result )
+	{
+		if ( groups[result] == search )
+		{
+			return result;
+		}
+	}
+	
+	return -1;
+}
+
+
+Name _MemoryReport_GetValue( MemoryReport* memoryReport, MemoryReportGroup reportGroup, MemoryPointer* memPtr ) {
+	Name valueString = NULL;
+
+	switch ( reportGroup ) {
+		case MEMORYREPORT_TYPE:
+			valueString = memPtr->type->value;
+			break;
+		case MEMORYREPORT_NAME:
+			valueString = memPtr->name->value;
+			break;
+		case MEMORYREPORT_FILE:
+			valueString = memPtr->file->value;
+			break;
+		case MEMORYREPORT_FUNC:
+			valueString = memPtr->func->value;
+			break;
+	}
+	return valueString;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/NamedObject_Register.c
--- a/Base/Foundation/src/NamedObject_Register.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: NamedObject_Register.c 2428 2004-12-16 03:33:16Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "Memory.h"
-#include "Class.h"
-#include "Object.h"
-#include "ObjectAdaptor.h"
-#include "ObjectList.h"
-#include "NamedObject_Register.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* Stg_Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-const Type NamedObject_Register_Type = "NamedObject_Register";
-
-NamedObject_Register*	NamedObject_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(NamedObject_Register);
-	Type                              type = NamedObject_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
-
-	return _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
-}
-
-NamedObject_Register*	_NamedObject_Register_New(  NAMEDOBJECT_REGISTER_DEFARGS  ) 
-{
-	NamedObject_Register*	self;
-	
-	/* Allocate memory/General info */
-	assert(_sizeOfSelf >= sizeof(NamedObject_Register));
-	self = (NamedObject_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* Virtual info */
-	
-	/* Stg_Class info */
-	_NamedObject_Register_Init( self );	
-
-	return self;
-}
-	
-void _NamedObject_Register_Init( NamedObject_Register* self ) {
-	self->objects = Stg_ObjectList_New();
-}
-
-void _NamedObject_Register_Delete( void* namedObjectRegister ) {
-	NamedObject_Register* self = (NamedObject_Register*)namedObjectRegister;
-	
-	Journal_DPrintf( Journal_Register( Debug_Type, NamedObject_Register_Type ), "In: %s()\n", __func__ );
-	
-	Stg_Class_Delete( self->objects ); 
-
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-	
-void NamedObject_Register_DeleteAll( void* reg ) {
-   /* Deletes all elements from register and then
-      deletes the register */
-   NamedObject_Register* self = (NamedObject_Register*)reg;
-
-   Stg_ObjectList_DeleteAllObjects( self->objects );
-
-   /* Stg_Class_Delete parent */
-   Stg_Class_Delete( self );
-}
-void _NamedObject_Register_Print( void* namedObjectRegister, struct Stream* stream ) {
-	NamedObject_Register*	self = (NamedObject_Register*)namedObjectRegister;
-
-	/* General info */
-	Journal_Printf( stream, "NamedObject_Register (ptr): %p\n", self);
-	Stream_Indent( stream );
-	
-	/* Use parent print */
-	_Stg_Class_Print( self, stream );
-	
-	/* Print the list of registered objects */
-	Stg_Class_Print( self->objects, stream );	
-	
-	Stream_UnIndent( stream );
-}
-
-
-void* _NamedObject_Register_Copy( const void* namedObjectRegister, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	NamedObject_Register*	self = (NamedObject_Register*)namedObjectRegister;
-	NamedObject_Register*	newNamedObjectRegister;
-	
-	newNamedObjectRegister = (NamedObject_Register*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	Journal_Firewall( 
-		deep, 
-		Journal_Register( Error_Type, NamedObject_Register_Type ), 
-		"Shallow copy not yet implemented\n" );
-	if( deep ) {
-          newNamedObjectRegister->objects = (Stg_ObjectList*)Stg_Class_Copy( self->objects, NULL, deep, nameExt, ptrMap );
-	}
-	
-	return newNamedObjectRegister;
-}
-
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/NamedObject_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/NamedObject_Register.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,143 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: NamedObject_Register.c 2428 2004-12-16 03:33:16Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "Memory.h"
+#include "Class.h"
+#include "Object.h"
+#include "ObjectAdaptor.h"
+#include "ObjectList.h"
+#include "NamedObject_Register.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Stg_Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+const Type NamedObject_Register_Type = "NamedObject_Register";
+
+NamedObject_Register*	NamedObject_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(NamedObject_Register);
+	Type                              type = NamedObject_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
+
+	return _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
+}
+
+NamedObject_Register*	_NamedObject_Register_New(  NAMEDOBJECT_REGISTER_DEFARGS  ) 
+{
+	NamedObject_Register*	self;
+	
+	/* Allocate memory/General info */
+	assert(_sizeOfSelf >= sizeof(NamedObject_Register));
+	self = (NamedObject_Register*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	_NamedObject_Register_Init( self );	
+
+	return self;
+}
+	
+void _NamedObject_Register_Init( NamedObject_Register* self ) {
+	self->objects = Stg_ObjectList_New();
+}
+
+void _NamedObject_Register_Delete( void* namedObjectRegister ) {
+	NamedObject_Register* self = (NamedObject_Register*)namedObjectRegister;
+	
+	Journal_DPrintf( Journal_Register( Debug_Type, NamedObject_Register_Type ), "In: %s()\n", __func__ );
+	
+	Stg_Class_Delete( self->objects ); 
+
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+	
+void NamedObject_Register_DeleteAll( void* reg ) {
+   /* Deletes all elements from register and then
+      deletes the register */
+   NamedObject_Register* self = (NamedObject_Register*)reg;
+
+   Stg_ObjectList_DeleteAllObjects( self->objects );
+
+   /* Stg_Class_Delete parent */
+   Stg_Class_Delete( self );
+}
+void _NamedObject_Register_Print( void* namedObjectRegister, struct Stream* stream ) {
+	NamedObject_Register*	self = (NamedObject_Register*)namedObjectRegister;
+
+	/* General info */
+	Journal_Printf( stream, "NamedObject_Register (ptr): %p\n", self);
+	Stream_Indent( stream );
+	
+	/* Use parent print */
+	_Stg_Class_Print( self, stream );
+	
+	/* Print the list of registered objects */
+	Stg_Class_Print( self->objects, stream );	
+	
+	Stream_UnIndent( stream );
+}
+
+
+void* _NamedObject_Register_Copy( const void* namedObjectRegister, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	NamedObject_Register*	self = (NamedObject_Register*)namedObjectRegister;
+	NamedObject_Register*	newNamedObjectRegister;
+	
+	newNamedObjectRegister = (NamedObject_Register*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	Journal_Firewall( 
+		deep, 
+		Journal_Register( Error_Type, NamedObject_Register_Type ), 
+		"Shallow copy not yet implemented\n" );
+	if( deep ) {
+          newNamedObjectRegister->objects = (Stg_ObjectList*)Stg_Class_Copy( self->objects, NULL, deep, nameExt, ptrMap );
+	}
+	
+	return newNamedObjectRegister;
+}
+
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/NewClass.c
--- a/Base/Foundation/src/NewClass.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include "types.h"
-#include "forwardDecl.h"
-#include "MemoryTag.h"
-#include "Memory.h"
-#include "Class.h"
-#include "NewClass.h"
-#include "ClassDef.h"
-
-
-void _NewClass_Init( void* _self ) {
-   NewClass* self = Class_Cast( _self, NewClass );
-
-   ((NewClass*)self)->nRefsToSelf = 0;
-   ((NewClass*)self)->curAllocd = 0;
-}
-
-void _NewClass_Destruct( void* _self ) {
-   NewClass* self = Class_Cast( _self, NewClass );
-
-#ifndef NDEBUG
-   if( ((NewClass*)self)->curAllocd != 0 ) {
-      fprintf( stderr, "\nWhile destructing a class memory has been leaked.\n" "Class type: %s\n" "Memory leaked: %ld\n", self->type, self->curAllocd );
-   }
-#endif
-}
-
-void _NewClass_Copy( void* self, const void* op ) {
-   assert( self );
-   assert( op );
-}
-
-void _NewClass_Print( const void* self, Stream* stream ) {
-}
-
-SizeT _NewClass_CalcMem( const void* _self, struct PtrMap* ptrs ) {
-   const NewClass* self = Class_ConstCast( _self, NewClass );
-   assert( ptrs );
-
-   if( PtrMap_Find( ptrs, (void*)self ) )
-      return 0;
-   PtrMap_Append( ptrs, (void*)self, (void*)self );
-   return self->curAllocd;
-}
-
-void NewClass_Delete( void* self ) {
-   if( !self ) return;
-   NewClass_Destruct( self );
-   MemFree( self );
-}
-
-void NewClass_AddRef( void* _self ) {
-   NewClass* self;
-
-   if( !_self ) return;
-   self = Class_Cast( _self, NewClass );
-   assert( self->nRefsToSelf >= 0 );
-   self->nRefsToSelf++;
-}
-
-void NewClass_RemoveRef( void* _self ) {
-   NewClass* self;
-
-   if( !_self ) return;
-   self = Class_Cast( _self, NewClass );
-#ifndef NDEBUG
-   if( self->nRefsToSelf == 0 ) {
-      fprintf( stderr, "\nRemoving a reference from a class with no pre-existing\n"
-	       "references.\n"
-	       "Class type: %s\n", 
-	       self->type );
-      abort();
-   }
-#endif
-   if( !(--self->nRefsToSelf) )
-      NewClass_Delete( self );
-}
-
-void* NewClass_Dup( const void* _self ) {
-   const NewClass* self = Class_ConstCast( _self, NewClass );
-   void* dup;
-
-   dup = self->newFunc();
-   NewClass_Copy( dup, self );
-   return dup;
-}
-
-Type NewClass_GetType( const void* _self ) {
-   const NewClass* self = Class_ConstCast( _self, NewClass );
-   return self->type;
-}
-
-SizeT NewClass_GetMemUsage( const void* _self ) {
-   const NewClass* self = Class_ConstCast( _self, NewClass );
-   struct PtrMap* ptrs;
-   SizeT mem;
-
-   ptrs = PtrMap_New( 10 );
-   mem = NewClass_CalcMem( self, ptrs );
-   Stg_Class_Delete( ptrs );
-   return mem;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/NewClass.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/NewClass.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,138 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include "types.h"
+#include "forwardDecl.h"
+#include "MemoryTag.h"
+#include "Memory.h"
+#include "Class.h"
+#include "NewClass.h"
+#include "ClassDef.h"
+
+
+void _NewClass_Init( void* _self ) {
+   NewClass* self = Class_Cast( _self, NewClass );
+
+   ((NewClass*)self)->nRefsToSelf = 0;
+   ((NewClass*)self)->curAllocd = 0;
+}
+
+void _NewClass_Destruct( void* _self ) {
+   NewClass* self = Class_Cast( _self, NewClass );
+
+#ifndef NDEBUG
+   if( ((NewClass*)self)->curAllocd != 0 ) {
+      fprintf( stderr, "\nWhile destructing a class memory has been leaked.\n" "Class type: %s\n" "Memory leaked: %ld\n", self->type, self->curAllocd );
+   }
+#endif
+}
+
+void _NewClass_Copy( void* self, const void* op ) {
+   assert( self );
+   assert( op );
+}
+
+void _NewClass_Print( const void* self, Stream* stream ) {
+}
+
+SizeT _NewClass_CalcMem( const void* _self, struct PtrMap* ptrs ) {
+   const NewClass* self = Class_ConstCast( _self, NewClass );
+   assert( ptrs );
+
+   if( PtrMap_Find( ptrs, (void*)self ) )
+      return 0;
+   PtrMap_Append( ptrs, (void*)self, (void*)self );
+   return self->curAllocd;
+}
+
+void NewClass_Delete( void* self ) {
+   if( !self ) return;
+   NewClass_Destruct( self );
+   MemFree( self );
+}
+
+void NewClass_AddRef( void* _self ) {
+   NewClass* self;
+
+   if( !_self ) return;
+   self = Class_Cast( _self, NewClass );
+   assert( self->nRefsToSelf >= 0 );
+   self->nRefsToSelf++;
+}
+
+void NewClass_RemoveRef( void* _self ) {
+   NewClass* self;
+
+   if( !_self ) return;
+   self = Class_Cast( _self, NewClass );
+#ifndef NDEBUG
+   if( self->nRefsToSelf == 0 ) {
+      fprintf( stderr, "\nRemoving a reference from a class with no pre-existing\n"
+	       "references.\n"
+	       "Class type: %s\n", 
+	       self->type );
+      abort();
+   }
+#endif
+   if( !(--self->nRefsToSelf) )
+      NewClass_Delete( self );
+}
+
+void* NewClass_Dup( const void* _self ) {
+   const NewClass* self = Class_ConstCast( _self, NewClass );
+   void* dup;
+
+   dup = self->newFunc();
+   NewClass_Copy( dup, self );
+   return dup;
+}
+
+Type NewClass_GetType( const void* _self ) {
+   const NewClass* self = Class_ConstCast( _self, NewClass );
+   return self->type;
+}
+
+SizeT NewClass_GetMemUsage( const void* _self ) {
+   const NewClass* self = Class_ConstCast( _self, NewClass );
+   struct PtrMap* ptrs;
+   SizeT mem;
+
+   ptrs = PtrMap_New( 10 );
+   mem = NewClass_CalcMem( self, ptrs );
+   Stg_Class_Delete( ptrs );
+   return mem;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/NewObject.c
--- a/Base/Foundation/src/NewObject.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
-** 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: NewObject.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <string.h>
-#include "types.h"
-#include "debug.h"
-#include "MemoryTag.h"
-#include "Memory.h"
-#include "NewClass.h"
-#include "NewObject.h"
-#include "StGermain/Base/Foundation/ClassDef.h"
-
-
-void _NewObject_Init( void* _self ) {
-   NewObject* self = (NewObject*)_self;
-
-   _NewClass_Init( self );
-   self->name = NULL;
-}
-
-void _NewObject_Destruct( void* _self ) {
-   NewObject* self = (NewObject*)_self;
-   assert( self );
-
-   Class_Free( self, self->name );
-   _NewClass_Destruct( self );
-}
-
-void _NewObject_Copy( void* self, const void* op ) {
-   _NewClass_Copy( self, op );
-   NewObject_SetName( self, ((NewObject*)op)->name );
-}
-
-void NewObject_SetName( void* _self, Name name ) {
-   NewObject* self = (NewObject*)_self;
-   int len;
-   assert( self );
-
-   len = name ? strlen( name ) + 1 : 0;
-   self->name = Class_Rearray( self, self->name, char, len );
-   if( name )
-      strcpy( self->name, name );
-}
-
-Name NewObject_GetName( void* self ) {
-   assert( self );
-
-   return ((NewObject*)self)->name;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/NewObject.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/NewObject.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,81 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 
+** 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: NewObject.c 3952 2007-01-09 06:24:06Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <string.h>
+#include "types.h"
+#include "debug.h"
+#include "MemoryTag.h"
+#include "Memory.h"
+#include "NewClass.h"
+#include "NewObject.h"
+#include "StGermain/Base/Foundation/ClassDef.h"
+
+
+void _NewObject_Init( void* _self ) {
+   NewObject* self = (NewObject*)_self;
+
+   _NewClass_Init( self );
+   self->name = NULL;
+}
+
+void _NewObject_Destruct( void* _self ) {
+   NewObject* self = (NewObject*)_self;
+   assert( self );
+
+   Class_Free( self, self->name );
+   _NewClass_Destruct( self );
+}
+
+void _NewObject_Copy( void* self, const void* op ) {
+   _NewClass_Copy( self, op );
+   NewObject_SetName( self, ((NewObject*)op)->name );
+}
+
+void NewObject_SetName( void* _self, Name name ) {
+   NewObject* self = (NewObject*)_self;
+   int len;
+   assert( self );
+
+   len = name ? strlen( name ) + 1 : 0;
+   self->name = Class_Rearray( self, self->name, char, len );
+   if( name )
+      strcpy( self->name, name );
+}
+
+Name NewObject_GetName( void* self ) {
+   assert( self );
+
+   return ((NewObject*)self)->name;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Numerics.c
--- a/Base/Foundation/src/Numerics.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Numerics.c 3584 2006-05-16 11:11:07Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include "types.h"
-#include "Numerics.h"
-
-
-const double	Num_Epsilon = 1e-12;
-
-
-Bool Num_Approx( double var, double val ) {
-  return (var >= val - Num_Epsilon && var <= val + Num_Epsilon) ? True : False;
-}
-
-Bool Num_InRange( double var, double low, double upp ) {
-  return (var >= low - Num_Epsilon && var <= upp + Num_Epsilon) ? True : False;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Numerics.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Numerics.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,49 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Numerics.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <assert.h>
+
+#include "types.h"
+#include "Numerics.h"
+
+
+const double	Num_Epsilon = 1e-12;
+
+
+Bool Num_Approx( double var, double val ) {
+  return (var >= val - Num_Epsilon && var <= val + Num_Epsilon) ? True : False;
+}
+
+Bool Num_InRange( double var, double low, double upp ) {
+  return (var >= low - Num_Epsilon && var <= upp + Num_Epsilon) ? True : False;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Object.c
--- a/Base/Foundation/src/Object.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Object.c 4253 2008-04-17 01:50:25Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "Memory.h"
-#include "Class.h"
-#include "Object.h"
-#include "CommonRoutines.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-const Type Stg_Object_Type = "Stg_Object";
-
-Index _Stg_Object_Counter = 0;
-static const char _Stg_Object_Unnamed[] = "Unnamed";
-
-Stg_Object* _Stg_Object_New(  STG_OBJECT_DEFARGS  )
-{
-	Stg_Object* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stg_Object) );
-	self = (Stg_Object*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	
-	/* Stg_Object info */
-	_Stg_Object_Init( self, name, nameAllocationType );
-	
-	return self;
-}
-
-
-void _Stg_Object_Init( Stg_Object* self, Name name, AllocationType nameAllocationType ) {
-	/* General and Virtual info should already be set */
-	
-	/* Stg_Object info */
-	if( !name || strlen( name ) == 0 ) {
-          char *tmp_name;
-          Stg_asprintf(&tmp_name,"%s-%u",_Stg_Object_Unnamed,_Stg_Object_Counter);
-          self->name=tmp_name;
-          _Stg_Object_Counter += 1;
-	}
-	else if ( GLOBAL == nameAllocationType ) {
-          /* This is a bit unsafe */
-          self->name = (char*)name;
-	}
-	else {
-		self->name = StG_Strdup( name );
-	}
-
-	self->nameAllocationType = nameAllocationType;	
-}
-
-
-void _Stg_Object_Delete( void* object ) {
-	Stg_Object* self = (Stg_Object*)object;
-	
-	if ( GLOBAL != self->nameAllocationType )
-          Memory_Free( self->name );
-
-	/* Delete parent class */
-	_Stg_Class_Delete( self );
-}
-
-
-void _Stg_Object_Print( void* object, struct Stream* stream) {
-	Stg_Object* self = (Stg_Object*)object;
-	
-	/* General info */
-	Journal_Printf( stream, "Stg_Object (ptr): %p\n", (void*)self );
-	Stream_Indent( stream );
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-	
-	/* Virtual info */
-	
-	/* Stg_Object */
-	Journal_Printf( stream, "name: %s\n", self->name );
-	Journal_Printf( stream, "nameAllocationType: %s\n", self->nameAllocationType == GLOBAL ? "GLOBAL" : "NON_GLOBAL" );
-	
-	Stream_UnIndent( stream );
-}
-
-void* _Stg_Object_Copy( const void* object, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_Object*	self = (Stg_Object*)object;
-	Stg_Object*	newObject;
-	
-	newObject = (Stg_Object*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	/* TODO: if we are not deep copying we should not copy the name, just the pointer.  There
-	 * is a problem with this; will try to fix it later. */
-	
-	if( nameExt ) {
-		unsigned	nameLen = strlen( self->name );
-                char *tmp_name;
-                tmp_name=
-                  Memory_Alloc_Array_Unnamed(char,nameLen+strlen(nameExt)+1);
-		memcpy( tmp_name, self->name, nameLen );
-		strcpy( tmp_name + nameLen, nameExt );
-                newObject->name=tmp_name;
-	}
-	else {
-		newObject->name = StG_Strdup( self->name );
-	}
-	
-	newObject->nameAllocationType = NON_GLOBAL;
-	
-	return newObject;
-}
-
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-void Stg_Object_SetName( void* object, Name name )
-{
-	Stg_Object* self = (Stg_Object*)object;
-	
-	if ( GLOBAL == self->nameAllocationType )
-	{
-          self->name = (char*)name;
-	}
-	else
-	{
-          Memory_Free( self->name );
-          self->name = StG_Strdup( name );
-	}
-}
-
-
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-Name _Stg_Object_GetNameFunc( void* object ) {
-	Stg_Object* self = (Stg_Object*)object;
-	
-	return _Stg_Object_GetNameMacro( self );
-}
-
-char * Stg_Object_AppendSuffix( void* object, Name suffix ) {
-	Stg_Object* self = (Stg_Object*)object;
-	char *name;
-
-	Stg_asprintf( &name, "%s-%s", _Stg_Object_GetNameMacro( self ), suffix );
-
-	return name;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/Object.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/Object.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,189 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Object.c 4253 2008-04-17 01:50:25Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "Memory.h"
+#include "Class.h"
+#include "Object.h"
+#include "CommonRoutines.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+const Type Stg_Object_Type = "Stg_Object";
+
+Index _Stg_Object_Counter = 0;
+static const char _Stg_Object_Unnamed[] = "Unnamed";
+
+Stg_Object* _Stg_Object_New(  STG_OBJECT_DEFARGS  )
+{
+	Stg_Object* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stg_Object) );
+	self = (Stg_Object*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	
+	/* Stg_Object info */
+	_Stg_Object_Init( self, name, nameAllocationType );
+	
+	return self;
+}
+
+
+void _Stg_Object_Init( Stg_Object* self, Name name, AllocationType nameAllocationType ) {
+	/* General and Virtual info should already be set */
+	
+	/* Stg_Object info */
+	if( !name || strlen( name ) == 0 ) {
+          char *tmp_name;
+          Stg_asprintf(&tmp_name,"%s-%u",_Stg_Object_Unnamed,_Stg_Object_Counter);
+          self->name=tmp_name;
+          _Stg_Object_Counter += 1;
+	}
+	else if ( GLOBAL == nameAllocationType ) {
+          /* This is a bit unsafe */
+          self->name = (char*)name;
+	}
+	else {
+		self->name = StG_Strdup( name );
+	}
+
+	self->nameAllocationType = nameAllocationType;	
+}
+
+
+void _Stg_Object_Delete( void* object ) {
+	Stg_Object* self = (Stg_Object*)object;
+	
+	if ( GLOBAL != self->nameAllocationType )
+          Memory_Free( self->name );
+
+	/* Delete parent class */
+	_Stg_Class_Delete( self );
+}
+
+
+void _Stg_Object_Print( void* object, struct Stream* stream) {
+	Stg_Object* self = (Stg_Object*)object;
+	
+	/* General info */
+	Journal_Printf( stream, "Stg_Object (ptr): %p\n", (void*)self );
+	Stream_Indent( stream );
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+	
+	/* Virtual info */
+	
+	/* Stg_Object */
+	Journal_Printf( stream, "name: %s\n", self->name );
+	Journal_Printf( stream, "nameAllocationType: %s\n", self->nameAllocationType == GLOBAL ? "GLOBAL" : "NON_GLOBAL" );
+	
+	Stream_UnIndent( stream );
+}
+
+void* _Stg_Object_Copy( const void* object, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_Object*	self = (Stg_Object*)object;
+	Stg_Object*	newObject;
+	
+	newObject = (Stg_Object*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	/* TODO: if we are not deep copying we should not copy the name, just the pointer.  There
+	 * is a problem with this; will try to fix it later. */
+	
+	if( nameExt ) {
+		unsigned	nameLen = strlen( self->name );
+                char *tmp_name;
+                tmp_name=
+                  Memory_Alloc_Array_Unnamed(char,nameLen+strlen(nameExt)+1);
+		memcpy( tmp_name, self->name, nameLen );
+		strcpy( tmp_name + nameLen, nameExt );
+                newObject->name=tmp_name;
+	}
+	else {
+		newObject->name = StG_Strdup( self->name );
+	}
+	
+	newObject->nameAllocationType = NON_GLOBAL;
+	
+	return newObject;
+}
+
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+void Stg_Object_SetName( void* object, Name name )
+{
+	Stg_Object* self = (Stg_Object*)object;
+	
+	if ( GLOBAL == self->nameAllocationType )
+	{
+          self->name = (char*)name;
+	}
+	else
+	{
+          Memory_Free( self->name );
+          self->name = StG_Strdup( name );
+	}
+}
+
+
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+Name _Stg_Object_GetNameFunc( void* object ) {
+	Stg_Object* self = (Stg_Object*)object;
+	
+	return _Stg_Object_GetNameMacro( self );
+}
+
+char * Stg_Object_AppendSuffix( void* object, Name suffix ) {
+	Stg_Object* self = (Stg_Object*)object;
+	char *name;
+
+	Stg_asprintf( &name, "%s-%s", _Stg_Object_GetNameMacro( self ), suffix );
+
+	return name;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/ObjectAdaptor.c
--- a/Base/Foundation/src/ObjectAdaptor.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ObjectAdaptor.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "Memory.h"
-#include "Class.h"
-#include "Object.h"
-#include "ObjectAdaptor.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-
-/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-const Type Stg_ObjectAdaptor_Type = "Stg_ObjectAdaptor";
-
-
-Stg_ObjectAdaptor* Stg_ObjectAdaptor_NewOfClass( void* dataPtr, Name name, Bool iOwn, Bool isGlobal ) {
-	/* Variables set in this function */
-	SizeT                                     _sizeOfSelf = sizeof(Stg_ObjectAdaptor);
-	Type                                             type = Stg_ObjectAdaptor_Type;
-	Stg_Class_DeleteFunction*                     _delete = _Stg_ObjectAdaptor_Delete;
-	Stg_Class_PrintFunction*                       _print = _Stg_ObjectAdaptor_Print;
-	Stg_Class_CopyFunction*                         _copy = _Stg_ObjectAdaptor_Copy;
-	Bool                                       isStgClass = True;
-	Stg_ObjectAdaptor_DeletePointerFunction*    ptrDelete = NULL;
-	Stg_ObjectAdaptor_PrintPointerFunction*      ptrPrint = NULL;
-	Stg_ObjectAdaptor_CopyPointerFunction*        ptrCopy = NULL;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Stg_ObjectAdaptor_New(  STG_OBJECTADAPTOR_PASSARGS  ); 
-}
-
-
-void Stg_ObjectAdaptor_InitOfClass( Stg_ObjectAdaptor* self, void* dataPtr, Name name, Bool iOwn, Bool isGlobal ) {
-	/* General info */
-	self->type = Stg_ObjectAdaptor_Type;
-	self->_sizeOfSelf = sizeof(Stg_ObjectAdaptor);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _Stg_ObjectAdaptor_Delete;
-	self->_print = _Stg_ObjectAdaptor_Print;
-	self->_copy = _Stg_ObjectAdaptor_Copy;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-
-	/* Stg_ObjectAdaptor info */
-	_Stg_ObjectAdaptor_Init( self, dataPtr, iOwn, isGlobal, True, NULL, NULL, NULL );
-}
-
-
-Stg_ObjectAdaptor* Stg_ObjectAdaptor_NewOfPointer(
-		void*						dataPtr, 
-		Name						name, 
-		Bool						iOwn,
-		Bool						isGlobal,
-		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(Stg_ObjectAdaptor);
-	Type                              type = Stg_ObjectAdaptor_Type;
-	Stg_Class_DeleteFunction*      _delete = _Stg_ObjectAdaptor_Delete;
-	Stg_Class_PrintFunction*        _print = _Stg_ObjectAdaptor_Print;
-	Stg_Class_CopyFunction*          _copy = _Stg_ObjectAdaptor_Copy;
-	Bool                        isStgClass = False;
-
-	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Stg_ObjectAdaptor_New(  STG_OBJECTADAPTOR_PASSARGS  ); 
-}
-
-
-void Stg_ObjectAdaptor_InitOfPointer( 
-		Stg_ObjectAdaptor* 				self, 
-		void*						dataPtr, 
-		Name						name, 
-		Bool						iOwn,
-		Bool						isGlobal,
-		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	/* General info */
-	self->type = Stg_ObjectAdaptor_Type;
-	self->_sizeOfSelf = sizeof(Stg_ObjectAdaptor);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _Stg_ObjectAdaptor_Delete;
-	self->_print = _Stg_ObjectAdaptor_Print;
-	self->_copy = _Stg_ObjectAdaptor_Copy;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_Object_Init( (Stg_Object*)self, name, GLOBAL );
-
-	/* Stg_ObjectAdaptor info */
-	_Stg_ObjectAdaptor_Init( self, dataPtr, iOwn, isGlobal, False, ptrDelete, ptrPrint, ptrCopy );
-}
-
-
-Stg_ObjectAdaptor* _Stg_ObjectAdaptor_New(  STG_OBJECTADAPTOR_DEFARGS  )
-{
-	Stg_ObjectAdaptor* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stg_ObjectAdaptor) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = GLOBAL;
-
-	self = (Stg_ObjectAdaptor*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	
-	/* Stg_ObjectAdaptor info */
-	_Stg_ObjectAdaptor_Init( self, dataPtr, iOwn, isGlobal, isStgClass, ptrDelete, ptrPrint, ptrCopy );
-	
-	return self;
-}
-
-
-void _Stg_ObjectAdaptor_Init(
-		Stg_ObjectAdaptor*				self, 
-		void*						dataPtr, 
-		Bool						iOwn, 
-		Bool						isGlobal, 
-		Bool						isStgClass,
-		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	self->dataPtr = dataPtr;
-	self->iOwn = iOwn;
-	self->isGlobal = isGlobal;
-	self->isStgClass = isStgClass;
-	if( isStgClass ) {
-		self->ptrDelete = NULL;
-		self->ptrPrint = NULL;
-		self->ptrCopy = NULL;
-	}
-	else {
-		self->ptrDelete = ptrDelete;
-		self->ptrPrint = ptrPrint;
-		self->ptrCopy = ptrCopy;
-	}
-	
-	Journal_Firewall( 
-		self->dataPtr!=NULL, 
-		Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
-		"Constructing a Stg_ObjectAdaptor where there the data pointer is NULL is illegal.\n" );
-	if( self->isGlobal ) {
-		Journal_Firewall( 
-			!self->iOwn, 
-			Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
-			"Constructing a Stg_ObjectAdaptor where both iOwn and isGlobal are true is illegal.\n" );
-	}
-}
-
-
-void _Stg_ObjectAdaptor_Delete( void* objectAdaptor ) {
-	Stg_ObjectAdaptor*	self = (Stg_ObjectAdaptor*)objectAdaptor;
-	
-	if( !self->isGlobal ) {
-		if( self->isStgClass ) {
-			if( self->iOwn && self->dataPtr ) {
-				Stg_Class_Delete( self->dataPtr );
-			}
-		}
-		else {
-			if( self->iOwn && self->dataPtr ) {
-				if( self->ptrDelete ) {
-					self->ptrDelete( self->dataPtr );
-				}
-				Memory_Free( self->dataPtr );
-			}
-		}
-	}
-	self->dataPtr = NULL;
-	
-	/* Delete parent class */
-	_Stg_Object_Delete( self );
-}
-
-
-void _Stg_ObjectAdaptor_Print( void* objectAdaptor, struct Stream* stream ) {
-	Stg_ObjectAdaptor*	self = (Stg_ObjectAdaptor*)objectAdaptor;
-	
-	/* General info */
-	Journal_Printf( stream, "Stg_ObjectAdaptor (ptr): %p\n", self );
-	Stream_Indent( stream );
-	
-	_Stg_Object_Print( self, stream );
-	
-	Journal_Printf( stream, "iOwn: %s\n", self->iOwn ? "Yes" : "No" );
-	Journal_Printf( stream, "isGlobal: %s\n", self->isGlobal ? "Yes" : "No" );
-	Journal_Printf( stream, "isStgClass: %s\n", self->isStgClass ? "Yes" : "No" );
-	
-	if( self->isStgClass ) {
-		Stg_Class_Print( self->dataPtr, stream );
-	}
-	else {
-		if( self->ptrPrint ) {
-			self->ptrPrint( self->dataPtr, stream );
-		}
-		else {
-			Journal_Printf( stream, "Don't know how to print the pointer (it is not to a StGermain class)\n" );
-		}
-	}
-	
-	Stream_UnIndent( stream );
-}
-
-
-void* _Stg_ObjectAdaptor_Copy( const void* objectAdaptor, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
-	Stg_ObjectAdaptor* newTuple;
-
-	newTuple = (Stg_ObjectAdaptor*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	newTuple->isGlobal = self->isGlobal;
-	newTuple->isStgClass = self->isStgClass;
-	
-	Journal_Firewall( deep, Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), "Shallow copy not yet implemented\n" );
-	if( deep ) {
-		if( self->isGlobal ) {
-			newTuple->iOwn = False;
-			newTuple->dataPtr = self->dataPtr;
-		}
-		else {
-			newTuple->iOwn = True;
-			
-			Journal_Firewall( 
-				self->iOwn, 
-				Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
-				"Deep copy for Stg_ObjectAdaptors that do not own the non-global data is not yet implemented\n" );
-			
-			/* TODO: DOES NOT check if the object has already been copied (i.e. use ptrMap). Beacuse if we assume
-			   ownership, we could not do so without an instance count machanism. */
-			/* if not in ptr map */
-			if( self->isStgClass ) {
-				newTuple->dataPtr = Stg_Class_Copy( self->dataPtr, 0, deep, nameExt, ptrMap );
-			}
-			else {
-				Journal_Firewall( 
-					self->ptrCopy != NULL, 
-					Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
-					"Deep copy for pointer based Stg_ObjectAdaptors requires a copy function attached... not provided!\n" );
-				newTuple->dataPtr = self->ptrCopy( self->dataPtr, 0, deep, nameExt, ptrMap );
-			}
-			/* else if in ptr map ... copy ptr value from there. */
-		}
-	}
-	
-	return newTuple;
-}
-	
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-void* Stg_ObjectAdaptor_ObjectFunc( void* objectAdaptor ) {
-	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
-	
-	return Stg_ObjectAdaptor_ObjectMacro( self );
-}
-
-
-Bool Stg_ObjectAdaptor_IOwnFunc( void* objectAdaptor ) {
-	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
-	
-	return Stg_ObjectAdaptor_IOwnMacro( self );
-}
-
-
-Bool Stg_ObjectAdaptor_IsGlobalFunc( void* objectAdaptor ) {
-	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
-	
-	return Stg_ObjectAdaptor_IsGlobalMacro( self );
-}
-
-
-Bool Stg_ObjectAdaptor_IsStgClassFunc( void* objectAdaptor ) {
-	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
-	
-	return Stg_ObjectAdaptor_IsStgClassMacro( self );
-}
-
-
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/ObjectAdaptor.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/ObjectAdaptor.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,333 @@
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ObjectAdaptor.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "Memory.h"
+#include "Class.h"
+#include "Object.h"
+#include "ObjectAdaptor.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+
+/* Class Administration members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+const Type Stg_ObjectAdaptor_Type = "Stg_ObjectAdaptor";
+
+
+Stg_ObjectAdaptor* Stg_ObjectAdaptor_NewOfClass( void* dataPtr, Name name, Bool iOwn, Bool isGlobal ) {
+	/* Variables set in this function */
+	SizeT                                     _sizeOfSelf = sizeof(Stg_ObjectAdaptor);
+	Type                                             type = Stg_ObjectAdaptor_Type;
+	Stg_Class_DeleteFunction*                     _delete = _Stg_ObjectAdaptor_Delete;
+	Stg_Class_PrintFunction*                       _print = _Stg_ObjectAdaptor_Print;
+	Stg_Class_CopyFunction*                         _copy = _Stg_ObjectAdaptor_Copy;
+	Bool                                       isStgClass = True;
+	Stg_ObjectAdaptor_DeletePointerFunction*    ptrDelete = NULL;
+	Stg_ObjectAdaptor_PrintPointerFunction*      ptrPrint = NULL;
+	Stg_ObjectAdaptor_CopyPointerFunction*        ptrCopy = NULL;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Stg_ObjectAdaptor_New(  STG_OBJECTADAPTOR_PASSARGS  ); 
+}
+
+
+void Stg_ObjectAdaptor_InitOfClass( Stg_ObjectAdaptor* self, void* dataPtr, Name name, Bool iOwn, Bool isGlobal ) {
+	/* General info */
+	self->type = Stg_ObjectAdaptor_Type;
+	self->_sizeOfSelf = sizeof(Stg_ObjectAdaptor);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _Stg_ObjectAdaptor_Delete;
+	self->_print = _Stg_ObjectAdaptor_Print;
+	self->_copy = _Stg_ObjectAdaptor_Copy;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+
+	/* Stg_ObjectAdaptor info */
+	_Stg_ObjectAdaptor_Init( self, dataPtr, iOwn, isGlobal, True, NULL, NULL, NULL );
+}
+
+
+Stg_ObjectAdaptor* Stg_ObjectAdaptor_NewOfPointer(
+		void*						dataPtr, 
+		Name						name, 
+		Bool						iOwn,
+		Bool						isGlobal,
+		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(Stg_ObjectAdaptor);
+	Type                              type = Stg_ObjectAdaptor_Type;
+	Stg_Class_DeleteFunction*      _delete = _Stg_ObjectAdaptor_Delete;
+	Stg_Class_PrintFunction*        _print = _Stg_ObjectAdaptor_Print;
+	Stg_Class_CopyFunction*          _copy = _Stg_ObjectAdaptor_Copy;
+	Bool                        isStgClass = False;
+
+	/* 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 = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Stg_ObjectAdaptor_New(  STG_OBJECTADAPTOR_PASSARGS  ); 
+}
+
+
+void Stg_ObjectAdaptor_InitOfPointer( 
+		Stg_ObjectAdaptor* 				self, 
+		void*						dataPtr, 
+		Name						name, 
+		Bool						iOwn,
+		Bool						isGlobal,
+		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	/* General info */
+	self->type = Stg_ObjectAdaptor_Type;
+	self->_sizeOfSelf = sizeof(Stg_ObjectAdaptor);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _Stg_ObjectAdaptor_Delete;
+	self->_print = _Stg_ObjectAdaptor_Print;
+	self->_copy = _Stg_ObjectAdaptor_Copy;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_Object_Init( (Stg_Object*)self, name, GLOBAL );
+
+	/* Stg_ObjectAdaptor info */
+	_Stg_ObjectAdaptor_Init( self, dataPtr, iOwn, isGlobal, False, ptrDelete, ptrPrint, ptrCopy );
+}
+
+
+Stg_ObjectAdaptor* _Stg_ObjectAdaptor_New(  STG_OBJECTADAPTOR_DEFARGS  )
+{
+	Stg_ObjectAdaptor* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stg_ObjectAdaptor) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = GLOBAL;
+
+	self = (Stg_ObjectAdaptor*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	
+	/* Stg_ObjectAdaptor info */
+	_Stg_ObjectAdaptor_Init( self, dataPtr, iOwn, isGlobal, isStgClass, ptrDelete, ptrPrint, ptrCopy );
+	
+	return self;
+}
+
+
+void _Stg_ObjectAdaptor_Init(
+		Stg_ObjectAdaptor*				self, 
+		void*						dataPtr, 
+		Bool						iOwn, 
+		Bool						isGlobal, 
+		Bool						isStgClass,
+		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	self->dataPtr = dataPtr;
+	self->iOwn = iOwn;
+	self->isGlobal = isGlobal;
+	self->isStgClass = isStgClass;
+	if( isStgClass ) {
+		self->ptrDelete = NULL;
+		self->ptrPrint = NULL;
+		self->ptrCopy = NULL;
+	}
+	else {
+		self->ptrDelete = ptrDelete;
+		self->ptrPrint = ptrPrint;
+		self->ptrCopy = ptrCopy;
+	}
+	
+	Journal_Firewall( 
+		self->dataPtr!=NULL, 
+		Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
+		"Constructing a Stg_ObjectAdaptor where there the data pointer is NULL is illegal.\n" );
+	if( self->isGlobal ) {
+		Journal_Firewall( 
+			!self->iOwn, 
+			Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
+			"Constructing a Stg_ObjectAdaptor where both iOwn and isGlobal are true is illegal.\n" );
+	}
+}
+
+
+void _Stg_ObjectAdaptor_Delete( void* objectAdaptor ) {
+	Stg_ObjectAdaptor*	self = (Stg_ObjectAdaptor*)objectAdaptor;
+	
+	if( !self->isGlobal ) {
+		if( self->isStgClass ) {
+			if( self->iOwn && self->dataPtr ) {
+				Stg_Class_Delete( self->dataPtr );
+			}
+		}
+		else {
+			if( self->iOwn && self->dataPtr ) {
+				if( self->ptrDelete ) {
+					self->ptrDelete( self->dataPtr );
+				}
+				Memory_Free( self->dataPtr );
+			}
+		}
+	}
+	self->dataPtr = NULL;
+	
+	/* Delete parent class */
+	_Stg_Object_Delete( self );
+}
+
+
+void _Stg_ObjectAdaptor_Print( void* objectAdaptor, struct Stream* stream ) {
+	Stg_ObjectAdaptor*	self = (Stg_ObjectAdaptor*)objectAdaptor;
+	
+	/* General info */
+	Journal_Printf( stream, "Stg_ObjectAdaptor (ptr): %p\n", self );
+	Stream_Indent( stream );
+	
+	_Stg_Object_Print( self, stream );
+	
+	Journal_Printf( stream, "iOwn: %s\n", self->iOwn ? "Yes" : "No" );
+	Journal_Printf( stream, "isGlobal: %s\n", self->isGlobal ? "Yes" : "No" );
+	Journal_Printf( stream, "isStgClass: %s\n", self->isStgClass ? "Yes" : "No" );
+	
+	if( self->isStgClass ) {
+		Stg_Class_Print( self->dataPtr, stream );
+	}
+	else {
+		if( self->ptrPrint ) {
+			self->ptrPrint( self->dataPtr, stream );
+		}
+		else {
+			Journal_Printf( stream, "Don't know how to print the pointer (it is not to a StGermain class)\n" );
+		}
+	}
+	
+	Stream_UnIndent( stream );
+}
+
+
+void* _Stg_ObjectAdaptor_Copy( const void* objectAdaptor, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
+	Stg_ObjectAdaptor* newTuple;
+
+	newTuple = (Stg_ObjectAdaptor*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	newTuple->isGlobal = self->isGlobal;
+	newTuple->isStgClass = self->isStgClass;
+	
+	Journal_Firewall( deep, Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), "Shallow copy not yet implemented\n" );
+	if( deep ) {
+		if( self->isGlobal ) {
+			newTuple->iOwn = False;
+			newTuple->dataPtr = self->dataPtr;
+		}
+		else {
+			newTuple->iOwn = True;
+			
+			Journal_Firewall( 
+				self->iOwn, 
+				Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
+				"Deep copy for Stg_ObjectAdaptors that do not own the non-global data is not yet implemented\n" );
+			
+			/* TODO: DOES NOT check if the object has already been copied (i.e. use ptrMap). Beacuse if we assume
+			   ownership, we could not do so without an instance count machanism. */
+			/* if not in ptr map */
+			if( self->isStgClass ) {
+				newTuple->dataPtr = Stg_Class_Copy( self->dataPtr, 0, deep, nameExt, ptrMap );
+			}
+			else {
+				Journal_Firewall( 
+					self->ptrCopy != NULL, 
+					Journal_Register( Error_Type, Stg_ObjectAdaptor_Type ), 
+					"Deep copy for pointer based Stg_ObjectAdaptors requires a copy function attached... not provided!\n" );
+				newTuple->dataPtr = self->ptrCopy( self->dataPtr, 0, deep, nameExt, ptrMap );
+			}
+			/* else if in ptr map ... copy ptr value from there. */
+		}
+	}
+	
+	return newTuple;
+}
+	
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+void* Stg_ObjectAdaptor_ObjectFunc( void* objectAdaptor ) {
+	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
+	
+	return Stg_ObjectAdaptor_ObjectMacro( self );
+}
+
+
+Bool Stg_ObjectAdaptor_IOwnFunc( void* objectAdaptor ) {
+	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
+	
+	return Stg_ObjectAdaptor_IOwnMacro( self );
+}
+
+
+Bool Stg_ObjectAdaptor_IsGlobalFunc( void* objectAdaptor ) {
+	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
+	
+	return Stg_ObjectAdaptor_IsGlobalMacro( self );
+}
+
+
+Bool Stg_ObjectAdaptor_IsStgClassFunc( void* objectAdaptor ) {
+	Stg_ObjectAdaptor* self = (Stg_ObjectAdaptor*)objectAdaptor;
+	
+	return Stg_ObjectAdaptor_IsStgClassMacro( self );
+}
+
+
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/ObjectList.c
--- a/Base/Foundation/src/ObjectList.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,874 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ObjectList.c 4274 2008-05-28 02:00:24Z JulianGiordani $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "types.h"
-#include "Memory.h"
-#include "forwardDecl.h"
-
-#include "Class.h"
-#include "Object.h"
-#include "ObjectAdaptor.h"
-#include "ObjectList.h"
-#include "CommonRoutines.h"
-#include "shortcuts.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-/* constants */
-
-/** Textual name of this class */
-const Type Stg_ObjectList_Type = "Stg_ObjectList";
-
-
-Stg_ObjectList* Stg_ObjectList_New2( Index initialSize, Index delta ) {
-	/* Variables set in this function */
-	SizeT                                           _sizeOfSelf = sizeof(Stg_ObjectList);
-	Type                                                   type = Stg_ObjectList_Type;
-	Stg_Class_DeleteFunction*                           _delete = _Stg_ObjectList_Delete;
-	Stg_Class_PrintFunction*                             _print = _Stg_ObjectList_Print;
-	Stg_Class_CopyFunction*                               _copy = _Stg_ObjectList_Copy;
-	Stg_ObjectList_AppendFunction*                      _append = _Stg_ObjectList_Append;
-	Stg_ObjectList_PrependFunction*                    _prepend = _Stg_ObjectList_Prepend;
-	Stg_ObjectList_ReplaceAllFunction*              _replaceAll = _Stg_ObjectList_ReplaceAll;
-	Stg_ObjectList_ReplaceFunction*                    _replace = _Stg_ObjectList_Replace;
-	Stg_ObjectList_InsertBeforeFunction*          _insertBefore = _Stg_ObjectList_InsertBefore;
-	Stg_ObjectList_InsertAfterFunction*            _insertAfter = _Stg_ObjectList_InsertAfter;
-	Stg_ObjectList_RemoveFunction*                      _remove = _Stg_ObjectList_Remove;
-	Stg_ObjectList_GetIndexFunction*                  _getIndex = _Stg_ObjectList_GetIndex;
-	Stg_ObjectList_GetFunction*                            _get = _Stg_ObjectList_Get;
-	Stg_ObjectList_AllocMoreMemoryFunction*    _allocMoreMemory = _Stg_ObjectList_AllocMoreMemory;
-	Stg_ObjectList_InsertAtIndexFunction*        _insertAtIndex = _Stg_ObjectList_InsertAtIndex;
-	Stg_ObjectList_RemoveByIndexFunction*        _removeByIndex = _Stg_ObjectList_RemoveByIndex;
-	Stg_ObjectList_DeleteAllObjectsFunction*  _deleteAllObjects = _Stg_ObjectList_DeleteAllObjects;
-
-	return _Stg_ObjectList_New(  STG_OBJECTLIST_PASSARGS  );
-}
-	
-
-void Stg_ObjectList_Init2( Stg_ObjectList* self, Index initialSize, Index delta ) {
-	/* General info */
-	self->type = Stg_ObjectList_Type;
-	self->_sizeOfSelf = sizeof(Stg_ObjectList);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _Stg_ObjectList_Delete;
-	self->_print = _Stg_ObjectList_Print;
-	self->_copy = _Stg_ObjectList_Copy;
-	self->_append = _Stg_ObjectList_Append;
-	self->_prepend = _Stg_ObjectList_Prepend;
-	self->_replaceAll = _Stg_ObjectList_ReplaceAll;
-	self->_replace = _Stg_ObjectList_Replace; 
-	self->_insertBefore = _Stg_ObjectList_InsertBefore;  
-	self->_insertAfter = _Stg_ObjectList_InsertAfter;  
-	self->_remove = _Stg_ObjectList_Remove;  
-	self->_getIndex = _Stg_ObjectList_GetIndex;  
-	self->_get = _Stg_ObjectList_Get;  
-	self->_allocMoreMemory = _Stg_ObjectList_AllocMoreMemory;  
-	self->_insertAtIndex = _Stg_ObjectList_InsertAtIndex;  
-	self->_removeByIndex = _Stg_ObjectList_RemoveByIndex;  
-	self->_deleteAllObjects = _Stg_ObjectList_DeleteAllObjects;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_Stg_ObjectList_Init( (Stg_ObjectList*)self, initialSize, delta );
-
-}
-	
-
-/* Creation implementation */
-Stg_ObjectList* _Stg_ObjectList_New(  STG_OBJECTLIST_DEFARGS  ) 
-{
-	Stg_ObjectList* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stg_ObjectList) );
-	self = (Stg_ObjectList*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	/* Virtual functions */
-	self->_append = _append;
-	self->_prepend = _prepend;
-	self->_replaceAll = _replaceAll;
-	self->_replace = _replace;
-	self->_insertBefore = _insertBefore;
-	self->_insertAfter = _insertAfter;
-	self->_remove = _remove;
-	self->_getIndex = _getIndex;  
-	self->_get = _get;
-	self->_allocMoreMemory = _allocMoreMemory;
-	self->_insertAtIndex = _insertAtIndex;
-	self->_removeByIndex = _removeByIndex;
-	self->_deleteAllObjects = _deleteAllObjects;
-	
-	/* ObjectList info */
-	_Stg_ObjectList_Init( self, initialSize, delta );
-	
-	return self;
-}
-
-
-/* Initialisation implementation */
-void _Stg_ObjectList_Init( Stg_ObjectList* self, Index initialSize, Index delta ) {
-	self->count = 0;
-	self->_size = initialSize;
-	self->_delta = delta;
-	self->data = (Stg_ObjectPtr*)Memory_Alloc_Array( Stg_ObjectPtr, initialSize, "ObjectList->data" );
-	self->_noJournalingInCopy = False;
-}
-
-/* Stg_Class_Delete implementation */
-void _Stg_ObjectList_Delete( void* namedObjectList ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-
-/*TODO - reference counter needs to be used to make sure
- we are not deleting objects that are being referenced to
- from other objects.*/
-	
-#if 0
-	Stg_ObjectList_DeleteAllObjects( self );
-#endif
-	
-	Memory_Free( self->data );
-
-	/* Stg_Class_Delete parent class */
-	_Stg_Class_Delete( self );
-
-}
-	
-	
-/* Print implementation */
-void _Stg_ObjectList_Print( void* objectList, struct Stream* stream ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-
-	/* General info */
-	Journal_Printf( stream, "Stg_ObjectList (ptr):%p\n", (void*)self );
-	Stream_Indent( stream );
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-
-	/* Virtual info */
-	Journal_Printf( stream, "_append(func ptr): %p\n", (void*)self->_append );
-	Journal_Printf( stream, "_prepend(func ptr): %p\n", (void*)self->_prepend );
-	Journal_Printf( stream, "_replaceAll(func ptr): %p\n", (void*)self->_replaceAll );
-	Journal_Printf( stream, "_replace(func ptr): %p\n", (void*)self->_replace );
-	Journal_Printf( stream, "_insertBefore(func ptr): %p\n", (void*)self->_insertBefore );
-	Journal_Printf( stream, "_insertAfter(func ptr): %p\n", (void*)self->_insertAfter );
-	Journal_Printf( stream, "_remove(func ptr): %p\n", (void*)self->_remove );
-	Journal_Printf( stream, "_getIndex(func ptr): %p\n", (void*)self->_getIndex );
-	Journal_Printf( stream, "_get(func ptr): %p\n", (void*)self->_get );
-	Journal_Printf( stream, "_allocMoreMemory(func ptr): %p\n", (void*)self->_allocMoreMemory );
-	Journal_Printf( stream, "_insertAtIndex(func ptr): %p\n", (void*)self->_insertAtIndex );
-	Journal_Printf( stream, "_removeByIndex(func ptr): %p\n", (void*)self->_removeByIndex );
-	Journal_Printf( stream, "_deleteAllObjects(func ptr): %p\n", (void*)self->_deleteAllObjects );
-
-	/* Stg_ObjectList */
-	Journal_Printf( stream, "_size: %u\n", self->_size );
-	Journal_Printf( stream, "_delta: %u\n", self->_delta );
-	Journal_Printf( stream, "_noJournalingInCopy: %u\n", self->_noJournalingInCopy );
-	Journal_Printf( stream, "count: %u\n", self->count );
-	Journal_Printf( stream, "data[0-%d]:\n", self->count );
-	Stg_ObjectList_PrintAllObjects( self, stream );
-	
-	
-	Stream_UnIndent( stream );
-}
-
-void* _Stg_ObjectList_Copy( const void* namedObjectList, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_ObjectList*	self = (Stg_ObjectList*) namedObjectList;
-	Stg_ObjectList*	newObjectList;
-	
-	newObjectList = (Stg_ObjectList*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	newObjectList->_append = self->_append;
-	newObjectList->_prepend = self->_prepend;
-	newObjectList->_append = self->_append;
-	newObjectList->_replaceAll = self->_replaceAll;
-	newObjectList->_replace = self->_replace;
-	newObjectList->_insertBefore = self->_insertBefore;
-	newObjectList->_insertAfter = self->_insertAfter;
-	newObjectList->_remove = self->_remove;
-	newObjectList->_getIndex = self->_getIndex;
-	newObjectList->_get = self->_get;
-	newObjectList->_allocMoreMemory = self->_allocMoreMemory;
-	newObjectList->_insertAtIndex = self->_insertAtIndex;
-	newObjectList->_removeByIndex = self->_removeByIndex;
-	newObjectList->_deleteAllObjects = self->_deleteAllObjects;
-	newObjectList->count = self->count;
-	newObjectList->_size = self->_size;
-	newObjectList->_delta = self->_delta;
-	newObjectList->_noJournalingInCopy = self->_noJournalingInCopy;
-	
-	/* As this class is used by the Journal backend, making Journal calls when used in the Journal backend, is problematic...
-	   in this case work around it. It seems to only be an issue for copying. */
-	if( self->_noJournalingInCopy ) {
-		assert( deep );
-	}
-	else {
-		Journal_Firewall( deep, Journal_Register( Error_Type, Stg_ObjectList_Type ), "Shallow copy not yet implemented\n");
-	}
-	if( deep ) {
-		unsigned obj_I;
-		
-		newObjectList->data = (Stg_ObjectPtr*)Memory_Alloc_Array( 
-			Stg_ObjectPtr, 
-			newObjectList->_size, 
-			"ObjectList->data" );
-		
-		for( obj_I = 0; obj_I < newObjectList->count; obj_I++ ) {
-                  newObjectList->data[obj_I] = (Stg_Object*)Stg_Class_Copy( self->data[obj_I], NULL, deep, nameExt, ptrMap );
-		}
-	}
-	
-	return newObjectList;
-}
-
-
-/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-static void GlobalPrint( void* ptr, struct Stream* stream ) {
-	Journal_Printf( stream, "(ptr): %p\n", ptr );
-}
-	
-Index Stg_ObjectList_Append( void* objectList, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return self->_append( self, objectPtr );
-}	
-
-Index Stg_ObjectList_ClassAppend( void* objectList, void* objectPtr, Name name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Append( self, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
-}
-
-Index Stg_ObjectList_PointerAppend( 
-		void*						objectList, 
-		void*						objectPtr, 
-		Name						name, 
-		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Append( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
-}
-
-Index Stg_ObjectList_GlobalPointerAppend( void* objectList, void* objectPtr, Name name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Append( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
-}
-
-Index Stg_ObjectList_Prepend( void* objectList, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return self->_prepend( self, objectPtr );
-}
-
-Index Stg_ObjectList_ClassPrepend( void* objectList, void* objectPtr, Name name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Prepend( self, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
-}
-
-Index Stg_ObjectList_PointerPrepend( 
-		void*						objectList, 
-		void*						objectPtr, 
-		Name						name, 
-		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Prepend( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
-}
-
-Index Stg_ObjectList_GlobalPointerPrepend( void* objectList, void* objectPtr, Name name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Prepend( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
-}
-
-Index Stg_ObjectList_ReplaceAll( void* objectList, ReplacementOption option, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return self->_replaceAll( self, option, objectPtr );
-}
-
-Index Stg_ObjectList_ClassReplaceAll( void* objectList, ReplacementOption option, void* objectPtr, Name name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_ReplaceAll( self, option, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
-}
-
-Index Stg_ObjectList_PointerReplaceAll( 
-		void*						objectList, 
-		ReplacementOption				option, 
-		void*						objectPtr, 
-		Name						name, 
-		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_ReplaceAll( 
-		self, 
-		option, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
-}
-
-Index Stg_ObjectList_GlobalPointerReplaceAll( void* objectList, ReplacementOption option, void* objectPtr, Name name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_ReplaceAll( self, option, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
-}
-
-Index Stg_ObjectList_Replace( 
-		void*						objectList, 
-		Name						toReplace,
-		ReplacementOption				option, 
-		void*						objectPtr )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return self->_replace( self, toReplace, option, objectPtr );
-}
-
-Index Stg_ObjectList_ClassReplace( 
-		void*						objectList, 
-		Name						toReplace,
-		ReplacementOption				option, 
-		void*						objectPtr, 
-		Name						name )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Replace( self, toReplace, option, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
-}
-
-Index Stg_ObjectList_PointerReplace( 
-		void*						objectList, 
-		Name						toReplace,
-		ReplacementOption				option, 
-		void*						objectPtr, 
-		Name						name,
-		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Replace( 
-		self, 
-		toReplace, 
-		option, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
-}
-
-Index Stg_ObjectList_GlobalPointerReplace( 
-		void*						objectList, 
-		Name						toReplace,
-		ReplacementOption				option, 
-		void*						objectPtr, 
-		Name						name )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_Replace( 
-		self, 
-		toReplace, 
-		option, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
-}
-
-Index Stg_ObjectList_InsertBefore( void* objectList, Name reference, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return self->_insertBefore( self, reference, objectPtr );	
-}
-
-Index Stg_ObjectList_ClassInsertBefore( void* objectList, Name reference, void* objectPtr, const char* name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_InsertBefore( self, reference, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
-}
-
-Index Stg_ObjectList_PointerInsertBefore( 
-		void*						objectList, 
-		Name						reference, 
-		void*						objectPtr, 
-		Name						name, 
-		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_InsertBefore( 
-		self, 
-		reference, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
-}
-
-Index Stg_ObjectList_GlobalPointerInsertBefore( void* objectList, Name reference, void* objectPtr, const char* name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_InsertBefore( 
-		self, 
-		reference, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
-}
-
-
-Index Stg_ObjectList_InsertAfter( void* objectList, Name reference, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return self->_insertAfter( self, reference, objectPtr );
-}
-
-
-void Stg_ObjectList_InsertAtIndex( void* objects, Index index, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objects;
-
-	/* Runs error checking and then inserts */
-	assert( objectPtr );
-	assert( self->count <= self->_size );
-	if ( self->count == self->_size ) {
-		self->_allocMoreMemory( self );
-	}
-
-	self->_insertAtIndex( self, index, objectPtr );
-}
-
-Index Stg_ObjectList_ClassInsertAfter( void* objectList, Name reference, void* objectPtr, const char* name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_InsertAfter( self, reference, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
-}
-
-Index Stg_ObjectList_PointerInsertAfter( 
-		void*						objectList, 
-		Name						reference, 
-		void*						objectPtr, 
-		Name						name, 
-		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
-		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
-		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
-{
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_InsertAfter( 
-		self, 
-		reference, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
-}
-
-Index Stg_ObjectList_GlobalPointerInsertAfter( void* objectList, Name reference, void* objectPtr, const char* name ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_InsertAfter( 
-		self, 
-		reference, 
-		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
-}
-
-Index Stg_ObjectList_Remove( void* objectList, Name reference, ReplacementOption option ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-
-	return self->_remove( self, reference, option );
-}
-
-Index Stg_ObjectList_GetIndex( void* objectList, Name toGet ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-
-	return self->_getIndex( self, toGet );
-}
-
-
-void* Stg_ObjectList_Get( void* objectList, Name objectName ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-
-	return self->_get( self, objectName );
-}
-
-
-void Stg_ObjectList_DeleteAllObjects( void* objectList ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-
-	self->_deleteAllObjects( self );
-}
-
-
-void Stg_ObjectList_PrintAllEntryNames( void* objectList, void* _stream ) {
-	Stg_ObjectList* self      = (Stg_ObjectList*) objectList;
-	Stream*         stream    = (Stream*)         _stream;
-	Index           object_I;
-	Index           count     = self->count;
-
-	Journal_Printf( stream, "{ " );
-
-	for ( object_I = 0 ; object_I < count - 1 ; object_I++ ) {
-		Journal_Printf( stream, "'%s' (%s), ", self->data[ object_I ]->name, self->data[ object_I ]->type );
-	}
-	Journal_Printf( stream, "'%s' (%s) }\n", self->data[ object_I ]->name, self->data[ object_I ]->type );
-}
-
-
-void Stg_ObjectList_PrintAllObjects( void* objectList, void* _stream ) {
-	Stg_ObjectList*	self        = (Stg_ObjectList*) objectList;
-	Stream*	         stream      = (Stream*)_stream;
-	Index            objectIndex = 0;
-	
-	for ( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		Stg_Class_Print( self->data[ objectIndex ], stream ) ;
-	}
-}
-
-
-void* Stg_ObjectList_AtFunc( void* objectList, Index index ) {
-	Stg_ObjectList*	self        = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_AtMacro( self, index );
-}
-
-
-Index Stg_ObjectList_CountFunc( void* objectList ) {
-	Stg_ObjectList*	self        = (Stg_ObjectList*) objectList;
-	
-	return Stg_ObjectList_CountMacro( self );
-}
-
-
-/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-Index _Stg_ObjectList_Append( void* namedObjectList, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-
-	assert( objectPtr );
-	assert( self->count <= self->_size );
-	if ( self->count == self->_size ) {
-		self->_allocMoreMemory( self );
-	}
-	
-	self->data[self->count] = (Stg_Object*) objectPtr;
-	
-	return (self->count)++;
-}
-
-
-Index _Stg_ObjectList_Prepend( void* namedObjectList, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-
-	assert( objectPtr );
-	assert( self->count <= self->_size );
-	if ( self->count == self->_size ) {
-		self->_allocMoreMemory( self );
-	}
-
-	self->_insertAtIndex( self, 0, objectPtr );
-	return 0;
-}
-
-
-Index _Stg_ObjectList_ReplaceAll( void* namedObjectList, ReplacementOption option, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-	Index objectIndex;
-
-	assert( objectPtr );
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if ( DELETE == option ) {
-			Stg_Class_Delete( self->data[objectIndex] );
-		}
-		self->data[objectIndex] = 0;
-	}
-	self->data[0] = (Stg_Object*) objectPtr; 
-	self->count = 1;
-	return 0;
-}
-
-
-Index _Stg_ObjectList_Replace( void* namedObjectList, Name toReplace, ReplacementOption option, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-	Index objectIndex;
-
-	assert( objectPtr );
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if ( toReplace == self->data[objectIndex]->name ) {
-			if ( DELETE == option ) {
-				Stg_Class_Delete( self->data[objectIndex] );
-			}
-			self->data[objectIndex] = (Stg_Object*) objectPtr; 
-			return objectIndex;
-		}
-	}
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if (0 == strcmp( toReplace, self->data[objectIndex]->name ) ) {
-			if ( DELETE == option ) {
-				Stg_Class_Delete( self->data[objectIndex] );
-			}
-			self->data[objectIndex] = (Stg_Object*) objectPtr; 
-			return objectIndex;
-		}
-	}
-
-	fprintf( stderr, "Error: %s(): specified object \"%s\" to replace not found.\n",
-		__func__, toReplace ); 
-	assert( 0 );
-	return (Index) -1;
-}
-
-
-Index _Stg_ObjectList_InsertBefore( void* namedObjectList, Name reference, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-	Index objectIndex;
-
-	assert( objectPtr );
-	assert( self->count <= self->_size );
-	if ( self->count == self->_size ) {
-		self->_allocMoreMemory( self );
-	}
-
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if ( reference == self->data[objectIndex]->name ) {
-			self->_insertAtIndex( self, objectIndex, objectPtr );
-			return objectIndex;
-		}
-	}
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if (0 == strcmp( reference, self->data[objectIndex]->name ) ) {
-			self->_insertAtIndex( self, objectIndex, objectPtr );
-			return objectIndex;
-		}
-	}
-
-	fprintf( stderr, "Error: %s(): specified object \"%s\" to insert before not found.\n",
-		__func__, reference ); 
-	assert( 0 );
-	return (Index) -1;
-}
-
-
-Index _Stg_ObjectList_InsertAfter( void* namedObjectList, Name reference, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-	Index objectIndex;
-
-	assert( objectPtr );
-	assert( self->count <= self->_size );
-	if ( self->count == self->_size ) {
-		self->_allocMoreMemory( self );
-	}
-
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if ( reference == self->data[objectIndex]->name ) {
-			self->_insertAtIndex( self, objectIndex+1, objectPtr );
-			return objectIndex;
-		}
-	}
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if (0 == strcmp( reference, self->data[objectIndex]->name ) ) {
-			self->_insertAtIndex( self, objectIndex+1, objectPtr );
-			return objectIndex;
-		}
-	}
-
-	fprintf( stderr, "Error: %s(): specified object \"%s\" to insert after not found.\n",
-		__func__, reference ); 
-	assert( 0 );
-	return (Index) -1;
-}
-
-Index _Stg_ObjectList_Remove( void* namedObjectList, Name reference, ReplacementOption option ) {
-	Stg_ObjectList* self        = (Stg_ObjectList*) namedObjectList;
-	Index            objectIndex;
-	Stream*          errorStream = Journal_Register( Error_Type, self->type );
-
-	objectIndex = self->_getIndex( self, reference );
-
-	Journal_Firewall( objectIndex != (Index) -1, errorStream, 
-			"Error: %s(): specified object \"%s\" to remove not found.\n", __func__, reference ); 
-	
-	self->_removeByIndex( self, objectIndex, option );
-
-	return objectIndex;
-}
-
-
-Index _Stg_ObjectList_GetIndex( void* namedObjectList, Name toGet ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-	Index objectIndex;
-	
-	/* Find the object and return it */
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if ( toGet == self->data[objectIndex]->name ) return objectIndex;
-	}
-	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if (0 == strcmp( toGet, self->data[objectIndex]->name ) ) return objectIndex;
-	}
-			
-	return (unsigned int) -1;
-}
-
-
-void* _Stg_ObjectList_Get( void* objectList, Name toGet ) {
-        Stg_ObjectList* self = (Stg_ObjectList*) objectList;
-        Index objectIndex;
-                                                                                                                                    
-        /* Find the object and return it */
-        for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) { 
-			if ( toGet == self->data[objectIndex]->name ) { 
-				if ( self->data[objectIndex]->type == Stg_ObjectAdaptor_Type ) { 
-					return Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)self->data[objectIndex] ); 
-				} 
-				else { 
-					return self->data[objectIndex]; 
-				} 
-			}
-        }
-        for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) { 
-			if (0 == strcmp( toGet, self->data[objectIndex]->name ) ) { 
-				if ( self->data[objectIndex]->type == Stg_ObjectAdaptor_Type ) { 
-					return Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)self->data[objectIndex] ); 
-				} 
-				else { 
-					return self->data[objectIndex]; 
-				} 
-			}
-        }
-                                                                                                                                    
-        return NULL;
-}
-
-void _Stg_ObjectList_DeleteAllObjects( void* namedObjectList ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-	Index objectIndex;
-	
-	for ( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
-		if( self->data[objectIndex] ) {
-			Stg_Class_Delete( self->data[objectIndex] );
-			self->data[objectIndex] = 0;
-		}
-	}
-	self->count = 0;
-}
-
-
-void _Stg_ObjectList_AllocMoreMemory( void* namedObjectList ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
-
-	self->_size += self->_delta;
-	self->data = Memory_Realloc_Array( self->data, Stg_ObjectPtr, self->_size );
-	assert( self->data );
-}
-
-
-
-void _Stg_ObjectList_InsertAtIndex( void* objects, Index index, void* objectPtr ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objects;
-	
-	/* Move current content down one position, and add  */
-	if (index != self->count) {
-		memmove( &self->data[index+1], &self->data[index], sizeof(Stg_ObjectPtr) * (self->count - index) );
-	}
-
-	self->data[index] = (Stg_Object*) objectPtr;
-	self->count++;
-}
-
-void _Stg_ObjectList_RemoveByIndex( void* objects, Index index, ReplacementOption option ) {
-	Stg_ObjectList* self = (Stg_ObjectList*) objects;
-	
-	assert( index < self->count );
-
-	if ( option == DELETE )
-		Stg_Class_Delete( self->data[index] );
-	
-	/* Move current content up one position */
-	if (index != self->count - 1) {
-		memmove( &self->data[index], &self->data[index+1], sizeof(Stg_ObjectPtr) * (self->count - index - 1) );
-	}
-
-	self->count--;
-}
-
-typedef struct {
-	Stg_Object*    objectPtr;
-	float          percentageSimilar;
-} Stg_ObjectList_SimilarityObject;
-
-int _Stg_ObjectList_SimilarityCompare( const void *ptr1, const void *ptr2 ) {
-	Stg_ObjectList_SimilarityObject* similarityPtr1 = (Stg_ObjectList_SimilarityObject*) ptr1;
-	Stg_ObjectList_SimilarityObject* similarityPtr2 = (Stg_ObjectList_SimilarityObject*) ptr2;
-
-	if ( similarityPtr1->percentageSimilar > similarityPtr2->percentageSimilar )
-		return -1;
-	else 
-		return 1;
-}
-
-void Stg_ObjectList_PrintSimilar( void* objectList, Name name, void* _stream, unsigned int number ) {
-	Stg_ObjectList*                  self               = (Stg_ObjectList*) objectList;
-	Stream*                          stream             = (Stream*)         _stream;
-	Stg_ObjectList_SimilarityObject* similarityArray;
-	float                            stringLength       = (float) strlen( name );
-	float                            objectStringLength;
-	Index                            object_I;
-	unsigned int                     substringLength;
-
-	similarityArray = Memory_Alloc_Array( Stg_ObjectList_SimilarityObject, self->count, "similarityArray");
-
-	for ( object_I = 0 ; object_I < self->count ; object_I++ ) {
-		substringLength = Stg_LongestMatchingSubsequenceLength( self->data[object_I]->name, name, False );
-		objectStringLength = (float) strlen( self->data[object_I]->name );
-
-		similarityArray[ object_I ].objectPtr = self->data[object_I];
-		similarityArray[ object_I ].percentageSimilar = 
-			(float) substringLength * 100.0 / MAX( objectStringLength, stringLength );
-	}
-
-	qsort( similarityArray, (size_t)self->count, sizeof( Stg_ObjectList_SimilarityObject ), _Stg_ObjectList_SimilarityCompare );
-	
-	if ( number > self->count )
-		number = self->count;
-	for ( object_I = 0 ; object_I < number ; object_I++ ) {
-		Journal_Printf( stream, "%s (%.2f%% similar)\n", similarityArray[ object_I ].objectPtr->name, similarityArray[ object_I ].percentageSimilar );
-	}
-
-	Memory_Free( similarityArray );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/ObjectList.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/ObjectList.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,874 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ObjectList.c 4274 2008-05-28 02:00:24Z JulianGiordani $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "types.h"
+#include "Memory.h"
+#include "forwardDecl.h"
+
+#include "Class.h"
+#include "Object.h"
+#include "ObjectAdaptor.h"
+#include "ObjectList.h"
+#include "CommonRoutines.h"
+#include "shortcuts.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+/* constants */
+
+/** Textual name of this class */
+const Type Stg_ObjectList_Type = "Stg_ObjectList";
+
+
+Stg_ObjectList* Stg_ObjectList_New2( Index initialSize, Index delta ) {
+	/* Variables set in this function */
+	SizeT                                           _sizeOfSelf = sizeof(Stg_ObjectList);
+	Type                                                   type = Stg_ObjectList_Type;
+	Stg_Class_DeleteFunction*                           _delete = _Stg_ObjectList_Delete;
+	Stg_Class_PrintFunction*                             _print = _Stg_ObjectList_Print;
+	Stg_Class_CopyFunction*                               _copy = _Stg_ObjectList_Copy;
+	Stg_ObjectList_AppendFunction*                      _append = _Stg_ObjectList_Append;
+	Stg_ObjectList_PrependFunction*                    _prepend = _Stg_ObjectList_Prepend;
+	Stg_ObjectList_ReplaceAllFunction*              _replaceAll = _Stg_ObjectList_ReplaceAll;
+	Stg_ObjectList_ReplaceFunction*                    _replace = _Stg_ObjectList_Replace;
+	Stg_ObjectList_InsertBeforeFunction*          _insertBefore = _Stg_ObjectList_InsertBefore;
+	Stg_ObjectList_InsertAfterFunction*            _insertAfter = _Stg_ObjectList_InsertAfter;
+	Stg_ObjectList_RemoveFunction*                      _remove = _Stg_ObjectList_Remove;
+	Stg_ObjectList_GetIndexFunction*                  _getIndex = _Stg_ObjectList_GetIndex;
+	Stg_ObjectList_GetFunction*                            _get = _Stg_ObjectList_Get;
+	Stg_ObjectList_AllocMoreMemoryFunction*    _allocMoreMemory = _Stg_ObjectList_AllocMoreMemory;
+	Stg_ObjectList_InsertAtIndexFunction*        _insertAtIndex = _Stg_ObjectList_InsertAtIndex;
+	Stg_ObjectList_RemoveByIndexFunction*        _removeByIndex = _Stg_ObjectList_RemoveByIndex;
+	Stg_ObjectList_DeleteAllObjectsFunction*  _deleteAllObjects = _Stg_ObjectList_DeleteAllObjects;
+
+	return _Stg_ObjectList_New(  STG_OBJECTLIST_PASSARGS  );
+}
+	
+
+void Stg_ObjectList_Init2( Stg_ObjectList* self, Index initialSize, Index delta ) {
+	/* General info */
+	self->type = Stg_ObjectList_Type;
+	self->_sizeOfSelf = sizeof(Stg_ObjectList);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _Stg_ObjectList_Delete;
+	self->_print = _Stg_ObjectList_Print;
+	self->_copy = _Stg_ObjectList_Copy;
+	self->_append = _Stg_ObjectList_Append;
+	self->_prepend = _Stg_ObjectList_Prepend;
+	self->_replaceAll = _Stg_ObjectList_ReplaceAll;
+	self->_replace = _Stg_ObjectList_Replace; 
+	self->_insertBefore = _Stg_ObjectList_InsertBefore;  
+	self->_insertAfter = _Stg_ObjectList_InsertAfter;  
+	self->_remove = _Stg_ObjectList_Remove;  
+	self->_getIndex = _Stg_ObjectList_GetIndex;  
+	self->_get = _Stg_ObjectList_Get;  
+	self->_allocMoreMemory = _Stg_ObjectList_AllocMoreMemory;  
+	self->_insertAtIndex = _Stg_ObjectList_InsertAtIndex;  
+	self->_removeByIndex = _Stg_ObjectList_RemoveByIndex;  
+	self->_deleteAllObjects = _Stg_ObjectList_DeleteAllObjects;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_Stg_ObjectList_Init( (Stg_ObjectList*)self, initialSize, delta );
+
+}
+	
+
+/* Creation implementation */
+Stg_ObjectList* _Stg_ObjectList_New(  STG_OBJECTLIST_DEFARGS  ) 
+{
+	Stg_ObjectList* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stg_ObjectList) );
+	self = (Stg_ObjectList*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	/* Virtual functions */
+	self->_append = _append;
+	self->_prepend = _prepend;
+	self->_replaceAll = _replaceAll;
+	self->_replace = _replace;
+	self->_insertBefore = _insertBefore;
+	self->_insertAfter = _insertAfter;
+	self->_remove = _remove;
+	self->_getIndex = _getIndex;  
+	self->_get = _get;
+	self->_allocMoreMemory = _allocMoreMemory;
+	self->_insertAtIndex = _insertAtIndex;
+	self->_removeByIndex = _removeByIndex;
+	self->_deleteAllObjects = _deleteAllObjects;
+	
+	/* ObjectList info */
+	_Stg_ObjectList_Init( self, initialSize, delta );
+	
+	return self;
+}
+
+
+/* Initialisation implementation */
+void _Stg_ObjectList_Init( Stg_ObjectList* self, Index initialSize, Index delta ) {
+	self->count = 0;
+	self->_size = initialSize;
+	self->_delta = delta;
+	self->data = (Stg_ObjectPtr*)Memory_Alloc_Array( Stg_ObjectPtr, initialSize, "ObjectList->data" );
+	self->_noJournalingInCopy = False;
+}
+
+/* Stg_Class_Delete implementation */
+void _Stg_ObjectList_Delete( void* namedObjectList ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+
+/*TODO - reference counter needs to be used to make sure
+ we are not deleting objects that are being referenced to
+ from other objects.*/
+	
+#if 0
+	Stg_ObjectList_DeleteAllObjects( self );
+#endif
+	
+	Memory_Free( self->data );
+
+	/* Stg_Class_Delete parent class */
+	_Stg_Class_Delete( self );
+
+}
+	
+	
+/* Print implementation */
+void _Stg_ObjectList_Print( void* objectList, struct Stream* stream ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+
+	/* General info */
+	Journal_Printf( stream, "Stg_ObjectList (ptr):%p\n", (void*)self );
+	Stream_Indent( stream );
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+
+	/* Virtual info */
+	Journal_Printf( stream, "_append(func ptr): %p\n", (void*)self->_append );
+	Journal_Printf( stream, "_prepend(func ptr): %p\n", (void*)self->_prepend );
+	Journal_Printf( stream, "_replaceAll(func ptr): %p\n", (void*)self->_replaceAll );
+	Journal_Printf( stream, "_replace(func ptr): %p\n", (void*)self->_replace );
+	Journal_Printf( stream, "_insertBefore(func ptr): %p\n", (void*)self->_insertBefore );
+	Journal_Printf( stream, "_insertAfter(func ptr): %p\n", (void*)self->_insertAfter );
+	Journal_Printf( stream, "_remove(func ptr): %p\n", (void*)self->_remove );
+	Journal_Printf( stream, "_getIndex(func ptr): %p\n", (void*)self->_getIndex );
+	Journal_Printf( stream, "_get(func ptr): %p\n", (void*)self->_get );
+	Journal_Printf( stream, "_allocMoreMemory(func ptr): %p\n", (void*)self->_allocMoreMemory );
+	Journal_Printf( stream, "_insertAtIndex(func ptr): %p\n", (void*)self->_insertAtIndex );
+	Journal_Printf( stream, "_removeByIndex(func ptr): %p\n", (void*)self->_removeByIndex );
+	Journal_Printf( stream, "_deleteAllObjects(func ptr): %p\n", (void*)self->_deleteAllObjects );
+
+	/* Stg_ObjectList */
+	Journal_Printf( stream, "_size: %u\n", self->_size );
+	Journal_Printf( stream, "_delta: %u\n", self->_delta );
+	Journal_Printf( stream, "_noJournalingInCopy: %u\n", self->_noJournalingInCopy );
+	Journal_Printf( stream, "count: %u\n", self->count );
+	Journal_Printf( stream, "data[0-%d]:\n", self->count );
+	Stg_ObjectList_PrintAllObjects( self, stream );
+	
+	
+	Stream_UnIndent( stream );
+}
+
+void* _Stg_ObjectList_Copy( const void* namedObjectList, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_ObjectList*	self = (Stg_ObjectList*) namedObjectList;
+	Stg_ObjectList*	newObjectList;
+	
+	newObjectList = (Stg_ObjectList*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	newObjectList->_append = self->_append;
+	newObjectList->_prepend = self->_prepend;
+	newObjectList->_append = self->_append;
+	newObjectList->_replaceAll = self->_replaceAll;
+	newObjectList->_replace = self->_replace;
+	newObjectList->_insertBefore = self->_insertBefore;
+	newObjectList->_insertAfter = self->_insertAfter;
+	newObjectList->_remove = self->_remove;
+	newObjectList->_getIndex = self->_getIndex;
+	newObjectList->_get = self->_get;
+	newObjectList->_allocMoreMemory = self->_allocMoreMemory;
+	newObjectList->_insertAtIndex = self->_insertAtIndex;
+	newObjectList->_removeByIndex = self->_removeByIndex;
+	newObjectList->_deleteAllObjects = self->_deleteAllObjects;
+	newObjectList->count = self->count;
+	newObjectList->_size = self->_size;
+	newObjectList->_delta = self->_delta;
+	newObjectList->_noJournalingInCopy = self->_noJournalingInCopy;
+	
+	/* As this class is used by the Journal backend, making Journal calls when used in the Journal backend, is problematic...
+	   in this case work around it. It seems to only be an issue for copying. */
+	if( self->_noJournalingInCopy ) {
+		assert( deep );
+	}
+	else {
+		Journal_Firewall( deep, Journal_Register( Error_Type, Stg_ObjectList_Type ), "Shallow copy not yet implemented\n");
+	}
+	if( deep ) {
+		unsigned obj_I;
+		
+		newObjectList->data = (Stg_ObjectPtr*)Memory_Alloc_Array( 
+			Stg_ObjectPtr, 
+			newObjectList->_size, 
+			"ObjectList->data" );
+		
+		for( obj_I = 0; obj_I < newObjectList->count; obj_I++ ) {
+                  newObjectList->data[obj_I] = (Stg_Object*)Stg_Class_Copy( self->data[obj_I], NULL, deep, nameExt, ptrMap );
+		}
+	}
+	
+	return newObjectList;
+}
+
+
+/* Public member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+static void GlobalPrint( void* ptr, struct Stream* stream ) {
+	Journal_Printf( stream, "(ptr): %p\n", ptr );
+}
+	
+Index Stg_ObjectList_Append( void* objectList, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return self->_append( self, objectPtr );
+}	
+
+Index Stg_ObjectList_ClassAppend( void* objectList, void* objectPtr, Name name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Append( self, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
+}
+
+Index Stg_ObjectList_PointerAppend( 
+		void*						objectList, 
+		void*						objectPtr, 
+		Name						name, 
+		Stg_ObjectAdaptor_DeletePointerFunction*	ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Append( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
+}
+
+Index Stg_ObjectList_GlobalPointerAppend( void* objectList, void* objectPtr, Name name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Append( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
+}
+
+Index Stg_ObjectList_Prepend( void* objectList, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return self->_prepend( self, objectPtr );
+}
+
+Index Stg_ObjectList_ClassPrepend( void* objectList, void* objectPtr, Name name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Prepend( self, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
+}
+
+Index Stg_ObjectList_PointerPrepend( 
+		void*						objectList, 
+		void*						objectPtr, 
+		Name						name, 
+		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Prepend( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
+}
+
+Index Stg_ObjectList_GlobalPointerPrepend( void* objectList, void* objectPtr, Name name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Prepend( self, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
+}
+
+Index Stg_ObjectList_ReplaceAll( void* objectList, ReplacementOption option, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return self->_replaceAll( self, option, objectPtr );
+}
+
+Index Stg_ObjectList_ClassReplaceAll( void* objectList, ReplacementOption option, void* objectPtr, Name name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_ReplaceAll( self, option, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
+}
+
+Index Stg_ObjectList_PointerReplaceAll( 
+		void*						objectList, 
+		ReplacementOption				option, 
+		void*						objectPtr, 
+		Name						name, 
+		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_ReplaceAll( 
+		self, 
+		option, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
+}
+
+Index Stg_ObjectList_GlobalPointerReplaceAll( void* objectList, ReplacementOption option, void* objectPtr, Name name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_ReplaceAll( self, option, Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
+}
+
+Index Stg_ObjectList_Replace( 
+		void*						objectList, 
+		Name						toReplace,
+		ReplacementOption				option, 
+		void*						objectPtr )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return self->_replace( self, toReplace, option, objectPtr );
+}
+
+Index Stg_ObjectList_ClassReplace( 
+		void*						objectList, 
+		Name						toReplace,
+		ReplacementOption				option, 
+		void*						objectPtr, 
+		Name						name )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Replace( self, toReplace, option, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
+}
+
+Index Stg_ObjectList_PointerReplace( 
+		void*						objectList, 
+		Name						toReplace,
+		ReplacementOption				option, 
+		void*						objectPtr, 
+		Name						name,
+		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Replace( 
+		self, 
+		toReplace, 
+		option, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
+}
+
+Index Stg_ObjectList_GlobalPointerReplace( 
+		void*						objectList, 
+		Name						toReplace,
+		ReplacementOption				option, 
+		void*						objectPtr, 
+		Name						name )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_Replace( 
+		self, 
+		toReplace, 
+		option, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
+}
+
+Index Stg_ObjectList_InsertBefore( void* objectList, Name reference, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return self->_insertBefore( self, reference, objectPtr );	
+}
+
+Index Stg_ObjectList_ClassInsertBefore( void* objectList, Name reference, void* objectPtr, const char* name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_InsertBefore( self, reference, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
+}
+
+Index Stg_ObjectList_PointerInsertBefore( 
+		void*						objectList, 
+		Name						reference, 
+		void*						objectPtr, 
+		Name						name, 
+		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_InsertBefore( 
+		self, 
+		reference, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
+}
+
+Index Stg_ObjectList_GlobalPointerInsertBefore( void* objectList, Name reference, void* objectPtr, const char* name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_InsertBefore( 
+		self, 
+		reference, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
+}
+
+
+Index Stg_ObjectList_InsertAfter( void* objectList, Name reference, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return self->_insertAfter( self, reference, objectPtr );
+}
+
+
+void Stg_ObjectList_InsertAtIndex( void* objects, Index index, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objects;
+
+	/* Runs error checking and then inserts */
+	assert( objectPtr );
+	assert( self->count <= self->_size );
+	if ( self->count == self->_size ) {
+		self->_allocMoreMemory( self );
+	}
+
+	self->_insertAtIndex( self, index, objectPtr );
+}
+
+Index Stg_ObjectList_ClassInsertAfter( void* objectList, Name reference, void* objectPtr, const char* name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_InsertAfter( self, reference, Stg_ObjectAdaptor_NewOfClass( objectPtr, name, True, False ) );
+}
+
+Index Stg_ObjectList_PointerInsertAfter( 
+		void*						objectList, 
+		Name						reference, 
+		void*						objectPtr, 
+		Name						name, 
+		Stg_ObjectAdaptor_DeletePointerFunction*		ptrDelete,
+		Stg_ObjectAdaptor_PrintPointerFunction*		ptrPrint,
+		Stg_ObjectAdaptor_CopyPointerFunction*		ptrCopy )
+{
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_InsertAfter( 
+		self, 
+		reference, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, True, False, ptrDelete, ptrPrint, ptrCopy ) );
+}
+
+Index Stg_ObjectList_GlobalPointerInsertAfter( void* objectList, Name reference, void* objectPtr, const char* name ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_InsertAfter( 
+		self, 
+		reference, 
+		Stg_ObjectAdaptor_NewOfPointer( objectPtr, name, False, True, 0, GlobalPrint, 0 ) );
+}
+
+Index Stg_ObjectList_Remove( void* objectList, Name reference, ReplacementOption option ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+
+	return self->_remove( self, reference, option );
+}
+
+Index Stg_ObjectList_GetIndex( void* objectList, Name toGet ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+
+	return self->_getIndex( self, toGet );
+}
+
+
+void* Stg_ObjectList_Get( void* objectList, Name objectName ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+
+	return self->_get( self, objectName );
+}
+
+
+void Stg_ObjectList_DeleteAllObjects( void* objectList ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+
+	self->_deleteAllObjects( self );
+}
+
+
+void Stg_ObjectList_PrintAllEntryNames( void* objectList, void* _stream ) {
+	Stg_ObjectList* self      = (Stg_ObjectList*) objectList;
+	Stream*         stream    = (Stream*)         _stream;
+	Index           object_I;
+	Index           count     = self->count;
+
+	Journal_Printf( stream, "{ " );
+
+	for ( object_I = 0 ; object_I < count - 1 ; object_I++ ) {
+		Journal_Printf( stream, "'%s' (%s), ", self->data[ object_I ]->name, self->data[ object_I ]->type );
+	}
+	Journal_Printf( stream, "'%s' (%s) }\n", self->data[ object_I ]->name, self->data[ object_I ]->type );
+}
+
+
+void Stg_ObjectList_PrintAllObjects( void* objectList, void* _stream ) {
+	Stg_ObjectList*	self        = (Stg_ObjectList*) objectList;
+	Stream*	         stream      = (Stream*)_stream;
+	Index            objectIndex = 0;
+	
+	for ( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		Stg_Class_Print( self->data[ objectIndex ], stream ) ;
+	}
+}
+
+
+void* Stg_ObjectList_AtFunc( void* objectList, Index index ) {
+	Stg_ObjectList*	self        = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_AtMacro( self, index );
+}
+
+
+Index Stg_ObjectList_CountFunc( void* objectList ) {
+	Stg_ObjectList*	self        = (Stg_ObjectList*) objectList;
+	
+	return Stg_ObjectList_CountMacro( self );
+}
+
+
+/* Private member functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+Index _Stg_ObjectList_Append( void* namedObjectList, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+
+	assert( objectPtr );
+	assert( self->count <= self->_size );
+	if ( self->count == self->_size ) {
+		self->_allocMoreMemory( self );
+	}
+	
+	self->data[self->count] = (Stg_Object*) objectPtr;
+	
+	return (self->count)++;
+}
+
+
+Index _Stg_ObjectList_Prepend( void* namedObjectList, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+
+	assert( objectPtr );
+	assert( self->count <= self->_size );
+	if ( self->count == self->_size ) {
+		self->_allocMoreMemory( self );
+	}
+
+	self->_insertAtIndex( self, 0, objectPtr );
+	return 0;
+}
+
+
+Index _Stg_ObjectList_ReplaceAll( void* namedObjectList, ReplacementOption option, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+	Index objectIndex;
+
+	assert( objectPtr );
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if ( DELETE == option ) {
+			Stg_Class_Delete( self->data[objectIndex] );
+		}
+		self->data[objectIndex] = 0;
+	}
+	self->data[0] = (Stg_Object*) objectPtr; 
+	self->count = 1;
+	return 0;
+}
+
+
+Index _Stg_ObjectList_Replace( void* namedObjectList, Name toReplace, ReplacementOption option, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+	Index objectIndex;
+
+	assert( objectPtr );
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if ( toReplace == self->data[objectIndex]->name ) {
+			if ( DELETE == option ) {
+				Stg_Class_Delete( self->data[objectIndex] );
+			}
+			self->data[objectIndex] = (Stg_Object*) objectPtr; 
+			return objectIndex;
+		}
+	}
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if (0 == strcmp( toReplace, self->data[objectIndex]->name ) ) {
+			if ( DELETE == option ) {
+				Stg_Class_Delete( self->data[objectIndex] );
+			}
+			self->data[objectIndex] = (Stg_Object*) objectPtr; 
+			return objectIndex;
+		}
+	}
+
+	fprintf( stderr, "Error: %s(): specified object \"%s\" to replace not found.\n",
+		__func__, toReplace ); 
+	assert( 0 );
+	return (Index) -1;
+}
+
+
+Index _Stg_ObjectList_InsertBefore( void* namedObjectList, Name reference, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+	Index objectIndex;
+
+	assert( objectPtr );
+	assert( self->count <= self->_size );
+	if ( self->count == self->_size ) {
+		self->_allocMoreMemory( self );
+	}
+
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if ( reference == self->data[objectIndex]->name ) {
+			self->_insertAtIndex( self, objectIndex, objectPtr );
+			return objectIndex;
+		}
+	}
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if (0 == strcmp( reference, self->data[objectIndex]->name ) ) {
+			self->_insertAtIndex( self, objectIndex, objectPtr );
+			return objectIndex;
+		}
+	}
+
+	fprintf( stderr, "Error: %s(): specified object \"%s\" to insert before not found.\n",
+		__func__, reference ); 
+	assert( 0 );
+	return (Index) -1;
+}
+
+
+Index _Stg_ObjectList_InsertAfter( void* namedObjectList, Name reference, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+	Index objectIndex;
+
+	assert( objectPtr );
+	assert( self->count <= self->_size );
+	if ( self->count == self->_size ) {
+		self->_allocMoreMemory( self );
+	}
+
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if ( reference == self->data[objectIndex]->name ) {
+			self->_insertAtIndex( self, objectIndex+1, objectPtr );
+			return objectIndex;
+		}
+	}
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if (0 == strcmp( reference, self->data[objectIndex]->name ) ) {
+			self->_insertAtIndex( self, objectIndex+1, objectPtr );
+			return objectIndex;
+		}
+	}
+
+	fprintf( stderr, "Error: %s(): specified object \"%s\" to insert after not found.\n",
+		__func__, reference ); 
+	assert( 0 );
+	return (Index) -1;
+}
+
+Index _Stg_ObjectList_Remove( void* namedObjectList, Name reference, ReplacementOption option ) {
+	Stg_ObjectList* self        = (Stg_ObjectList*) namedObjectList;
+	Index            objectIndex;
+	Stream*          errorStream = Journal_Register( Error_Type, self->type );
+
+	objectIndex = self->_getIndex( self, reference );
+
+	Journal_Firewall( objectIndex != (Index) -1, errorStream, 
+			"Error: %s(): specified object \"%s\" to remove not found.\n", __func__, reference ); 
+	
+	self->_removeByIndex( self, objectIndex, option );
+
+	return objectIndex;
+}
+
+
+Index _Stg_ObjectList_GetIndex( void* namedObjectList, Name toGet ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+	Index objectIndex;
+	
+	/* Find the object and return it */
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if ( toGet == self->data[objectIndex]->name ) return objectIndex;
+	}
+	for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if (0 == strcmp( toGet, self->data[objectIndex]->name ) ) return objectIndex;
+	}
+			
+	return (unsigned int) -1;
+}
+
+
+void* _Stg_ObjectList_Get( void* objectList, Name toGet ) {
+        Stg_ObjectList* self = (Stg_ObjectList*) objectList;
+        Index objectIndex;
+                                                                                                                                    
+        /* Find the object and return it */
+        for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) { 
+			if ( toGet == self->data[objectIndex]->name ) { 
+				if ( self->data[objectIndex]->type == Stg_ObjectAdaptor_Type ) { 
+					return Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)self->data[objectIndex] ); 
+				} 
+				else { 
+					return self->data[objectIndex]; 
+				} 
+			}
+        }
+        for( objectIndex = 0; objectIndex < self->count; objectIndex++ ) { 
+			if (0 == strcmp( toGet, self->data[objectIndex]->name ) ) { 
+				if ( self->data[objectIndex]->type == Stg_ObjectAdaptor_Type ) { 
+					return Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)self->data[objectIndex] ); 
+				} 
+				else { 
+					return self->data[objectIndex]; 
+				} 
+			}
+        }
+                                                                                                                                    
+        return NULL;
+}
+
+void _Stg_ObjectList_DeleteAllObjects( void* namedObjectList ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+	Index objectIndex;
+	
+	for ( objectIndex = 0; objectIndex < self->count; objectIndex++ ) {
+		if( self->data[objectIndex] ) {
+			Stg_Class_Delete( self->data[objectIndex] );
+			self->data[objectIndex] = 0;
+		}
+	}
+	self->count = 0;
+}
+
+
+void _Stg_ObjectList_AllocMoreMemory( void* namedObjectList ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) namedObjectList;
+
+	self->_size += self->_delta;
+	self->data = Memory_Realloc_Array( self->data, Stg_ObjectPtr, self->_size );
+	assert( self->data );
+}
+
+
+
+void _Stg_ObjectList_InsertAtIndex( void* objects, Index index, void* objectPtr ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objects;
+	
+	/* Move current content down one position, and add  */
+	if (index != self->count) {
+		memmove( &self->data[index+1], &self->data[index], sizeof(Stg_ObjectPtr) * (self->count - index) );
+	}
+
+	self->data[index] = (Stg_Object*) objectPtr;
+	self->count++;
+}
+
+void _Stg_ObjectList_RemoveByIndex( void* objects, Index index, ReplacementOption option ) {
+	Stg_ObjectList* self = (Stg_ObjectList*) objects;
+	
+	assert( index < self->count );
+
+	if ( option == DELETE )
+		Stg_Class_Delete( self->data[index] );
+	
+	/* Move current content up one position */
+	if (index != self->count - 1) {
+		memmove( &self->data[index], &self->data[index+1], sizeof(Stg_ObjectPtr) * (self->count - index - 1) );
+	}
+
+	self->count--;
+}
+
+typedef struct {
+	Stg_Object*    objectPtr;
+	float          percentageSimilar;
+} Stg_ObjectList_SimilarityObject;
+
+int _Stg_ObjectList_SimilarityCompare( const void *ptr1, const void *ptr2 ) {
+	Stg_ObjectList_SimilarityObject* similarityPtr1 = (Stg_ObjectList_SimilarityObject*) ptr1;
+	Stg_ObjectList_SimilarityObject* similarityPtr2 = (Stg_ObjectList_SimilarityObject*) ptr2;
+
+	if ( similarityPtr1->percentageSimilar > similarityPtr2->percentageSimilar )
+		return -1;
+	else 
+		return 1;
+}
+
+void Stg_ObjectList_PrintSimilar( void* objectList, Name name, void* _stream, unsigned int number ) {
+	Stg_ObjectList*                  self               = (Stg_ObjectList*) objectList;
+	Stream*                          stream             = (Stream*)         _stream;
+	Stg_ObjectList_SimilarityObject* similarityArray;
+	float                            stringLength       = (float) strlen( name );
+	float                            objectStringLength;
+	Index                            object_I;
+	unsigned int                     substringLength;
+
+	similarityArray = Memory_Alloc_Array( Stg_ObjectList_SimilarityObject, self->count, "similarityArray");
+
+	for ( object_I = 0 ; object_I < self->count ; object_I++ ) {
+		substringLength = Stg_LongestMatchingSubsequenceLength( self->data[object_I]->name, name, False );
+		objectStringLength = (float) strlen( self->data[object_I]->name );
+
+		similarityArray[ object_I ].objectPtr = self->data[object_I];
+		similarityArray[ object_I ].percentageSimilar = 
+			(float) substringLength * 100.0 / MAX( objectStringLength, stringLength );
+	}
+
+	qsort( similarityArray, (size_t)self->count, sizeof( Stg_ObjectList_SimilarityObject ), _Stg_ObjectList_SimilarityCompare );
+	
+	if ( number > self->count )
+		number = self->count;
+	for ( object_I = 0 ; object_I < number ; object_I++ ) {
+		Journal_Printf( stream, "%s (%.2f%% similar)\n", similarityArray[ object_I ].objectPtr->name, similarityArray[ object_I ].percentageSimilar );
+	}
+
+	Memory_Free( similarityArray );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/PrimitiveObject.c
--- a/Base/Foundation/src/PrimitiveObject.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: ObjectAdaptor.c 2136 2004-09-30 02:47:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include "types.h"
-#include "forwardDecl.h"
-
-#include "Memory.h"
-#include "Class.h"
-#include "Object.h"
-#include "PrimitiveObject.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-
-const Type Stg_PrimitiveObject_Type = "Stg_PrimitiveObject";
-
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedChar( unsigned char value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedChar;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asUnsignedChar = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedShort( unsigned short value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedShort;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asUnsignedShort = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedInt( unsigned int value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedInt;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asUnsignedInt = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedLong( unsigned long value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedLong;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asUnsignedLong = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_Char( char value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Char;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asChar = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_Short( short value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Short;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asShort = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_Int( int value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Int;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asInt = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_Long( long value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Long;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asLong = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_Float( float value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Float;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asFloat = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-Stg_PrimitiveObject* Stg_PrimitiveObject_New_Double( double value_renamed, Name name ) {
-	/* Variables set in this function */
-	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Double;
-
-	/* 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 */
-	SizeT                             _sizeOfSelf = ZERO;
-	Type                                     type = ZERO;
-	Stg_Class_DeleteFunction*             _delete = ZERO;
-	Stg_Class_PrintFunction*               _print = ZERO;
-	Stg_Class_CopyFunction*                 _copy = ZERO;
-	AllocationType             nameAllocationType = GLOBAL;
-
-	Stg_C_Primitive v;
-	v.asDouble = value_renamed;
-	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
-	Stg_C_Primitive  value = v;
-
-	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
-}
-
-Stg_PrimitiveObject* _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_DEFARGS  )
-{
-	Stg_PrimitiveObject*  result;
-
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	_sizeOfSelf        = sizeof(Stg_PrimitiveObject);
-	type               = Stg_PrimitiveObject_Type;
-	_delete            = _Stg_PrimitiveObject_Delete;
-	_print             = _Stg_PrimitiveObject_Print;
-	_copy              = _Stg_PrimitiveObject_Copy;
-	nameAllocationType = NON_GLOBAL;
-
-	result = (Stg_PrimitiveObject*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
-	
-	_Stg_PrimitiveObject_Init( result, dataType, value );
-
-	return result;
-}
-
-void _Stg_PrimitiveObject_Init( 
-	Stg_PrimitiveObject*	self, 
-	Stg_C_Primitive_Type	dataType,
-	Stg_C_Primitive		value )
-{
-	self->dataType = dataType;
-	self->value = value;
-}
-
-
-void _Stg_PrimitiveObject_Delete( void* primitive ) {
-	_Stg_Object_Delete( primitive );
-}
-
-void _Stg_PrimitiveObject_Print( void* primitive, struct Stream* stream ) {
-	Stg_PrimitiveObject* self = (Stg_PrimitiveObject*)primitive;
-	Name typeString;
-
-	switch( self->dataType ) {
-		case Stg_C_Primitive_Type_UnsignedChar:
-			typeString = "unsigned char";
-			break;
-		case Stg_C_Primitive_Type_UnsignedShort:
-			typeString = "unsigned short";
-			break;
-		case Stg_C_Primitive_Type_UnsignedInt:
-			typeString = "unsigned int";
-			break;
-		case Stg_C_Primitive_Type_UnsignedLong:
-			typeString = "unsigned long";
-			break;
-		case Stg_C_Primitive_Type_Char:
-			typeString = "char";
-			break;
-		case Stg_C_Primitive_Type_Short:
-			typeString = "short";
-			break;
-		case Stg_C_Primitive_Type_Int:
-			typeString = "int";
-			break;
-		case Stg_C_Primitive_Type_Long:
-			typeString = "long";
-			break;
-		case Stg_C_Primitive_Type_Float:
-			typeString = "float";
-			break;
-		case Stg_C_Primitive_Type_Double:
-			typeString = "double";
-			break;
-		default:
-			typeString = "";
-			break;
-	}
-	
-	Journal_Printf( stream, "Primitive Object (ptr): %p\n", (void*)self );
-	Stream_Indent( stream );
-
-	Journal_Printf( stream, "%s %s = ", typeString, self->name );
-
-	switch ( self->dataType ) {
-		case Stg_C_Primitive_Type_UnsignedChar:
-		case Stg_C_Primitive_Type_Char: 
-			Journal_Printf( stream, "'%c'", self->value.asChar );
-			break;
-		case Stg_C_Primitive_Type_UnsignedShort:
-			Journal_Printf( stream, "%u", self->value.asUnsignedShort );
-			break;
-		case Stg_C_Primitive_Type_UnsignedInt:
-			Journal_Printf( stream, "%u", self->value.asUnsignedInt );
-			break;
-		case Stg_C_Primitive_Type_UnsignedLong:
-			Journal_Printf( stream, "%u", self->value.asUnsignedLong );
-			break;
-		case Stg_C_Primitive_Type_Short:
-			Journal_Printf( stream, "%d", self->value.asShort );
-			break;
-		case Stg_C_Primitive_Type_Int:
-			Journal_Printf( stream, "%d", self->value.asInt );
-			break;
-		case Stg_C_Primitive_Type_Long:
-			Journal_Printf( stream, "%d", self->value.asLong );
-			break;
-		case Stg_C_Primitive_Type_Float:
-			Journal_Printf( stream, "%.6ff", self->value.asFloat );
-			break;
-		case Stg_C_Primitive_Type_Double:
-			Journal_Printf( stream, "%.6f", self->value.asDouble );
-			break;
-		default:
-			break;
-	}
-	Journal_Printf( stream, ";\n" );
-	
-	Stream_UnIndent( stream );
-}
-
-void* _Stg_PrimitiveObject_Copy( const void* primitive, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stg_PrimitiveObject* self = (Stg_PrimitiveObject*)primitive;
-	Stg_PrimitiveObject* newCopy;
-
-	newCopy = (Stg_PrimitiveObject*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newCopy->dataType = self->dataType;
-	newCopy->value = self->value;
-
-	return newCopy;
-}
-	
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/PrimitiveObject.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/PrimitiveObject.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,371 @@
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ObjectAdaptor.c 2136 2004-09-30 02:47:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include "types.h"
+#include "forwardDecl.h"
+
+#include "Memory.h"
+#include "Class.h"
+#include "Object.h"
+#include "PrimitiveObject.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+
+const Type Stg_PrimitiveObject_Type = "Stg_PrimitiveObject";
+
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedChar( unsigned char value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedChar;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asUnsignedChar = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedShort( unsigned short value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedShort;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asUnsignedShort = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedInt( unsigned int value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedInt;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asUnsignedInt = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_UnsignedLong( unsigned long value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_UnsignedLong;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asUnsignedLong = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_Char( char value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Char;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asChar = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_Short( short value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Short;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asShort = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_Int( int value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Int;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asInt = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_Long( long value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Long;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asLong = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_Float( float value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Float;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asFloat = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+Stg_PrimitiveObject* Stg_PrimitiveObject_New_Double( double value_renamed, Name name ) {
+	/* Variables set in this function */
+	Stg_C_Primitive_Type  dataType = Stg_C_Primitive_Type_Double;
+
+	/* 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 */
+	SizeT                             _sizeOfSelf = ZERO;
+	Type                                     type = ZERO;
+	Stg_Class_DeleteFunction*             _delete = ZERO;
+	Stg_Class_PrintFunction*               _print = ZERO;
+	Stg_Class_CopyFunction*                 _copy = ZERO;
+	AllocationType             nameAllocationType = GLOBAL;
+
+	Stg_C_Primitive v;
+	v.asDouble = value_renamed;
+	/* The following terms are parameters that have been passed into or defined in this function but are being set before being passed onto the parent */
+	Stg_C_Primitive  value = v;
+
+	return _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_PASSARGS  );
+}
+
+Stg_PrimitiveObject* _Stg_PrimitiveObject_New(  STG_PRIMITIVEOBJECT_DEFARGS  )
+{
+	Stg_PrimitiveObject*  result;
+
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	_sizeOfSelf        = sizeof(Stg_PrimitiveObject);
+	type               = Stg_PrimitiveObject_Type;
+	_delete            = _Stg_PrimitiveObject_Delete;
+	_print             = _Stg_PrimitiveObject_Print;
+	_copy              = _Stg_PrimitiveObject_Copy;
+	nameAllocationType = NON_GLOBAL;
+
+	result = (Stg_PrimitiveObject*)_Stg_Object_New(  STG_OBJECT_PASSARGS  );
+	
+	_Stg_PrimitiveObject_Init( result, dataType, value );
+
+	return result;
+}
+
+void _Stg_PrimitiveObject_Init( 
+	Stg_PrimitiveObject*	self, 
+	Stg_C_Primitive_Type	dataType,
+	Stg_C_Primitive		value )
+{
+	self->dataType = dataType;
+	self->value = value;
+}
+
+
+void _Stg_PrimitiveObject_Delete( void* primitive ) {
+	_Stg_Object_Delete( primitive );
+}
+
+void _Stg_PrimitiveObject_Print( void* primitive, struct Stream* stream ) {
+	Stg_PrimitiveObject* self = (Stg_PrimitiveObject*)primitive;
+	Name typeString;
+
+	switch( self->dataType ) {
+		case Stg_C_Primitive_Type_UnsignedChar:
+			typeString = "unsigned char";
+			break;
+		case Stg_C_Primitive_Type_UnsignedShort:
+			typeString = "unsigned short";
+			break;
+		case Stg_C_Primitive_Type_UnsignedInt:
+			typeString = "unsigned int";
+			break;
+		case Stg_C_Primitive_Type_UnsignedLong:
+			typeString = "unsigned long";
+			break;
+		case Stg_C_Primitive_Type_Char:
+			typeString = "char";
+			break;
+		case Stg_C_Primitive_Type_Short:
+			typeString = "short";
+			break;
+		case Stg_C_Primitive_Type_Int:
+			typeString = "int";
+			break;
+		case Stg_C_Primitive_Type_Long:
+			typeString = "long";
+			break;
+		case Stg_C_Primitive_Type_Float:
+			typeString = "float";
+			break;
+		case Stg_C_Primitive_Type_Double:
+			typeString = "double";
+			break;
+		default:
+			typeString = "";
+			break;
+	}
+	
+	Journal_Printf( stream, "Primitive Object (ptr): %p\n", (void*)self );
+	Stream_Indent( stream );
+
+	Journal_Printf( stream, "%s %s = ", typeString, self->name );
+
+	switch ( self->dataType ) {
+		case Stg_C_Primitive_Type_UnsignedChar:
+		case Stg_C_Primitive_Type_Char: 
+			Journal_Printf( stream, "'%c'", self->value.asChar );
+			break;
+		case Stg_C_Primitive_Type_UnsignedShort:
+			Journal_Printf( stream, "%u", self->value.asUnsignedShort );
+			break;
+		case Stg_C_Primitive_Type_UnsignedInt:
+			Journal_Printf( stream, "%u", self->value.asUnsignedInt );
+			break;
+		case Stg_C_Primitive_Type_UnsignedLong:
+			Journal_Printf( stream, "%u", self->value.asUnsignedLong );
+			break;
+		case Stg_C_Primitive_Type_Short:
+			Journal_Printf( stream, "%d", self->value.asShort );
+			break;
+		case Stg_C_Primitive_Type_Int:
+			Journal_Printf( stream, "%d", self->value.asInt );
+			break;
+		case Stg_C_Primitive_Type_Long:
+			Journal_Printf( stream, "%d", self->value.asLong );
+			break;
+		case Stg_C_Primitive_Type_Float:
+			Journal_Printf( stream, "%.6ff", self->value.asFloat );
+			break;
+		case Stg_C_Primitive_Type_Double:
+			Journal_Printf( stream, "%.6f", self->value.asDouble );
+			break;
+		default:
+			break;
+	}
+	Journal_Printf( stream, ";\n" );
+	
+	Stream_UnIndent( stream );
+}
+
+void* _Stg_PrimitiveObject_Copy( const void* primitive, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stg_PrimitiveObject* self = (Stg_PrimitiveObject*)primitive;
+	Stg_PrimitiveObject* newCopy;
+
+	newCopy = (Stg_PrimitiveObject*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newCopy->dataType = self->dataType;
+	newCopy->value = self->value;
+
+	return newCopy;
+}
+	
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/TestSuite.c
--- a/Base/Foundation/src/TestSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: TestSuite.c 3584 2006-05-16 11:11:07Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <mpi.h>
-
-#include "types.h"
-#include "shortcuts.h"
-#include "forwardDecl.h"
-#include "debug.h"
-#include "MemoryTag.h"
-#include "Memory.h"
-#include "Class.h"
-#include "TestSuite.h"
-
-
-/* Textual name of this class */
-const Type TestSuite_Type = "TestSuite";
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-
-TestSuite* TestSuite_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(TestSuite);
-	Type                              type = TestSuite_Type;
-	Stg_Class_DeleteFunction*      _delete = _TestSuite_Delete;
-	Stg_Class_PrintFunction*        _print = _TestSuite_Print;
-	Stg_Class_CopyFunction*          _copy = _TestSuite_Copy;
-
-	return _TestSuite_New(  TESTSUITE_PASSARGS  );
-}
-
-TestSuite* _TestSuite_New(  TESTSUITE_DEFARGS  ) {
-	TestSuite* self;
-
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(TestSuite) );
-	self = (TestSuite*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-
-	/* Virtual info */
-
-	/* TestSuite info */
-	_TestSuite_Init( self );
-
-	return self;
-}
-
-void _TestSuite_Init( TestSuite* self ) {
-	assert( self );
-
-	insist( MPI_Comm_size( MPI_COMM_WORLD, &self->nProcs ), == MPI_SUCCESS );
-	insist( MPI_Comm_rank( MPI_COMM_WORLD, &self->rank ), == MPI_SUCCESS );
-	self->nTests = 0;
-	self->tests = NULL;
-}
-
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _TestSuite_Delete( void* testSuite ) {
-	TestSuite*	self = (TestSuite*)testSuite;
-
-	assert( self );
-
-	TestSuite_Destruct( self );
-
-	/* Delete the parent. */
-	_Stg_Class_Delete( self );
-}
-
-void _TestSuite_Print( void* testSuite, struct Stream* stream ) {
-	TestSuite*	self = (TestSuite*)testSuite;
-
-	/* Print parent */
-	Journal_Printf( stream, "TestSuite (ptr): (%p)\n", self );
-	_Stg_Class_Print( self, stream );
-}
-
-void* _TestSuite_Copy( const void* testSuite, void* destProc_I, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-#if 0
-	TestSuite*	self = (TestSuite*)testSuite;
-	TestSuite*	newTestSuite;
-	PtrMap*	map = ptrMap;
-	Bool	ownMap = False;
-
-	/* Damn me for making copying so difficult... what was I thinking? */
-	
-	/* We need to create a map if it doesn't already exist. */
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newTestSuite = (TestSuite*)_Mesh_Copy( self, destProc_I, deep, nameExt, map );
-	
-	/* Copy the virtual methods here. */
-
-	/* Deep or shallow? */
-	if( deep ) {
-	}
-	else {
-	}
-	
-	/* If we own the map, get rid of it here. */
-	if( ownMap ) Stg_Class_Delete( map );
-	
-	return (void*)newTestSuite;
-#endif
-
-	return NULL;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void TestSuite_SetTests( void* testSuite, unsigned nTests, TestSuite_Test* tests ) {
-	TestSuite*	self = (TestSuite*)testSuite;
-
-	assert( self );
-	assert( !nTests || tests );
-
-	TestSuite_Destruct( self );
-
-	self->nTests = nTests;
-	if( nTests ) {
-		self->tests = Memory_Alloc_Array( TestSuite_Test, nTests, "TestSuite::tests" );
-		memcpy( self->tests, tests, nTests * sizeof(TestSuite_Test) );
-	}
-}
-
-void TestSuite_Run( void* testSuite ) {
-	TestSuite*	self = (TestSuite*)testSuite;
-	unsigned	t_i;
-
-	assert( self );
-
-	for( t_i = 0; t_i < self->nTests; t_i++ ) {
-		TestSuite_Test*	test = self->tests + t_i;
-		Bool		result;
-
-		assert( test );
-		assert( test->name );
-		assert( test->func );
-
-		if( !self->rank )
-			printf( "   Running test '%s'... ", test->name );
-		result = test->func( self );
-		if( !self->rank )
-			printf( "%s\n", result ? "passed" : "failed" );
-		insist( MPI_Barrier( MPI_COMM_WORLD ), == MPI_SUCCESS );
-	}
-}
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-
-void TestSuite_Destruct( TestSuite* self ) {
-	assert( self );
-
-	self->nTests = 0;
-	KillArray( self->tests );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/TestSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/TestSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,201 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: TestSuite.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mpi.h>
+
+#include "types.h"
+#include "shortcuts.h"
+#include "forwardDecl.h"
+#include "debug.h"
+#include "MemoryTag.h"
+#include "Memory.h"
+#include "Class.h"
+#include "TestSuite.h"
+
+
+/* Textual name of this class */
+const Type TestSuite_Type = "TestSuite";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+TestSuite* TestSuite_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(TestSuite);
+	Type                              type = TestSuite_Type;
+	Stg_Class_DeleteFunction*      _delete = _TestSuite_Delete;
+	Stg_Class_PrintFunction*        _print = _TestSuite_Print;
+	Stg_Class_CopyFunction*          _copy = _TestSuite_Copy;
+
+	return _TestSuite_New(  TESTSUITE_PASSARGS  );
+}
+
+TestSuite* _TestSuite_New(  TESTSUITE_DEFARGS  ) {
+	TestSuite* self;
+
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(TestSuite) );
+	self = (TestSuite*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+
+	/* Virtual info */
+
+	/* TestSuite info */
+	_TestSuite_Init( self );
+
+	return self;
+}
+
+void _TestSuite_Init( TestSuite* self ) {
+	assert( self );
+
+	insist( MPI_Comm_size( MPI_COMM_WORLD, &self->nProcs ), == MPI_SUCCESS );
+	insist( MPI_Comm_rank( MPI_COMM_WORLD, &self->rank ), == MPI_SUCCESS );
+	self->nTests = 0;
+	self->tests = NULL;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _TestSuite_Delete( void* testSuite ) {
+	TestSuite*	self = (TestSuite*)testSuite;
+
+	assert( self );
+
+	TestSuite_Destruct( self );
+
+	/* Delete the parent. */
+	_Stg_Class_Delete( self );
+}
+
+void _TestSuite_Print( void* testSuite, struct Stream* stream ) {
+	TestSuite*	self = (TestSuite*)testSuite;
+
+	/* Print parent */
+	Journal_Printf( stream, "TestSuite (ptr): (%p)\n", self );
+	_Stg_Class_Print( self, stream );
+}
+
+void* _TestSuite_Copy( const void* testSuite, void* destProc_I, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+#if 0
+	TestSuite*	self = (TestSuite*)testSuite;
+	TestSuite*	newTestSuite;
+	PtrMap*	map = ptrMap;
+	Bool	ownMap = False;
+
+	/* Damn me for making copying so difficult... what was I thinking? */
+	
+	/* We need to create a map if it doesn't already exist. */
+	if( !map ) {
+		map = PtrMap_New( 10 );
+		ownMap = True;
+	}
+	
+	newTestSuite = (TestSuite*)_Mesh_Copy( self, destProc_I, deep, nameExt, map );
+	
+	/* Copy the virtual methods here. */
+
+	/* Deep or shallow? */
+	if( deep ) {
+	}
+	else {
+	}
+	
+	/* If we own the map, get rid of it here. */
+	if( ownMap ) Stg_Class_Delete( map );
+	
+	return (void*)newTestSuite;
+#endif
+
+	return NULL;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void TestSuite_SetTests( void* testSuite, unsigned nTests, TestSuite_Test* tests ) {
+	TestSuite*	self = (TestSuite*)testSuite;
+
+	assert( self );
+	assert( !nTests || tests );
+
+	TestSuite_Destruct( self );
+
+	self->nTests = nTests;
+	if( nTests ) {
+		self->tests = Memory_Alloc_Array( TestSuite_Test, nTests, "TestSuite::tests" );
+		memcpy( self->tests, tests, nTests * sizeof(TestSuite_Test) );
+	}
+}
+
+void TestSuite_Run( void* testSuite ) {
+	TestSuite*	self = (TestSuite*)testSuite;
+	unsigned	t_i;
+
+	assert( self );
+
+	for( t_i = 0; t_i < self->nTests; t_i++ ) {
+		TestSuite_Test*	test = self->tests + t_i;
+		Bool		result;
+
+		assert( test );
+		assert( test->name );
+		assert( test->func );
+
+		if( !self->rank )
+			printf( "   Running test '%s'... ", test->name );
+		result = test->func( self );
+		if( !self->rank )
+			printf( "%s\n", result ? "passed" : "failed" );
+		insist( MPI_Barrier( MPI_COMM_WORLD ), == MPI_SUCCESS );
+	}
+}
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+
+void TestSuite_Destruct( TestSuite* self ) {
+	assert( self );
+
+	self->nTests = 0;
+	KillArray( self->tests );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/TimeMonitor.c
--- a/Base/Foundation/src/TimeMonitor.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: TimeMonitor.c 3157 2005-08-07 23:43:05Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-
-#include "types.h"
-#include "shortcuts.h"
-#include "forwardDecl.h"
-#include "MemoryPointer.h"
-#include "MemoryField.h"
-#include "Memory.h"
-#include "TimeMonitor.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#define Stg_TimeMonitor_t0_ZERO_CONDITION (-1.0)
-
-double Stg_TimeMonitor_t0 = Stg_TimeMonitor_t0_ZERO_CONDITION;
-double Stg_TimerWatchCriteria;
-
-const Type Stg_TimeMonitor_Type = "Stg_TimeMonitor";
-const Type Stg_TimeMonitor_InfoStreamName = "TimeMonitor";
-const Type Stg_TimeMonitor_TagType = "Stg_TimeMonitor_Tag";
-
-void Stg_TimeMonitor_Initialise() {
-	Stg_TimeMonitor_t0 = MPI_Wtime();
-	Stg_TimerWatchCriteria = 0.2;
-}
-void Stg_TimeMonitor_Finalise() {
-
-}
-void Stg_TimeMonitor_SetTimerWatchCriteria( double ratioOfTotalTime ) {
-	Stg_TimerWatchCriteria = ratioOfTotalTime;
-}
-
-Stg_TimeMonitor* Stg_TimeMonitor_New( Name tag, Bool criteria, Bool print, MPI_Comm comm ) {
-	Stg_TimeMonitor* tm;
-	
-	tm = Memory_Alloc_Unnamed( Stg_TimeMonitor );
-	tm->tag = (char*)Memory_Alloc_Bytes_Unnamed( strlen( tag ) + 1, Stg_TimeMonitor_TagType );
-	strcpy( tm->tag, tag );
-	tm->criteria = criteria;
-	tm->print = print;
-	tm->comm = comm;
-	
-	return tm;
-}
-
-void Stg_TimeMonitor_Delete( Stg_TimeMonitor* tm ) {
-	if( tm->tag ) {
-		Memory_Free( tm->tag );
-	}
-	
-	Memory_Free( tm );
-}
-
-void Stg_TimeMonitor_Begin( Stg_TimeMonitor* tm ) {
-	Journal_Firewall(
-		Stg_TimeMonitor_t0 > Stg_TimeMonitor_t0_ZERO_CONDITION,
-		Journal_Register( Error_Type, Stg_TimeMonitor_Type ),
-		"Time monitor used but not initialised!\n" );
-	
-	tm->t1 = MPI_Wtime();
-	tm->t2 = tm->t1;	
-}
-
-
-double Stg_TimeMonitor_End( Stg_TimeMonitor* tm, TimeMonitorData* tmData ) {
-	int      rank;
-	int      nProc;
-
-	tm->t2 = MPI_Wtime();
-
-	tmData->dt = tm->t2 - tm->t1;
-	tmData->totalSinceInit = tm->t2 - Stg_TimeMonitor_t0;
-
-	/* Note: maybe Stg_Components should store rank and comm??? how do the find their comm? */
-	MPI_Comm_rank( tm->comm, &rank );
-	MPI_Comm_size( tm->comm, &nProc );
-
-	if ( nProc == 1 ) {
-		tmData->maxProcDt = tmData->dt;
-		tmData->minProcDt = tmData->dt;
-		tmData->aveProcDt = tmData->dt;
-	}
-	else {
-		double   sumdt;
-
-		/*
-		MPI_Reduce( &tmData->dt, &tmData->maxProcDt, 1, MPI_DOUBLE, MPI_MAX, 0, tm->comm );
-		MPI_Reduce( &tmData->dt, &tmData->minProcDt, 1, MPI_DOUBLE, MPI_MIN, 0, tm->comm );
-		MPI_Allreduce( &tmData->dt, &sumdt, 1, MPI_DOUBLE, MPI_SUM, tm->comm );
-		avedt = sumdt / size;
-		*/
-		/* Note: Above is commented out because cannot use MPI_Reduce functions unless we are sure
-		 * that ALL procs will call end(). This is currently not the case with Stg_Component_Initialise()
-		 * phase as some procs will have more/less variables to call Initialise() on via Variable_Condition
-		 * due to decomposition and Wall boundary conditions */
-		sumdt = tmData->dt * nProc;
-		tmData->maxProcDt = tmData->dt;
-		tmData->minProcDt = tmData->dt;
-		tmData->aveProcDt = (double)tmData->dt;
-	}
-
-	tmData->percentTM_ofTotal = tmData->aveProcDt / tmData->totalSinceInit * 100;
-
-
-	tmData->criterionPassed = False;
-	if ( tm->criteria ) {
-          tmData->criterionPassed = tm->t2 > (Stg_TimerWatchCriteria * tmData->totalSinceInit) ? True : False;
-	}
-
-	if( tm->print && (rank == 0) && ((tm->criteria == False) || tmData->criterionPassed )) {
-		if ( nProc == 1 ) {
-			Journal_Printf( 
-				Journal_Register( Info_Type, Stg_TimeMonitor_InfoStreamName ),
-				"\t%s(%s):  curr sim time=%.2g (secs), dt= %.2gs (%.2g%% of total)\n", 
-				Stg_TimeMonitor_InfoStreamName,
-				tm->tag,
-				tmData->totalSinceInit,
-				tmData->aveProcDt,
-				tmData->percentTM_ofTotal );
-		}
-		else {
-			Journal_Printf( 
-				Journal_Register( Info_Type, Stg_TimeMonitor_InfoStreamName ),
-				"\t%s(%s):  curr sim time=%.2g (secs), ave dt/proc= %.2gs (%.2g%% of total)\n"
-				"\t\t(individual proc time spent min/max = %.2g/%.2gs)\n", 
-				Stg_TimeMonitor_InfoStreamName,
-				tm->tag,
-				tmData->totalSinceInit,
-				tmData->aveProcDt,
-				tmData->percentTM_ofTotal,
-				tmData->maxProcDt,
-				tmData->minProcDt);
-		}
-	}
-	
-	return tmData->aveProcDt;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/TimeMonitor.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/TimeMonitor.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,173 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: TimeMonitor.c 3157 2005-08-07 23:43:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+
+#include "types.h"
+#include "shortcuts.h"
+#include "forwardDecl.h"
+#include "MemoryPointer.h"
+#include "MemoryField.h"
+#include "Memory.h"
+#include "TimeMonitor.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#define Stg_TimeMonitor_t0_ZERO_CONDITION (-1.0)
+
+double Stg_TimeMonitor_t0 = Stg_TimeMonitor_t0_ZERO_CONDITION;
+double Stg_TimerWatchCriteria;
+
+const Type Stg_TimeMonitor_Type = "Stg_TimeMonitor";
+const Type Stg_TimeMonitor_InfoStreamName = "TimeMonitor";
+const Type Stg_TimeMonitor_TagType = "Stg_TimeMonitor_Tag";
+
+void Stg_TimeMonitor_Initialise() {
+	Stg_TimeMonitor_t0 = MPI_Wtime();
+	Stg_TimerWatchCriteria = 0.2;
+}
+void Stg_TimeMonitor_Finalise() {
+
+}
+void Stg_TimeMonitor_SetTimerWatchCriteria( double ratioOfTotalTime ) {
+	Stg_TimerWatchCriteria = ratioOfTotalTime;
+}
+
+Stg_TimeMonitor* Stg_TimeMonitor_New( Name tag, Bool criteria, Bool print, MPI_Comm comm ) {
+	Stg_TimeMonitor* tm;
+	
+	tm = Memory_Alloc_Unnamed( Stg_TimeMonitor );
+	tm->tag = (char*)Memory_Alloc_Bytes_Unnamed( strlen( tag ) + 1, Stg_TimeMonitor_TagType );
+	strcpy( tm->tag, tag );
+	tm->criteria = criteria;
+	tm->print = print;
+	tm->comm = comm;
+	
+	return tm;
+}
+
+void Stg_TimeMonitor_Delete( Stg_TimeMonitor* tm ) {
+	if( tm->tag ) {
+		Memory_Free( tm->tag );
+	}
+	
+	Memory_Free( tm );
+}
+
+void Stg_TimeMonitor_Begin( Stg_TimeMonitor* tm ) {
+	Journal_Firewall(
+		Stg_TimeMonitor_t0 > Stg_TimeMonitor_t0_ZERO_CONDITION,
+		Journal_Register( Error_Type, Stg_TimeMonitor_Type ),
+		"Time monitor used but not initialised!\n" );
+	
+	tm->t1 = MPI_Wtime();
+	tm->t2 = tm->t1;	
+}
+
+
+double Stg_TimeMonitor_End( Stg_TimeMonitor* tm, TimeMonitorData* tmData ) {
+	int      rank;
+	int      nProc;
+
+	tm->t2 = MPI_Wtime();
+
+	tmData->dt = tm->t2 - tm->t1;
+	tmData->totalSinceInit = tm->t2 - Stg_TimeMonitor_t0;
+
+	/* Note: maybe Stg_Components should store rank and comm??? how do the find their comm? */
+	MPI_Comm_rank( tm->comm, &rank );
+	MPI_Comm_size( tm->comm, &nProc );
+
+	if ( nProc == 1 ) {
+		tmData->maxProcDt = tmData->dt;
+		tmData->minProcDt = tmData->dt;
+		tmData->aveProcDt = tmData->dt;
+	}
+	else {
+		double   sumdt;
+
+		/*
+		MPI_Reduce( &tmData->dt, &tmData->maxProcDt, 1, MPI_DOUBLE, MPI_MAX, 0, tm->comm );
+		MPI_Reduce( &tmData->dt, &tmData->minProcDt, 1, MPI_DOUBLE, MPI_MIN, 0, tm->comm );
+		MPI_Allreduce( &tmData->dt, &sumdt, 1, MPI_DOUBLE, MPI_SUM, tm->comm );
+		avedt = sumdt / size;
+		*/
+		/* Note: Above is commented out because cannot use MPI_Reduce functions unless we are sure
+		 * that ALL procs will call end(). This is currently not the case with Stg_Component_Initialise()
+		 * phase as some procs will have more/less variables to call Initialise() on via Variable_Condition
+		 * due to decomposition and Wall boundary conditions */
+		sumdt = tmData->dt * nProc;
+		tmData->maxProcDt = tmData->dt;
+		tmData->minProcDt = tmData->dt;
+		tmData->aveProcDt = (double)tmData->dt;
+	}
+
+	tmData->percentTM_ofTotal = tmData->aveProcDt / tmData->totalSinceInit * 100;
+
+
+	tmData->criterionPassed = False;
+	if ( tm->criteria ) {
+          tmData->criterionPassed = tm->t2 > (Stg_TimerWatchCriteria * tmData->totalSinceInit) ? True : False;
+	}
+
+	if( tm->print && (rank == 0) && ((tm->criteria == False) || tmData->criterionPassed )) {
+		if ( nProc == 1 ) {
+			Journal_Printf( 
+				Journal_Register( Info_Type, Stg_TimeMonitor_InfoStreamName ),
+				"\t%s(%s):  curr sim time=%.2g (secs), dt= %.2gs (%.2g%% of total)\n", 
+				Stg_TimeMonitor_InfoStreamName,
+				tm->tag,
+				tmData->totalSinceInit,
+				tmData->aveProcDt,
+				tmData->percentTM_ofTotal );
+		}
+		else {
+			Journal_Printf( 
+				Journal_Register( Info_Type, Stg_TimeMonitor_InfoStreamName ),
+				"\t%s(%s):  curr sim time=%.2g (secs), ave dt/proc= %.2gs (%.2g%% of total)\n"
+				"\t\t(individual proc time spent min/max = %.2g/%.2gs)\n", 
+				Stg_TimeMonitor_InfoStreamName,
+				tm->tag,
+				tmData->totalSinceInit,
+				tmData->aveProcDt,
+				tmData->percentTM_ofTotal,
+				tmData->maxProcDt,
+				tmData->minProcDt);
+		}
+	}
+	
+	return tmData->aveProcDt;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/debug.c
--- a/Base/Foundation/src/debug.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: debug.c 3803 2006-09-27 03:17:12Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "debug.h"
-
-
-Bool	assert_jmpEnabled = False;
-jmp_buf	assert_env;
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/src/debug.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/src/debug.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,37 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: debug.c 3803 2006-09-27 03:17:12Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "debug.h"
+
+
+Bool	assert_jmpEnabled = False;
+jmp_buf	assert_env;
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/CommonRoutinesSuite.c
--- a/Base/Foundation/tests/CommonRoutinesSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testCommonRoutines.c 3706 2006-07-25 02:19:37Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "CommonRoutinesSuite.h"
-
-#define N_TEST_VALUES 7
-
-typedef struct {
-   Index  nTestValues;
-   double testValues[N_TEST_VALUES];
-   double tolerances[N_TEST_VALUES];
-} CommonRoutinesSuiteData;
-
-
-void CommonRoutinesSuite_Setup( CommonRoutinesSuiteData* data ) {
-   data->nTestValues = 7;
-   data->testValues[0] = 0.0;
-   data->testValues[1] = 3.4562e-30;
-   data->testValues[2] = 9.7324;
-   data->testValues[3] = 97.654;
-   data->testValues[4] = 104.321;
-   data->testValues[5] = -13762.1;
-   data->testValues[6] = 0.0043253;
-   data->tolerances[0] = 1e-40;
-   data->tolerances[1] = 1e-40;
-   data->tolerances[2] = 1e-12;
-   data->tolerances[3] = 1e-12;
-   data->tolerances[4] = 1e-12;
-   data->tolerances[5] = 1e-12;
-   data->tolerances[6] = 1e-12;
-}
-
-
-void CommonRoutinesSuite_Teardown( CommonRoutinesSuiteData* data ) {
-}
-
-
-void CommonRoutinesSuite_TestLMS( CommonRoutinesSuiteData* data ) {
-   pcu_check_true( 1 == Stg_LongestMatchingSubsequenceLength( (char *)"Acrobat", (char *)"BOAT", True )  );
-   pcu_check_true( 6 == Stg_LongestMatchingSubsequenceLength( (char *)"Abracadabra", (char *)"Yabbadabbadoo", True )  );
-   pcu_check_true( 7 == Stg_LongestMatchingSubsequenceLength( (char *)"Abracadabra", (char *)"Yabbadabbadoo", False )  );
-   pcu_check_true( 6 == Stg_LongestMatchingSubsequenceLength( (char *)"Python", (char *)"PythonShape", False ) );
-}
-
-
-void CommonRoutinesSuite_TestStringIsNumeric( CommonRoutinesSuiteData* data ) {
-   pcu_check_true( False == Stg_StringIsNumeric( (char *)"nan" ) );
-   pcu_check_true( True == Stg_StringIsNumeric( "567" ) );
-   pcu_check_true( True == Stg_StringIsNumeric( "1.0e90" ) );
-   pcu_check_true( False ==  Stg_StringIsNumeric( "1e90e80" ) );
-   pcu_check_true( False == Stg_StringIsNumeric(".asdfasdf" ) );
-   pcu_check_true( True == Stg_StringIsNumeric(".0032" ) );
-   pcu_check_true( False == Stg_StringIsNumeric(".0032.00" ) );
-}
- 
-  
-void CommonRoutinesSuite_TestStringIsEmpty( CommonRoutinesSuiteData* data ) {
-   pcu_check_true( True  == Stg_StringIsEmpty( (char *)"\t \n" ) );
-   pcu_check_true( False == Stg_StringIsEmpty( "asdf" ) );
-   pcu_check_true( True  == Stg_StringIsEmpty( "    " ) );
-   pcu_check_true( True  == Stg_StringIsEmpty( "    \n" ) );
-   pcu_check_true( False == Stg_StringIsEmpty( "  sdf  \n" ) );
-}
-
-
-void CommonRoutinesSuite_TestStG_RoundDoubleToNDecimalPlaces( CommonRoutinesSuiteData* data    ) {
-   double roundedValue;
-   double errorMargin;
-   Index testValue_I;
-   Index nDecPlaces;
-   double expectedRoundedToDecPlaces[7][4] = {
-      { 0.0, 0.0, 0.0, 0.0 },
-      { 0.0, 0.0, 0.0, 0.0 },
-      { 10., 9.7, 9.73, 9.732 },
-      { 98., 97.7, 97.65, 97.654 },
-      { 104., 104.3, 104.32, 104.321 },
-      { -13762., -13762.1, -13762.10, -13762.100 },
-      { 0.,    0.0, 0.00, 0.004 } };
-
-   for ( testValue_I = 0; testValue_I < data->nTestValues; testValue_I++ ) {
-      for ( nDecPlaces = 0; nDecPlaces <=3; nDecPlaces++ ) {
-         roundedValue = StG_RoundDoubleToNDecimalPlaces(
-            data->testValues[testValue_I], nDecPlaces );
-         errorMargin = fabs( roundedValue -
-            expectedRoundedToDecPlaces[testValue_I][nDecPlaces] );
-
-         pcu_check_le( errorMargin, data->tolerances[testValue_I] );
-      }
-   }
-}
-
-
-void CommonRoutinesSuite_TestStG_RoundDoubleToNSigFigs( CommonRoutinesSuiteData* data ) {
-   double roundedValue;
-   double errorMargin;
-   Index testValue_I;
-   Index nSigFigs;
-   double expectedRoundedToSigFigs[7][4] = {
-      { 0.0, 0.0, 0.0, 0.0 },
-      { 0.0, 3e-30, 3.5e-30, 3.46e-30 },
-      { 0., 10, 9.7, 9.73 },
-      { 0., 100, 98, 97.7 },
-      { 0., 100, 100, 104 },
-      { 0., -10000, -14000, -13800 },
-      { 0., 0.004, 0.0043, 0.00433 } };
-
-   for ( testValue_I = 0; testValue_I < data->nTestValues; testValue_I++ ) {
-      for ( nSigFigs = 1; nSigFigs <=3; nSigFigs++ ) {
-         roundedValue = StG_RoundDoubleToNSigFigs(
-            data->testValues[testValue_I], nSigFigs );
-         errorMargin = fabs( roundedValue -
-            expectedRoundedToSigFigs[testValue_I][nSigFigs] );
-         pcu_check_le( errorMargin, data->tolerances[testValue_I] );
-      }
-   }
-}
-
-
-void CommonRoutinesSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, CommonRoutinesSuiteData );
-   pcu_suite_setFixtures( suite, CommonRoutinesSuite_Setup, CommonRoutinesSuite_Teardown );
-   pcu_suite_addTest( suite, CommonRoutinesSuite_TestLMS );
-   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStringIsNumeric );
-   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStringIsEmpty );
-   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStG_RoundDoubleToNDecimalPlaces );
-   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStG_RoundDoubleToNSigFigs );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/CommonRoutinesSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/CommonRoutinesSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,165 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testCommonRoutines.c 3706 2006-07-25 02:19:37Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "CommonRoutinesSuite.h"
+
+#define N_TEST_VALUES 7
+
+typedef struct {
+   Index  nTestValues;
+   double testValues[N_TEST_VALUES];
+   double tolerances[N_TEST_VALUES];
+} CommonRoutinesSuiteData;
+
+
+void CommonRoutinesSuite_Setup( CommonRoutinesSuiteData* data ) {
+   data->nTestValues = 7;
+   data->testValues[0] = 0.0;
+   data->testValues[1] = 3.4562e-30;
+   data->testValues[2] = 9.7324;
+   data->testValues[3] = 97.654;
+   data->testValues[4] = 104.321;
+   data->testValues[5] = -13762.1;
+   data->testValues[6] = 0.0043253;
+   data->tolerances[0] = 1e-40;
+   data->tolerances[1] = 1e-40;
+   data->tolerances[2] = 1e-12;
+   data->tolerances[3] = 1e-12;
+   data->tolerances[4] = 1e-12;
+   data->tolerances[5] = 1e-12;
+   data->tolerances[6] = 1e-12;
+}
+
+
+void CommonRoutinesSuite_Teardown( CommonRoutinesSuiteData* data ) {
+}
+
+
+void CommonRoutinesSuite_TestLMS( CommonRoutinesSuiteData* data ) {
+   pcu_check_true( 1 == Stg_LongestMatchingSubsequenceLength( (char *)"Acrobat", (char *)"BOAT", True )  );
+   pcu_check_true( 6 == Stg_LongestMatchingSubsequenceLength( (char *)"Abracadabra", (char *)"Yabbadabbadoo", True )  );
+   pcu_check_true( 7 == Stg_LongestMatchingSubsequenceLength( (char *)"Abracadabra", (char *)"Yabbadabbadoo", False )  );
+   pcu_check_true( 6 == Stg_LongestMatchingSubsequenceLength( (char *)"Python", (char *)"PythonShape", False ) );
+}
+
+
+void CommonRoutinesSuite_TestStringIsNumeric( CommonRoutinesSuiteData* data ) {
+   pcu_check_true( False == Stg_StringIsNumeric( (char *)"nan" ) );
+   pcu_check_true( True == Stg_StringIsNumeric( "567" ) );
+   pcu_check_true( True == Stg_StringIsNumeric( "1.0e90" ) );
+   pcu_check_true( False ==  Stg_StringIsNumeric( "1e90e80" ) );
+   pcu_check_true( False == Stg_StringIsNumeric(".asdfasdf" ) );
+   pcu_check_true( True == Stg_StringIsNumeric(".0032" ) );
+   pcu_check_true( False == Stg_StringIsNumeric(".0032.00" ) );
+}
+ 
+  
+void CommonRoutinesSuite_TestStringIsEmpty( CommonRoutinesSuiteData* data ) {
+   pcu_check_true( True  == Stg_StringIsEmpty( (char *)"\t \n" ) );
+   pcu_check_true( False == Stg_StringIsEmpty( "asdf" ) );
+   pcu_check_true( True  == Stg_StringIsEmpty( "    " ) );
+   pcu_check_true( True  == Stg_StringIsEmpty( "    \n" ) );
+   pcu_check_true( False == Stg_StringIsEmpty( "  sdf  \n" ) );
+}
+
+
+void CommonRoutinesSuite_TestStG_RoundDoubleToNDecimalPlaces( CommonRoutinesSuiteData* data    ) {
+   double roundedValue;
+   double errorMargin;
+   Index testValue_I;
+   Index nDecPlaces;
+   double expectedRoundedToDecPlaces[7][4] = {
+      { 0.0, 0.0, 0.0, 0.0 },
+      { 0.0, 0.0, 0.0, 0.0 },
+      { 10., 9.7, 9.73, 9.732 },
+      { 98., 97.7, 97.65, 97.654 },
+      { 104., 104.3, 104.32, 104.321 },
+      { -13762., -13762.1, -13762.10, -13762.100 },
+      { 0.,    0.0, 0.00, 0.004 } };
+
+   for ( testValue_I = 0; testValue_I < data->nTestValues; testValue_I++ ) {
+      for ( nDecPlaces = 0; nDecPlaces <=3; nDecPlaces++ ) {
+         roundedValue = StG_RoundDoubleToNDecimalPlaces(
+            data->testValues[testValue_I], nDecPlaces );
+         errorMargin = fabs( roundedValue -
+            expectedRoundedToDecPlaces[testValue_I][nDecPlaces] );
+
+         pcu_check_le( errorMargin, data->tolerances[testValue_I] );
+      }
+   }
+}
+
+
+void CommonRoutinesSuite_TestStG_RoundDoubleToNSigFigs( CommonRoutinesSuiteData* data ) {
+   double roundedValue;
+   double errorMargin;
+   Index testValue_I;
+   Index nSigFigs;
+   double expectedRoundedToSigFigs[7][4] = {
+      { 0.0, 0.0, 0.0, 0.0 },
+      { 0.0, 3e-30, 3.5e-30, 3.46e-30 },
+      { 0., 10, 9.7, 9.73 },
+      { 0., 100, 98, 97.7 },
+      { 0., 100, 100, 104 },
+      { 0., -10000, -14000, -13800 },
+      { 0., 0.004, 0.0043, 0.00433 } };
+
+   for ( testValue_I = 0; testValue_I < data->nTestValues; testValue_I++ ) {
+      for ( nSigFigs = 1; nSigFigs <=3; nSigFigs++ ) {
+         roundedValue = StG_RoundDoubleToNSigFigs(
+            data->testValues[testValue_I], nSigFigs );
+         errorMargin = fabs( roundedValue -
+            expectedRoundedToSigFigs[testValue_I][nSigFigs] );
+         pcu_check_le( errorMargin, data->tolerances[testValue_I] );
+      }
+   }
+}
+
+
+void CommonRoutinesSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, CommonRoutinesSuiteData );
+   pcu_suite_setFixtures( suite, CommonRoutinesSuite_Setup, CommonRoutinesSuite_Teardown );
+   pcu_suite_addTest( suite, CommonRoutinesSuite_TestLMS );
+   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStringIsNumeric );
+   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStringIsEmpty );
+   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStG_RoundDoubleToNDecimalPlaces );
+   pcu_suite_addTest( suite, CommonRoutinesSuite_TestStG_RoundDoubleToNSigFigs );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/MemMonitorSuite.c
--- a/Base/Foundation/tests/MemMonitorSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests accuracy of memory statistics generation.
-**
-** $Id: testMemory2.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h" /* For Journal stuff */
-#include "MemMonitorSuite.h"
-
-
-typedef struct {
-   Stg_MemMonitor*	mm;
-   int					rank;   
-} MemMonitorSuiteData;
-
-
-void MemMonitorSuite_Setup( MemMonitorSuiteData* data ) {
-   Journal_Enable_TypedStream( Info_Type, True );
-   Stream_Enable( Journal_Register( Info_Type, (Name)Stg_MemMonitor_InfoStreamName  ), True );
-
-   data->mm = NULL;
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-}
-
-
-void MemMonitorSuite_Teardown( MemMonitorSuiteData* data ) {
-   Stg_MemMonitor_Delete( data->mm );
-}
-
-
-void MemMonitorSuite_TestMonitor( MemMonitorSuiteData* data ) {
-   Name memoryReportOutputFilename = "./MemMonitorSuite_TestOutput.txt";
-   char*          a;
-   char*          b;
-   char*          c;
-   char*          d;
-   char*          e;
-   char*          f;
-   MemMonitorData mmData;
-   Index            totalMemAtTestStart;
-   int            expMemDiff;
-   double         expPercentChange;
-   Bool           expCritResult = False;
-   
-   Stg_MemMonitor_SetMemoryWatchCriteria( 0.2 );
-   if (data->rank==0) {
-      Stream_RedirectFile( Journal_Register( Info_Type, (Name)Stg_MemMonitor_InfoStreamName  ), memoryReportOutputFilename );
-   }
-
-   /* Don't create the MM until now, so we can control the total memory for testing purposes */
-   data->mm = Stg_MemMonitor_New( "test", True, True, MPI_COMM_WORLD );
-   a = Memory_Alloc_Array( char, 1024, "a" );
-
-   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
-   totalMemAtTestStart = stgMemory->types->currentAllocation;
-   Stg_MemMonitor_Begin( data->mm );
-   b = Memory_Alloc_Array( char, 1024*2, "b" );
-   Stg_MemMonitor_End( data->mm, &mmData );
-
-   expMemDiff = 1024*2;
-   pcu_check_true( mmData.memDiff == expMemDiff );
-   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
-   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
-   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
-   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
-   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
-   pcu_check_true( mmData.criterionPassed == expCritResult );
-
-   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
-   totalMemAtTestStart = stgMemory->types->currentAllocation;
-   Stg_MemMonitor_Begin( data->mm );
-   c = Memory_Alloc_Array( char, 100, "c" );
-   d = Memory_Alloc_Array( char, 100*1024, "d" );
-   Stg_MemMonitor_End( data->mm, &mmData );
-   
-   expMemDiff = 100 + 100*1024;
-   pcu_check_true( mmData.memDiff == expMemDiff );
-   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
-   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
-   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
-   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
-   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
-   pcu_check_true( mmData.criterionPassed == expCritResult );
-
-   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
-   totalMemAtTestStart = stgMemory->types->currentAllocation;
-   Stg_MemMonitor_Begin( data->mm );
-   Memory_Free( a );
-   Memory_Free( c );
-   Memory_Free( d );
-   Stg_MemMonitor_End( data->mm, &mmData );
-
-   expMemDiff = -1024 - 100 - 100*1024;
-   pcu_check_true( mmData.memDiff == expMemDiff );
-   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
-   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
-   /* Percent should be negative this time */
-   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
-   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
-   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
-   pcu_check_true( mmData.criterionPassed == expCritResult );
-
-   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
-   totalMemAtTestStart = stgMemory->types->currentAllocation;
-   Stg_MemMonitor_Begin( data->mm );
-   e = Memory_Alloc_Array( char, 10*1024, "e" );
-   f = Memory_Alloc_Array( char, 10*1024, "f" );
-   Stg_MemMonitor_End( data->mm, &mmData );
-   
-   expMemDiff = 10*1024 + 10*1024;
-   pcu_check_true( mmData.memDiff == expMemDiff );
-   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
-   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
-   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
-   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
-   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
-   pcu_check_true( mmData.criterionPassed == expCritResult );
-
-   Memory_Free( b );
-   Memory_Free( e );
-   Memory_Free( f );
-   
-   if (data->rank==0) {
-      remove( memoryReportOutputFilename );
-   }
-}
- 
-
-void MemMonitorSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MemMonitorSuiteData );
-   pcu_suite_setFixtures( suite, MemMonitorSuite_Setup, MemMonitorSuite_Teardown );
-   #ifdef MEMORY_STATS
-   pcu_suite_addTest( suite, MemMonitorSuite_TestMonitor );
-   #endif
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/MemMonitorSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/MemMonitorSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,171 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests accuracy of memory statistics generation.
+**
+** $Id: testMemory2.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h" /* For Journal stuff */
+#include "MemMonitorSuite.h"
+
+
+typedef struct {
+   Stg_MemMonitor*	mm;
+   int					rank;   
+} MemMonitorSuiteData;
+
+
+void MemMonitorSuite_Setup( MemMonitorSuiteData* data ) {
+   Journal_Enable_TypedStream( Info_Type, True );
+   Stream_Enable( Journal_Register( Info_Type, (Name)Stg_MemMonitor_InfoStreamName  ), True );
+
+   data->mm = NULL;
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+}
+
+
+void MemMonitorSuite_Teardown( MemMonitorSuiteData* data ) {
+   Stg_MemMonitor_Delete( data->mm );
+}
+
+
+void MemMonitorSuite_TestMonitor( MemMonitorSuiteData* data ) {
+   Name memoryReportOutputFilename = "./MemMonitorSuite_TestOutput.txt";
+   char*          a;
+   char*          b;
+   char*          c;
+   char*          d;
+   char*          e;
+   char*          f;
+   MemMonitorData mmData;
+   Index            totalMemAtTestStart;
+   int            expMemDiff;
+   double         expPercentChange;
+   Bool           expCritResult = False;
+   
+   Stg_MemMonitor_SetMemoryWatchCriteria( 0.2 );
+   if (data->rank==0) {
+      Stream_RedirectFile( Journal_Register( Info_Type, (Name)Stg_MemMonitor_InfoStreamName  ), memoryReportOutputFilename );
+   }
+
+   /* Don't create the MM until now, so we can control the total memory for testing purposes */
+   data->mm = Stg_MemMonitor_New( "test", True, True, MPI_COMM_WORLD );
+   a = Memory_Alloc_Array( char, 1024, "a" );
+
+   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
+   totalMemAtTestStart = stgMemory->types->currentAllocation;
+   Stg_MemMonitor_Begin( data->mm );
+   b = Memory_Alloc_Array( char, 1024*2, "b" );
+   Stg_MemMonitor_End( data->mm, &mmData );
+
+   expMemDiff = 1024*2;
+   pcu_check_true( mmData.memDiff == expMemDiff );
+   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
+   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
+   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
+   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
+   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
+   pcu_check_true( mmData.criterionPassed == expCritResult );
+
+   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
+   totalMemAtTestStart = stgMemory->types->currentAllocation;
+   Stg_MemMonitor_Begin( data->mm );
+   c = Memory_Alloc_Array( char, 100, "c" );
+   d = Memory_Alloc_Array( char, 100*1024, "d" );
+   Stg_MemMonitor_End( data->mm, &mmData );
+   
+   expMemDiff = 100 + 100*1024;
+   pcu_check_true( mmData.memDiff == expMemDiff );
+   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
+   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
+   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
+   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
+   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
+   pcu_check_true( mmData.criterionPassed == expCritResult );
+
+   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
+   totalMemAtTestStart = stgMemory->types->currentAllocation;
+   Stg_MemMonitor_Begin( data->mm );
+   Memory_Free( a );
+   Memory_Free( c );
+   Memory_Free( d );
+   Stg_MemMonitor_End( data->mm, &mmData );
+
+   expMemDiff = -1024 - 100 - 100*1024;
+   pcu_check_true( mmData.memDiff == expMemDiff );
+   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
+   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
+   /* Percent should be negative this time */
+   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
+   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
+   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
+   pcu_check_true( mmData.criterionPassed == expCritResult );
+
+   MemoryField_UpdateAsSumOfSubFields( stgMemory->types );
+   totalMemAtTestStart = stgMemory->types->currentAllocation;
+   Stg_MemMonitor_Begin( data->mm );
+   e = Memory_Alloc_Array( char, 10*1024, "e" );
+   f = Memory_Alloc_Array( char, 10*1024, "f" );
+   Stg_MemMonitor_End( data->mm, &mmData );
+   
+   expMemDiff = 10*1024 + 10*1024;
+   pcu_check_true( mmData.memDiff == expMemDiff );
+   pcu_check_true( mmData.memFinal == totalMemAtTestStart + expMemDiff );
+   pcu_check_true( mmData.avgProcMemDiff == mmData.memDiff );
+   expPercentChange = expMemDiff / (double)totalMemAtTestStart*100; 
+   pcu_check_true( fabs( expPercentChange - mmData.percentChange ) < 0.1 );
+   expCritResult = (fabs(expPercentChange/100) >= 0.2 ? True : False);
+   pcu_check_true( mmData.criterionPassed == expCritResult );
+
+   Memory_Free( b );
+   Memory_Free( e );
+   Memory_Free( f );
+   
+   if (data->rank==0) {
+      remove( memoryReportOutputFilename );
+   }
+}
+ 
+
+void MemMonitorSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MemMonitorSuiteData );
+   pcu_suite_setFixtures( suite, MemMonitorSuite_Setup, MemMonitorSuite_Teardown );
+   #ifdef MEMORY_STATS
+   pcu_suite_addTest( suite, MemMonitorSuite_TestMonitor );
+   #endif
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/MemoryReportSuite.c
--- a/Base/Foundation/tests/MemoryReportSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,575 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests accuracy of memory statistics generation.
-**
-** $Id: testMemory2.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h" /* For Journal stuff */
-#include "MemoryReportSuite.h"
-
-struct StructA
-{
-   int x;
-   float y;
-   char z;
-};
-typedef struct StructA StructA;
-
-struct StructB
-{
-   double x;
-};
-typedef struct StructB StructB;
-
-struct StructC
-{
-   char* x;
-   StructA a;
-};
-typedef struct StructC StructC;
-
-typedef struct {
-   Memory*                 savedStgMemory;
-   MemoryReport*           report;
-   int							rank;   
-   void*                   bytesObj;
-   void*                   bytesArray;
-   StructA*                object;
-   StructB*                array1d;
-   StructC**               array2d;
-   StructA***              array3d;
-   StructB****             array4d;
-   StructC*                one2d;
-   StructA*                one3d;
-   StructB*                one4d;
-   StructC**               complex2d;
-   Index**                 setup;
-   StructA***              complex3d;
-   unsigned                strA_alloc;
-   unsigned                strB_alloc;
-   unsigned                strC_alloc;
-   unsigned                bytes_alloc;
-   unsigned                index_alloc;
-   unsigned                strA_total;
-   unsigned                strB_total;
-   unsigned                strC_total;
-   unsigned                bytes_total;
-   unsigned                index_total;
-   unsigned                groupTwo_strA_alloc;
-   unsigned                groupTwo_strB_alloc;
-   unsigned                groupTwo_strC_alloc;
-   unsigned                groupTwo_strA_total;
-   unsigned                groupTwo_strB_total;
-   unsigned                groupTwo_strC_total;
-   unsigned                groupOneFunc_alloc;
-   unsigned                groupTwoFunc_alloc;
-   unsigned                groupTwoName_alloc;
-   unsigned                bytesFunc_alloc;
-   unsigned                groupOneFunc_total;
-   unsigned                groupTwoFunc_total;
-   unsigned                groupTwoName_total;
-   unsigned                bytesFunc_total;
-   unsigned                file_alloc;
-   unsigned                file_total;
-} MemoryReportSuiteData;
-
-
-void MemoryReportSuite_AllocGroupOne( MemoryReportSuiteData* data ) {
-   data->array1d = Memory_Alloc_Array( StructB, 3, "GroupOne" );
-   data->strB_alloc++;
-   data->strB_total += sizeof(StructB)*3;
-
-   data->array2d = Memory_Alloc_2DArray( StructC, 4, 5, (Name)"GroupOne" );
-   data->strC_alloc++;
-   data->strC_total += Memory_Length_2DArray( sizeof(StructC ), 4, 5 );
-
-   data->array3d = Memory_Alloc_3DArray( StructA, 2, 3, 4, (Name)"GroupOne" );
-   data->strA_alloc++;
-   data->strA_total += Memory_Length_3DArray( sizeof(StructA ), 2, 3, 4 );
-
-   data->array4d = Memory_Alloc_4DArray_Unnamed( StructB, 5, 4, 3, 2 );
-   data->strB_alloc++;
-   data->strB_total += Memory_Length_4DArray( sizeof(StructB), 5, 4, 3, 2 );
-
-   data->one2d = Memory_Alloc_2DArrayAs1D_Unnamed( StructC, 4, 2 );
-   data->strC_alloc++;
-   data->strC_total += Memory_Length_2DAs1D( sizeof(StructC), 4, 2 );
-
-   data->one3d = Memory_Alloc_3DArrayAs1D_Unnamed( StructA, 2, 2, 3 );
-   data->strA_alloc++;
-   data->strA_total += Memory_Length_3DAs1D( sizeof(StructA), 2, 2, 3 );
-
-   data->groupOneFunc_alloc = data->strA_alloc + data->strB_alloc + data->strC_alloc;
-   data->groupOneFunc_total = data->strA_total + data->strB_total + data->strC_total;
-}
-
-
-void MemoryReportSuite_AllocGroupTwo( MemoryReportSuiteData* data ) {
-   Index          x1 = 4;
-   Index          y1[] = { 1, 2, 3, 4 };
-   Index          x2 = 2;
-   Index          y2[] = { 1, 1 };
-
-   data->object = Memory_Alloc( StructA, "GroupTwo" );
-   data->strA_alloc++;
-   data->strA_total += sizeof(StructA);
-   data->groupTwo_strA_alloc++;
-   data->groupTwo_strA_total += sizeof(StructA);
-
-   data->one4d = Memory_Alloc_4DArrayAs1D( StructB, 4, 2, 3, 5, "GroupTwo" );
-   data->strB_alloc++;
-   data->strB_total += Memory_Length_4DAs1D( sizeof(StructB), 4, 2, 3, 5 );
-   data->groupTwo_strB_alloc++;
-   data->groupTwo_strB_total += Memory_Length_4DAs1D( sizeof(StructB), 4, 2, 3, 5 );
-
-   data->complex2d = Memory_Alloc_2DComplex( StructC, x1, y1, "GroupTwo" );
-   data->strC_alloc++;
-   data->strC_total += Memory_Length_2DComplex( sizeof(StructC), x1, y1 );
-   data->groupTwo_strC_alloc++;
-   data->groupTwo_strC_total += Memory_Length_2DComplex( sizeof(StructC), x1, y1 );
-
-   data->setup = Memory_Alloc_3DSetup( x2, y2 );
-   data->index_alloc++;
-   data->index_total += Memory_Length_2DComplex( sizeof(Index), x2, y2 );
-   /* The Index allocation won't be classed as coming from this name, as it's called
-    *  within Memory_Alloc_3DSetup */   
-
-   data->setup[0][0] = 2;
-   data->setup[1][0] = 3;
-   data->complex3d = Memory_Alloc_3DComplex( StructA, x2, y2, data->setup, "GroupTwo" );
-   data->strA_alloc++;
-   data->strA_total += Memory_Length_3DComplex( sizeof(StructA), x2, y2, data->setup );
-   data->groupTwo_strA_alloc++;
-   data->groupTwo_strA_total += Memory_Length_3DComplex( sizeof(StructA), x2, y2, data->setup );
-
-   data->groupTwoName_alloc = data->groupTwo_strA_alloc + data->groupTwo_strB_alloc + data->groupTwo_strC_alloc;
-   data->groupTwoName_total = data->groupTwo_strA_total + data->groupTwo_strB_total + data->groupTwo_strC_total;
-   data->groupTwoFunc_alloc = data->groupTwoName_alloc + data->index_alloc;
-   data->groupTwoFunc_total = data->groupTwoName_total + data->index_total;
-}
-
-
-void MemoryReportSuite_AllocBytes( MemoryReportSuiteData* data ) {
-   data->bytesObj = Memory_Alloc_Bytes( 5, "Bytes", "BytesGroup" );
-   data->bytes_alloc++;
-   data->bytes_total += 5;
-
-   data->bytesArray = Memory_Alloc_Array_Bytes( 3, 10, "Bytes", "BytesGroup" );
-   data->bytes_alloc++;
-   data->bytes_total += 3 * 10;
-
-   data->bytesFunc_alloc = data->bytes_alloc;
-   data->bytesFunc_total = data->bytes_total;
-}
-
-
-Memory* MemoryReportSuite_SaveStgMemoryAndCreateTemp( MemoryReportSuiteData* data ) {
-   /* Save the main stgMemory struct, and create a special one for this test */
-   data->savedStgMemory = stgMemory;
-   stgMemory = Memory_Init();
-
-   stgMemory->infoStream = Stg_Class_Copy( (Stream*)Journal_GetTypedStream( Info_Type ), NULL, True, NULL, NULL );
-   stgMemory->debugStream = Stg_Class_Copy( (Stream*)Journal_GetTypedStream( Debug_Type ), NULL, True, NULL, NULL );
-   stgMemory->errorStream = Stg_Class_Copy( (Stream*)Journal_GetTypedStream( Error_Type ), NULL, True, NULL, NULL );
-   Journal_Enable_TypedStream( Info_Type, True );
-   return stgMemory;
-}
-
-
-void MemoryReportSuite_Setup( MemoryReportSuiteData* data ) {
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-
-   data->strA_alloc=0;
-   data->strB_alloc=0;
-   data->strC_alloc=0;
-   data->bytes_alloc=0;
-   data->index_alloc=0;
-   data->strA_total=0;
-   data->strB_total=0;
-   data->strC_total=0;
-   data->bytes_total=0;
-   data->index_total=0;
-   data->groupTwo_strA_alloc=0;
-   data->groupTwo_strB_alloc=0;
-   data->groupTwo_strC_alloc=0;
-   data->groupTwo_strA_total=0;
-   data->groupTwo_strB_total=0;
-   data->groupTwo_strC_total=0;
-   data->groupOneFunc_alloc=0;
-   data->groupTwoFunc_alloc=0;
-   data->groupTwoName_alloc=0;
-   data->bytesFunc_alloc=0;
-   data->groupOneFunc_total=0;
-   data->groupTwoFunc_total=0;
-   data->groupTwoName_total=0;
-   data->bytesFunc_total=0;
-   data->file_alloc=0;
-   data->file_total=0;
-}
-
-
-void MemoryReportSuite_Teardown( MemoryReportSuiteData* data ) {
-}
-
-
-void MemoryReportSuite_AllocTestMemoryObjects( MemoryReportSuiteData* data ) {
-   MemoryReportSuite_AllocGroupOne( data );
-   MemoryReportSuite_AllocGroupTwo( data );
-   MemoryReportSuite_AllocBytes( data );
-   data->file_alloc = data->groupOneFunc_alloc + data->groupTwoFunc_alloc
-      + data->bytesFunc_alloc;
-   data->file_total = data->groupOneFunc_total + data->groupTwoFunc_total
-      + data->bytesFunc_total;
-}
-
-
-void MemoryReportSuite_FreeTestMemoryObjects( MemoryReportSuiteData* data ) {
-   Memory_Free( data->bytesObj );
-   Memory_Free( data->bytesArray );
-   Memory_Free_Type( StructA );
-   Memory_Free_Type( StructB );
-   Memory_Free_Type( StructC );
-}
-
-
-/*Test 1: MemoryReport: (Type), where file is this test*/
-void MemoryReportSuite_TestReportPrintsOne( MemoryReportSuiteData* data ) {
-   Name memoryReportOutputFilename="./MemoryReportSuite_TestOutput-1.txt";
-   Memory*        tempMemoryManager;   
-
-   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
-
-   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
-   MemoryReportSuite_AllocTestMemoryObjects( data );
-   stgMemory = data->savedStgMemory;
-
-   data->report = MemoryReport_New();
-   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_TYPE );
-   MemoryReport_AddCondition( data->report, MEMORYREPORT_FILE, "StGermain/Base/Foundation/tests/MemoryReportSuite.c" );
-   MemoryReport_Print( data->report );
-
-   if (data->rank==0) {
-      #define        MAXLINE 1000
-      FILE*          memoryReportOutputFile = NULL;
-      char           memoryReportString[MAXLINE];
-      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
-      char           valString[1000];
-
-      valString[0] = '\0';
-
-      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
-      /* Just skip first 2 lines: headings */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_true( timesAlloc == data->file_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->file_total );
-      pcu_check_true( totalBytes == data->file_total );
-      
-      /* skip a heading line */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      /* Due to sorting, order should be: bytes, index, strA, strB, strC */
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "Bytes" );
-      pcu_check_true( timesAlloc == data->bytes_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->bytes_total );
-      pcu_check_true( totalBytes == data->bytes_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "Index" );
-      pcu_check_true( timesAlloc == data->index_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->index_total );
-      pcu_check_true( totalBytes == data->index_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StructA" );
-      pcu_check_true( timesAlloc == data->strA_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->strA_total );
-      pcu_check_true( totalBytes == data->strA_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StructB" );
-      pcu_check_true( timesAlloc == data->strB_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->strB_total );
-      pcu_check_true( totalBytes == data->strB_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StructC" );
-      pcu_check_true( timesAlloc == data->strC_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->strC_total );
-      pcu_check_true( totalBytes == data->strC_total );
-
-      fclose( memoryReportOutputFile );
-      remove( memoryReportOutputFilename );
-   }
-
-   stgMemory = tempMemoryManager;
-   MemoryReportSuite_FreeTestMemoryObjects( data );
-   Memory_Delete();
-   stgMemory = data->savedStgMemory;
-
-   MemoryReport_Delete( data->report );
-}
-
-
-/*Test 2: MemoryReport: (Type), where name=Test1*/
-void MemoryReportSuite_TestReportPrintsTwo( MemoryReportSuiteData* data ) {
-   Name memoryReportOutputFilename = "./MemoryReportSuite_TestOutput-2.txt";
-   Memory*        tempMemoryManager;   
-   
-   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
-
-   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
-   MemoryReportSuite_AllocTestMemoryObjects( data );
-   stgMemory = data->savedStgMemory;
-
-   data->report = MemoryReport_New();
-   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_TYPE );
-   MemoryReport_AddCondition( data->report, MEMORYREPORT_NAME, "GroupTwo" );
-   MemoryReport_Print( data->report );
-
-   if (data->rank==0) {
-      #define        MAXLINE 1000
-      FILE*          memoryReportOutputFile = NULL;
-      char           memoryReportString[MAXLINE];
-      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
-      char           valString[1000];
-
-      valString[0] = '\0';
-
-      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
-      /* Just skip first 2 lines: headings */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_true( timesAlloc == data->groupTwoName_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwoName_total );
-      pcu_check_true( totalBytes == data->groupTwoName_total );
-      
-      /* skip a heading line */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      /* Due to sorting, order should be: index, strA, strB, strC */
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StructA" );
-      pcu_check_true( timesAlloc == data->groupTwo_strA_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwo_strA_total );
-      pcu_check_true( totalBytes == data->groupTwo_strA_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StructB" );
-      pcu_check_true( timesAlloc == data->groupTwo_strB_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwo_strB_total );
-      pcu_check_true( totalBytes == data->groupTwo_strB_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StructC" );
-      pcu_check_true( timesAlloc == data->groupTwo_strC_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwo_strC_total );
-      pcu_check_true( totalBytes == data->groupTwo_strC_total );
-
-      fclose( memoryReportOutputFile );
-      remove( memoryReportOutputFilename );
-   }
-
-   stgMemory = tempMemoryManager;
-   MemoryReportSuite_FreeTestMemoryObjects( data );
-   Memory_Delete();
-   stgMemory = data->savedStgMemory;
-
-   MemoryReport_Delete( data->report );
-}
-
-
-/*Test 3: MemoryReport: (Func), where file= this file */
-void MemoryReportSuite_TestReportPrintsThree( MemoryReportSuiteData* data ) {
-   Name memoryReportOutputFilename="./MemoryReportSuite_TestOutput-3.txt";
-   Memory*        tempMemoryManager;   
-   
-   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
-
-   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
-   MemoryReportSuite_AllocTestMemoryObjects( data );
-   stgMemory = data->savedStgMemory;
-
-   data->report = MemoryReport_New();
-   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_FUNC );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_FILE );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_TYPE );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_NAME );
-   MemoryReport_AddCondition( data->report, MEMORYREPORT_FILE, "StGermain/Base/Foundation/tests/MemoryReportSuite.c" );
-   MemoryReport_Print( data->report );
-
-   if (data->rank==0) {
-      #define        MAXLINE 1000
-      FILE*          memoryReportOutputFile = NULL;
-      char           memoryReportString[MAXLINE];
-      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
-      char           valString[1000];
-
-      valString[0] = '\0';
-
-      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
-      /* Just skip first 2 lines: headings */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_true( timesAlloc == data->file_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->file_total );
-      pcu_check_true( totalBytes == data->file_total );
-      
-      /* skip a heading line */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      /* Due to sorting, order should be: allocBytes, allocGroupOne, allocGroupTwo */
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "MemoryReportSuite_AllocBytes" );
-      pcu_check_true( timesAlloc == data->bytesFunc_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->bytesFunc_total );
-      pcu_check_true( totalBytes == data->bytesFunc_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "MemoryReportSuite_AllocGroupOne" );
-      pcu_check_true( timesAlloc == data->groupOneFunc_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupOneFunc_total );
-      pcu_check_true( totalBytes == data->groupOneFunc_total );
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "MemoryReportSuite_AllocGroupTwo" );
-      pcu_check_true( timesAlloc == data->groupTwoFunc_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwoFunc_total );
-      pcu_check_true( totalBytes == data->groupTwoFunc_total );
-
-      fclose( memoryReportOutputFile );
-      remove( memoryReportOutputFilename );
-   }
-
-   stgMemory = tempMemoryManager;
-   MemoryReportSuite_FreeTestMemoryObjects( data );
-   Memory_Delete();
-   stgMemory = data->savedStgMemory;
-
-   MemoryReport_Delete( data->report );
-}
-
-
-/*Test 4: MemoryReport: (File), where type=StructA and name=Test2 */
-void MemoryReportSuite_TestReportPrintsFour( MemoryReportSuiteData* data ) {
-   Name memoryReportOutputFilename="./MemoryReportSuite_TestOutput-4.txt";
-   Memory*        tempMemoryManager;   
-   
-   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
-
-   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
-   MemoryReportSuite_AllocTestMemoryObjects( data );
-   stgMemory = data->savedStgMemory;
-
-   data->report = MemoryReport_New();
-   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
-   MemoryReport_AddGroup( data->report, MEMORYREPORT_FILE );
-   MemoryReport_AddCondition( data->report, MEMORYREPORT_TYPE, "StructA" );
-   MemoryReport_AddCondition( data->report, MEMORYREPORT_NAME, "GroupTwo" );
-   MemoryReport_Print( data->report );
-
-   if (data->rank==0) {
-      #define        MAXLINE 1000
-      FILE*          memoryReportOutputFile = NULL;
-      char           memoryReportString[MAXLINE];
-      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
-      char           valString[1000];
-
-      valString[0] = '\0';
-
-      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
-      /* Just skip first 2 lines: headings */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_true( timesAlloc == data->groupTwo_strA_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwo_strA_total );
-      pcu_check_true( totalBytes == data->groupTwo_strA_total );
-      
-      /* skip a heading line */
-      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
-
-      /* Due to sorting, order should be: allocBytes, allocGroupOne, allocGroupTwo */
-      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
-      pcu_check_streq( valString, "StGermain/Base/Foundation/tests/MemoryReportSuite.c" );
-      pcu_check_true( timesAlloc == data->groupTwo_strA_alloc );
-      pcu_check_true( timesFree == 0 );
-      pcu_check_true( currBytes == data->groupTwo_strA_total );
-      pcu_check_true( totalBytes == data->groupTwo_strA_total );
-
-      fclose( memoryReportOutputFile );
-      remove( memoryReportOutputFilename );
-   }
-
-   stgMemory = tempMemoryManager;
-   MemoryReportSuite_FreeTestMemoryObjects( data );
-   Memory_Delete();
-   stgMemory = data->savedStgMemory;
-
-   MemoryReport_Delete( data->report );
-}
-
-
-void MemoryReportSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MemoryReportSuiteData );
-   pcu_suite_setFixtures( suite, MemoryReportSuite_Setup, MemoryReportSuite_Teardown );
-   #ifdef MEMORY_STATS
-   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsOne );
-   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsTwo );
-   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsThree );
-   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsFour );
-   #endif
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/MemoryReportSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/MemoryReportSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,575 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests accuracy of memory statistics generation.
+**
+** $Id: testMemory2.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h" /* For Journal stuff */
+#include "MemoryReportSuite.h"
+
+struct StructA
+{
+   int x;
+   float y;
+   char z;
+};
+typedef struct StructA StructA;
+
+struct StructB
+{
+   double x;
+};
+typedef struct StructB StructB;
+
+struct StructC
+{
+   char* x;
+   StructA a;
+};
+typedef struct StructC StructC;
+
+typedef struct {
+   Memory*                 savedStgMemory;
+   MemoryReport*           report;
+   int							rank;   
+   void*                   bytesObj;
+   void*                   bytesArray;
+   StructA*                object;
+   StructB*                array1d;
+   StructC**               array2d;
+   StructA***              array3d;
+   StructB****             array4d;
+   StructC*                one2d;
+   StructA*                one3d;
+   StructB*                one4d;
+   StructC**               complex2d;
+   Index**                 setup;
+   StructA***              complex3d;
+   unsigned                strA_alloc;
+   unsigned                strB_alloc;
+   unsigned                strC_alloc;
+   unsigned                bytes_alloc;
+   unsigned                index_alloc;
+   unsigned                strA_total;
+   unsigned                strB_total;
+   unsigned                strC_total;
+   unsigned                bytes_total;
+   unsigned                index_total;
+   unsigned                groupTwo_strA_alloc;
+   unsigned                groupTwo_strB_alloc;
+   unsigned                groupTwo_strC_alloc;
+   unsigned                groupTwo_strA_total;
+   unsigned                groupTwo_strB_total;
+   unsigned                groupTwo_strC_total;
+   unsigned                groupOneFunc_alloc;
+   unsigned                groupTwoFunc_alloc;
+   unsigned                groupTwoName_alloc;
+   unsigned                bytesFunc_alloc;
+   unsigned                groupOneFunc_total;
+   unsigned                groupTwoFunc_total;
+   unsigned                groupTwoName_total;
+   unsigned                bytesFunc_total;
+   unsigned                file_alloc;
+   unsigned                file_total;
+} MemoryReportSuiteData;
+
+
+void MemoryReportSuite_AllocGroupOne( MemoryReportSuiteData* data ) {
+   data->array1d = Memory_Alloc_Array( StructB, 3, "GroupOne" );
+   data->strB_alloc++;
+   data->strB_total += sizeof(StructB)*3;
+
+   data->array2d = Memory_Alloc_2DArray( StructC, 4, 5, (Name)"GroupOne" );
+   data->strC_alloc++;
+   data->strC_total += Memory_Length_2DArray( sizeof(StructC ), 4, 5 );
+
+   data->array3d = Memory_Alloc_3DArray( StructA, 2, 3, 4, (Name)"GroupOne" );
+   data->strA_alloc++;
+   data->strA_total += Memory_Length_3DArray( sizeof(StructA ), 2, 3, 4 );
+
+   data->array4d = Memory_Alloc_4DArray_Unnamed( StructB, 5, 4, 3, 2 );
+   data->strB_alloc++;
+   data->strB_total += Memory_Length_4DArray( sizeof(StructB), 5, 4, 3, 2 );
+
+   data->one2d = Memory_Alloc_2DArrayAs1D_Unnamed( StructC, 4, 2 );
+   data->strC_alloc++;
+   data->strC_total += Memory_Length_2DAs1D( sizeof(StructC), 4, 2 );
+
+   data->one3d = Memory_Alloc_3DArrayAs1D_Unnamed( StructA, 2, 2, 3 );
+   data->strA_alloc++;
+   data->strA_total += Memory_Length_3DAs1D( sizeof(StructA), 2, 2, 3 );
+
+   data->groupOneFunc_alloc = data->strA_alloc + data->strB_alloc + data->strC_alloc;
+   data->groupOneFunc_total = data->strA_total + data->strB_total + data->strC_total;
+}
+
+
+void MemoryReportSuite_AllocGroupTwo( MemoryReportSuiteData* data ) {
+   Index          x1 = 4;
+   Index          y1[] = { 1, 2, 3, 4 };
+   Index          x2 = 2;
+   Index          y2[] = { 1, 1 };
+
+   data->object = Memory_Alloc( StructA, "GroupTwo" );
+   data->strA_alloc++;
+   data->strA_total += sizeof(StructA);
+   data->groupTwo_strA_alloc++;
+   data->groupTwo_strA_total += sizeof(StructA);
+
+   data->one4d = Memory_Alloc_4DArrayAs1D( StructB, 4, 2, 3, 5, "GroupTwo" );
+   data->strB_alloc++;
+   data->strB_total += Memory_Length_4DAs1D( sizeof(StructB), 4, 2, 3, 5 );
+   data->groupTwo_strB_alloc++;
+   data->groupTwo_strB_total += Memory_Length_4DAs1D( sizeof(StructB), 4, 2, 3, 5 );
+
+   data->complex2d = Memory_Alloc_2DComplex( StructC, x1, y1, "GroupTwo" );
+   data->strC_alloc++;
+   data->strC_total += Memory_Length_2DComplex( sizeof(StructC), x1, y1 );
+   data->groupTwo_strC_alloc++;
+   data->groupTwo_strC_total += Memory_Length_2DComplex( sizeof(StructC), x1, y1 );
+
+   data->setup = Memory_Alloc_3DSetup( x2, y2 );
+   data->index_alloc++;
+   data->index_total += Memory_Length_2DComplex( sizeof(Index), x2, y2 );
+   /* The Index allocation won't be classed as coming from this name, as it's called
+    *  within Memory_Alloc_3DSetup */   
+
+   data->setup[0][0] = 2;
+   data->setup[1][0] = 3;
+   data->complex3d = Memory_Alloc_3DComplex( StructA, x2, y2, data->setup, "GroupTwo" );
+   data->strA_alloc++;
+   data->strA_total += Memory_Length_3DComplex( sizeof(StructA), x2, y2, data->setup );
+   data->groupTwo_strA_alloc++;
+   data->groupTwo_strA_total += Memory_Length_3DComplex( sizeof(StructA), x2, y2, data->setup );
+
+   data->groupTwoName_alloc = data->groupTwo_strA_alloc + data->groupTwo_strB_alloc + data->groupTwo_strC_alloc;
+   data->groupTwoName_total = data->groupTwo_strA_total + data->groupTwo_strB_total + data->groupTwo_strC_total;
+   data->groupTwoFunc_alloc = data->groupTwoName_alloc + data->index_alloc;
+   data->groupTwoFunc_total = data->groupTwoName_total + data->index_total;
+}
+
+
+void MemoryReportSuite_AllocBytes( MemoryReportSuiteData* data ) {
+   data->bytesObj = Memory_Alloc_Bytes( 5, "Bytes", "BytesGroup" );
+   data->bytes_alloc++;
+   data->bytes_total += 5;
+
+   data->bytesArray = Memory_Alloc_Array_Bytes( 3, 10, "Bytes", "BytesGroup" );
+   data->bytes_alloc++;
+   data->bytes_total += 3 * 10;
+
+   data->bytesFunc_alloc = data->bytes_alloc;
+   data->bytesFunc_total = data->bytes_total;
+}
+
+
+Memory* MemoryReportSuite_SaveStgMemoryAndCreateTemp( MemoryReportSuiteData* data ) {
+   /* Save the main stgMemory struct, and create a special one for this test */
+   data->savedStgMemory = stgMemory;
+   stgMemory = Memory_Init();
+
+   stgMemory->infoStream = Stg_Class_Copy( (Stream*)Journal_GetTypedStream( Info_Type ), NULL, True, NULL, NULL );
+   stgMemory->debugStream = Stg_Class_Copy( (Stream*)Journal_GetTypedStream( Debug_Type ), NULL, True, NULL, NULL );
+   stgMemory->errorStream = Stg_Class_Copy( (Stream*)Journal_GetTypedStream( Error_Type ), NULL, True, NULL, NULL );
+   Journal_Enable_TypedStream( Info_Type, True );
+   return stgMemory;
+}
+
+
+void MemoryReportSuite_Setup( MemoryReportSuiteData* data ) {
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+
+   data->strA_alloc=0;
+   data->strB_alloc=0;
+   data->strC_alloc=0;
+   data->bytes_alloc=0;
+   data->index_alloc=0;
+   data->strA_total=0;
+   data->strB_total=0;
+   data->strC_total=0;
+   data->bytes_total=0;
+   data->index_total=0;
+   data->groupTwo_strA_alloc=0;
+   data->groupTwo_strB_alloc=0;
+   data->groupTwo_strC_alloc=0;
+   data->groupTwo_strA_total=0;
+   data->groupTwo_strB_total=0;
+   data->groupTwo_strC_total=0;
+   data->groupOneFunc_alloc=0;
+   data->groupTwoFunc_alloc=0;
+   data->groupTwoName_alloc=0;
+   data->bytesFunc_alloc=0;
+   data->groupOneFunc_total=0;
+   data->groupTwoFunc_total=0;
+   data->groupTwoName_total=0;
+   data->bytesFunc_total=0;
+   data->file_alloc=0;
+   data->file_total=0;
+}
+
+
+void MemoryReportSuite_Teardown( MemoryReportSuiteData* data ) {
+}
+
+
+void MemoryReportSuite_AllocTestMemoryObjects( MemoryReportSuiteData* data ) {
+   MemoryReportSuite_AllocGroupOne( data );
+   MemoryReportSuite_AllocGroupTwo( data );
+   MemoryReportSuite_AllocBytes( data );
+   data->file_alloc = data->groupOneFunc_alloc + data->groupTwoFunc_alloc
+      + data->bytesFunc_alloc;
+   data->file_total = data->groupOneFunc_total + data->groupTwoFunc_total
+      + data->bytesFunc_total;
+}
+
+
+void MemoryReportSuite_FreeTestMemoryObjects( MemoryReportSuiteData* data ) {
+   Memory_Free( data->bytesObj );
+   Memory_Free( data->bytesArray );
+   Memory_Free_Type( StructA );
+   Memory_Free_Type( StructB );
+   Memory_Free_Type( StructC );
+}
+
+
+/*Test 1: MemoryReport: (Type), where file is this test*/
+void MemoryReportSuite_TestReportPrintsOne( MemoryReportSuiteData* data ) {
+   Name memoryReportOutputFilename="./MemoryReportSuite_TestOutput-1.txt";
+   Memory*        tempMemoryManager;   
+
+   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
+
+   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
+   MemoryReportSuite_AllocTestMemoryObjects( data );
+   stgMemory = data->savedStgMemory;
+
+   data->report = MemoryReport_New();
+   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_TYPE );
+   MemoryReport_AddCondition( data->report, MEMORYREPORT_FILE, "StGermain/Base/Foundation/tests/MemoryReportSuite.c" );
+   MemoryReport_Print( data->report );
+
+   if (data->rank==0) {
+      #define        MAXLINE 1000
+      FILE*          memoryReportOutputFile = NULL;
+      char           memoryReportString[MAXLINE];
+      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
+      char           valString[1000];
+
+      valString[0] = '\0';
+
+      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
+      /* Just skip first 2 lines: headings */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_true( timesAlloc == data->file_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->file_total );
+      pcu_check_true( totalBytes == data->file_total );
+      
+      /* skip a heading line */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      /* Due to sorting, order should be: bytes, index, strA, strB, strC */
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "Bytes" );
+      pcu_check_true( timesAlloc == data->bytes_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->bytes_total );
+      pcu_check_true( totalBytes == data->bytes_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "Index" );
+      pcu_check_true( timesAlloc == data->index_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->index_total );
+      pcu_check_true( totalBytes == data->index_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StructA" );
+      pcu_check_true( timesAlloc == data->strA_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->strA_total );
+      pcu_check_true( totalBytes == data->strA_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StructB" );
+      pcu_check_true( timesAlloc == data->strB_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->strB_total );
+      pcu_check_true( totalBytes == data->strB_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StructC" );
+      pcu_check_true( timesAlloc == data->strC_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->strC_total );
+      pcu_check_true( totalBytes == data->strC_total );
+
+      fclose( memoryReportOutputFile );
+      remove( memoryReportOutputFilename );
+   }
+
+   stgMemory = tempMemoryManager;
+   MemoryReportSuite_FreeTestMemoryObjects( data );
+   Memory_Delete();
+   stgMemory = data->savedStgMemory;
+
+   MemoryReport_Delete( data->report );
+}
+
+
+/*Test 2: MemoryReport: (Type), where name=Test1*/
+void MemoryReportSuite_TestReportPrintsTwo( MemoryReportSuiteData* data ) {
+   Name memoryReportOutputFilename = "./MemoryReportSuite_TestOutput-2.txt";
+   Memory*        tempMemoryManager;   
+   
+   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
+
+   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
+   MemoryReportSuite_AllocTestMemoryObjects( data );
+   stgMemory = data->savedStgMemory;
+
+   data->report = MemoryReport_New();
+   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_TYPE );
+   MemoryReport_AddCondition( data->report, MEMORYREPORT_NAME, "GroupTwo" );
+   MemoryReport_Print( data->report );
+
+   if (data->rank==0) {
+      #define        MAXLINE 1000
+      FILE*          memoryReportOutputFile = NULL;
+      char           memoryReportString[MAXLINE];
+      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
+      char           valString[1000];
+
+      valString[0] = '\0';
+
+      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
+      /* Just skip first 2 lines: headings */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_true( timesAlloc == data->groupTwoName_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwoName_total );
+      pcu_check_true( totalBytes == data->groupTwoName_total );
+      
+      /* skip a heading line */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      /* Due to sorting, order should be: index, strA, strB, strC */
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StructA" );
+      pcu_check_true( timesAlloc == data->groupTwo_strA_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwo_strA_total );
+      pcu_check_true( totalBytes == data->groupTwo_strA_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StructB" );
+      pcu_check_true( timesAlloc == data->groupTwo_strB_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwo_strB_total );
+      pcu_check_true( totalBytes == data->groupTwo_strB_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StructC" );
+      pcu_check_true( timesAlloc == data->groupTwo_strC_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwo_strC_total );
+      pcu_check_true( totalBytes == data->groupTwo_strC_total );
+
+      fclose( memoryReportOutputFile );
+      remove( memoryReportOutputFilename );
+   }
+
+   stgMemory = tempMemoryManager;
+   MemoryReportSuite_FreeTestMemoryObjects( data );
+   Memory_Delete();
+   stgMemory = data->savedStgMemory;
+
+   MemoryReport_Delete( data->report );
+}
+
+
+/*Test 3: MemoryReport: (Func), where file= this file */
+void MemoryReportSuite_TestReportPrintsThree( MemoryReportSuiteData* data ) {
+   Name memoryReportOutputFilename="./MemoryReportSuite_TestOutput-3.txt";
+   Memory*        tempMemoryManager;   
+   
+   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
+
+   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
+   MemoryReportSuite_AllocTestMemoryObjects( data );
+   stgMemory = data->savedStgMemory;
+
+   data->report = MemoryReport_New();
+   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_FUNC );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_FILE );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_TYPE );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_NAME );
+   MemoryReport_AddCondition( data->report, MEMORYREPORT_FILE, "StGermain/Base/Foundation/tests/MemoryReportSuite.c" );
+   MemoryReport_Print( data->report );
+
+   if (data->rank==0) {
+      #define        MAXLINE 1000
+      FILE*          memoryReportOutputFile = NULL;
+      char           memoryReportString[MAXLINE];
+      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
+      char           valString[1000];
+
+      valString[0] = '\0';
+
+      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
+      /* Just skip first 2 lines: headings */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_true( timesAlloc == data->file_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->file_total );
+      pcu_check_true( totalBytes == data->file_total );
+      
+      /* skip a heading line */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      /* Due to sorting, order should be: allocBytes, allocGroupOne, allocGroupTwo */
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "MemoryReportSuite_AllocBytes" );
+      pcu_check_true( timesAlloc == data->bytesFunc_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->bytesFunc_total );
+      pcu_check_true( totalBytes == data->bytesFunc_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "MemoryReportSuite_AllocGroupOne" );
+      pcu_check_true( timesAlloc == data->groupOneFunc_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupOneFunc_total );
+      pcu_check_true( totalBytes == data->groupOneFunc_total );
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "MemoryReportSuite_AllocGroupTwo" );
+      pcu_check_true( timesAlloc == data->groupTwoFunc_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwoFunc_total );
+      pcu_check_true( totalBytes == data->groupTwoFunc_total );
+
+      fclose( memoryReportOutputFile );
+      remove( memoryReportOutputFilename );
+   }
+
+   stgMemory = tempMemoryManager;
+   MemoryReportSuite_FreeTestMemoryObjects( data );
+   Memory_Delete();
+   stgMemory = data->savedStgMemory;
+
+   MemoryReport_Delete( data->report );
+}
+
+
+/*Test 4: MemoryReport: (File), where type=StructA and name=Test2 */
+void MemoryReportSuite_TestReportPrintsFour( MemoryReportSuiteData* data ) {
+   Name memoryReportOutputFilename="./MemoryReportSuite_TestOutput-4.txt";
+   Memory*        tempMemoryManager;   
+   
+   Stream_RedirectFile((Stream*)stgMemory->infoStream,memoryReportOutputFilename);
+
+   tempMemoryManager = MemoryReportSuite_SaveStgMemoryAndCreateTemp( data );
+   MemoryReportSuite_AllocTestMemoryObjects( data );
+   stgMemory = data->savedStgMemory;
+
+   data->report = MemoryReport_New();
+   MemoryReport_SetCustomMemoryManager( data->report, tempMemoryManager );
+   MemoryReport_AddGroup( data->report, MEMORYREPORT_FILE );
+   MemoryReport_AddCondition( data->report, MEMORYREPORT_TYPE, "StructA" );
+   MemoryReport_AddCondition( data->report, MEMORYREPORT_NAME, "GroupTwo" );
+   MemoryReport_Print( data->report );
+
+   if (data->rank==0) {
+      #define        MAXLINE 1000
+      FILE*          memoryReportOutputFile = NULL;
+      char           memoryReportString[MAXLINE];
+      unsigned       timesAlloc, timesFree, currBytes, totalBytes;
+      char           valString[1000];
+
+      valString[0] = '\0';
+
+      memoryReportOutputFile = fopen(memoryReportOutputFilename, "r");
+      /* Just skip first 2 lines: headings */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      fscanf( memoryReportOutputFile, "%u %u %u %u\n", &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_true( timesAlloc == data->groupTwo_strA_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwo_strA_total );
+      pcu_check_true( totalBytes == data->groupTwo_strA_total );
+      
+      /* skip a heading line */
+      pcu_check_true( fgets( memoryReportString, MAXLINE, memoryReportOutputFile ) );
+
+      /* Due to sorting, order should be: allocBytes, allocGroupOne, allocGroupTwo */
+      fscanf( memoryReportOutputFile, "%s %u %u %u %u\n", valString, &timesAlloc, &timesFree, &currBytes, &totalBytes ); 
+      pcu_check_streq( valString, "StGermain/Base/Foundation/tests/MemoryReportSuite.c" );
+      pcu_check_true( timesAlloc == data->groupTwo_strA_alloc );
+      pcu_check_true( timesFree == 0 );
+      pcu_check_true( currBytes == data->groupTwo_strA_total );
+      pcu_check_true( totalBytes == data->groupTwo_strA_total );
+
+      fclose( memoryReportOutputFile );
+      remove( memoryReportOutputFilename );
+   }
+
+   stgMemory = tempMemoryManager;
+   MemoryReportSuite_FreeTestMemoryObjects( data );
+   Memory_Delete();
+   stgMemory = data->savedStgMemory;
+
+   MemoryReport_Delete( data->report );
+}
+
+
+void MemoryReportSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MemoryReportSuiteData );
+   pcu_suite_setFixtures( suite, MemoryReportSuite_Setup, MemoryReportSuite_Teardown );
+   #ifdef MEMORY_STATS
+   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsOne );
+   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsTwo );
+   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsThree );
+   pcu_suite_addTest( suite, MemoryReportSuite_TestReportPrintsFour );
+   #endif
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/MemorySuite.c
--- a/Base/Foundation/tests/MemorySuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests accuracy of memory statistics generation.
-**
-** $Id: testMemory0.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "MemorySuite.h"
-
-/* A basic tolerance, not for serious arithmetic calculations but just since we are using doubles 
- * in increments of 0.1 as part of read-write tests */
-#define DOUBLE_TOLERANCE 0.00001
-
-typedef struct {
-} MemorySuiteData;
-
-void MemorySuite_Setup( MemorySuiteData* data ) {
-   #ifdef MEMORY_STATS
-   stgMemory->enable = True;
-   #endif
-}
-
-void MemorySuite_Teardown( MemorySuiteData* data ) {
-}
-
-
-void MemorySuite_Test2DArray( MemorySuiteData* data ) {
-   double**       array2d = NULL;
-   Index          ii = 0;
-   Index          jj = 0;
-	#ifdef MEMORY_STATS
-   MemoryPointer* memoryPtr;
-	#endif
-
-   array2d = Memory_Alloc_2DArray_Unnamed( double, 2, 3 );
-   pcu_check_true( NULL != array2d );
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_IsAllocated( array2d ) == True );
-   memoryPtr = (MemoryPointer*)Memory_Find_Pointer( array2d );
-   pcu_check_true( NULL != memoryPtr );
-   pcu_check_true( memoryPtr->allocType == MEMORY_2DARRAY );
-   pcu_check_streq( memoryPtr->type->value, "double" );
-   pcu_check_streq( memoryPtr->file->value, "StGermain/Base/Foundation/tests/MemorySuite.c" );
-   pcu_check_streq( memoryPtr->func->value, __func__ );
-   pcu_check_true( memoryPtr->itemSize == sizeof(double));
-   pcu_check_true( memoryPtr->totalSize == sizeof(double)*2*3 + sizeof(double*)*2 );
-   pcu_check_true( memoryPtr->length.twoD[0] == 2 );
-   pcu_check_true( memoryPtr->length.twoD[1] == 3 );
-   #endif
-
-   /* Simply write values to specified array entries, and check they're able to be read back properly */
-   for ( ii = 0; ii < 2; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         array2d[ii][jj] = ii + (jj / 10.0);
-      }
-   }
-   for ( ii = 0; ii < 2; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         pcu_check_true( fabs(array2d[ii][jj] - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-
-   array2d = Memory_Realloc_2DArray( array2d, double, 4, 4 );
-   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
-   for ( ii = 0; ii < 2; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         pcu_check_true( fabs(array2d[ii][jj] - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 4; jj++ ) {
-         array2d[ii][jj] = ii + (jj / 20.0);
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 4; jj++ ) {
-         pcu_check_true( fabs(array2d[ii][jj] - (ii + (jj / 20.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_CountGet( array2d ) == 0 );
-   Memory_CountInc( array2d );
-   pcu_check_true( Memory_CountGet( array2d ) == 1 );
-   Memory_CountDec( array2d );
-   Memory_CountGet( array2d );
-   #endif
-   Memory_Free( array2d );
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_IsAllocated( array2d ) == False );
-   #endif
-
-}
-
-
-void MemorySuite_Test3DArray( MemorySuiteData* data ) {
-   double***   array3d=NULL;
-   Index       ii = 0;
-   Index       jj = 0;
-   Index       kk = 0;
-
-   array3d = Memory_Alloc_3DArray_Unnamed( double, 4, 3, 2 );
-   pcu_check_true( NULL != array3d );
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_IsAllocated( array3d ) == True );
-   #endif
-
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            array3d[ii][jj][kk] = ii + (jj / 10.0) + (kk / 100.0);
-         }
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            pcu_check_true( fabs(array3d[ii][jj][kk] - (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
-         }
-      }
-   }
-
-   array3d = Memory_Realloc_3DArray( array3d, double, 5, 5, 5 );
-   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            pcu_check_true( fabs(array3d[ii][jj][kk] - (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
-         }
-      }
-   }
-   for ( ii = 0; ii < 5; ii++ ) {
-      for ( jj = 0; jj < 5; jj++ ) {
-         for ( kk = 0; kk < 5; kk++ ) {
-            array3d[ii][jj][kk] = ii + (jj / 20.0) + (kk / 200.0);
-         }
-      }
-   }
-   for ( ii = 0; ii < 5; ii++ ) {
-      for ( jj = 0; jj < 5; jj++ ) {
-         for ( kk = 0; kk < 5; kk++ ) {
-            pcu_check_true( fabs(array3d[ii][jj][kk] - (ii + (jj / 20.0) + (kk / 200.0))) <= DOUBLE_TOLERANCE );
-         }
-      }
-   }
-
-   /* Note: this test would work better compiled with MEMORY_STATS enabled. Not sure how to
-    * do this in scons yet. -- PatrickSunter, 7 Apr 2009 */
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_CountGet( array3d ) == 0 );
-   Memory_CountInc( array3d );
-   pcu_check_true( Memory_CountGet( array3d ) == 1 );
-   Memory_CountDec( array3d );
-   Memory_CountGet( array3d );
-   #endif
-   Memory_Free( array3d );
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_IsAllocated( array3d ) == False );
-   #endif
-}
-
-
-void MemorySuite_Test4DArray( MemorySuiteData* data ) {
-   double****   array4d=NULL;
-   Index       ii = 0;
-   Index       jj = 0;
-   Index       kk = 0;
-   Index       ll = 0;
-
-   array4d = Memory_Alloc_4DArray_Unnamed( double, 4, 3, 2, 3 );
-   pcu_check_true( NULL != array4d );
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_IsAllocated( array4d ) == True );
-   #endif
-
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            for ( ll = 0; ll < 3; ll++ ) {
-               array4d[ii][jj][kk][ll] = ii + (jj / 10.0) + (kk / 100.0) + (ll / 1000.0);
-            }
-         }
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            for ( ll = 0; ll < 3; ll++ ) {
-               pcu_check_true( fabs( array4d[ii][jj][kk][ll] - (ii + (jj / 10.0) + (kk / 100.0)
-                               + (ll / 1000.0))) <= DOUBLE_TOLERANCE );
-            }
-         }
-      }
-   }
-
-   /* There doesn't yet seem to be a function to Re-Alloc a 4D array, so no test for it.
-    *  -- Patrick Sunter, 7 Apr 2009 */
-
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_CountGet( array4d ) == 0 );
-   Memory_CountInc( array4d );
-   pcu_check_true( Memory_CountGet( array4d ) == 1 );
-   Memory_CountDec( array4d );
-   Memory_CountGet( array4d );
-   #endif
-   Memory_Free( array4d );
-   #ifdef MEMORY_STATS
-   pcu_check_true( Memory_IsAllocated( array4d ) == False );
-   #endif
-}
-
-
-void MemorySuite_Test2DArrayAs1D( MemorySuiteData* data ) {
-   double*    one2d = NULL;
-   Index      ii = 0;
-   Index      jj = 0;
-
-   one2d = Memory_Alloc_2DArrayAs1D_Unnamed( double, 3, 2 );
-   pcu_check_true( NULL != one2d );
-
-   for ( ii = 0; ii < 3; ii++ ) {
-      for ( jj = 0; jj < 2; jj++ ) {
-         Memory_Access2D( one2d, ii, jj, 2 ) = ii + (jj / 10.0);
-      }
-   }
-   for ( ii = 0; ii < 3; ii++ ) {
-      for ( jj = 0; jj < 2; jj++ ) {
-         pcu_check_true( fabs( Memory_Access2D( one2d, ii, jj, 2 ) - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-
-   one2d = Memory_Realloc_2DArrayAs1D( one2d, double, 3, 2, 4, 4 );
-   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
-   for ( ii = 0; ii < 3; ii++ ) {
-      for ( jj = 0; jj < 2; jj++ ) {
-         pcu_check_true( fabs( Memory_Access2D( one2d, ii, jj, 4 ) - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 4; jj++ ) {
-         Memory_Access2D( one2d, ii, jj, 4 ) = ii + (jj / 20.0);
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 4; jj++ ) {
-         pcu_check_true( fabs( Memory_Access2D( one2d, ii, jj, 4 ) - (ii + (jj / 20.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-
-   Memory_Free( one2d );
-}
-
-
-void MemorySuite_Test3DArrayAs1D( MemorySuiteData* data ) {
-   double*    one3d = NULL;
-   Index      ii = 0;
-   Index      jj = 0;
-   Index      kk = 0;
-
-   one3d = Memory_Alloc_3DArrayAs1D_Unnamed( double, 4, 3, 2 );
-   pcu_check_true( NULL != one3d );
-
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            Memory_Access3D( one3d, ii, jj, kk, 3, 2 ) = ii + (jj / 10.0) + (kk / 100.0);
-         }
-      }
-   }
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            pcu_check_true( fabs( Memory_Access3D( one3d, ii, jj, kk, 3, 2 ) - 
-               (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
-         }
-      }
-   }
-
-   one3d = Memory_Realloc_3DArrayAs1D( one3d, double, 4, 3, 2, 5, 5, 5 );
-   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            pcu_check_true( fabs( Memory_Access3D( one3d, ii, jj, kk, 5, 5 ) - 
-               (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
-         }
-      }
-   }
-   for ( ii = 0; ii < 5; ii++ ) {
-      for ( jj = 0; jj < 5; jj++ ) {
-         for ( kk = 0; kk < 5; kk++ ) {
-            Memory_Access3D( one3d, ii, jj, kk, 5, 5 ) = ii + (jj / 20.0) + (kk / 200.0);
-         }
-      }
-   }
-   for ( ii = 0; ii < 5; ii++ ) {
-      for ( jj = 0; jj < 5; jj++ ) {
-         for ( kk = 0; kk < 5; kk++ ) {
-            pcu_check_true( fabs( Memory_Access3D( one3d, ii, jj, kk, 5, 5 ) -
-               (ii + (jj / 20.0) + (kk / 200.0))) <= DOUBLE_TOLERANCE );
-         }
-      }
-   }
-
-   Memory_Free( one3d );
-}
-
-
-void MemorySuite_Test4DArrayAs1D( MemorySuiteData* data ) {
-   double*    one4d = NULL;
-   Index      ii = 0;
-   Index      jj = 0;
-   Index      kk = 0;
-   Index      ll = 0;
-
-   one4d = Memory_Alloc_4DArrayAs1D_Unnamed( double, 4, 3, 2, 3 );
-   pcu_check_true( NULL != one4d );
-
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            for ( ll = 0; ll < 3; ll++ ) {
-               Memory_Access4D( one4d, ii, jj, kk, ll, 3, 2, 3 ) = 
-                  ii + (jj / 10.0) + (kk / 100.0) + (ll / 1000.0);
-            }
-         }
-      }
-   }
-
-   for ( ii = 0; ii < 4; ii++ ) {
-      for ( jj = 0; jj < 3; jj++ ) {
-         for ( kk = 0; kk < 2; kk++ ) {
-            for ( ll = 0; ll < 3; ll++ ) {
-               pcu_check_true( fabs(Memory_Access4D( one4d, ii, jj, kk, ll, 3, 2, 3 ) - 
-                  (ii + (jj / 10.0) + (kk / 100.0) + (ll / 1000.0))) <= DOUBLE_TOLERANCE );
-            }
-         }
-      }
-   }
-
-   Memory_Free( one4d );
-}
-
-
-void MemorySuite_Test2DComplexArray( MemorySuiteData* data ) {
-   double**    complex2d;
-   Index       x1 = 5;
-   Index       y1[] = { 1, 2, 3, 4, 5 };
-   Index      ii = 0;
-   Index      jj = 0;
-
-   complex2d = Memory_Alloc_2DComplex_Unnamed( double, x1, y1 );
-   pcu_check_true( NULL != complex2d );
-
-   for (ii = 0; ii < x1; ii++) {
-      for (jj = 0; jj < y1[ii]; jj++) {
-         complex2d[ii][jj] = ii + (double)(jj / 10.0);
-      }
-   }
-
-   for (ii = 0; ii < x1; ii++) {
-      for (jj = 0; jj < y1[ii]; jj++) {
-         pcu_check_true( (complex2d[ii][jj] - (ii + (double)(jj / 10.0))) <= DOUBLE_TOLERANCE );
-      }
-   }
-
-   Memory_Free( complex2d );
-}
-
-   
-void MemorySuite_Test3DComplexArray( MemorySuiteData* data ) {
-   Index**     setup;
-   double***   complex3d;
-   Index       x2 = 3;
-   Index       y2[] = { 4, 2, 3 };
-   Index       ii = 0;
-   Index       jj = 0;
-   Index       kk = 0;
-
-   setup = Memory_Alloc_3DSetup( x2, y2 );
-   pcu_check_true( NULL != setup );
-   setup[0][0] = 2;
-   setup[0][1] = 3;
-   setup[0][2] = 2;
-   setup[0][3] = 3;
-   setup[1][0] = 1;
-   setup[1][1] = 5;
-   setup[2][0] = 2;
-   setup[2][1] = 4;
-   setup[2][2] = 2;
-
-   complex3d = Memory_Alloc_3DComplex_Unnamed( double, x2, y2, setup );   
-   pcu_check_true( NULL != complex3d );
-   for (ii = 0; ii < x2; ii++) {
-      for (jj = 0; jj < y2[ii]; jj++) {
-         for (kk = 0; kk < setup[ii][jj]; kk++) {
-            complex3d[ii][jj][kk] = ii + (jj / 10.0) + (kk / 100.0);
-         }
-      }
-   }
-   for (ii = 0; ii < x2; ii++) {
-      for (jj = 0; jj < y2[ii]; jj++) {
-         for (kk = 0; kk < setup[ii][jj]; kk++) {
-            pcu_check_true( (complex3d[ii][jj][kk] - (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE);
-         }
-      }
-   }
-
-   Memory_Free( setup );
-   Memory_Free( complex3d );
-}
-
-
-void MemorySuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MemorySuiteData );
-   pcu_suite_setFixtures( suite, MemorySuite_Setup, MemorySuite_Teardown );
-   pcu_suite_addTest( suite, MemorySuite_Test2DArray );
-   pcu_suite_addTest( suite, MemorySuite_Test3DArray );
-   pcu_suite_addTest( suite, MemorySuite_Test4DArray );
-   pcu_suite_addTest( suite, MemorySuite_Test2DArrayAs1D );
-   pcu_suite_addTest( suite, MemorySuite_Test3DArrayAs1D );
-   pcu_suite_addTest( suite, MemorySuite_Test4DArrayAs1D );
-   pcu_suite_addTest( suite, MemorySuite_Test2DComplexArray );
-   pcu_suite_addTest( suite, MemorySuite_Test3DComplexArray );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/MemorySuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/MemorySuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,460 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests accuracy of memory statistics generation.
+**
+** $Id: testMemory0.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "MemorySuite.h"
+
+/* A basic tolerance, not for serious arithmetic calculations but just since we are using doubles 
+ * in increments of 0.1 as part of read-write tests */
+#define DOUBLE_TOLERANCE 0.00001
+
+typedef struct {
+} MemorySuiteData;
+
+void MemorySuite_Setup( MemorySuiteData* data ) {
+   #ifdef MEMORY_STATS
+   stgMemory->enable = True;
+   #endif
+}
+
+void MemorySuite_Teardown( MemorySuiteData* data ) {
+}
+
+
+void MemorySuite_Test2DArray( MemorySuiteData* data ) {
+   double**       array2d = NULL;
+   Index          ii = 0;
+   Index          jj = 0;
+	#ifdef MEMORY_STATS
+   MemoryPointer* memoryPtr;
+	#endif
+
+   array2d = Memory_Alloc_2DArray_Unnamed( double, 2, 3 );
+   pcu_check_true( NULL != array2d );
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_IsAllocated( array2d ) == True );
+   memoryPtr = (MemoryPointer*)Memory_Find_Pointer( array2d );
+   pcu_check_true( NULL != memoryPtr );
+   pcu_check_true( memoryPtr->allocType == MEMORY_2DARRAY );
+   pcu_check_streq( memoryPtr->type->value, "double" );
+   pcu_check_streq( memoryPtr->file->value, "StGermain/Base/Foundation/tests/MemorySuite.c" );
+   pcu_check_streq( memoryPtr->func->value, __func__ );
+   pcu_check_true( memoryPtr->itemSize == sizeof(double));
+   pcu_check_true( memoryPtr->totalSize == sizeof(double)*2*3 + sizeof(double*)*2 );
+   pcu_check_true( memoryPtr->length.twoD[0] == 2 );
+   pcu_check_true( memoryPtr->length.twoD[1] == 3 );
+   #endif
+
+   /* Simply write values to specified array entries, and check they're able to be read back properly */
+   for ( ii = 0; ii < 2; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         array2d[ii][jj] = ii + (jj / 10.0);
+      }
+   }
+   for ( ii = 0; ii < 2; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         pcu_check_true( fabs(array2d[ii][jj] - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+
+   array2d = Memory_Realloc_2DArray( array2d, double, 4, 4 );
+   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
+   for ( ii = 0; ii < 2; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         pcu_check_true( fabs(array2d[ii][jj] - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 4; jj++ ) {
+         array2d[ii][jj] = ii + (jj / 20.0);
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 4; jj++ ) {
+         pcu_check_true( fabs(array2d[ii][jj] - (ii + (jj / 20.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_CountGet( array2d ) == 0 );
+   Memory_CountInc( array2d );
+   pcu_check_true( Memory_CountGet( array2d ) == 1 );
+   Memory_CountDec( array2d );
+   Memory_CountGet( array2d );
+   #endif
+   Memory_Free( array2d );
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_IsAllocated( array2d ) == False );
+   #endif
+
+}
+
+
+void MemorySuite_Test3DArray( MemorySuiteData* data ) {
+   double***   array3d=NULL;
+   Index       ii = 0;
+   Index       jj = 0;
+   Index       kk = 0;
+
+   array3d = Memory_Alloc_3DArray_Unnamed( double, 4, 3, 2 );
+   pcu_check_true( NULL != array3d );
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_IsAllocated( array3d ) == True );
+   #endif
+
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            array3d[ii][jj][kk] = ii + (jj / 10.0) + (kk / 100.0);
+         }
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            pcu_check_true( fabs(array3d[ii][jj][kk] - (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
+         }
+      }
+   }
+
+   array3d = Memory_Realloc_3DArray( array3d, double, 5, 5, 5 );
+   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            pcu_check_true( fabs(array3d[ii][jj][kk] - (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
+         }
+      }
+   }
+   for ( ii = 0; ii < 5; ii++ ) {
+      for ( jj = 0; jj < 5; jj++ ) {
+         for ( kk = 0; kk < 5; kk++ ) {
+            array3d[ii][jj][kk] = ii + (jj / 20.0) + (kk / 200.0);
+         }
+      }
+   }
+   for ( ii = 0; ii < 5; ii++ ) {
+      for ( jj = 0; jj < 5; jj++ ) {
+         for ( kk = 0; kk < 5; kk++ ) {
+            pcu_check_true( fabs(array3d[ii][jj][kk] - (ii + (jj / 20.0) + (kk / 200.0))) <= DOUBLE_TOLERANCE );
+         }
+      }
+   }
+
+   /* Note: this test would work better compiled with MEMORY_STATS enabled. Not sure how to
+    * do this in scons yet. -- PatrickSunter, 7 Apr 2009 */
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_CountGet( array3d ) == 0 );
+   Memory_CountInc( array3d );
+   pcu_check_true( Memory_CountGet( array3d ) == 1 );
+   Memory_CountDec( array3d );
+   Memory_CountGet( array3d );
+   #endif
+   Memory_Free( array3d );
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_IsAllocated( array3d ) == False );
+   #endif
+}
+
+
+void MemorySuite_Test4DArray( MemorySuiteData* data ) {
+   double****   array4d=NULL;
+   Index       ii = 0;
+   Index       jj = 0;
+   Index       kk = 0;
+   Index       ll = 0;
+
+   array4d = Memory_Alloc_4DArray_Unnamed( double, 4, 3, 2, 3 );
+   pcu_check_true( NULL != array4d );
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_IsAllocated( array4d ) == True );
+   #endif
+
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            for ( ll = 0; ll < 3; ll++ ) {
+               array4d[ii][jj][kk][ll] = ii + (jj / 10.0) + (kk / 100.0) + (ll / 1000.0);
+            }
+         }
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            for ( ll = 0; ll < 3; ll++ ) {
+               pcu_check_true( fabs( array4d[ii][jj][kk][ll] - (ii + (jj / 10.0) + (kk / 100.0)
+                               + (ll / 1000.0))) <= DOUBLE_TOLERANCE );
+            }
+         }
+      }
+   }
+
+   /* There doesn't yet seem to be a function to Re-Alloc a 4D array, so no test for it.
+    *  -- Patrick Sunter, 7 Apr 2009 */
+
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_CountGet( array4d ) == 0 );
+   Memory_CountInc( array4d );
+   pcu_check_true( Memory_CountGet( array4d ) == 1 );
+   Memory_CountDec( array4d );
+   Memory_CountGet( array4d );
+   #endif
+   Memory_Free( array4d );
+   #ifdef MEMORY_STATS
+   pcu_check_true( Memory_IsAllocated( array4d ) == False );
+   #endif
+}
+
+
+void MemorySuite_Test2DArrayAs1D( MemorySuiteData* data ) {
+   double*    one2d = NULL;
+   Index      ii = 0;
+   Index      jj = 0;
+
+   one2d = Memory_Alloc_2DArrayAs1D_Unnamed( double, 3, 2 );
+   pcu_check_true( NULL != one2d );
+
+   for ( ii = 0; ii < 3; ii++ ) {
+      for ( jj = 0; jj < 2; jj++ ) {
+         Memory_Access2D( one2d, ii, jj, 2 ) = ii + (jj / 10.0);
+      }
+   }
+   for ( ii = 0; ii < 3; ii++ ) {
+      for ( jj = 0; jj < 2; jj++ ) {
+         pcu_check_true( fabs( Memory_Access2D( one2d, ii, jj, 2 ) - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+
+   one2d = Memory_Realloc_2DArrayAs1D( one2d, double, 3, 2, 4, 4 );
+   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
+   for ( ii = 0; ii < 3; ii++ ) {
+      for ( jj = 0; jj < 2; jj++ ) {
+         pcu_check_true( fabs( Memory_Access2D( one2d, ii, jj, 4 ) - (ii + (jj / 10.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 4; jj++ ) {
+         Memory_Access2D( one2d, ii, jj, 4 ) = ii + (jj / 20.0);
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 4; jj++ ) {
+         pcu_check_true( fabs( Memory_Access2D( one2d, ii, jj, 4 ) - (ii + (jj / 20.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+
+   Memory_Free( one2d );
+}
+
+
+void MemorySuite_Test3DArrayAs1D( MemorySuiteData* data ) {
+   double*    one3d = NULL;
+   Index      ii = 0;
+   Index      jj = 0;
+   Index      kk = 0;
+
+   one3d = Memory_Alloc_3DArrayAs1D_Unnamed( double, 4, 3, 2 );
+   pcu_check_true( NULL != one3d );
+
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            Memory_Access3D( one3d, ii, jj, kk, 3, 2 ) = ii + (jj / 10.0) + (kk / 100.0);
+         }
+      }
+   }
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            pcu_check_true( fabs( Memory_Access3D( one3d, ii, jj, kk, 3, 2 ) - 
+               (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
+         }
+      }
+   }
+
+   one3d = Memory_Realloc_3DArrayAs1D( one3d, double, 4, 3, 2, 5, 5, 5 );
+   /* Check that the realloc hasn't corrupted existing values, then re-write and re-check */
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            pcu_check_true( fabs( Memory_Access3D( one3d, ii, jj, kk, 5, 5 ) - 
+               (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE );
+         }
+      }
+   }
+   for ( ii = 0; ii < 5; ii++ ) {
+      for ( jj = 0; jj < 5; jj++ ) {
+         for ( kk = 0; kk < 5; kk++ ) {
+            Memory_Access3D( one3d, ii, jj, kk, 5, 5 ) = ii + (jj / 20.0) + (kk / 200.0);
+         }
+      }
+   }
+   for ( ii = 0; ii < 5; ii++ ) {
+      for ( jj = 0; jj < 5; jj++ ) {
+         for ( kk = 0; kk < 5; kk++ ) {
+            pcu_check_true( fabs( Memory_Access3D( one3d, ii, jj, kk, 5, 5 ) -
+               (ii + (jj / 20.0) + (kk / 200.0))) <= DOUBLE_TOLERANCE );
+         }
+      }
+   }
+
+   Memory_Free( one3d );
+}
+
+
+void MemorySuite_Test4DArrayAs1D( MemorySuiteData* data ) {
+   double*    one4d = NULL;
+   Index      ii = 0;
+   Index      jj = 0;
+   Index      kk = 0;
+   Index      ll = 0;
+
+   one4d = Memory_Alloc_4DArrayAs1D_Unnamed( double, 4, 3, 2, 3 );
+   pcu_check_true( NULL != one4d );
+
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            for ( ll = 0; ll < 3; ll++ ) {
+               Memory_Access4D( one4d, ii, jj, kk, ll, 3, 2, 3 ) = 
+                  ii + (jj / 10.0) + (kk / 100.0) + (ll / 1000.0);
+            }
+         }
+      }
+   }
+
+   for ( ii = 0; ii < 4; ii++ ) {
+      for ( jj = 0; jj < 3; jj++ ) {
+         for ( kk = 0; kk < 2; kk++ ) {
+            for ( ll = 0; ll < 3; ll++ ) {
+               pcu_check_true( fabs(Memory_Access4D( one4d, ii, jj, kk, ll, 3, 2, 3 ) - 
+                  (ii + (jj / 10.0) + (kk / 100.0) + (ll / 1000.0))) <= DOUBLE_TOLERANCE );
+            }
+         }
+      }
+   }
+
+   Memory_Free( one4d );
+}
+
+
+void MemorySuite_Test2DComplexArray( MemorySuiteData* data ) {
+   double**    complex2d;
+   Index       x1 = 5;
+   Index       y1[] = { 1, 2, 3, 4, 5 };
+   Index      ii = 0;
+   Index      jj = 0;
+
+   complex2d = Memory_Alloc_2DComplex_Unnamed( double, x1, y1 );
+   pcu_check_true( NULL != complex2d );
+
+   for (ii = 0; ii < x1; ii++) {
+      for (jj = 0; jj < y1[ii]; jj++) {
+         complex2d[ii][jj] = ii + (double)(jj / 10.0);
+      }
+   }
+
+   for (ii = 0; ii < x1; ii++) {
+      for (jj = 0; jj < y1[ii]; jj++) {
+         pcu_check_true( (complex2d[ii][jj] - (ii + (double)(jj / 10.0))) <= DOUBLE_TOLERANCE );
+      }
+   }
+
+   Memory_Free( complex2d );
+}
+
+   
+void MemorySuite_Test3DComplexArray( MemorySuiteData* data ) {
+   Index**     setup;
+   double***   complex3d;
+   Index       x2 = 3;
+   Index       y2[] = { 4, 2, 3 };
+   Index       ii = 0;
+   Index       jj = 0;
+   Index       kk = 0;
+
+   setup = Memory_Alloc_3DSetup( x2, y2 );
+   pcu_check_true( NULL != setup );
+   setup[0][0] = 2;
+   setup[0][1] = 3;
+   setup[0][2] = 2;
+   setup[0][3] = 3;
+   setup[1][0] = 1;
+   setup[1][1] = 5;
+   setup[2][0] = 2;
+   setup[2][1] = 4;
+   setup[2][2] = 2;
+
+   complex3d = Memory_Alloc_3DComplex_Unnamed( double, x2, y2, setup );   
+   pcu_check_true( NULL != complex3d );
+   for (ii = 0; ii < x2; ii++) {
+      for (jj = 0; jj < y2[ii]; jj++) {
+         for (kk = 0; kk < setup[ii][jj]; kk++) {
+            complex3d[ii][jj][kk] = ii + (jj / 10.0) + (kk / 100.0);
+         }
+      }
+   }
+   for (ii = 0; ii < x2; ii++) {
+      for (jj = 0; jj < y2[ii]; jj++) {
+         for (kk = 0; kk < setup[ii][jj]; kk++) {
+            pcu_check_true( (complex3d[ii][jj][kk] - (ii + (jj / 10.0) + (kk / 100.0))) <= DOUBLE_TOLERANCE);
+         }
+      }
+   }
+
+   Memory_Free( setup );
+   Memory_Free( complex3d );
+}
+
+
+void MemorySuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MemorySuiteData );
+   pcu_suite_setFixtures( suite, MemorySuite_Setup, MemorySuite_Teardown );
+   pcu_suite_addTest( suite, MemorySuite_Test2DArray );
+   pcu_suite_addTest( suite, MemorySuite_Test3DArray );
+   pcu_suite_addTest( suite, MemorySuite_Test4DArray );
+   pcu_suite_addTest( suite, MemorySuite_Test2DArrayAs1D );
+   pcu_suite_addTest( suite, MemorySuite_Test3DArrayAs1D );
+   pcu_suite_addTest( suite, MemorySuite_Test4DArrayAs1D );
+   pcu_suite_addTest( suite, MemorySuite_Test2DComplexArray );
+   pcu_suite_addTest( suite, MemorySuite_Test3DComplexArray );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/NamedObject_Register2Suite.c
--- a/Base/Foundation/tests/NamedObject_Register2Suite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testFieldVariable_Register.c 2432 2004-12-16 23:01:59Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "NamedObject_RegisterSuite.h"
-#include "NamedObject_Register2Suite.h"
-
-typedef struct {
-	__Stg_Object
-} TestObject2;
-
-Stg_Object* TestObject2_New( Name name ) {
-	/* Variables set in this function */
-	SizeT                             _sizeOfSelf = sizeof( TestObject2 );
-	Type                                     type = "TestObject";
-	Stg_Class_DeleteFunction*             _delete = _Stg_Object_Delete;
-	Stg_Class_PrintFunction*               _print = _Stg_Object_Print;
-	Stg_Class_CopyFunction*                 _copy = _Stg_Object_Copy;
-	AllocationType             nameAllocationType = NON_GLOBAL;
-
-	return _Stg_Object_New(  STG_OBJECT_PASSARGS  );
-}
-
-typedef struct {
-   NamedObject_Register* reg;
-   Stg_Object**          testObjects;
-   char**                testObjectNames;
-   Index                 testObjectsCount;
-} NamedObject_RegisterSuite2Data;
-
-void NamedObject_RegisterSuite2_Setup( NamedObject_RegisterSuite2Data* data ) {
-   Index  ii=0;
-   char   letter='0';
-
-   data->reg = NamedObject_Register_New();
-   data->testObjectsCount = 5;
-   data->testObjectNames = (char**)malloc(sizeof(char*) * data->testObjectsCount);
-   data->testObjects = (Stg_Object**)malloc(sizeof(Stg_Object*) * data->testObjectsCount);
-
-   letter='a';
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-     data->testObjectNames[ii] = (char*)malloc(sizeof(char) * 2 );
-      sprintf( data->testObjectNames[ii], "%c", letter );
-      letter++;
-      data->testObjects[ii] = TestObject2_New( data->testObjectNames[ii] );
-   }
-}
-
-void NamedObject_RegisterSuite2_Teardown( NamedObject_RegisterSuite2Data* data ) {
-   Index ii;
-
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      free( data->testObjectNames[ii] );
-   }
-   free( data->testObjects );
-   free( data->testObjectNames );
-}
-
-void NamedObject_RegisterSuite2_TestDeleteAll( NamedObject_RegisterSuite2Data* data ) {
-   Index ii;
-
-   pcu_docstring( "Tests a series of new objects can be added to a register, and the register's data "
-      "fields are updated correctly" );
-
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      NamedObject_Register_Add( data->reg, data->testObjects[ii] );
-   }
-
-   pcu_check_true( data->testObjectsCount == data->reg->objects->count );
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      pcu_check_true( data->testObjects[ii] == data->reg->objects->data[ii] );
-   }
-
-   NamedObject_Register_DeleteAll( data->reg );
-}
-
-
-void NamedObject_Register2Suite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, NamedObject_RegisterSuite2Data );
-   pcu_suite_setFixtures( suite, NamedObject_RegisterSuite2_Setup, NamedObject_RegisterSuite2_Teardown );
-   pcu_suite_addTest( suite, NamedObject_RegisterSuite2_TestDeleteAll );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/NamedObject_Register2Suite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/NamedObject_Register2Suite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,115 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testFieldVariable_Register.c 2432 2004-12-16 23:01:59Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "NamedObject_RegisterSuite.h"
+#include "NamedObject_Register2Suite.h"
+
+typedef struct {
+	__Stg_Object
+} TestObject2;
+
+Stg_Object* TestObject2_New( Name name ) {
+	/* Variables set in this function */
+	SizeT                             _sizeOfSelf = sizeof( TestObject2 );
+	Type                                     type = "TestObject";
+	Stg_Class_DeleteFunction*             _delete = _Stg_Object_Delete;
+	Stg_Class_PrintFunction*               _print = _Stg_Object_Print;
+	Stg_Class_CopyFunction*                 _copy = _Stg_Object_Copy;
+	AllocationType             nameAllocationType = NON_GLOBAL;
+
+	return _Stg_Object_New(  STG_OBJECT_PASSARGS  );
+}
+
+typedef struct {
+   NamedObject_Register* reg;
+   Stg_Object**          testObjects;
+   char**                testObjectNames;
+   Index                 testObjectsCount;
+} NamedObject_RegisterSuite2Data;
+
+void NamedObject_RegisterSuite2_Setup( NamedObject_RegisterSuite2Data* data ) {
+   Index  ii=0;
+   char   letter='0';
+
+   data->reg = NamedObject_Register_New();
+   data->testObjectsCount = 5;
+   data->testObjectNames = (char**)malloc(sizeof(char*) * data->testObjectsCount);
+   data->testObjects = (Stg_Object**)malloc(sizeof(Stg_Object*) * data->testObjectsCount);
+
+   letter='a';
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+     data->testObjectNames[ii] = (char*)malloc(sizeof(char) * 2 );
+      sprintf( data->testObjectNames[ii], "%c", letter );
+      letter++;
+      data->testObjects[ii] = TestObject2_New( data->testObjectNames[ii] );
+   }
+}
+
+void NamedObject_RegisterSuite2_Teardown( NamedObject_RegisterSuite2Data* data ) {
+   Index ii;
+
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      free( data->testObjectNames[ii] );
+   }
+   free( data->testObjects );
+   free( data->testObjectNames );
+}
+
+void NamedObject_RegisterSuite2_TestDeleteAll( NamedObject_RegisterSuite2Data* data ) {
+   Index ii;
+
+   pcu_docstring( "Tests a series of new objects can be added to a register, and the register's data "
+      "fields are updated correctly" );
+
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      NamedObject_Register_Add( data->reg, data->testObjects[ii] );
+   }
+
+   pcu_check_true( data->testObjectsCount == data->reg->objects->count );
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      pcu_check_true( data->testObjects[ii] == data->reg->objects->data[ii] );
+   }
+
+   NamedObject_Register_DeleteAll( data->reg );
+}
+
+
+void NamedObject_Register2Suite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, NamedObject_RegisterSuite2Data );
+   pcu_suite_setFixtures( suite, NamedObject_RegisterSuite2_Setup, NamedObject_RegisterSuite2_Teardown );
+   pcu_suite_addTest( suite, NamedObject_RegisterSuite2_TestDeleteAll );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/NamedObject_RegisterSuite.c
--- a/Base/Foundation/tests/NamedObject_RegisterSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testFieldVariable_Register.c 2432 2004-12-16 23:01:59Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "NamedObject_RegisterSuite.h"
-
-typedef struct {
-	__Stg_Object
-} TestObject;
-
-Stg_Object* TestObject_New( Name name ) {
-	/* Variables set in this function */
-	SizeT                             _sizeOfSelf = sizeof( TestObject );
-	Type                                     type = "TestObject";
-	Stg_Class_DeleteFunction*             _delete = _Stg_Object_Delete;
-	Stg_Class_PrintFunction*               _print = _Stg_Object_Print;
-	Stg_Class_CopyFunction*                 _copy = _Stg_Object_Copy;
-	AllocationType             nameAllocationType = NON_GLOBAL;
-
-	return _Stg_Object_New(  STG_OBJECT_PASSARGS  );
-}
-
-typedef struct {
-   NamedObject_Register* reg;
-   Stg_Object**          testObjects;
-   char**                testObjectNames;
-   Index                 testObjectsCount;
-} NamedObject_RegisterSuiteData;
-
-void NamedObject_RegisterSuite_Setup( NamedObject_RegisterSuiteData* data ) {
-   Index  ii=0;
-   char   letter='0';
-
-   data->reg = NamedObject_Register_New();
-   data->testObjectsCount = 5;
-   data->testObjectNames = (char**)malloc(sizeof(char*) * data->testObjectsCount);
-   data->testObjects = (Stg_Object**)malloc(sizeof(Stg_Object*) * data->testObjectsCount);
-
-   letter='a';
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-     data->testObjectNames[ii] = (char*)malloc(sizeof(char) * 2 );
-      sprintf( data->testObjectNames[ii], "%c", letter );
-      letter++;
-      data->testObjects[ii] = TestObject_New( data->testObjectNames[ii] );
-   }
-}
-
-void NamedObject_RegisterSuite_Teardown( NamedObject_RegisterSuiteData* data ) {
-   Index ii;
-
-   _NamedObject_Register_Delete( data->reg );
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      _Stg_Object_Delete( data->testObjects[ii] );
-      free( data->testObjectNames[ii] );
-   }
-   free( data->testObjects );
-   free( data->testObjectNames );
-}
-
-void NamedObject_RegisterSuite_TestAdd( NamedObject_RegisterSuiteData* data ) {
-   Index ii;
-
-   pcu_docstring( "Tests a series of new objects can be added to a register, and the register's data "
-      "fields are updated correctly" );
-
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      NamedObject_Register_Add( data->reg, data->testObjects[ii] );
-   }
-
-   pcu_check_true( data->testObjectsCount == data->reg->objects->count );
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      pcu_check_true( data->testObjects[ii] == data->reg->objects->data[ii] );
-   }
-}
-
-
-void NamedObject_RegisterSuite_TestGetFunctions( NamedObject_RegisterSuiteData* data ) {
-   Index ii;
-
-   pcu_docstring( "Tests objects can be searched and got from the register, by both name and index." );
-
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      NamedObject_Register_Add( data->reg, data->testObjects[ii] );
-   }
-
-   for (ii=0; ii < data->testObjectsCount; ii++ ) {
-      pcu_check_true( ii == NamedObject_Register_GetIndex( data->reg,
-         data->testObjectNames[ii] ) );
-      pcu_check_true( data->testObjects[ii] == NamedObject_Register_GetByIndex( data->reg, ii ) );
-      pcu_check_true( data->testObjects[ii] == NamedObject_Register_GetByName( data->reg,
-         data->testObjectNames[ii] ) );
-   }
-}
-
-void NamedObject_RegisterSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, NamedObject_RegisterSuiteData );
-   pcu_suite_setFixtures( suite, NamedObject_RegisterSuite_Setup, NamedObject_RegisterSuite_Teardown );
-   pcu_suite_addTest( suite, NamedObject_RegisterSuite_TestAdd );
-   pcu_suite_addTest( suite, NamedObject_RegisterSuite_TestGetFunctions );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/NamedObject_RegisterSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/NamedObject_RegisterSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,133 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testFieldVariable_Register.c 2432 2004-12-16 23:01:59Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "NamedObject_RegisterSuite.h"
+
+typedef struct {
+	__Stg_Object
+} TestObject;
+
+Stg_Object* TestObject_New( Name name ) {
+	/* Variables set in this function */
+	SizeT                             _sizeOfSelf = sizeof( TestObject );
+	Type                                     type = "TestObject";
+	Stg_Class_DeleteFunction*             _delete = _Stg_Object_Delete;
+	Stg_Class_PrintFunction*               _print = _Stg_Object_Print;
+	Stg_Class_CopyFunction*                 _copy = _Stg_Object_Copy;
+	AllocationType             nameAllocationType = NON_GLOBAL;
+
+	return _Stg_Object_New(  STG_OBJECT_PASSARGS  );
+}
+
+typedef struct {
+   NamedObject_Register* reg;
+   Stg_Object**          testObjects;
+   char**                testObjectNames;
+   Index                 testObjectsCount;
+} NamedObject_RegisterSuiteData;
+
+void NamedObject_RegisterSuite_Setup( NamedObject_RegisterSuiteData* data ) {
+   Index  ii=0;
+   char   letter='0';
+
+   data->reg = NamedObject_Register_New();
+   data->testObjectsCount = 5;
+   data->testObjectNames = (char**)malloc(sizeof(char*) * data->testObjectsCount);
+   data->testObjects = (Stg_Object**)malloc(sizeof(Stg_Object*) * data->testObjectsCount);
+
+   letter='a';
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+     data->testObjectNames[ii] = (char*)malloc(sizeof(char) * 2 );
+      sprintf( data->testObjectNames[ii], "%c", letter );
+      letter++;
+      data->testObjects[ii] = TestObject_New( data->testObjectNames[ii] );
+   }
+}
+
+void NamedObject_RegisterSuite_Teardown( NamedObject_RegisterSuiteData* data ) {
+   Index ii;
+
+   _NamedObject_Register_Delete( data->reg );
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      _Stg_Object_Delete( data->testObjects[ii] );
+      free( data->testObjectNames[ii] );
+   }
+   free( data->testObjects );
+   free( data->testObjectNames );
+}
+
+void NamedObject_RegisterSuite_TestAdd( NamedObject_RegisterSuiteData* data ) {
+   Index ii;
+
+   pcu_docstring( "Tests a series of new objects can be added to a register, and the register's data "
+      "fields are updated correctly" );
+
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      NamedObject_Register_Add( data->reg, data->testObjects[ii] );
+   }
+
+   pcu_check_true( data->testObjectsCount == data->reg->objects->count );
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      pcu_check_true( data->testObjects[ii] == data->reg->objects->data[ii] );
+   }
+}
+
+
+void NamedObject_RegisterSuite_TestGetFunctions( NamedObject_RegisterSuiteData* data ) {
+   Index ii;
+
+   pcu_docstring( "Tests objects can be searched and got from the register, by both name and index." );
+
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      NamedObject_Register_Add( data->reg, data->testObjects[ii] );
+   }
+
+   for (ii=0; ii < data->testObjectsCount; ii++ ) {
+      pcu_check_true( ii == NamedObject_Register_GetIndex( data->reg,
+         data->testObjectNames[ii] ) );
+      pcu_check_true( data->testObjects[ii] == NamedObject_Register_GetByIndex( data->reg, ii ) );
+      pcu_check_true( data->testObjects[ii] == NamedObject_Register_GetByName( data->reg,
+         data->testObjectNames[ii] ) );
+   }
+}
+
+void NamedObject_RegisterSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, NamedObject_RegisterSuiteData );
+   pcu_suite_setFixtures( suite, NamedObject_RegisterSuite_Setup, NamedObject_RegisterSuite_Teardown );
+   pcu_suite_addTest( suite, NamedObject_RegisterSuite_TestAdd );
+   pcu_suite_addTest( suite, NamedObject_RegisterSuite_TestGetFunctions );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/ObjectListSuite.c
--- a/Base/Foundation/tests/ObjectListSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,489 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testNamedStg_ObjectList.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "ObjectListSuite.h"
-
-const Type DummyClass_Type = "DummyClass_Type";
-
-
-typedef struct {
-   Stg_ObjectList* ol0;
-   Stg_ObjectList  ol1;
-   Stg_ObjectList* ol2;
-   Stg_ObjectList* ol3;
-   Stg_Class*      addPtr0;
-   Stg_Class*      addPtr1;
-   int*            addPtr2;
-   int*            addPtr3;
-} ObjectListSuiteData;
-
-Stg_Class* DummyClass_New( void ) {
-   return _Stg_Class_New( 
-      sizeof(Stg_Class),
-      DummyClass_Type,
-      _Stg_Class_Delete,
-      _Stg_Class_Print,
-      _Stg_Class_Copy );
-}
-
-int* DummyPointer_New( void ) {
-   return Memory_Alloc_Unnamed( int );
-}
-
-void DummyPointer_Print( void* ptr, struct Stream* stream ) {
-   Journal_Printf( stream, "value: %i\n", *(int*)ptr );
-}
-
-void* DummyPointer_Copy( const void* ptr, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-   int* newInt;
-   
-   newInt = Memory_Alloc_Unnamed( int );
-   *newInt = *(int*)ptr;
-   
-   return newInt;
-}
-
-
-void DummyFunc1( void ) {
-}
-
-void DummyFunc2( void ) {
-}
-
-void DummyFunc3( void ) {
-}
-
-void DummyFunc4( void ) {
-}
-
-void DummyFunc5( void ) {
-}
-
-void DummyFunc6( void ) {
-}
-
-
-void ObjectListSuite_Setup( ObjectListSuiteData* data ) {
-   data->ol0 = Stg_ObjectList_New();
-   Stg_ObjectList_Init( &data->ol1 );
-   data->ol2 = Stg_ObjectList_New();
-   data->ol3 = Stg_ObjectList_New();
-   data->addPtr0 = NULL;
-   data->addPtr1 = NULL;
-   data->addPtr2 = NULL;
-   data->addPtr3 = NULL;
-}
-
-
-void ObjectListSuite_Teardown( ObjectListSuiteData* data ) {
-      Stg_Class_Delete(  data->ol3 );
-      Stg_Class_Delete(  data->ol2 );
-      Stg_Class_Delete( &data->ol1 );
-      Stg_Class_Delete(  data->ol0 );
-}
-
-
-/* Test 2: Can we append the first entry? */
-void ObjectListSuite_TestAppend( ObjectListSuiteData* data ) {
-
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), "a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), "a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), "a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), "a"  );
-
-   pcu_check_true(
-      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"a"  ) &&
-      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 0 ) &&
-      Stg_ObjectList_Count( data->ol0 ) == 1 &&
-      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"a"  ) &&
-      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 0 ) &&
-      Stg_ObjectList_Count( &data->ol1 ) == 1 &&
-      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"a"  ) &&
-      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 0 ) &&
-      Stg_ObjectList_Count( data->ol2 ) == 1 &&
-      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"a"  ) &&
-      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 0 ) &&
-      Stg_ObjectList_Count( data->ol3 ) == 1 );
-}
-
-   
-/* Test 3: Can we prepend the second entry? */
-void ObjectListSuite_TestPrepend( ObjectListSuiteData* data ) {
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
-
-   Stg_ObjectList_ClassPrepend(  data->ol0, (data->addPtr0 = DummyClass_New()), "b" );
-   Stg_ObjectList_ClassPrepend( &data->ol1, (data->addPtr1 = DummyClass_New()), "b" );
-   Stg_ObjectList_PointerPrepend(  data->ol2, (data->addPtr2 = DummyPointer_New()), "b", 0, DummyPointer_Print, DummyPointer_Copy );
-   Stg_ObjectList_GlobalPointerPrepend(  data->ol3, (data->addPtr3 = (int*)DummyFunc2), "b" );
-
-   pcu_check_true(
-      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"b"  ) &&
-      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 0 ) &&
-      Stg_ObjectList_Count( data->ol0 ) == 2 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"b"  ) &&
-      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 0 ) &&
-      Stg_ObjectList_Count( &data->ol1 ) == 2 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"b"  ) &&
-      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 0 ) &&
-      Stg_ObjectList_Count( data->ol2 ) == 2 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"b"  ) &&
-      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 0 ) &&
-      Stg_ObjectList_Count( data->ol3 ) == 2 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "a" ) == 0 );
-}
-
-   
-/* Test 4: Can we insert before "a" the third entry? */
-void ObjectListSuite_TestInsertBefore( ObjectListSuiteData* data ) {
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
-
-   Stg_ObjectList_ClassInsertBefore(  data->ol0, "a", (data->addPtr0 = DummyClass_New()), "c" );
-   Stg_ObjectList_ClassInsertBefore( &data->ol1, "a", (data->addPtr1 = DummyClass_New()), "c" );
-   Stg_ObjectList_PointerInsertBefore(  
-      data->ol2, 
-      "a", 
-      (data->addPtr2 = DummyPointer_New()), 
-      "c", 
-      0, 
-      DummyPointer_Print, 
-      DummyPointer_Copy );
-   Stg_ObjectList_GlobalPointerInsertBefore(  data->ol3, "a", (data->addPtr3 = (int*)DummyFunc3), "c" );
-
-   pcu_check_true(
-      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"c"  ) &&
-      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 1 ) &&
-      Stg_ObjectList_Count( data->ol0 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 2 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"c"  ) &&
-      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 1 ) &&
-      Stg_ObjectList_Count( &data->ol1 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 2 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"c"  ) &&
-      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 1 ) &&
-      Stg_ObjectList_Count( data->ol2 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 2 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"c"  ) &&
-      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 1 ) &&
-      Stg_ObjectList_Count( data->ol3 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 2 ) ), "a" ) == 0 );
-}
-   
-
-/* Test 5: Can we insert after "c" the fourth entry? */
-void ObjectListSuite_TestInsertAfter( ObjectListSuiteData* data ) {
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"c"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"c"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"c", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"c"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
-
-   Stg_ObjectList_ClassInsertAfter(  data->ol0, "c", (data->addPtr0 = DummyClass_New()), "d" );
-   Stg_ObjectList_ClassInsertAfter( &data->ol1, "c", (data->addPtr1 = DummyClass_New()), "d" );
-
-   Stg_ObjectList_PointerInsertAfter(  
-      data->ol2, 
-      "c", 
-      (data->addPtr2 = DummyPointer_New()), 
-      "d", 
-      0, 
-      DummyPointer_Print, 
-      DummyPointer_Copy );
-   Stg_ObjectList_GlobalPointerInsertAfter(  data->ol3, "c", (data->addPtr3 = (int*)DummyFunc4), "d" );
-
-   pcu_check_true(
-      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"d"  ) &&
-      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 2 ) &&
-      Stg_ObjectList_Count( data->ol0 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 3 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"d"  ) &&
-      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 2 ) &&
-      Stg_ObjectList_Count( &data->ol1 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 3 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"d"  ) &&
-      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 2 ) &&
-      Stg_ObjectList_Count( data->ol2 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 3 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"d"  ) &&
-      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 2 ) &&
-      Stg_ObjectList_Count( data->ol3 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 3 ) ), "a" ) == 0 );
-}
-
-   
-/* Test 6: Can we replace "d" with the fifth entry? */
-void ObjectListSuite_TestReplace( ObjectListSuiteData* data ) {
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"c"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"c"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"c", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"c"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"d"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"d"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"d", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"d"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
-
-   Stg_ObjectList_ClassReplace(  data->ol0, "d", DELETE, (data->addPtr0 = DummyClass_New()), "e" );
-   Stg_ObjectList_ClassReplace( &data->ol1, "d", DELETE, (data->addPtr1 = DummyClass_New()), "e" );
-   Stg_ObjectList_PointerReplace( data->ol2, "d", DELETE, (data->addPtr2 = DummyPointer_New()), (Name)"e", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerReplace( data->ol3, (Name)"d", DELETE, (data->addPtr3 = (int*)DummyFunc5), (Name)"e"  );
-   pcu_check_true(
-      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"e"  ) &&
-      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 2 ) &&
-      Stg_ObjectList_Count( data->ol0 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 3 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"e"  ) &&
-      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 2 ) &&
-      Stg_ObjectList_Count( &data->ol1 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 3 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"e"  ) &&
-      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 2 ) &&
-      Stg_ObjectList_Count( data->ol2 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 3 ) ), "a" ) == 0 );
-   pcu_check_true(
-      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"e"  ) &&
-      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 2 ) &&
-      Stg_ObjectList_Count( data->ol3 ) == 4 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "c" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 3 ) ), "a" ) == 0 );
-}
-   
-
-/* Test 7: Can we remove the "c" entry? */
-void ObjectListSuite_TestRemove( ObjectListSuiteData* data ) {
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"c"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"c"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"c", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"c"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"e"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"e"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"e", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"e"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
-
-   Stg_ObjectList_Remove( data->ol0, (Name)"c", DELETE  );
-   Stg_ObjectList_Remove( &data->ol1, (Name)"c", DELETE  );
-   Stg_ObjectList_Remove( data->ol2, (Name)"c", DELETE  );
-   Stg_ObjectList_Remove( data->ol3, (Name)"c", DELETE );
-
-   pcu_check_true(
-      Stg_ObjectList_Count( data->ol0 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object* )Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "e" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 2 ) ), "a" ) == 0 );
-   pcu_check_true(
-      Stg_ObjectList_Count( &data->ol1 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "e" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 2 ) ), "a" ) == 0 );
-   pcu_check_true(
-      Stg_ObjectList_Count( data->ol2 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "e" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 2 ) ), "a" ) == 0 );
-   pcu_check_true(
-      Stg_ObjectList_Count( data->ol3 ) == 3 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "e" ) == 0 &&
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 2 ) ), "a" ) == 0 );
-}
-
-   
-   /* Test 8: Can we replace all with the sixth entry? */
-void ObjectListSuite_TestReplaceAll( ObjectListSuiteData* data ) {
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"e"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"e"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"e", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"e"  );
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
-
-   Stg_ObjectList_ClassReplaceAll( data->ol0, DELETE, (data->addPtr0 = DummyClass_New()), (Name)"f"  );
-   Stg_ObjectList_ClassReplaceAll( &data->ol1, DELETE, (data->addPtr1 = DummyClass_New()), (Name)"f"  );
-   Stg_ObjectList_PointerReplaceAll(  
-      data->ol2, 
-      DELETE, 
-      (data->addPtr2 = DummyPointer_New()), 
-      "f", 
-      0, 
-      DummyPointer_Print, 
-      DummyPointer_Copy );
-   Stg_ObjectList_GlobalPointerReplaceAll(  data->ol3, DELETE, (data->addPtr3 = (int*)DummyFunc6), "f" );
-   pcu_check_true(
-      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"f"  ) &&
-      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 0 ) &&
-      Stg_ObjectList_Count( data->ol0 ) == 1 );
-   pcu_check_true(
-      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"f"  ) &&
-      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 0 ) &&
-      Stg_ObjectList_Count( &data->ol1 ) == 1 );
-   pcu_check_true(
-      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"f"  ) &&
-      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 0 ) &&
-      Stg_ObjectList_Count( data->ol2 ) == 1 );
-   pcu_check_true(
-      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"f"  ) &&
-      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 0 ) &&
-      Stg_ObjectList_Count( data->ol3 ) == 1 );
-}
-
-   
-/* Test 9: Copying */
-/* Shallow copying not yet implemented */
-/* Deep copying "OfPointer" (i.e. non-StGermain class) not yet implemented */
-void ObjectListSuite_TestCopy( ObjectListSuiteData* data ) {
-   Stg_ObjectList* ol0deep;
-   Stg_ObjectList* ol1deep;
-   Stg_ObjectList* ol2deep;
-   Stg_ObjectList* ol3deep;
-
-   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"f"  );
-   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"f"  );
-   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"f", 0, DummyPointer_Print, DummyPointer_Copy  );
-   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"f"  );
-
-   ol0deep = (Stg_ObjectList*)Stg_Class_Copy(  data->ol0, 0, True, 0, 0 );
-   ol1deep = (Stg_ObjectList*)Stg_Class_Copy( &data->ol1, 0, True, 0, 0 );
-   ol2deep = (Stg_ObjectList*)Stg_Class_Copy(  data->ol2, 0, True, 0, 0 );
-   ol3deep = (Stg_ObjectList*)Stg_Class_Copy(  data->ol3, 0, True, 0, 0 );
-
-   pcu_check_true(
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol0deep, 0 ) ), "f" ) == 0 &&
-      Stg_ObjectList_Count( ol0deep ) == 1 &&
-      Stg_ObjectList_ObjectAt( data->ol0, 0 ) != Stg_ObjectList_ObjectAt( ol0deep, 0 ) &&
-      Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( data->ol0, 0 ) ) == Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( ol0deep, 0 ) ) );
-   pcu_check_true(
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol1deep, 0 ) ), "f" ) == 0 &&
-      Stg_ObjectList_Count( ol1deep ) == 1 &&
-      Stg_ObjectList_ObjectAt( &data->ol1, 0 ) != Stg_ObjectList_ObjectAt( ol1deep, 0 ) &&
-      Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( &data->ol1, 0 ) ) == Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( ol1deep, 0 ) ) );
-   pcu_check_true(
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol2deep, 0 ) ), "f" ) == 0 &&
-      Stg_ObjectList_Count( ol2deep ) == 1 &&
-      Stg_ObjectList_ObjectAt( data->ol2, 0 ) != Stg_ObjectList_ObjectAt( ol2deep, 0 ) );
-   pcu_check_true(
-      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol3deep, 0 ) ), "f" ) == 0 &&
-      Stg_ObjectList_Count( ol3deep ) == 1 &&
-      Stg_ObjectList_ObjectAt( data->ol3, 0 ) == Stg_ObjectList_ObjectAt( ol3deep, 0 ) && /* different to others */
-      Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( data->ol3, 0 ) ) == Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( ol3deep, 0 ) ) );
-
-      Stg_Class_Delete(  ol3deep );
-      Stg_Class_Delete(  ol2deep );
-      Stg_Class_Delete(  ol1deep );
-      Stg_Class_Delete(  ol0deep );
-}
-
-
-void ObjectListSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ObjectListSuiteData );
-   pcu_suite_setFixtures( suite, ObjectListSuite_Setup, ObjectListSuite_Teardown );
-   pcu_suite_addTest( suite, ObjectListSuite_TestAppend );
-   pcu_suite_addTest( suite, ObjectListSuite_TestPrepend );
-   pcu_suite_addTest( suite, ObjectListSuite_TestInsertBefore );
-   pcu_suite_addTest( suite, ObjectListSuite_TestInsertAfter );
-   pcu_suite_addTest( suite, ObjectListSuite_TestReplace );
-   pcu_suite_addTest( suite, ObjectListSuite_TestRemove );
-   pcu_suite_addTest( suite, ObjectListSuite_TestReplaceAll );
-   pcu_suite_addTest( suite, ObjectListSuite_TestCopy );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/ObjectListSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/ObjectListSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,489 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testNamedStg_ObjectList.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "ObjectListSuite.h"
+
+const Type DummyClass_Type = "DummyClass_Type";
+
+
+typedef struct {
+   Stg_ObjectList* ol0;
+   Stg_ObjectList  ol1;
+   Stg_ObjectList* ol2;
+   Stg_ObjectList* ol3;
+   Stg_Class*      addPtr0;
+   Stg_Class*      addPtr1;
+   int*            addPtr2;
+   int*            addPtr3;
+} ObjectListSuiteData;
+
+Stg_Class* DummyClass_New( void ) {
+   return _Stg_Class_New( 
+      sizeof(Stg_Class),
+      DummyClass_Type,
+      _Stg_Class_Delete,
+      _Stg_Class_Print,
+      _Stg_Class_Copy );
+}
+
+int* DummyPointer_New( void ) {
+   return Memory_Alloc_Unnamed( int );
+}
+
+void DummyPointer_Print( void* ptr, struct Stream* stream ) {
+   Journal_Printf( stream, "value: %i\n", *(int*)ptr );
+}
+
+void* DummyPointer_Copy( const void* ptr, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+   int* newInt;
+   
+   newInt = Memory_Alloc_Unnamed( int );
+   *newInt = *(int*)ptr;
+   
+   return newInt;
+}
+
+
+void DummyFunc1( void ) {
+}
+
+void DummyFunc2( void ) {
+}
+
+void DummyFunc3( void ) {
+}
+
+void DummyFunc4( void ) {
+}
+
+void DummyFunc5( void ) {
+}
+
+void DummyFunc6( void ) {
+}
+
+
+void ObjectListSuite_Setup( ObjectListSuiteData* data ) {
+   data->ol0 = Stg_ObjectList_New();
+   Stg_ObjectList_Init( &data->ol1 );
+   data->ol2 = Stg_ObjectList_New();
+   data->ol3 = Stg_ObjectList_New();
+   data->addPtr0 = NULL;
+   data->addPtr1 = NULL;
+   data->addPtr2 = NULL;
+   data->addPtr3 = NULL;
+}
+
+
+void ObjectListSuite_Teardown( ObjectListSuiteData* data ) {
+      Stg_Class_Delete(  data->ol3 );
+      Stg_Class_Delete(  data->ol2 );
+      Stg_Class_Delete( &data->ol1 );
+      Stg_Class_Delete(  data->ol0 );
+}
+
+
+/* Test 2: Can we append the first entry? */
+void ObjectListSuite_TestAppend( ObjectListSuiteData* data ) {
+
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), "a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), "a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), "a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), "a"  );
+
+   pcu_check_true(
+      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"a"  ) &&
+      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 0 ) &&
+      Stg_ObjectList_Count( data->ol0 ) == 1 &&
+      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"a"  ) &&
+      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 0 ) &&
+      Stg_ObjectList_Count( &data->ol1 ) == 1 &&
+      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"a"  ) &&
+      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 0 ) &&
+      Stg_ObjectList_Count( data->ol2 ) == 1 &&
+      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"a"  ) &&
+      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 0 ) &&
+      Stg_ObjectList_Count( data->ol3 ) == 1 );
+}
+
+   
+/* Test 3: Can we prepend the second entry? */
+void ObjectListSuite_TestPrepend( ObjectListSuiteData* data ) {
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
+
+   Stg_ObjectList_ClassPrepend(  data->ol0, (data->addPtr0 = DummyClass_New()), "b" );
+   Stg_ObjectList_ClassPrepend( &data->ol1, (data->addPtr1 = DummyClass_New()), "b" );
+   Stg_ObjectList_PointerPrepend(  data->ol2, (data->addPtr2 = DummyPointer_New()), "b", 0, DummyPointer_Print, DummyPointer_Copy );
+   Stg_ObjectList_GlobalPointerPrepend(  data->ol3, (data->addPtr3 = (int*)DummyFunc2), "b" );
+
+   pcu_check_true(
+      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"b"  ) &&
+      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 0 ) &&
+      Stg_ObjectList_Count( data->ol0 ) == 2 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"b"  ) &&
+      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 0 ) &&
+      Stg_ObjectList_Count( &data->ol1 ) == 2 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"b"  ) &&
+      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 0 ) &&
+      Stg_ObjectList_Count( data->ol2 ) == 2 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"b"  ) &&
+      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 0 ) &&
+      Stg_ObjectList_Count( data->ol3 ) == 2 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "a" ) == 0 );
+}
+
+   
+/* Test 4: Can we insert before "a" the third entry? */
+void ObjectListSuite_TestInsertBefore( ObjectListSuiteData* data ) {
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
+
+   Stg_ObjectList_ClassInsertBefore(  data->ol0, "a", (data->addPtr0 = DummyClass_New()), "c" );
+   Stg_ObjectList_ClassInsertBefore( &data->ol1, "a", (data->addPtr1 = DummyClass_New()), "c" );
+   Stg_ObjectList_PointerInsertBefore(  
+      data->ol2, 
+      "a", 
+      (data->addPtr2 = DummyPointer_New()), 
+      "c", 
+      0, 
+      DummyPointer_Print, 
+      DummyPointer_Copy );
+   Stg_ObjectList_GlobalPointerInsertBefore(  data->ol3, "a", (data->addPtr3 = (int*)DummyFunc3), "c" );
+
+   pcu_check_true(
+      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"c"  ) &&
+      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 1 ) &&
+      Stg_ObjectList_Count( data->ol0 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 2 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"c"  ) &&
+      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 1 ) &&
+      Stg_ObjectList_Count( &data->ol1 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 2 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"c"  ) &&
+      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 1 ) &&
+      Stg_ObjectList_Count( data->ol2 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 2 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"c"  ) &&
+      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 1 ) &&
+      Stg_ObjectList_Count( data->ol3 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 2 ) ), "a" ) == 0 );
+}
+   
+
+/* Test 5: Can we insert after "c" the fourth entry? */
+void ObjectListSuite_TestInsertAfter( ObjectListSuiteData* data ) {
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"c"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"c"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"c", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"c"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
+
+   Stg_ObjectList_ClassInsertAfter(  data->ol0, "c", (data->addPtr0 = DummyClass_New()), "d" );
+   Stg_ObjectList_ClassInsertAfter( &data->ol1, "c", (data->addPtr1 = DummyClass_New()), "d" );
+
+   Stg_ObjectList_PointerInsertAfter(  
+      data->ol2, 
+      "c", 
+      (data->addPtr2 = DummyPointer_New()), 
+      "d", 
+      0, 
+      DummyPointer_Print, 
+      DummyPointer_Copy );
+   Stg_ObjectList_GlobalPointerInsertAfter(  data->ol3, "c", (data->addPtr3 = (int*)DummyFunc4), "d" );
+
+   pcu_check_true(
+      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"d"  ) &&
+      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 2 ) &&
+      Stg_ObjectList_Count( data->ol0 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 3 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"d"  ) &&
+      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 2 ) &&
+      Stg_ObjectList_Count( &data->ol1 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 3 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"d"  ) &&
+      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 2 ) &&
+      Stg_ObjectList_Count( data->ol2 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 3 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"d"  ) &&
+      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 2 ) &&
+      Stg_ObjectList_Count( data->ol3 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 3 ) ), "a" ) == 0 );
+}
+
+   
+/* Test 6: Can we replace "d" with the fifth entry? */
+void ObjectListSuite_TestReplace( ObjectListSuiteData* data ) {
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"c"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"c"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"c", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"c"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"d"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"d"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"d", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"d"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
+
+   Stg_ObjectList_ClassReplace(  data->ol0, "d", DELETE, (data->addPtr0 = DummyClass_New()), "e" );
+   Stg_ObjectList_ClassReplace( &data->ol1, "d", DELETE, (data->addPtr1 = DummyClass_New()), "e" );
+   Stg_ObjectList_PointerReplace( data->ol2, "d", DELETE, (data->addPtr2 = DummyPointer_New()), (Name)"e", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerReplace( data->ol3, (Name)"d", DELETE, (data->addPtr3 = (int*)DummyFunc5), (Name)"e"  );
+   pcu_check_true(
+      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"e"  ) &&
+      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 2 ) &&
+      Stg_ObjectList_Count( data->ol0 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 3 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"e"  ) &&
+      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 2 ) &&
+      Stg_ObjectList_Count( &data->ol1 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 3 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"e"  ) &&
+      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 2 ) &&
+      Stg_ObjectList_Count( data->ol2 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 3 ) ), "a" ) == 0 );
+   pcu_check_true(
+      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"e"  ) &&
+      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 2 ) &&
+      Stg_ObjectList_Count( data->ol3 ) == 4 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "c" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 3 ) ), "a" ) == 0 );
+}
+   
+
+/* Test 7: Can we remove the "c" entry? */
+void ObjectListSuite_TestRemove( ObjectListSuiteData* data ) {
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"c"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"c"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"c", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"c"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"e"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"e"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"e", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"e"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
+
+   Stg_ObjectList_Remove( data->ol0, (Name)"c", DELETE  );
+   Stg_ObjectList_Remove( &data->ol1, (Name)"c", DELETE  );
+   Stg_ObjectList_Remove( data->ol2, (Name)"c", DELETE  );
+   Stg_ObjectList_Remove( data->ol3, (Name)"c", DELETE );
+
+   pcu_check_true(
+      Stg_ObjectList_Count( data->ol0 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object* )Stg_ObjectList_At( data->ol0, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 1 ) ), "e" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol0, 2 ) ), "a" ) == 0 );
+   pcu_check_true(
+      Stg_ObjectList_Count( &data->ol1 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 1 ) ), "e" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( &data->ol1, 2 ) ), "a" ) == 0 );
+   pcu_check_true(
+      Stg_ObjectList_Count( data->ol2 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 1 ) ), "e" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol2, 2 ) ), "a" ) == 0 );
+   pcu_check_true(
+      Stg_ObjectList_Count( data->ol3 ) == 3 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 0 ) ), "b" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 1 ) ), "e" ) == 0 &&
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( data->ol3, 2 ) ), "a" ) == 0 );
+}
+
+   
+   /* Test 8: Can we replace all with the sixth entry? */
+void ObjectListSuite_TestReplaceAll( ObjectListSuiteData* data ) {
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"b"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"b", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"b"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"e"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"e"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"e", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"e"  );
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"a"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"a", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"a"  );
+
+   Stg_ObjectList_ClassReplaceAll( data->ol0, DELETE, (data->addPtr0 = DummyClass_New()), (Name)"f"  );
+   Stg_ObjectList_ClassReplaceAll( &data->ol1, DELETE, (data->addPtr1 = DummyClass_New()), (Name)"f"  );
+   Stg_ObjectList_PointerReplaceAll(  
+      data->ol2, 
+      DELETE, 
+      (data->addPtr2 = DummyPointer_New()), 
+      "f", 
+      0, 
+      DummyPointer_Print, 
+      DummyPointer_Copy );
+   Stg_ObjectList_GlobalPointerReplaceAll(  data->ol3, DELETE, (data->addPtr3 = (int*)DummyFunc6), "f" );
+   pcu_check_true(
+      data->addPtr0 == Stg_ObjectList_Get( data->ol0, (Name)"f"  ) &&
+      data->addPtr0 == Stg_ObjectList_ObjectAt( data->ol0, 0 ) &&
+      Stg_ObjectList_Count( data->ol0 ) == 1 );
+   pcu_check_true(
+      data->addPtr1 == Stg_ObjectList_Get( &data->ol1, (Name)"f"  ) &&
+      data->addPtr1 == Stg_ObjectList_ObjectAt( &data->ol1, 0 ) &&
+      Stg_ObjectList_Count( &data->ol1 ) == 1 );
+   pcu_check_true(
+      data->addPtr2 == Stg_ObjectList_Get( data->ol2, (Name)"f"  ) &&
+      data->addPtr2 == Stg_ObjectList_ObjectAt( data->ol2, 0 ) &&
+      Stg_ObjectList_Count( data->ol2 ) == 1 );
+   pcu_check_true(
+      data->addPtr3 == Stg_ObjectList_Get( data->ol3, (Name)"f"  ) &&
+      data->addPtr3 == Stg_ObjectList_ObjectAt( data->ol3, 0 ) &&
+      Stg_ObjectList_Count( data->ol3 ) == 1 );
+}
+
+   
+/* Test 9: Copying */
+/* Shallow copying not yet implemented */
+/* Deep copying "OfPointer" (i.e. non-StGermain class) not yet implemented */
+void ObjectListSuite_TestCopy( ObjectListSuiteData* data ) {
+   Stg_ObjectList* ol0deep;
+   Stg_ObjectList* ol1deep;
+   Stg_ObjectList* ol2deep;
+   Stg_ObjectList* ol3deep;
+
+   Stg_ObjectList_ClassAppend( data->ol0, (data->addPtr0 = DummyClass_New()), (Name)"f"  );
+   Stg_ObjectList_ClassAppend( &data->ol1, (data->addPtr1 = DummyClass_New()), (Name)"f"  );
+   Stg_ObjectList_PointerAppend( data->ol2, (data->addPtr2 = DummyPointer_New()), (Name)"f", 0, DummyPointer_Print, DummyPointer_Copy  );
+   Stg_ObjectList_GlobalPointerAppend( data->ol3, (data->addPtr3 = (int*)DummyFunc1), (Name)"f"  );
+
+   ol0deep = (Stg_ObjectList*)Stg_Class_Copy(  data->ol0, 0, True, 0, 0 );
+   ol1deep = (Stg_ObjectList*)Stg_Class_Copy( &data->ol1, 0, True, 0, 0 );
+   ol2deep = (Stg_ObjectList*)Stg_Class_Copy(  data->ol2, 0, True, 0, 0 );
+   ol3deep = (Stg_ObjectList*)Stg_Class_Copy(  data->ol3, 0, True, 0, 0 );
+
+   pcu_check_true(
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol0deep, 0 ) ), "f" ) == 0 &&
+      Stg_ObjectList_Count( ol0deep ) == 1 &&
+      Stg_ObjectList_ObjectAt( data->ol0, 0 ) != Stg_ObjectList_ObjectAt( ol0deep, 0 ) &&
+      Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( data->ol0, 0 ) ) == Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( ol0deep, 0 ) ) );
+   pcu_check_true(
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol1deep, 0 ) ), "f" ) == 0 &&
+      Stg_ObjectList_Count( ol1deep ) == 1 &&
+      Stg_ObjectList_ObjectAt( &data->ol1, 0 ) != Stg_ObjectList_ObjectAt( ol1deep, 0 ) &&
+      Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( &data->ol1, 0 ) ) == Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( ol1deep, 0 ) ) );
+   pcu_check_true(
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol2deep, 0 ) ), "f" ) == 0 &&
+      Stg_ObjectList_Count( ol2deep ) == 1 &&
+      Stg_ObjectList_ObjectAt( data->ol2, 0 ) != Stg_ObjectList_ObjectAt( ol2deep, 0 ) );
+   pcu_check_true(
+      strcmp( Stg_Object_GetName( (Stg_Object*)Stg_ObjectList_At( ol3deep, 0 ) ), "f" ) == 0 &&
+      Stg_ObjectList_Count( ol3deep ) == 1 &&
+      Stg_ObjectList_ObjectAt( data->ol3, 0 ) == Stg_ObjectList_ObjectAt( ol3deep, 0 ) && /* different to others */
+      Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( data->ol3, 0 ) ) == Stg_Class_GetType( (Stg_Class*)Stg_ObjectList_ObjectAt( ol3deep, 0 ) ) );
+
+      Stg_Class_Delete(  ol3deep );
+      Stg_Class_Delete(  ol2deep );
+      Stg_Class_Delete(  ol1deep );
+      Stg_Class_Delete(  ol0deep );
+}
+
+
+void ObjectListSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ObjectListSuiteData );
+   pcu_suite_setFixtures( suite, ObjectListSuite_Setup, ObjectListSuite_Teardown );
+   pcu_suite_addTest( suite, ObjectListSuite_TestAppend );
+   pcu_suite_addTest( suite, ObjectListSuite_TestPrepend );
+   pcu_suite_addTest( suite, ObjectListSuite_TestInsertBefore );
+   pcu_suite_addTest( suite, ObjectListSuite_TestInsertAfter );
+   pcu_suite_addTest( suite, ObjectListSuite_TestReplace );
+   pcu_suite_addTest( suite, ObjectListSuite_TestRemove );
+   pcu_suite_addTest( suite, ObjectListSuite_TestReplaceAll );
+   pcu_suite_addTest( suite, ObjectListSuite_TestCopy );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/PrimitiveObjectSuite.c
--- a/Base/Foundation/tests/PrimitiveObjectSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testNamedStg_ObjectList.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "PrimitiveObjectSuite.h"
-
-
-typedef struct {
-} PrimitiveObjectSuiteData;
-
-void PrimitiveObjectSuite_Setup( PrimitiveObjectSuiteData* data ) {
-}
-
-void PrimitiveObjectSuite_Teardown( PrimitiveObjectSuiteData* data ) {
-}
-
-
-/* Note that since the key feature of the PrimitiveObject component that was tested was really
- * the print capacity, I've had to use the journal outputting to file approach again */
-void PrimitiveObjectSuite_TestPrimObjects( PrimitiveObjectSuiteData* data ) {
-   Stg_ObjectList*      list;
-   Stg_PrimitiveObject* primObject;
-
-   list = Stg_ObjectList_New();
-
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedChar( 'a', (Name)"char item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedShort( 123, (Name)"short item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedInt( 456, (Name)"int item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedLong( 789, (Name)"long item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Char( 'a', (Name)"char item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Short( -123, (Name)"short item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Int( -456, (Name)"int item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Long( -789, (Name)"long item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Float( 1.2f, (Name)"float item" )  );
-   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Double( 2.4, (Name)"double item" ) );
-
-   primObject = (Stg_PrimitiveObject* )Stg_ObjectList_At( list, 0 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedChar );
-   pcu_check_true( primObject->value.asUnsignedChar == 'a' );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 1 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedShort );
-   pcu_check_true( primObject->value.asUnsignedShort == 123 );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 2 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedInt );
-   pcu_check_true( primObject->value.asUnsignedInt == 456 );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 3 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedLong );
-   pcu_check_true( primObject->value.asUnsignedLong == 789 );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 4 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Char );
-   pcu_check_true( primObject->value.asChar == 'a' );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 5 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Short );
-   pcu_check_true( primObject->value.asShort == -123 );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 6 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Int );
-   pcu_check_true( primObject->value.asInt == -456 );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 7 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Long );
-   pcu_check_true( primObject->value.asLong == -789 );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 8 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Float );
-   pcu_check_true( primObject->value.asFloat == 1.2f );
-   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 9 );
-   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Double );
-   pcu_check_true( primObject->value.asDouble == 2.4 );
-
-   Stg_Class_Delete( list );
-}
-
-
-void PrimitiveObjectSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, PrimitiveObjectSuiteData );
-   pcu_suite_setFixtures( suite, PrimitiveObjectSuite_Setup, PrimitiveObjectSuite_Teardown );
-   pcu_suite_addTest( suite, PrimitiveObjectSuite_TestPrimObjects );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/PrimitiveObjectSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/PrimitiveObjectSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,113 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testNamedStg_ObjectList.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "PrimitiveObjectSuite.h"
+
+
+typedef struct {
+} PrimitiveObjectSuiteData;
+
+void PrimitiveObjectSuite_Setup( PrimitiveObjectSuiteData* data ) {
+}
+
+void PrimitiveObjectSuite_Teardown( PrimitiveObjectSuiteData* data ) {
+}
+
+
+/* Note that since the key feature of the PrimitiveObject component that was tested was really
+ * the print capacity, I've had to use the journal outputting to file approach again */
+void PrimitiveObjectSuite_TestPrimObjects( PrimitiveObjectSuiteData* data ) {
+   Stg_ObjectList*      list;
+   Stg_PrimitiveObject* primObject;
+
+   list = Stg_ObjectList_New();
+
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedChar( 'a', (Name)"char item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedShort( 123, (Name)"short item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedInt( 456, (Name)"int item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_UnsignedLong( 789, (Name)"long item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Char( 'a', (Name)"char item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Short( -123, (Name)"short item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Int( -456, (Name)"int item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Long( -789, (Name)"long item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Float( 1.2f, (Name)"float item" )  );
+   Stg_ObjectList_Append( list, Stg_PrimitiveObject_New_Double( 2.4, (Name)"double item" ) );
+
+   primObject = (Stg_PrimitiveObject* )Stg_ObjectList_At( list, 0 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedChar );
+   pcu_check_true( primObject->value.asUnsignedChar == 'a' );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 1 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedShort );
+   pcu_check_true( primObject->value.asUnsignedShort == 123 );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 2 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedInt );
+   pcu_check_true( primObject->value.asUnsignedInt == 456 );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 3 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_UnsignedLong );
+   pcu_check_true( primObject->value.asUnsignedLong == 789 );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 4 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Char );
+   pcu_check_true( primObject->value.asChar == 'a' );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 5 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Short );
+   pcu_check_true( primObject->value.asShort == -123 );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 6 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Int );
+   pcu_check_true( primObject->value.asInt == -456 );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 7 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Long );
+   pcu_check_true( primObject->value.asLong == -789 );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 8 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Float );
+   pcu_check_true( primObject->value.asFloat == 1.2f );
+   primObject = (Stg_PrimitiveObject*)Stg_ObjectList_At( list, 9 );
+   pcu_check_true( primObject->dataType == Stg_C_Primitive_Type_Double );
+   pcu_check_true( primObject->value.asDouble == 2.4 );
+
+   Stg_Class_Delete( list );
+}
+
+
+void PrimitiveObjectSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, PrimitiveObjectSuiteData );
+   pcu_suite_setFixtures( suite, PrimitiveObjectSuite_Setup, PrimitiveObjectSuite_Teardown );
+   pcu_suite_addTest( suite, PrimitiveObjectSuite_TestPrimObjects );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/Stg_asprintfSuite.c
--- a/Base/Foundation/tests/Stg_asprintfSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testNamedStg_ObjectList.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <string.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "Stg_asprintfSuite.h"
-
-typedef struct {
-} Stg_asprintfSuiteData;
-
-void Stg_asprintfSuite_Setup( Stg_asprintfSuiteData* data ) {
-}
-
-void Stg_asprintfSuite_Teardown( Stg_asprintfSuiteData* data ) {
-}
-
-void Stg_asprintfSuite_TestPrint( Stg_asprintfSuiteData* data ) {
-	Name  fiftyBytes = "01234567890123456789012345678901234567890123456789";
-	char*        testString;
-	char*        testStringPtr;
-   unsigned int offset=0;
-
-	/* Stress testing Stg_asprintf beyond the default alloc number of bytes */
-	Stg_asprintf( &testString, "%s%s%s%s", fiftyBytes, fiftyBytes, fiftyBytes, fiftyBytes );
-	pcu_check_true( 200 == strlen( testString ) );
-   for ( offset=0; offset < 200; offset+=50 ) {
-      testStringPtr = testString + offset;
-      pcu_check_true( 0 == strncmp( fiftyBytes, testStringPtr, 50 ) );
-   }
-	Memory_Free( testString );
-}
-
-void Stg_asprintfSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, Stg_asprintfSuiteData );
-   pcu_suite_setFixtures( suite, Stg_asprintfSuite_Setup, Stg_asprintfSuite_Teardown );
-   pcu_suite_addTest( suite, Stg_asprintfSuite_TestPrint );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/Stg_asprintfSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/Stg_asprintfSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,70 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testNamedStg_ObjectList.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "Stg_asprintfSuite.h"
+
+typedef struct {
+} Stg_asprintfSuiteData;
+
+void Stg_asprintfSuite_Setup( Stg_asprintfSuiteData* data ) {
+}
+
+void Stg_asprintfSuite_Teardown( Stg_asprintfSuiteData* data ) {
+}
+
+void Stg_asprintfSuite_TestPrint( Stg_asprintfSuiteData* data ) {
+	Name  fiftyBytes = "01234567890123456789012345678901234567890123456789";
+	char*        testString;
+	char*        testStringPtr;
+   unsigned int offset=0;
+
+	/* Stress testing Stg_asprintf beyond the default alloc number of bytes */
+	Stg_asprintf( &testString, "%s%s%s%s", fiftyBytes, fiftyBytes, fiftyBytes, fiftyBytes );
+	pcu_check_true( 200 == strlen( testString ) );
+   for ( offset=0; offset < 200; offset+=50 ) {
+      testStringPtr = testString + offset;
+      pcu_check_true( 0 == strncmp( fiftyBytes, testStringPtr, 50 ) );
+   }
+	Memory_Free( testString );
+}
+
+void Stg_asprintfSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, Stg_asprintfSuiteData );
+   pcu_suite_setFixtures( suite, Stg_asprintfSuite_Setup, Stg_asprintfSuite_Teardown );
+   pcu_suite_addTest( suite, Stg_asprintfSuite_TestPrint );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/TimeMonitorSuite.c
--- a/Base/Foundation/tests/TimeMonitorSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: testNamedStg_TimeMonitor.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <math.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
-#include "TimeMonitorSuite.h"
-
-typedef struct {
-} TimeMonitorSuiteData;
-
-void TimeMonitorSuite_Setup( TimeMonitorSuiteData* data ) {
-}
-
-void TimeMonitorSuite_Teardown( TimeMonitorSuiteData* data ) {
-}
-
-void TimeMonitorSuite_TestTimingPeriod( TimeMonitorSuiteData* data ) {
-   #define           MAXLINE 1000
-   TimeMonitorData   tmData;
-   Stg_TimeMonitor*  tm=NULL;
-   double            percentOfTotalCalc;
-
-   Stg_TimeMonitor_SetTimerWatchCriteria( 0.5 );
-
-   tm = Stg_TimeMonitor_New( "test", True, False /*Don't print*/, MPI_COMM_WORLD );
-   sleep( 1 );
-   Stg_TimeMonitor_Begin( tm );
-   sleep( 2 );
-   Stg_TimeMonitor_End( tm, &tmData );
-
-	printf( "Total Since Init: %f\n", tmData.totalSinceInit );
-   pcu_check_true( ( (double)2.95 < tmData.totalSinceInit ) && ( tmData.totalSinceInit < (double)5.05 ) );
-   pcu_check_true( ( 1.95 < tmData.dt ) && ( tmData.dt < 2.05 ) );
-   pcu_check_true( ( 1.95 < tmData.aveProcDt ) && ( tmData.aveProcDt < 2.05 ) );
-   percentOfTotalCalc = tmData.aveProcDt / tmData.totalSinceInit * 100;
-   pcu_check_true( fabs( percentOfTotalCalc - tmData.percentTM_ofTotal ) < 0.01 );
-   pcu_check_true( tmData.criterionPassed == True );
-
-   Stg_TimeMonitor_Delete( tm );
-}
-
-void TimeMonitorSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, TimeMonitorSuiteData );
-   pcu_suite_setFixtures( suite, TimeMonitorSuite_Setup, TimeMonitorSuite_Teardown );
-   pcu_suite_addTest( suite, TimeMonitorSuite_TestTimingPeriod );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Foundation/tests/TimeMonitorSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Foundation/tests/TimeMonitorSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,81 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testNamedStg_TimeMonitor.c 2432 2005-08-08 23:01:59Z Raquibul Hassan $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <unistd.h>
+#include <stdio.h>
+#include <math.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/Foundation/forwardDecl.h" /* For Journal stuff */
+#include "TimeMonitorSuite.h"
+
+typedef struct {
+} TimeMonitorSuiteData;
+
+void TimeMonitorSuite_Setup( TimeMonitorSuiteData* data ) {
+}
+
+void TimeMonitorSuite_Teardown( TimeMonitorSuiteData* data ) {
+}
+
+void TimeMonitorSuite_TestTimingPeriod( TimeMonitorSuiteData* data ) {
+   #define           MAXLINE 1000
+   TimeMonitorData   tmData;
+   Stg_TimeMonitor*  tm=NULL;
+   double            percentOfTotalCalc;
+
+   Stg_TimeMonitor_SetTimerWatchCriteria( 0.5 );
+
+   tm = Stg_TimeMonitor_New( "test", True, False /*Don't print*/, MPI_COMM_WORLD );
+   sleep( 1 );
+   Stg_TimeMonitor_Begin( tm );
+   sleep( 2 );
+   Stg_TimeMonitor_End( tm, &tmData );
+
+	printf( "Total Since Init: %f\n", tmData.totalSinceInit );
+   pcu_check_true( ( (double)2.95 < tmData.totalSinceInit ) && ( tmData.totalSinceInit < (double)5.05 ) );
+   pcu_check_true( ( 1.95 < tmData.dt ) && ( tmData.dt < 2.05 ) );
+   pcu_check_true( ( 1.95 < tmData.aveProcDt ) && ( tmData.aveProcDt < 2.05 ) );
+   percentOfTotalCalc = tmData.aveProcDt / tmData.totalSinceInit * 100;
+   pcu_check_true( fabs( percentOfTotalCalc - tmData.percentTM_ofTotal ) < 0.01 );
+   pcu_check_true( tmData.criterionPassed == True );
+
+   Stg_TimeMonitor_Delete( tm );
+}
+
+void TimeMonitorSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, TimeMonitorSuiteData );
+   pcu_suite_setFixtures( suite, TimeMonitorSuite_Setup, TimeMonitorSuite_Teardown );
+   pcu_suite_addTest( suite, TimeMonitorSuite_TestTimingPeriod );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/BinaryStream.c
--- a/Base/IO/src/BinaryStream.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id:  $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "Stream.h"
-#include "BinaryStream.h"
-
-#include "Base/IO/mpirecord/mpimessaging.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <stdarg.h>   /* Subsequent files need this for variable argument lists. */
-
-#include "Journal.h"
-
-
-const Type BinaryStream_Type = "BinaryStream";
-
-
-Stream* BinaryStream_New( Name name )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(BinaryStream);
-	Type                              type = BinaryStream_Type;
-	Stg_Class_DeleteFunction*      _delete = _BinaryStream_Delete;
-	Stg_Class_PrintFunction*        _print = _BinaryStream_Print;
-	Stg_Class_CopyFunction*          _copy = _Stream_Copy;
-	Stream_PrintfFunction*         _printf = _BinaryStream_Printf;
-	Stream_WriteFunction*           _write = _BinaryStream_Write;
-	Stream_DumpFunction*             _dump = _BinaryStream_Dump;
-	Stream_SetFileFunction*       _setFile = _BinaryStream_SetFile;
-
-	return (Stream*)_BinaryStream_New(  BINARYSTREAM_PASSARGS  );
-}
-
-BinaryStream* _BinaryStream_New(  BINARYSTREAM_DEFARGS  )
-{
-	BinaryStream* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(BinaryStream) );
-	self = (BinaryStream*)_Stream_New(  STREAM_PASSARGS  );
-	
-	_BinaryStream_Init( self );
-	
-	return self;
-}
-
-void _BinaryStream_Init( BinaryStream* self )
-{
-	self->defaultFileType = CFileBinary_New;
-}
-	
-void _BinaryStream_Delete( void* cStream )
-{
-	BinaryStream* self = (BinaryStream*)cStream;
-	
-	/* Stg_Class_Delete parent */
-	_Stream_Delete( self );
-}
-
-void _BinaryStream_Print( void* BinaryStream, Stream* stream ) {
-	/* TODO? */
-		
-}
-	
-SizeT _BinaryStream_Printf( Stream* stream, const char *fmt, va_list args )
-{
-	/* TODO? */
-	return False;
-}
-	
-SizeT _BinaryStream_Write( Stream* stream, const void *data, SizeT elem_size, SizeT num_elems )
-{
-	BinaryStream* self = (BinaryStream*)stream;
-	
-	return fwrite(data,elem_size,num_elems,(FILE*)(self->_file->fileHandle));
-}
-	
-Bool _BinaryStream_Dump( Stream* stream, const void *data )
-{
-	/* No specific dumping mechanism, can create in derived classes */
-	return False;
-}
-
-Bool _BinaryStream_SetFile( Stream* stream, JournalFile* file )
-{
-	if ( file->type == CFile_Type )
-	{
-		stream->_file = file;
-		return True;
-	}
-	return False;
-}
-
-void BinaryStream_WriteAllProcessors( Name filename, void *data, SizeT elem_size, SizeT num_elems, MPI_Comm comm ) {
-	Stream*    stream = Journal_Register( BinaryStream_Type, BinaryStream_Type );
-	MPI_Status status;
-	int        rank;
-	int        nproc;
-	int        confirmation = 0;
-	const int         FINISHED_WRITING_TAG = 100;	
-	MPI_Comm_rank( comm, &rank );
-	MPI_Comm_size( comm, &nproc );
-
-	/* wait for go-ahead from process ranked lower than me, to avoid competition writing to file */
-	if ( rank != 0 ) {
-		MPI_Recv( &confirmation, 1, MPI_INT, rank - 1, FINISHED_WRITING_TAG, comm, &status );
-	}	
-        /* open the file */
-	if ( rank == 0 ) {
-		Stream_RedirectFile( stream, filename );
-	}
-	else {
-		Stream_AppendFile( stream, filename );
-	}	
-
-        /* write the data */
-	Stream_Write( stream, data, elem_size, num_elems );
-
-	/* close the file */
-	Stream_CloseFile( stream);	
-	/* send go-ahead from process ranked lower than me, to avoid competition writing to file */
-	if ( rank != nproc - 1 ) {
-		MPI_Ssend( &confirmation, 1, MPI_INT, rank + 1, FINISHED_WRITING_TAG, comm );
-	}	
-
-	return;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/BinaryStream.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/BinaryStream.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,168 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id:  $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "Stream.h"
+#include "BinaryStream.h"
+
+#include "Base/IO/mpirecord/mpimessaging.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <stdarg.h>   /* Subsequent files need this for variable argument lists. */
+
+#include "Journal.h"
+
+
+const Type BinaryStream_Type = "BinaryStream";
+
+
+Stream* BinaryStream_New( Name name )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(BinaryStream);
+	Type                              type = BinaryStream_Type;
+	Stg_Class_DeleteFunction*      _delete = _BinaryStream_Delete;
+	Stg_Class_PrintFunction*        _print = _BinaryStream_Print;
+	Stg_Class_CopyFunction*          _copy = _Stream_Copy;
+	Stream_PrintfFunction*         _printf = _BinaryStream_Printf;
+	Stream_WriteFunction*           _write = _BinaryStream_Write;
+	Stream_DumpFunction*             _dump = _BinaryStream_Dump;
+	Stream_SetFileFunction*       _setFile = _BinaryStream_SetFile;
+
+	return (Stream*)_BinaryStream_New(  BINARYSTREAM_PASSARGS  );
+}
+
+BinaryStream* _BinaryStream_New(  BINARYSTREAM_DEFARGS  )
+{
+	BinaryStream* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(BinaryStream) );
+	self = (BinaryStream*)_Stream_New(  STREAM_PASSARGS  );
+	
+	_BinaryStream_Init( self );
+	
+	return self;
+}
+
+void _BinaryStream_Init( BinaryStream* self )
+{
+	self->defaultFileType = CFileBinary_New;
+}
+	
+void _BinaryStream_Delete( void* cStream )
+{
+	BinaryStream* self = (BinaryStream*)cStream;
+	
+	/* Stg_Class_Delete parent */
+	_Stream_Delete( self );
+}
+
+void _BinaryStream_Print( void* BinaryStream, Stream* stream ) {
+	/* TODO? */
+		
+}
+	
+SizeT _BinaryStream_Printf( Stream* stream, const char *fmt, va_list args )
+{
+	/* TODO? */
+	return False;
+}
+	
+SizeT _BinaryStream_Write( Stream* stream, const void *data, SizeT elem_size, SizeT num_elems )
+{
+	BinaryStream* self = (BinaryStream*)stream;
+	
+	return fwrite(data,elem_size,num_elems,(FILE*)(self->_file->fileHandle));
+}
+	
+Bool _BinaryStream_Dump( Stream* stream, const void *data )
+{
+	/* No specific dumping mechanism, can create in derived classes */
+	return False;
+}
+
+Bool _BinaryStream_SetFile( Stream* stream, JournalFile* file )
+{
+	if ( file->type == CFile_Type )
+	{
+		stream->_file = file;
+		return True;
+	}
+	return False;
+}
+
+void BinaryStream_WriteAllProcessors( Name filename, void *data, SizeT elem_size, SizeT num_elems, MPI_Comm comm ) {
+	Stream*    stream = Journal_Register( BinaryStream_Type, BinaryStream_Type );
+	MPI_Status status;
+	int        rank;
+	int        nproc;
+	int        confirmation = 0;
+	const int         FINISHED_WRITING_TAG = 100;	
+	MPI_Comm_rank( comm, &rank );
+	MPI_Comm_size( comm, &nproc );
+
+	/* wait for go-ahead from process ranked lower than me, to avoid competition writing to file */
+	if ( rank != 0 ) {
+		MPI_Recv( &confirmation, 1, MPI_INT, rank - 1, FINISHED_WRITING_TAG, comm, &status );
+	}	
+        /* open the file */
+	if ( rank == 0 ) {
+		Stream_RedirectFile( stream, filename );
+	}
+	else {
+		Stream_AppendFile( stream, filename );
+	}	
+
+        /* write the data */
+	Stream_Write( stream, data, elem_size, num_elems );
+
+	/* close the file */
+	Stream_CloseFile( stream);	
+	/* send go-ahead from process ranked lower than me, to avoid competition writing to file */
+	if ( rank != nproc - 1 ) {
+		MPI_Ssend( &confirmation, 1, MPI_INT, rank + 1, FINISHED_WRITING_TAG, comm );
+	}	
+
+	return;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/CFile.c
--- a/Base/IO/src/CFile.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: CFile.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "Stream.h"
-#include "Journal.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-const Type CFile_Type = "CFile";
-
-
-JournalFile* CFile_New()
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(CFile);
-	Type                              type = CFile_Type;
-	Stg_Class_DeleteFunction*      _delete = _CFile_Delete;
-	Stg_Class_PrintFunction*        _print = _CFile_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-	Bool                            binary = False;
-
-	return (JournalFile*)_CFile_New(  CFILE_PASSARGS  );
-}
-
-JournalFile* CFileBinary_New()
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(CFile);
-	Type                              type = CFile_Type;
-	Stg_Class_DeleteFunction*      _delete = _CFile_Delete;
-	Stg_Class_PrintFunction*        _print = _CFile_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-	Bool                            binary = True;
-
-	return (JournalFile*)_CFile_New(  CFILE_PASSARGS  );
-}
-
-
-JournalFile* CFile_New2( Name fileName )
-{
-	JournalFile* result = CFile_New();
-
-	if ( !JournalFile_Open( result, fileName ) )
-	{
-		/* File could not be opened successfully. Return cleanly. */
-		Stg_Class_Delete( result );
-		result = NULL;
-	}
-	
-	return result;
-}
-
-CFile* _CFile_New(  CFILE_DEFARGS  )
-{
-	CFile* self;
-	
-	self = (CFile*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	self->binary = binary;
-	
-	_CFile_Init( self );
-	
-	return self;
-}
-	
-void CFile_Init( CFile* self )
-{
-	/* Set virtual info. */
-	self->_sizeOfSelf = sizeof(CFile);
-	self->type = CFile_Type;
-	self->_delete = _CFile_Delete;
-	self->_print = _CFile_Print;
-	self->_copy = NULL;
-	
-	_CFile_Init( self );
-}
-	
-void _CFile_Init( CFile* self )
-{
-	_JournalFile_Init( (JournalFile*)self, (JournalFile_OpenFunction*)_CFile_Open,
-		(JournalFile_AppendFunction*)_CFile_Append, _CFile_Close, _CFile_Flush );
-}
-	
-void _CFile_Delete( void* cfile )
-{
-	CFile* self = (CFile*)cfile;
-	
-	_JournalFile_Delete( self );
-}
-void _CFile_Print( void* cfile, Stream* stream )
-{
-	CFile* self = (CFile*)cfile;
-	
-	_JournalFile_Print( self, stream );
-}
-
-	
-Bool _CFile_Open( void* file, Name const fileName )
-{
-	CFile* self = (CFile*) file;
-	FILE* filePtr;
-	
-	if(!self->binary)
-		filePtr = fopen( fileName, "w" );
-	else
-		filePtr = fopen( fileName, "wb" );
-	
-	if ( filePtr == NULL )
-	{
-		return False;
-	}
-
-	self->fileHandle = (void*) filePtr;
-	
-	return True;	
-}
-	
-Bool _CFile_Append( void* file, Name const fileName )
-{
-	CFile* self = (CFile*) file;
-	FILE* filePtr;
-	
-	if(!self->binary)
-		filePtr = fopen( fileName, "a" );
-	else
-		filePtr = fopen( fileName, "ab" );
-	
-	if ( filePtr == NULL )
-	{
-		return False;
-	}
-
-	self->fileHandle = (void*) filePtr;
-	
-	return True;	
-}
-Bool _CFile_Close( void* file )
-{
-	CFile* self = (CFile*) file;
-	if ( self->fileHandle != NULL )
-	{
-          return fclose(  (FILE*) self->fileHandle ) == 0 ? True : False;
-	}
-	return False;
-}
-
-Bool _CFile_Flush( void* file )
-{
-	CFile* self = (CFile*) file;
-	if ( self->fileHandle != NULL )
-	{
-          return fflush( (FILE*) self->fileHandle ) == 0 ? True : False;
-	}
-	return False;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/CFile.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/CFile.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,194 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: CFile.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "Stream.h"
+#include "Journal.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+const Type CFile_Type = "CFile";
+
+
+JournalFile* CFile_New()
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(CFile);
+	Type                              type = CFile_Type;
+	Stg_Class_DeleteFunction*      _delete = _CFile_Delete;
+	Stg_Class_PrintFunction*        _print = _CFile_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+	Bool                            binary = False;
+
+	return (JournalFile*)_CFile_New(  CFILE_PASSARGS  );
+}
+
+JournalFile* CFileBinary_New()
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(CFile);
+	Type                              type = CFile_Type;
+	Stg_Class_DeleteFunction*      _delete = _CFile_Delete;
+	Stg_Class_PrintFunction*        _print = _CFile_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+	Bool                            binary = True;
+
+	return (JournalFile*)_CFile_New(  CFILE_PASSARGS  );
+}
+
+
+JournalFile* CFile_New2( Name fileName )
+{
+	JournalFile* result = CFile_New();
+
+	if ( !JournalFile_Open( result, fileName ) )
+	{
+		/* File could not be opened successfully. Return cleanly. */
+		Stg_Class_Delete( result );
+		result = NULL;
+	}
+	
+	return result;
+}
+
+CFile* _CFile_New(  CFILE_DEFARGS  )
+{
+	CFile* self;
+	
+	self = (CFile*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	self->binary = binary;
+	
+	_CFile_Init( self );
+	
+	return self;
+}
+	
+void CFile_Init( CFile* self )
+{
+	/* Set virtual info. */
+	self->_sizeOfSelf = sizeof(CFile);
+	self->type = CFile_Type;
+	self->_delete = _CFile_Delete;
+	self->_print = _CFile_Print;
+	self->_copy = NULL;
+	
+	_CFile_Init( self );
+}
+	
+void _CFile_Init( CFile* self )
+{
+	_JournalFile_Init( (JournalFile*)self, (JournalFile_OpenFunction*)_CFile_Open,
+		(JournalFile_AppendFunction*)_CFile_Append, _CFile_Close, _CFile_Flush );
+}
+	
+void _CFile_Delete( void* cfile )
+{
+	CFile* self = (CFile*)cfile;
+	
+	_JournalFile_Delete( self );
+}
+void _CFile_Print( void* cfile, Stream* stream )
+{
+	CFile* self = (CFile*)cfile;
+	
+	_JournalFile_Print( self, stream );
+}
+
+	
+Bool _CFile_Open( void* file, Name const fileName )
+{
+	CFile* self = (CFile*) file;
+	FILE* filePtr;
+	
+	if(!self->binary)
+		filePtr = fopen( fileName, "w" );
+	else
+		filePtr = fopen( fileName, "wb" );
+	
+	if ( filePtr == NULL )
+	{
+		return False;
+	}
+
+	self->fileHandle = (void*) filePtr;
+	
+	return True;	
+}
+	
+Bool _CFile_Append( void* file, Name const fileName )
+{
+	CFile* self = (CFile*) file;
+	FILE* filePtr;
+	
+	if(!self->binary)
+		filePtr = fopen( fileName, "a" );
+	else
+		filePtr = fopen( fileName, "ab" );
+	
+	if ( filePtr == NULL )
+	{
+		return False;
+	}
+
+	self->fileHandle = (void*) filePtr;
+	
+	return True;	
+}
+Bool _CFile_Close( void* file )
+{
+	CFile* self = (CFile*) file;
+	if ( self->fileHandle != NULL )
+	{
+          return fclose(  (FILE*) self->fileHandle ) == 0 ? True : False;
+	}
+	return False;
+}
+
+Bool _CFile_Flush( void* file )
+{
+	CFile* self = (CFile*) file;
+	if ( self->fileHandle != NULL )
+	{
+          return fflush( (FILE*) self->fileHandle ) == 0 ? True : False;
+	}
+	return False;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/CStream.c
--- a/Base/IO/src/CStream.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: CStream.c 3570 2006-05-15 03:28:02Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "Stream.h"
-#include "CStream.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <stdarg.h>   /* Subsequent files need this for variable argument lists. */
-
-#include "Journal.h"
-
-
-const Type CStream_Type = "CStream";
-
-
-Stream* CStream_New( Name name )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(CStream);
-	Type                              type = CStream_Type;
-	Stg_Class_DeleteFunction*      _delete = _CStream_Delete;
-	Stg_Class_PrintFunction*        _print = _CStream_Print;
-	Stg_Class_CopyFunction*          _copy = _Stream_Copy;
-	Stream_PrintfFunction*         _printf = _CStream_Printf;
-	Stream_WriteFunction*           _write = _CStream_Write;
-	Stream_DumpFunction*             _dump = _CStream_Dump;
-	Stream_SetFileFunction*       _setFile = _CStream_SetFile;
-
-	return (Stream*)_CStream_New(  CSTREAM_PASSARGS  );
-}
-
-void CStream_Init( CStream* self, Name name )
-{
-	
-}
-
-
-CStream* _CStream_New(  CSTREAM_DEFARGS  )
-{
-	CStream* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(CStream) );
-	self = (CStream*)_Stream_New(  STREAM_PASSARGS  );
-	
-	_CStream_Init( self );
-	
-	return self;
-}
-
-void _CStream_Init( CStream* self )
-{
-	self->defaultFileType = CFile_New;
-
-}
-	
-void _CStream_Delete( void* cStream )
-{
-	CStream* self = (CStream*)cStream;
-	
-	/* Stg_Class_Delete parent */
-	_Stream_Delete( self );
-}
-
-void _CStream_Print( void* cStream, Stream* stream ) {
-
-	CStream* self = (CStream*)cStream;
-	
-	/* General info */
-	Journal_Printf( stream, "CStream (ptr): %p\n", cStream );
-	
-	/* Print parent */
-	_Stream_Print( self, stream );
-		
-}
-	
-SizeT _CStream_Printf( Stream* stream, const char *fmt, va_list args )
-{
-	CStream* self = (CStream*)stream;
-	SizeT    printResult;
-
-	if ( self->_file == NULL )
-	{
-		return 0;
-	}
-
-	printResult = vfprintf( (FILE*) self->_file->fileHandle, fmt, args );
-	return printResult;
-}
-	
-SizeT _CStream_Write( Stream* stream, const void *data, SizeT elem_size, SizeT num_elems )
-{
-	CStream* self = (CStream*)stream;
-	return fwrite( data, elem_size, num_elems, (FILE*) (self->_file->fileHandle) );
-}
-	
-Bool _CStream_Dump( Stream* stream, const void *data )
-{
-	/* Traditional C does not have a dumping function. Hence, CStream performs no operation here. */
-	return False;
-}
-
-Bool _CStream_SetFile( Stream* stream, JournalFile* file )
-{
-	if ( file->type == CFile_Type )
-	{
-		stream->_file = file;
-		return True;
-	}
-	return False;
-}
-
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/CStream.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/CStream.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,152 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: CStream.c 3570 2006-05-15 03:28:02Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "Stream.h"
+#include "CStream.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <stdarg.h>   /* Subsequent files need this for variable argument lists. */
+
+#include "Journal.h"
+
+
+const Type CStream_Type = "CStream";
+
+
+Stream* CStream_New( Name name )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(CStream);
+	Type                              type = CStream_Type;
+	Stg_Class_DeleteFunction*      _delete = _CStream_Delete;
+	Stg_Class_PrintFunction*        _print = _CStream_Print;
+	Stg_Class_CopyFunction*          _copy = _Stream_Copy;
+	Stream_PrintfFunction*         _printf = _CStream_Printf;
+	Stream_WriteFunction*           _write = _CStream_Write;
+	Stream_DumpFunction*             _dump = _CStream_Dump;
+	Stream_SetFileFunction*       _setFile = _CStream_SetFile;
+
+	return (Stream*)_CStream_New(  CSTREAM_PASSARGS  );
+}
+
+void CStream_Init( CStream* self, Name name )
+{
+	
+}
+
+
+CStream* _CStream_New(  CSTREAM_DEFARGS  )
+{
+	CStream* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(CStream) );
+	self = (CStream*)_Stream_New(  STREAM_PASSARGS  );
+	
+	_CStream_Init( self );
+	
+	return self;
+}
+
+void _CStream_Init( CStream* self )
+{
+	self->defaultFileType = CFile_New;
+
+}
+	
+void _CStream_Delete( void* cStream )
+{
+	CStream* self = (CStream*)cStream;
+	
+	/* Stg_Class_Delete parent */
+	_Stream_Delete( self );
+}
+
+void _CStream_Print( void* cStream, Stream* stream ) {
+
+	CStream* self = (CStream*)cStream;
+	
+	/* General info */
+	Journal_Printf( stream, "CStream (ptr): %p\n", cStream );
+	
+	/* Print parent */
+	_Stream_Print( self, stream );
+		
+}
+	
+SizeT _CStream_Printf( Stream* stream, const char *fmt, va_list args )
+{
+	CStream* self = (CStream*)stream;
+	SizeT    printResult;
+
+	if ( self->_file == NULL )
+	{
+		return 0;
+	}
+
+	printResult = vfprintf( (FILE*) self->_file->fileHandle, fmt, args );
+	return printResult;
+}
+	
+SizeT _CStream_Write( Stream* stream, const void *data, SizeT elem_size, SizeT num_elems )
+{
+	CStream* self = (CStream*)stream;
+	return fwrite( data, elem_size, num_elems, (FILE*) (self->_file->fileHandle) );
+}
+	
+Bool _CStream_Dump( Stream* stream, const void *data )
+{
+	/* Traditional C does not have a dumping function. Hence, CStream performs no operation here. */
+	return False;
+}
+
+Bool _CStream_SetFile( Stream* stream, JournalFile* file )
+{
+	if ( file->type == CFile_Type )
+	{
+		stream->_file = file;
+		return True;
+	}
+	return False;
+}
+
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/CmdLineArgs.c
--- a/Base/IO/src/CmdLineArgs.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Dictionary.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <string.h>
-
-#include "Base/Foundation/Foundation.h"
-
-
-void stgRemoveCmdLineArg( int* argc, char** argv[], int index ) {
-	if( index > 0 && index < *argc ) {
-		int i;
-		char* tmpPtr = (*argv)[index];
-
-		for( i = index; i < *argc - 1; i++ ) {
-			(*argv)[i] = (*argv)[i+1];
-		}
-
-		(*argv)[*argc-1] = tmpPtr;
-		*argc -= 1;
-	}
-}
-
-
-char* stgParseHelpCmdLineArg( int* argc, char** argv[] ) {
-	int                   arg_I;
-
-	/* Loop over all the arguments from command line and reads all arguments of form "--help topic" */
-	for( arg_I = 1 ; arg_I < *argc; arg_I++ ) {
-		char*                   valueString = 0;
-		char*                   argumentString = (*argv)[arg_I];
-		Name             preceedingString = "--help";
-		unsigned int            preceedingStringLength = strlen( preceedingString );
-
-		/* Check is string has preceeding string is "--help" if not then continue in loop */
-		if( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 ) {
-			continue;
-		}
-		if( strlen( argumentString ) != strlen( preceedingString ) ) {
-			continue;
-		}
-		if( arg_I >= (*argc - 1) ) {
-			continue;
-		}
-
-		valueString = StG_Strdup( (*argv)[arg_I+1] );
-		stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --help */
-		stgRemoveCmdLineArg( argc, argv, arg_I ); /* second argument: topic */
-		return valueString;		
-	}
-
-	return 0;
-}
-
-char* stgParseListCmdLineArg( int* argc, char** argv[] ) {
-	int                   arg_I;
-
-	/* Loop over all the arguments from command line and reads all arguments of form "--help topic" */
-	for( arg_I = 1 ; arg_I < *argc; arg_I++ ) {
-		char*                   valueString = 0;
-		char*                   argumentString = (*argv)[arg_I];
-		Name             preceedingString = "--list";
-		unsigned int            preceedingStringLength = strlen( preceedingString );
-
-		/* Check is string has preceeding string is "--list" if not then continue in loop */
-		if( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 ) {
-			continue;
-		}
-		if( strlen( argumentString ) != strlen( preceedingString ) ) {
-			continue;
-		}
-		if( arg_I >= (*argc - 1) ) { /* "--list" is the last commandline argument */
-			valueString = StG_Strdup( "" );
-			stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
-			return valueString;
-		}
-
-		valueString = StG_Strdup( (*argv)[arg_I+1] );
-		stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
-		stgRemoveCmdLineArg( argc, argv, arg_I ); /* second argument: topic */
-		return valueString;		
-	}
-
-	return 0;
-}
-
-char* stgParseListAllCmdLineArg( int* argc, char** argv[] ) {
-	int                   arg_I;
-
-	/* Loop over all the arguments from command line and reads all arguments of form "--help topic" */
-	for( arg_I = 1 ; arg_I < *argc; arg_I++ ) {
-		char*                   valueString = 0;
-		char*                   argumentString = (*argv)[arg_I];
-		Name             preceedingString = "--list-all";
-		unsigned int            preceedingStringLength = strlen( preceedingString );
-
-		/* Check is string has preceeding string is "--list" if not then continue in loop */
-		if( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 ) {
-			continue;
-		}
-		if( strlen( argumentString ) != strlen( preceedingString ) ) {
-			continue;
-		}
-		if( arg_I >= (*argc - 1) ) { /* "--list" is the last commandline argument */
-			valueString = StG_Strdup( "" );
-			stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
-			return valueString;
-		}
-
-		valueString = StG_Strdup( (*argv)[arg_I+1] );
-		stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
-		stgRemoveCmdLineArg( argc, argv, arg_I ); /* second argument: topic */
-		return valueString;		
-	}
-
-	return 0;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/CmdLineArgs.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/CmdLineArgs.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,146 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Dictionary.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <string.h>
+
+#include "Base/Foundation/Foundation.h"
+
+
+void stgRemoveCmdLineArg( int* argc, char** argv[], int index ) {
+	if( index > 0 && index < *argc ) {
+		int i;
+		char* tmpPtr = (*argv)[index];
+
+		for( i = index; i < *argc - 1; i++ ) {
+			(*argv)[i] = (*argv)[i+1];
+		}
+
+		(*argv)[*argc-1] = tmpPtr;
+		*argc -= 1;
+	}
+}
+
+
+char* stgParseHelpCmdLineArg( int* argc, char** argv[] ) {
+	int                   arg_I;
+
+	/* Loop over all the arguments from command line and reads all arguments of form "--help topic" */
+	for( arg_I = 1 ; arg_I < *argc; arg_I++ ) {
+		char*                   valueString = 0;
+		char*                   argumentString = (*argv)[arg_I];
+		Name             preceedingString = "--help";
+		unsigned int            preceedingStringLength = strlen( preceedingString );
+
+		/* Check is string has preceeding string is "--help" if not then continue in loop */
+		if( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 ) {
+			continue;
+		}
+		if( strlen( argumentString ) != strlen( preceedingString ) ) {
+			continue;
+		}
+		if( arg_I >= (*argc - 1) ) {
+			continue;
+		}
+
+		valueString = StG_Strdup( (*argv)[arg_I+1] );
+		stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --help */
+		stgRemoveCmdLineArg( argc, argv, arg_I ); /* second argument: topic */
+		return valueString;		
+	}
+
+	return 0;
+}
+
+char* stgParseListCmdLineArg( int* argc, char** argv[] ) {
+	int                   arg_I;
+
+	/* Loop over all the arguments from command line and reads all arguments of form "--help topic" */
+	for( arg_I = 1 ; arg_I < *argc; arg_I++ ) {
+		char*                   valueString = 0;
+		char*                   argumentString = (*argv)[arg_I];
+		Name             preceedingString = "--list";
+		unsigned int            preceedingStringLength = strlen( preceedingString );
+
+		/* Check is string has preceeding string is "--list" if not then continue in loop */
+		if( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 ) {
+			continue;
+		}
+		if( strlen( argumentString ) != strlen( preceedingString ) ) {
+			continue;
+		}
+		if( arg_I >= (*argc - 1) ) { /* "--list" is the last commandline argument */
+			valueString = StG_Strdup( "" );
+			stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
+			return valueString;
+		}
+
+		valueString = StG_Strdup( (*argv)[arg_I+1] );
+		stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
+		stgRemoveCmdLineArg( argc, argv, arg_I ); /* second argument: topic */
+		return valueString;		
+	}
+
+	return 0;
+}
+
+char* stgParseListAllCmdLineArg( int* argc, char** argv[] ) {
+	int                   arg_I;
+
+	/* Loop over all the arguments from command line and reads all arguments of form "--help topic" */
+	for( arg_I = 1 ; arg_I < *argc; arg_I++ ) {
+		char*                   valueString = 0;
+		char*                   argumentString = (*argv)[arg_I];
+		Name             preceedingString = "--list-all";
+		unsigned int            preceedingStringLength = strlen( preceedingString );
+
+		/* Check is string has preceeding string is "--list" if not then continue in loop */
+		if( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 ) {
+			continue;
+		}
+		if( strlen( argumentString ) != strlen( preceedingString ) ) {
+			continue;
+		}
+		if( arg_I >= (*argc - 1) ) { /* "--list" is the last commandline argument */
+			valueString = StG_Strdup( "" );
+			stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
+			return valueString;
+		}
+
+		valueString = StG_Strdup( (*argv)[arg_I+1] );
+		stgRemoveCmdLineArg( argc, argv, arg_I ); /* first argument: --list */
+		stgRemoveCmdLineArg( argc, argv, arg_I ); /* second argument: topic */
+		return valueString;		
+	}
+
+	return 0;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Dictionary.c
--- a/Base/IO/src/Dictionary.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,877 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Dictionary.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "forwardDecl.h"
-#include "Dictionary.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "Stream.h"
-#include "Dictionary_Entry_Value.h"
-#include "Dictionary_Entry.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/* Textual name of this class */
-const Type Dictionary_Type = "dictionary";
-
-/* Controlling struct behaviour */
-static const int DEFAULT_INIT_SIZE = 10;
-static const int DEFAULT_DELTA = 5;
-static const int STRUCT_INIT_SIZE = 2;
-static const int STRUCT_DELTA = 2;
-
-Dictionary* Dictionary_New( void ) {
-	/* Variables set in this function */
-	SizeT                                _sizeOfSelf = sizeof(Dictionary);
-	Type                                        type = Dictionary_Type;
-	Stg_Class_DeleteFunction*                _delete = _Dictionary_Delete;
-	Stg_Class_PrintFunction*                  _print = _Dictionary_Print;
-	Stg_Class_CopyFunction*                    _copy = _Dictionary_Copy;
-	Dictionary_AddFunction*                      add = _Dictionary_Add;
-	Dictionary_AddWithSourceFunction*  addWithSource = _Dictionary_AddWithSource;
-	Dictionary_SetFunction*                      set = _Dictionary_Set;
-	Dictionary_SetWithSourceFunction*  setWithSource = _Dictionary_SetWithSource;
-	Dictionary_GetFunction*                      get = _Dictionary_Get;
-	Dictionary_GetSourceFunction*          getSource = _Dictionary_GetSource;
-
-	return _Dictionary_New(  DICTIONARY_PASSARGS  );
-}
-
-Dictionary* _Dictionary_New(  DICTIONARY_DEFARGS  )
-{	
-	Dictionary* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Dictionary) );
-	self = (Dictionary*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* virtual functions */
-	self->add = add;
-	self->addWithSource = addWithSource;
-	self->set = set;
-	self->setWithSource = setWithSource;
-	self->get = get;
-	self->getSource = getSource;
-	
-	/* Dictionary info */
-	_Dictionary_Init( self );
-	
-	return self;
-}
-
-void _Dictionary_Init( void* dictionary ) {
-	Dictionary* self = (Dictionary*) dictionary;
-
-	self->size = DEFAULT_INIT_SIZE;
-	self->delta = DEFAULT_DELTA;
-	self->count = 0;
-	self->entryPtr = Memory_Alloc_Array( Dictionary_Entry*, self->size, "Dictionary->entryPtr" );
-	self->debugStream = Journal_Register( Debug_Type, "DictionaryWarning" );
-}
-
-void _Dictionary_Delete( void* dictionary ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	for( index = 0; index < self->count; index++ ) {
-		Dictionary_Entry_Delete( self->entryPtr[index] );
-	}
-	Memory_Free( self->entryPtr );
-	
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-
-void _Dictionary_Print( void* dictionary, Stream* stream ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-
-	Journal_Printf( (void*)stream, "Dictionary:\n" );
-	Journal_Printf( (void*)stream, "\tsize: %u\n", self->size );
-	Journal_Printf( (void*)stream, "\tdelta: %u\n", self->delta );
-	Journal_Printf( (void*)stream, "\tcount: %u\n", self->count );
-	Journal_Printf( (void*)stream, "\tentryPtr[0-%u]: {\n", self->count );
-	Stream_Indent( stream );
-	Stream_Indent( stream );
-
-	for( index = 0; index < self->count; index++ ) {
-		/*Journal_Printf( (void*)stream, "\t\t" );*/
-		Dictionary_Entry_Print( self->entryPtr[index], stream ); 
-		Journal_Printf( (void*)stream, "\n" );
-	}
-	Journal_Printf( (void*)stream, "\t}\n" );
-	Stream_UnIndent( stream );
-	Stream_UnIndent( stream );
-}
-
-void Dictionary_PrintConcise( void* dictionary, Stream* stream ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-
-	Journal_Printf( stream, "Dictionary contains %u entries:\n", self->count );
-
-	Stream_Indent( stream );
-	for( index = 0; index < self->count; index++ ) {
-		Journal_Printf( stream, "\t" );
-		Dictionary_Entry_Print( self->entryPtr[index], stream ); 
-		Journal_Printf( stream, "\n" );
-	}
-	Journal_Printf( stream, "}\n" );
-	Stream_UnIndent( stream );
-}
-
-
-void Dictionary_Empty( void* dictionary ) {
-	Dictionary*      self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	for( index = 0; index < self->count; index++ ) {
-		Dictionary_Entry_Delete( self->entryPtr[index] );
-	}
-	
-	self->count=0;
-	self->size = DEFAULT_INIT_SIZE;
-	self->entryPtr = Memory_Realloc_Array( self->entryPtr, Dictionary_Entry*, self->size );
-}
-
-
-void* _Dictionary_Copy( const void* dictionary, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Dictionary*      self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	Dictionary*	 newDict;
-	Bool             ownMap = False;
-	
-	if( !ptrMap ) {
-		ptrMap = PtrMap_New( 10 );
-		ownMap = True;
-	}
-
-	newDict = (Dictionary*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newDict->add = self->add;
-	newDict->addWithSource = self->addWithSource;
-	newDict->set = self->set;
-	newDict->setWithSource = self->setWithSource;
-	newDict->get = self->get;
-	newDict->getSource = self->getSource;
-
-	newDict->size = self->size;
-	newDict->delta = self->delta;
-
-	if ( False == deep ) {
-		newDict->debugStream = self->debugStream;
-	}
-	else {
-          newDict->debugStream = (Stream*)Stg_Class_Copy( self->debugStream, NULL, deep, nameExt, ptrMap );
-	}
-
-	newDict->entryPtr = Memory_Alloc_Array( Dictionary_Entry*, self->size, "Dictionary->entryPtr" );
-	if ( False == deep ) {
-		newDict->count = self->count;
-		memcpy( newDict->entryPtr, self->entryPtr, sizeof(Dictionary_Entry*) * self->count );
-		for( index = 0; index < self->count; index++ ) {
-			newDict->entryPtr[index] = self->entryPtr[index];
-		}
-	}
-	else {
-		newDict->count = 0;
-		for( index = 0; index < self->count; index++ ) {
-			Dictionary_Add( newDict, self->entryPtr[index]->key,
-				Dictionary_Entry_Value_Copy( self->entryPtr[index]->value, True ) );
-		}
-	}
-
-	if( ownMap ) {
-		Stg_Class_Delete( ptrMap );
-	}
-
-	return (void*)newDict;
-}
-
-
-void Dictionary_Add( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
-	Dictionary* self = (Dictionary*)dictionary;
-	self->add( dictionary, key, value );
-}
-
-void Dictionary_AddWithSource( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value, 
-				Dictionary_Entry_Source source ) 
-{
-	Dictionary* self = (Dictionary*)dictionary;
-	self->addWithSource( dictionary, key, value, source );
-}
-
-Bool Dictionary_Set( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
-	Dictionary* self = (Dictionary*)dictionary;
-	return self->set( dictionary, key, value );
-}
-
-Dictionary_Entry_Value* Dictionary_Get( void* dictionary, Dictionary_Entry_Key key ) {
-	Dictionary* self = (Dictionary*)dictionary;
-	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
-	return self ? self->get( dictionary, key ) : NULL;
-}
-
-Dictionary_Entry_Source Dictionary_GetSource( void* dictionary, Dictionary_Entry_Key key ) {
-	Dictionary* self = (Dictionary*)dictionary;
-	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
-	return self ? self->getSource( dictionary, key ) : NULL;
-}
-
-Dictionary_Entry_Value* Dictionary_GetByIndex( void* dictionary, Dictionary_Index index ) {
-	Dictionary* self = (Dictionary*)dictionary;
-	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
-	return self ? _Dictionary_GetByIndex( dictionary, index ) : NULL;
-}
-
-Dictionary_Entry* Dictionary_GetEntry( void* dictionary, Dictionary_Entry_Key key ) {
-  Dictionary* self = (Dictionary*)dictionary;
-  Dictionary_Index index;
-  Dictionary_Index count;
-
-  /* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
-  count = self ? self->count : 0;
-	
-  for( index = 0; index < count; index++ ) {
-    if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
-      return self->entryPtr[index];
-    }
-  }
-  return NULL;
-}
-
-Dictionary_Entry* Dictionary_GetEntryByIndex( void* dictionary, Dictionary_Index index) {
-  Dictionary* self = (Dictionary*)dictionary;
-
-  /* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
-  /* Check that self->entryPtr[index] is NOT NULL */
-  if( !self || !self->entryPtr[index] )
-    return NULL;
-  else
-    return self->entryPtr[index];
-}
-
-Index Dictionary_GetCount( void* dictionary ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
-	return self ? self->count : 0;
-}
-
-Dictionary_Entry_Value* Dictionary_GetDefault( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	for( index = 0; index < self->count; index++ ) {
-		if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
-			/* key found, so delete the default value */
-			Dictionary_Entry_Value_Delete( value );
-			return Dictionary_Entry_Get( self->entryPtr[index] );
-		}
-	}
-	
-	Journal_Printf( self->debugStream, "Warning - value %s not found in dictionary, using default value of ", key );
-	Dictionary_Entry_Value_Print( value, self->debugStream );
-	Journal_Printf( self->debugStream, "\n" );
-	
-	Dictionary_Add( dictionary, key, value );
-	return value;
-}
-
-
-
-void _Dictionary_Add( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	assert( self->count <= self->size );
-	if( self->count == self->size ) {
-		self->size += self->delta;
-		self->entryPtr = Memory_Realloc_Array( self->entryPtr, Dictionary_Entry*, self->size );
-	}
-	
-	self->entryPtr[self->count] = Dictionary_Entry_New( key, value );
-	self->count++;
-}
-
-void _Dictionary_AddWithSource( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value, 
-				Dictionary_Entry_Source source ) 
-{
-	Dictionary* self = (Dictionary*) dictionary;
-	assert( self->count <= self->size );
-	if( self->count == self->size ) {
-		self->size += self->delta;
-		self->entryPtr = Memory_Realloc_Array( self->entryPtr, Dictionary_Entry*, self->size );
-	}
-	
-	self->entryPtr[self->count] = Dictionary_Entry_NewWithSource( key, value, source );
-	self->count++;
-}
-
-Dictionary_Entry_Value* Dictionary_AddMerge( 
-		void*						dictionary, 
-		Dictionary_Entry_Key				key, 
-		Dictionary_Entry_Value*				value,
-		Dictionary_MergeType				mergeType )
-{
-	Dictionary*					self = (Dictionary*)dictionary;
-	Dictionary_Entry*				existingEntry = Dictionary_GetEntry( self, key );
-	Dictionary_Entry_Value*				newValue = value;
-	Dictionary_Entry_Value*				updatedValue = value;
-	Dictionary_Entry_Value*				curValue;
-	
-	if( existingEntry ) {
-		Dictionary_Entry_Value*				existingValue = Dictionary_Entry_Get( existingEntry );
-		Index						i;
-		
-		switch( existingValue->type ) {
-			/* parameters... all behave the same */
-			case Dictionary_Entry_Value_Type_String:
-			case Dictionary_Entry_Value_Type_Double:
-			case Dictionary_Entry_Value_Type_UnsignedInt:
-			case Dictionary_Entry_Value_Type_Int:
-			case Dictionary_Entry_Value_Type_Bool:
-			case Dictionary_Entry_Value_Type_UnsignedLong:
-			case Dictionary_Entry_Value_Type_VoidPtr:
-				switch( mergeType ) {
-					/* "Append", means add to end... default add behaviour */
-					case Dictionary_MergeType_Append:
-						_Dictionary_Add( dictionary, key, newValue );
-						break;
-					/* "Merge" and "Replace" means override */
-					case Dictionary_MergeType_Merge:
-					case Dictionary_MergeType_Replace:
-						Dictionary_Entry_Set( existingEntry, newValue );
-						break;
-				};
-				break;
-			case Dictionary_Entry_Value_Type_Struct:
-				switch( mergeType ) {
-					/* "Append", means add to end... default add behaviour */
-					case Dictionary_MergeType_Append: /* create at end */
-						_Dictionary_Add( dictionary, key, newValue );
-						break;
-					/* "Merge" means for all struct items, add to end... i.e. do nothing here .*/
-					case Dictionary_MergeType_Merge:
-						for( i = 0; i < newValue->as.typeStruct->count; i++ ) {
-							Dictionary_AddMerge( existingValue->as.typeStruct,
-								newValue->as.typeStruct->entryPtr[i]->key, 
-								newValue->as.typeStruct->entryPtr[i]->value, mergeType );
-						}
-						
-						newValue->as.typeStruct->count = 0;
-						Stg_Class_Delete( newValue->as.typeStruct );
-						Memory_Free( newValue );
-						updatedValue = existingValue;
-						break;
-					/* "Replace" means remove current entry and create a newey */
-					case Dictionary_MergeType_Replace:
-						Dictionary_Entry_Set( existingEntry, newValue );
-						break;
-				};
-				break;
-			case Dictionary_Entry_Value_Type_List:
-				switch( mergeType ) {
-					/* "Append", means add to end... default add behaviour */
-					case Dictionary_MergeType_Append: /* create at end */
-						_Dictionary_Add( dictionary, key, newValue );
-						break;
-					/* "Merge": 2 different cases... */
-					/* means for all list items, add to end... i.e. do nothing here .*/
-					case Dictionary_MergeType_Merge:
-						curValue = newValue->as.typeList->first;
-						for( i = 0; i < newValue->as.typeList->count; i++ ) {
-							Dictionary_Entry_Value_AddElement( existingValue, curValue );
-							curValue = curValue->next;
-						}
-						
-						Memory_Free( newValue );
-						updatedValue = existingValue;
-						break;
-					/* "Replace" means remove current entry and create a newey */
-					case Dictionary_MergeType_Replace:
-						Dictionary_Entry_Set( existingEntry, newValue );
-						break;
-				};
-				break;
-			default:
-				Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
-					"Error in func %s: Bad existingValue type '%u'\n", __func__, existingValue->type ); 
-				break;
-		}
-	}
-	else {
-		_Dictionary_Add( self, key, value );
-	}
-	
-	return updatedValue;
-}
-
-Dictionary_Entry_Value* Dictionary_AddMergeWithSource( 
-		void*						dictionary, 
-		Dictionary_Entry_Key				key, 
-		Dictionary_Entry_Value*				value,
-		Dictionary_MergeType				mergeType,
-		Dictionary_Entry_Source				source )
-{
-	Dictionary*					self = (Dictionary*)dictionary;
-	Dictionary_Entry*				existingEntry = Dictionary_GetEntry( self, key );
-	Dictionary_Entry_Value*				newValue = value;
-	Dictionary_Entry_Value*				updatedValue = value;
-	Dictionary_Entry_Value*				curValue;
-	
-	if( existingEntry ) {
-		Dictionary_Entry_Value*				existingValue = Dictionary_Entry_Get( existingEntry );
-		Index						i;
-		
-		switch( existingValue->type ) {
-			/* parameters... all behave the same */
-			case Dictionary_Entry_Value_Type_String:
-			case Dictionary_Entry_Value_Type_Double:
-			case Dictionary_Entry_Value_Type_UnsignedInt:
-			case Dictionary_Entry_Value_Type_Int:
-			case Dictionary_Entry_Value_Type_Bool:
-			case Dictionary_Entry_Value_Type_UnsignedLong:
-			case Dictionary_Entry_Value_Type_VoidPtr:
-				switch( mergeType ) {
-					/* "Append", means add to end... default add behaviour */
-					case Dictionary_MergeType_Append:
-						_Dictionary_AddWithSource( dictionary, key, newValue, source );
-						break;
-					/* "Merge" and "Replace" means override */
-					case Dictionary_MergeType_Merge:
-					case Dictionary_MergeType_Replace:
-						Dictionary_Entry_SetWithSource( existingEntry, newValue, source );
-						break;
-				};
-				break;
-			case Dictionary_Entry_Value_Type_Struct:
-				switch( mergeType ) {
-					/* "Append", means add to end... default add behaviour */
-					case Dictionary_MergeType_Append: /* create at end */
-						_Dictionary_AddWithSource( dictionary, key, newValue, source );
-						break;
-					/* "Merge" means for all struct items, add to end... i.e. do nothing here .*/
-					case Dictionary_MergeType_Merge:
-						for( i = 0; i < newValue->as.typeStruct->count; i++ ) {
-							Dictionary_AddMergeWithSource( existingValue->as.typeStruct,
-								newValue->as.typeStruct->entryPtr[i]->key, 
-								newValue->as.typeStruct->entryPtr[i]->value, 
-								mergeType, source );
-						}
-						
-						newValue->as.typeStruct->count = 0;
-						Stg_Class_Delete( newValue->as.typeStruct );
-						Memory_Free( newValue );
-						updatedValue = existingValue;
-						break;
-					/* "Replace" means remove current entry and create a newey */
-					case Dictionary_MergeType_Replace:
-						Dictionary_Entry_SetWithSource( existingEntry, newValue, source );
-						break;
-				};
-				break;
-			case Dictionary_Entry_Value_Type_List:
-				switch( mergeType ) {
-					/* "Append", means add to end... default add behaviour */
-					case Dictionary_MergeType_Append: /* create at end */
-						_Dictionary_AddWithSource( dictionary, key, newValue, source );
-						break;
-					/* "Merge": 2 different cases... */
-					/* means for all list items, add to end... i.e. do nothing here .*/
-					case Dictionary_MergeType_Merge:
-						curValue = newValue->as.typeList->first;
-						for( i = 0; i < newValue->as.typeList->count; i++ ) {
-							Dictionary_Entry_Value_AddElementWithSource( existingValue, curValue, 
-													source );
-							curValue = curValue->next;
-						}
-						
-						Memory_Free( newValue );
-						updatedValue = existingValue;
-						break;
-					/* "Replace" means remove current entry and create a newey */
-					case Dictionary_MergeType_Replace:
-						Dictionary_Entry_SetWithSource( existingEntry, newValue, source );
-						break;
-				};
-				break;
-			default:
-				Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
-					"Error in func %s: Bad existingValue type '%u'\n", __func__, existingValue->type ); 
-				break;
-		}
-	}
-	else {
-		_Dictionary_AddWithSource( self, key, value, source );
-	}
-	
-	return updatedValue;
-}
-
-Bool _Dictionary_Set( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	for( index = 0; index < self->count; index++ ) {
-		if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
-			Dictionary_Entry_Set( self->entryPtr[index], value );
-			return True;
-		}
-	}
-
-	/* If we reach here and haven't found it, add new entry */
-	Dictionary_Add( self, key, value );
-
-	return True;
-}
-
-Bool _Dictionary_SetWithSource( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value,
-				Dictionary_Entry_Source source ) 
-{
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	for( index = 0; index < self->count; index++ ) {
-		if( Dictionary_Entry_CompareWithSource( self->entryPtr[index], key, source ) != 0 ) {
-			Dictionary_Entry_SetWithSource( self->entryPtr[index], value, source );
-			return True;
-		}
-	}
-
-	/* If we reach here and haven't found it, add new entry */
-	Dictionary_AddWithSource( self, key, value, source );
-
-	return True;
-}
-
-Dictionary_Entry_Value* _Dictionary_Get( void* dictionary, Dictionary_Entry_Key key ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-	
-	for( index = 0; index < self->count; index++ ) {
-		if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
-			return Dictionary_Entry_Get( self->entryPtr[index] );
-		}
-	}
-	return 0;
-}
-
-Dictionary_Entry_Source _Dictionary_GetSource( void* dictionary, Dictionary_Entry_Key key) {
-	Dictionary* self = (Dictionary*) dictionary;
-	Dictionary_Index index;
-
-	for( index = 0; index < self->count; index++ ) {
-                if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
-                        return Dictionary_Entry_GetSource( self->entryPtr[index] );
-                }
-        }
-        return 0;
-}
-
-
-Dictionary_Entry_Value* _Dictionary_GetByIndex( void* dictionary, Dictionary_Index index ) {
-	Dictionary* self = (Dictionary*) dictionary;
-	return Dictionary_Entry_Get(self->entryPtr[index]);
-}
-
-void Dictionary_ParseCommandLineParam( void* self, char* paramString, char* valueString ) {
-	Dictionary* dictionary = (Dictionary*)self;
-	char* point;
-	char* lbracket;
-
-	point = strchr( paramString, '.' );
-	lbracket = strchr( paramString, '[' );
-
-	/* If there's neither a point or left-bracket in the (supposed) param string, them treat as a parameter */
-	if( !point && !lbracket ) {
-		Dictionary_Entry_Value* ev;
-
-		ev = Dictionary_Get( dictionary, paramString );
-
-		/* Add value to dictionary */
-		if( ev == NULL ) {
-			/* If there isn't already an entry in dictionary - create one */
-			Dictionary_Add( dictionary, paramString, Dictionary_Entry_Value_FromString( valueString ) );
-		}
-		else {
-			/* If is already in dictionary - then update value */
-			Dictionary_Entry_Value_SetFromStringKeepCurrentType( ev, valueString );
-		}
-	}
-	else {
-		/* It is either a struct or list or both. Work out one at a time, from the left */
-		if( point && lbracket ) {
-			if( point < lbracket ) {
-				lbracket = 0;
-			}
-			else {
-				point = 0;
-			}
-		}
-
-		if( point ) {
-			char* structString;
-			char* memberString;
-			char* point2;
-			Dictionary* structDictionary; 
-			Dictionary_Entry_Value*  ev;
-			
-			/* Create the struct and member strings from the source */
-			structString = StG_Strdup( paramString );
-			point2 = strchr( structString, '.' );
-			*point2 = 0;
-			memberString = point2 + 1;
-			
-			/* Add value to dictionary */
-			ev = Dictionary_Get( dictionary, structString );
-			if( !ev ) {
-				/* If there isn't already an entry in the dictionary - create one */
-				structDictionary = Dictionary_New();
-				Dictionary_Add( dictionary, structString, Dictionary_Entry_Value_FromStruct( structDictionary ) );
-			}
-			else {
-				/* Entry found. Ensure its a struct */
-				structDictionary = Dictionary_Entry_Value_AsDictionary( ev );
-				Journal_Firewall( 
-					structDictionary==NULL, 
-					Journal_Register( Error_Type, Dictionary_Type ), 
-					"Command line argument \"%s\" parsed as struct, and is in dictionary, but not as a struct",
-						structString );
-			}
-			Dictionary_ParseCommandLineParam( structDictionary, memberString, valueString );
-			Memory_Free( structString );
-		}
-		else if( lbracket ) {
-			char* listString;
-			char* lbracket2;
-			char* indexString;
-			char* rbracket2;
-			char* remainderString;
-			Index index;
-			Bool emptyIndex;
-			Bool isStruct;
-			char* memberString;
-
-			Dictionary_Entry_Value* ev;
-
-			/* Create the list string and index from the source */
-			listString = StG_Strdup( paramString );
-			lbracket2 = strchr( listString, '[' );
-			*lbracket2 = 0;
-			indexString = lbracket2 + 1;
-			
-			/* Make sure there is a right bracket in the string */
-			rbracket2 = strchr( indexString, ']' );
-			Journal_Firewall( 
-				rbracket2==NULL, 
-				Journal_Register( Error_Type, Dictionary_Type ), 
-				"Command line argument \"%s\" parsed as list but missing closing \']\'.",
-					listString );
-			*rbracket2 = 0;
-			remainderString = rbracket2 + 1;
-			
-			/* Obtain the index */
-			if( strlen( indexString ) ) {
-				emptyIndex = False;
-				index = strtoul( indexString, 0, 0 );
-			}
-			else {
-				emptyIndex = True;
-				index = 0;
-			}
-			
-			if( strlen( remainderString ) ) {
-				/* TODO: parse out recursive lists SQ20060206 */
-				/* TODO: parse out structures (properly) SQ20060206 */
-				if( remainderString[0] == '.' ) {
-					memberString = remainderString + 1;
-					isStruct = True;
-				}
-				else {
-					memberString = 0;
-					isStruct = False;
-				}
-			}
-			else {
-				memberString = 0;
-				isStruct = False;
-			}
-			
-			
-			/* Assume it is a parameter */
-			ev = Dictionary_Get( dictionary, listString );
-
-			/* Add value to dictionary */
-			if( ev == NULL ) {
-				/* If there isn't already an entry in dictionary - create one. Verify index is 0 (0th/add)*/
-				Journal_Firewall( 
-					emptyIndex, 
-					Journal_Register( Error_Type, Dictionary_Type ), 
-					"Command line argument \"%s\" parsed as list but list not found and "\
-					"index not specified as add (i.e. '[]').",
-						listString );
-				ev = Dictionary_Entry_Value_NewList();
-				Dictionary_Add( dictionary, listString, ev );
-				if( isStruct ) {
-					Dictionary* newStruct = Dictionary_New();
-					
-					Dictionary_Entry_Value_AddElement( 
-						ev, 
-						Dictionary_Entry_Value_FromStruct( newStruct ) );
-					Dictionary_ParseCommandLineParam( newStruct, memberString, valueString );
-				}
-				else {
-					Dictionary_Entry_Value_AddElement( 
-						ev, 
-						Dictionary_Entry_Value_FromString( valueString ) );
-				}
-			}
-			else {
-				/* Obtain the ith element or add if specified */
-				if( emptyIndex ) {
-					if( isStruct ) {
-						Dictionary* newStruct = Dictionary_New();
-					
-						Dictionary_Entry_Value_AddElement( 
-							ev, 
-							Dictionary_Entry_Value_FromStruct( newStruct ) );
-						Dictionary_ParseCommandLineParam( newStruct, memberString, valueString );
-					}
-					else {
-						Dictionary_Entry_Value_AddElement( 
-							ev, 
-							Dictionary_Entry_Value_FromString( valueString ) );
-					}
-				}
-				else {
-					Dictionary_Entry_Value* item;
-				
-					item = Dictionary_Entry_Value_GetElement( ev, index );
-					Journal_Firewall( 
-						item==NULL, 
-						Journal_Register( Error_Type, Dictionary_Type ), 
-						"Command line argument \"%s\" parsed as list, requesting index \"%u\", "\
-						"but that index does not exist.",
-							listString,
-							index );
-					
-					if( isStruct ) {
-						Dictionary* newStruct = Dictionary_Entry_Value_AsDictionary( item );
-						Dictionary_ParseCommandLineParam( newStruct, memberString, valueString );
-					}
-					else {
-						Dictionary_Entry_Value_SetFromStringKeepCurrentType( item, valueString );
-					}
-				}
-			}
-			Memory_Free( listString );
-		}
-	}
-}
-
-void Dictionary_ReadAllParamFromCommandLine( void* dictionary, int argc, char* argv[] ) {
-	int                     arg_I;
-	Name             preceedingString = "--";
-	char*                   argumentString;
-	char*                   paramString;
-	char*                   valueString;
-	char*                   equalsSign;
-	unsigned int            preceedingStringLength = strlen( preceedingString );
-
-	/* Loop over all the arguments from command line and reads all arguments of form "--param=value" */
-	for ( arg_I = 1 ; arg_I < argc ; arg_I++ ) {
-		argumentString = argv[ arg_I ];
-
-		/* Check is string has preceeding string "--" if not then continue in loop */
-		if ( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 )
-			continue;
-
-		/* Make sure there is an equals sign in the string */
-		equalsSign = strchr( argumentString, '=' ) ;
-
-		/* Make sure that there are characters after equals sign */
-		if ( equalsSign == NULL ) 
-			continue;
-
-		/* Paramater name starts right after these dashes */
-		paramString = StG_Strdup(&argumentString[ preceedingStringLength ]);
-
-		/* Find Pointer to equals sign in this new string we've just created */
-		equalsSign = strchr( paramString, '=' ) ;
-
-		/* Put in null terminator at equals sign */
-		*equalsSign = '\0';
-
-		/* Get Value String - which is everything after the "=" */
-		valueString = equalsSign + 1;
-
-		Dictionary_ParseCommandLineParam( dictionary, paramString, valueString );
-		
-		/* Free memory that we have allocated */
-		Memory_Free( paramString );
-	}
-}
-
-
-Bool Dictionary_CompareAllEntriesFull( void* dictionary1, void* dictionary2, Bool strictTypeCheck ) {
-	Dictionary*          dict1 = (Dictionary*)dictionary1;
-	Dictionary*          dict2 = (Dictionary*)dictionary2;
-	Dictionary_Entry*    entryPtr1 = NULL;	
-	Dictionary_Entry*    entryPtr2 = NULL;	
-	Bool                 retValue = True;
-	Dictionary_Index     index;
-
-	if ( dict1->count != dict2->count ) return False;
-
-	for( index = 0; index < dict1->count; index++ ) {
-		entryPtr1 = dict1->entryPtr[index];
-		entryPtr2 = dict2->entryPtr[index];
-		retValue = Dictionary_Entry_Compare( entryPtr1, entryPtr2->key );
-		if (retValue == False ) break;
-		retValue = Dictionary_Entry_Value_CompareFull( entryPtr1->value,
-			entryPtr2->value, strictTypeCheck );
-		if (retValue == False ) break;
-	}
-
-	return retValue;
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Dictionary.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Dictionary.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,877 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Dictionary.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "forwardDecl.h"
+#include "Dictionary.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "Stream.h"
+#include "Dictionary_Entry_Value.h"
+#include "Dictionary_Entry.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type Dictionary_Type = "dictionary";
+
+/* Controlling struct behaviour */
+static const int DEFAULT_INIT_SIZE = 10;
+static const int DEFAULT_DELTA = 5;
+static const int STRUCT_INIT_SIZE = 2;
+static const int STRUCT_DELTA = 2;
+
+Dictionary* Dictionary_New( void ) {
+	/* Variables set in this function */
+	SizeT                                _sizeOfSelf = sizeof(Dictionary);
+	Type                                        type = Dictionary_Type;
+	Stg_Class_DeleteFunction*                _delete = _Dictionary_Delete;
+	Stg_Class_PrintFunction*                  _print = _Dictionary_Print;
+	Stg_Class_CopyFunction*                    _copy = _Dictionary_Copy;
+	Dictionary_AddFunction*                      add = _Dictionary_Add;
+	Dictionary_AddWithSourceFunction*  addWithSource = _Dictionary_AddWithSource;
+	Dictionary_SetFunction*                      set = _Dictionary_Set;
+	Dictionary_SetWithSourceFunction*  setWithSource = _Dictionary_SetWithSource;
+	Dictionary_GetFunction*                      get = _Dictionary_Get;
+	Dictionary_GetSourceFunction*          getSource = _Dictionary_GetSource;
+
+	return _Dictionary_New(  DICTIONARY_PASSARGS  );
+}
+
+Dictionary* _Dictionary_New(  DICTIONARY_DEFARGS  )
+{	
+	Dictionary* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Dictionary) );
+	self = (Dictionary*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* virtual functions */
+	self->add = add;
+	self->addWithSource = addWithSource;
+	self->set = set;
+	self->setWithSource = setWithSource;
+	self->get = get;
+	self->getSource = getSource;
+	
+	/* Dictionary info */
+	_Dictionary_Init( self );
+	
+	return self;
+}
+
+void _Dictionary_Init( void* dictionary ) {
+	Dictionary* self = (Dictionary*) dictionary;
+
+	self->size = DEFAULT_INIT_SIZE;
+	self->delta = DEFAULT_DELTA;
+	self->count = 0;
+	self->entryPtr = Memory_Alloc_Array( Dictionary_Entry*, self->size, "Dictionary->entryPtr" );
+	self->debugStream = Journal_Register( Debug_Type, "DictionaryWarning" );
+}
+
+void _Dictionary_Delete( void* dictionary ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	for( index = 0; index < self->count; index++ ) {
+		Dictionary_Entry_Delete( self->entryPtr[index] );
+	}
+	Memory_Free( self->entryPtr );
+	
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+
+void _Dictionary_Print( void* dictionary, Stream* stream ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+
+	Journal_Printf( (void*)stream, "Dictionary:\n" );
+	Journal_Printf( (void*)stream, "\tsize: %u\n", self->size );
+	Journal_Printf( (void*)stream, "\tdelta: %u\n", self->delta );
+	Journal_Printf( (void*)stream, "\tcount: %u\n", self->count );
+	Journal_Printf( (void*)stream, "\tentryPtr[0-%u]: {\n", self->count );
+	Stream_Indent( stream );
+	Stream_Indent( stream );
+
+	for( index = 0; index < self->count; index++ ) {
+		/*Journal_Printf( (void*)stream, "\t\t" );*/
+		Dictionary_Entry_Print( self->entryPtr[index], stream ); 
+		Journal_Printf( (void*)stream, "\n" );
+	}
+	Journal_Printf( (void*)stream, "\t}\n" );
+	Stream_UnIndent( stream );
+	Stream_UnIndent( stream );
+}
+
+void Dictionary_PrintConcise( void* dictionary, Stream* stream ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+
+	Journal_Printf( stream, "Dictionary contains %u entries:\n", self->count );
+
+	Stream_Indent( stream );
+	for( index = 0; index < self->count; index++ ) {
+		Journal_Printf( stream, "\t" );
+		Dictionary_Entry_Print( self->entryPtr[index], stream ); 
+		Journal_Printf( stream, "\n" );
+	}
+	Journal_Printf( stream, "}\n" );
+	Stream_UnIndent( stream );
+}
+
+
+void Dictionary_Empty( void* dictionary ) {
+	Dictionary*      self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	for( index = 0; index < self->count; index++ ) {
+		Dictionary_Entry_Delete( self->entryPtr[index] );
+	}
+	
+	self->count=0;
+	self->size = DEFAULT_INIT_SIZE;
+	self->entryPtr = Memory_Realloc_Array( self->entryPtr, Dictionary_Entry*, self->size );
+}
+
+
+void* _Dictionary_Copy( const void* dictionary, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Dictionary*      self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	Dictionary*	 newDict;
+	Bool             ownMap = False;
+	
+	if( !ptrMap ) {
+		ptrMap = PtrMap_New( 10 );
+		ownMap = True;
+	}
+
+	newDict = (Dictionary*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newDict->add = self->add;
+	newDict->addWithSource = self->addWithSource;
+	newDict->set = self->set;
+	newDict->setWithSource = self->setWithSource;
+	newDict->get = self->get;
+	newDict->getSource = self->getSource;
+
+	newDict->size = self->size;
+	newDict->delta = self->delta;
+
+	if ( False == deep ) {
+		newDict->debugStream = self->debugStream;
+	}
+	else {
+          newDict->debugStream = (Stream*)Stg_Class_Copy( self->debugStream, NULL, deep, nameExt, ptrMap );
+	}
+
+	newDict->entryPtr = Memory_Alloc_Array( Dictionary_Entry*, self->size, "Dictionary->entryPtr" );
+	if ( False == deep ) {
+		newDict->count = self->count;
+		memcpy( newDict->entryPtr, self->entryPtr, sizeof(Dictionary_Entry*) * self->count );
+		for( index = 0; index < self->count; index++ ) {
+			newDict->entryPtr[index] = self->entryPtr[index];
+		}
+	}
+	else {
+		newDict->count = 0;
+		for( index = 0; index < self->count; index++ ) {
+			Dictionary_Add( newDict, self->entryPtr[index]->key,
+				Dictionary_Entry_Value_Copy( self->entryPtr[index]->value, True ) );
+		}
+	}
+
+	if( ownMap ) {
+		Stg_Class_Delete( ptrMap );
+	}
+
+	return (void*)newDict;
+}
+
+
+void Dictionary_Add( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
+	Dictionary* self = (Dictionary*)dictionary;
+	self->add( dictionary, key, value );
+}
+
+void Dictionary_AddWithSource( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value, 
+				Dictionary_Entry_Source source ) 
+{
+	Dictionary* self = (Dictionary*)dictionary;
+	self->addWithSource( dictionary, key, value, source );
+}
+
+Bool Dictionary_Set( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
+	Dictionary* self = (Dictionary*)dictionary;
+	return self->set( dictionary, key, value );
+}
+
+Dictionary_Entry_Value* Dictionary_Get( void* dictionary, Dictionary_Entry_Key key ) {
+	Dictionary* self = (Dictionary*)dictionary;
+	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
+	return self ? self->get( dictionary, key ) : NULL;
+}
+
+Dictionary_Entry_Source Dictionary_GetSource( void* dictionary, Dictionary_Entry_Key key ) {
+	Dictionary* self = (Dictionary*)dictionary;
+	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
+	return self ? self->getSource( dictionary, key ) : NULL;
+}
+
+Dictionary_Entry_Value* Dictionary_GetByIndex( void* dictionary, Dictionary_Index index ) {
+	Dictionary* self = (Dictionary*)dictionary;
+	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
+	return self ? _Dictionary_GetByIndex( dictionary, index ) : NULL;
+}
+
+Dictionary_Entry* Dictionary_GetEntry( void* dictionary, Dictionary_Entry_Key key ) {
+  Dictionary* self = (Dictionary*)dictionary;
+  Dictionary_Index index;
+  Dictionary_Index count;
+
+  /* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
+  count = self ? self->count : 0;
+	
+  for( index = 0; index < count; index++ ) {
+    if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
+      return self->entryPtr[index];
+    }
+  }
+  return NULL;
+}
+
+Dictionary_Entry* Dictionary_GetEntryByIndex( void* dictionary, Dictionary_Index index) {
+  Dictionary* self = (Dictionary*)dictionary;
+
+  /* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
+  /* Check that self->entryPtr[index] is NOT NULL */
+  if( !self || !self->entryPtr[index] )
+    return NULL;
+  else
+    return self->entryPtr[index];
+}
+
+Index Dictionary_GetCount( void* dictionary ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	/* Be less sensitive to whether the dictionary is NULL... yields nicer user code */
+	return self ? self->count : 0;
+}
+
+Dictionary_Entry_Value* Dictionary_GetDefault( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	for( index = 0; index < self->count; index++ ) {
+		if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
+			/* key found, so delete the default value */
+			Dictionary_Entry_Value_Delete( value );
+			return Dictionary_Entry_Get( self->entryPtr[index] );
+		}
+	}
+	
+	Journal_Printf( self->debugStream, "Warning - value %s not found in dictionary, using default value of ", key );
+	Dictionary_Entry_Value_Print( value, self->debugStream );
+	Journal_Printf( self->debugStream, "\n" );
+	
+	Dictionary_Add( dictionary, key, value );
+	return value;
+}
+
+
+
+void _Dictionary_Add( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	assert( self->count <= self->size );
+	if( self->count == self->size ) {
+		self->size += self->delta;
+		self->entryPtr = Memory_Realloc_Array( self->entryPtr, Dictionary_Entry*, self->size );
+	}
+	
+	self->entryPtr[self->count] = Dictionary_Entry_New( key, value );
+	self->count++;
+}
+
+void _Dictionary_AddWithSource( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value, 
+				Dictionary_Entry_Source source ) 
+{
+	Dictionary* self = (Dictionary*) dictionary;
+	assert( self->count <= self->size );
+	if( self->count == self->size ) {
+		self->size += self->delta;
+		self->entryPtr = Memory_Realloc_Array( self->entryPtr, Dictionary_Entry*, self->size );
+	}
+	
+	self->entryPtr[self->count] = Dictionary_Entry_NewWithSource( key, value, source );
+	self->count++;
+}
+
+Dictionary_Entry_Value* Dictionary_AddMerge( 
+		void*						dictionary, 
+		Dictionary_Entry_Key				key, 
+		Dictionary_Entry_Value*				value,
+		Dictionary_MergeType				mergeType )
+{
+	Dictionary*					self = (Dictionary*)dictionary;
+	Dictionary_Entry*				existingEntry = Dictionary_GetEntry( self, key );
+	Dictionary_Entry_Value*				newValue = value;
+	Dictionary_Entry_Value*				updatedValue = value;
+	Dictionary_Entry_Value*				curValue;
+	
+	if( existingEntry ) {
+		Dictionary_Entry_Value*				existingValue = Dictionary_Entry_Get( existingEntry );
+		Index						i;
+		
+		switch( existingValue->type ) {
+			/* parameters... all behave the same */
+			case Dictionary_Entry_Value_Type_String:
+			case Dictionary_Entry_Value_Type_Double:
+			case Dictionary_Entry_Value_Type_UnsignedInt:
+			case Dictionary_Entry_Value_Type_Int:
+			case Dictionary_Entry_Value_Type_Bool:
+			case Dictionary_Entry_Value_Type_UnsignedLong:
+			case Dictionary_Entry_Value_Type_VoidPtr:
+				switch( mergeType ) {
+					/* "Append", means add to end... default add behaviour */
+					case Dictionary_MergeType_Append:
+						_Dictionary_Add( dictionary, key, newValue );
+						break;
+					/* "Merge" and "Replace" means override */
+					case Dictionary_MergeType_Merge:
+					case Dictionary_MergeType_Replace:
+						Dictionary_Entry_Set( existingEntry, newValue );
+						break;
+				};
+				break;
+			case Dictionary_Entry_Value_Type_Struct:
+				switch( mergeType ) {
+					/* "Append", means add to end... default add behaviour */
+					case Dictionary_MergeType_Append: /* create at end */
+						_Dictionary_Add( dictionary, key, newValue );
+						break;
+					/* "Merge" means for all struct items, add to end... i.e. do nothing here .*/
+					case Dictionary_MergeType_Merge:
+						for( i = 0; i < newValue->as.typeStruct->count; i++ ) {
+							Dictionary_AddMerge( existingValue->as.typeStruct,
+								newValue->as.typeStruct->entryPtr[i]->key, 
+								newValue->as.typeStruct->entryPtr[i]->value, mergeType );
+						}
+						
+						newValue->as.typeStruct->count = 0;
+						Stg_Class_Delete( newValue->as.typeStruct );
+						Memory_Free( newValue );
+						updatedValue = existingValue;
+						break;
+					/* "Replace" means remove current entry and create a newey */
+					case Dictionary_MergeType_Replace:
+						Dictionary_Entry_Set( existingEntry, newValue );
+						break;
+				};
+				break;
+			case Dictionary_Entry_Value_Type_List:
+				switch( mergeType ) {
+					/* "Append", means add to end... default add behaviour */
+					case Dictionary_MergeType_Append: /* create at end */
+						_Dictionary_Add( dictionary, key, newValue );
+						break;
+					/* "Merge": 2 different cases... */
+					/* means for all list items, add to end... i.e. do nothing here .*/
+					case Dictionary_MergeType_Merge:
+						curValue = newValue->as.typeList->first;
+						for( i = 0; i < newValue->as.typeList->count; i++ ) {
+							Dictionary_Entry_Value_AddElement( existingValue, curValue );
+							curValue = curValue->next;
+						}
+						
+						Memory_Free( newValue );
+						updatedValue = existingValue;
+						break;
+					/* "Replace" means remove current entry and create a newey */
+					case Dictionary_MergeType_Replace:
+						Dictionary_Entry_Set( existingEntry, newValue );
+						break;
+				};
+				break;
+			default:
+				Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+					"Error in func %s: Bad existingValue type '%u'\n", __func__, existingValue->type ); 
+				break;
+		}
+	}
+	else {
+		_Dictionary_Add( self, key, value );
+	}
+	
+	return updatedValue;
+}
+
+Dictionary_Entry_Value* Dictionary_AddMergeWithSource( 
+		void*						dictionary, 
+		Dictionary_Entry_Key				key, 
+		Dictionary_Entry_Value*				value,
+		Dictionary_MergeType				mergeType,
+		Dictionary_Entry_Source				source )
+{
+	Dictionary*					self = (Dictionary*)dictionary;
+	Dictionary_Entry*				existingEntry = Dictionary_GetEntry( self, key );
+	Dictionary_Entry_Value*				newValue = value;
+	Dictionary_Entry_Value*				updatedValue = value;
+	Dictionary_Entry_Value*				curValue;
+	
+	if( existingEntry ) {
+		Dictionary_Entry_Value*				existingValue = Dictionary_Entry_Get( existingEntry );
+		Index						i;
+		
+		switch( existingValue->type ) {
+			/* parameters... all behave the same */
+			case Dictionary_Entry_Value_Type_String:
+			case Dictionary_Entry_Value_Type_Double:
+			case Dictionary_Entry_Value_Type_UnsignedInt:
+			case Dictionary_Entry_Value_Type_Int:
+			case Dictionary_Entry_Value_Type_Bool:
+			case Dictionary_Entry_Value_Type_UnsignedLong:
+			case Dictionary_Entry_Value_Type_VoidPtr:
+				switch( mergeType ) {
+					/* "Append", means add to end... default add behaviour */
+					case Dictionary_MergeType_Append:
+						_Dictionary_AddWithSource( dictionary, key, newValue, source );
+						break;
+					/* "Merge" and "Replace" means override */
+					case Dictionary_MergeType_Merge:
+					case Dictionary_MergeType_Replace:
+						Dictionary_Entry_SetWithSource( existingEntry, newValue, source );
+						break;
+				};
+				break;
+			case Dictionary_Entry_Value_Type_Struct:
+				switch( mergeType ) {
+					/* "Append", means add to end... default add behaviour */
+					case Dictionary_MergeType_Append: /* create at end */
+						_Dictionary_AddWithSource( dictionary, key, newValue, source );
+						break;
+					/* "Merge" means for all struct items, add to end... i.e. do nothing here .*/
+					case Dictionary_MergeType_Merge:
+						for( i = 0; i < newValue->as.typeStruct->count; i++ ) {
+							Dictionary_AddMergeWithSource( existingValue->as.typeStruct,
+								newValue->as.typeStruct->entryPtr[i]->key, 
+								newValue->as.typeStruct->entryPtr[i]->value, 
+								mergeType, source );
+						}
+						
+						newValue->as.typeStruct->count = 0;
+						Stg_Class_Delete( newValue->as.typeStruct );
+						Memory_Free( newValue );
+						updatedValue = existingValue;
+						break;
+					/* "Replace" means remove current entry and create a newey */
+					case Dictionary_MergeType_Replace:
+						Dictionary_Entry_SetWithSource( existingEntry, newValue, source );
+						break;
+				};
+				break;
+			case Dictionary_Entry_Value_Type_List:
+				switch( mergeType ) {
+					/* "Append", means add to end... default add behaviour */
+					case Dictionary_MergeType_Append: /* create at end */
+						_Dictionary_AddWithSource( dictionary, key, newValue, source );
+						break;
+					/* "Merge": 2 different cases... */
+					/* means for all list items, add to end... i.e. do nothing here .*/
+					case Dictionary_MergeType_Merge:
+						curValue = newValue->as.typeList->first;
+						for( i = 0; i < newValue->as.typeList->count; i++ ) {
+							Dictionary_Entry_Value_AddElementWithSource( existingValue, curValue, 
+													source );
+							curValue = curValue->next;
+						}
+						
+						Memory_Free( newValue );
+						updatedValue = existingValue;
+						break;
+					/* "Replace" means remove current entry and create a newey */
+					case Dictionary_MergeType_Replace:
+						Dictionary_Entry_SetWithSource( existingEntry, newValue, source );
+						break;
+				};
+				break;
+			default:
+				Journal_Firewall( False, Journal_Register( Error_Type, self->type ),
+					"Error in func %s: Bad existingValue type '%u'\n", __func__, existingValue->type ); 
+				break;
+		}
+	}
+	else {
+		_Dictionary_AddWithSource( self, key, value, source );
+	}
+	
+	return updatedValue;
+}
+
+Bool _Dictionary_Set( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	for( index = 0; index < self->count; index++ ) {
+		if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
+			Dictionary_Entry_Set( self->entryPtr[index], value );
+			return True;
+		}
+	}
+
+	/* If we reach here and haven't found it, add new entry */
+	Dictionary_Add( self, key, value );
+
+	return True;
+}
+
+Bool _Dictionary_SetWithSource( void* dictionary, Dictionary_Entry_Key key, Dictionary_Entry_Value* value,
+				Dictionary_Entry_Source source ) 
+{
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	for( index = 0; index < self->count; index++ ) {
+		if( Dictionary_Entry_CompareWithSource( self->entryPtr[index], key, source ) != 0 ) {
+			Dictionary_Entry_SetWithSource( self->entryPtr[index], value, source );
+			return True;
+		}
+	}
+
+	/* If we reach here and haven't found it, add new entry */
+	Dictionary_AddWithSource( self, key, value, source );
+
+	return True;
+}
+
+Dictionary_Entry_Value* _Dictionary_Get( void* dictionary, Dictionary_Entry_Key key ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+	
+	for( index = 0; index < self->count; index++ ) {
+		if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
+			return Dictionary_Entry_Get( self->entryPtr[index] );
+		}
+	}
+	return 0;
+}
+
+Dictionary_Entry_Source _Dictionary_GetSource( void* dictionary, Dictionary_Entry_Key key) {
+	Dictionary* self = (Dictionary*) dictionary;
+	Dictionary_Index index;
+
+	for( index = 0; index < self->count; index++ ) {
+                if( Dictionary_Entry_Compare( self->entryPtr[index], key ) != 0 ) {
+                        return Dictionary_Entry_GetSource( self->entryPtr[index] );
+                }
+        }
+        return 0;
+}
+
+
+Dictionary_Entry_Value* _Dictionary_GetByIndex( void* dictionary, Dictionary_Index index ) {
+	Dictionary* self = (Dictionary*) dictionary;
+	return Dictionary_Entry_Get(self->entryPtr[index]);
+}
+
+void Dictionary_ParseCommandLineParam( void* self, char* paramString, char* valueString ) {
+	Dictionary* dictionary = (Dictionary*)self;
+	char* point;
+	char* lbracket;
+
+	point = strchr( paramString, '.' );
+	lbracket = strchr( paramString, '[' );
+
+	/* If there's neither a point or left-bracket in the (supposed) param string, them treat as a parameter */
+	if( !point && !lbracket ) {
+		Dictionary_Entry_Value* ev;
+
+		ev = Dictionary_Get( dictionary, paramString );
+
+		/* Add value to dictionary */
+		if( ev == NULL ) {
+			/* If there isn't already an entry in dictionary - create one */
+			Dictionary_Add( dictionary, paramString, Dictionary_Entry_Value_FromString( valueString ) );
+		}
+		else {
+			/* If is already in dictionary - then update value */
+			Dictionary_Entry_Value_SetFromStringKeepCurrentType( ev, valueString );
+		}
+	}
+	else {
+		/* It is either a struct or list or both. Work out one at a time, from the left */
+		if( point && lbracket ) {
+			if( point < lbracket ) {
+				lbracket = 0;
+			}
+			else {
+				point = 0;
+			}
+		}
+
+		if( point ) {
+			char* structString;
+			char* memberString;
+			char* point2;
+			Dictionary* structDictionary; 
+			Dictionary_Entry_Value*  ev;
+			
+			/* Create the struct and member strings from the source */
+			structString = StG_Strdup( paramString );
+			point2 = strchr( structString, '.' );
+			*point2 = 0;
+			memberString = point2 + 1;
+			
+			/* Add value to dictionary */
+			ev = Dictionary_Get( dictionary, structString );
+			if( !ev ) {
+				/* If there isn't already an entry in the dictionary - create one */
+				structDictionary = Dictionary_New();
+				Dictionary_Add( dictionary, structString, Dictionary_Entry_Value_FromStruct( structDictionary ) );
+			}
+			else {
+				/* Entry found. Ensure its a struct */
+				structDictionary = Dictionary_Entry_Value_AsDictionary( ev );
+				Journal_Firewall( 
+					structDictionary==NULL, 
+					Journal_Register( Error_Type, Dictionary_Type ), 
+					"Command line argument \"%s\" parsed as struct, and is in dictionary, but not as a struct",
+						structString );
+			}
+			Dictionary_ParseCommandLineParam( structDictionary, memberString, valueString );
+			Memory_Free( structString );
+		}
+		else if( lbracket ) {
+			char* listString;
+			char* lbracket2;
+			char* indexString;
+			char* rbracket2;
+			char* remainderString;
+			Index index;
+			Bool emptyIndex;
+			Bool isStruct;
+			char* memberString;
+
+			Dictionary_Entry_Value* ev;
+
+			/* Create the list string and index from the source */
+			listString = StG_Strdup( paramString );
+			lbracket2 = strchr( listString, '[' );
+			*lbracket2 = 0;
+			indexString = lbracket2 + 1;
+			
+			/* Make sure there is a right bracket in the string */
+			rbracket2 = strchr( indexString, ']' );
+			Journal_Firewall( 
+				rbracket2==NULL, 
+				Journal_Register( Error_Type, Dictionary_Type ), 
+				"Command line argument \"%s\" parsed as list but missing closing \']\'.",
+					listString );
+			*rbracket2 = 0;
+			remainderString = rbracket2 + 1;
+			
+			/* Obtain the index */
+			if( strlen( indexString ) ) {
+				emptyIndex = False;
+				index = strtoul( indexString, 0, 0 );
+			}
+			else {
+				emptyIndex = True;
+				index = 0;
+			}
+			
+			if( strlen( remainderString ) ) {
+				/* TODO: parse out recursive lists SQ20060206 */
+				/* TODO: parse out structures (properly) SQ20060206 */
+				if( remainderString[0] == '.' ) {
+					memberString = remainderString + 1;
+					isStruct = True;
+				}
+				else {
+					memberString = 0;
+					isStruct = False;
+				}
+			}
+			else {
+				memberString = 0;
+				isStruct = False;
+			}
+			
+			
+			/* Assume it is a parameter */
+			ev = Dictionary_Get( dictionary, listString );
+
+			/* Add value to dictionary */
+			if( ev == NULL ) {
+				/* If there isn't already an entry in dictionary - create one. Verify index is 0 (0th/add)*/
+				Journal_Firewall( 
+					emptyIndex, 
+					Journal_Register( Error_Type, Dictionary_Type ), 
+					"Command line argument \"%s\" parsed as list but list not found and "\
+					"index not specified as add (i.e. '[]').",
+						listString );
+				ev = Dictionary_Entry_Value_NewList();
+				Dictionary_Add( dictionary, listString, ev );
+				if( isStruct ) {
+					Dictionary* newStruct = Dictionary_New();
+					
+					Dictionary_Entry_Value_AddElement( 
+						ev, 
+						Dictionary_Entry_Value_FromStruct( newStruct ) );
+					Dictionary_ParseCommandLineParam( newStruct, memberString, valueString );
+				}
+				else {
+					Dictionary_Entry_Value_AddElement( 
+						ev, 
+						Dictionary_Entry_Value_FromString( valueString ) );
+				}
+			}
+			else {
+				/* Obtain the ith element or add if specified */
+				if( emptyIndex ) {
+					if( isStruct ) {
+						Dictionary* newStruct = Dictionary_New();
+					
+						Dictionary_Entry_Value_AddElement( 
+							ev, 
+							Dictionary_Entry_Value_FromStruct( newStruct ) );
+						Dictionary_ParseCommandLineParam( newStruct, memberString, valueString );
+					}
+					else {
+						Dictionary_Entry_Value_AddElement( 
+							ev, 
+							Dictionary_Entry_Value_FromString( valueString ) );
+					}
+				}
+				else {
+					Dictionary_Entry_Value* item;
+				
+					item = Dictionary_Entry_Value_GetElement( ev, index );
+					Journal_Firewall( 
+						item==NULL, 
+						Journal_Register( Error_Type, Dictionary_Type ), 
+						"Command line argument \"%s\" parsed as list, requesting index \"%u\", "\
+						"but that index does not exist.",
+							listString,
+							index );
+					
+					if( isStruct ) {
+						Dictionary* newStruct = Dictionary_Entry_Value_AsDictionary( item );
+						Dictionary_ParseCommandLineParam( newStruct, memberString, valueString );
+					}
+					else {
+						Dictionary_Entry_Value_SetFromStringKeepCurrentType( item, valueString );
+					}
+				}
+			}
+			Memory_Free( listString );
+		}
+	}
+}
+
+void Dictionary_ReadAllParamFromCommandLine( void* dictionary, int argc, char* argv[] ) {
+	int                     arg_I;
+	Name             preceedingString = "--";
+	char*                   argumentString;
+	char*                   paramString;
+	char*                   valueString;
+	char*                   equalsSign;
+	unsigned int            preceedingStringLength = strlen( preceedingString );
+
+	/* Loop over all the arguments from command line and reads all arguments of form "--param=value" */
+	for ( arg_I = 1 ; arg_I < argc ; arg_I++ ) {
+		argumentString = argv[ arg_I ];
+
+		/* Check is string has preceeding string "--" if not then continue in loop */
+		if ( strncmp( preceedingString, argumentString , preceedingStringLength ) != 0 )
+			continue;
+
+		/* Make sure there is an equals sign in the string */
+		equalsSign = strchr( argumentString, '=' ) ;
+
+		/* Make sure that there are characters after equals sign */
+		if ( equalsSign == NULL ) 
+			continue;
+
+		/* Paramater name starts right after these dashes */
+		paramString = StG_Strdup(&argumentString[ preceedingStringLength ]);
+
+		/* Find Pointer to equals sign in this new string we've just created */
+		equalsSign = strchr( paramString, '=' ) ;
+
+		/* Put in null terminator at equals sign */
+		*equalsSign = '\0';
+
+		/* Get Value String - which is everything after the "=" */
+		valueString = equalsSign + 1;
+
+		Dictionary_ParseCommandLineParam( dictionary, paramString, valueString );
+		
+		/* Free memory that we have allocated */
+		Memory_Free( paramString );
+	}
+}
+
+
+Bool Dictionary_CompareAllEntriesFull( void* dictionary1, void* dictionary2, Bool strictTypeCheck ) {
+	Dictionary*          dict1 = (Dictionary*)dictionary1;
+	Dictionary*          dict2 = (Dictionary*)dictionary2;
+	Dictionary_Entry*    entryPtr1 = NULL;	
+	Dictionary_Entry*    entryPtr2 = NULL;	
+	Bool                 retValue = True;
+	Dictionary_Index     index;
+
+	if ( dict1->count != dict2->count ) return False;
+
+	for( index = 0; index < dict1->count; index++ ) {
+		entryPtr1 = dict1->entryPtr[index];
+		entryPtr2 = dict2->entryPtr[index];
+		retValue = Dictionary_Entry_Compare( entryPtr1, entryPtr2->key );
+		if (retValue == False ) break;
+		retValue = Dictionary_Entry_Value_CompareFull( entryPtr1->value,
+			entryPtr2->value, strictTypeCheck );
+		if (retValue == False ) break;
+	}
+
+	return retValue;
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Dictionary_Entry.c
--- a/Base/IO/src/Dictionary_Entry.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Dictionary_Entry.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include "Dictionary_Entry_Value.h"
-#include "Dictionary_Entry.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
-Dictionary_Entry* Dictionary_Entry_New( Dictionary_Entry_Key key, Dictionary_Entry_Value* value )
-{
-	Dictionary_Entry* self;
-	
-	self = Memory_Alloc( Dictionary_Entry, "Entry" );
-	Dictionary_Entry_Init( self, key, value );
-	
-	return self;
-}
-
-Dictionary_Entry* Dictionary_Entry_NewWithSource( Dictionary_Entry_Key key, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
-{
-	Dictionary_Entry* self;
-	
-	self = Memory_Alloc( Dictionary_Entry, "Entry" );
-	Dictionary_Entry_InitWithSource( self, key, value, source );
-
-	return self;
-}
-
-void Dictionary_Entry_Init( Dictionary_Entry* self, Dictionary_Entry_Key key, Dictionary_Entry_Value* value )
-{
-	assert( key );
-	assert( value );
-
-	self->key = StG_Strdup( key );
-	self->value = value;
-	self->source = NULL;
-}
-
-void Dictionary_Entry_InitWithSource( Dictionary_Entry* self, Dictionary_Entry_Key key, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
-{
-	assert( key );
-	assert( value );
-	
-	self->key = StG_Strdup( key );
-	self->value = value;
-	if( source != NULL )
-		self->source = StG_Strdup( source );
-	else
-		self->source = NULL;
-}
-
-void Dictionary_Entry_Delete( Dictionary_Entry* self )
-{
-  Memory_Free( self->key );
-  Dictionary_Entry_Value_Delete( self->value );
-  if( self->source != NULL )
-    Memory_Free( self->source );
-  Memory_Free( self );
-}
-
-void Dictionary_Entry_Print( Dictionary_Entry* self, Stream* stream )
-{
-	Journal_Printf( stream, "%s: ", self->key );
-	Dictionary_Entry_Value_Print( self->value, stream );
-	if( self->source != NULL )
-		Journal_Printf( stream, " (original source file: %s)", self->source );
-}
-
-Bool Dictionary_Entry_Compare( Dictionary_Entry* self, Dictionary_Entry_Key key )
-{
-  return (!strcmp( self->key, key )) ? True : False;
-}
-
-Bool Dictionary_Entry_CompareWithSource( Dictionary_Entry* self, Dictionary_Entry_Key key, Dictionary_Entry_Source source )
-{
-  if( self->source == NULL )
-    {
-      if( source == NULL )
-        return (!strcmp( self->key, key )) ? True : False;
-      else
-        return False;
-    }
-  else
-    {
-      if( source == NULL )
-        return False;
-      else
-        return (!strcmp(self->key,key) && !strcmp(self->source,source))
-          ? True : False;
-    }
-}
-
-void Dictionary_Entry_Set( Dictionary_Entry* self, Dictionary_Entry_Value* value )
-{
-	assert( value );
-	Dictionary_Entry_Value_Delete( self->value );
-	self->value = value;
-}
-
-void Dictionary_Entry_SetWithSource( Dictionary_Entry* self, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
-{
-	assert( value );
-	Dictionary_Entry_Value_Delete( self->value );
-	self->value = value;
-
-	if( self->source != NULL )
-		Memory_Free( self->source );
-	if( source != NULL )
-		self->source = StG_Strdup( source );
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Get( Dictionary_Entry* self )
-{
-	return self->value;
-}
-
-Dictionary_Entry_Source Dictionary_Entry_GetSource( Dictionary_Entry* self )
-{
-	return self->source;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Dictionary_Entry.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Dictionary_Entry.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,158 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Dictionary_Entry.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include "Dictionary_Entry_Value.h"
+#include "Dictionary_Entry.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+Dictionary_Entry* Dictionary_Entry_New( Dictionary_Entry_Key key, Dictionary_Entry_Value* value )
+{
+	Dictionary_Entry* self;
+	
+	self = Memory_Alloc( Dictionary_Entry, "Entry" );
+	Dictionary_Entry_Init( self, key, value );
+	
+	return self;
+}
+
+Dictionary_Entry* Dictionary_Entry_NewWithSource( Dictionary_Entry_Key key, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
+{
+	Dictionary_Entry* self;
+	
+	self = Memory_Alloc( Dictionary_Entry, "Entry" );
+	Dictionary_Entry_InitWithSource( self, key, value, source );
+
+	return self;
+}
+
+void Dictionary_Entry_Init( Dictionary_Entry* self, Dictionary_Entry_Key key, Dictionary_Entry_Value* value )
+{
+	assert( key );
+	assert( value );
+
+	self->key = StG_Strdup( key );
+	self->value = value;
+	self->source = NULL;
+}
+
+void Dictionary_Entry_InitWithSource( Dictionary_Entry* self, Dictionary_Entry_Key key, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
+{
+	assert( key );
+	assert( value );
+	
+	self->key = StG_Strdup( key );
+	self->value = value;
+	if( source != NULL )
+		self->source = StG_Strdup( source );
+	else
+		self->source = NULL;
+}
+
+void Dictionary_Entry_Delete( Dictionary_Entry* self )
+{
+  Memory_Free( self->key );
+  Dictionary_Entry_Value_Delete( self->value );
+  if( self->source != NULL )
+    Memory_Free( self->source );
+  Memory_Free( self );
+}
+
+void Dictionary_Entry_Print( Dictionary_Entry* self, Stream* stream )
+{
+	Journal_Printf( stream, "%s: ", self->key );
+	Dictionary_Entry_Value_Print( self->value, stream );
+	if( self->source != NULL )
+		Journal_Printf( stream, " (original source file: %s)", self->source );
+}
+
+Bool Dictionary_Entry_Compare( Dictionary_Entry* self, Dictionary_Entry_Key key )
+{
+  return (!strcmp( self->key, key )) ? True : False;
+}
+
+Bool Dictionary_Entry_CompareWithSource( Dictionary_Entry* self, Dictionary_Entry_Key key, Dictionary_Entry_Source source )
+{
+  if( self->source == NULL )
+    {
+      if( source == NULL )
+        return (!strcmp( self->key, key )) ? True : False;
+      else
+        return False;
+    }
+  else
+    {
+      if( source == NULL )
+        return False;
+      else
+        return (!strcmp(self->key,key) && !strcmp(self->source,source))
+          ? True : False;
+    }
+}
+
+void Dictionary_Entry_Set( Dictionary_Entry* self, Dictionary_Entry_Value* value )
+{
+	assert( value );
+	Dictionary_Entry_Value_Delete( self->value );
+	self->value = value;
+}
+
+void Dictionary_Entry_SetWithSource( Dictionary_Entry* self, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
+{
+	assert( value );
+	Dictionary_Entry_Value_Delete( self->value );
+	self->value = value;
+
+	if( self->source != NULL )
+		Memory_Free( self->source );
+	if( source != NULL )
+		self->source = StG_Strdup( source );
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Get( Dictionary_Entry* self )
+{
+	return self->value;
+}
+
+Dictionary_Entry_Source Dictionary_Entry_GetSource( Dictionary_Entry* self )
+{
+	return self->source;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Dictionary_Entry_Value.c
--- a/Base/IO/src/Dictionary_Entry_Value.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1212 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Dictionary_Entry_Value.c 4282 2008-07-14 06:01:20Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "Stream.h" 
-#include "Dictionary.h"
-#include "Dictionary_Entry.h"
-#include "Dictionary_Entry_Value.h"
-#include "PathUtils.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* Private functions */
-static void Dictionary_Entry_Value_SetValueUnsignedInt( Dictionary_Entry_Value* self, unsigned int value );
-static void Dictionary_Entry_Value_SetValueInt( Dictionary_Entry_Value* self, unsigned int value );
-static void Dictionary_Entry_Value_SetValueDouble( Dictionary_Entry_Value* self, double value );
-static void Dictionary_Entry_Value_SetValueUnsignedLong( Dictionary_Entry_Value* self, unsigned long value );
-static void Dictionary_Entry_Value_SetValueString( Dictionary_Entry_Value* self, Name const value );
-static void Dictionary_Entry_Value_SetValueBool( Dictionary_Entry_Value* self, Bool value );
-static void Dictionary_Entry_Value_SetValueNewStruct( Dictionary_Entry_Value* self);
-static void Dictionary_Entry_Value_SetValueStruct( Dictionary_Entry_Value* self, void* value );
-static void Dictionary_Entry_Value_SetValueNewList( Dictionary_Entry_Value* self );
-static void Dictionary_Entry_Value_DeleteContents( Dictionary_Entry_Value* self);
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromUnsignedInt( unsigned int value ) {
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Signed Int" );
-	
-	Dictionary_Entry_Value_InitFromUnsignedInt( self, value );
-	
-	return self;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromInt( int value ) {
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Int" );
-	
-	Dictionary_Entry_Value_InitFromInt( self, value );
-	
-	return self;
-}
-
-void Dictionary_Entry_Value_InitFromUnsignedInt( Dictionary_Entry_Value* self, unsigned int value ) {
-	Dictionary_Entry_Value_SetValueUnsignedInt( self, value );
-	self->next = 0;
-}
-
-void Dictionary_Entry_Value_InitFromInt( Dictionary_Entry_Value* self, int value ) {
-	Dictionary_Entry_Value_SetValueInt( self, value );
-	self->next = 0;
-}
-
-static void Dictionary_Entry_Value_SetValueUnsignedInt( Dictionary_Entry_Value* self, unsigned int value ) {
-	self->as.typeUnsignedInt = value;
-	self->type = Dictionary_Entry_Value_Type_UnsignedInt;
-}
-
-static void Dictionary_Entry_Value_SetValueInt( Dictionary_Entry_Value* self, unsigned int value ) {
-	self->as.typeInt = value;
-	self->type = Dictionary_Entry_Value_Type_Int;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromDouble( double value ) {
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Double" );
-	
-	Dictionary_Entry_Value_InitFromDouble( self, value );
-	
-	return self;
-}
-
-void Dictionary_Entry_Value_InitFromDouble( Dictionary_Entry_Value* self, double value ) {
-	Dictionary_Entry_Value_SetValueDouble( self, value );
-	self->next = 0;
-}
-
-
-static void Dictionary_Entry_Value_SetValueDouble( Dictionary_Entry_Value* self, double value ) {
-	self->as.typeDouble = value;
-	self->type = Dictionary_Entry_Value_Type_Double;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromUnsignedLong( unsigned long value ) {
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Unsigned Long" );
-	
-	Dictionary_Entry_Value_InitFromUnsignedLong( self, value );
-	
-	return self;
-}
-
-void Dictionary_Entry_Value_InitFromUnsignedLong( Dictionary_Entry_Value* self, unsigned long value ) {
-	Dictionary_Entry_Value_SetValueUnsignedLong( self, value );
-	self->next = 0;
-}
-
-static void Dictionary_Entry_Value_SetValueUnsignedLong( Dictionary_Entry_Value* self, unsigned long value ) {
-	self->as.typeUnsignedLong = value;
-	self->type = Dictionary_Entry_Value_Type_UnsignedLong;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromString( Name const value ) {
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value String" );
-	
-	Dictionary_Entry_Value_InitFromString( self, value );
-	
-	return self;
-}
-	
-void Dictionary_Entry_Value_InitFromString( Dictionary_Entry_Value* self, Name const value ) {
-	Dictionary_Entry_Value_SetValueString( self, value );
-	self->next = 0;
-}
-
-static void Dictionary_Entry_Value_SetValueString( Dictionary_Entry_Value* self, Name const value ) {
-	self->as.typeString = StG_Strdup( value );
-	self->type = Dictionary_Entry_Value_Type_String;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromStringTo( char* string, char type ) {
-	Dictionary_Entry_Value* retValue = Memory_Alloc( Dictionary_Entry_Value, "Return Value" );
-	
-	/* need to create the value temporarily so it can be converted if necessary */
-	retValue->type = Dictionary_Entry_Value_Type_String;
-
-	if ( string ) {
-		retValue->as.typeString = ExpandEnvironmentVariables( string );
-	}
-	else {
-		retValue->as.typeString = string;
-	}
-	
-	switch (type) {
-		case Dictionary_Entry_Value_Type_String:
-			Dictionary_Entry_Value_InitFromString( retValue, retValue->as.typeString );
-			break;
-		case Dictionary_Entry_Value_Type_Double:
-			Dictionary_Entry_Value_InitFromDouble( retValue, Dictionary_Entry_Value_AsDouble( retValue ) );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			Dictionary_Entry_Value_InitFromUnsignedInt( retValue, Dictionary_Entry_Value_AsUnsignedInt( retValue ) );
-			break;
-		case Dictionary_Entry_Value_Type_Int:
-			Dictionary_Entry_Value_InitFromInt( retValue, Dictionary_Entry_Value_AsInt( retValue ) );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			Dictionary_Entry_Value_InitFromUnsignedLong( retValue, Dictionary_Entry_Value_AsUnsignedLong( retValue ) );
-			break;
-		case Dictionary_Entry_Value_Type_Bool:
-			Dictionary_Entry_Value_InitFromBool( retValue, Dictionary_Entry_Value_AsBool( retValue ) );
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			Dictionary_Entry_Value_InitNewStruct( retValue );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			Dictionary_Entry_Value_InitNewList( retValue );
-			break;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: type '%d' is invalid.\n", __func__, type );
-		}
-	}		
-	
-	return retValue;
-}
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromBool( Bool value ) {
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Bool" );
-	
-	Dictionary_Entry_Value_InitFromBool( self, value );
-	
-	return self;
-}
-
-void Dictionary_Entry_Value_InitFromBool( Dictionary_Entry_Value* self, Bool value ) {
-	Dictionary_Entry_Value_SetValueBool( self, value );
-	self->next = 0;
-}
-
-static void Dictionary_Entry_Value_SetValueBool( Dictionary_Entry_Value* self, Bool value ) {
-	self->as.typeBool = value;
-	if( self->as.typeBool != False && self->as.typeBool != True ) {
-		self->as.typeBool = True;
-	}
-	self->type = Dictionary_Entry_Value_Type_Bool;
-}
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_NewStruct( void )
-{
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Struct" );
-	
-	Dictionary_Entry_Value_InitNewStruct( self );
-	return self;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_FromStruct( void* dictionary )
-{
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Struct" );
-	
-	Dictionary_Entry_Value_InitFromStruct( self, dictionary );
-	return self;
-}
-
-void Dictionary_Entry_Value_InitNewStruct( Dictionary_Entry_Value* self )
-{
-	Dictionary_Entry_Value_SetValueNewStruct( self );
-	self->next = 0;
-}
-
-void Dictionary_Entry_Value_InitFromStruct( Dictionary_Entry_Value* self, void* dictionary )
-{
-	Dictionary_Entry_Value_SetValueStruct( self, dictionary );
-	self->next = 0;
-}
-
-static void Dictionary_Entry_Value_SetValueNewStruct( Dictionary_Entry_Value* self ) {
-	Dictionary_Entry_Value_SetValueStruct( self, Dictionary_New() );
-}
-
-static void Dictionary_Entry_Value_SetValueStruct( Dictionary_Entry_Value* self, void* value )
-{
-	self->as.typeStruct = (Dictionary*) value;
-	self->type = Dictionary_Entry_Value_Type_Struct;
-}
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_NewList( void )
-{
-	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value List" );
-	
-	Dictionary_Entry_Value_InitNewList( self );
-	return self;
-}
-
-void Dictionary_Entry_Value_InitNewList( Dictionary_Entry_Value* self )
-{
-	Dictionary_Entry_Value_SetValueNewList( self );
-	self->next = 0;
-}
-
-static void Dictionary_Entry_Value_SetValueNewList( Dictionary_Entry_Value* self )
-{
-	self->as.typeList = Memory_Alloc( Dictionary_Entry_Value_List, "Entry Value List" );
-	self->as.typeList->first = NULL;
-	self->as.typeList->last = NULL;
-	self->as.typeList->count = 0;
-	self->as.typeList->encoding = Default;
-	self->type = Dictionary_Entry_Value_Type_List;
-}
-
-
-void Dictionary_Entry_Value_AddMember( Dictionary_Entry_Value* self, Dictionary_Entry_Key name,	Dictionary_Entry_Value* value )
-{
-	self->as.typeStruct->add( self->as.typeStruct, name, value);
-}
-
-void Dictionary_Entry_Value_AddMemberWithSource( Dictionary_Entry_Value* self, Dictionary_Entry_Key name,
-							Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
-{
-	self->as.typeStruct->addWithSource( self->as.typeStruct, name, value, source);
-}
-
-void Dictionary_Entry_Value_AddElement( Dictionary_Entry_Value* self, Dictionary_Entry_Value* element )
-{
-	/* check type - convert to a list if not so... */
-	if (Dictionary_Entry_Value_Type_List != self->type) {
-		Dictionary_Entry_Value* copy = NULL;
-		copy = Dictionary_Entry_Value_Copy( self, True );
-		Dictionary_Entry_Value_SetNewList( self );	
-		Dictionary_Entry_Value_AddElement( self, copy );
-	}
-	
-	if (!self->as.typeList->first) {
-		self->as.typeList->first = element;
-	} else {
-		self->as.typeList->last->next = element;
-	}
-	self->as.typeList->last = element;
-	self->as.typeList->count++;
-}
-
-
-void Dictionary_Entry_Value_AddElementWithSource(
-		Dictionary_Entry_Value* self,
-		Dictionary_Entry_Value* element,
-		Dictionary_Entry_Source source )
-{
-	/* check type - convert to a list if not so... */
-	if (Dictionary_Entry_Value_Type_List != self->type) {
-		Dictionary_Entry_Value* copy = NULL;
-		copy = Dictionary_Entry_Value_Copy( self, True );
-
-		Dictionary_Entry_Value_SetNewList( self );	
-		Dictionary_Entry_Value_AddElementWithSource( self, copy, source );
-	}
-	
-	if (!self->as.typeList->first) {
-		self->as.typeList->first = element;
-	} else {
-		self->as.typeList->last->next = element;
-	}
-	self->as.typeList->last = element;
-	self->as.typeList->count++;
-}
-
-
-void Dictionary_Entry_Value_Delete( Dictionary_Entry_Value* self ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Memory_Free( self );
-}
-
-
-static void Dictionary_Entry_Value_DeleteContents( Dictionary_Entry_Value* self ) {
-	Dictionary_Entry_Value* cur         = NULL;
-	Dictionary_Entry_Value* next        = NULL;
-	Stream*                 errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_String:
-			Journal_Firewall( self->as.typeString != NULL, errorStream, "In func %s: self->as.typeString is NULL.\n", __func__ );
-			Memory_Free( self->as.typeString );
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			Journal_Firewall( self->as.typeStruct != NULL, errorStream, "In func %s: self->as.typeStruct is NULL.\n", __func__ );
-			Stg_Class_Delete( self->as.typeStruct );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			cur = self->as.typeList->first;
-			while ( cur ) {
-				next = cur->next;
-				Dictionary_Entry_Value_Delete( cur );
-				cur = next;
-			}	
-			Memory_Free( self->as.typeList );
-			break;
-		case Dictionary_Entry_Value_Type_Double:
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-		case Dictionary_Entry_Value_Type_Int:
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-		case Dictionary_Entry_Value_Type_Bool:
-			break;
-		default:
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-	};
-}
-
-
-void Dictionary_Entry_Value_Print( Dictionary_Entry_Value* self, Stream* stream ) {
-	Dictionary_Index index;
-	
-	if( !self ) {
-		return;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_String:
-			Journal_Printf( stream, "\"%s\"", self->as.typeString );
-			return;
-		case Dictionary_Entry_Value_Type_Double:
-			Journal_Printf( stream, "%g", self->as.typeDouble );
-			return;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			Journal_Printf( stream, "%u", self->as.typeUnsignedInt );
-			return;
-		case Dictionary_Entry_Value_Type_Int:
-			Journal_Printf( stream, "%d", self->as.typeInt );
-			return;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			Journal_Printf( stream, "%ld", self->as.typeUnsignedLong );
-			return;
-		case Dictionary_Entry_Value_Type_Bool:
-			Journal_Printf( stream, "%s", Dictionary_Entry_Value_AsString( self ) );
-			return;
-		case Dictionary_Entry_Value_Type_List:
-			if (self->as.typeList->first) {
-				Dictionary_Entry_Value* cur = self->as.typeList->first;
-				Dictionary_Entry_Value_Print( cur, stream );
-				cur = cur->next;
-				
-				while (cur) {
-					Journal_Printf( stream, ", " );
-					Dictionary_Entry_Value_Print( cur, stream );
-					cur = cur->next;
-				}
-			}
-			return;
-		case Dictionary_Entry_Value_Type_Struct:
-			Stream_Indent( stream );
-			for( index = 0; index < self->as.typeStruct->count; index++ ) {
-				Journal_Printf( stream, "\n");
-				Journal_Printf( stream, "%s: ", self->as.typeStruct->entryPtr[index]->key );
-				Dictionary_Entry_Value_Print( self->as.typeStruct->entryPtr[index]->value, stream );
-			}
-			Stream_UnIndent( stream );
-			return;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-}
-
-
-void Dictionary_Entry_Value_SetFrom( Dictionary_Entry_Value* self, void* value, const char type) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	
-	switch (type) {
-		case Dictionary_Entry_Value_Type_String:
-			Dictionary_Entry_Value_SetValueString( self, *( (char**) value) );
-			break;
-		case Dictionary_Entry_Value_Type_Double:
-			Dictionary_Entry_Value_SetValueDouble( self, *( (double*) value) );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			Dictionary_Entry_Value_SetValueUnsignedInt( self, *( (unsigned int*) value) );
-			break;
-		case Dictionary_Entry_Value_Type_Int:
-			Dictionary_Entry_Value_SetValueInt( self, *( (unsigned int*) value) );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			Dictionary_Entry_Value_SetValueUnsignedLong( self, *( (unsigned long*) value) );
-			break;
-		case Dictionary_Entry_Value_Type_Bool:
-			Dictionary_Entry_Value_SetValueBool( self, *( (Bool*) value) );
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			Dictionary_Entry_Value_SetValueStruct( self, value );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			Dictionary_Entry_Value_SetValueNewList( self );
-			break;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-}
-
-
-void Dictionary_Entry_Value_SetFromUnsignedInt( Dictionary_Entry_Value* self, unsigned int value ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueUnsignedInt( self, value );
-}
-
-void Dictionary_Entry_Value_SetFromInt( Dictionary_Entry_Value* self, int value ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueInt( self, value );
-}
-
-void Dictionary_Entry_Value_SetFromDouble( Dictionary_Entry_Value* self, double value ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueDouble( self, value );
-}
-
-void Dictionary_Entry_Value_SetFromUnsignedLong( Dictionary_Entry_Value* self, unsigned long value ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueUnsignedLong( self, value );
-}
-
-void Dictionary_Entry_Value_SetFromString( Dictionary_Entry_Value* self, char* value ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueString( self, value );
-}
-
-
-void Dictionary_Entry_Value_SetFromStringKeepCurrentType( Dictionary_Entry_Value* self, char* string ) {
-	Dictionary_Entry_Value_Type currType = self->type;
-	Dictionary_Entry_Value_DeleteContents( self );
-	self->type = Dictionary_Entry_Value_Type_String;
-	self->as.typeString = string;
-	
-	switch (currType) {
-		case Dictionary_Entry_Value_Type_String:
-			Dictionary_Entry_Value_SetValueString( self, string );
-			break;
-		case Dictionary_Entry_Value_Type_Double:
-			Dictionary_Entry_Value_SetValueDouble( self, Dictionary_Entry_Value_AsDouble( self ) );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			Dictionary_Entry_Value_SetValueUnsignedInt( self, Dictionary_Entry_Value_AsUnsignedInt( self ) );
-			break;
-		case Dictionary_Entry_Value_Type_Int:
-			Dictionary_Entry_Value_SetValueInt( self, Dictionary_Entry_Value_AsInt( self ) );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			Dictionary_Entry_Value_SetValueUnsignedLong( self, Dictionary_Entry_Value_AsUnsignedLong( self ) );
-			break;
-		case Dictionary_Entry_Value_Type_Bool:
-			Dictionary_Entry_Value_SetValueBool( self, Dictionary_Entry_Value_AsBool( self ) );
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			Dictionary_Entry_Value_SetValueNewStruct( self );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			Dictionary_Entry_Value_SetValueNewList( self );
-			break;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-}
-
-
-void Dictionary_Entry_Value_SetFromBool( Dictionary_Entry_Value* self, Bool value ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueBool( self, value );
-}
-
-
-void Dictionary_Entry_Value_SetNewStruct( Dictionary_Entry_Value* self )
-{
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueNewStruct( self );
-}
-
-
-void Dictionary_Entry_Value_SetNewList( Dictionary_Entry_Value* self )
-{
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueNewList( self );
-}
-
-void Dictionary_Entry_Value_SetFromStruct( Dictionary_Entry_Value* self, void* dictionary ) {
-	Dictionary_Entry_Value_DeleteContents( self );
-	Dictionary_Entry_Value_SetValueStruct( self, dictionary );
-}
-
-unsigned int Dictionary_Entry_Value_AsUnsignedInt( Dictionary_Entry_Value* self ) {
-	if( !self ) {
-		return 0;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			/* Do nothing (later will print a warning) */
-			return 0;
-		case Dictionary_Entry_Value_Type_List:
-			/* returns the first element as an unsigned int */
-			if (self->as.typeList->first) {
-				return Dictionary_Entry_Value_AsUnsignedInt( self->as.typeList->first );
-			} else {	
-				return 0;
-			}	
-		case Dictionary_Entry_Value_Type_String:
-			return strtoul( self->as.typeString, 0, 0 );
-		case Dictionary_Entry_Value_Type_Double:
-			return (unsigned int)self->as.typeDouble;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			return self->as.typeUnsignedInt;
-		case Dictionary_Entry_Value_Type_Int:
-			return self->as.typeInt;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return self->as.typeUnsignedLong;
-		case Dictionary_Entry_Value_Type_Bool:
-			return (unsigned int)self->as.typeBool;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return 0;
-}
-
-int Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value* self ) {
-	if( !self ) {
-		return 0;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			/* Do nothing (later will print a warning) */
-			return 0;
-		case Dictionary_Entry_Value_Type_List:
-			/* returns the first element as an unsigned int */
-			if (self->as.typeList->first) {
-				return Dictionary_Entry_Value_AsInt( self->as.typeList->first );
-			} else {	
-				return 0;
-			}	
-		case Dictionary_Entry_Value_Type_String:
-			return strtoul( self->as.typeString, 0, 0 );
-		case Dictionary_Entry_Value_Type_Double:
-			return (unsigned int)self->as.typeDouble;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			return self->as.typeUnsignedInt;
-		case Dictionary_Entry_Value_Type_Int:
-			return self->as.typeInt;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return self->as.typeUnsignedLong;
-		case Dictionary_Entry_Value_Type_Bool:
-			return (unsigned int)self->as.typeBool;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return 0;
-}
-
-double Dictionary_Entry_Value_AsDouble( Dictionary_Entry_Value* self ) {
-	if( !self ) {
-		return 0.0f;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			/* Do nothing (later will print a warning) */
-			return 0;
-		case Dictionary_Entry_Value_Type_List:
-			/* returns the first element as an unsigned int */
-			if (self->as.typeList->first) {
-				return Dictionary_Entry_Value_AsDouble( self->as.typeList->first );
-			} else {	
-				return 0;
-			}	
-		case Dictionary_Entry_Value_Type_String:
-			return strtod( self->as.typeString, 0 );
-		case Dictionary_Entry_Value_Type_Double:
-			return self->as.typeDouble;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			return (double)self->as.typeUnsignedInt;
-		case Dictionary_Entry_Value_Type_Int:
-			return self->as.typeInt;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return self->as.typeUnsignedLong;
-		case Dictionary_Entry_Value_Type_Bool:
-			return (double)self->as.typeBool;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	
-	return 0.0f;
-}
-
-unsigned long Dictionary_Entry_Value_AsUnsignedLong( Dictionary_Entry_Value* self ) {
-	if( !self ) {
-		return 0.0;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			/* Do nothing (later will print a warning) */
-			return 0;
-		case Dictionary_Entry_Value_Type_List:
-			/* returns the first element as an unsigned long */
-			if (self->as.typeList->first) {
-				return Dictionary_Entry_Value_AsUnsignedLong( self->as.typeList->first );
-			} else {	
-				return 0;
-			}	
-		case Dictionary_Entry_Value_Type_String:
-			return strtod( self->as.typeString, 0 );
-		case Dictionary_Entry_Value_Type_Double:
-			return self->as.typeDouble;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			return (double)self->as.typeUnsignedInt;
-		case Dictionary_Entry_Value_Type_Int:
-			return self->as.typeInt;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return self->as.typeUnsignedLong;
-		case Dictionary_Entry_Value_Type_Bool:
-			return (double)self->as.typeBool;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	
-	return 0.0;
-}
-
-char* Dictionary_Entry_Value_AsString( Dictionary_Entry_Value* self ) {
-	static char buf[256];
-	
-	if( !self ) {
-		strcpy( buf, "" );
-		return buf;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			strcpy( buf, "" );
-			return buf;
-		case Dictionary_Entry_Value_Type_List:
-			/* returns the first element as a string */
-			if (self->as.typeList->first) {
-				return Dictionary_Entry_Value_AsString( self->as.typeList->first );
-			} else {	
-				return 0;
-			}	
-		case Dictionary_Entry_Value_Type_String:
-			return self->as.typeString;
-		case Dictionary_Entry_Value_Type_Double:
-			sprintf( buf, "%g", self->as.typeDouble );
-			return buf;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			sprintf( buf, "%u", self->as.typeUnsignedInt );
-			return buf;
-		case Dictionary_Entry_Value_Type_Int:
-			sprintf( buf, "%d", self->as.typeInt );
-			return buf;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			sprintf( buf, "%ld", self->as.typeUnsignedLong );
-			return buf;
-		case Dictionary_Entry_Value_Type_Bool:
-			if (True == self->as.typeBool) {
-				 sprintf( buf, "true" );
-			}	 
-			else if (False == self->as.typeBool) {
-				 sprintf( buf, "false" );
-			}	 
-			return buf;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return buf;
-}
-
-
-Bool Dictionary_Entry_Value_AsBool( Dictionary_Entry_Value* self ) {
-	if( !self ) {
-          return False;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			/* Do nothing (later will print a warning) */
-			return False;
-		case Dictionary_Entry_Value_Type_List:
-			/* returns the first element as an unsigned int */
-			if (self->as.typeList->first) {
-				return Dictionary_Entry_Value_AsBool( self->as.typeList->first );
-			} else {	
-				return False;
-			}	
-		case Dictionary_Entry_Value_Type_String:
-			if( !strcmp( "1", self->as.typeString ) ) {
-				return True;
-			}
-			else if( !strcmp( "0", self->as.typeString ) ) {
-				return False;
-			}
-			else if( !strcasecmp( "true", self->as.typeString ) ) {
-				return True;
-			}
-			else if( !strcasecmp( "false", self->as.typeString ) ) {
-				return False;
-			}
-			else if( !strcasecmp( "t", self->as.typeString ) ) {
-				return True;
-			}
-			else if( !strcasecmp( "f", self->as.typeString ) ) {
-				return False;
-			}
-			else if( !strcasecmp( "yes", self->as.typeString ) ) {
-				return True;
-			}
-			else if( !strcasecmp( "no", self->as.typeString ) ) {
-				return False;
-			}
-			else if( !strcasecmp( "y", self->as.typeString ) ) {
-				return True;
-			}
-			else if( !strcasecmp( "n", self->as.typeString ) ) {
-				return False;
-			}
-			else if( !strcasecmp( "on", self->as.typeString ) ) {
-				return True;
-			}
-			else if( !strcasecmp( "off", self->as.typeString ) ) {
-				return False;
-			}
-			else {
-				Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-				Journal_Firewall( False, errorStream, "In func %s: Cannot convert string '%s' to Bool.\n", __func__, self->as.typeString );
-			}
-		case Dictionary_Entry_Value_Type_Double:
-			if( (Bool)self->as.typeDouble ) {
-				return True;
-			}
-			else {
-				return False;
-			}
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			if( (Bool)self->as.typeUnsignedInt ) {
-				return True;
-			}
-			else {
-				return False;
-			}
-		case Dictionary_Entry_Value_Type_Int:
-			if( (Bool)self->as.typeInt ) {
-				return True;
-			}
-			else {
-				return False;
-			}
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			if( (Bool)self->as.typeUnsignedLong ) {
-				return True;
-			}
-			else {
-				return False;
-			}
-		case Dictionary_Entry_Value_Type_Bool:
-			return self->as.typeBool;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return False;
-}
-
-
-Bool Dictionary_Entry_Value_AsBool_with_Default( Dictionary_Entry_Value* self, Bool Default ) {
-  if(self==NULL)
-    return Default;
-  else
-    return Dictionary_Entry_Value_AsBool(self);
-}
-
-
-Dictionary* Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value* self ) {
-	if( !self ) {
-		return 0;
-	}
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			return self->as.typeStruct;
-		case Dictionary_Entry_Value_Type_List:
-			return 0;
-		case Dictionary_Entry_Value_Type_String:
-			return 0;
-		case Dictionary_Entry_Value_Type_Double:
-			return 0;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			return 0;
-		case Dictionary_Entry_Value_Type_Int:
-			return 0;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return 0;
-		case Dictionary_Entry_Value_Type_Bool:
-			return 0;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return 0;
-}
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_GetFirstElement( Dictionary_Entry_Value* self )
-{
-	return Dictionary_Entry_Value_GetElement( self, 0 );
-}
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_GetElement( Dictionary_Entry_Value* self, Index index )
-{
-	Index currIndex = 0;
-	Dictionary_Entry_Value* currElement = NULL;
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_List:
-			if ( index > self->as.typeList->count ) {
-				return NULL;
-			}
-			
-			currElement = self->as.typeList->first;
-			while ( currIndex++ < index ) {
-				currElement = currElement->next;
-			}	
-			
-			return currElement;
-		case Dictionary_Entry_Value_Type_Struct:
-		case Dictionary_Entry_Value_Type_String:
-		case Dictionary_Entry_Value_Type_Bool:
-		case Dictionary_Entry_Value_Type_Double:
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-		case Dictionary_Entry_Value_Type_Int:
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return self;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return self;
-}
-
-
-Index Dictionary_Entry_Value_GetCount( Dictionary_Entry_Value* self )
-{
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_List:
-			return self->as.typeList->count;
-		case Dictionary_Entry_Value_Type_Struct:
-			return self->as.typeStruct->count;
-		case Dictionary_Entry_Value_Type_String:
-		case Dictionary_Entry_Value_Type_Bool:
-		case Dictionary_Entry_Value_Type_Double:
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-		case Dictionary_Entry_Value_Type_Int:
-			return 1;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return 1;
-}
-
-
-void Dictionary_Entry_Value_SetEncoding( Dictionary_Entry_Value* self, const Encoding encoding ) {
-	if ( Dictionary_Entry_Value_Type_List == self->type ) {
-		self->as.typeList->encoding = encoding;
-	}	
-}
-
-
-Encoding Dictionary_Entry_Value_GetEncoding( Dictionary_Entry_Value* self ) {
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_List:
-			return self->as.typeList->encoding;
-		case Dictionary_Entry_Value_Type_Struct:
-		case Dictionary_Entry_Value_Type_String:
-		case Dictionary_Entry_Value_Type_Bool:
-		case Dictionary_Entry_Value_Type_Double:
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-		case Dictionary_Entry_Value_Type_Int:
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			return Default;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-	return Default;
-}
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value* self, Dictionary_Entry_Key name) {
-	Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-
-	Journal_Firewall( self->as.typeStruct != NULL, 
-			errorStream, "In func %s: self->as.typeStruct is NULL.\n", __func__, self->as.typeStruct );
-	if ( Dictionary_Entry_Value_Type_Struct != self->type ) {
-		return NULL;
-	}
-	
-	return self->as.typeStruct->get( self->as.typeStruct, name );
-}
-
-
-void Dictionary_Entry_Value_SetMember( Dictionary_Entry_Value* self,
-	Dictionary_Entry_Key name, Dictionary_Entry_Value* member ) {
-	Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			self->as.typeStruct->set( self->as.typeStruct, name, member );
-			return;
-		case Dictionary_Entry_Value_Type_List:
-		case Dictionary_Entry_Value_Type_String:
-		case Dictionary_Entry_Value_Type_Bool:
-		case Dictionary_Entry_Value_Type_Double:
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-		case Dictionary_Entry_Value_Type_Int:
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			/* should print a warning once journal set up */
-			Journal_Printf( errorStream, "Func %s does not support Dictionary_Entry_Values of type '%d'.\n", __func__, self->type );
-			return;
-		default:
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-	};
-}
-
-
-void Dictionary_Entry_Value_SetMemberWithSource( Dictionary_Entry_Value* self,
-	Dictionary_Entry_Key name, Dictionary_Entry_Value* member, Dictionary_Entry_Source source ) {
-	Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-	
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			self->as.typeStruct->setWithSource( self->as.typeStruct, name, member, source );
-			return;
-		case Dictionary_Entry_Value_Type_List:
-		case Dictionary_Entry_Value_Type_String:
-		case Dictionary_Entry_Value_Type_Bool:
-		case Dictionary_Entry_Value_Type_Double:
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-		case Dictionary_Entry_Value_Type_Int:
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			/* should print a warning once journal set up */
-			Journal_Printf( errorStream, "Func %s does not support Dictionary_Entry_Values of type '%d'.\n", __func__, self->type );
-			return;
-		default:
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-	};
-}
-
-
-Bool Dictionary_Entry_Value_CompareFull( Dictionary_Entry_Value* self, Dictionary_Entry_Value* dev, Bool strictTypeCheck ) {
-	Bool         retValue = True; 
-	Stream*      errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-
-	if ( strictTypeCheck ) {
-		if ( self->type != dev->type ) {
-			return False;
-		}
-	}
-
-	switch( self->type ) {
-		case Dictionary_Entry_Value_Type_String: {
-			/* Comparing as strings is tricky. When both are strings it's fine. If the dev to compare to is stored
-			 * natively as a number, we should convert the first to a number also for comparison. Otherwise, you
-			 * can get false Negatives when the entries are numerically the same, but use different notation
-			 * (e.g. scientific vs decimal) */ 	
-			switch( dev->type ) {
-				case Dictionary_Entry_Value_Type_String:
-					if ( 0 != strcmp( self->as.typeString, dev->as.typeString ) ) 
-						retValue = False;
-					break;
-				case Dictionary_Entry_Value_Type_Double:
-					if ( dev->as.typeDouble != Dictionary_Entry_Value_AsDouble( self ) )
-						retValue = False;
-					break;
-				case Dictionary_Entry_Value_Type_UnsignedInt:
-					if ( dev->as.typeUnsignedInt != Dictionary_Entry_Value_AsUnsignedInt( self ) )
-						retValue = False;
-					break;
-				case Dictionary_Entry_Value_Type_Int:
-					if ( dev->as.typeInt != Dictionary_Entry_Value_AsInt( self ) )
-						retValue = False;
-					break;
-				case Dictionary_Entry_Value_Type_UnsignedLong:
-					if ( dev->as.typeUnsignedLong != Dictionary_Entry_Value_AsUnsignedLong( self ) )
-						retValue = False;
-					break;
-				case Dictionary_Entry_Value_Type_Bool:
-					if ( dev->as.typeBool != Dictionary_Entry_Value_AsBool( self ) )
-				case Dictionary_Entry_Value_Type_Struct:
-				case Dictionary_Entry_Value_Type_List:
-					retValue = False;
-					break;
-				default:
-					Journal_Firewall( False, errorStream, "In func %s: dev->type '%d' is invalid.\n", __func__, dev->type );
-			}
-			break;
-		}
-		case Dictionary_Entry_Value_Type_Double:
-			if ( self->as.typeDouble != Dictionary_Entry_Value_AsDouble( dev ) )
-				retValue = False;
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			if ( self->as.typeUnsignedInt != Dictionary_Entry_Value_AsUnsignedInt( dev ) )
-				retValue = False;
-			break;
-		case Dictionary_Entry_Value_Type_Int:
-			if ( self->as.typeInt != Dictionary_Entry_Value_AsInt( dev ) )
-				retValue = False;
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			if ( self->as.typeUnsignedLong != Dictionary_Entry_Value_AsUnsignedLong( dev ) )
-				retValue = False;
-			break;
-		case Dictionary_Entry_Value_Type_Bool:
-			if ( self->as.typeBool != Dictionary_Entry_Value_AsBool( dev ) )
-				retValue = False;
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			if ( dev->type != Dictionary_Entry_Value_Type_Struct ) {
-				retValue = False;
-				break;
-			}
-			retValue = Dictionary_CompareAllEntriesFull( self->as.typeStruct, dev->as.typeStruct, strictTypeCheck );
-			break;
-		case Dictionary_Entry_Value_Type_List: {
-			Dictionary_Entry_Value* cur1 = NULL;
-			Dictionary_Entry_Value* cur2 = NULL;
-
-			if ( dev->type != Dictionary_Entry_Value_Type_List ) {
-				retValue = False;
-				break;
-			}
-			if ( self->as.typeList->count != dev->as.typeList->count ) {
-				retValue = False;
-				break;
-			}
-			cur1 = self->as.typeList->first;
-			cur2 = dev->as.typeList->first;
-			while ( cur1 ) {
-				retValue = Dictionary_Entry_Value_CompareFull( cur1, cur2, strictTypeCheck );
-				if ( retValue == False ) break;
-				cur1 = cur1->next;
-				cur2 = cur2->next;
-			}	
-			break;
-		}
-		default:
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-	};
-
-	return retValue;
-}
-
-
-Dictionary_Entry_Value* Dictionary_Entry_Value_Copy(
-		Dictionary_Entry_Value*  self,
-		Bool deep )
-{
-	Dictionary_Entry_Value* copy = NULL;
-	
-	switch (self->type) {
-		case Dictionary_Entry_Value_Type_String:
-			copy = Dictionary_Entry_Value_FromString( self->as.typeString );
-			break;
-		case Dictionary_Entry_Value_Type_Double:
-			copy = Dictionary_Entry_Value_FromDouble( self->as.typeDouble );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			copy = Dictionary_Entry_Value_FromUnsignedInt( self->as.typeUnsignedInt );
-			break;
-		case Dictionary_Entry_Value_Type_Int:
-			copy = Dictionary_Entry_Value_FromInt( self->as.typeInt );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedLong:
-			copy = Dictionary_Entry_Value_FromUnsignedLong( self->as.typeUnsignedLong );
-			break;
-		case Dictionary_Entry_Value_Type_Bool:
-			copy = Dictionary_Entry_Value_FromBool( self->as.typeBool );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			if ( False == deep ) {
-				Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-				Journal_Firewall( False, errorStream, "In func %s: Shallow copy operation of list DEV not supported.\n", __func__ );
-			}
-			else {
-				Dictionary_Entry_Value* cur = self->as.typeList->first;
-				Dictionary_Entry_Value* copiedEntry = NULL;
-
-				copy = Dictionary_Entry_Value_NewList();
-				while ( cur ) {
-					copiedEntry = Dictionary_Entry_Value_Copy( cur, True );
-					Dictionary_Entry_Value_AddElement( copy, copiedEntry );
-					cur = cur->next;
-				}	
-			}
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			if ( False == deep ) {
-				copy = Dictionary_Entry_Value_FromStruct( self->as.typeStruct );
-			}
-			else {
-				Dictionary* copiedDict;
-				copiedDict = (Dictionary*)Stg_Class_Copy( self->as.typeStruct,
-					NULL, True, NULL, NULL );
-				copy = Dictionary_Entry_Value_FromStruct( copiedDict );
-			}
-			break;
-		default: {
-			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
-			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
-		}
-	}
-
-	return copy;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Dictionary_Entry_Value.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Dictionary_Entry_Value.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,1212 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Dictionary_Entry_Value.c 4282 2008-07-14 06:01:20Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "Stream.h" 
+#include "Dictionary.h"
+#include "Dictionary_Entry.h"
+#include "Dictionary_Entry_Value.h"
+#include "PathUtils.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* Private functions */
+static void Dictionary_Entry_Value_SetValueUnsignedInt( Dictionary_Entry_Value* self, unsigned int value );
+static void Dictionary_Entry_Value_SetValueInt( Dictionary_Entry_Value* self, unsigned int value );
+static void Dictionary_Entry_Value_SetValueDouble( Dictionary_Entry_Value* self, double value );
+static void Dictionary_Entry_Value_SetValueUnsignedLong( Dictionary_Entry_Value* self, unsigned long value );
+static void Dictionary_Entry_Value_SetValueString( Dictionary_Entry_Value* self, Name const value );
+static void Dictionary_Entry_Value_SetValueBool( Dictionary_Entry_Value* self, Bool value );
+static void Dictionary_Entry_Value_SetValueNewStruct( Dictionary_Entry_Value* self);
+static void Dictionary_Entry_Value_SetValueStruct( Dictionary_Entry_Value* self, void* value );
+static void Dictionary_Entry_Value_SetValueNewList( Dictionary_Entry_Value* self );
+static void Dictionary_Entry_Value_DeleteContents( Dictionary_Entry_Value* self);
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromUnsignedInt( unsigned int value ) {
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Signed Int" );
+	
+	Dictionary_Entry_Value_InitFromUnsignedInt( self, value );
+	
+	return self;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromInt( int value ) {
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Int" );
+	
+	Dictionary_Entry_Value_InitFromInt( self, value );
+	
+	return self;
+}
+
+void Dictionary_Entry_Value_InitFromUnsignedInt( Dictionary_Entry_Value* self, unsigned int value ) {
+	Dictionary_Entry_Value_SetValueUnsignedInt( self, value );
+	self->next = 0;
+}
+
+void Dictionary_Entry_Value_InitFromInt( Dictionary_Entry_Value* self, int value ) {
+	Dictionary_Entry_Value_SetValueInt( self, value );
+	self->next = 0;
+}
+
+static void Dictionary_Entry_Value_SetValueUnsignedInt( Dictionary_Entry_Value* self, unsigned int value ) {
+	self->as.typeUnsignedInt = value;
+	self->type = Dictionary_Entry_Value_Type_UnsignedInt;
+}
+
+static void Dictionary_Entry_Value_SetValueInt( Dictionary_Entry_Value* self, unsigned int value ) {
+	self->as.typeInt = value;
+	self->type = Dictionary_Entry_Value_Type_Int;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromDouble( double value ) {
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Double" );
+	
+	Dictionary_Entry_Value_InitFromDouble( self, value );
+	
+	return self;
+}
+
+void Dictionary_Entry_Value_InitFromDouble( Dictionary_Entry_Value* self, double value ) {
+	Dictionary_Entry_Value_SetValueDouble( self, value );
+	self->next = 0;
+}
+
+
+static void Dictionary_Entry_Value_SetValueDouble( Dictionary_Entry_Value* self, double value ) {
+	self->as.typeDouble = value;
+	self->type = Dictionary_Entry_Value_Type_Double;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromUnsignedLong( unsigned long value ) {
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Unsigned Long" );
+	
+	Dictionary_Entry_Value_InitFromUnsignedLong( self, value );
+	
+	return self;
+}
+
+void Dictionary_Entry_Value_InitFromUnsignedLong( Dictionary_Entry_Value* self, unsigned long value ) {
+	Dictionary_Entry_Value_SetValueUnsignedLong( self, value );
+	self->next = 0;
+}
+
+static void Dictionary_Entry_Value_SetValueUnsignedLong( Dictionary_Entry_Value* self, unsigned long value ) {
+	self->as.typeUnsignedLong = value;
+	self->type = Dictionary_Entry_Value_Type_UnsignedLong;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromString( Name const value ) {
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value String" );
+	
+	Dictionary_Entry_Value_InitFromString( self, value );
+	
+	return self;
+}
+	
+void Dictionary_Entry_Value_InitFromString( Dictionary_Entry_Value* self, Name const value ) {
+	Dictionary_Entry_Value_SetValueString( self, value );
+	self->next = 0;
+}
+
+static void Dictionary_Entry_Value_SetValueString( Dictionary_Entry_Value* self, Name const value ) {
+	self->as.typeString = StG_Strdup( value );
+	self->type = Dictionary_Entry_Value_Type_String;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromStringTo( char* string, char type ) {
+	Dictionary_Entry_Value* retValue = Memory_Alloc( Dictionary_Entry_Value, "Return Value" );
+	
+	/* need to create the value temporarily so it can be converted if necessary */
+	retValue->type = Dictionary_Entry_Value_Type_String;
+
+	if ( string ) {
+		retValue->as.typeString = ExpandEnvironmentVariables( string );
+	}
+	else {
+		retValue->as.typeString = string;
+	}
+	
+	switch (type) {
+		case Dictionary_Entry_Value_Type_String:
+			Dictionary_Entry_Value_InitFromString( retValue, retValue->as.typeString );
+			break;
+		case Dictionary_Entry_Value_Type_Double:
+			Dictionary_Entry_Value_InitFromDouble( retValue, Dictionary_Entry_Value_AsDouble( retValue ) );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			Dictionary_Entry_Value_InitFromUnsignedInt( retValue, Dictionary_Entry_Value_AsUnsignedInt( retValue ) );
+			break;
+		case Dictionary_Entry_Value_Type_Int:
+			Dictionary_Entry_Value_InitFromInt( retValue, Dictionary_Entry_Value_AsInt( retValue ) );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			Dictionary_Entry_Value_InitFromUnsignedLong( retValue, Dictionary_Entry_Value_AsUnsignedLong( retValue ) );
+			break;
+		case Dictionary_Entry_Value_Type_Bool:
+			Dictionary_Entry_Value_InitFromBool( retValue, Dictionary_Entry_Value_AsBool( retValue ) );
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			Dictionary_Entry_Value_InitNewStruct( retValue );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			Dictionary_Entry_Value_InitNewList( retValue );
+			break;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: type '%d' is invalid.\n", __func__, type );
+		}
+	}		
+	
+	return retValue;
+}
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromBool( Bool value ) {
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Bool" );
+	
+	Dictionary_Entry_Value_InitFromBool( self, value );
+	
+	return self;
+}
+
+void Dictionary_Entry_Value_InitFromBool( Dictionary_Entry_Value* self, Bool value ) {
+	Dictionary_Entry_Value_SetValueBool( self, value );
+	self->next = 0;
+}
+
+static void Dictionary_Entry_Value_SetValueBool( Dictionary_Entry_Value* self, Bool value ) {
+	self->as.typeBool = value;
+	if( self->as.typeBool != False && self->as.typeBool != True ) {
+		self->as.typeBool = True;
+	}
+	self->type = Dictionary_Entry_Value_Type_Bool;
+}
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_NewStruct( void )
+{
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Struct" );
+	
+	Dictionary_Entry_Value_InitNewStruct( self );
+	return self;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_FromStruct( void* dictionary )
+{
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value Struct" );
+	
+	Dictionary_Entry_Value_InitFromStruct( self, dictionary );
+	return self;
+}
+
+void Dictionary_Entry_Value_InitNewStruct( Dictionary_Entry_Value* self )
+{
+	Dictionary_Entry_Value_SetValueNewStruct( self );
+	self->next = 0;
+}
+
+void Dictionary_Entry_Value_InitFromStruct( Dictionary_Entry_Value* self, void* dictionary )
+{
+	Dictionary_Entry_Value_SetValueStruct( self, dictionary );
+	self->next = 0;
+}
+
+static void Dictionary_Entry_Value_SetValueNewStruct( Dictionary_Entry_Value* self ) {
+	Dictionary_Entry_Value_SetValueStruct( self, Dictionary_New() );
+}
+
+static void Dictionary_Entry_Value_SetValueStruct( Dictionary_Entry_Value* self, void* value )
+{
+	self->as.typeStruct = (Dictionary*) value;
+	self->type = Dictionary_Entry_Value_Type_Struct;
+}
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_NewList( void )
+{
+	Dictionary_Entry_Value* self = Memory_Alloc( Dictionary_Entry_Value, "Entry Value List" );
+	
+	Dictionary_Entry_Value_InitNewList( self );
+	return self;
+}
+
+void Dictionary_Entry_Value_InitNewList( Dictionary_Entry_Value* self )
+{
+	Dictionary_Entry_Value_SetValueNewList( self );
+	self->next = 0;
+}
+
+static void Dictionary_Entry_Value_SetValueNewList( Dictionary_Entry_Value* self )
+{
+	self->as.typeList = Memory_Alloc( Dictionary_Entry_Value_List, "Entry Value List" );
+	self->as.typeList->first = NULL;
+	self->as.typeList->last = NULL;
+	self->as.typeList->count = 0;
+	self->as.typeList->encoding = Default;
+	self->type = Dictionary_Entry_Value_Type_List;
+}
+
+
+void Dictionary_Entry_Value_AddMember( Dictionary_Entry_Value* self, Dictionary_Entry_Key name,	Dictionary_Entry_Value* value )
+{
+	self->as.typeStruct->add( self->as.typeStruct, name, value);
+}
+
+void Dictionary_Entry_Value_AddMemberWithSource( Dictionary_Entry_Value* self, Dictionary_Entry_Key name,
+							Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
+{
+	self->as.typeStruct->addWithSource( self->as.typeStruct, name, value, source);
+}
+
+void Dictionary_Entry_Value_AddElement( Dictionary_Entry_Value* self, Dictionary_Entry_Value* element )
+{
+	/* check type - convert to a list if not so... */
+	if (Dictionary_Entry_Value_Type_List != self->type) {
+		Dictionary_Entry_Value* copy = NULL;
+		copy = Dictionary_Entry_Value_Copy( self, True );
+		Dictionary_Entry_Value_SetNewList( self );	
+		Dictionary_Entry_Value_AddElement( self, copy );
+	}
+	
+	if (!self->as.typeList->first) {
+		self->as.typeList->first = element;
+	} else {
+		self->as.typeList->last->next = element;
+	}
+	self->as.typeList->last = element;
+	self->as.typeList->count++;
+}
+
+
+void Dictionary_Entry_Value_AddElementWithSource(
+		Dictionary_Entry_Value* self,
+		Dictionary_Entry_Value* element,
+		Dictionary_Entry_Source source )
+{
+	/* check type - convert to a list if not so... */
+	if (Dictionary_Entry_Value_Type_List != self->type) {
+		Dictionary_Entry_Value* copy = NULL;
+		copy = Dictionary_Entry_Value_Copy( self, True );
+
+		Dictionary_Entry_Value_SetNewList( self );	
+		Dictionary_Entry_Value_AddElementWithSource( self, copy, source );
+	}
+	
+	if (!self->as.typeList->first) {
+		self->as.typeList->first = element;
+	} else {
+		self->as.typeList->last->next = element;
+	}
+	self->as.typeList->last = element;
+	self->as.typeList->count++;
+}
+
+
+void Dictionary_Entry_Value_Delete( Dictionary_Entry_Value* self ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Memory_Free( self );
+}
+
+
+static void Dictionary_Entry_Value_DeleteContents( Dictionary_Entry_Value* self ) {
+	Dictionary_Entry_Value* cur         = NULL;
+	Dictionary_Entry_Value* next        = NULL;
+	Stream*                 errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_String:
+			Journal_Firewall( self->as.typeString != NULL, errorStream, "In func %s: self->as.typeString is NULL.\n", __func__ );
+			Memory_Free( self->as.typeString );
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			Journal_Firewall( self->as.typeStruct != NULL, errorStream, "In func %s: self->as.typeStruct is NULL.\n", __func__ );
+			Stg_Class_Delete( self->as.typeStruct );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			cur = self->as.typeList->first;
+			while ( cur ) {
+				next = cur->next;
+				Dictionary_Entry_Value_Delete( cur );
+				cur = next;
+			}	
+			Memory_Free( self->as.typeList );
+			break;
+		case Dictionary_Entry_Value_Type_Double:
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+		case Dictionary_Entry_Value_Type_Int:
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+		case Dictionary_Entry_Value_Type_Bool:
+			break;
+		default:
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+	};
+}
+
+
+void Dictionary_Entry_Value_Print( Dictionary_Entry_Value* self, Stream* stream ) {
+	Dictionary_Index index;
+	
+	if( !self ) {
+		return;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_String:
+			Journal_Printf( stream, "\"%s\"", self->as.typeString );
+			return;
+		case Dictionary_Entry_Value_Type_Double:
+			Journal_Printf( stream, "%g", self->as.typeDouble );
+			return;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			Journal_Printf( stream, "%u", self->as.typeUnsignedInt );
+			return;
+		case Dictionary_Entry_Value_Type_Int:
+			Journal_Printf( stream, "%d", self->as.typeInt );
+			return;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			Journal_Printf( stream, "%ld", self->as.typeUnsignedLong );
+			return;
+		case Dictionary_Entry_Value_Type_Bool:
+			Journal_Printf( stream, "%s", Dictionary_Entry_Value_AsString( self ) );
+			return;
+		case Dictionary_Entry_Value_Type_List:
+			if (self->as.typeList->first) {
+				Dictionary_Entry_Value* cur = self->as.typeList->first;
+				Dictionary_Entry_Value_Print( cur, stream );
+				cur = cur->next;
+				
+				while (cur) {
+					Journal_Printf( stream, ", " );
+					Dictionary_Entry_Value_Print( cur, stream );
+					cur = cur->next;
+				}
+			}
+			return;
+		case Dictionary_Entry_Value_Type_Struct:
+			Stream_Indent( stream );
+			for( index = 0; index < self->as.typeStruct->count; index++ ) {
+				Journal_Printf( stream, "\n");
+				Journal_Printf( stream, "%s: ", self->as.typeStruct->entryPtr[index]->key );
+				Dictionary_Entry_Value_Print( self->as.typeStruct->entryPtr[index]->value, stream );
+			}
+			Stream_UnIndent( stream );
+			return;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+}
+
+
+void Dictionary_Entry_Value_SetFrom( Dictionary_Entry_Value* self, void* value, const char type) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	
+	switch (type) {
+		case Dictionary_Entry_Value_Type_String:
+			Dictionary_Entry_Value_SetValueString( self, *( (char**) value) );
+			break;
+		case Dictionary_Entry_Value_Type_Double:
+			Dictionary_Entry_Value_SetValueDouble( self, *( (double*) value) );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			Dictionary_Entry_Value_SetValueUnsignedInt( self, *( (unsigned int*) value) );
+			break;
+		case Dictionary_Entry_Value_Type_Int:
+			Dictionary_Entry_Value_SetValueInt( self, *( (unsigned int*) value) );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			Dictionary_Entry_Value_SetValueUnsignedLong( self, *( (unsigned long*) value) );
+			break;
+		case Dictionary_Entry_Value_Type_Bool:
+			Dictionary_Entry_Value_SetValueBool( self, *( (Bool*) value) );
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			Dictionary_Entry_Value_SetValueStruct( self, value );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			Dictionary_Entry_Value_SetValueNewList( self );
+			break;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+}
+
+
+void Dictionary_Entry_Value_SetFromUnsignedInt( Dictionary_Entry_Value* self, unsigned int value ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueUnsignedInt( self, value );
+}
+
+void Dictionary_Entry_Value_SetFromInt( Dictionary_Entry_Value* self, int value ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueInt( self, value );
+}
+
+void Dictionary_Entry_Value_SetFromDouble( Dictionary_Entry_Value* self, double value ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueDouble( self, value );
+}
+
+void Dictionary_Entry_Value_SetFromUnsignedLong( Dictionary_Entry_Value* self, unsigned long value ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueUnsignedLong( self, value );
+}
+
+void Dictionary_Entry_Value_SetFromString( Dictionary_Entry_Value* self, char* value ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueString( self, value );
+}
+
+
+void Dictionary_Entry_Value_SetFromStringKeepCurrentType( Dictionary_Entry_Value* self, char* string ) {
+	Dictionary_Entry_Value_Type currType = self->type;
+	Dictionary_Entry_Value_DeleteContents( self );
+	self->type = Dictionary_Entry_Value_Type_String;
+	self->as.typeString = string;
+	
+	switch (currType) {
+		case Dictionary_Entry_Value_Type_String:
+			Dictionary_Entry_Value_SetValueString( self, string );
+			break;
+		case Dictionary_Entry_Value_Type_Double:
+			Dictionary_Entry_Value_SetValueDouble( self, Dictionary_Entry_Value_AsDouble( self ) );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			Dictionary_Entry_Value_SetValueUnsignedInt( self, Dictionary_Entry_Value_AsUnsignedInt( self ) );
+			break;
+		case Dictionary_Entry_Value_Type_Int:
+			Dictionary_Entry_Value_SetValueInt( self, Dictionary_Entry_Value_AsInt( self ) );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			Dictionary_Entry_Value_SetValueUnsignedLong( self, Dictionary_Entry_Value_AsUnsignedLong( self ) );
+			break;
+		case Dictionary_Entry_Value_Type_Bool:
+			Dictionary_Entry_Value_SetValueBool( self, Dictionary_Entry_Value_AsBool( self ) );
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			Dictionary_Entry_Value_SetValueNewStruct( self );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			Dictionary_Entry_Value_SetValueNewList( self );
+			break;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+}
+
+
+void Dictionary_Entry_Value_SetFromBool( Dictionary_Entry_Value* self, Bool value ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueBool( self, value );
+}
+
+
+void Dictionary_Entry_Value_SetNewStruct( Dictionary_Entry_Value* self )
+{
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueNewStruct( self );
+}
+
+
+void Dictionary_Entry_Value_SetNewList( Dictionary_Entry_Value* self )
+{
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueNewList( self );
+}
+
+void Dictionary_Entry_Value_SetFromStruct( Dictionary_Entry_Value* self, void* dictionary ) {
+	Dictionary_Entry_Value_DeleteContents( self );
+	Dictionary_Entry_Value_SetValueStruct( self, dictionary );
+}
+
+unsigned int Dictionary_Entry_Value_AsUnsignedInt( Dictionary_Entry_Value* self ) {
+	if( !self ) {
+		return 0;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			/* Do nothing (later will print a warning) */
+			return 0;
+		case Dictionary_Entry_Value_Type_List:
+			/* returns the first element as an unsigned int */
+			if (self->as.typeList->first) {
+				return Dictionary_Entry_Value_AsUnsignedInt( self->as.typeList->first );
+			} else {	
+				return 0;
+			}	
+		case Dictionary_Entry_Value_Type_String:
+			return strtoul( self->as.typeString, 0, 0 );
+		case Dictionary_Entry_Value_Type_Double:
+			return (unsigned int)self->as.typeDouble;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			return self->as.typeUnsignedInt;
+		case Dictionary_Entry_Value_Type_Int:
+			return self->as.typeInt;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return self->as.typeUnsignedLong;
+		case Dictionary_Entry_Value_Type_Bool:
+			return (unsigned int)self->as.typeBool;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return 0;
+}
+
+int Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value* self ) {
+	if( !self ) {
+		return 0;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			/* Do nothing (later will print a warning) */
+			return 0;
+		case Dictionary_Entry_Value_Type_List:
+			/* returns the first element as an unsigned int */
+			if (self->as.typeList->first) {
+				return Dictionary_Entry_Value_AsInt( self->as.typeList->first );
+			} else {	
+				return 0;
+			}	
+		case Dictionary_Entry_Value_Type_String:
+			return strtoul( self->as.typeString, 0, 0 );
+		case Dictionary_Entry_Value_Type_Double:
+			return (unsigned int)self->as.typeDouble;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			return self->as.typeUnsignedInt;
+		case Dictionary_Entry_Value_Type_Int:
+			return self->as.typeInt;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return self->as.typeUnsignedLong;
+		case Dictionary_Entry_Value_Type_Bool:
+			return (unsigned int)self->as.typeBool;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return 0;
+}
+
+double Dictionary_Entry_Value_AsDouble( Dictionary_Entry_Value* self ) {
+	if( !self ) {
+		return 0.0f;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			/* Do nothing (later will print a warning) */
+			return 0;
+		case Dictionary_Entry_Value_Type_List:
+			/* returns the first element as an unsigned int */
+			if (self->as.typeList->first) {
+				return Dictionary_Entry_Value_AsDouble( self->as.typeList->first );
+			} else {	
+				return 0;
+			}	
+		case Dictionary_Entry_Value_Type_String:
+			return strtod( self->as.typeString, 0 );
+		case Dictionary_Entry_Value_Type_Double:
+			return self->as.typeDouble;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			return (double)self->as.typeUnsignedInt;
+		case Dictionary_Entry_Value_Type_Int:
+			return self->as.typeInt;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return self->as.typeUnsignedLong;
+		case Dictionary_Entry_Value_Type_Bool:
+			return (double)self->as.typeBool;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	
+	return 0.0f;
+}
+
+unsigned long Dictionary_Entry_Value_AsUnsignedLong( Dictionary_Entry_Value* self ) {
+	if( !self ) {
+		return 0.0;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			/* Do nothing (later will print a warning) */
+			return 0;
+		case Dictionary_Entry_Value_Type_List:
+			/* returns the first element as an unsigned long */
+			if (self->as.typeList->first) {
+				return Dictionary_Entry_Value_AsUnsignedLong( self->as.typeList->first );
+			} else {	
+				return 0;
+			}	
+		case Dictionary_Entry_Value_Type_String:
+			return strtod( self->as.typeString, 0 );
+		case Dictionary_Entry_Value_Type_Double:
+			return self->as.typeDouble;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			return (double)self->as.typeUnsignedInt;
+		case Dictionary_Entry_Value_Type_Int:
+			return self->as.typeInt;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return self->as.typeUnsignedLong;
+		case Dictionary_Entry_Value_Type_Bool:
+			return (double)self->as.typeBool;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	
+	return 0.0;
+}
+
+char* Dictionary_Entry_Value_AsString( Dictionary_Entry_Value* self ) {
+	static char buf[256];
+	
+	if( !self ) {
+		strcpy( buf, "" );
+		return buf;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			strcpy( buf, "" );
+			return buf;
+		case Dictionary_Entry_Value_Type_List:
+			/* returns the first element as a string */
+			if (self->as.typeList->first) {
+				return Dictionary_Entry_Value_AsString( self->as.typeList->first );
+			} else {	
+				return 0;
+			}	
+		case Dictionary_Entry_Value_Type_String:
+			return self->as.typeString;
+		case Dictionary_Entry_Value_Type_Double:
+			sprintf( buf, "%g", self->as.typeDouble );
+			return buf;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			sprintf( buf, "%u", self->as.typeUnsignedInt );
+			return buf;
+		case Dictionary_Entry_Value_Type_Int:
+			sprintf( buf, "%d", self->as.typeInt );
+			return buf;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			sprintf( buf, "%ld", self->as.typeUnsignedLong );
+			return buf;
+		case Dictionary_Entry_Value_Type_Bool:
+			if (True == self->as.typeBool) {
+				 sprintf( buf, "true" );
+			}	 
+			else if (False == self->as.typeBool) {
+				 sprintf( buf, "false" );
+			}	 
+			return buf;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return buf;
+}
+
+
+Bool Dictionary_Entry_Value_AsBool( Dictionary_Entry_Value* self ) {
+	if( !self ) {
+          return False;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			/* Do nothing (later will print a warning) */
+			return False;
+		case Dictionary_Entry_Value_Type_List:
+			/* returns the first element as an unsigned int */
+			if (self->as.typeList->first) {
+				return Dictionary_Entry_Value_AsBool( self->as.typeList->first );
+			} else {	
+				return False;
+			}	
+		case Dictionary_Entry_Value_Type_String:
+			if( !strcmp( "1", self->as.typeString ) ) {
+				return True;
+			}
+			else if( !strcmp( "0", self->as.typeString ) ) {
+				return False;
+			}
+			else if( !strcasecmp( "true", self->as.typeString ) ) {
+				return True;
+			}
+			else if( !strcasecmp( "false", self->as.typeString ) ) {
+				return False;
+			}
+			else if( !strcasecmp( "t", self->as.typeString ) ) {
+				return True;
+			}
+			else if( !strcasecmp( "f", self->as.typeString ) ) {
+				return False;
+			}
+			else if( !strcasecmp( "yes", self->as.typeString ) ) {
+				return True;
+			}
+			else if( !strcasecmp( "no", self->as.typeString ) ) {
+				return False;
+			}
+			else if( !strcasecmp( "y", self->as.typeString ) ) {
+				return True;
+			}
+			else if( !strcasecmp( "n", self->as.typeString ) ) {
+				return False;
+			}
+			else if( !strcasecmp( "on", self->as.typeString ) ) {
+				return True;
+			}
+			else if( !strcasecmp( "off", self->as.typeString ) ) {
+				return False;
+			}
+			else {
+				Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+				Journal_Firewall( False, errorStream, "In func %s: Cannot convert string '%s' to Bool.\n", __func__, self->as.typeString );
+			}
+		case Dictionary_Entry_Value_Type_Double:
+			if( (Bool)self->as.typeDouble ) {
+				return True;
+			}
+			else {
+				return False;
+			}
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			if( (Bool)self->as.typeUnsignedInt ) {
+				return True;
+			}
+			else {
+				return False;
+			}
+		case Dictionary_Entry_Value_Type_Int:
+			if( (Bool)self->as.typeInt ) {
+				return True;
+			}
+			else {
+				return False;
+			}
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			if( (Bool)self->as.typeUnsignedLong ) {
+				return True;
+			}
+			else {
+				return False;
+			}
+		case Dictionary_Entry_Value_Type_Bool:
+			return self->as.typeBool;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return False;
+}
+
+
+Bool Dictionary_Entry_Value_AsBool_with_Default( Dictionary_Entry_Value* self, Bool Default ) {
+  if(self==NULL)
+    return Default;
+  else
+    return Dictionary_Entry_Value_AsBool(self);
+}
+
+
+Dictionary* Dictionary_Entry_Value_AsDictionary( Dictionary_Entry_Value* self ) {
+	if( !self ) {
+		return 0;
+	}
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			return self->as.typeStruct;
+		case Dictionary_Entry_Value_Type_List:
+			return 0;
+		case Dictionary_Entry_Value_Type_String:
+			return 0;
+		case Dictionary_Entry_Value_Type_Double:
+			return 0;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			return 0;
+		case Dictionary_Entry_Value_Type_Int:
+			return 0;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return 0;
+		case Dictionary_Entry_Value_Type_Bool:
+			return 0;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return 0;
+}
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_GetFirstElement( Dictionary_Entry_Value* self )
+{
+	return Dictionary_Entry_Value_GetElement( self, 0 );
+}
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_GetElement( Dictionary_Entry_Value* self, Index index )
+{
+	Index currIndex = 0;
+	Dictionary_Entry_Value* currElement = NULL;
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_List:
+			if ( index > self->as.typeList->count ) {
+				return NULL;
+			}
+			
+			currElement = self->as.typeList->first;
+			while ( currIndex++ < index ) {
+				currElement = currElement->next;
+			}	
+			
+			return currElement;
+		case Dictionary_Entry_Value_Type_Struct:
+		case Dictionary_Entry_Value_Type_String:
+		case Dictionary_Entry_Value_Type_Bool:
+		case Dictionary_Entry_Value_Type_Double:
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+		case Dictionary_Entry_Value_Type_Int:
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return self;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return self;
+}
+
+
+Index Dictionary_Entry_Value_GetCount( Dictionary_Entry_Value* self )
+{
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_List:
+			return self->as.typeList->count;
+		case Dictionary_Entry_Value_Type_Struct:
+			return self->as.typeStruct->count;
+		case Dictionary_Entry_Value_Type_String:
+		case Dictionary_Entry_Value_Type_Bool:
+		case Dictionary_Entry_Value_Type_Double:
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+		case Dictionary_Entry_Value_Type_Int:
+			return 1;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return 1;
+}
+
+
+void Dictionary_Entry_Value_SetEncoding( Dictionary_Entry_Value* self, const Encoding encoding ) {
+	if ( Dictionary_Entry_Value_Type_List == self->type ) {
+		self->as.typeList->encoding = encoding;
+	}	
+}
+
+
+Encoding Dictionary_Entry_Value_GetEncoding( Dictionary_Entry_Value* self ) {
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_List:
+			return self->as.typeList->encoding;
+		case Dictionary_Entry_Value_Type_Struct:
+		case Dictionary_Entry_Value_Type_String:
+		case Dictionary_Entry_Value_Type_Bool:
+		case Dictionary_Entry_Value_Type_Double:
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+		case Dictionary_Entry_Value_Type_Int:
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			return Default;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+	return Default;
+}
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value* self, Dictionary_Entry_Key name) {
+	Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+
+	Journal_Firewall( self->as.typeStruct != NULL, 
+			errorStream, "In func %s: self->as.typeStruct is NULL.\n", __func__, self->as.typeStruct );
+	if ( Dictionary_Entry_Value_Type_Struct != self->type ) {
+		return NULL;
+	}
+	
+	return self->as.typeStruct->get( self->as.typeStruct, name );
+}
+
+
+void Dictionary_Entry_Value_SetMember( Dictionary_Entry_Value* self,
+	Dictionary_Entry_Key name, Dictionary_Entry_Value* member ) {
+	Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			self->as.typeStruct->set( self->as.typeStruct, name, member );
+			return;
+		case Dictionary_Entry_Value_Type_List:
+		case Dictionary_Entry_Value_Type_String:
+		case Dictionary_Entry_Value_Type_Bool:
+		case Dictionary_Entry_Value_Type_Double:
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+		case Dictionary_Entry_Value_Type_Int:
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			/* should print a warning once journal set up */
+			Journal_Printf( errorStream, "Func %s does not support Dictionary_Entry_Values of type '%d'.\n", __func__, self->type );
+			return;
+		default:
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+	};
+}
+
+
+void Dictionary_Entry_Value_SetMemberWithSource( Dictionary_Entry_Value* self,
+	Dictionary_Entry_Key name, Dictionary_Entry_Value* member, Dictionary_Entry_Source source ) {
+	Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+	
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			self->as.typeStruct->setWithSource( self->as.typeStruct, name, member, source );
+			return;
+		case Dictionary_Entry_Value_Type_List:
+		case Dictionary_Entry_Value_Type_String:
+		case Dictionary_Entry_Value_Type_Bool:
+		case Dictionary_Entry_Value_Type_Double:
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+		case Dictionary_Entry_Value_Type_Int:
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			/* should print a warning once journal set up */
+			Journal_Printf( errorStream, "Func %s does not support Dictionary_Entry_Values of type '%d'.\n", __func__, self->type );
+			return;
+		default:
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+	};
+}
+
+
+Bool Dictionary_Entry_Value_CompareFull( Dictionary_Entry_Value* self, Dictionary_Entry_Value* dev, Bool strictTypeCheck ) {
+	Bool         retValue = True; 
+	Stream*      errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+
+	if ( strictTypeCheck ) {
+		if ( self->type != dev->type ) {
+			return False;
+		}
+	}
+
+	switch( self->type ) {
+		case Dictionary_Entry_Value_Type_String: {
+			/* Comparing as strings is tricky. When both are strings it's fine. If the dev to compare to is stored
+			 * natively as a number, we should convert the first to a number also for comparison. Otherwise, you
+			 * can get false Negatives when the entries are numerically the same, but use different notation
+			 * (e.g. scientific vs decimal) */ 	
+			switch( dev->type ) {
+				case Dictionary_Entry_Value_Type_String:
+					if ( 0 != strcmp( self->as.typeString, dev->as.typeString ) ) 
+						retValue = False;
+					break;
+				case Dictionary_Entry_Value_Type_Double:
+					if ( dev->as.typeDouble != Dictionary_Entry_Value_AsDouble( self ) )
+						retValue = False;
+					break;
+				case Dictionary_Entry_Value_Type_UnsignedInt:
+					if ( dev->as.typeUnsignedInt != Dictionary_Entry_Value_AsUnsignedInt( self ) )
+						retValue = False;
+					break;
+				case Dictionary_Entry_Value_Type_Int:
+					if ( dev->as.typeInt != Dictionary_Entry_Value_AsInt( self ) )
+						retValue = False;
+					break;
+				case Dictionary_Entry_Value_Type_UnsignedLong:
+					if ( dev->as.typeUnsignedLong != Dictionary_Entry_Value_AsUnsignedLong( self ) )
+						retValue = False;
+					break;
+				case Dictionary_Entry_Value_Type_Bool:
+					if ( dev->as.typeBool != Dictionary_Entry_Value_AsBool( self ) )
+				case Dictionary_Entry_Value_Type_Struct:
+				case Dictionary_Entry_Value_Type_List:
+					retValue = False;
+					break;
+				default:
+					Journal_Firewall( False, errorStream, "In func %s: dev->type '%d' is invalid.\n", __func__, dev->type );
+			}
+			break;
+		}
+		case Dictionary_Entry_Value_Type_Double:
+			if ( self->as.typeDouble != Dictionary_Entry_Value_AsDouble( dev ) )
+				retValue = False;
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			if ( self->as.typeUnsignedInt != Dictionary_Entry_Value_AsUnsignedInt( dev ) )
+				retValue = False;
+			break;
+		case Dictionary_Entry_Value_Type_Int:
+			if ( self->as.typeInt != Dictionary_Entry_Value_AsInt( dev ) )
+				retValue = False;
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			if ( self->as.typeUnsignedLong != Dictionary_Entry_Value_AsUnsignedLong( dev ) )
+				retValue = False;
+			break;
+		case Dictionary_Entry_Value_Type_Bool:
+			if ( self->as.typeBool != Dictionary_Entry_Value_AsBool( dev ) )
+				retValue = False;
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			if ( dev->type != Dictionary_Entry_Value_Type_Struct ) {
+				retValue = False;
+				break;
+			}
+			retValue = Dictionary_CompareAllEntriesFull( self->as.typeStruct, dev->as.typeStruct, strictTypeCheck );
+			break;
+		case Dictionary_Entry_Value_Type_List: {
+			Dictionary_Entry_Value* cur1 = NULL;
+			Dictionary_Entry_Value* cur2 = NULL;
+
+			if ( dev->type != Dictionary_Entry_Value_Type_List ) {
+				retValue = False;
+				break;
+			}
+			if ( self->as.typeList->count != dev->as.typeList->count ) {
+				retValue = False;
+				break;
+			}
+			cur1 = self->as.typeList->first;
+			cur2 = dev->as.typeList->first;
+			while ( cur1 ) {
+				retValue = Dictionary_Entry_Value_CompareFull( cur1, cur2, strictTypeCheck );
+				if ( retValue == False ) break;
+				cur1 = cur1->next;
+				cur2 = cur2->next;
+			}	
+			break;
+		}
+		default:
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+	};
+
+	return retValue;
+}
+
+
+Dictionary_Entry_Value* Dictionary_Entry_Value_Copy(
+		Dictionary_Entry_Value*  self,
+		Bool deep )
+{
+	Dictionary_Entry_Value* copy = NULL;
+	
+	switch (self->type) {
+		case Dictionary_Entry_Value_Type_String:
+			copy = Dictionary_Entry_Value_FromString( self->as.typeString );
+			break;
+		case Dictionary_Entry_Value_Type_Double:
+			copy = Dictionary_Entry_Value_FromDouble( self->as.typeDouble );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			copy = Dictionary_Entry_Value_FromUnsignedInt( self->as.typeUnsignedInt );
+			break;
+		case Dictionary_Entry_Value_Type_Int:
+			copy = Dictionary_Entry_Value_FromInt( self->as.typeInt );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedLong:
+			copy = Dictionary_Entry_Value_FromUnsignedLong( self->as.typeUnsignedLong );
+			break;
+		case Dictionary_Entry_Value_Type_Bool:
+			copy = Dictionary_Entry_Value_FromBool( self->as.typeBool );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			if ( False == deep ) {
+				Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+				Journal_Firewall( False, errorStream, "In func %s: Shallow copy operation of list DEV not supported.\n", __func__ );
+			}
+			else {
+				Dictionary_Entry_Value* cur = self->as.typeList->first;
+				Dictionary_Entry_Value* copiedEntry = NULL;
+
+				copy = Dictionary_Entry_Value_NewList();
+				while ( cur ) {
+					copiedEntry = Dictionary_Entry_Value_Copy( cur, True );
+					Dictionary_Entry_Value_AddElement( copy, copiedEntry );
+					cur = cur->next;
+				}	
+			}
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			if ( False == deep ) {
+				copy = Dictionary_Entry_Value_FromStruct( self->as.typeStruct );
+			}
+			else {
+				Dictionary* copiedDict;
+				copiedDict = (Dictionary*)Stg_Class_Copy( self->as.typeStruct,
+					NULL, True, NULL, NULL );
+				copy = Dictionary_Entry_Value_FromStruct( copiedDict );
+			}
+			break;
+		default: {
+			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
+			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
+		}
+	}
+
+	return copy;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Finalise.c
--- a/Base/IO/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 3594 2006-05-18 06:34:43Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include "StreamFormatter.h"
-#include "Finalise.h"
-
-
-#include <stdio.h>
-
-Bool BaseIO_Finalise( void )
-{
-	Stream* stream;
-	if ( stJournal->flushCount > 0 ) {
-		stream = Journal_Register( Debug_Type, (char*)__func__ );
-		Journal_Printf( stream, "StGermain IO Report - File Flush called %d times.\n", stJournal->flushCount );
-	}
-	Journal_Delete();
-	/* Now clean up the special memory streams seeing as these aren't in the journal */
-	Stg_Class_Delete( stgMemory->infoStream );
-	Stg_Class_Delete( stgMemory->debugStream );
-	Stg_Class_Delete( stgMemory->errorStream );
-	StreamFormatter_Buffer_Delete( stgStreamFormatter_Buffer );
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,59 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 3594 2006-05-18 06:34:43Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include "StreamFormatter.h"
+#include "Finalise.h"
+
+
+#include <stdio.h>
+
+Bool BaseIO_Finalise( void )
+{
+	Stream* stream;
+	if ( stJournal->flushCount > 0 ) {
+		stream = Journal_Register( Debug_Type, (char*)__func__ );
+		Journal_Printf( stream, "StGermain IO Report - File Flush called %d times.\n", stJournal->flushCount );
+	}
+	Journal_Delete();
+	/* Now clean up the special memory streams seeing as these aren't in the journal */
+	Stg_Class_Delete( stgMemory->infoStream );
+	Stg_Class_Delete( stgMemory->debugStream );
+	Stg_Class_Delete( stgMemory->errorStream );
+	StreamFormatter_Buffer_Delete( stgStreamFormatter_Buffer );
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/IO_Handler.c
--- a/Base/IO/src/IO_Handler.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**face Factory
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IO_Handler.c 4260 2008-05-02 04:20:37Z LeonSutedja $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Dictionary.h"
-#include "Dictionary_Entry.h"
-#include "Dictionary_Entry_Value.h"
-#include "IO_Handler.h"
-
-#include "Journal.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-/** Textual name of this class */
-const Type IO_Handler_Type = Type_Invalid;
-
-/* Setting the default merge types centrally here */
-const Dictionary_MergeType IO_Handler_DefaultMergeType = Dictionary_MergeType_Replace;
-const Dictionary_MergeType IO_Handler_DefaultChildrenMergeType = Dictionary_MergeType_Append;
-
-/* TODO: register with IO_Handler registry */
-
-IO_Handler* _IO_Handler_New(  IO_HANDLER_DEFARGS  )
-{
-	IO_Handler* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(IO_Handler) );
-	self = (IO_Handler*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual functions */
-	self->_readAllFromFile = _readAllFromFile;
-	self->_readAllFromFileForceSource = _readAllFromFileForceSource;
-	self->_readAllFromBuffer = _readAllFromBuffer;
-	self->_writeAllToFile = _writeAllToFile;
-	
-	/* IO_Handler info */
-	_IO_Handler_Init( self );
-	
-	return self;
-}
-
-void _IO_Handler_Init( IO_Handler* self ) {
-	/* General and Virtual info should already be set */
-
-	/* IO_Handler info */
-	self->currDictionary = NULL;
-	self->resource = NULL;
-	self->currPath = NULL;
-	self->schema = NULL;
-	self->validate = 0;
-}
-
-
-/** delete the object's memory at this level */
-void _IO_Handler_Delete( void* io_handler ) {
-	IO_Handler* self = (IO_Handler*)io_handler;
-	
-	if( self->currPath ) Memory_Free( self->currPath );
-	if( self->resource ) Memory_Free( self->resource );
-
-	/* Stg_Class_Delete parent class */
-	_Stg_Class_Delete( self );
-}
-
-
-/** print this level's info */
-void _IO_Handler_Print( void* io_handler, Stream* stream ) {
-	IO_Handler* self = (IO_Handler*) io_handler;
-	
-	/* General info */
-	printf( "IO_Handler (ptr): %p\n", (void*)self );
-	
-	/* Print parent class */
-	_Stg_Class_Print( self, stream );
-	
-	/* Virtual info */
-	printf( "\t_readAllFromFile (func ptr): %p\n", (void*)self->_readAllFromFile );
-	printf( "\t_readAllFromFileForceSource (func ptr): %p\n", (void*)self->_readAllFromFileForceSource );
-	printf( "\t_writeAllToFile (func ptr): %p\n", (void*)self->_writeAllToFile );
-	
-	/* IO_Handler */
-	printf( "\tcurrDictionary (ptr): %p\n", (void*)self->currDictionary );
-	if( self->resource ) {
-		printf( "\tresource: %s\n", self->resource );
-	}
-	else {
-		printf( "\tresource: (null)\n" );
-	}
-}
-
-
-/** Read a dictionary entry of a given name from file */
-Bool IO_Handler_ReadAllFromFile( void* io_handler, Name filename, Dictionary* dictionary )
-{
-	IO_Handler* self = (IO_Handler*) io_handler;
-	Index chr_I;
-	
-	for( chr_I = strlen(filename); chr_I > 0; chr_I--)
-		if( filename[chr_I - 1] == '/' )
-		{
-			self->currPath = Memory_Alloc_Array( char, (chr_I + 1), "IO_Handler->currPath" );
-			strncpy(self->currPath, filename, chr_I);
-			self->currPath[chr_I] = 0;
-			break;
-		}
-		
-	if( chr_I == 0 )
-	{
-		self->currPath = Memory_Alloc_Array( char, 3, "IO_Handler->currPath" );
-		strcpy(self->currPath, "./");
-		self->currPath[2] = 0;
-	}
-	
-	return self->_readAllFromFile( self, filename, dictionary );
-}
-
-/** Read a dictionary entry of a given name from file, include source files in dictionary_Entries. */
-Bool IO_Handler_ReadAllFromFileForceSource( void* io_handler, Name filename, Dictionary* dictionary )
-{
-	IO_Handler* self = (IO_Handler*) io_handler;
-	Index chr_I;
-	
-	for( chr_I = strlen(filename); chr_I > 0; chr_I--)
-		if( filename[chr_I - 1] == '/' )
-		{
-			self->currPath = Memory_Alloc_Array( char, (chr_I + 1), "IO_Handler->currPath" );
-			strncpy(self->currPath, filename, chr_I);
-			self->currPath[chr_I] = 0;
-			break;
-		}
-		
-	if( chr_I == 0 )
-	{
-		self->currPath = Memory_Alloc_Array( char, 3, "IO_Handler->currPath" );
-		strcpy(self->currPath, "./");
-		self->currPath[2] = 0;
-	}
-	
-	return self->_readAllFromFileForceSource( self, filename, dictionary );
-}
-
-/** Read a dictionary entry of a given name from file */
-Bool IO_Handler_ReadAllFromBuffer( void* io_handler, Name buffer, Dictionary* dictionary )
-{
-	IO_Handler* self = (IO_Handler*) io_handler;
-
-	return self->_readAllFromBuffer( self, buffer, dictionary );
-}
-
-/** write a given dictionary entry to file */
-Bool IO_Handler_WriteAllToFile(void* io_handler, Name filename, Dictionary* dictionary )
-{
-	IO_Handler* self = (IO_Handler*) io_handler;
-	return self->_writeAllToFile( self, filename, dictionary );
-}
-
-
-/** Add a new dictionary value depending on the parent type, or replace the existing value if found.
- *	if parent is NULL, add as a plain entry. If parent is a list, add as an element to that
- *	list. If parent is a struct, add as a member of that struct. */
-Dictionary_Entry_Value* IO_Handler_DictSetAddValue( 
-	void*							io_handler, 
-	Dictionary_Entry_Key					name,
-	char*							newValue, 
-	char							newDictValType,
-	Dictionary_Entry_Value*					parent, 
-	Dictionary_MergeType					mergeType )
-{
-	IO_Handler* self = (IO_Handler*) io_handler;
-	Dictionary_Entry_Value* newDictVal = NULL;
-	#if DEBUG
-		assert( self );
-	#endif
-	
-	/* If parent == NULL... then this is being added to no list or struct, but the dictionary itself */
-	if ( NULL == parent ) {
-		if ( NULL == name ) {
-			fprintf( stdout, "Warning- while parsing file %s: entry that isn't a list element "
-				"given with no name. Not adding this parameter to the dictionary.\n",
-				self->resource );
-			return NULL;
-		}
-		
-		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
-		newDictVal = Dictionary_AddMerge( 
-				self->currDictionary, 
-				name, 
-				newDictVal,
-				mergeType );
-	}
-	else if( parent->type == Dictionary_Entry_Value_Type_List ) {
-		if ( NULL != name ) {
-			fprintf( stdout, "Warning - while parsing file %s: entry inside a list given with a name. Adding the "
-				"entry to the list, but ignoring the name.\n", self->resource );
-		}	
-		
-		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
-		Dictionary_Entry_Value_AddElement( parent, newDictVal );
-	}
-	else if	( parent->type == Dictionary_Entry_Value_Type_Struct ) {
-	/*	Dictionary_Entry_Value* member = NULL;		*/
-		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
-		
-		if ( NULL == name ) {
-			fprintf( stdout, "Warning - while parsing file %s: entry that isn't a list element given with no name. "
-				"Not adding it to the dictionary.\n", self->resource );
-			return NULL;
-		}
-		
-		newDictVal = Dictionary_AddMerge( 
-				parent->as.typeStruct, 
-				name, 
-				newDictVal,
-				mergeType );
-	
-	/*
-	**      This code overrides the merge code, disabling...
-	**
-		if ( (member = Dictionary_Entry_Value_GetMember( parent, name ) ) )
-		{
-			Dictionary_Entry_Value_SetMember( parent, name, newDictVal );
-		}
-		else {
-			Dictionary_Entry_Value_AddMember( parent, name, newDictVal );
-		}
-	*/
-	}
-	else {
-		fprintf( stdout, "Warning - while parsing file %s: IO_Handler_SetAdd passed a parent not of list "
-			"or struct type. Ignoring.\n", self->resource );
-	}
-	
-	return newDictVal;
-} /* IO_Handler_SetAdd */
-
-/** Add a new dictionary value depending on the parent type, or replace the existing value if found.
- *	if parent is NULL, add as a plain entry. If parent is a list, add as an element to that
- *	list. If parent is a struct, add as a member of that struct. */
-Dictionary_Entry_Value* IO_Handler_DictSetAddValueWithSource( 
-	void*							io_handler, 
-	Dictionary_Entry_Key					name,
-	char*							newValue, 
-	char							newDictValType,
-	Dictionary_Entry_Value*					parent, 
-	Dictionary_MergeType					mergeType,
-	Dictionary_Entry_Source					source )
-{
-	IO_Handler* self = (IO_Handler*) io_handler;
-	Dictionary_Entry_Value* newDictVal = NULL;
-	#if DEBUG
-		assert( self );
-	#endif
-	
-	/* If parent == NULL... then this is being added to no list or struct, but the dictionary itself */
-	if ( NULL == parent ) {
-		if ( NULL == name ) {
-			fprintf( stdout, "Warning- while parsing file %s: entry that isn't a list element "
-				"given with no name. Not adding this parameter to the dictionary.\n",
-				self->resource );
-			return NULL;
-		}
-		
-		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
-		newDictVal = Dictionary_AddMergeWithSource( 
-				self->currDictionary, 
-				name, 
-				newDictVal,
-				mergeType,
-				source );
-	}
-	else if( parent->type == Dictionary_Entry_Value_Type_List ) {
-		if ( NULL != name ) {
-			fprintf( stdout, "Warning - while parsing file %s: entry inside a list given with a name. Adding the "
-				"entry to the list, but ignoring the name.\n", self->resource );
-		}	
-		
-		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
-		Dictionary_Entry_Value_AddElementWithSource( parent, newDictVal, source );
-	}
-	else if	( parent->type == Dictionary_Entry_Value_Type_Struct ) {
-	/*	Dictionary_Entry_Value* member = NULL;		*/
-		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
-		
-		if ( NULL == name ) {
-			fprintf( stdout, "Warning - while parsing file %s: entry that isn't a list element given with no name. "
-				"Not adding it to the dictionary.\n", self->resource );
-			return NULL;
-		}
-		
-		newDictVal = Dictionary_AddMergeWithSource( 
-				parent->as.typeStruct, 
-				name, 
-				newDictVal,
-				mergeType,
-				source );
-	
-	/*
-	**      This code overrides the merge code, disabling...
-	**
-		if ( (member = Dictionary_Entry_Value_GetMember( parent, name ) ) )
-		{
-			Dictionary_Entry_Value_SetMember( parent, name, newDictVal );
-		}
-		else {
-			Dictionary_Entry_Value_AddMember( parent, name, newDictVal );
-		}
-	*/
-	}
-	else {
-		fprintf( stdout, "Warning - while parsing file %s: IO_Handler_SetAdd passed a parent not of list "
-			"or struct type. Ignoring.\n", self->resource );
-	}
-	
-	return newDictVal;
-} /* IO_Handler_SetAddWithSource */
-
-Index IO_Handler_ReadAllFilesFromCommandLine( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
-	IO_Handler* self          = (IO_Handler*) ioHandler;
-	Stream*     errorStream   = Journal_Register( Error_Type, CURR_MODULE_NAME );
-	int       arg_I;
-	char*       filename;
-	char*       extension;
-	Bool        result;
-	Index       filesRead = 0;
-
-	/* Loop over all the arguments from command line */
-	for ( arg_I = 1 ; arg_I < argc ; arg_I++ ) {
-		filename = argv[ arg_I ];
-
-		/* Find extension of potential filename by finding the pointer to the last dot in the string */
-		extension = strrchr( filename, '.' );
-
-		/* Check if there was a '.' in the filename at all - if not, then bail */
-		if ( extension == NULL )
-			continue;
-
-		/* Check if file has a ".xml" extension - if not, then bail */
-		if ( strcasecmp( extension, ".xml" ) != 0 )
-			continue;
-	
-		/* Read file */
-		result = IO_Handler_ReadAllFromFile( self, filename, dictionary );
-		Journal_Firewall( result, errorStream, 
-				"Error: %s could not read input file %s. Exiting.\n", argv[0], filename );
-		filesRead++;		
-	}
-
-	return filesRead;
-}
-
-
-Index IO_Handler_ReadAllFilesFromCommandLineForceSource( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
-	IO_Handler* self          = (IO_Handler*) ioHandler;
-	Stream*     errorStream   = Journal_Register( Error_Type, CURR_MODULE_NAME );
-	int       arg_I;
-	char*       filename;
-	char*       extension;
-	Bool        result;
-	Index       filesRead = 0;
-
-	/* Loop over all the arguments from command line */
-	for ( arg_I = 1 ; arg_I < argc ; arg_I++ ) {
-		filename = argv[ arg_I ];
-
-		/* Find extension of potential filename by finding the pointer to the last dot in the string */
-		extension = strrchr( filename, '.' );
-
-		/* Check if there was a '.' in the filename at all - if not, then bail */
-		if ( extension == NULL )
-			continue;
-
-		/* Check if file has a ".xml" extension - if not, then bail */
-		if ( strcasecmp( extension, ".xml" ) != 0 )
-			continue;
-	
-		/* Read file */
-		result = IO_Handler_ReadAllFromFileForceSource( self, filename, dictionary );
-		Journal_Firewall( result, errorStream, 
-				"Error: %s could not read input file %s. Exiting.\n", argv[0], filename );
-		filesRead++;		
-	}
-
-	return filesRead;
-}
-
-void _get_XML(void* ioHandler, char* argv[], int argc) {
-	IO_Handler* self          = (IO_Handler*) ioHandler;
-	int arg_I;
-	int schema=0;
-	char* name;
-	char* option;
-	
-	for ( arg_I = 1 ; arg_I < argc; arg_I++) {
-		name = argv[ arg_I ];
-		option = strrchr( name, '-' );
-		if ( schema == 1 ) { 
-			if ( self->schema==NULL ) {
-                          self->schema=(char*)malloc( strlen( argv[arg_I] ) +1 );
-                          strcpy( self->schema, argv[ arg_I ] );
-                          schema=0;
-			}
-		}
-		if ( option != NULL ) {
-			if ( strcasecmp( option, "-schema" ) == 0 )
-				schema = 1;
-			if ( strcasecmp( option, "-dontXMLValidate" ) == 0 )
-				(self->validate) = 0;
-			if ( strcasecmp( option, "-XMLValidate" ) == 0 )
-				(self->validate) = 1;
-		}
-	}
-}
-
-
-Index IO_Handler_ReadAllFromCommandLine( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
-	Index filesRead = 0;
-
-	_get_XML( ioHandler, argv, argc );
-	filesRead = IO_Handler_ReadAllFilesFromCommandLine( ioHandler, argc, argv, dictionary );
-	Dictionary_ReadAllParamFromCommandLine( dictionary, argc, argv );
-
-	return filesRead;
-}
-
-
-Index IO_Handler_ReadAllFromCommandLineForceSource( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
-	Index filesRead = 0;
-
-	filesRead = IO_Handler_ReadAllFilesFromCommandLineForceSource( ioHandler, argc, argv, dictionary );
-	Dictionary_ReadAllParamFromCommandLine( dictionary, argc, argv );
-
-	return filesRead;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/IO_Handler.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/IO_Handler.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,471 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**face Factory
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IO_Handler.c 4260 2008-05-02 04:20:37Z LeonSutedja $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Dictionary.h"
+#include "Dictionary_Entry.h"
+#include "Dictionary_Entry_Value.h"
+#include "IO_Handler.h"
+
+#include "Journal.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/** Textual name of this class */
+const Type IO_Handler_Type = Type_Invalid;
+
+/* Setting the default merge types centrally here */
+const Dictionary_MergeType IO_Handler_DefaultMergeType = Dictionary_MergeType_Replace;
+const Dictionary_MergeType IO_Handler_DefaultChildrenMergeType = Dictionary_MergeType_Append;
+
+/* TODO: register with IO_Handler registry */
+
+IO_Handler* _IO_Handler_New(  IO_HANDLER_DEFARGS  )
+{
+	IO_Handler* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(IO_Handler) );
+	self = (IO_Handler*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual functions */
+	self->_readAllFromFile = _readAllFromFile;
+	self->_readAllFromFileForceSource = _readAllFromFileForceSource;
+	self->_readAllFromBuffer = _readAllFromBuffer;
+	self->_writeAllToFile = _writeAllToFile;
+	
+	/* IO_Handler info */
+	_IO_Handler_Init( self );
+	
+	return self;
+}
+
+void _IO_Handler_Init( IO_Handler* self ) {
+	/* General and Virtual info should already be set */
+
+	/* IO_Handler info */
+	self->currDictionary = NULL;
+	self->resource = NULL;
+	self->currPath = NULL;
+	self->schema = NULL;
+	self->validate = 0;
+}
+
+
+/** delete the object's memory at this level */
+void _IO_Handler_Delete( void* io_handler ) {
+	IO_Handler* self = (IO_Handler*)io_handler;
+	
+	if( self->currPath ) Memory_Free( self->currPath );
+	if( self->resource ) Memory_Free( self->resource );
+
+	/* Stg_Class_Delete parent class */
+	_Stg_Class_Delete( self );
+}
+
+
+/** print this level's info */
+void _IO_Handler_Print( void* io_handler, Stream* stream ) {
+	IO_Handler* self = (IO_Handler*) io_handler;
+	
+	/* General info */
+	printf( "IO_Handler (ptr): %p\n", (void*)self );
+	
+	/* Print parent class */
+	_Stg_Class_Print( self, stream );
+	
+	/* Virtual info */
+	printf( "\t_readAllFromFile (func ptr): %p\n", (void*)self->_readAllFromFile );
+	printf( "\t_readAllFromFileForceSource (func ptr): %p\n", (void*)self->_readAllFromFileForceSource );
+	printf( "\t_writeAllToFile (func ptr): %p\n", (void*)self->_writeAllToFile );
+	
+	/* IO_Handler */
+	printf( "\tcurrDictionary (ptr): %p\n", (void*)self->currDictionary );
+	if( self->resource ) {
+		printf( "\tresource: %s\n", self->resource );
+	}
+	else {
+		printf( "\tresource: (null)\n" );
+	}
+}
+
+
+/** Read a dictionary entry of a given name from file */
+Bool IO_Handler_ReadAllFromFile( void* io_handler, Name filename, Dictionary* dictionary )
+{
+	IO_Handler* self = (IO_Handler*) io_handler;
+	Index chr_I;
+	
+	for( chr_I = strlen(filename); chr_I > 0; chr_I--)
+		if( filename[chr_I - 1] == '/' )
+		{
+			self->currPath = Memory_Alloc_Array( char, (chr_I + 1), "IO_Handler->currPath" );
+			strncpy(self->currPath, filename, chr_I);
+			self->currPath[chr_I] = 0;
+			break;
+		}
+		
+	if( chr_I == 0 )
+	{
+		self->currPath = Memory_Alloc_Array( char, 3, "IO_Handler->currPath" );
+		strcpy(self->currPath, "./");
+		self->currPath[2] = 0;
+	}
+	
+	return self->_readAllFromFile( self, filename, dictionary );
+}
+
+/** Read a dictionary entry of a given name from file, include source files in dictionary_Entries. */
+Bool IO_Handler_ReadAllFromFileForceSource( void* io_handler, Name filename, Dictionary* dictionary )
+{
+	IO_Handler* self = (IO_Handler*) io_handler;
+	Index chr_I;
+	
+	for( chr_I = strlen(filename); chr_I > 0; chr_I--)
+		if( filename[chr_I - 1] == '/' )
+		{
+			self->currPath = Memory_Alloc_Array( char, (chr_I + 1), "IO_Handler->currPath" );
+			strncpy(self->currPath, filename, chr_I);
+			self->currPath[chr_I] = 0;
+			break;
+		}
+		
+	if( chr_I == 0 )
+	{
+		self->currPath = Memory_Alloc_Array( char, 3, "IO_Handler->currPath" );
+		strcpy(self->currPath, "./");
+		self->currPath[2] = 0;
+	}
+	
+	return self->_readAllFromFileForceSource( self, filename, dictionary );
+}
+
+/** Read a dictionary entry of a given name from file */
+Bool IO_Handler_ReadAllFromBuffer( void* io_handler, Name buffer, Dictionary* dictionary )
+{
+	IO_Handler* self = (IO_Handler*) io_handler;
+
+	return self->_readAllFromBuffer( self, buffer, dictionary );
+}
+
+/** write a given dictionary entry to file */
+Bool IO_Handler_WriteAllToFile(void* io_handler, Name filename, Dictionary* dictionary )
+{
+	IO_Handler* self = (IO_Handler*) io_handler;
+	return self->_writeAllToFile( self, filename, dictionary );
+}
+
+
+/** Add a new dictionary value depending on the parent type, or replace the existing value if found.
+ *	if parent is NULL, add as a plain entry. If parent is a list, add as an element to that
+ *	list. If parent is a struct, add as a member of that struct. */
+Dictionary_Entry_Value* IO_Handler_DictSetAddValue( 
+	void*							io_handler, 
+	Dictionary_Entry_Key					name,
+	char*							newValue, 
+	char							newDictValType,
+	Dictionary_Entry_Value*					parent, 
+	Dictionary_MergeType					mergeType )
+{
+	IO_Handler* self = (IO_Handler*) io_handler;
+	Dictionary_Entry_Value* newDictVal = NULL;
+	#if DEBUG
+		assert( self );
+	#endif
+	
+	/* If parent == NULL... then this is being added to no list or struct, but the dictionary itself */
+	if ( NULL == parent ) {
+		if ( NULL == name ) {
+			fprintf( stdout, "Warning- while parsing file %s: entry that isn't a list element "
+				"given with no name. Not adding this parameter to the dictionary.\n",
+				self->resource );
+			return NULL;
+		}
+		
+		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
+		newDictVal = Dictionary_AddMerge( 
+				self->currDictionary, 
+				name, 
+				newDictVal,
+				mergeType );
+	}
+	else if( parent->type == Dictionary_Entry_Value_Type_List ) {
+		if ( NULL != name ) {
+			fprintf( stdout, "Warning - while parsing file %s: entry inside a list given with a name. Adding the "
+				"entry to the list, but ignoring the name.\n", self->resource );
+		}	
+		
+		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
+		Dictionary_Entry_Value_AddElement( parent, newDictVal );
+	}
+	else if	( parent->type == Dictionary_Entry_Value_Type_Struct ) {
+	/*	Dictionary_Entry_Value* member = NULL;		*/
+		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
+		
+		if ( NULL == name ) {
+			fprintf( stdout, "Warning - while parsing file %s: entry that isn't a list element given with no name. "
+				"Not adding it to the dictionary.\n", self->resource );
+			return NULL;
+		}
+		
+		newDictVal = Dictionary_AddMerge( 
+				parent->as.typeStruct, 
+				name, 
+				newDictVal,
+				mergeType );
+	
+	/*
+	**      This code overrides the merge code, disabling...
+	**
+		if ( (member = Dictionary_Entry_Value_GetMember( parent, name ) ) )
+		{
+			Dictionary_Entry_Value_SetMember( parent, name, newDictVal );
+		}
+		else {
+			Dictionary_Entry_Value_AddMember( parent, name, newDictVal );
+		}
+	*/
+	}
+	else {
+		fprintf( stdout, "Warning - while parsing file %s: IO_Handler_SetAdd passed a parent not of list "
+			"or struct type. Ignoring.\n", self->resource );
+	}
+	
+	return newDictVal;
+} /* IO_Handler_SetAdd */
+
+/** Add a new dictionary value depending on the parent type, or replace the existing value if found.
+ *	if parent is NULL, add as a plain entry. If parent is a list, add as an element to that
+ *	list. If parent is a struct, add as a member of that struct. */
+Dictionary_Entry_Value* IO_Handler_DictSetAddValueWithSource( 
+	void*							io_handler, 
+	Dictionary_Entry_Key					name,
+	char*							newValue, 
+	char							newDictValType,
+	Dictionary_Entry_Value*					parent, 
+	Dictionary_MergeType					mergeType,
+	Dictionary_Entry_Source					source )
+{
+	IO_Handler* self = (IO_Handler*) io_handler;
+	Dictionary_Entry_Value* newDictVal = NULL;
+	#if DEBUG
+		assert( self );
+	#endif
+	
+	/* If parent == NULL... then this is being added to no list or struct, but the dictionary itself */
+	if ( NULL == parent ) {
+		if ( NULL == name ) {
+			fprintf( stdout, "Warning- while parsing file %s: entry that isn't a list element "
+				"given with no name. Not adding this parameter to the dictionary.\n",
+				self->resource );
+			return NULL;
+		}
+		
+		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
+		newDictVal = Dictionary_AddMergeWithSource( 
+				self->currDictionary, 
+				name, 
+				newDictVal,
+				mergeType,
+				source );
+	}
+	else if( parent->type == Dictionary_Entry_Value_Type_List ) {
+		if ( NULL != name ) {
+			fprintf( stdout, "Warning - while parsing file %s: entry inside a list given with a name. Adding the "
+				"entry to the list, but ignoring the name.\n", self->resource );
+		}	
+		
+		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
+		Dictionary_Entry_Value_AddElementWithSource( parent, newDictVal, source );
+	}
+	else if	( parent->type == Dictionary_Entry_Value_Type_Struct ) {
+	/*	Dictionary_Entry_Value* member = NULL;		*/
+		newDictVal = Dictionary_Entry_Value_FromStringTo( newValue, newDictValType );
+		
+		if ( NULL == name ) {
+			fprintf( stdout, "Warning - while parsing file %s: entry that isn't a list element given with no name. "
+				"Not adding it to the dictionary.\n", self->resource );
+			return NULL;
+		}
+		
+		newDictVal = Dictionary_AddMergeWithSource( 
+				parent->as.typeStruct, 
+				name, 
+				newDictVal,
+				mergeType,
+				source );
+	
+	/*
+	**      This code overrides the merge code, disabling...
+	**
+		if ( (member = Dictionary_Entry_Value_GetMember( parent, name ) ) )
+		{
+			Dictionary_Entry_Value_SetMember( parent, name, newDictVal );
+		}
+		else {
+			Dictionary_Entry_Value_AddMember( parent, name, newDictVal );
+		}
+	*/
+	}
+	else {
+		fprintf( stdout, "Warning - while parsing file %s: IO_Handler_SetAdd passed a parent not of list "
+			"or struct type. Ignoring.\n", self->resource );
+	}
+	
+	return newDictVal;
+} /* IO_Handler_SetAddWithSource */
+
+Index IO_Handler_ReadAllFilesFromCommandLine( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
+	IO_Handler* self          = (IO_Handler*) ioHandler;
+	Stream*     errorStream   = Journal_Register( Error_Type, CURR_MODULE_NAME );
+	int       arg_I;
+	char*       filename;
+	char*       extension;
+	Bool        result;
+	Index       filesRead = 0;
+
+	/* Loop over all the arguments from command line */
+	for ( arg_I = 1 ; arg_I < argc ; arg_I++ ) {
+		filename = argv[ arg_I ];
+
+		/* Find extension of potential filename by finding the pointer to the last dot in the string */
+		extension = strrchr( filename, '.' );
+
+		/* Check if there was a '.' in the filename at all - if not, then bail */
+		if ( extension == NULL )
+			continue;
+
+		/* Check if file has a ".xml" extension - if not, then bail */
+		if ( strcasecmp( extension, ".xml" ) != 0 )
+			continue;
+	
+		/* Read file */
+		result = IO_Handler_ReadAllFromFile( self, filename, dictionary );
+		Journal_Firewall( result, errorStream, 
+				"Error: %s could not read input file %s. Exiting.\n", argv[0], filename );
+		filesRead++;		
+	}
+
+	return filesRead;
+}
+
+
+Index IO_Handler_ReadAllFilesFromCommandLineForceSource( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
+	IO_Handler* self          = (IO_Handler*) ioHandler;
+	Stream*     errorStream   = Journal_Register( Error_Type, CURR_MODULE_NAME );
+	int       arg_I;
+	char*       filename;
+	char*       extension;
+	Bool        result;
+	Index       filesRead = 0;
+
+	/* Loop over all the arguments from command line */
+	for ( arg_I = 1 ; arg_I < argc ; arg_I++ ) {
+		filename = argv[ arg_I ];
+
+		/* Find extension of potential filename by finding the pointer to the last dot in the string */
+		extension = strrchr( filename, '.' );
+
+		/* Check if there was a '.' in the filename at all - if not, then bail */
+		if ( extension == NULL )
+			continue;
+
+		/* Check if file has a ".xml" extension - if not, then bail */
+		if ( strcasecmp( extension, ".xml" ) != 0 )
+			continue;
+	
+		/* Read file */
+		result = IO_Handler_ReadAllFromFileForceSource( self, filename, dictionary );
+		Journal_Firewall( result, errorStream, 
+				"Error: %s could not read input file %s. Exiting.\n", argv[0], filename );
+		filesRead++;		
+	}
+
+	return filesRead;
+}
+
+void _get_XML(void* ioHandler, char* argv[], int argc) {
+	IO_Handler* self          = (IO_Handler*) ioHandler;
+	int arg_I;
+	int schema=0;
+	char* name;
+	char* option;
+	
+	for ( arg_I = 1 ; arg_I < argc; arg_I++) {
+		name = argv[ arg_I ];
+		option = strrchr( name, '-' );
+		if ( schema == 1 ) { 
+			if ( self->schema==NULL ) {
+                          self->schema=(char*)malloc( strlen( argv[arg_I] ) +1 );
+                          strcpy( self->schema, argv[ arg_I ] );
+                          schema=0;
+			}
+		}
+		if ( option != NULL ) {
+			if ( strcasecmp( option, "-schema" ) == 0 )
+				schema = 1;
+			if ( strcasecmp( option, "-dontXMLValidate" ) == 0 )
+				(self->validate) = 0;
+			if ( strcasecmp( option, "-XMLValidate" ) == 0 )
+				(self->validate) = 1;
+		}
+	}
+}
+
+
+Index IO_Handler_ReadAllFromCommandLine( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
+	Index filesRead = 0;
+
+	_get_XML( ioHandler, argv, argc );
+	filesRead = IO_Handler_ReadAllFilesFromCommandLine( ioHandler, argc, argv, dictionary );
+	Dictionary_ReadAllParamFromCommandLine( dictionary, argc, argv );
+
+	return filesRead;
+}
+
+
+Index IO_Handler_ReadAllFromCommandLineForceSource( void* ioHandler, int argc, char* argv[], Dictionary* dictionary ) {
+	Index filesRead = 0;
+
+	filesRead = IO_Handler_ReadAllFilesFromCommandLineForceSource( ioHandler, argc, argv, dictionary );
+	Dictionary_ReadAllParamFromCommandLine( dictionary, argc, argv );
+
+	return filesRead;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/IndentFormatter.c
--- a/Base/IO/src/IndentFormatter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: IndentFormatter.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "StreamFormatter.h"
-#include "LineFormatter.h"
-#include "IndentFormatter.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <stdarg.h>   /* subsequent files need this */
-
-
-const Type IndentFormatter_Type = "IndentFormatter";
-const char IndentFormatter_IndentChar = '\t';
-
-/** Makes the string which forms the identation for printing. */
-void IndentFormatter_MakeTag( IndentFormatter* formatter );
-
-
-StreamFormatter* IndentFormatter_New()
-{
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(IndentFormatter);
-	Type                                    type = IndentFormatter_Type;
-	Stg_Class_DeleteFunction*            _delete = _IndentFormatter_Delete;
-	Stg_Class_PrintFunction*              _print = _IndentFormatter_Print;
-	Stg_Class_CopyFunction*                _copy = _IndentFormatter_Copy;
-	StreamFormatter_FormatFunction*      _format = _LineFormatter_Format;
-	char                              _character = IndentFormatter_IndentChar;
-
-	return (StreamFormatter*)_IndentFormatter_New(  INDENTFORMATTER_PASSARGS  );
-}
-
-StreamFormatter* IndentFormatter_New2( const char _character )
-{
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(IndentFormatter);
-	Type                                    type = IndentFormatter_Type;
-	Stg_Class_DeleteFunction*            _delete = _IndentFormatter_Delete;
-	Stg_Class_PrintFunction*              _print = _IndentFormatter_Print;
-	Stg_Class_CopyFunction*                _copy = _IndentFormatter_Copy;
-	StreamFormatter_FormatFunction*      _format = _LineFormatter_Format;
-
-	return (StreamFormatter*)_IndentFormatter_New(  INDENTFORMATTER_PASSARGS  );
-}
-
-void IndentFormatter_Init( IndentFormatter* self )
-{
-	self->_sizeOfSelf = sizeof(IndentFormatter);
-	self->type = IndentFormatter_Type;
-	self->_delete = _IndentFormatter_Delete;
-	self->_print = _IndentFormatter_Print;
-	self->_copy = _IndentFormatter_Copy;
-	
-	_IndentFormatter_Init( self, (StreamFormatter_FormatFunction*)_LineFormatter_Format, IndentFormatter_IndentChar );
-}
-
-IndentFormatter* _IndentFormatter_New(  INDENTFORMATTER_DEFARGS  )
-{
-	IndentFormatter* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(IndentFormatter) );
-	self = (IndentFormatter*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-                                                                                
-	_IndentFormatter_Init( self, _format, _character );
-
-	return self;
-}
-
-void _IndentFormatter_Init(
-	IndentFormatter*		self,
-	StreamFormatter_FormatFunction*	_format,
-	char				_character )
-{
-	_LineFormatter_Init( (LineFormatter*)self, _format );
-	
-	self->_indent = 0;
-	self->_character = _character;
-}
-
-void _IndentFormatter_Delete( void* formatter )
-{
-	IndentFormatter* self = (IndentFormatter*)formatter;
-	
-	#if DEBUG
-		assert( self );
-	#endif
-
-	/* Stg_Class_Delete parent */
-	_LineFormatter_Delete( self );
-}
-void _IndentFormatter_Print( void* formatter, Stream* stream )
-{
-	/*IndentFormatter* self = (IndentFormatter*) formatter;*/
-
-	#if DEBUG
-		assert( formatter );
-		assert( stream );
-	#endif
-	
-	/* General info */
-	printf( "IndentFormatter (ptr): %p\n", formatter );
-	
-	_LineFormatter_Print( formatter, stream );
-}
-
-void* _IndentFormatter_Copy( const void* indentFormatter, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	IndentFormatter*	self = (IndentFormatter*)indentFormatter;
-	IndentFormatter*	newIndentFormatter;
-	
-	newIndentFormatter = (IndentFormatter*)_LineFormatter_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	IndentFormatter_SetIndent( newIndentFormatter, self->_indent );
-	
-	return newIndentFormatter;
-}
-
-void IndentFormatter_SetIndent( void* formatter, Index indent )
-{
-	IndentFormatter* self = (IndentFormatter*)formatter;
-	
-	self->_indent = indent;
-	IndentFormatter_MakeTag( self );
-}
-
-void IndentFormatter_Increment( void* formatter )
-{
-	IndentFormatter* self = (IndentFormatter*)formatter;
-	
-	self->_indent++;
-	IndentFormatter_MakeTag( self );
-}
-
-void IndentFormatter_Decrement( void* formatter )
-{
-	IndentFormatter* self = (IndentFormatter*)formatter;
-	
-	self->_indent = ( self->_indent <= 0 ) ? 0 : self->_indent - 1;
-	IndentFormatter_MakeTag( self );
-}
-
-void IndentFormatter_Zero( void* formatter)
-{
-	IndentFormatter* self = (IndentFormatter*)formatter;
-	
-	self->_indent = 0;
-	IndentFormatter_MakeTag( self );
-}
-
-void IndentFormatter_MakeTag( IndentFormatter* formatter )
-{
-	Index i;
-	
-	/* Release previous tag if existing. */
-	if ( formatter->_tag != NULL )
-	{
-		Memory_Free( formatter->_tag );
-	}
-	
-	/* Stop if no indentation. */
-	if ( formatter->_indent <= 0 )
-	{
-		formatter->_tag = NULL;
-		return;
-	}
-	
-	/* Produce tag. */
-	formatter->_tag = Memory_Alloc_Array( char, formatter->_indent + 1, Memory_IgnoreName );
-	for ( i = 0; i < formatter->_indent; ++i )
-	{
-		formatter->_tag[i] = formatter->_character;
-	}
-	formatter->_tag[i] = '\0';
-}
-
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/IndentFormatter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/IndentFormatter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,214 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: IndentFormatter.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "StreamFormatter.h"
+#include "LineFormatter.h"
+#include "IndentFormatter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <stdarg.h>   /* subsequent files need this */
+
+
+const Type IndentFormatter_Type = "IndentFormatter";
+const char IndentFormatter_IndentChar = '\t';
+
+/** Makes the string which forms the identation for printing. */
+void IndentFormatter_MakeTag( IndentFormatter* formatter );
+
+
+StreamFormatter* IndentFormatter_New()
+{
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(IndentFormatter);
+	Type                                    type = IndentFormatter_Type;
+	Stg_Class_DeleteFunction*            _delete = _IndentFormatter_Delete;
+	Stg_Class_PrintFunction*              _print = _IndentFormatter_Print;
+	Stg_Class_CopyFunction*                _copy = _IndentFormatter_Copy;
+	StreamFormatter_FormatFunction*      _format = _LineFormatter_Format;
+	char                              _character = IndentFormatter_IndentChar;
+
+	return (StreamFormatter*)_IndentFormatter_New(  INDENTFORMATTER_PASSARGS  );
+}
+
+StreamFormatter* IndentFormatter_New2( const char _character )
+{
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(IndentFormatter);
+	Type                                    type = IndentFormatter_Type;
+	Stg_Class_DeleteFunction*            _delete = _IndentFormatter_Delete;
+	Stg_Class_PrintFunction*              _print = _IndentFormatter_Print;
+	Stg_Class_CopyFunction*                _copy = _IndentFormatter_Copy;
+	StreamFormatter_FormatFunction*      _format = _LineFormatter_Format;
+
+	return (StreamFormatter*)_IndentFormatter_New(  INDENTFORMATTER_PASSARGS  );
+}
+
+void IndentFormatter_Init( IndentFormatter* self )
+{
+	self->_sizeOfSelf = sizeof(IndentFormatter);
+	self->type = IndentFormatter_Type;
+	self->_delete = _IndentFormatter_Delete;
+	self->_print = _IndentFormatter_Print;
+	self->_copy = _IndentFormatter_Copy;
+	
+	_IndentFormatter_Init( self, (StreamFormatter_FormatFunction*)_LineFormatter_Format, IndentFormatter_IndentChar );
+}
+
+IndentFormatter* _IndentFormatter_New(  INDENTFORMATTER_DEFARGS  )
+{
+	IndentFormatter* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(IndentFormatter) );
+	self = (IndentFormatter*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+                                                                                
+	_IndentFormatter_Init( self, _format, _character );
+
+	return self;
+}
+
+void _IndentFormatter_Init(
+	IndentFormatter*		self,
+	StreamFormatter_FormatFunction*	_format,
+	char				_character )
+{
+	_LineFormatter_Init( (LineFormatter*)self, _format );
+	
+	self->_indent = 0;
+	self->_character = _character;
+}
+
+void _IndentFormatter_Delete( void* formatter )
+{
+	IndentFormatter* self = (IndentFormatter*)formatter;
+	
+	#if DEBUG
+		assert( self );
+	#endif
+
+	/* Stg_Class_Delete parent */
+	_LineFormatter_Delete( self );
+}
+void _IndentFormatter_Print( void* formatter, Stream* stream )
+{
+	/*IndentFormatter* self = (IndentFormatter*) formatter;*/
+
+	#if DEBUG
+		assert( formatter );
+		assert( stream );
+	#endif
+	
+	/* General info */
+	printf( "IndentFormatter (ptr): %p\n", formatter );
+	
+	_LineFormatter_Print( formatter, stream );
+}
+
+void* _IndentFormatter_Copy( const void* indentFormatter, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	IndentFormatter*	self = (IndentFormatter*)indentFormatter;
+	IndentFormatter*	newIndentFormatter;
+	
+	newIndentFormatter = (IndentFormatter*)_LineFormatter_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	IndentFormatter_SetIndent( newIndentFormatter, self->_indent );
+	
+	return newIndentFormatter;
+}
+
+void IndentFormatter_SetIndent( void* formatter, Index indent )
+{
+	IndentFormatter* self = (IndentFormatter*)formatter;
+	
+	self->_indent = indent;
+	IndentFormatter_MakeTag( self );
+}
+
+void IndentFormatter_Increment( void* formatter )
+{
+	IndentFormatter* self = (IndentFormatter*)formatter;
+	
+	self->_indent++;
+	IndentFormatter_MakeTag( self );
+}
+
+void IndentFormatter_Decrement( void* formatter )
+{
+	IndentFormatter* self = (IndentFormatter*)formatter;
+	
+	self->_indent = ( self->_indent <= 0 ) ? 0 : self->_indent - 1;
+	IndentFormatter_MakeTag( self );
+}
+
+void IndentFormatter_Zero( void* formatter)
+{
+	IndentFormatter* self = (IndentFormatter*)formatter;
+	
+	self->_indent = 0;
+	IndentFormatter_MakeTag( self );
+}
+
+void IndentFormatter_MakeTag( IndentFormatter* formatter )
+{
+	Index i;
+	
+	/* Release previous tag if existing. */
+	if ( formatter->_tag != NULL )
+	{
+		Memory_Free( formatter->_tag );
+	}
+	
+	/* Stop if no indentation. */
+	if ( formatter->_indent <= 0 )
+	{
+		formatter->_tag = NULL;
+		return;
+	}
+	
+	/* Produce tag. */
+	formatter->_tag = Memory_Alloc_Array( char, formatter->_indent + 1, Memory_IgnoreName );
+	for ( i = 0; i < formatter->_indent; ++i )
+	{
+		formatter->_tag[i] = formatter->_character;
+	}
+	formatter->_tag[i] = '\0';
+}
+
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Init.c
--- a/Base/IO/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 4124 2007-05-27 23:18:25Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <mpi.h>
-#include <libxml/xmlerror.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Dictionary.h"
-#include "Dictionary_Entry.h"
-#include "Dictionary_Entry_Value.h"
-#include "IO_Handler.h"
-#include "XML_IO_Handler.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "MPIFile.h"
-#include "Stream.h"
-#include "CStream.h"
-#include "MPIStream.h"
-#include "BinaryStream.h"
-#include "StreamFormatter.h"
-#include "LineFormatter.h"
-#include "IndentFormatter.h"
-#include "RankFormatter.h"
-#include "PathUtils.h"
-#include "CmdLineArgs.h"
-#include "Init.h"
-
-const Name     LiveDebugName = "LiveDebug";
-Stream*        LiveDebug = NULL;
-
-Stream* stgErrorStream;
-
-Bool BaseIO_Init( int* argc, char** argv[] )
-{
-	Stream*	general;
-
-	/* Set up a useful map in the XML_IO_Handler */
-	XML_IO_Handler_MergeTypeMap[Dictionary_MergeType_Append] = APPEND_TAG;
-	XML_IO_Handler_MergeTypeMap[Dictionary_MergeType_Merge] = MERGE_TAG;
-	XML_IO_Handler_MergeTypeMap[Dictionary_MergeType_Replace] = REPLACE_TAG;
-
-	stgStreamFormatter_Buffer = StreamFormatter_Buffer_New(); 
-
-	stJournal = Journal_New();
-	/* Create default Typed Streams. */
-	Journal_SetupDefaultTypedStreams();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	stgMemory->infoStream = Stg_Class_Copy( Journal_GetTypedStream( Info_Type ), 0, True, 0, 0 );
-	stgMemory->debugStream = Stg_Class_Copy( Journal_GetTypedStream( Debug_Type ), 0, True, 0, 0 );
-	stgMemory->errorStream = Stg_Class_Copy( Journal_GetTypedStream( Error_Type ), 0, True, 0, 0 );
-
-	/* more inits from the Foundation level */
-	Stream_Enable( Journal_Register( Info_Type, Stg_TimeMonitor_InfoStreamName ), False );
-	Stream_Enable( Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ), False );
-
-	/* The LiveDebug stream */
-	LiveDebug = Journal_Register( Info_Type, LiveDebugName );
-	Stream_Enable( LiveDebug, False );
-	Stream_SetLevel( LiveDebug, 1 );
-
-	/* General streams. */
-	general = Journal_Register( Info_Type, "general" );
-	Stream_SetPrintingRank( general, 0 );
-	stgErrorStream = Journal_Register( Error_Type, "stgErrorStream" );
-
-	/* Handle the output of libXML properly, by redirecting to the XML_IO_Handler error stream */
-	xmlSetGenericErrorFunc( NULL, XML_IO_Handler_LibXMLErrorHandler );
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,107 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 4124 2007-05-27 23:18:25Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <mpi.h>
+#include <libxml/xmlerror.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Dictionary.h"
+#include "Dictionary_Entry.h"
+#include "Dictionary_Entry_Value.h"
+#include "IO_Handler.h"
+#include "XML_IO_Handler.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "MPIFile.h"
+#include "Stream.h"
+#include "CStream.h"
+#include "MPIStream.h"
+#include "BinaryStream.h"
+#include "StreamFormatter.h"
+#include "LineFormatter.h"
+#include "IndentFormatter.h"
+#include "RankFormatter.h"
+#include "PathUtils.h"
+#include "CmdLineArgs.h"
+#include "Init.h"
+
+const Name     LiveDebugName = "LiveDebug";
+Stream*        LiveDebug = NULL;
+
+Stream* stgErrorStream;
+
+Bool BaseIO_Init( int* argc, char** argv[] )
+{
+	Stream*	general;
+
+	/* Set up a useful map in the XML_IO_Handler */
+	XML_IO_Handler_MergeTypeMap[Dictionary_MergeType_Append] = APPEND_TAG;
+	XML_IO_Handler_MergeTypeMap[Dictionary_MergeType_Merge] = MERGE_TAG;
+	XML_IO_Handler_MergeTypeMap[Dictionary_MergeType_Replace] = REPLACE_TAG;
+
+	stgStreamFormatter_Buffer = StreamFormatter_Buffer_New(); 
+
+	stJournal = Journal_New();
+	/* Create default Typed Streams. */
+	Journal_SetupDefaultTypedStreams();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	stgMemory->infoStream = Stg_Class_Copy( Journal_GetTypedStream( Info_Type ), 0, True, 0, 0 );
+	stgMemory->debugStream = Stg_Class_Copy( Journal_GetTypedStream( Debug_Type ), 0, True, 0, 0 );
+	stgMemory->errorStream = Stg_Class_Copy( Journal_GetTypedStream( Error_Type ), 0, True, 0, 0 );
+
+	/* more inits from the Foundation level */
+	Stream_Enable( Journal_Register( Info_Type, Stg_TimeMonitor_InfoStreamName ), False );
+	Stream_Enable( Journal_Register( Info_Type, Stg_MemMonitor_InfoStreamName ), False );
+
+	/* The LiveDebug stream */
+	LiveDebug = Journal_Register( Info_Type, LiveDebugName );
+	Stream_Enable( LiveDebug, False );
+	Stream_SetLevel( LiveDebug, 1 );
+
+	/* General streams. */
+	general = Journal_Register( Info_Type, "general" );
+	Stream_SetPrintingRank( general, 0 );
+	stgErrorStream = Journal_Register( Error_Type, "stgErrorStream" );
+
+	/* Handle the output of libXML properly, by redirecting to the XML_IO_Handler error stream */
+	xmlSetGenericErrorFunc( NULL, XML_IO_Handler_LibXMLErrorHandler );
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Journal.c
--- a/Base/IO/src/Journal.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,765 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Journal.c 4216 2008-02-11 10:22:07Z DavidMay $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-
-
-#include "pcu/pcu.h"	/* We'll use pcu_assert in Firewall function */
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Dictionary.h"
-#include "Dictionary_Entry.h"
-#include "Dictionary_Entry_Value.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "Stream.h"
-#include "CStream.h"
-#include "MPIStream.h"
-#include "BinaryStream.h"
-#include "StreamFormatter.h"
-#include "LineFormatter.h"
-#include "RankFormatter.h"
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef NO_UNISTD
-#include <unistd.h>
-#endif
-
-
-Journal* stJournal = NULL;
-
-const Type Journal_Type = "Journal";
-
-/* String constants for default Journal typed streams. */
-const Type Info_Type = "info";
-const Type Debug_Type = "debug";
-const Type Dump_Type = "dump";
-const Type Error_Type = "error";
-
-/* Depricated string constants. */
-const Type InfoStream_Type = "info";
-const Type DebugStream_Type = "debug";
-const Type DumpStream_Type = "dump";
-const Type ErrorStream_Type = "error";
-
-/* Parsing constants for Dictionary reading. */
-Name JOURNAL_DELIMITER = ".";
-Name JOURNAL_KEY = "journal";
-Name JOURNAL_ENABLE_KEY = "journal";
-Name JOURNAL_ENABLE_BRANCH_KEY = "journal-enable-branch";
-Name JOURNAL_LEVEL_KEY = "journal-level";
-Name JOURNAL_LEVEL_BRANCH_KEY = "journal-level-branch";
-Name JOURNAL_FILE_KEY = "journal-file";
-Name JOURNAL_RANK_KEY = "journal-rank";
-Name JOURNAL_FLUSH_KEY = "journal-autoflush";
-Name JOURNAL_MPI_OFFSET_KEY = "journal-mpi-offset";
-
-Name JOURNAL_ON = "on";
-Name JOURNAL_OFF = "off";
-
-
-static const int JOURNAL_START_SIZE = 16;	/**< Initial size of lists in Journal. */
-static const int JOURNAL_DELTA_SIZE = 8;	/**< Number of elements to extend by for lists in Journal. */
-
-
-/** Retrieves the given named stream. Dotted-decimal notation may be used to get sub streams.
- ** If the stream does not exists, a new stream is created from the parent stream.
- **/
-Stream* Journal_GetNamedStream( Stream* typedStream, Name name );
-
-
-Journal* Journal_New()
-{
-	Journal* self = Memory_Alloc( Journal, "Singleton" );
-	
-	self->_files = Stg_ObjectList_New2( JOURNAL_START_SIZE, JOURNAL_DELTA_SIZE );
-	self->_typedStreams = Stg_ObjectList_New2( JOURNAL_START_SIZE, JOURNAL_DELTA_SIZE );
-	self->enable = True;
-
-	/** Initialise default files. */
-	self->stdOut = CFile_New();
-	self->stdOut->fileHandle = stdout;
-	self->stdOut->_opened = True;
-	
-	self->stdErr = CFile_New();
-	self->stdErr->fileHandle = stderr;
-	self->stdErr->_opened = True;
-	
-	self->firewallProducesAssert = True;
-
-	self->flushCount = 0;
-	
-	return self;
-}
-
-void Journal_Delete() {
-	Stg_Class_Delete( stJournal->stdOut );
-	Stg_Class_Delete( stJournal->stdErr );
-	
-	Journal_Purge();
-	Stg_Class_Delete( stJournal->_typedStreams );
-	Stg_Class_Delete( stJournal->_files );
-	
-	Memory_Free( stJournal );
-}
-
-void Journal_Purge() {
-	Index i;
-	
-	Stg_ObjectList_DeleteAllObjects( stJournal->_typedStreams );
-
-	for ( i = 0; i < stJournal->_files->count; ++i ) {
-		if ( !JournalFile_Close( (JournalFile*) stJournal->_files->data[i] ) ) {
-			/* TODO: warning can't close */
-		}
-	}
-	Stg_ObjectList_DeleteAllObjects( stJournal->_files );
-}
-
-void Journal_ReadFromDictionary( Dictionary* dictionary )
-{
-	Dictionary_Index index;
-
-	Stream* stream = NULL; /* The stream which the operation will be applied to. */
-	
-	char* keyCopy;	
-	char* typedToken;
-	char* namedToken;
-	
-	char* operation;
-				
-	Bool valid;
-	
-	/* Iterate through the whole dictionary, checking for journal related commands */
-	for ( index = 0; index < dictionary->count; ++index )
-	{
-		/* Check to see if it is a journal operation by searching for the JOURNAL_KEY. */
-		if ( (0 == strncasecmp( dictionary->entryPtr[index]->key, JOURNAL_KEY, strlen(JOURNAL_KEY))) )
-		{
-			valid = True;
-
-			/* Make copy to tokenise so original contents will not be destroyed */
-			keyCopy = StG_Strdup( dictionary->entryPtr[index]->key );
-			
-			/* The first token determines the operation to perform. */
-			operation = strtok( keyCopy, JOURNAL_DELIMITER );
-			
-			typedToken = strtok( NULL, JOURNAL_DELIMITER );
-			namedToken = strtok( NULL, "" );
-				
-			if ( strcmp( operation, JOURNAL_ENABLE_KEY ) == 0 )
-			{
-				/* Enable function */
-				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
-				
-				if ( typedToken == NULL )
-				{
-					/* no more tokens, set the entire journal */
-					stJournal->enable = enable;
-				}
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						/* no more tokens, set the entire type */
-						Journal_Enable_TypedStream( typedToken, enable );
-					}
-					else
-					{
-						Journal_Enable_NamedStream( typedToken, namedToken, enable );
-					}
-				}
-				
-			} /* END Enable function */
-			if ( strcmp( operation, JOURNAL_ENABLE_BRANCH_KEY ) == 0 )
-			{
-				Stream* branchStream;
-				/* Enable function */
-				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
-		
-				assert( typedToken );
-				if ( namedToken == NULL ) {
-					branchStream = Journal_GetTypedStream( typedToken );
-				}
-				else {
-					branchStream = Journal_Register( typedToken, namedToken );
-				}
-				Stream_EnableBranch( branchStream, enable );
-				
-			} /* END Enable function */
-			else if ( strcmp( operation, JOURNAL_LEVEL_KEY ) == 0 )
-			{
-				/* Set level function */
-				JournalLevel level;
-				
-				level = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
-				
-				if ( typedToken == NULL )
-				{
-					printf( "Warning - Can only change level for typed and named streams.\n" );
-				}
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						stream = Journal_GetTypedStream( typedToken );
-					}
-					else
-					{
-						stream = Journal_Register( typedToken, namedToken );
-					}
-					Stream_SetLevel( stream, level );
-				}
-			} /* END SetLevel function */
-			else if ( strcmp( operation, JOURNAL_LEVEL_BRANCH_KEY ) == 0 )
-			{
-				/* Set level function */
-				JournalLevel level;
-				
-				level = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
-				
-				if ( typedToken == NULL )
-				{
-					printf( "Warning - Can only change level for typed and named streams.\n" );
-				}
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						stream = Journal_GetTypedStream( typedToken );
-					}
-					else
-					{
-						stream = Journal_Register( typedToken, namedToken );
-					}
-					Stream_SetLevelBranch( stream, level );
-				}
-			} /* END SetLevelBranch function */
-			else if ( strcmp( operation, JOURNAL_FILE_KEY ) == 0 )
-			{
-				/* Set file destination function */
-				JournalFile* file = NULL;
-				char* fileName = Dictionary_Entry_Value_AsString( dictionary->entryPtr[index]->value );
-				
-				if ( typedToken == NULL )
-				{
-					printf( "Warning - Can only change files for typed and named streams.\n" );
-				}
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						/* setting file for typed stream */
-						stream = Journal_GetTypedStream( typedToken );
-					}
-					else
-					{
-						stream = Journal_Register( typedToken, namedToken );
-					}
-					
-					file = Journal_GetFile( fileName );
-					if ( file == NULL )
-					{
-						file = stream->defaultFileType();
-						if ( JournalFile_Open( file, fileName ) ) {
-							Journal_RegisterFile( file );
-						}
-						else {
-							/* error/warning */
-						}
-					}
-					if ( !Stream_SetFile( stream, file ) )
-					{
-						/* file is not valid */
-					}
-				}
-			} /* END File function */
-			else if ( strcmp( operation, JOURNAL_RANK_KEY ) == 0 )
-			{
-				int rank;
-
-				rank = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
-
-				if ( typedToken == NULL )
-				{
-					printf( "Warning - Can only set printing rank for typed and named streams.\n" );
-				}
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						stream = Journal_GetTypedStream( typedToken );
-					}
-					else
-					{
-						stream = Journal_Register( typedToken, namedToken );
-					}
-					Stream_SetPrintingRank( stream, rank );
-				}
-			} /* END Printing Rank funciton. */
-			else if ( strcmp( operation, JOURNAL_FLUSH_KEY ) == 0 )
-			{
-				Bool flush = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
-
-				if ( typedToken == NULL )
-				{
-					printf( "Warning - Can only set auto-flush for typed and named streams.\n" );
-				}
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						stream = Journal_GetTypedStream( typedToken );
-					}
-					else
-					{
-						stream = Journal_Register( typedToken, namedToken );
-					}
-
-					Stream_SetAutoFlush( stream, flush );
-				}
-			}
-			else if ( strcmp( operation, JOURNAL_MPI_OFFSET_KEY ) == 0 )
-			{
-				MPI_Offset offset = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
-
-				if ( typedToken == NULL ) 
-				{
-					printf( "Warning - Can only set mpi-offset for typed and named streams.\n" );
-				}	
-				else
-				{
-					if ( namedToken == NULL )
-					{
-						stream = Journal_GetTypedStream( typedToken );
-					}
-					else
-					{
-						stream = Journal_Register( typedToken, namedToken );
-					}
-
-					if ( ! MPIStream_SetOffset( stream, offset, MPI_COMM_WORLD ) )
-					{
-						printf( "Warning - Failed to set mpi-offset for %s", typedToken );
-						if ( namedToken )
-						{
-							printf( ".%s", namedToken );
-						}
-						printf( "\n" );
-					}	
-				}
-			}	
-			
-			Memory_Free( keyCopy );
-		}	
-	}
-}
-
-void Journal_RegisterTypedStream( Stream* typedStream )
-{
-	/* check exists and update */
-	Stg_ObjectList_Append( stJournal->_typedStreams, typedStream );
-}
-
-Stream* Journal_GetTypedStream( const Type type )
-{
-	Stream* typedStream = NULL;
-
-	typedStream = (Stream*)Stg_ObjectList_Get( stJournal->_typedStreams, (Name)type );	
-	if ( typedStream == NULL )
-	{
-		/* Make a default stream for this name. */
-		typedStream = CStream_New( type );
-		Stream_Enable( typedStream, False );
-		Stream_SetLevel( typedStream, 1 );
-		Stream_SetFile( typedStream, stJournal->stdOut );
-
-		Journal_RegisterTypedStream( typedStream );
-	}
-	
-	return typedStream;
-}
-
-Stream* Journal_GetNamedStream( Stream* typedStream, Name name )
-{
-	Stream* currentStream ;
-	char* nameCopy;
-	char* token;
-	
-	currentStream = typedStream;
-	nameCopy = StG_Strdup( name );
-	
-	
-	token = strtok( nameCopy, JOURNAL_DELIMITER );
-	while ( token != NULL )
-	{
-		currentStream = Stream_RegisterChild( currentStream, token );
-		token = strtok( NULL, JOURNAL_DELIMITER );
-	}
-	
-	Memory_Free( nameCopy );
-	
-	if ( currentStream == typedStream )
-	{
-		return NULL;
-	}
-	
-	return currentStream;
-}
-
-Stream* Journal_Register( const Type type, Name name )
-{
-	Stream* typedStream = NULL;
-	Stream* namedStream = NULL;
-
-	typedStream = Journal_GetTypedStream( type );
-	namedStream = Journal_GetNamedStream( typedStream, name );	
-	
-	return namedStream;
-}
-
-Stream* Journal_Register2( const Type streamType, const Type componentType, Name componentName ) {
-	Stream* componentStream;
-	Stream* instanceStream;
-	componentStream = Journal_Register( streamType, componentType );
-	instanceStream = Stream_RegisterChild( componentStream, componentName );
-
-	return instanceStream;
-}
-
-JournalFile* Journal_GetFile( Name fileName )
-{
-	return (JournalFile*) Stg_ObjectList_Get( stJournal->_files, fileName );
-}
-
-
-void Journal_RegisterFile( JournalFile* newFile )
-{
-	if ( newFile == NULL )
-	{
-		/* Warning */
-		return;
-	}
-	Stg_ObjectList_Append( stJournal->_files, newFile );
-}
-
-void Journal_DeregisterFile( JournalFile* file )
-{
-	if ( file == NULL ) {
-		return;
-	}
-	Stg_ObjectList_Remove( stJournal->_files, file->name, KEEP );
-}
-
-void Journal_Enable_TypedStream( const Type type, Bool enable )
-{
-	Stream* typedStream = Journal_GetTypedStream( type );
-	Stream_Enable( typedStream, enable );
-}
-
-void Journal_Enable_AllTypedStream( Bool enable )
-{
-	Journal_Enable_TypedStream( Info_Type, enable );
-	Journal_Enable_TypedStream( Debug_Type, enable );
-	Journal_Enable_TypedStream( Dump_Type, enable );
-	Journal_Enable_TypedStream( Error_Type, enable );
-}
-
-void Journal_Enable_NamedStream( const Type type, Name name, Bool enable )
-{
-	Stream* stream = Journal_Register( type, name );
-	Stream_Enable( stream, enable );
-}
-
-void Journal_PrintConcise()
-{
-	Stream* stream;
-	Index i;
-	
-	if ( stJournal == NULL )
-	{
-		return;
-	}
-
-	stream = Journal_Register( Info_Type, "Journal" );
-
-	Journal_Printf( stream, "\nSummary of Journal and Stream Status:\n" );
-	Journal_Printf( stream, "Journal Enabled: %s\n", stJournal->enable ? "True" : "False" );
-	
-	Journal_Printf( stream, "Explanation of the following stream status printout:\n"
-		"The streams are organised hierarchically, as trees, according to the\n"
-		"purpose of the stream - the key stream types \"info\", \"debug\" and \"error\"\n"
-		"are at the top, with all other streams as their children.\n"
-		"We also display the status of each stream: the \"Enabled\" parameter, which can\n"
-		"be individually set from input files/command line, determines whether output sent\n"
-		"to a given stream will print or not. The \"Level\" parameter determines the level\n"
-		"of detail that it will output - 1 is the default, 4 means very verbose.\n"
-		"For full details on Journalling, go to https://csd.vpac.org/twiki/bin/view/Stgermain/Journal\n\n");
-
-	Journal_Printf( stream, "Typed Streams:\n" );
-	for ( i = 0; i < stJournal->_typedStreams->count; ++i )
-	{
-		Stream_PrintConcise( stJournal->_typedStreams->data[i], stream );
-	}
-	Journal_Printf( stream, "\n" );
-}
-
-int Journal_Printf( void* _stream, Name fmt, ... )
-{
-	int result;
-	Stream* stream = (Stream*)_stream;
-	
-	va_list ap;
-
-	if ( !stJournal->enable || !Stream_IsEnable( stream ) )
-	{
-		return 0;
-	}
-
-	va_start( ap, fmt );
- 	
-	result = Stream_Printf( stream, fmt, ap );
-	
-	va_end(ap);
-	
-	return result;
-}
-
-int Journal_PrintfL( void* _stream, JournalLevel level, Name fmt, ... )
-{
-	int result;
-	Stream* stream = (Stream*)_stream;
-	
-	va_list ap;
-
-	if ( !stJournal->enable || !Stream_IsEnable( stream ) || !Stream_IsPrintableLevel( stream, level ) )
-	{
-		return 0;
-	}
-
-	va_start( ap, fmt );
- 	
-	result = Stream_Printf( stream, fmt, ap );
-	
-	va_end(ap);
-	return result;
-}
-/*
-int Journal_Firewall_Func( int expression, char* expressionText, 
-	Name file, const char* func, int line, void* _stream, char* fmt, ... )
-*/
-int Journal_Firewall( int expression, void* _stream, Name fmt, ... )
-{
-	int result = 0;
-	Stream* stream = (Stream*)_stream;
-	int nProc = 0;
-
-	va_list ap;
-	
-	MPI_Comm_size( MPI_COMM_WORLD, &nProc );
-	
-	if ( expression )
-	{
-		/* Every thing is OK! Back to work as normal */
-		return 0;
-	}
-	
-	Stream_Enable( stream, True ); /* Enforce enabling of stream because we really do want to see this */
-
-	if ( stJournal->enable && Stream_IsEnable( stream ) )
-	{
-		va_start( ap, fmt );
-/*
-		Journal_Printf( stream, "Expression: %s\n", expressionText );
-		Journal_Printf( stream, "From File: %s\n", file );
-		Journal_Printf( stream, "     Function: %s\n", func );
-		Journal_Printf( stream, "     Line: %d\n", line );
-*/	
-		result = Stream_Printf( stream, fmt, ap );
-		Stream_Flush( stream );
-
-		va_end(ap);
-	}
-	
-	if ( stJournal->firewallProducesAssert == True ) {
-		/* Use pcu_assert, so that StGermain PCU tests can check that a Firewall
-		 * is correctly produced. */ 
-		pcu_assert( expression );
-	}
-	else {
-		/* TODO: Don't use FAILURE until Pat beef's up the test scripts to do .error checks
-			exit( EXIT_FAILURE );
-		*/
-
-		/* SGI MPI on the ess does not always print out everything before it exits
-		 To ensure all output is displayed before the program quits on firewall, sleep for one second
-		 Alan & Kath 20061006 */
-#ifndef NO_UNISTD
-		sleep( 1 );
-#endif
-		if ( nProc == 1 ) {
-			exit(EXIT_SUCCESS);
-		}
-		else {
-			MPI_Abort( MPI_COMM_WORLD, EXIT_SUCCESS );
-		}
-	}
-	
-	return result;	
-}
-
-SizeT Journal_Write( void* _stream, const void* data, SizeT elem_size, SizeT num_elems )
-{
-	Stream* stream = (Stream*)_stream;
-
-	return Stream_Write( stream, data, elem_size, num_elems );
-}
-
-Bool Journal_Dump( void* _stream, const void* data )
-{
-	Stream* stream = (Stream*)_stream;
-
-	return Stream_Dump( stream, data );
-}
-
-
-/* Only rank 0 will print to stream */
-int Journal_RPrintf ( void* _stream, Name const fmt, ... )
-{
-	Stream* stream = (Stream*)_stream;
-	int result, init_stream_rank;
-        va_list ap;
-
-        init_stream_rank = Stream_GetPrintingRank( stream );
-	Stream_SetPrintingRank( stream, 0 );
-
-        va_start( ap, fmt );
-
-        if ( !stJournal->enable || !Stream_IsEnable( stream ) )
-        {
-                return 0;
-        }
-
-        result = Stream_Printf( stream, fmt, ap );
-
-        va_end(ap);
-
-	Stream_SetPrintingRank( stream, init_stream_rank );
-        return result;
-}
-
-/* Only rank 0 will print to stream */
-int Journal_RPrintfL ( void* _stream, JournalLevel level, Name const fmt, ... )
-{
-        Stream* stream = (Stream*)_stream;
-        int result, init_stream_rank;
-        va_list ap;
-
-        init_stream_rank = Stream_GetPrintingRank( stream );
-        Stream_SetPrintingRank( stream, 0 );
-
-        va_start( ap, fmt );
-
-        if ( !stJournal->enable || !Stream_IsEnable( stream ) || !Stream_IsPrintableLevel( stream, level ) )
-        {
-                return 0;
-        }
-
-        result = Stream_Printf( stream, fmt, ap );
-
-        va_end(ap);
-
-        Stream_SetPrintingRank( stream, init_stream_rank );
-        return result;
-}
-
-
-void Journal_SetupDefaultTypedStreams() {
-	Stream* typedStream;
-
-	/* info */
-	typedStream = CStream_New( Info_Type );
-	Stream_Enable( typedStream, False );
-	Stream_SetLevel( typedStream, 1 );
-	Stream_SetFile( typedStream, stJournal->stdOut );
-	Stream_SetAutoFlush( typedStream, True );
-	Journal_RegisterTypedStream( typedStream );
-	/* Default when registering a Journal stream is to have it print from Rank 0 only) */
-	Stream_SetPrintingRank( typedStream, 0);
-
-	/* debug */
-	typedStream = CStream_New( Debug_Type );
-	Stream_Enable( typedStream, False );
-	Stream_SetLevel( typedStream, 1 );
-	Stream_SetFile( typedStream, stJournal->stdOut );
-	Stream_SetAutoFlush( typedStream, True );
-	Stream_AddFormatter( typedStream, RankFormatter_New() );
-	Journal_RegisterTypedStream( typedStream );
-	/* Default when registering a Journal stream is to have it print from Rank 0 only) */
-	Stream_SetPrintingRank( typedStream, 0);
-	
-	/* dump */
-	typedStream = CStream_New( Dump_Type );
-	Stream_Enable( typedStream, False );
-	Stream_SetLevel( typedStream, 1 );
-	Stream_SetFile( typedStream, stJournal->stdOut );
-	Journal_RegisterTypedStream( typedStream );
-	
-	/* error */
-	typedStream = CStream_New( Error_Type );
-	Stream_Enable( typedStream, True );
-	Stream_SetLevel( typedStream, 1 );
-	Stream_SetFile( typedStream, stJournal->stdErr );
-	Stream_SetAutoFlush( typedStream, True );
-	Stream_AddFormatter( typedStream, RankFormatter_New() );
-	Journal_RegisterTypedStream( typedStream );
-	
-	/* mpi stream */
-	typedStream = MPIStream_New( MPIStream_Type );
-	Stream_Enable( typedStream, False );
-	Stream_SetLevel( typedStream, 1 );
-	Journal_RegisterTypedStream( typedStream );
-	/* MPI Streams need to print from all ranks */
-
-	/* binary stream */
-	typedStream = BinaryStream_New( BinaryStream_Type );
-	Stream_Enable( typedStream, False );
-	Stream_SetLevel( typedStream, 1 );
-	Journal_RegisterTypedStream( typedStream );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Journal.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Journal.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,765 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Journal.c 4216 2008-02-11 10:22:07Z DavidMay $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+
+
+#include "pcu/pcu.h"	/* We'll use pcu_assert in Firewall function */
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Dictionary.h"
+#include "Dictionary_Entry.h"
+#include "Dictionary_Entry_Value.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "Stream.h"
+#include "CStream.h"
+#include "MPIStream.h"
+#include "BinaryStream.h"
+#include "StreamFormatter.h"
+#include "LineFormatter.h"
+#include "RankFormatter.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef NO_UNISTD
+#include <unistd.h>
+#endif
+
+
+Journal* stJournal = NULL;
+
+const Type Journal_Type = "Journal";
+
+/* String constants for default Journal typed streams. */
+const Type Info_Type = "info";
+const Type Debug_Type = "debug";
+const Type Dump_Type = "dump";
+const Type Error_Type = "error";
+
+/* Depricated string constants. */
+const Type InfoStream_Type = "info";
+const Type DebugStream_Type = "debug";
+const Type DumpStream_Type = "dump";
+const Type ErrorStream_Type = "error";
+
+/* Parsing constants for Dictionary reading. */
+Name JOURNAL_DELIMITER = ".";
+Name JOURNAL_KEY = "journal";
+Name JOURNAL_ENABLE_KEY = "journal";
+Name JOURNAL_ENABLE_BRANCH_KEY = "journal-enable-branch";
+Name JOURNAL_LEVEL_KEY = "journal-level";
+Name JOURNAL_LEVEL_BRANCH_KEY = "journal-level-branch";
+Name JOURNAL_FILE_KEY = "journal-file";
+Name JOURNAL_RANK_KEY = "journal-rank";
+Name JOURNAL_FLUSH_KEY = "journal-autoflush";
+Name JOURNAL_MPI_OFFSET_KEY = "journal-mpi-offset";
+
+Name JOURNAL_ON = "on";
+Name JOURNAL_OFF = "off";
+
+
+static const int JOURNAL_START_SIZE = 16;	/**< Initial size of lists in Journal. */
+static const int JOURNAL_DELTA_SIZE = 8;	/**< Number of elements to extend by for lists in Journal. */
+
+
+/** Retrieves the given named stream. Dotted-decimal notation may be used to get sub streams.
+ ** If the stream does not exists, a new stream is created from the parent stream.
+ **/
+Stream* Journal_GetNamedStream( Stream* typedStream, Name name );
+
+
+Journal* Journal_New()
+{
+	Journal* self = Memory_Alloc( Journal, "Singleton" );
+	
+	self->_files = Stg_ObjectList_New2( JOURNAL_START_SIZE, JOURNAL_DELTA_SIZE );
+	self->_typedStreams = Stg_ObjectList_New2( JOURNAL_START_SIZE, JOURNAL_DELTA_SIZE );
+	self->enable = True;
+
+	/** Initialise default files. */
+	self->stdOut = CFile_New();
+	self->stdOut->fileHandle = stdout;
+	self->stdOut->_opened = True;
+	
+	self->stdErr = CFile_New();
+	self->stdErr->fileHandle = stderr;
+	self->stdErr->_opened = True;
+	
+	self->firewallProducesAssert = True;
+
+	self->flushCount = 0;
+	
+	return self;
+}
+
+void Journal_Delete() {
+	Stg_Class_Delete( stJournal->stdOut );
+	Stg_Class_Delete( stJournal->stdErr );
+	
+	Journal_Purge();
+	Stg_Class_Delete( stJournal->_typedStreams );
+	Stg_Class_Delete( stJournal->_files );
+	
+	Memory_Free( stJournal );
+}
+
+void Journal_Purge() {
+	Index i;
+	
+	Stg_ObjectList_DeleteAllObjects( stJournal->_typedStreams );
+
+	for ( i = 0; i < stJournal->_files->count; ++i ) {
+		if ( !JournalFile_Close( (JournalFile*) stJournal->_files->data[i] ) ) {
+			/* TODO: warning can't close */
+		}
+	}
+	Stg_ObjectList_DeleteAllObjects( stJournal->_files );
+}
+
+void Journal_ReadFromDictionary( Dictionary* dictionary )
+{
+	Dictionary_Index index;
+
+	Stream* stream = NULL; /* The stream which the operation will be applied to. */
+	
+	char* keyCopy;	
+	char* typedToken;
+	char* namedToken;
+	
+	char* operation;
+				
+	Bool valid;
+	
+	/* Iterate through the whole dictionary, checking for journal related commands */
+	for ( index = 0; index < dictionary->count; ++index )
+	{
+		/* Check to see if it is a journal operation by searching for the JOURNAL_KEY. */
+		if ( (0 == strncasecmp( dictionary->entryPtr[index]->key, JOURNAL_KEY, strlen(JOURNAL_KEY))) )
+		{
+			valid = True;
+
+			/* Make copy to tokenise so original contents will not be destroyed */
+			keyCopy = StG_Strdup( dictionary->entryPtr[index]->key );
+			
+			/* The first token determines the operation to perform. */
+			operation = strtok( keyCopy, JOURNAL_DELIMITER );
+			
+			typedToken = strtok( NULL, JOURNAL_DELIMITER );
+			namedToken = strtok( NULL, "" );
+				
+			if ( strcmp( operation, JOURNAL_ENABLE_KEY ) == 0 )
+			{
+				/* Enable function */
+				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
+				
+				if ( typedToken == NULL )
+				{
+					/* no more tokens, set the entire journal */
+					stJournal->enable = enable;
+				}
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						/* no more tokens, set the entire type */
+						Journal_Enable_TypedStream( typedToken, enable );
+					}
+					else
+					{
+						Journal_Enable_NamedStream( typedToken, namedToken, enable );
+					}
+				}
+				
+			} /* END Enable function */
+			if ( strcmp( operation, JOURNAL_ENABLE_BRANCH_KEY ) == 0 )
+			{
+				Stream* branchStream;
+				/* Enable function */
+				Bool enable = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
+		
+				assert( typedToken );
+				if ( namedToken == NULL ) {
+					branchStream = Journal_GetTypedStream( typedToken );
+				}
+				else {
+					branchStream = Journal_Register( typedToken, namedToken );
+				}
+				Stream_EnableBranch( branchStream, enable );
+				
+			} /* END Enable function */
+			else if ( strcmp( operation, JOURNAL_LEVEL_KEY ) == 0 )
+			{
+				/* Set level function */
+				JournalLevel level;
+				
+				level = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
+				
+				if ( typedToken == NULL )
+				{
+					printf( "Warning - Can only change level for typed and named streams.\n" );
+				}
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						stream = Journal_GetTypedStream( typedToken );
+					}
+					else
+					{
+						stream = Journal_Register( typedToken, namedToken );
+					}
+					Stream_SetLevel( stream, level );
+				}
+			} /* END SetLevel function */
+			else if ( strcmp( operation, JOURNAL_LEVEL_BRANCH_KEY ) == 0 )
+			{
+				/* Set level function */
+				JournalLevel level;
+				
+				level = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
+				
+				if ( typedToken == NULL )
+				{
+					printf( "Warning - Can only change level for typed and named streams.\n" );
+				}
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						stream = Journal_GetTypedStream( typedToken );
+					}
+					else
+					{
+						stream = Journal_Register( typedToken, namedToken );
+					}
+					Stream_SetLevelBranch( stream, level );
+				}
+			} /* END SetLevelBranch function */
+			else if ( strcmp( operation, JOURNAL_FILE_KEY ) == 0 )
+			{
+				/* Set file destination function */
+				JournalFile* file = NULL;
+				char* fileName = Dictionary_Entry_Value_AsString( dictionary->entryPtr[index]->value );
+				
+				if ( typedToken == NULL )
+				{
+					printf( "Warning - Can only change files for typed and named streams.\n" );
+				}
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						/* setting file for typed stream */
+						stream = Journal_GetTypedStream( typedToken );
+					}
+					else
+					{
+						stream = Journal_Register( typedToken, namedToken );
+					}
+					
+					file = Journal_GetFile( fileName );
+					if ( file == NULL )
+					{
+						file = stream->defaultFileType();
+						if ( JournalFile_Open( file, fileName ) ) {
+							Journal_RegisterFile( file );
+						}
+						else {
+							/* error/warning */
+						}
+					}
+					if ( !Stream_SetFile( stream, file ) )
+					{
+						/* file is not valid */
+					}
+				}
+			} /* END File function */
+			else if ( strcmp( operation, JOURNAL_RANK_KEY ) == 0 )
+			{
+				int rank;
+
+				rank = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
+
+				if ( typedToken == NULL )
+				{
+					printf( "Warning - Can only set printing rank for typed and named streams.\n" );
+				}
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						stream = Journal_GetTypedStream( typedToken );
+					}
+					else
+					{
+						stream = Journal_Register( typedToken, namedToken );
+					}
+					Stream_SetPrintingRank( stream, rank );
+				}
+			} /* END Printing Rank funciton. */
+			else if ( strcmp( operation, JOURNAL_FLUSH_KEY ) == 0 )
+			{
+				Bool flush = Dictionary_Entry_Value_AsBool( dictionary->entryPtr[index]->value );
+
+				if ( typedToken == NULL )
+				{
+					printf( "Warning - Can only set auto-flush for typed and named streams.\n" );
+				}
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						stream = Journal_GetTypedStream( typedToken );
+					}
+					else
+					{
+						stream = Journal_Register( typedToken, namedToken );
+					}
+
+					Stream_SetAutoFlush( stream, flush );
+				}
+			}
+			else if ( strcmp( operation, JOURNAL_MPI_OFFSET_KEY ) == 0 )
+			{
+				MPI_Offset offset = Dictionary_Entry_Value_AsUnsignedInt( dictionary->entryPtr[index]->value );
+
+				if ( typedToken == NULL ) 
+				{
+					printf( "Warning - Can only set mpi-offset for typed and named streams.\n" );
+				}	
+				else
+				{
+					if ( namedToken == NULL )
+					{
+						stream = Journal_GetTypedStream( typedToken );
+					}
+					else
+					{
+						stream = Journal_Register( typedToken, namedToken );
+					}
+
+					if ( ! MPIStream_SetOffset( stream, offset, MPI_COMM_WORLD ) )
+					{
+						printf( "Warning - Failed to set mpi-offset for %s", typedToken );
+						if ( namedToken )
+						{
+							printf( ".%s", namedToken );
+						}
+						printf( "\n" );
+					}	
+				}
+			}	
+			
+			Memory_Free( keyCopy );
+		}	
+	}
+}
+
+void Journal_RegisterTypedStream( Stream* typedStream )
+{
+	/* check exists and update */
+	Stg_ObjectList_Append( stJournal->_typedStreams, typedStream );
+}
+
+Stream* Journal_GetTypedStream( const Type type )
+{
+	Stream* typedStream = NULL;
+
+	typedStream = (Stream*)Stg_ObjectList_Get( stJournal->_typedStreams, (Name)type );	
+	if ( typedStream == NULL )
+	{
+		/* Make a default stream for this name. */
+		typedStream = CStream_New( type );
+		Stream_Enable( typedStream, False );
+		Stream_SetLevel( typedStream, 1 );
+		Stream_SetFile( typedStream, stJournal->stdOut );
+
+		Journal_RegisterTypedStream( typedStream );
+	}
+	
+	return typedStream;
+}
+
+Stream* Journal_GetNamedStream( Stream* typedStream, Name name )
+{
+	Stream* currentStream ;
+	char* nameCopy;
+	char* token;
+	
+	currentStream = typedStream;
+	nameCopy = StG_Strdup( name );
+	
+	
+	token = strtok( nameCopy, JOURNAL_DELIMITER );
+	while ( token != NULL )
+	{
+		currentStream = Stream_RegisterChild( currentStream, token );
+		token = strtok( NULL, JOURNAL_DELIMITER );
+	}
+	
+	Memory_Free( nameCopy );
+	
+	if ( currentStream == typedStream )
+	{
+		return NULL;
+	}
+	
+	return currentStream;
+}
+
+Stream* Journal_Register( const Type type, Name name )
+{
+	Stream* typedStream = NULL;
+	Stream* namedStream = NULL;
+
+	typedStream = Journal_GetTypedStream( type );
+	namedStream = Journal_GetNamedStream( typedStream, name );	
+	
+	return namedStream;
+}
+
+Stream* Journal_Register2( const Type streamType, const Type componentType, Name componentName ) {
+	Stream* componentStream;
+	Stream* instanceStream;
+	componentStream = Journal_Register( streamType, componentType );
+	instanceStream = Stream_RegisterChild( componentStream, componentName );
+
+	return instanceStream;
+}
+
+JournalFile* Journal_GetFile( Name fileName )
+{
+	return (JournalFile*) Stg_ObjectList_Get( stJournal->_files, fileName );
+}
+
+
+void Journal_RegisterFile( JournalFile* newFile )
+{
+	if ( newFile == NULL )
+	{
+		/* Warning */
+		return;
+	}
+	Stg_ObjectList_Append( stJournal->_files, newFile );
+}
+
+void Journal_DeregisterFile( JournalFile* file )
+{
+	if ( file == NULL ) {
+		return;
+	}
+	Stg_ObjectList_Remove( stJournal->_files, file->name, KEEP );
+}
+
+void Journal_Enable_TypedStream( const Type type, Bool enable )
+{
+	Stream* typedStream = Journal_GetTypedStream( type );
+	Stream_Enable( typedStream, enable );
+}
+
+void Journal_Enable_AllTypedStream( Bool enable )
+{
+	Journal_Enable_TypedStream( Info_Type, enable );
+	Journal_Enable_TypedStream( Debug_Type, enable );
+	Journal_Enable_TypedStream( Dump_Type, enable );
+	Journal_Enable_TypedStream( Error_Type, enable );
+}
+
+void Journal_Enable_NamedStream( const Type type, Name name, Bool enable )
+{
+	Stream* stream = Journal_Register( type, name );
+	Stream_Enable( stream, enable );
+}
+
+void Journal_PrintConcise()
+{
+	Stream* stream;
+	Index i;
+	
+	if ( stJournal == NULL )
+	{
+		return;
+	}
+
+	stream = Journal_Register( Info_Type, "Journal" );
+
+	Journal_Printf( stream, "\nSummary of Journal and Stream Status:\n" );
+	Journal_Printf( stream, "Journal Enabled: %s\n", stJournal->enable ? "True" : "False" );
+	
+	Journal_Printf( stream, "Explanation of the following stream status printout:\n"
+		"The streams are organised hierarchically, as trees, according to the\n"
+		"purpose of the stream - the key stream types \"info\", \"debug\" and \"error\"\n"
+		"are at the top, with all other streams as their children.\n"
+		"We also display the status of each stream: the \"Enabled\" parameter, which can\n"
+		"be individually set from input files/command line, determines whether output sent\n"
+		"to a given stream will print or not. The \"Level\" parameter determines the level\n"
+		"of detail that it will output - 1 is the default, 4 means very verbose.\n"
+		"For full details on Journalling, go to https://csd.vpac.org/twiki/bin/view/Stgermain/Journal\n\n");
+
+	Journal_Printf( stream, "Typed Streams:\n" );
+	for ( i = 0; i < stJournal->_typedStreams->count; ++i )
+	{
+		Stream_PrintConcise( stJournal->_typedStreams->data[i], stream );
+	}
+	Journal_Printf( stream, "\n" );
+}
+
+int Journal_Printf( void* _stream, Name fmt, ... )
+{
+	int result;
+	Stream* stream = (Stream*)_stream;
+	
+	va_list ap;
+
+	if ( !stJournal->enable || !Stream_IsEnable( stream ) )
+	{
+		return 0;
+	}
+
+	va_start( ap, fmt );
+ 	
+	result = Stream_Printf( stream, fmt, ap );
+	
+	va_end(ap);
+	
+	return result;
+}
+
+int Journal_PrintfL( void* _stream, JournalLevel level, Name fmt, ... )
+{
+	int result;
+	Stream* stream = (Stream*)_stream;
+	
+	va_list ap;
+
+	if ( !stJournal->enable || !Stream_IsEnable( stream ) || !Stream_IsPrintableLevel( stream, level ) )
+	{
+		return 0;
+	}
+
+	va_start( ap, fmt );
+ 	
+	result = Stream_Printf( stream, fmt, ap );
+	
+	va_end(ap);
+	return result;
+}
+/*
+int Journal_Firewall_Func( int expression, char* expressionText, 
+	Name file, const char* func, int line, void* _stream, char* fmt, ... )
+*/
+int Journal_Firewall( int expression, void* _stream, Name fmt, ... )
+{
+	int result = 0;
+	Stream* stream = (Stream*)_stream;
+	int nProc = 0;
+
+	va_list ap;
+	
+	MPI_Comm_size( MPI_COMM_WORLD, &nProc );
+	
+	if ( expression )
+	{
+		/* Every thing is OK! Back to work as normal */
+		return 0;
+	}
+	
+	Stream_Enable( stream, True ); /* Enforce enabling of stream because we really do want to see this */
+
+	if ( stJournal->enable && Stream_IsEnable( stream ) )
+	{
+		va_start( ap, fmt );
+/*
+		Journal_Printf( stream, "Expression: %s\n", expressionText );
+		Journal_Printf( stream, "From File: %s\n", file );
+		Journal_Printf( stream, "     Function: %s\n", func );
+		Journal_Printf( stream, "     Line: %d\n", line );
+*/	
+		result = Stream_Printf( stream, fmt, ap );
+		Stream_Flush( stream );
+
+		va_end(ap);
+	}
+	
+	if ( stJournal->firewallProducesAssert == True ) {
+		/* Use pcu_assert, so that StGermain PCU tests can check that a Firewall
+		 * is correctly produced. */ 
+		pcu_assert( expression );
+	}
+	else {
+		/* TODO: Don't use FAILURE until Pat beef's up the test scripts to do .error checks
+			exit( EXIT_FAILURE );
+		*/
+
+		/* SGI MPI on the ess does not always print out everything before it exits
+		 To ensure all output is displayed before the program quits on firewall, sleep for one second
+		 Alan & Kath 20061006 */
+#ifndef NO_UNISTD
+		sleep( 1 );
+#endif
+		if ( nProc == 1 ) {
+			exit(EXIT_SUCCESS);
+		}
+		else {
+			MPI_Abort( MPI_COMM_WORLD, EXIT_SUCCESS );
+		}
+	}
+	
+	return result;	
+}
+
+SizeT Journal_Write( void* _stream, const void* data, SizeT elem_size, SizeT num_elems )
+{
+	Stream* stream = (Stream*)_stream;
+
+	return Stream_Write( stream, data, elem_size, num_elems );
+}
+
+Bool Journal_Dump( void* _stream, const void* data )
+{
+	Stream* stream = (Stream*)_stream;
+
+	return Stream_Dump( stream, data );
+}
+
+
+/* Only rank 0 will print to stream */
+int Journal_RPrintf ( void* _stream, Name const fmt, ... )
+{
+	Stream* stream = (Stream*)_stream;
+	int result, init_stream_rank;
+        va_list ap;
+
+        init_stream_rank = Stream_GetPrintingRank( stream );
+	Stream_SetPrintingRank( stream, 0 );
+
+        va_start( ap, fmt );
+
+        if ( !stJournal->enable || !Stream_IsEnable( stream ) )
+        {
+                return 0;
+        }
+
+        result = Stream_Printf( stream, fmt, ap );
+
+        va_end(ap);
+
+	Stream_SetPrintingRank( stream, init_stream_rank );
+        return result;
+}
+
+/* Only rank 0 will print to stream */
+int Journal_RPrintfL ( void* _stream, JournalLevel level, Name const fmt, ... )
+{
+        Stream* stream = (Stream*)_stream;
+        int result, init_stream_rank;
+        va_list ap;
+
+        init_stream_rank = Stream_GetPrintingRank( stream );
+        Stream_SetPrintingRank( stream, 0 );
+
+        va_start( ap, fmt );
+
+        if ( !stJournal->enable || !Stream_IsEnable( stream ) || !Stream_IsPrintableLevel( stream, level ) )
+        {
+                return 0;
+        }
+
+        result = Stream_Printf( stream, fmt, ap );
+
+        va_end(ap);
+
+        Stream_SetPrintingRank( stream, init_stream_rank );
+        return result;
+}
+
+
+void Journal_SetupDefaultTypedStreams() {
+	Stream* typedStream;
+
+	/* info */
+	typedStream = CStream_New( Info_Type );
+	Stream_Enable( typedStream, False );
+	Stream_SetLevel( typedStream, 1 );
+	Stream_SetFile( typedStream, stJournal->stdOut );
+	Stream_SetAutoFlush( typedStream, True );
+	Journal_RegisterTypedStream( typedStream );
+	/* Default when registering a Journal stream is to have it print from Rank 0 only) */
+	Stream_SetPrintingRank( typedStream, 0);
+
+	/* debug */
+	typedStream = CStream_New( Debug_Type );
+	Stream_Enable( typedStream, False );
+	Stream_SetLevel( typedStream, 1 );
+	Stream_SetFile( typedStream, stJournal->stdOut );
+	Stream_SetAutoFlush( typedStream, True );
+	Stream_AddFormatter( typedStream, RankFormatter_New() );
+	Journal_RegisterTypedStream( typedStream );
+	/* Default when registering a Journal stream is to have it print from Rank 0 only) */
+	Stream_SetPrintingRank( typedStream, 0);
+	
+	/* dump */
+	typedStream = CStream_New( Dump_Type );
+	Stream_Enable( typedStream, False );
+	Stream_SetLevel( typedStream, 1 );
+	Stream_SetFile( typedStream, stJournal->stdOut );
+	Journal_RegisterTypedStream( typedStream );
+	
+	/* error */
+	typedStream = CStream_New( Error_Type );
+	Stream_Enable( typedStream, True );
+	Stream_SetLevel( typedStream, 1 );
+	Stream_SetFile( typedStream, stJournal->stdErr );
+	Stream_SetAutoFlush( typedStream, True );
+	Stream_AddFormatter( typedStream, RankFormatter_New() );
+	Journal_RegisterTypedStream( typedStream );
+	
+	/* mpi stream */
+	typedStream = MPIStream_New( MPIStream_Type );
+	Stream_Enable( typedStream, False );
+	Stream_SetLevel( typedStream, 1 );
+	Journal_RegisterTypedStream( typedStream );
+	/* MPI Streams need to print from all ranks */
+
+	/* binary stream */
+	typedStream = BinaryStream_New( BinaryStream_Type );
+	Stream_Enable( typedStream, False );
+	Stream_SetLevel( typedStream, 1 );
+	Journal_RegisterTypedStream( typedStream );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/JournalFile.c
--- a/Base/IO/src/JournalFile.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: JournalFile.c 3573 2006-05-15 07:51:14Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "JournalFile.h"
-#include "Journal.h"
-#include "Stream.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type JournalFile_Type = "JournalFile";
-
-
-JournalFile* _JournalFile_New(  JOURNALFILE_DEFARGS  )
-{
-	JournalFile* self;
-	
-	assert( _sizeOfSelf >= sizeof(JournalFile) );
-	self = (JournalFile*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	_JournalFile_Init( self, _open, _append, _close, _flush );
-	
-	return self;
-}
-	
-void _JournalFile_Init(
-	JournalFile*			self,
-	JournalFile_OpenFunction*	_open,
-	JournalFile_AppendFunction*	_append,
-	JournalFile_CloseFunction*	_close,
-	JournalFile_FlushFunction*	_flush )
-{
-	_Stg_Object_Init( (Stg_Object*)self, "", NON_GLOBAL );
-	
-	self->_open = _open;
-	self->_append = _append;
-	self->_close = _close;
-	self->_flush = _flush;
-	
-	self->fileHandle = NULL;
-	self->_opened = False;
-}
-
-void _JournalFile_Delete( void* journalFile )
-{
-   /* Close if opened */
-   JournalFile_Close( journalFile );
-	_Stg_Object_Delete( journalFile );
-}
-void _JournalFile_Print( void* journalFile, Stream* stream )
-{
-	JournalFile* self = (JournalFile*)journalFile;
-                                                                                
-        Journal_Printf( stream, "JournalFile (ptr): %p\n", self );
-         
-        _Stg_Object_Print( self, stream );
-         
-        Journal_Printf( stream, "\tfileHandle (ptr): %p\n", self->fileHandle );
-}
-
-Bool JournalFile_Open( void* file, const Name fileName )
-{
-	JournalFile* self = (JournalFile*)file;
-	
-	Bool result = self->_open( self, fileName );
-	
-	if ( result )
-	{
-		/* File opened, set the name. */
-		Stg_Object_SetName( self, fileName );
-		self->_opened = True;
-	}
-	
-	return result;
-}
-Bool JournalFile_Reopen( void* journalFile ) {
-	JournalFile* self = (JournalFile*)journalFile;
-
-	Bool result;
-
-	if ( self->_opened ) {
-		return True;
-	}
-	result = self->_open( self, self->name );
-	if ( result ) {
-		self->_opened = True;
-	}
-	return result;
-}
-
-Bool JournalFile_Append( void* file, const Name fileName ) {
-	JournalFile* self = (JournalFile*)file;
-	
-	Bool result = self->_append( self, fileName );
-	
-	if ( result )
-	{
-		/* File opened, set the name. */
-		Stg_Object_SetName( self, fileName );
-		self->_opened = True;
-	}
-	
-	return result;
-}
-Bool JournalFile_Close( void* file )
-{
-	JournalFile* self = (JournalFile*)file;
-	Bool result = False;
-	if ( self->_opened ) {
-		result = self->_close( file );
-		if ( result ) {
-			self->_opened = False;
-		}
-	}
-	return result;
-}
-Bool JournalFile_IsOpened( void* journalFile ) {
-	JournalFile* self = (JournalFile*)journalFile;
-	return self->_opened;
-}
-
-Bool JournalFile_Flush( void* file )
-{
-	JournalFile* self = (JournalFile*)file;
-	stJournal->flushCount++;
-	return self->_flush( self );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/JournalFile.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/JournalFile.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,162 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: JournalFile.c 3573 2006-05-15 07:51:14Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "JournalFile.h"
+#include "Journal.h"
+#include "Stream.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type JournalFile_Type = "JournalFile";
+
+
+JournalFile* _JournalFile_New(  JOURNALFILE_DEFARGS  )
+{
+	JournalFile* self;
+	
+	assert( _sizeOfSelf >= sizeof(JournalFile) );
+	self = (JournalFile*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	_JournalFile_Init( self, _open, _append, _close, _flush );
+	
+	return self;
+}
+	
+void _JournalFile_Init(
+	JournalFile*			self,
+	JournalFile_OpenFunction*	_open,
+	JournalFile_AppendFunction*	_append,
+	JournalFile_CloseFunction*	_close,
+	JournalFile_FlushFunction*	_flush )
+{
+	_Stg_Object_Init( (Stg_Object*)self, "", NON_GLOBAL );
+	
+	self->_open = _open;
+	self->_append = _append;
+	self->_close = _close;
+	self->_flush = _flush;
+	
+	self->fileHandle = NULL;
+	self->_opened = False;
+}
+
+void _JournalFile_Delete( void* journalFile )
+{
+   /* Close if opened */
+   JournalFile_Close( journalFile );
+	_Stg_Object_Delete( journalFile );
+}
+void _JournalFile_Print( void* journalFile, Stream* stream )
+{
+	JournalFile* self = (JournalFile*)journalFile;
+                                                                                
+        Journal_Printf( stream, "JournalFile (ptr): %p\n", self );
+         
+        _Stg_Object_Print( self, stream );
+         
+        Journal_Printf( stream, "\tfileHandle (ptr): %p\n", self->fileHandle );
+}
+
+Bool JournalFile_Open( void* file, const Name fileName )
+{
+	JournalFile* self = (JournalFile*)file;
+	
+	Bool result = self->_open( self, fileName );
+	
+	if ( result )
+	{
+		/* File opened, set the name. */
+		Stg_Object_SetName( self, fileName );
+		self->_opened = True;
+	}
+	
+	return result;
+}
+Bool JournalFile_Reopen( void* journalFile ) {
+	JournalFile* self = (JournalFile*)journalFile;
+
+	Bool result;
+
+	if ( self->_opened ) {
+		return True;
+	}
+	result = self->_open( self, self->name );
+	if ( result ) {
+		self->_opened = True;
+	}
+	return result;
+}
+
+Bool JournalFile_Append( void* file, const Name fileName ) {
+	JournalFile* self = (JournalFile*)file;
+	
+	Bool result = self->_append( self, fileName );
+	
+	if ( result )
+	{
+		/* File opened, set the name. */
+		Stg_Object_SetName( self, fileName );
+		self->_opened = True;
+	}
+	
+	return result;
+}
+Bool JournalFile_Close( void* file )
+{
+	JournalFile* self = (JournalFile*)file;
+	Bool result = False;
+	if ( self->_opened ) {
+		result = self->_close( file );
+		if ( result ) {
+			self->_opened = False;
+		}
+	}
+	return result;
+}
+Bool JournalFile_IsOpened( void* journalFile ) {
+	JournalFile* self = (JournalFile*)journalFile;
+	return self->_opened;
+}
+
+Bool JournalFile_Flush( void* file )
+{
+	JournalFile* self = (JournalFile*)file;
+	stJournal->flushCount++;
+	return self->_flush( self );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/LineFormatter.c
--- a/Base/IO/src/LineFormatter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: LineFormatter.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "StreamFormatter.h"
-#include "LineFormatter.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <mpi.h>
-#include <stdarg.h>  
-
-
-const Type LineFormatter_Type = "LineFormatter";
-
-LineFormatter* _LineFormatter_New(  LINEFORMATTER_DEFARGS  )
-{
-	LineFormatter* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(LineFormatter) );
-	self = (LineFormatter*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-                                                                                
-	_LineFormatter_Init( self, _format );
-
-	return self;
-}
-
-void _LineFormatter_Init(
-	LineFormatter*			self,
-	StreamFormatter_FormatFunction*	_format )
-{
-	_StreamFormatter_Init( (StreamFormatter*)self, _format );
-	self->_newLine = True;
-	self->_tag = NULL;
-}
-
-void _LineFormatter_Delete( void* formatter )
-{
-	LineFormatter* self = (LineFormatter*)formatter;
-	
-	#if DEBUG
-		assert( self );
-	#endif
-
-	if ( self->_tag != NULL )
-	{
-		Memory_Free( self->_tag );
-	}
-
-	/* Stg_Class_Delete parent */
-	_StreamFormatter_Delete( self );
-}
-void _LineFormatter_Print( void* formatter, Stream* stream )
-{
-	LineFormatter* self = (LineFormatter*) formatter;
-
-	#if DEBUG
-		assert( self );
-		assert (stream);
-	#endif
-	
-	/* General info */
-	printf( "LineFormatter (ptr): %p\n", formatter );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-	
-	/* print _newLine and _tag */
-}
-
-void* _LineFormatter_Copy( const void* lineFormatter, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	LineFormatter*	self = (LineFormatter*)lineFormatter;
-	LineFormatter*	newLineFormatter;
-	
-	/* Create new instance. Copy virtual info */
-	newLineFormatter = (LineFormatter*)_StreamFormatter_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	/* Copy member info. */
-	newLineFormatter->_newLine = self->_newLine;
-	if ( self->_tag != NULL ) {
-		newLineFormatter->_tag = StG_Strdup( self->_tag );
-	}
-	else {
-		newLineFormatter->_tag = NULL;
-	}
-	
-	return newLineFormatter;
-}
-
-Name _LineFormatter_Format( void* formatter, const char* fmt )
-{
-	LineFormatter* self = (LineFormatter*)formatter;
-	char* result;
-	Name currentLine;
-	int numInsert;
-	int fmtLength;
-	int prependLength;
-	int newLength;
-
-			
-	char* destPtr;
-	Name srcPtr;
-		
-	#if DEBUG
-		assert( self );
-	#endif
-
-	if ( self->_tag == NULL )
-	{
-		/* No tag to add, so return same format */
-		return fmt;
-	}
-
-	/* count number of inserts */
-	numInsert = 0;
-	currentLine = strchr( fmt, '\n' );
-	while ( currentLine != NULL )
-	{
-		numInsert++;	
-		currentLine = strchr( currentLine + 1, '\n' );
-	}
-	if ( self->_newLine )
-	{
-		numInsert++;
-	}
-	
-	fmtLength = strlen( fmt );
-	if ( fmtLength > 0 && fmt[fmtLength - 1] == '\n' )
-	{
-		numInsert--;
-	}
-
-	prependLength = strlen( self->_tag );
-	
-	/* Calculate length of new string */
-	if ( numInsert > 0 )
-	{
-		newLength = fmtLength + ( prependLength * numInsert );
-	}
-	else
-	{
-		newLength = fmtLength;
-	}
-	
-/*	result = Memory_Alloc_Array( char, newLength + 1, Memory_IgnoreName );*/
-	result = StreamFormatter_Buffer_AllocNext( newLength + 1 );
-	
-	destPtr = result;
-	srcPtr = fmt;
-	
-	/* If we were upto a new line, begin with a prepend. */
-	if ( self->_newLine )
-	{
-		sprintf( destPtr, "%s", self->_tag );
-		destPtr += prependLength;
-	}
-	
-	self->_newLine = False;
-	
-	while ( *srcPtr != '\0' )
-	{
-		*destPtr = *srcPtr;
-		
-		destPtr++;
-		
-		if ( *srcPtr == '\n' )
-		{
-			/* if not the last endline */
-			if ( (srcPtr - fmt) != (fmtLength - 1) )
-			{
-				sprintf( destPtr, "%s", self->_tag );
-				destPtr += prependLength;
-			}
-			else
-			{
-				/* If we are at the last line, and it was a new line, prepend the next time this is called. */
-				self->_newLine = True;
-			}
-		}
-		srcPtr++;
-	}
-	*destPtr = '\0';
-	
-	return result;	
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/LineFormatter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/LineFormatter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,222 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: LineFormatter.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "StreamFormatter.h"
+#include "LineFormatter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <mpi.h>
+#include <stdarg.h>  
+
+
+const Type LineFormatter_Type = "LineFormatter";
+
+LineFormatter* _LineFormatter_New(  LINEFORMATTER_DEFARGS  )
+{
+	LineFormatter* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(LineFormatter) );
+	self = (LineFormatter*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+                                                                                
+	_LineFormatter_Init( self, _format );
+
+	return self;
+}
+
+void _LineFormatter_Init(
+	LineFormatter*			self,
+	StreamFormatter_FormatFunction*	_format )
+{
+	_StreamFormatter_Init( (StreamFormatter*)self, _format );
+	self->_newLine = True;
+	self->_tag = NULL;
+}
+
+void _LineFormatter_Delete( void* formatter )
+{
+	LineFormatter* self = (LineFormatter*)formatter;
+	
+	#if DEBUG
+		assert( self );
+	#endif
+
+	if ( self->_tag != NULL )
+	{
+		Memory_Free( self->_tag );
+	}
+
+	/* Stg_Class_Delete parent */
+	_StreamFormatter_Delete( self );
+}
+void _LineFormatter_Print( void* formatter, Stream* stream )
+{
+	LineFormatter* self = (LineFormatter*) formatter;
+
+	#if DEBUG
+		assert( self );
+		assert (stream);
+	#endif
+	
+	/* General info */
+	printf( "LineFormatter (ptr): %p\n", formatter );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+	
+	/* print _newLine and _tag */
+}
+
+void* _LineFormatter_Copy( const void* lineFormatter, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	LineFormatter*	self = (LineFormatter*)lineFormatter;
+	LineFormatter*	newLineFormatter;
+	
+	/* Create new instance. Copy virtual info */
+	newLineFormatter = (LineFormatter*)_StreamFormatter_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	/* Copy member info. */
+	newLineFormatter->_newLine = self->_newLine;
+	if ( self->_tag != NULL ) {
+		newLineFormatter->_tag = StG_Strdup( self->_tag );
+	}
+	else {
+		newLineFormatter->_tag = NULL;
+	}
+	
+	return newLineFormatter;
+}
+
+Name _LineFormatter_Format( void* formatter, const char* fmt )
+{
+	LineFormatter* self = (LineFormatter*)formatter;
+	char* result;
+	Name currentLine;
+	int numInsert;
+	int fmtLength;
+	int prependLength;
+	int newLength;
+
+			
+	char* destPtr;
+	Name srcPtr;
+		
+	#if DEBUG
+		assert( self );
+	#endif
+
+	if ( self->_tag == NULL )
+	{
+		/* No tag to add, so return same format */
+		return fmt;
+	}
+
+	/* count number of inserts */
+	numInsert = 0;
+	currentLine = strchr( fmt, '\n' );
+	while ( currentLine != NULL )
+	{
+		numInsert++;	
+		currentLine = strchr( currentLine + 1, '\n' );
+	}
+	if ( self->_newLine )
+	{
+		numInsert++;
+	}
+	
+	fmtLength = strlen( fmt );
+	if ( fmtLength > 0 && fmt[fmtLength - 1] == '\n' )
+	{
+		numInsert--;
+	}
+
+	prependLength = strlen( self->_tag );
+	
+	/* Calculate length of new string */
+	if ( numInsert > 0 )
+	{
+		newLength = fmtLength + ( prependLength * numInsert );
+	}
+	else
+	{
+		newLength = fmtLength;
+	}
+	
+/*	result = Memory_Alloc_Array( char, newLength + 1, Memory_IgnoreName );*/
+	result = StreamFormatter_Buffer_AllocNext( newLength + 1 );
+	
+	destPtr = result;
+	srcPtr = fmt;
+	
+	/* If we were upto a new line, begin with a prepend. */
+	if ( self->_newLine )
+	{
+		sprintf( destPtr, "%s", self->_tag );
+		destPtr += prependLength;
+	}
+	
+	self->_newLine = False;
+	
+	while ( *srcPtr != '\0' )
+	{
+		*destPtr = *srcPtr;
+		
+		destPtr++;
+		
+		if ( *srcPtr == '\n' )
+		{
+			/* if not the last endline */
+			if ( (srcPtr - fmt) != (fmtLength - 1) )
+			{
+				sprintf( destPtr, "%s", self->_tag );
+				destPtr += prependLength;
+			}
+			else
+			{
+				/* If we are at the last line, and it was a new line, prepend the next time this is called. */
+				self->_newLine = True;
+			}
+		}
+		srcPtr++;
+	}
+	*destPtr = '\0';
+	
+	return result;	
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/MPIFile.c
--- a/Base/IO/src/MPIFile.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MPIFile.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "JournalFile.h"
-#include "MPIFile.h"
-#include "Stream.h"
-#include "Journal.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-const Type MPIFile_Type = "MPIFile";
-
-
-JournalFile* MPIFile_New()
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(MPIFile);
-	Type                              type = MPIFile_Type;
-	Stg_Class_DeleteFunction*      _delete = _MPIFile_Delete;
-	Stg_Class_PrintFunction*        _print = _MPIFile_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-	return (JournalFile*)_MPIFile_New(  MPIFILE_PASSARGS  );
-}
-
-JournalFile* MPIFile_New2( const Name fileName )
-{
-	JournalFile* result = MPIFile_New();
-
-	if ( !JournalFile_Open( result, fileName ) )
-	{
-		/* File could not be opened successfully. Return cleanly. */
-		Stg_Class_Delete( result );
-		result = NULL;
-	}
-	
-	return result;
-}
-
-MPIFile* _MPIFile_New(  MPIFILE_DEFARGS  )
-{
-	MPIFile* self;
-	
-	self = (MPIFile*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-	
-	_MPIFile_Init( self );
-	
-	return self;
-}
-	
-void MPIFile_Init( MPIFile* self )
-{
-	/* Set virtual info. */
-	self->_sizeOfSelf = sizeof(MPIFile);
-	self->type = MPIFile_Type;
-	self->_delete = _MPIFile_Delete;
-	self->_print = _MPIFile_Print;
-	self->_copy = NULL;
-	
-	_MPIFile_Init( self );
-}
-	
-void _MPIFile_Init( MPIFile* self )
-{
-	_JournalFile_Init( (JournalFile*)self, _MPIFile_Open, _MPIFile_Append, _MPIFile_Close, _MPIFile_Flush );
-}
-	
-void _MPIFile_Delete( void* cfile )
-{
-	MPIFile* self = (MPIFile*)cfile;
-	
-	_JournalFile_Delete( self );
-}
-void _MPIFile_Print( void* cfile, Stream* stream )
-{
-	MPIFile* self = (MPIFile*)cfile;
-	
-	_JournalFile_Print( self, stream );
-}
-
-	
-Bool _MPIFile_Open( void* file, Name const fileName )
-{
-	MPIFile*   self = (MPIFile*) file;
-	int        fileOpenResult = 0;
-
-	/* Remove the file */
-        remove( fileName );
-
-	fileOpenResult = MPI_File_open( MPI_COMM_WORLD, (char*)fileName,
-				MPI_MODE_CREATE | MPI_MODE_WRONLY | MPI_MODE_EXCL, 
-				MPI_INFO_NULL, &(self->mpiFile) );
-
-	if (fileOpenResult != MPI_SUCCESS) {
-		char         errorString[2000];
-		int          errorStringLength = 0;
-		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
-		int          myRank = 0;
-
-		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
-		MPI_Error_string( fileOpenResult, errorString, &errorStringLength);
-		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
-		MPI_Abort(MPI_COMM_WORLD, fileOpenResult );
-	}
-
-	self->fileHandle = &(self->mpiFile);
-	return True;	
-}
-	
-Bool _MPIFile_Append( void* file, Name const fileName )
-{
-	MPIFile*   self = (MPIFile*) file;
-	int        fileOpenResult = 0;
-
-	fileOpenResult = MPI_File_open( MPI_COMM_WORLD, (char*)fileName, MPI_MODE_WRONLY, MPI_INFO_NULL,
-		&(self->mpiFile) );
-
-	if (fileOpenResult != MPI_SUCCESS) {
-		char         errorString[2000];
-		int          errorStringLength = 0;
-		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
-		int          myRank = 0;
-
-		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
-		MPI_Error_string( fileOpenResult, errorString, &errorStringLength);
-		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
-		MPI_Abort(MPI_COMM_WORLD, fileOpenResult );
-	}
-
-	self->fileHandle = &(self->mpiFile);
-	return True;	
-}
-
-
-Bool _MPIFile_Close( void* file )
-{
-	MPIFile* self = (MPIFile*) file;
-	
-	MPI_File_close( &(self->mpiFile) );
-	
-	return True;
-}
-
-Bool _MPIFile_Flush( void* file )
-{
-
-	/* No flush */
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/MPIFile.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/MPIFile.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,189 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MPIFile.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "JournalFile.h"
+#include "MPIFile.h"
+#include "Stream.h"
+#include "Journal.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+const Type MPIFile_Type = "MPIFile";
+
+
+JournalFile* MPIFile_New()
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(MPIFile);
+	Type                              type = MPIFile_Type;
+	Stg_Class_DeleteFunction*      _delete = _MPIFile_Delete;
+	Stg_Class_PrintFunction*        _print = _MPIFile_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+	return (JournalFile*)_MPIFile_New(  MPIFILE_PASSARGS  );
+}
+
+JournalFile* MPIFile_New2( const Name fileName )
+{
+	JournalFile* result = MPIFile_New();
+
+	if ( !JournalFile_Open( result, fileName ) )
+	{
+		/* File could not be opened successfully. Return cleanly. */
+		Stg_Class_Delete( result );
+		result = NULL;
+	}
+	
+	return result;
+}
+
+MPIFile* _MPIFile_New(  MPIFILE_DEFARGS  )
+{
+	MPIFile* self;
+	
+	self = (MPIFile*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+	
+	_MPIFile_Init( self );
+	
+	return self;
+}
+	
+void MPIFile_Init( MPIFile* self )
+{
+	/* Set virtual info. */
+	self->_sizeOfSelf = sizeof(MPIFile);
+	self->type = MPIFile_Type;
+	self->_delete = _MPIFile_Delete;
+	self->_print = _MPIFile_Print;
+	self->_copy = NULL;
+	
+	_MPIFile_Init( self );
+}
+	
+void _MPIFile_Init( MPIFile* self )
+{
+	_JournalFile_Init( (JournalFile*)self, _MPIFile_Open, _MPIFile_Append, _MPIFile_Close, _MPIFile_Flush );
+}
+	
+void _MPIFile_Delete( void* cfile )
+{
+	MPIFile* self = (MPIFile*)cfile;
+	
+	_JournalFile_Delete( self );
+}
+void _MPIFile_Print( void* cfile, Stream* stream )
+{
+	MPIFile* self = (MPIFile*)cfile;
+	
+	_JournalFile_Print( self, stream );
+}
+
+	
+Bool _MPIFile_Open( void* file, Name const fileName )
+{
+	MPIFile*   self = (MPIFile*) file;
+	int        fileOpenResult = 0;
+
+	/* Remove the file */
+        remove( fileName );
+
+	fileOpenResult = MPI_File_open( MPI_COMM_WORLD, (char*)fileName,
+				MPI_MODE_CREATE | MPI_MODE_WRONLY | MPI_MODE_EXCL, 
+				MPI_INFO_NULL, &(self->mpiFile) );
+
+	if (fileOpenResult != MPI_SUCCESS) {
+		char         errorString[2000];
+		int          errorStringLength = 0;
+		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
+		int          myRank = 0;
+
+		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
+		MPI_Error_string( fileOpenResult, errorString, &errorStringLength);
+		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
+		MPI_Abort(MPI_COMM_WORLD, fileOpenResult );
+	}
+
+	self->fileHandle = &(self->mpiFile);
+	return True;	
+}
+	
+Bool _MPIFile_Append( void* file, Name const fileName )
+{
+	MPIFile*   self = (MPIFile*) file;
+	int        fileOpenResult = 0;
+
+	fileOpenResult = MPI_File_open( MPI_COMM_WORLD, (char*)fileName, MPI_MODE_WRONLY, MPI_INFO_NULL,
+		&(self->mpiFile) );
+
+	if (fileOpenResult != MPI_SUCCESS) {
+		char         errorString[2000];
+		int          errorStringLength = 0;
+		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
+		int          myRank = 0;
+
+		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
+		MPI_Error_string( fileOpenResult, errorString, &errorStringLength);
+		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
+		MPI_Abort(MPI_COMM_WORLD, fileOpenResult );
+	}
+
+	self->fileHandle = &(self->mpiFile);
+	return True;	
+}
+
+
+Bool _MPIFile_Close( void* file )
+{
+	MPIFile* self = (MPIFile*) file;
+	
+	MPI_File_close( &(self->mpiFile) );
+	
+	return True;
+}
+
+Bool _MPIFile_Flush( void* file )
+{
+
+	/* No flush */
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/MPIStream.c
--- a/Base/IO/src/MPIStream.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: MPIStream.c 2807 2005-03-17 00:24:43Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "JournalFile.h"
-#include "MPIFile.h"
-#include "Stream.h"
-#include "MPIStream.h"
-
-#include "Base/IO/mpirecord/mpimessaging.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <stdarg.h>   /* Subsequent files need this for variable argument lists. */
-
-#include "Journal.h"
-
-
-const Type MPIStream_Type = "MPIStream";
-
-
-Stream* MPIStream_New( Name name )
-{
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(MPIStream);
-	Type                              type = MPIStream_Type;
-	Stg_Class_DeleteFunction*      _delete = _MPIStream_Delete;
-	Stg_Class_PrintFunction*        _print = _MPIStream_Print;
-	Stg_Class_CopyFunction*          _copy = _Stream_Copy;
-	Stream_PrintfFunction*         _printf = _MPIStream_Printf;
-	Stream_WriteFunction*           _write = _MPIStream_Write;
-	Stream_DumpFunction*             _dump = _MPIStream_Dump;
-	Stream_SetFileFunction*       _setFile = _MPIStream_SetFile;
-
-	return (Stream*)_MPIStream_New(  MPISTREAM_PASSARGS  );
-}
-
-void MPIStream_Init( MPIStream* self, Name name )
-{
-	
-}
-
-
-MPIStream* _MPIStream_New(  MPISTREAM_DEFARGS  )
-{
-	MPIStream* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(MPIStream) );
-	self = (MPIStream*)_Stream_New(  STREAM_PASSARGS  );
-	
-	_MPIStream_Init( self );
-	
-	return self;
-}
-
-void _MPIStream_Init( MPIStream* self )
-{
-	self->defaultFileType = MPIFile_New;
-}
-	
-void _MPIStream_Delete( void* cStream )
-{
-	MPIStream* self = (MPIStream*)cStream;
-	
-	/* Stg_Class_Delete parent */
-	_Stream_Delete( self );
-}
-
-void _MPIStream_Print( void* mpiStream, Stream* stream ) {
-
-	MPIStream* self = (MPIStream*)mpiStream;
-	
-	/* General info */
-	Journal_Printf( stream, "MPIStream (ptr): %p\n", mpiStream );
-	
-	/* Print parent */
-	_Stream_Print( self, stream );
-		
-}
-	
-SizeT _MPIStream_Printf( Stream* stream, const char *fmt, va_list args )
-{
-	MPIStream* self = (MPIStream*)stream;
-	MPI_Status status;
-	char* buffer;
-	SizeT numChars;
-	int   writeResult;
-	
-	if ( self->_file == NULL )
-	{
-		return 0;
-	}
-
-	numChars = Stg_vasprintf( &buffer, fmt, args );
-
-	writeResult = MPI_File_write( *(MPI_File*)(self->_file->fileHandle), buffer, numChars, MPI_BYTE, &status );
-
-	if (writeResult != MPI_SUCCESS) {
-		char         errorString[2000];
-		int          errorStringLength = 0;
-		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
-		int          myRank = 0;
-
-		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
-		MPI_Error_string( writeResult, errorString, &errorStringLength);
-		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
-		JournalFile_Close( self->_file );
-		MPI_Abort(MPI_COMM_WORLD, writeResult );
-	}
-
-	Memory_Free( buffer );
-	
-	return 0;
-}
-	
-SizeT _MPIStream_Write( Stream* stream, const void *data, SizeT elem_size, SizeT num_elems )
-{
-	MPIStream* self = (MPIStream*)stream;
-	MPI_Status status;
-	int   writeResult;
-	
-	writeResult = MPI_File_write( *(MPI_File*)(self->_file->fileHandle), (void*)data, num_elems * elem_size,
-		 			MPI_BYTE, &status );
-
-	if (writeResult != MPI_SUCCESS) {
-		char         errorString[2000];
-		int          errorStringLength = 0;
-		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
-		int          myRank = 0;
-
-		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
-		MPI_Error_string( writeResult, errorString, &errorStringLength);
-		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
-		JournalFile_Close( self->_file );
-		MPI_Abort(MPI_COMM_WORLD, writeResult );
-	}
-
-	return num_elems;
-}
-	
-Bool _MPIStream_Dump( Stream* stream, const void *data )
-{
-	/* No specific dumping mechanism, can create in derived classes */
-	return False;
-}
-
-Bool _MPIStream_SetFile( Stream* stream, JournalFile* file )
-{
-	if ( file->type == MPIFile_Type )
-	{
-		stream->_file = file;
-		return True;
-	}
-	return False;
-}
-
-#define MPIStream_OffsetTag 167
-
-Bool MPIStream_SetOffset( Stream* stream, SizeT sizeToWrite, MPI_Comm communicator ) {
-	MPI_Offset    offset    = 0;
-	int           rank;
-	int           nproc;
-	unsigned int  localSizeToWrite;
-	unsigned int  sizePartialSum;
-	
-	if ( stream->_file == NULL ) {
-		return False;
-	}
-
-	if ( stream->_file->type != MPIFile_Type ) {
-		return False;
-	}
-	
-	MPI_Comm_rank( communicator, &rank );
-	MPI_Comm_size( communicator, &nproc );
-
-	/* Sum up the individual sizeToWrites for processors lower than this one */
-	localSizeToWrite = sizeToWrite;
-	MPI_Scan( &localSizeToWrite, &sizePartialSum, 1, MPI_UNSIGNED, MPI_SUM, communicator ); 
-	/* Now, just subtract the sizeToWrite of current processor to get our start point */
-	offset = sizePartialSum - localSizeToWrite;
-	
-	MPI_File_seek( *(MPI_File*)stream->_file->fileHandle, offset, MPI_SEEK_SET ); 
-	
-	return True;
-}
-
-SizeT MPIStream_WriteAllProcessors( Stream* stream, void *data, SizeT elem_size, SizeT num_elems, MPI_Comm communicator ) {
-	SizeT sizeToWrite = elem_size * num_elems;
-
-	MPIStream_SetOffset( stream, sizeToWrite, communicator );
-
-	return Stream_Write( stream, data, elem_size, num_elems );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/MPIStream.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/MPIStream.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,232 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: MPIStream.c 2807 2005-03-17 00:24:43Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "JournalFile.h"
+#include "MPIFile.h"
+#include "Stream.h"
+#include "MPIStream.h"
+
+#include "Base/IO/mpirecord/mpimessaging.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <stdarg.h>   /* Subsequent files need this for variable argument lists. */
+
+#include "Journal.h"
+
+
+const Type MPIStream_Type = "MPIStream";
+
+
+Stream* MPIStream_New( Name name )
+{
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(MPIStream);
+	Type                              type = MPIStream_Type;
+	Stg_Class_DeleteFunction*      _delete = _MPIStream_Delete;
+	Stg_Class_PrintFunction*        _print = _MPIStream_Print;
+	Stg_Class_CopyFunction*          _copy = _Stream_Copy;
+	Stream_PrintfFunction*         _printf = _MPIStream_Printf;
+	Stream_WriteFunction*           _write = _MPIStream_Write;
+	Stream_DumpFunction*             _dump = _MPIStream_Dump;
+	Stream_SetFileFunction*       _setFile = _MPIStream_SetFile;
+
+	return (Stream*)_MPIStream_New(  MPISTREAM_PASSARGS  );
+}
+
+void MPIStream_Init( MPIStream* self, Name name )
+{
+	
+}
+
+
+MPIStream* _MPIStream_New(  MPISTREAM_DEFARGS  )
+{
+	MPIStream* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(MPIStream) );
+	self = (MPIStream*)_Stream_New(  STREAM_PASSARGS  );
+	
+	_MPIStream_Init( self );
+	
+	return self;
+}
+
+void _MPIStream_Init( MPIStream* self )
+{
+	self->defaultFileType = MPIFile_New;
+}
+	
+void _MPIStream_Delete( void* cStream )
+{
+	MPIStream* self = (MPIStream*)cStream;
+	
+	/* Stg_Class_Delete parent */
+	_Stream_Delete( self );
+}
+
+void _MPIStream_Print( void* mpiStream, Stream* stream ) {
+
+	MPIStream* self = (MPIStream*)mpiStream;
+	
+	/* General info */
+	Journal_Printf( stream, "MPIStream (ptr): %p\n", mpiStream );
+	
+	/* Print parent */
+	_Stream_Print( self, stream );
+		
+}
+	
+SizeT _MPIStream_Printf( Stream* stream, const char *fmt, va_list args )
+{
+	MPIStream* self = (MPIStream*)stream;
+	MPI_Status status;
+	char* buffer;
+	SizeT numChars;
+	int   writeResult;
+	
+	if ( self->_file == NULL )
+	{
+		return 0;
+	}
+
+	numChars = Stg_vasprintf( &buffer, fmt, args );
+
+	writeResult = MPI_File_write( *(MPI_File*)(self->_file->fileHandle), buffer, numChars, MPI_BYTE, &status );
+
+	if (writeResult != MPI_SUCCESS) {
+		char         errorString[2000];
+		int          errorStringLength = 0;
+		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
+		int          myRank = 0;
+
+		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
+		MPI_Error_string( writeResult, errorString, &errorStringLength);
+		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
+		JournalFile_Close( self->_file );
+		MPI_Abort(MPI_COMM_WORLD, writeResult );
+	}
+
+	Memory_Free( buffer );
+	
+	return 0;
+}
+	
+SizeT _MPIStream_Write( Stream* stream, const void *data, SizeT elem_size, SizeT num_elems )
+{
+	MPIStream* self = (MPIStream*)stream;
+	MPI_Status status;
+	int   writeResult;
+	
+	writeResult = MPI_File_write( *(MPI_File*)(self->_file->fileHandle), (void*)data, num_elems * elem_size,
+		 			MPI_BYTE, &status );
+
+	if (writeResult != MPI_SUCCESS) {
+		char         errorString[2000];
+		int          errorStringLength = 0;
+		Stream*      errorStream = Journal_Register( Error_Type, MPIFile_Type );
+		int          myRank = 0;
+
+		MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
+		MPI_Error_string( writeResult, errorString, &errorStringLength);
+		Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
+		JournalFile_Close( self->_file );
+		MPI_Abort(MPI_COMM_WORLD, writeResult );
+	}
+
+	return num_elems;
+}
+	
+Bool _MPIStream_Dump( Stream* stream, const void *data )
+{
+	/* No specific dumping mechanism, can create in derived classes */
+	return False;
+}
+
+Bool _MPIStream_SetFile( Stream* stream, JournalFile* file )
+{
+	if ( file->type == MPIFile_Type )
+	{
+		stream->_file = file;
+		return True;
+	}
+	return False;
+}
+
+#define MPIStream_OffsetTag 167
+
+Bool MPIStream_SetOffset( Stream* stream, SizeT sizeToWrite, MPI_Comm communicator ) {
+	MPI_Offset    offset    = 0;
+	int           rank;
+	int           nproc;
+	unsigned int  localSizeToWrite;
+	unsigned int  sizePartialSum;
+	
+	if ( stream->_file == NULL ) {
+		return False;
+	}
+
+	if ( stream->_file->type != MPIFile_Type ) {
+		return False;
+	}
+	
+	MPI_Comm_rank( communicator, &rank );
+	MPI_Comm_size( communicator, &nproc );
+
+	/* Sum up the individual sizeToWrites for processors lower than this one */
+	localSizeToWrite = sizeToWrite;
+	MPI_Scan( &localSizeToWrite, &sizePartialSum, 1, MPI_UNSIGNED, MPI_SUM, communicator ); 
+	/* Now, just subtract the sizeToWrite of current processor to get our start point */
+	offset = sizePartialSum - localSizeToWrite;
+	
+	MPI_File_seek( *(MPI_File*)stream->_file->fileHandle, offset, MPI_SEEK_SET ); 
+	
+	return True;
+}
+
+SizeT MPIStream_WriteAllProcessors( Stream* stream, void *data, SizeT elem_size, SizeT num_elems, MPI_Comm communicator ) {
+	SizeT sizeToWrite = elem_size * num_elems;
+
+	MPIStream_SetOffset( stream, sizeToWrite, communicator );
+
+	return Stream_Write( stream, data, elem_size, num_elems );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/PathUtils.c
--- a/Base/IO/src/PathUtils.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <mpi.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "Base/Foundation/Foundation.h"
-#include <libxml/parserInternals.h>
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "Stream.h"
-
-#include "PathUtils.h"
-
-
-static Name      joiner = "/";
-
-
-void FindFile( char* fullPath, Name filename, const char* searchPaths ) {
-	char*   spaths;
-	char*   pos;
-	FILE*   f;
-	
-	assert( filename );
-	
-	fullPath[0] = 0;
-	
-	if( searchPaths && !(filename[0] == '/' || filename[0] == '~' || filename[0] == '.' ) ) {
-		spaths = Memory_Alloc_Array_Unnamed(char,(strlen( searchPaths ) + 1));
-		strcpy( spaths, searchPaths );
-		pos = strtok( spaths, ":" );
-		while( pos ) {
-			PathJoin( fullPath, 2, pos, filename );
-		
-			f = fopen( fullPath, "r" );
-			if( f ) {
-				fclose( f );
-				break;
-			}
-		
-			fullPath[0] = 0;
-			pos = strtok( NULL, ":" );
-		}
-		
-		Memory_Free( spaths );
-	}
-	else {
-		f = fopen( filename, "r" );
-		if( f ) {
-			fclose( f );
-			strcpy( fullPath, filename );
-		}
-	}
-}
-
-Bool FindFileInPathList( char* fullPath, char* filename, char** searchPaths, Index searchPathsSize ) {
-
-	xmlParserInputBufferPtr fileTester;
-	
-	assert( filename );
-
-	if( searchPaths && searchPathsSize > 0 && !(filename[0] == '/' || filename[0] == '~') ) {
-		Index ii;
-
-		for ( ii = 0; ii < searchPathsSize; ++ii ) {
-			sprintf( fullPath, "%s/%s", searchPaths[ii], filename );
-			fileTester = xmlParserInputBufferCreateFilename( fullPath, XML_CHAR_ENCODING_NONE );
-			if ( fileTester ) {
-				xmlFreeParserInputBuffer( fileTester );
-				return True;
-			}
-		}
-	}
-	else {
-		fileTester = xmlParserInputBufferCreateFilename( filename, XML_CHAR_ENCODING_NONE );
-		if ( fileTester ) {
-			xmlFreeParserInputBuffer( fileTester );
-			strcpy( fullPath, filename );
-			return True;
-		}
-	}
-	return False;
-}
-
-void PathJoin( char* path, unsigned count, ... ) {
-	va_list		lst;
-	char*		next;
-	char*		pos;
-	unsigned	i;
-	
-	assert( count );
-
-	pos = path;
-	va_start( lst, count );
-	for( i = 0; i < count - 1; i++ ) {
-		next = va_arg( lst, char* );
-		
-		memcpy( pos, next, sizeof(char) * strlen( next ) );
-		pos += strlen( next );
-		
-		if( strncmp( pos - strlen( joiner ), joiner, strlen( joiner ) ) ) {
-			memcpy( pos, joiner, sizeof(char) * strlen( joiner ) );
-			pos += strlen( joiner );
-		}
-	}
-
-	next = va_arg( lst, char* );
-	strcpy( pos, next );
-	
-	va_end( lst );
-}
-
-
-
-/* Based on Robert Turnbull's ExpandEnvironmentVariables function */
-/* assumes string is malloced and from a non-tokenised source */
-char* ExpandEnvironmentVariables( char* string ) {
-	char* result;			/* copy of input argument */
-	
-	char* variableBegin;		/* ptr to where variable starts */
-	char* variableEnd;		/* ptr to position after end of variable text */
-	char* nameBegin;		/* ptr to where name of variable starts */
-	char* nameEnd;			/* ptr to position of the last character in variable name */
-	Name endChars = NULL;	/* list of characters which indicate an end of variable */
-
-	char* current;			/* current position in string */
-	char* endOfString;		/* pointer to end of string */
-
-	char envName[256];		/* name of environment variable */
-	Name envValue;		/* the value of the environment variable */
-
-	int length;			/* current length of result string */
-	int nameLength;			/* length of the variable name */
-
-	int charsToWrite;		/* number of characters to write to result */
-	int charsWritten; 		/* number of characters written to the result */
-
-	Bool hasBraces;			/* whether the env variable is using a brace in its name */
-
-	length = strlen( string );
-	charsWritten = 0;
-	
-	result = Memory_Alloc_Array( char, length + 1, "EnvTemp" );
-
-	current = string;
-	endOfString = string + length;
-
-	variableBegin = strchr( current, '$' );
-	if ( variableBegin == NULL ) {
-		Memory_Free( result );
-		return string;
-	}
-
-	while ( variableBegin != NULL ) {
-
-		charsToWrite = variableBegin - current;
-		strncpy( result + charsWritten, current, charsToWrite );
-		charsWritten += charsToWrite;
-		
-		hasBraces = True;
-		switch ( *(variableBegin + 1) ) {
-			case '{':
-				nameBegin = variableBegin + 2;
-				endChars = "}";
-				break;
-			case '(':
-				nameBegin = variableBegin + 2;
-				endChars = ")";
-				break;
-			case '\0':
-				nameBegin = variableBegin + 1;
-				break;
-			default:
-				nameBegin = variableBegin + 1;
-				endChars = "/.;, \\"; 
-				hasBraces = False;
-		}
-
-		if ( nameBegin >= endOfString ) {
-			Journal_Printf(
-				Journal_Register( Debug_Type, "PathUtils" ),
-				"Warning - Environment variable begins at the end of string: %s\n",
-				string );
-			Memory_Free( result );
-			return string;
-		}
-
-		variableEnd = strpbrk( nameBegin, endChars );
-
-		if ( variableEnd == NULL ) {
-			if ( hasBraces ) {
-				Journal_Printf(
-					Journal_Register( Debug_Type, "PathUtils" ),
-					"Warning - Mismatched %s for environment variable in value: %s\n",
-					endChars,
-					string );
-				Memory_Free( result );
-				return string;
-			}
-			else {
-				variableEnd = endOfString;
-			}
-		}
-		if ( variableBegin == variableEnd ) {
-			Journal_Printf(
-				Journal_Register( Debug_Type, "PathUtils" ),
-				"Warning - Empty name for environment variable: %s\n",
-				string );
-		}
-
-		if ( hasBraces ) {
-			nameEnd = variableEnd;
-			variableEnd++;
-		}
-		else {
-			nameEnd = variableEnd;
-		}
-		
-		nameLength = nameEnd - nameBegin;
-
-		strncpy( envName, nameBegin, nameLength );
-		*(envName + nameLength) = '\0';
-
-		envValue = getenv( envName );
-
-		if ( envValue == NULL ) {
-			envValue = "";
-		}
-
-		if ( strlen( envValue ) > (unsigned)( variableEnd - variableBegin ) ) {
-			length += strlen( envValue ) - ( variableEnd - variableBegin );
-			result = Memory_Realloc_Array( result, char, length + 1 );
-		}
-
-
-		charsToWrite = strlen( envValue );
-		strncpy( result + charsWritten, envValue, charsToWrite );
-		charsWritten += charsToWrite;
-
-		current = variableEnd;
-		variableBegin = strchr( current, '$' );
-	}
-
-	charsToWrite = endOfString - current;
-	strncpy( result + charsWritten, current, charsToWrite );
-	charsWritten += charsToWrite;
-
-	*(result + charsWritten) = '\0';
-	
-	/* write the result back to the argument */
-	/*
-	if ( strlen( string ) < strlen( result ) ) {
-		string = Memory_Realloc_Array( string, char, strlen( result ) + 1 );
-	}
-	strcpy( string, result );
-	Memory_Free( result );
-
-
-	return string;
-	*/
-	return result;
-}
-
-char* ParentDirectory( Name path ) {
-	char* result;
-	int i, length;
-
-	assert( path );
-	
-	length = strlen( path );
-	
-	if ( length > 0 ) {
-		int endIndex = length;
-		
-		if ( path[length - 1] == '/' ) {
-			endIndex--;
-		}
-		
-		for ( i = endIndex - 1; i >= 0; --i ) {
-			if ( path[i] == '/' ) {
-				break;
-			}
-		}
-		if ( i < 0  ) {
-			return NULL;
-		}
-		result = Memory_Alloc_Array_Unnamed( char, i + 1 );
-		strncpy( result, path, i );
-		result[i] = '\0';
-
-		return result;
-	}
-	return NULL;
-}
-
-Bool Stg_CreateDirectory( Name path ) {
-	assert( path );
-	
-	if ( ! Stg_DirectoryExists( path ) ) {
-		char* parent;
-		int ret;
-
-		parent = ParentDirectory( path );
-		if ( parent != NULL ) {
-			if ( Stg_CreateDirectory( parent ) == False ) {
-				Memory_Free( parent );
-				return False;
-			}
-			Memory_Free( parent );
-		}
-
-#ifdef NO_SYS_STAT
-		ret = mkdir( path);
-#else
-		ret = mkdir( path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH );
-#endif
-
-		return (ret == 0) ? True : False;
-	}
-
-	return True;
-}
-
-Bool Stg_FileExists( Name path ) {
-	struct stat info;
-	assert( path );
-	if ( stat( path, &info ) < 0 ) {
-		return False;
-	}
-        return (info.st_mode & S_IFREG) ? True : False;
-}
-
-Bool Stg_DirectoryExists( Name path ) {
-	struct stat info;
-	assert( path );
-	if ( stat( path, &info ) < 0 ) {
-		return False;
-	}
-        return (info.st_mode & S_IFDIR) ? True : False;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/PathUtils.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/PathUtils.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,349 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "Base/Foundation/Foundation.h"
+#include <libxml/parserInternals.h>
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "Stream.h"
+
+#include "PathUtils.h"
+
+
+static Name      joiner = "/";
+
+
+void FindFile( char* fullPath, Name filename, const char* searchPaths ) {
+	char*   spaths;
+	char*   pos;
+	FILE*   f;
+	
+	assert( filename );
+	
+	fullPath[0] = 0;
+	
+	if( searchPaths && !(filename[0] == '/' || filename[0] == '~' || filename[0] == '.' ) ) {
+		spaths = Memory_Alloc_Array_Unnamed(char,(strlen( searchPaths ) + 1));
+		strcpy( spaths, searchPaths );
+		pos = strtok( spaths, ":" );
+		while( pos ) {
+			PathJoin( fullPath, 2, pos, filename );
+		
+			f = fopen( fullPath, "r" );
+			if( f ) {
+				fclose( f );
+				break;
+			}
+		
+			fullPath[0] = 0;
+			pos = strtok( NULL, ":" );
+		}
+		
+		Memory_Free( spaths );
+	}
+	else {
+		f = fopen( filename, "r" );
+		if( f ) {
+			fclose( f );
+			strcpy( fullPath, filename );
+		}
+	}
+}
+
+Bool FindFileInPathList( char* fullPath, char* filename, char** searchPaths, Index searchPathsSize ) {
+
+	xmlParserInputBufferPtr fileTester;
+	
+	assert( filename );
+
+	if( searchPaths && searchPathsSize > 0 && !(filename[0] == '/' || filename[0] == '~') ) {
+		Index ii;
+
+		for ( ii = 0; ii < searchPathsSize; ++ii ) {
+			sprintf( fullPath, "%s/%s", searchPaths[ii], filename );
+			fileTester = xmlParserInputBufferCreateFilename( fullPath, XML_CHAR_ENCODING_NONE );
+			if ( fileTester ) {
+				xmlFreeParserInputBuffer( fileTester );
+				return True;
+			}
+		}
+	}
+	else {
+		fileTester = xmlParserInputBufferCreateFilename( filename, XML_CHAR_ENCODING_NONE );
+		if ( fileTester ) {
+			xmlFreeParserInputBuffer( fileTester );
+			strcpy( fullPath, filename );
+			return True;
+		}
+	}
+	return False;
+}
+
+void PathJoin( char* path, unsigned count, ... ) {
+	va_list		lst;
+	char*		next;
+	char*		pos;
+	unsigned	i;
+	
+	assert( count );
+
+	pos = path;
+	va_start( lst, count );
+	for( i = 0; i < count - 1; i++ ) {
+		next = va_arg( lst, char* );
+		
+		memcpy( pos, next, sizeof(char) * strlen( next ) );
+		pos += strlen( next );
+		
+		if( strncmp( pos - strlen( joiner ), joiner, strlen( joiner ) ) ) {
+			memcpy( pos, joiner, sizeof(char) * strlen( joiner ) );
+			pos += strlen( joiner );
+		}
+	}
+
+	next = va_arg( lst, char* );
+	strcpy( pos, next );
+	
+	va_end( lst );
+}
+
+
+
+/* Based on Robert Turnbull's ExpandEnvironmentVariables function */
+/* assumes string is malloced and from a non-tokenised source */
+char* ExpandEnvironmentVariables( char* string ) {
+	char* result;			/* copy of input argument */
+	
+	char* variableBegin;		/* ptr to where variable starts */
+	char* variableEnd;		/* ptr to position after end of variable text */
+	char* nameBegin;		/* ptr to where name of variable starts */
+	char* nameEnd;			/* ptr to position of the last character in variable name */
+	Name endChars = NULL;	/* list of characters which indicate an end of variable */
+
+	char* current;			/* current position in string */
+	char* endOfString;		/* pointer to end of string */
+
+	char envName[256];		/* name of environment variable */
+	Name envValue;		/* the value of the environment variable */
+
+	int length;			/* current length of result string */
+	int nameLength;			/* length of the variable name */
+
+	int charsToWrite;		/* number of characters to write to result */
+	int charsWritten; 		/* number of characters written to the result */
+
+	Bool hasBraces;			/* whether the env variable is using a brace in its name */
+
+	length = strlen( string );
+	charsWritten = 0;
+	
+	result = Memory_Alloc_Array( char, length + 1, "EnvTemp" );
+
+	current = string;
+	endOfString = string + length;
+
+	variableBegin = strchr( current, '$' );
+	if ( variableBegin == NULL ) {
+		Memory_Free( result );
+		return string;
+	}
+
+	while ( variableBegin != NULL ) {
+
+		charsToWrite = variableBegin - current;
+		strncpy( result + charsWritten, current, charsToWrite );
+		charsWritten += charsToWrite;
+		
+		hasBraces = True;
+		switch ( *(variableBegin + 1) ) {
+			case '{':
+				nameBegin = variableBegin + 2;
+				endChars = "}";
+				break;
+			case '(':
+				nameBegin = variableBegin + 2;
+				endChars = ")";
+				break;
+			case '\0':
+				nameBegin = variableBegin + 1;
+				break;
+			default:
+				nameBegin = variableBegin + 1;
+				endChars = "/.;, \\"; 
+				hasBraces = False;
+		}
+
+		if ( nameBegin >= endOfString ) {
+			Journal_Printf(
+				Journal_Register( Debug_Type, "PathUtils" ),
+				"Warning - Environment variable begins at the end of string: %s\n",
+				string );
+			Memory_Free( result );
+			return string;
+		}
+
+		variableEnd = strpbrk( nameBegin, endChars );
+
+		if ( variableEnd == NULL ) {
+			if ( hasBraces ) {
+				Journal_Printf(
+					Journal_Register( Debug_Type, "PathUtils" ),
+					"Warning - Mismatched %s for environment variable in value: %s\n",
+					endChars,
+					string );
+				Memory_Free( result );
+				return string;
+			}
+			else {
+				variableEnd = endOfString;
+			}
+		}
+		if ( variableBegin == variableEnd ) {
+			Journal_Printf(
+				Journal_Register( Debug_Type, "PathUtils" ),
+				"Warning - Empty name for environment variable: %s\n",
+				string );
+		}
+
+		if ( hasBraces ) {
+			nameEnd = variableEnd;
+			variableEnd++;
+		}
+		else {
+			nameEnd = variableEnd;
+		}
+		
+		nameLength = nameEnd - nameBegin;
+
+		strncpy( envName, nameBegin, nameLength );
+		*(envName + nameLength) = '\0';
+
+		envValue = getenv( envName );
+
+		if ( envValue == NULL ) {
+			envValue = "";
+		}
+
+		if ( strlen( envValue ) > (unsigned)( variableEnd - variableBegin ) ) {
+			length += strlen( envValue ) - ( variableEnd - variableBegin );
+			result = Memory_Realloc_Array( result, char, length + 1 );
+		}
+
+
+		charsToWrite = strlen( envValue );
+		strncpy( result + charsWritten, envValue, charsToWrite );
+		charsWritten += charsToWrite;
+
+		current = variableEnd;
+		variableBegin = strchr( current, '$' );
+	}
+
+	charsToWrite = endOfString - current;
+	strncpy( result + charsWritten, current, charsToWrite );
+	charsWritten += charsToWrite;
+
+	*(result + charsWritten) = '\0';
+	
+	/* write the result back to the argument */
+	/*
+	if ( strlen( string ) < strlen( result ) ) {
+		string = Memory_Realloc_Array( string, char, strlen( result ) + 1 );
+	}
+	strcpy( string, result );
+	Memory_Free( result );
+
+
+	return string;
+	*/
+	return result;
+}
+
+char* ParentDirectory( Name path ) {
+	char* result;
+	int i, length;
+
+	assert( path );
+	
+	length = strlen( path );
+	
+	if ( length > 0 ) {
+		int endIndex = length;
+		
+		if ( path[length - 1] == '/' ) {
+			endIndex--;
+		}
+		
+		for ( i = endIndex - 1; i >= 0; --i ) {
+			if ( path[i] == '/' ) {
+				break;
+			}
+		}
+		if ( i < 0  ) {
+			return NULL;
+		}
+		result = Memory_Alloc_Array_Unnamed( char, i + 1 );
+		strncpy( result, path, i );
+		result[i] = '\0';
+
+		return result;
+	}
+	return NULL;
+}
+
+Bool Stg_CreateDirectory( Name path ) {
+	assert( path );
+	
+	if ( ! Stg_DirectoryExists( path ) ) {
+		char* parent;
+		int ret;
+
+		parent = ParentDirectory( path );
+		if ( parent != NULL ) {
+			if ( Stg_CreateDirectory( parent ) == False ) {
+				Memory_Free( parent );
+				return False;
+			}
+			Memory_Free( parent );
+		}
+
+#ifdef NO_SYS_STAT
+		ret = mkdir( path);
+#else
+		ret = mkdir( path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH );
+#endif
+
+		return (ret == 0) ? True : False;
+	}
+
+	return True;
+}
+
+Bool Stg_FileExists( Name path ) {
+	struct stat info;
+	assert( path );
+	if ( stat( path, &info ) < 0 ) {
+		return False;
+	}
+        return (info.st_mode & S_IFREG) ? True : False;
+}
+
+Bool Stg_DirectoryExists( Name path ) {
+	struct stat info;
+	assert( path );
+	if ( stat( path, &info ) < 0 ) {
+		return False;
+	}
+        return (info.st_mode & S_IFDIR) ? True : False;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/RankFormatter.c
--- a/Base/IO/src/RankFormatter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: RankFormatter.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include <stdarg.h>  
-#include "StreamFormatter.h"
-#include "LineFormatter.h"
-#include "RankFormatter.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <mpi.h>
-
-
-const Type RankFormatter_Type = "RankFormatter";
-Name PREPEND = ": ";
-
-
-StreamFormatter* RankFormatter_New()
-{
-	/* Variables set in this function */
-	SizeT                            _sizeOfSelf = sizeof(RankFormatter);
-	Type                                    type = RankFormatter_Type;
-	Stg_Class_DeleteFunction*            _delete = _RankFormatter_Delete;
-	Stg_Class_PrintFunction*              _print = _RankFormatter_Print;
-	Stg_Class_CopyFunction*                _copy = _LineFormatter_Copy;
-	StreamFormatter_FormatFunction*      _format = _LineFormatter_Format;
-
-	return (StreamFormatter*)_RankFormatter_New(  RANKFORMATTER_PASSARGS  );
-}
-	
-void RankFormatter_Init( RankFormatter* self )
-{
-	self->_sizeOfSelf = sizeof(RankFormatter);
-	self->type = RankFormatter_Type;
-	self->_delete = _RankFormatter_Delete;
-	self->_print = _RankFormatter_Print;
-	self->_copy = _LineFormatter_Copy;
-
-	_LineFormatter_Init( (LineFormatter*)self, (StreamFormatter_FormatFunction*)_LineFormatter_Format );
-	_RankFormatter_Init( self, (StreamFormatter_FormatFunction*)_LineFormatter_Format );
-}
-
-RankFormatter* _RankFormatter_New(  RANKFORMATTER_DEFARGS  )
-{
-	RankFormatter* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(RankFormatter) );
-	self = (RankFormatter*)_LineFormatter_New(  LINEFORMATTER_PASSARGS  );
-	
-	_RankFormatter_Init( self, _format );
-
-	return self;
-}
-
-void _RankFormatter_Init(
-	RankFormatter*			self,
-	StreamFormatter_FormatFunction*	_format )
-{
-	int rank, rankTemp;
-	int rankDigits;
-	int size;
-	int prependLength;
-	
-	/* If there is only one processor, do not print rank */
-	MPI_Comm_size( MPI_COMM_WORLD, &size );
-	if ( size == 1 )
-	{
-		return;
-	}
-
-	/* Calculate length of rank string */
-	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-	rankTemp = rank;
-	rankDigits = 0;
-	do
-	{
-		rankDigits++;
-		rankTemp /= 10; /* Base 10 */
-	} while ( rankTemp > 0 );
-	
-	prependLength = rankDigits + strlen( PREPEND );
-
-	self->_tag = Memory_Alloc_Array( char, prependLength + 1, "RankFormatter->_tag" );
-
-	sprintf( self->_tag, "%d%s", rank, PREPEND );
-}
-
-void _RankFormatter_Delete( void* formatter )
-{
-	RankFormatter* self = (RankFormatter*)formatter;
-	
-	#if DEBUG
-		assert( self );
-	#endif
-
-	/* Stg_Class_Delete parent */
-	_LineFormatter_Delete( self );
-}
-void _RankFormatter_Print( void* formatter, Stream* stream )
-{
-	#if DEBUG
-		RankFormatter* self = (RankFormatter*) formatter;
-
-		assert( self );
-		assert (stream);
-	#endif
-	
-	/* General info */
-	printf( "RankFormatter (ptr): %p\n", formatter );
-	
-	_LineFormatter_Print( formatter, stream );
-}
-
-
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/RankFormatter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/RankFormatter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,151 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: RankFormatter.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include <stdarg.h>  
+#include "StreamFormatter.h"
+#include "LineFormatter.h"
+#include "RankFormatter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <mpi.h>
+
+
+const Type RankFormatter_Type = "RankFormatter";
+Name PREPEND = ": ";
+
+
+StreamFormatter* RankFormatter_New()
+{
+	/* Variables set in this function */
+	SizeT                            _sizeOfSelf = sizeof(RankFormatter);
+	Type                                    type = RankFormatter_Type;
+	Stg_Class_DeleteFunction*            _delete = _RankFormatter_Delete;
+	Stg_Class_PrintFunction*              _print = _RankFormatter_Print;
+	Stg_Class_CopyFunction*                _copy = _LineFormatter_Copy;
+	StreamFormatter_FormatFunction*      _format = _LineFormatter_Format;
+
+	return (StreamFormatter*)_RankFormatter_New(  RANKFORMATTER_PASSARGS  );
+}
+	
+void RankFormatter_Init( RankFormatter* self )
+{
+	self->_sizeOfSelf = sizeof(RankFormatter);
+	self->type = RankFormatter_Type;
+	self->_delete = _RankFormatter_Delete;
+	self->_print = _RankFormatter_Print;
+	self->_copy = _LineFormatter_Copy;
+
+	_LineFormatter_Init( (LineFormatter*)self, (StreamFormatter_FormatFunction*)_LineFormatter_Format );
+	_RankFormatter_Init( self, (StreamFormatter_FormatFunction*)_LineFormatter_Format );
+}
+
+RankFormatter* _RankFormatter_New(  RANKFORMATTER_DEFARGS  )
+{
+	RankFormatter* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(RankFormatter) );
+	self = (RankFormatter*)_LineFormatter_New(  LINEFORMATTER_PASSARGS  );
+	
+	_RankFormatter_Init( self, _format );
+
+	return self;
+}
+
+void _RankFormatter_Init(
+	RankFormatter*			self,
+	StreamFormatter_FormatFunction*	_format )
+{
+	int rank, rankTemp;
+	int rankDigits;
+	int size;
+	int prependLength;
+	
+	/* If there is only one processor, do not print rank */
+	MPI_Comm_size( MPI_COMM_WORLD, &size );
+	if ( size == 1 )
+	{
+		return;
+	}
+
+	/* Calculate length of rank string */
+	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+	rankTemp = rank;
+	rankDigits = 0;
+	do
+	{
+		rankDigits++;
+		rankTemp /= 10; /* Base 10 */
+	} while ( rankTemp > 0 );
+	
+	prependLength = rankDigits + strlen( PREPEND );
+
+	self->_tag = Memory_Alloc_Array( char, prependLength + 1, "RankFormatter->_tag" );
+
+	sprintf( self->_tag, "%d%s", rank, PREPEND );
+}
+
+void _RankFormatter_Delete( void* formatter )
+{
+	RankFormatter* self = (RankFormatter*)formatter;
+	
+	#if DEBUG
+		assert( self );
+	#endif
+
+	/* Stg_Class_Delete parent */
+	_LineFormatter_Delete( self );
+}
+void _RankFormatter_Print( void* formatter, Stream* stream )
+{
+	#if DEBUG
+		RankFormatter* self = (RankFormatter*) formatter;
+
+		assert( self );
+		assert (stream);
+	#endif
+	
+	/* General info */
+	printf( "RankFormatter (ptr): %p\n", formatter );
+	
+	_LineFormatter_Print( formatter, stream );
+}
+
+
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Stream.c
--- a/Base/IO/src/Stream.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,745 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Stream.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "StreamFormatter.h"
-#include "LineFormatter.h"
-#include "IndentFormatter.h"
-#include "Stream.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-const Type Stream_Type = "stream";
-
-static const int STREAM_FORMATTER_SIZE = 1;	/**< Initial size of a formatter array. */
-static const int STREAM_FORMATTER_DELTA = 1;	/**< Number of formatters to resize by when extending the array. */
-
-static const int STREAM_CHILDREN_SIZE = 4;	/**< Initial size of the sub-stream children array. */
-static const int STREAM_CHILDREN_DELTA = 4;	/**< Number of streams to resize by when extending the array. */
-
-
-/** Returns True if the current process is allowed to print. */
-Bool _Stream_IsPrintingRank( Stream* stream );
-
-Stream* _Stream_New(  STREAM_DEFARGS  )
-{
-	Stream* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(Stream) );
-	self = (Stream*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-                                                                                
-	_Stream_Init( self, name, _printf, _write, _dump, _setFile );
-
-	return self;
-}
-
-void _Stream_Init(
-	Stream*			self,
-	Name			name,
-	Stream_PrintfFunction*	_printf,
-	Stream_WriteFunction*	_write,
-	Stream_DumpFunction*	_dump,
-	Stream_SetFileFunction*	_setFile )
-{
-	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
-	
-	self->_printf = _printf;
-	self->_write = _write;
-	self->_dump = _dump;
-	self->_setFile = _setFile;
-	
-	self->_enable = False;
-	self->_level = 1;
-	self->_file = NULL;
-	self->_printingRank = STREAM_ALL_RANKS;
-	self->_autoFlush = False;
-	self->_indent = (IndentFormatter*)IndentFormatter_New();
-	self->_formatter = NULL;
-	self->_formatterCount = 0;
-	self->_formatterSize = 0;
-	self->_currentSource = NULL;
-	self->_currentFunction = NULL;
-	self->_currentLine = 0;
-	
-	self->_parent = NULL;
-	self->_children = Stg_ObjectList_New2( STREAM_CHILDREN_SIZE, STREAM_CHILDREN_DELTA );
-	self->_children->_noJournalingInCopy = True; /* Important... else _Stream_Copy ends up stuck in a recursive copy loop */
-}
-
-
-void _Stream_Delete( void* stream )
-{
-	Index i;
-	
-	Stream* self = (Stream*)stream;
-	
-	#if DEBUG
-		assert( self );
-	#endif
-
-	Stg_Class_Delete( self->_indent );
-
-	if ( self->_formatter != NULL )
-	{
-		for ( i = 0; i < self->_formatterCount; ++i )
-		{
-			Stg_Class_Delete( self->_formatter[i] );
-		}
-		Memory_Free( self->_formatter );
-	}
-
-	if ( self->_currentSource ) Memory_Free( self->_currentSource );
-	if ( self->_currentFunction ) Memory_Free( self->_currentFunction );
-
-	Stg_ObjectList_DeleteAllObjects( self->_children );
-	Stg_Class_Delete( self->_children );
-
-	/* Stg_Class_Delete parent */
-	_Stg_Object_Delete( self );
-}
-
-
-void _Stream_Print( void* stream, Stream* paramStream )
-{
-	Stream* self = (Stream*) stream;
-
-	#if DEBUG
-		assert( self );
-	#endif
-	
-	/* General info */
-	Journal_Printf( paramStream, "Stream (ptr): %p\n", self );
-	
-	/* Print parent */
-	_Stg_Object_Print( self, paramStream );
-	
-	Stream_Indent( paramStream );
-	/* Virtual info */
-	Journal_Printf( paramStream, "_printf (func ptr): %p\n", self->_printf );
-	Journal_Printf( paramStream, "_write (func ptr): %p\n", self->_write );
-	Journal_Printf( paramStream, "_dump (func ptr): %p\n", self->_dump );
-	Journal_Printf( paramStream, "_setFile (func ptr): %p\n", self->_setFile );
-	Journal_Printf( paramStream, "_copy (func ptr): %p\n", self->_copy );
-	
-	/* Stream info */
-	Journal_Printf( paramStream, "_enable: %d\n", self->_enable );
-	Journal_Printf( paramStream, "_level: %d\n", self->_level );
-	Journal_Printf( paramStream, "_file (ptr):  %p\n", self->_file );
-	Journal_Printf( paramStream, "_printingRank: %d\n", self->_printingRank );
-	Journal_Printf( paramStream, "_autoFlush: %d\n", self->_autoFlush );
-	Journal_Printf( paramStream, "_indent: %d\n", self->_indent->_indent );
-	Journal_Printf( paramStream, "_formatters (ptr):  %p\n", self->_formatter );
-	Journal_Printf( paramStream, "_formatter count: %d\n", self->_formatterCount );
-	Journal_Printf( paramStream, "_formatter size: %d\n", self->_formatterSize );
-	/*
-	Journal_Printf( paramStream, "current source file: %s\n", self->_currentSource );
-	Journal_Printf( paramStream, "current function: %s\n", self->_currentFunction );
-	Journal_Printf( paramStream, "current line: %d\n", self->_currentLine );
-	*/
-	Journal_Printf( paramStream, "_parent (ptr): %p\n", self->_parent );
-
-	Stream_Indent( paramStream );
-
-	Stg_Class_Print( self->_children, paramStream );
-
-	Stream_UnIndent( paramStream );
-
-	Stream_UnIndent( paramStream );
-}
-
-
-void Stream_PrintConcise( void* stream, Stream* paramStream )
-{
-	Stream* self = (Stream*) stream;
-	Index   child_I = 0;
-
-	#if DEBUG
-		assert( self );
-	#endif
-	
-	/* General info */
-	Journal_Printf( paramStream, "Stream \"%s\":\n", self->name );
-	
-	Stream_Indent( paramStream );
-	
-	/* Stream info */
-	Journal_Printf( paramStream, "Enabled: %s\n", self->_enable ? "True" : "False" );
-	Journal_Printf( paramStream, "Level: %d\n", self->_level );
-
-	if ( self->_children->count > 0 ) {
-		Journal_Printf( paramStream, "Children:\n" );
-		Stream_Indent( paramStream );
-		for ( child_I = 0; child_I < self->_children->count; child_I++ ) {
-			Stream_PrintConcise( self->_children->data[child_I], paramStream );
-		}
-		Stream_UnIndent( paramStream );
-	}
-
-	Stream_UnIndent( paramStream );
-}
-
-
-void* _Stream_Copy( const void* stream, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Stream*		self = (Stream*)stream;
-	Stream*		newStream;
-	unsigned	i;
-	
-	newStream = (Stream*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	newStream->_printf = self->_printf;
-	newStream->_write = self->_write;
-	newStream->_dump = self->_dump;
-	newStream->_setFile = self->_setFile;
-	newStream->defaultFileType = self->defaultFileType;
-	newStream->_copy = self->_copy;
-	newStream->_enable = self->_enable;
-	newStream->_level = self->_level;
-	newStream->_file = self->_file;
-	newStream->_printingRank = self->_printingRank;
-	newStream->_autoFlush = self->_autoFlush;
-	newStream->_indent = (IndentFormatter*)IndentFormatter_New();
-	newStream->_formatter = NULL;
-	newStream->_formatterCount = 0;
-	newStream->_formatterSize = 0;
-	newStream->_currentSource = NULL;
-	newStream->_currentFunction = NULL;
-	newStream->_currentLine = 0;
-	newStream->_parent = self->_parent;
-/*	newStream->_children = Stg_Class_Copy( self->_children, 0 , deep, nameExt, ptrMap );*/
-	newStream->_children = Stg_ObjectList_New2( STREAM_CHILDREN_SIZE, STREAM_CHILDREN_DELTA );
-
-	
-	IndentFormatter_SetIndent( newStream->_indent, self->_indent->_indent );
-	for ( i = 0; i < self->_formatterCount; ++i ) {
-          Stream_AddFormatter( newStream, (StreamFormatter*)Stg_Class_Copy( self->_formatter[i], 0, deep, nameExt, ptrMap ) );
-		/**set stream for formatter */
-	}
-	
-	return newStream;
-}
-
-
-SizeT Stream_Printf( Stream *stream, const char *fmt, va_list args )
-{
-	Index i;
-	SizeT result;
-	Name lastFormat;
-	Name currentFormat;
-
-	if ( stream->_file == NULL ) {
-		return 0;
-	}
-	if ( !_Stream_IsPrintingRank( stream ) )
-	{
-		return 0;
-	}
-
-	JournalFile_ReopenIfClosed( stream->_file );
-
-	currentFormat = StreamFormatter_Format( stream->_indent, fmt );
-	lastFormat = currentFormat;
-
-	for ( i = 0; i < stream->_formatterCount; ++i )
-	{
-		currentFormat = StreamFormatter_Format( stream->_formatter[i], lastFormat );
-		lastFormat = currentFormat;
-	}
-	result = stream->_printf( stream, currentFormat, args );
-
-	if ( stream->_autoFlush )
-	{
-		Stream_Flush( stream );
-	}
-	return result;
-}
-SizeT Stream_Write( Stream *stream, const void *data, SizeT elem_size, SizeT num_elems )
-{
-	SizeT result;
-
-	if ( stream->_file == NULL ) {
-		return 0;
-	}
-	if ( !_Stream_IsPrintingRank( stream ) )
-	{
-		return 0;
-	}
-	
-	JournalFile_ReopenIfClosed( stream->_file );
-
-	result =  stream->_write( stream, data, elem_size, num_elems );
-
-	if( stream->_autoFlush )
-	{
-		Stream_Flush( stream );
-	}
-	return result;
-}
-
-Bool Stream_Dump( Stream *stream, const void *data )
-{
-	Bool result;
-	
-	if ( stream->_file == NULL ) {
-		return False;
-	}
-	if ( !_Stream_IsPrintingRank( stream ) )
-	{
-		return False;
-	}
-
-	JournalFile_ReopenIfClosed( stream->_file );
-
-	result = stream->_dump( stream, data );
-
-	if ( stream->_autoFlush )
-	{
-		Stream_Flush( stream );
-	}
-
-	return result;
-}
-
-Bool Stream_RedirectFile( Stream* stream, const Name fileName ) {
-	JournalFile* file;
-
-	file = Journal_GetFile( fileName );
-	if ( file == NULL ) {
-		file = stream->defaultFileType();
-		if ( !JournalFile_Open( file, fileName ) ) {
-			Stg_Class_Delete( file );
-			return False;
-		}
-		Journal_RegisterFile( file );
-	}
-
-	return Stream_SetFile( stream, file );
-}
-
-Bool Stream_RedirectAllToFile( const Name fileName ) {
-	char* infoStreamFilename;
-	char* debugStreamFilename;
-	char* dumpStreamFilename;
-	char* errorStreamFilename;
-
-	Stg_asprintf( &infoStreamFilename, "%s.info", fileName );
-	Stg_asprintf( &debugStreamFilename, "%s.debug", fileName );
-	Stg_asprintf( &dumpStreamFilename, "%s.dump", fileName );
-	Stg_asprintf( &errorStreamFilename, "%s.error", fileName );
-
-	if( Stream_RedirectFile( Journal_GetTypedStream( Info_Type ), infoStreamFilename ) &&
-		Stream_RedirectFile( Journal_GetTypedStream( Debug_Type ), debugStreamFilename ) &&
-		Stream_RedirectFile( Journal_GetTypedStream( Dump_Type ), dumpStreamFilename ) &&
-		Stream_RedirectFile( Journal_GetTypedStream( Error_Type ), errorStreamFilename ) ) {
-		
-		Stream_ClearCustomFormatters( Journal_GetTypedStream( Info_Type ) );
-		Stream_ClearCustomFormatters( Journal_GetTypedStream( Debug_Type ) );
-		Stream_ClearCustomFormatters( Journal_GetTypedStream( Dump_Type ) );
-		Stream_ClearCustomFormatters( Journal_GetTypedStream( Error_Type ) );
-
-		return True;
-	}
-	else
-		return False;
-}
-
-void Stream_PurgeAllRedirectedFiles( void ) {
-	Stream_CloseAndFreeFile( Journal_GetTypedStream( Info_Type ) );
-	Stream_CloseAndFreeFile( Journal_GetTypedStream( Debug_Type ) );
-	Stream_CloseAndFreeFile( Journal_GetTypedStream( Dump_Type ) );
-	Stream_CloseAndFreeFile( Journal_GetTypedStream( Error_Type ) );
-}
-
-Bool Stream_RedirectFileBranch( Stream* stream, const Name fileName ) {
-	JournalFile* file;
-
-	file = Journal_GetFile( fileName );
-	if ( file == NULL ) {
-		file = stream->defaultFileType();
-		JournalFile_Open( file, fileName );
-		Journal_RegisterFile( file );
-	}
-
-	return Stream_SetFileBranch( stream, file );
-}
-
-Bool Stream_AppendFile( Stream* stream, const Name fileName ) {
-	JournalFile* file;
-
-	file = Journal_GetFile( fileName );
-	if ( file == NULL ) {
-		file = stream->defaultFileType();
-		if ( !JournalFile_Append( file, fileName ) ) {
-			Stg_Class_Delete( file );
-			return False;
-		}
-		Journal_RegisterFile( file );
-	}
-
-	return Stream_SetFile( stream, file );
-}
-
-Bool Stream_SetFile( Stream* stream, JournalFile* file )
-{
-	if ( file == NULL )
-	{
-		return False;
-	}
-	
-	return stream->_setFile( stream, file );
-}
-Bool Stream_SetFileBranch( Stream* stream, JournalFile* file )
-{
-	Bool result = False;
-	Index i;
-	
-	if ( file == NULL )
-	{
-		return False;
-	}
-	
-	result = stream->_setFile( stream, file );
-	for ( i = 0; result && i < stream->_children->count; ++i )
-	{
-		result = Stream_SetFileBranch( (Stream*)stream->_children->data[i], file );
-		if ( !result )
-		{
-			return False;
-		}
-	}
-	return result;
-}
-
-JournalFile* Stream_GetFile( void* stream ) {
-	Stream* self = (Stream*) stream;
-
-	return self->_file;
-}
-
-Bool Stream_IsEnable( void* stream )
-{
-	Stream* self = (Stream*) stream;
-	if (stream == NULL) return False;
-	
-	if ( self->_parent == NULL )
-	{
-		return self->_enable;
-	}
-	
-	return (self->_enable && Stream_IsEnable( self->_parent )) ? True : False;
-}
-
-void Stream_Enable( void* stream, Bool enable )
-{
-	Stream* self = (Stream*) stream;
-	self->_enable = enable;
-	
-	/* set path of enable is only set when true */	
-	if ( enable && self->_parent != NULL )
-	{
-		Stream_Enable( self->_parent, True );
-	}
-}
-void Stream_EnableBranch( void* stream, Bool enable )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	self->_enable = enable;
-	
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_EnableBranch( (Stream*)self->_children->data[i], enable );
-	}
-}
-void Stream_EnableSelfOnly( void* stream, Bool enable )
-{
-	Stream* self = (Stream*) stream;
-	self->_enable = enable;
-}
-
-void Stream_SetPrintingRank( void* stream, int rank )
-{
-	Stream* self = (Stream*) stream;
-	self->_printingRank = rank;
-}
-
-int Stream_GetPrintingRank( void* stream )
-{
-	Stream* self = (Stream*) stream;
-	return self->_printingRank;
-}
-
-void Stream_SetPrintingRankBranch( void* stream, int rank )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	self->_printingRank = rank;
-	
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_SetPrintingRankBranch( self->_children->data[i], rank );
-	}
-}
-
-void Stream_SetAutoFlush( void* stream, Bool autoFlush )
-{
-	Stream* self = (Stream*) stream;
-	self->_autoFlush = autoFlush;
-}
-
-Bool Stream_GetAutoFlush( void* stream )
-{
-	Stream* self = (Stream*) stream;
-	return self->_autoFlush;
-}
-
-void Stream_SetAutoFlushBranch( void* stream, Bool autoFlush )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	self->_autoFlush = autoFlush;
-	
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_SetAutoFlushBranch( self->_children->data[i], autoFlush );
-	}
-}
-
-Bool Stream_IsPrintableLevel( void* stream, JournalLevel level )
-{
-	Stream* self = (Stream*) stream;
-	return (self->_level >= level) ? True : False;
-}
-	
-void Stream_SetLevel( void* stream, JournalLevel level )
-{
-	Stream* self = (Stream*) stream;
-	self->_level = level;	
-}
-void Stream_SetLevelBranch( void* stream, JournalLevel level )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	self->_level = level;	
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_SetLevelBranch( (Stream*)self->_children->data[i], level );
-	}
-
-}
-
-void Stream_SetIndent( void* stream, Index indent )
-{
-	Stream* self = (Stream*) stream;
-	IndentFormatter_SetIndent( self->_indent, indent );
-}
-
-void Stream_Indent( void* stream )
-{
-	Stream* self = (Stream*) stream;
-	IndentFormatter_Increment( self->_indent );
-}
-
-void Stream_UnIndent( void* stream )
-{
-	Stream* self = (Stream*) stream;
-	IndentFormatter_Decrement( self->_indent );
-}
-
-void Stream_ZeroIndent( void* stream )
-{
-	Stream* self = (Stream*) stream;
-	IndentFormatter_Zero( self->_indent );
-}
-
-
-void Stream_SetIndentBranch( void* stream, Index indent )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	IndentFormatter_SetIndent( self->_indent, indent );
-
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_SetIndentBranch( self->_children->data[i], indent );
-	}
-}
-void Stream_IndentBranch( void* stream )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	IndentFormatter_Increment( self->_indent );
-
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_IndentBranch( self->_children->data[i] );
-	}
-}
-void Stream_UnIndentBranch( void* stream )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	IndentFormatter_Decrement( self->_indent );
-
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_UnIndentBranch( self->_children->data[i] );
-	}
-}
-void Stream_ZeroIndentBranch( void* stream )
-{
-	Index i;
-	Stream* self = (Stream*) stream;
-	
-	IndentFormatter_Zero( self->_indent );
-
-	for ( i = 0; i < self->_children->count; ++i )
-	{
-		Stream_ZeroIndentBranch( self->_children->data[i] );
-	}
-}
-
-void Stream_AddFormatter( void* stream, StreamFormatter* formatter )
-{
-	Stream* self = (Stream*) stream;
-	
-	if ( self->_formatterCount >= self->_formatterSize )
-	{
-		if ( self->_formatter == NULL )
-		{
-			self->_formatterSize = STREAM_FORMATTER_SIZE;
-			self->_formatter = Memory_Alloc_Array( StreamFormatter*, self->_formatterSize, "Stream->_formatter" );
-		}
-		else
-		{
-			self->_formatterSize += STREAM_FORMATTER_DELTA;
-			self->_formatter = Memory_Realloc_Array( self->_formatter, StreamFormatter*, self->_formatterSize );
-		}
-	}
-	self->_formatter[self->_formatterCount] = formatter;
-	self->_formatterCount++;
-	
-	formatter->_stream = self;
-}
-
-void Stream_ClearCustomFormatters( void* stream ) {
-	Stream* self = (Stream*) stream;
-
-	Memory_Free( self->_formatter );
-	self->_formatter = NULL;
-	self->_formatterSize = 0;
-	self->_formatterCount = 0;
-}
-
-
-void Stream_SetCurrentInfo( void* stream, Name const currentSource, const char* const currentFunction, int line )
-{
-	Stream* self = (Stream*)stream;
-
-	if ( self->_currentSource ) Memory_Free( self->_currentSource );
-	if ( self->_currentFunction ) Memory_Free( self->_currentFunction );
-	Stg_asprintf( &self->_currentSource, "%s", currentSource );
-	Stg_asprintf( &self->_currentFunction, "%s", currentFunction );
-	self->_currentLine = line;
-}
-
-
-Stream* Stream_RegisterChild( void* stream, Name name )
-{
-	Stream* self = (Stream*) stream;
-	Stream* child;
-	
-	child = (Stream*)Stg_ObjectList_Get( self->_children, name );
-	
-	if ( child == NULL )
-	{
-          child = (Stream*)Stg_Class_Copy( self, 0, True, 0, 0 );
-          Stg_Object_SetName( child, name );
-          child->_parent = self;
-          Stg_ObjectList_Append( self->_children, child );
-	}
-	
-	return child;
-}
-
-Bool Stream_Flush( void* stream )
-{
-	Stream* self = (Stream*)stream;
-	return JournalFile_Flush( self->_file );
-}
-
-Bool Stream_CloseFile( void* stream ) {
-	Stream* self = (Stream*)stream;
-
-	return JournalFile_Close( self->_file );
-}
-
-void Stream_CloseAndFreeFile( void* stream ) {
-	Stream* self = (Stream*)stream;
-
-	Stream_CloseFile( self );
-	Journal_DeregisterFile( self->_file );
-	Stg_Class_Delete( self->_file );
-}
-
-
-Bool _Stream_IsPrintingRank( Stream* stream )
-{
-	int rank;
-	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-	
-	if ( stream->_printingRank > STREAM_ALL_RANKS && rank != stream->_printingRank )
-	{
-		return False;
-	}
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/Stream.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/Stream.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,745 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Stream.c 4096 2007-05-16 00:54:10Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "StreamFormatter.h"
+#include "LineFormatter.h"
+#include "IndentFormatter.h"
+#include "Stream.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+
+const Type Stream_Type = "stream";
+
+static const int STREAM_FORMATTER_SIZE = 1;	/**< Initial size of a formatter array. */
+static const int STREAM_FORMATTER_DELTA = 1;	/**< Number of formatters to resize by when extending the array. */
+
+static const int STREAM_CHILDREN_SIZE = 4;	/**< Initial size of the sub-stream children array. */
+static const int STREAM_CHILDREN_DELTA = 4;	/**< Number of streams to resize by when extending the array. */
+
+
+/** Returns True if the current process is allowed to print. */
+Bool _Stream_IsPrintingRank( Stream* stream );
+
+Stream* _Stream_New(  STREAM_DEFARGS  )
+{
+	Stream* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(Stream) );
+	self = (Stream*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+                                                                                
+	_Stream_Init( self, name, _printf, _write, _dump, _setFile );
+
+	return self;
+}
+
+void _Stream_Init(
+	Stream*			self,
+	Name			name,
+	Stream_PrintfFunction*	_printf,
+	Stream_WriteFunction*	_write,
+	Stream_DumpFunction*	_dump,
+	Stream_SetFileFunction*	_setFile )
+{
+	_Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+	
+	self->_printf = _printf;
+	self->_write = _write;
+	self->_dump = _dump;
+	self->_setFile = _setFile;
+	
+	self->_enable = False;
+	self->_level = 1;
+	self->_file = NULL;
+	self->_printingRank = STREAM_ALL_RANKS;
+	self->_autoFlush = False;
+	self->_indent = (IndentFormatter*)IndentFormatter_New();
+	self->_formatter = NULL;
+	self->_formatterCount = 0;
+	self->_formatterSize = 0;
+	self->_currentSource = NULL;
+	self->_currentFunction = NULL;
+	self->_currentLine = 0;
+	
+	self->_parent = NULL;
+	self->_children = Stg_ObjectList_New2( STREAM_CHILDREN_SIZE, STREAM_CHILDREN_DELTA );
+	self->_children->_noJournalingInCopy = True; /* Important... else _Stream_Copy ends up stuck in a recursive copy loop */
+}
+
+
+void _Stream_Delete( void* stream )
+{
+	Index i;
+	
+	Stream* self = (Stream*)stream;
+	
+	#if DEBUG
+		assert( self );
+	#endif
+
+	Stg_Class_Delete( self->_indent );
+
+	if ( self->_formatter != NULL )
+	{
+		for ( i = 0; i < self->_formatterCount; ++i )
+		{
+			Stg_Class_Delete( self->_formatter[i] );
+		}
+		Memory_Free( self->_formatter );
+	}
+
+	if ( self->_currentSource ) Memory_Free( self->_currentSource );
+	if ( self->_currentFunction ) Memory_Free( self->_currentFunction );
+
+	Stg_ObjectList_DeleteAllObjects( self->_children );
+	Stg_Class_Delete( self->_children );
+
+	/* Stg_Class_Delete parent */
+	_Stg_Object_Delete( self );
+}
+
+
+void _Stream_Print( void* stream, Stream* paramStream )
+{
+	Stream* self = (Stream*) stream;
+
+	#if DEBUG
+		assert( self );
+	#endif
+	
+	/* General info */
+	Journal_Printf( paramStream, "Stream (ptr): %p\n", self );
+	
+	/* Print parent */
+	_Stg_Object_Print( self, paramStream );
+	
+	Stream_Indent( paramStream );
+	/* Virtual info */
+	Journal_Printf( paramStream, "_printf (func ptr): %p\n", self->_printf );
+	Journal_Printf( paramStream, "_write (func ptr): %p\n", self->_write );
+	Journal_Printf( paramStream, "_dump (func ptr): %p\n", self->_dump );
+	Journal_Printf( paramStream, "_setFile (func ptr): %p\n", self->_setFile );
+	Journal_Printf( paramStream, "_copy (func ptr): %p\n", self->_copy );
+	
+	/* Stream info */
+	Journal_Printf( paramStream, "_enable: %d\n", self->_enable );
+	Journal_Printf( paramStream, "_level: %d\n", self->_level );
+	Journal_Printf( paramStream, "_file (ptr):  %p\n", self->_file );
+	Journal_Printf( paramStream, "_printingRank: %d\n", self->_printingRank );
+	Journal_Printf( paramStream, "_autoFlush: %d\n", self->_autoFlush );
+	Journal_Printf( paramStream, "_indent: %d\n", self->_indent->_indent );
+	Journal_Printf( paramStream, "_formatters (ptr):  %p\n", self->_formatter );
+	Journal_Printf( paramStream, "_formatter count: %d\n", self->_formatterCount );
+	Journal_Printf( paramStream, "_formatter size: %d\n", self->_formatterSize );
+	/*
+	Journal_Printf( paramStream, "current source file: %s\n", self->_currentSource );
+	Journal_Printf( paramStream, "current function: %s\n", self->_currentFunction );
+	Journal_Printf( paramStream, "current line: %d\n", self->_currentLine );
+	*/
+	Journal_Printf( paramStream, "_parent (ptr): %p\n", self->_parent );
+
+	Stream_Indent( paramStream );
+
+	Stg_Class_Print( self->_children, paramStream );
+
+	Stream_UnIndent( paramStream );
+
+	Stream_UnIndent( paramStream );
+}
+
+
+void Stream_PrintConcise( void* stream, Stream* paramStream )
+{
+	Stream* self = (Stream*) stream;
+	Index   child_I = 0;
+
+	#if DEBUG
+		assert( self );
+	#endif
+	
+	/* General info */
+	Journal_Printf( paramStream, "Stream \"%s\":\n", self->name );
+	
+	Stream_Indent( paramStream );
+	
+	/* Stream info */
+	Journal_Printf( paramStream, "Enabled: %s\n", self->_enable ? "True" : "False" );
+	Journal_Printf( paramStream, "Level: %d\n", self->_level );
+
+	if ( self->_children->count > 0 ) {
+		Journal_Printf( paramStream, "Children:\n" );
+		Stream_Indent( paramStream );
+		for ( child_I = 0; child_I < self->_children->count; child_I++ ) {
+			Stream_PrintConcise( self->_children->data[child_I], paramStream );
+		}
+		Stream_UnIndent( paramStream );
+	}
+
+	Stream_UnIndent( paramStream );
+}
+
+
+void* _Stream_Copy( const void* stream, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Stream*		self = (Stream*)stream;
+	Stream*		newStream;
+	unsigned	i;
+	
+	newStream = (Stream*)_Stg_Object_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	newStream->_printf = self->_printf;
+	newStream->_write = self->_write;
+	newStream->_dump = self->_dump;
+	newStream->_setFile = self->_setFile;
+	newStream->defaultFileType = self->defaultFileType;
+	newStream->_copy = self->_copy;
+	newStream->_enable = self->_enable;
+	newStream->_level = self->_level;
+	newStream->_file = self->_file;
+	newStream->_printingRank = self->_printingRank;
+	newStream->_autoFlush = self->_autoFlush;
+	newStream->_indent = (IndentFormatter*)IndentFormatter_New();
+	newStream->_formatter = NULL;
+	newStream->_formatterCount = 0;
+	newStream->_formatterSize = 0;
+	newStream->_currentSource = NULL;
+	newStream->_currentFunction = NULL;
+	newStream->_currentLine = 0;
+	newStream->_parent = self->_parent;
+/*	newStream->_children = Stg_Class_Copy( self->_children, 0 , deep, nameExt, ptrMap );*/
+	newStream->_children = Stg_ObjectList_New2( STREAM_CHILDREN_SIZE, STREAM_CHILDREN_DELTA );
+
+	
+	IndentFormatter_SetIndent( newStream->_indent, self->_indent->_indent );
+	for ( i = 0; i < self->_formatterCount; ++i ) {
+          Stream_AddFormatter( newStream, (StreamFormatter*)Stg_Class_Copy( self->_formatter[i], 0, deep, nameExt, ptrMap ) );
+		/**set stream for formatter */
+	}
+	
+	return newStream;
+}
+
+
+SizeT Stream_Printf( Stream *stream, const char *fmt, va_list args )
+{
+	Index i;
+	SizeT result;
+	Name lastFormat;
+	Name currentFormat;
+
+	if ( stream->_file == NULL ) {
+		return 0;
+	}
+	if ( !_Stream_IsPrintingRank( stream ) )
+	{
+		return 0;
+	}
+
+	JournalFile_ReopenIfClosed( stream->_file );
+
+	currentFormat = StreamFormatter_Format( stream->_indent, fmt );
+	lastFormat = currentFormat;
+
+	for ( i = 0; i < stream->_formatterCount; ++i )
+	{
+		currentFormat = StreamFormatter_Format( stream->_formatter[i], lastFormat );
+		lastFormat = currentFormat;
+	}
+	result = stream->_printf( stream, currentFormat, args );
+
+	if ( stream->_autoFlush )
+	{
+		Stream_Flush( stream );
+	}
+	return result;
+}
+SizeT Stream_Write( Stream *stream, const void *data, SizeT elem_size, SizeT num_elems )
+{
+	SizeT result;
+
+	if ( stream->_file == NULL ) {
+		return 0;
+	}
+	if ( !_Stream_IsPrintingRank( stream ) )
+	{
+		return 0;
+	}
+	
+	JournalFile_ReopenIfClosed( stream->_file );
+
+	result =  stream->_write( stream, data, elem_size, num_elems );
+
+	if( stream->_autoFlush )
+	{
+		Stream_Flush( stream );
+	}
+	return result;
+}
+
+Bool Stream_Dump( Stream *stream, const void *data )
+{
+	Bool result;
+	
+	if ( stream->_file == NULL ) {
+		return False;
+	}
+	if ( !_Stream_IsPrintingRank( stream ) )
+	{
+		return False;
+	}
+
+	JournalFile_ReopenIfClosed( stream->_file );
+
+	result = stream->_dump( stream, data );
+
+	if ( stream->_autoFlush )
+	{
+		Stream_Flush( stream );
+	}
+
+	return result;
+}
+
+Bool Stream_RedirectFile( Stream* stream, const Name fileName ) {
+	JournalFile* file;
+
+	file = Journal_GetFile( fileName );
+	if ( file == NULL ) {
+		file = stream->defaultFileType();
+		if ( !JournalFile_Open( file, fileName ) ) {
+			Stg_Class_Delete( file );
+			return False;
+		}
+		Journal_RegisterFile( file );
+	}
+
+	return Stream_SetFile( stream, file );
+}
+
+Bool Stream_RedirectAllToFile( const Name fileName ) {
+	char* infoStreamFilename;
+	char* debugStreamFilename;
+	char* dumpStreamFilename;
+	char* errorStreamFilename;
+
+	Stg_asprintf( &infoStreamFilename, "%s.info", fileName );
+	Stg_asprintf( &debugStreamFilename, "%s.debug", fileName );
+	Stg_asprintf( &dumpStreamFilename, "%s.dump", fileName );
+	Stg_asprintf( &errorStreamFilename, "%s.error", fileName );
+
+	if( Stream_RedirectFile( Journal_GetTypedStream( Info_Type ), infoStreamFilename ) &&
+		Stream_RedirectFile( Journal_GetTypedStream( Debug_Type ), debugStreamFilename ) &&
+		Stream_RedirectFile( Journal_GetTypedStream( Dump_Type ), dumpStreamFilename ) &&
+		Stream_RedirectFile( Journal_GetTypedStream( Error_Type ), errorStreamFilename ) ) {
+		
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Info_Type ) );
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Debug_Type ) );
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Dump_Type ) );
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Error_Type ) );
+
+		return True;
+	}
+	else
+		return False;
+}
+
+void Stream_PurgeAllRedirectedFiles( void ) {
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Info_Type ) );
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Debug_Type ) );
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Dump_Type ) );
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Error_Type ) );
+}
+
+Bool Stream_RedirectFileBranch( Stream* stream, const Name fileName ) {
+	JournalFile* file;
+
+	file = Journal_GetFile( fileName );
+	if ( file == NULL ) {
+		file = stream->defaultFileType();
+		JournalFile_Open( file, fileName );
+		Journal_RegisterFile( file );
+	}
+
+	return Stream_SetFileBranch( stream, file );
+}
+
+Bool Stream_AppendFile( Stream* stream, const Name fileName ) {
+	JournalFile* file;
+
+	file = Journal_GetFile( fileName );
+	if ( file == NULL ) {
+		file = stream->defaultFileType();
+		if ( !JournalFile_Append( file, fileName ) ) {
+			Stg_Class_Delete( file );
+			return False;
+		}
+		Journal_RegisterFile( file );
+	}
+
+	return Stream_SetFile( stream, file );
+}
+
+Bool Stream_SetFile( Stream* stream, JournalFile* file )
+{
+	if ( file == NULL )
+	{
+		return False;
+	}
+	
+	return stream->_setFile( stream, file );
+}
+Bool Stream_SetFileBranch( Stream* stream, JournalFile* file )
+{
+	Bool result = False;
+	Index i;
+	
+	if ( file == NULL )
+	{
+		return False;
+	}
+	
+	result = stream->_setFile( stream, file );
+	for ( i = 0; result && i < stream->_children->count; ++i )
+	{
+		result = Stream_SetFileBranch( (Stream*)stream->_children->data[i], file );
+		if ( !result )
+		{
+			return False;
+		}
+	}
+	return result;
+}
+
+JournalFile* Stream_GetFile( void* stream ) {
+	Stream* self = (Stream*) stream;
+
+	return self->_file;
+}
+
+Bool Stream_IsEnable( void* stream )
+{
+	Stream* self = (Stream*) stream;
+	if (stream == NULL) return False;
+	
+	if ( self->_parent == NULL )
+	{
+		return self->_enable;
+	}
+	
+	return (self->_enable && Stream_IsEnable( self->_parent )) ? True : False;
+}
+
+void Stream_Enable( void* stream, Bool enable )
+{
+	Stream* self = (Stream*) stream;
+	self->_enable = enable;
+	
+	/* set path of enable is only set when true */	
+	if ( enable && self->_parent != NULL )
+	{
+		Stream_Enable( self->_parent, True );
+	}
+}
+void Stream_EnableBranch( void* stream, Bool enable )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	self->_enable = enable;
+	
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_EnableBranch( (Stream*)self->_children->data[i], enable );
+	}
+}
+void Stream_EnableSelfOnly( void* stream, Bool enable )
+{
+	Stream* self = (Stream*) stream;
+	self->_enable = enable;
+}
+
+void Stream_SetPrintingRank( void* stream, int rank )
+{
+	Stream* self = (Stream*) stream;
+	self->_printingRank = rank;
+}
+
+int Stream_GetPrintingRank( void* stream )
+{
+	Stream* self = (Stream*) stream;
+	return self->_printingRank;
+}
+
+void Stream_SetPrintingRankBranch( void* stream, int rank )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	self->_printingRank = rank;
+	
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_SetPrintingRankBranch( self->_children->data[i], rank );
+	}
+}
+
+void Stream_SetAutoFlush( void* stream, Bool autoFlush )
+{
+	Stream* self = (Stream*) stream;
+	self->_autoFlush = autoFlush;
+}
+
+Bool Stream_GetAutoFlush( void* stream )
+{
+	Stream* self = (Stream*) stream;
+	return self->_autoFlush;
+}
+
+void Stream_SetAutoFlushBranch( void* stream, Bool autoFlush )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	self->_autoFlush = autoFlush;
+	
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_SetAutoFlushBranch( self->_children->data[i], autoFlush );
+	}
+}
+
+Bool Stream_IsPrintableLevel( void* stream, JournalLevel level )
+{
+	Stream* self = (Stream*) stream;
+	return (self->_level >= level) ? True : False;
+}
+	
+void Stream_SetLevel( void* stream, JournalLevel level )
+{
+	Stream* self = (Stream*) stream;
+	self->_level = level;	
+}
+void Stream_SetLevelBranch( void* stream, JournalLevel level )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	self->_level = level;	
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_SetLevelBranch( (Stream*)self->_children->data[i], level );
+	}
+
+}
+
+void Stream_SetIndent( void* stream, Index indent )
+{
+	Stream* self = (Stream*) stream;
+	IndentFormatter_SetIndent( self->_indent, indent );
+}
+
+void Stream_Indent( void* stream )
+{
+	Stream* self = (Stream*) stream;
+	IndentFormatter_Increment( self->_indent );
+}
+
+void Stream_UnIndent( void* stream )
+{
+	Stream* self = (Stream*) stream;
+	IndentFormatter_Decrement( self->_indent );
+}
+
+void Stream_ZeroIndent( void* stream )
+{
+	Stream* self = (Stream*) stream;
+	IndentFormatter_Zero( self->_indent );
+}
+
+
+void Stream_SetIndentBranch( void* stream, Index indent )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	IndentFormatter_SetIndent( self->_indent, indent );
+
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_SetIndentBranch( self->_children->data[i], indent );
+	}
+}
+void Stream_IndentBranch( void* stream )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	IndentFormatter_Increment( self->_indent );
+
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_IndentBranch( self->_children->data[i] );
+	}
+}
+void Stream_UnIndentBranch( void* stream )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	IndentFormatter_Decrement( self->_indent );
+
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_UnIndentBranch( self->_children->data[i] );
+	}
+}
+void Stream_ZeroIndentBranch( void* stream )
+{
+	Index i;
+	Stream* self = (Stream*) stream;
+	
+	IndentFormatter_Zero( self->_indent );
+
+	for ( i = 0; i < self->_children->count; ++i )
+	{
+		Stream_ZeroIndentBranch( self->_children->data[i] );
+	}
+}
+
+void Stream_AddFormatter( void* stream, StreamFormatter* formatter )
+{
+	Stream* self = (Stream*) stream;
+	
+	if ( self->_formatterCount >= self->_formatterSize )
+	{
+		if ( self->_formatter == NULL )
+		{
+			self->_formatterSize = STREAM_FORMATTER_SIZE;
+			self->_formatter = Memory_Alloc_Array( StreamFormatter*, self->_formatterSize, "Stream->_formatter" );
+		}
+		else
+		{
+			self->_formatterSize += STREAM_FORMATTER_DELTA;
+			self->_formatter = Memory_Realloc_Array( self->_formatter, StreamFormatter*, self->_formatterSize );
+		}
+	}
+	self->_formatter[self->_formatterCount] = formatter;
+	self->_formatterCount++;
+	
+	formatter->_stream = self;
+}
+
+void Stream_ClearCustomFormatters( void* stream ) {
+	Stream* self = (Stream*) stream;
+
+	Memory_Free( self->_formatter );
+	self->_formatter = NULL;
+	self->_formatterSize = 0;
+	self->_formatterCount = 0;
+}
+
+
+void Stream_SetCurrentInfo( void* stream, Name const currentSource, const char* const currentFunction, int line )
+{
+	Stream* self = (Stream*)stream;
+
+	if ( self->_currentSource ) Memory_Free( self->_currentSource );
+	if ( self->_currentFunction ) Memory_Free( self->_currentFunction );
+	Stg_asprintf( &self->_currentSource, "%s", currentSource );
+	Stg_asprintf( &self->_currentFunction, "%s", currentFunction );
+	self->_currentLine = line;
+}
+
+
+Stream* Stream_RegisterChild( void* stream, Name name )
+{
+	Stream* self = (Stream*) stream;
+	Stream* child;
+	
+	child = (Stream*)Stg_ObjectList_Get( self->_children, name );
+	
+	if ( child == NULL )
+	{
+          child = (Stream*)Stg_Class_Copy( self, 0, True, 0, 0 );
+          Stg_Object_SetName( child, name );
+          child->_parent = self;
+          Stg_ObjectList_Append( self->_children, child );
+	}
+	
+	return child;
+}
+
+Bool Stream_Flush( void* stream )
+{
+	Stream* self = (Stream*)stream;
+	return JournalFile_Flush( self->_file );
+}
+
+Bool Stream_CloseFile( void* stream ) {
+	Stream* self = (Stream*)stream;
+
+	return JournalFile_Close( self->_file );
+}
+
+void Stream_CloseAndFreeFile( void* stream ) {
+	Stream* self = (Stream*)stream;
+
+	Stream_CloseFile( self );
+	Journal_DeregisterFile( self->_file );
+	Stg_Class_Delete( self->_file );
+}
+
+
+Bool _Stream_IsPrintingRank( Stream* stream )
+{
+	int rank;
+	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+	
+	if ( stream->_printingRank > STREAM_ALL_RANKS && rank != stream->_printingRank )
+	{
+		return False;
+	}
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/StreamFormatter.c
--- a/Base/IO/src/StreamFormatter.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: StreamFormatter.c 3774 2006-08-31 07:39:32Z KathleenHumble $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Journal.h"
-#include "StreamFormatter.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-const Type StreamFormatter_Type = "StreamFormatter";
-
-StreamFormatter* _StreamFormatter_New(  STREAMFORMATTER_DEFARGS  )
-{
-	StreamFormatter* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(StreamFormatter) );
-	self = (StreamFormatter*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-                                                                                
-	_StreamFormatter_Init( self, _format );
-
-	return self;
-}
-void _StreamFormatter_Init(
-	StreamFormatter*		self,
-	StreamFormatter_FormatFunction*	_format )
-{
-	self->_format = _format;
-	
-	self->_stream = NULL;
-}
-
-void _StreamFormatter_Delete( void* formatter )
-{
-	StreamFormatter* self = (StreamFormatter*)formatter;
-	
-	#if DEBUG
-		assert( self );
-	#endif
-
-	/* Stg_Class_Delete parent */
-	_Stg_Class_Delete( self );
-}
-void _StreamFormatter_Print( void* formatter, Stream* stream )
-{
-	StreamFormatter* self = (StreamFormatter*) formatter;
-
-	#if DEBUG
-		assert( self );
-		assert( stream );
-	#endif
-	
-	/* General info */
-	printf( "StreamFormatter (ptr): %p\n", formatter );
-	
-	/* Print parent */
-	_Stg_Class_Print( self, stream );
-	
-	/* Virtual info */
-	printf( "\t_format (func ptr): %p\n", (void*)self->_format );
-	printf( "\t_copy (func ptr): %p\n", (void*)self->_copy );
-	printf( "\t_stream (ptr): %p\n", (void*)self->_stream );
-}
-
-void* _StreamFormatter_Copy( const void* streamFormatter, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	StreamFormatter*	self = (StreamFormatter*)streamFormatter;
-	StreamFormatter*	newStreamFormatter;
-	
-	newStreamFormatter = (StreamFormatter*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	newStreamFormatter->_format = self->_format;
-	newStreamFormatter->_stream = NULL;
-	
-	return newStreamFormatter;
-}
-
-
-Name StreamFormatter_Format( void* formatter, const char* const fmt )
-{
-	StreamFormatter* self = (StreamFormatter*)formatter;
-	return self->_format( self, fmt );
-}
-
-
-StreamFormatter_Buffer* stgStreamFormatter_Buffer;
-
-StreamFormatter_Buffer* StreamFormatter_Buffer_New() {
-	StreamFormatter_Buffer* result = Memory_Alloc( StreamFormatter_Buffer, "StreamFormatter_Buffer" );
-	result->buffer1 = NULL;
-	result->buffer2 = NULL;
-	result->length1 = 0;
-	result->length2 = 0;
-	result->current = &result->buffer1;
-	result->lengthPtr = &result->length1;
-
-	return result;
-}
-void StreamFormatter_Buffer_Delete( StreamFormatter_Buffer* buffer ) {
-	if ( buffer->buffer1 != NULL ) {
-		Memory_Free( buffer->buffer1 );
-	}
-	if ( buffer->buffer2 != NULL ) {
-		Memory_Free( buffer->buffer2 );
-	}
-
-	Memory_Free( buffer );
-}
-char* StreamFormatter_Buffer_AllocNext( Index size ) {
-
-	/* Buffer swap */
-	if ( stgStreamFormatter_Buffer->current == &stgStreamFormatter_Buffer->buffer1 ) {
-		stgStreamFormatter_Buffer->current = &stgStreamFormatter_Buffer->buffer2;
-		stgStreamFormatter_Buffer->lengthPtr = &stgStreamFormatter_Buffer->length2;
-	}
-	else {
-		stgStreamFormatter_Buffer->current = &stgStreamFormatter_Buffer->buffer1;
-		stgStreamFormatter_Buffer->lengthPtr = &stgStreamFormatter_Buffer->length1;
-	}
-
-	/* Realloc/alloc as needed: make sure stats get entered */
-	if ( size > *stgStreamFormatter_Buffer->lengthPtr ) {
-		*stgStreamFormatter_Buffer->lengthPtr = size;
-      if ( *stgStreamFormatter_Buffer->current == NULL ) {
-         *stgStreamFormatter_Buffer->current = Memory_Alloc_Array( char, size, "StreamFormatter-Buffer-Current" );
-      }
-      else {
-		   *stgStreamFormatter_Buffer->current = (char*)Memory_Realloc_Array( *stgStreamFormatter_Buffer->current, char, size );
-      }
-	}
-
-	return *stgStreamFormatter_Buffer->current;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/StreamFormatter.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/StreamFormatter.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,167 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: StreamFormatter.c 3774 2006-08-31 07:39:32Z KathleenHumble $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Journal.h"
+#include "StreamFormatter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+const Type StreamFormatter_Type = "StreamFormatter";
+
+StreamFormatter* _StreamFormatter_New(  STREAMFORMATTER_DEFARGS  )
+{
+	StreamFormatter* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(StreamFormatter) );
+	self = (StreamFormatter*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+                                                                                
+	_StreamFormatter_Init( self, _format );
+
+	return self;
+}
+void _StreamFormatter_Init(
+	StreamFormatter*		self,
+	StreamFormatter_FormatFunction*	_format )
+{
+	self->_format = _format;
+	
+	self->_stream = NULL;
+}
+
+void _StreamFormatter_Delete( void* formatter )
+{
+	StreamFormatter* self = (StreamFormatter*)formatter;
+	
+	#if DEBUG
+		assert( self );
+	#endif
+
+	/* Stg_Class_Delete parent */
+	_Stg_Class_Delete( self );
+}
+void _StreamFormatter_Print( void* formatter, Stream* stream )
+{
+	StreamFormatter* self = (StreamFormatter*) formatter;
+
+	#if DEBUG
+		assert( self );
+		assert( stream );
+	#endif
+	
+	/* General info */
+	printf( "StreamFormatter (ptr): %p\n", formatter );
+	
+	/* Print parent */
+	_Stg_Class_Print( self, stream );
+	
+	/* Virtual info */
+	printf( "\t_format (func ptr): %p\n", (void*)self->_format );
+	printf( "\t_copy (func ptr): %p\n", (void*)self->_copy );
+	printf( "\t_stream (ptr): %p\n", (void*)self->_stream );
+}
+
+void* _StreamFormatter_Copy( const void* streamFormatter, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	StreamFormatter*	self = (StreamFormatter*)streamFormatter;
+	StreamFormatter*	newStreamFormatter;
+	
+	newStreamFormatter = (StreamFormatter*)_Stg_Class_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	newStreamFormatter->_format = self->_format;
+	newStreamFormatter->_stream = NULL;
+	
+	return newStreamFormatter;
+}
+
+
+Name StreamFormatter_Format( void* formatter, const char* const fmt )
+{
+	StreamFormatter* self = (StreamFormatter*)formatter;
+	return self->_format( self, fmt );
+}
+
+
+StreamFormatter_Buffer* stgStreamFormatter_Buffer;
+
+StreamFormatter_Buffer* StreamFormatter_Buffer_New() {
+	StreamFormatter_Buffer* result = Memory_Alloc( StreamFormatter_Buffer, "StreamFormatter_Buffer" );
+	result->buffer1 = NULL;
+	result->buffer2 = NULL;
+	result->length1 = 0;
+	result->length2 = 0;
+	result->current = &result->buffer1;
+	result->lengthPtr = &result->length1;
+
+	return result;
+}
+void StreamFormatter_Buffer_Delete( StreamFormatter_Buffer* buffer ) {
+	if ( buffer->buffer1 != NULL ) {
+		Memory_Free( buffer->buffer1 );
+	}
+	if ( buffer->buffer2 != NULL ) {
+		Memory_Free( buffer->buffer2 );
+	}
+
+	Memory_Free( buffer );
+}
+char* StreamFormatter_Buffer_AllocNext( Index size ) {
+
+	/* Buffer swap */
+	if ( stgStreamFormatter_Buffer->current == &stgStreamFormatter_Buffer->buffer1 ) {
+		stgStreamFormatter_Buffer->current = &stgStreamFormatter_Buffer->buffer2;
+		stgStreamFormatter_Buffer->lengthPtr = &stgStreamFormatter_Buffer->length2;
+	}
+	else {
+		stgStreamFormatter_Buffer->current = &stgStreamFormatter_Buffer->buffer1;
+		stgStreamFormatter_Buffer->lengthPtr = &stgStreamFormatter_Buffer->length1;
+	}
+
+	/* Realloc/alloc as needed: make sure stats get entered */
+	if ( size > *stgStreamFormatter_Buffer->lengthPtr ) {
+		*stgStreamFormatter_Buffer->lengthPtr = size;
+      if ( *stgStreamFormatter_Buffer->current == NULL ) {
+         *stgStreamFormatter_Buffer->current = Memory_Alloc_Array( char, size, "StreamFormatter-Buffer-Current" );
+      }
+      else {
+		   *stgStreamFormatter_Buffer->current = (char*)Memory_Realloc_Array( *stgStreamFormatter_Buffer->current, char, size );
+      }
+	}
+
+	return *stgStreamFormatter_Buffer->current;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/XML_IO_Handler.c
--- a/Base/IO/src/XML_IO_Handler.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2351 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Dictionary.h"
-#include "Dictionary_Entry.h"
-#include "Dictionary_Entry_Value.h"
-#include "IO_Handler.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "Stream.h"
-#include "PathUtils.h"
-#include <libxml/tree.h>
-#include "XML_IO_Handler.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xmlreader.h>
-#include <libxml/xmlversion.h>
-
-/* textual class name */
-const Type XML_IO_Handler_Type = "XML_IO_Handler";
-
-/** The Xml search path list. */
-Stg_ObjectList* Project_XMLSearchPaths = NULL;
-
-#define XML_OLD_DTD 1
-
-/* keyword strings for nodes and lists */
-static const xmlChar* INCLUDE_TAG = (const xmlChar*) "include";
-static const xmlChar* NAME_ATTR = (const xmlChar*) "name";
-static const xmlChar* SOURCEFILE_ATTR = (const xmlChar*) "sourceFile";
-static const xmlChar* MERGETYPE_ATTR = (const xmlChar*) "mergeType";
-static const xmlChar* CHILDRENMERGETYPE_ATTR = (const xmlChar*) "childrenMergeType";
-static const xmlChar* TYPE_ATTR = (const xmlChar*) "type";
-static const xmlChar* PARAMTYPE_ATTR = (const xmlChar*) "paramType";
-#ifdef XML_OLD_DTD
-static const xmlChar* LIST_TAG = (const xmlChar*) "list";
-static const xmlChar* STRUCT_TAG = (const xmlChar*) "struct";
-static const xmlChar* PARAM_TAG = (const xmlChar*) "param";
-#endif
-static const xmlChar* LIST_ATTR = (const xmlChar*) "list";
-static const xmlChar* STRUCT_ATTR = (const xmlChar*) "struct";
-static const xmlChar* PARAM_ATTR = (const xmlChar*) "param";
-
-static const xmlChar* ASCII_DATA_TAG = (const xmlChar*) "asciidata";
-static const xmlChar* COLUMN_DEFINITION_TAG = (const xmlChar*) "columnDefinition";
-
-const xmlChar* APPEND_TAG = (const xmlChar*) "append";
-const xmlChar* MERGE_TAG = (const xmlChar*) "merge";
-const xmlChar* REPLACE_TAG = (const xmlChar*) "replace";
-const xmlChar* XML_IO_Handler_MergeTypeMap[3];
-
-static const xmlChar* SEARCH_PATH_TAG = (const xmlChar*) "searchPath";
-static const xmlChar* ELEMENT_TAG = (const xmlChar*) "element";
-
-static const xmlChar* PLUGINS_TAG = (const xmlChar*) "plugins";
-static const xmlChar* PLUGIN_TAG = (const xmlChar*) "plugin";
-static const xmlChar* IMPORT_TAG = (const xmlChar*) "import";
-static const xmlChar* TOOLBOX_TAG = (const xmlChar*) "toolbox";
-static const xmlChar* COMPONENTS_TAG = (const xmlChar*) "components";
-
-
-/* Namespace and root node to validate against - please update on new releases */
-static const xmlChar* ROOT_NODE_NAME = (xmlChar*) "StGermainData";
-static const xmlChar* XML_VERSION = (xmlChar*) "1.0";
-
-/** column handling for ascii/binary data */
-#define MAX_COLUMNS 100
-static const unsigned int MAX_COLUMN_NUM_LENGTH = 3;
-
-/** struct to store column info in */
-typedef struct {
-	char* name;
-	Dictionary_Entry_Value_Type dictValueType;
-} ColumnInfo;	
-
-static Name ASCII_DELIMITERS = " \n\t";
-
-static const unsigned int ASCII_LIST_STRING_BUFFER_SIZE = 1024;
-
-
-/* Reading Function prototypes */
-static xmlNodePtr _XML_IO_Handler_OpenCheckFile( XML_IO_Handler*, Name );
-static xmlNodePtr _XML_IO_Handler_OpenCheckBuffer( XML_IO_Handler*, Name );
-static void _XML_IO_Handler_OpenFile( XML_IO_Handler*, Name );
-static void _XML_IO_Handler_ValidateFile( XML_IO_Handler*, Name );
-static void _XML_IO_Handler_OpenBuffer( XML_IO_Handler*, Name );
-static Bool _XML_IO_Handler_Check( XML_IO_Handler*, xmlDocPtr currDoc );
-static void _XML_IO_Handler_ParseNodes( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source source );
-static void _XML_IO_Handler_ParseList( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParseElement( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParseAsciiData( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value* );
-static void _XML_IO_Handler_ParseColumnDefinitions( XML_IO_Handler*, xmlNodePtr, ColumnInfo [MAX_COLUMNS], int* const );
-static void _XML_IO_Handler_ParseAsciiValue( char* asciiValue, ColumnInfo* columnInfo, Dictionary_Entry_Value* toDictStruct );
-static char* _XML_IO_Handler_GetNextAsciiToken( XML_IO_Handler*, xmlNodePtr );
-static void _XML_IO_Handler_ParseStruct( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParseParameter( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParsePlugins( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParsePlugin( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParseImport( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParseToolbox( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static void _XML_IO_Handler_ParseComponents( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
-					Dictionary_MergeType, Dictionary_Entry_Source );
-static Dictionary_Entry_Value_Type _XML_IO_Handler_GetDictValueType( XML_IO_Handler* self, char* type );
-static Dictionary_MergeType _XML_IO_Handler_GetMergeType( XML_IO_Handler* self, const xmlChar* mergeTypeStr, 
-		Name funcName, const char* tagStr, xmlChar* entryName, Dictionary_MergeType defaultMergeType );
-static xmlChar* _XML_IO_Handler_StripLeadingTrailingWhiteSpace( XML_IO_Handler* self, const xmlChar* const );
-static Bool _XML_IO_Handler_IsOnlyWhiteSpace( char* );
-/* Writing Function prototypes */
-static void _XML_IO_Handler_WriteDictionary( XML_IO_Handler*, Dictionary*, xmlNodePtr);
-static void _XML_IO_Handler_WriteNode( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
-static void _XML_IO_Handler_WriteList( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
-static void _XML_IO_Handler_WriteListElementsXML( XML_IO_Handler*, Dictionary_Entry_Value*, xmlNodePtr);
-static Bool _XML_IO_Handler_CheckListCanBePrintedRaw( Dictionary_Entry_Value* );
-static void _XML_IO_Handler_WriteListElementsRawASCII( XML_IO_Handler*, Dictionary_Entry_Value*, xmlNodePtr);
-static unsigned int _XML_IO_Handler_GetWrittenElementSize( XML_IO_Handler*, Dictionary_Entry_Value* );
-static void _XML_IO_Handler_WriteMemberAscii( XML_IO_Handler*, Dictionary_Entry_Value*, char* );
-static void _XML_IO_Handler_WriteListElementsRawBinary( XML_IO_Handler*, Dictionary_Entry_Value*, xmlNodePtr);
-static void _XML_IO_Handler_WriteStruct( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
-static void _XML_IO_Handler_WriteParameter( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
-
-
-XML_IO_Handler* XML_IO_Handler_New( void ) {
-	/* Variables set in this function */
-	SizeT                                                           _sizeOfSelf = sizeof(XML_IO_Handler);
-	Type                                                                   type = XML_IO_Handler_Type;
-	Stg_Class_DeleteFunction*                                           _delete = _XML_IO_Handler_Delete;
-	Stg_Class_PrintFunction*                                             _print = _XML_IO_Handler_Print;
-	Stg_Class_CopyFunction*                                               _copy = NULL;
-	IO_Handler_ReadAllFromFileFunction*                        _readAllFromFile = _XML_IO_Handler_ReadAllFromFile;
-	IO_Handler_ReadAllFromFileForceSourceFunction*  _readAllFromFileForceSource = _XML_IO_Handler_ReadAllFromFileForceSource;
-	IO_Handler_ReadAllFromBufferFunction*                    _readAllFromBuffer = _XML_IO_Handler_ReadAllFromBuffer;
-	IO_Handler_WriteAllToFileFunction*                          _writeAllToFile = _XML_IO_Handler_WriteAllToFile;
-	XML_IO_Handler_WriteEntryToFileFunction*                  _writeEntryToFile = _XML_IO_Handler_WriteEntryToFile;
-	XML_IO_Handler_SetListEncodingFunction*                    _setListEncoding = _XML_IO_Handler_SetListEncoding;
-	XML_IO_Handler_SetWritingPrecisionFunction*            _setWritingPrecision = _XML_IO_Handler_SetWritingPrecision;
-	XML_IO_Handler_SetWriteExplicitTypesFunction*        _setWriteExplicitTypes = _XML_IO_Handler_SetWriteExplicitTypes;
-
-	return _XML_IO_Handler_New(  XML_IO_HANDLER_PASSARGS  );
-}
-
-XML_IO_Handler* XML_IO_Handler_New_Schema( XML_IO_Handler* old );
-
-void XML_IO_Handler_Init( XML_IO_Handler* self ) {
-	/* General info */
-	self->type = XML_IO_Handler_Type;
-	self->_sizeOfSelf = sizeof(XML_IO_Handler);
-	self->_deleteSelf = False;
-	
-	/* Virtual info */
-	self->_delete = _XML_IO_Handler_Delete;
-	self->_print = _XML_IO_Handler_Print;
-	self->_writeEntryToFile = _XML_IO_Handler_WriteEntryToFile;
-	self->_setListEncoding = _XML_IO_Handler_SetListEncoding;
-	self->_setWritingPrecision = _XML_IO_Handler_SetWritingPrecision;
-	self->_setWriteExplicitTypes = _XML_IO_Handler_SetWriteExplicitTypes;
-	_Stg_Class_Init( (Stg_Class*)self );
-	_IO_Handler_Init( (IO_Handler*)self );
-	
-	/* XML_IO_Handler info */
-	_XML_IO_Handler_Init( self );
-}
-
-XML_IO_Handler* _XML_IO_Handler_New(  XML_IO_HANDLER_DEFARGS  )
-{
-	XML_IO_Handler* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(XML_IO_Handler) );
-	self = (XML_IO_Handler*)_IO_Handler_New(  IO_HANDLER_PASSARGS  );
-	
-	/* General info */
-	
-	/* Virtual info */
-	self->_writeEntryToFile = _writeEntryToFile;
-	self->_setListEncoding = _setListEncoding;
-	self->_setWritingPrecision = _setWritingPrecision;
-	self->_setWriteExplicitTypes = _setWriteExplicitTypes;
-	
-	/* WallBoundaryConditionLayout info */
-	_XML_IO_Handler_Init( self );
-	
-	return self;
-}
-
-XML_IO_Handler* XML_IO_Handler_New_Schema( XML_IO_Handler* old ) {
-	XML_IO_Handler* newHandler = XML_IO_Handler_New();
-					
-	// copy the schema and validation from prvious XML_IO_Handler
-
-	newHandler->validate = old->validate;
-	if ( old->schema != NULL ) {
-          newHandler->schema = (char*)malloc( strlen( old->schema ) +1 );
-          strcpy( newHandler->schema, old->schema );
-	}
-	return newHandler;
-}
-
-
-static void LookupTypePrint( void* ptr, struct Stream* stream ) {
-	switch( *(Dictionary_Entry_Value_Type*)ptr ) {
-		case Dictionary_Entry_Value_Type_String:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_String\n" );
-			break;
-		case Dictionary_Entry_Value_Type_Double:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Double\n" );
-			break;
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_UnsignedInt\n" );
-			break;
-		case Dictionary_Entry_Value_Type_Int:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Int\n" );
-			break;
-		case Dictionary_Entry_Value_Type_Bool:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Bool\n" );
-			break;
-		case Dictionary_Entry_Value_Type_Struct:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Struct\n" );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_List\n" );
-			break;
-		default:
-			Journal_Printf( stream, "Dictionary_Entry_Value_Type_???\n" );
-			break;
-	}
-}
-
-static void* LookupTypeCopy( const void* ptr, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
-	Dictionary_Entry_Value_Type* newLookupType;
-	
-	Journal_Firewall( deep, Journal_Register( Error_Type, XML_IO_Handler_Type ), "Shallow copy not yet implemented\n" );
-	
-	newLookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*newLookupType = *(Dictionary_Entry_Value_Type*)ptr;
-	
-	return newLookupType;
-}
-
-void _XML_IO_Handler_Init( XML_IO_Handler* self ) {
-	/* General and Virtual info should already be set */
-
-	Dictionary_Entry_Value_Type* lookupType;
-	
-	/* XML_IO_Handler info */
-	self->nameSpacesList = NULL;
-	_XML_IO_Handler_AddNameSpace( self, "http://www.vpac.org/StGermain/XML_IO_Handler/", "Jun2003" );
-	self->resource = NULL;
-	self->currDoc = NULL;
-	self->currNameSpace = NULL;
-	self->tokeniserCalls = 0;
-	self->listEncoding = PerList;
-	self->validate = 0;
-	
-	self->typeKeywords = Stg_ObjectList_New();
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_String;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "string", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_Double;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "double", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_UnsignedInt;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "uint", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_UnsignedInt;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "unsigned int", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_Int;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "int", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_UnsignedLong;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "unsigned long", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_Bool;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "bool", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_Struct;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "struct", 0, LookupTypePrint, LookupTypeCopy );
-	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
-	*lookupType = Dictionary_Entry_Value_Type_List;
-	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "list", 0, LookupTypePrint, LookupTypeCopy );
-	
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_String] = "string";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Double] = "double";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_UnsignedInt] = "uint";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Int] = "int";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_UnsignedLong] = "ulong";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Bool] = "bool";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Struct] = "struct";
-	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_List] = "list";
-	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_String] = 1;
-	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_Double] = 7;
-	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_UnsignedInt] = 6; 
-	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_Int] = 6; 
-	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_UnsignedLong] = 6; 
-	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_Bool] = 1;
-	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_String, 30 );
-	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_Double, 5 );
-	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_UnsignedInt, 5 );
-	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_Int, 5 );
-	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_UnsignedLong, 5 );
-	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_Bool, 5 );
-	self->writeExplicitTypes = False;
-	
-	/* set so that whitespaces in between tags are not parsed, and indentation is generated in the output */
-	xmlKeepBlanksDefault( False );
-	
-	/* search path info */
-	self->searchPathsSize = 0;
-	self->searchPaths = NULL;
-	
-}
-
-
-/** delete the memory used by this level in the class hierarchy. */
-void _XML_IO_Handler_Delete( void* xml_io_handler ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	NameSpaceInfo* currNameSpaceInfo;
-
-	Index ii;
-
-	assert( self );
-	
-	Stg_ObjectList_DeleteAllObjects( self->typeKeywords );
-	Stg_Class_Delete( self->typeKeywords );
-
-	/* delete this level's memory */
-	currNameSpaceInfo = self->nameSpacesList;
-	while ( currNameSpaceInfo ) {
-		NameSpaceInfo* tempNameSpaceInfo = currNameSpaceInfo;
-		currNameSpaceInfo = currNameSpaceInfo->next;	
-		
-		Memory_Free( tempNameSpaceInfo->location );
-		Memory_Free( tempNameSpaceInfo->version );
-		Memory_Free( tempNameSpaceInfo );
-	}
-	
-	for ( ii = 0; ii < self->searchPathsSize; ++ii ) {
-		Memory_Free( self->searchPaths[ii] );
-	}
-	if ( self->searchPaths ) {
-		Memory_Free( self->searchPaths );
-	}
-
-	/* Stg_Class_Delete Parent Stg_Class */
-	_IO_Handler_Delete( self );
-}
-
-
-/** print implementation */
-void _XML_IO_Handler_Print( void* xml_io_handler, Stream* stream ) {
-	XML_IO_Handler* self = (XML_IO_Handler*)xml_io_handler;
-	
-	/* General info */
-	Journal_Printf( stream, "XML_IO_Handler (ptr): %p\n", self );
-	
-	/* Print parent class */
-	_IO_Handler_Print( self, stream );
-	
-	/* Virtual info */
-	Journal_Printf( stream, "\t_writeEntryToFile (func ptr): %p\n", self->_writeEntryToFile );
-	Journal_Printf( stream, "\t_setListEncoding (func ptr): %p\n", self-> _setListEncoding);
-	Journal_Printf( stream, "\t_setWritingPrecision (func ptr): %p\n", self->_setWritingPrecision );
-	Journal_Printf( stream, "\t_setWriteExplicitTypes (func ptr): %p\n", self->_setWriteExplicitTypes );
-	
-	/* XML_IO_Handler */
-	Journal_Printf( stream, "\tcurDoc (ptr)= %p, ", self->currDoc );
-	if( self->currNameSpace ) {
-		Journal_Printf( stream, "currNameSpace: %s\n", self->currNameSpace->href );
-	}
-	else {
-		Journal_Printf( stream, "currNameSpace: (null)\n" );
-	}	
-}
-
-
-/** sets the type of list encoding you'd like output to be written in, see ::ListEncoding enum. */
-void XML_IO_Handler_SetListEncoding( void* xml_io_handler, ListEncoding listEncoding ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	assert ( self );
-	self->_setListEncoding( self, listEncoding );
-}
-
-void _XML_IO_Handler_SetListEncoding( void* xml_io_handler, ListEncoding listEncoding ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	self->listEncoding = listEncoding;
-}
-
-
-/** sets the precision to which output numbers will be printed. Field width's will be correspondingly adjusted
- * automatically. */
-void XML_IO_Handler_SetWritingPrecision( void* xml_io_handler, int dictionaryEntryType, int value ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	assert ( self );
-	self->_setWritingPrecision( xml_io_handler, dictionaryEntryType, value );
-}
-
-void _XML_IO_Handler_SetWritingPrecision( void* xml_io_handler, int dictionaryEntryType, int value ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	assert ( self );
-	self->writingPrecision[dictionaryEntryType] = value; 
-	self->writingFieldWidth[dictionaryEntryType] = value + self->WRITING_FIELD_EXTRAS[dictionaryEntryType];
-}
-
-
-/** Determines whether types will be written explicitly in the output (default: no). If set to yes, the type of each
- * variable will be written as an attribute. */
-void XML_IO_Handler_SetWriteExplicitTypes( void* xml_io_handler, Bool writeExplicitTypes ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	assert ( self );
-	self->_setWriteExplicitTypes( self, writeExplicitTypes );
-}
-
-void _XML_IO_Handler_SetWriteExplicitTypes( void* xml_io_handler, Bool writeExplicitTypes ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	self->writeExplicitTypes = writeExplicitTypes;
-}
-
-
-/** adds a namespace to the list of those that will be checked against when reading a file */
-void _XML_IO_Handler_AddNameSpace( void* xml_io_handler, Name location, const char* version )
-{
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	NameSpaceInfo* newNameSpaceInfo = Memory_Alloc( NameSpaceInfo, "XML_IO_Handler->nameSpaceList" );
-	
-	assert ( self );
-	newNameSpaceInfo->location = StG_Strdup(location);
-	newNameSpaceInfo->version = StG_Strdup(version);
-	newNameSpaceInfo->next = self->nameSpacesList; 
-	self->nameSpacesList = newNameSpaceInfo;
-}
-
-
-/** add a path to the search paths */
-void XML_IO_Handler_AddDirectory( Name name, char* directory ) {
-	Bool				found;
-	Index				dir_i;
-	/* Check if it is a valid path */
-	if ( !directory ) {
-		return;
-	}
-
-	/* Check if dictionary already exists */
-	if(Project_XMLSearchPaths == NULL) {
-		Project_XMLSearchPaths = Stg_ObjectList_New();
-	}
-	
-	/* Add path to global list */
-	found = False;
-	for( dir_i =  0; dir_i < Project_XMLSearchPaths->count; dir_i++ ){
-          if( strcmp( directory, (char*)Stg_ObjectList_ObjectAt( Project_XMLSearchPaths, dir_i ) ) == 0 ) {
-			found = True;
-		}
-	}
-	
-	if( !found ) {
-		Stg_ObjectList_PointerAppend( Project_XMLSearchPaths, StG_Strdup( directory ), name, 0, 0, 0 ); 
-	}
-}	
-/** add a path to the search paths */
-void _XML_IO_Handler_AddSearchPath( void* xml_io_handler, Name path ) {
-	XML_IO_Handler*		self = (XML_IO_Handler*)xml_io_handler;
-
-	if ( !path ) {
-		return;
-	}
-
-	self->searchPathsSize++;
-	
-	if( self->searchPathsSize == 1 ) {
-		self->searchPaths = Memory_Alloc_Array( char*, self->searchPathsSize, "XML_IO_Handler->searchPathsSize" );
-	}
-	else {
-		self->searchPaths = Memory_Realloc_Array( self->searchPaths, char*, self->searchPathsSize );
-	}
-
-	self->searchPaths[ self->searchPathsSize - 1 ] = StG_Strdup( path );
-}
-
-/** Read all parameters from a file implementation. See IO_Handler_ReadAllFromFile(). It will first check if the file
- * exists, and contains valid XML. */
-Bool _XML_IO_Handler_ReadAllFromFile( void* xml_io_handler, Name filename, Dictionary* dictionary ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	xmlNodePtr rootElement = NULL;
-	xmlNodePtr firstElement = NULL;
-	int rank;
-	
-	Journal_DPrintf( Journal_Register( Debug_Type, XML_IO_Handler_Type ), "XML_IO_Handler called to read file %s.\n", filename );
-	
-	assert( self && filename && dictionary );
-	MPI_Comm_rank( MPI_COMM_WORLD, &rank );	
-	/* set the current dictionary to the one being read */
-	self->currDictionary = dictionary;
-
-	/* Order of search*/
-	/* 1. Current directory */
-	/* 2. XML, searched paths */
-	/* 3. XML paths from other projects */
-	/* 4. Environment Variable */
-	/* 5. Default STG_INCLUDE_PATH */
-
-	/* 1. Current directory */
-	{
-          /* $PWD does not work for all ranks, in all mpi implementations
-             "./" however does so far.
-             char* pwd = getenv( "PWD" ); */
-		Name pwd = "./";
-		if ( pwd != NULL ) {
-			_XML_IO_Handler_AddSearchPath( self, pwd );
-		}
-	}
-
-	/* 2. XML, searched paths */
-	if( self->currPath ) /* setup initial search path (currPath) */
-		_XML_IO_Handler_AddSearchPath( self, self->currPath );
-	else
-		_XML_IO_Handler_AddSearchPath( self, "./" );
-
-	/* 3. XML paths from other projects */
-	if (Project_XMLSearchPaths != NULL) {
-		Index index_I;
-		for (index_I = 0; index_I  < Project_XMLSearchPaths->count; index_I++){
-			_XML_IO_Handler_AddSearchPath( 
-					self, 
-					(char*)Stg_ObjectList_ObjectAt( Project_XMLSearchPaths,index_I )
-				); 
-		}
-	}
-	/* 4. Environment Variable */
-	{
-		char* envValue;
-
-		envValue = getenv( "STG_INCLUDE_PATH" );
-		if ( envValue != NULL ) {
-			char* envCopy; 
-			char* token;
-
-			envCopy = StG_Strdup( envValue );
-			token = strtok( envCopy, ":" );
-			while ( token != NULL ) {
-				_XML_IO_Handler_AddSearchPath( self, token );
-				token = strtok( NULL, ":" );
-			}
-
-			Memory_Free( envCopy );
-		}
-	}
-
-	/* 5. Default STG_INCLUDE_PATH */
-	#ifdef STG_INCLUDE_PATH
-		_XML_IO_Handler_AddSearchPath( self, STG_INCLUDE_PATH );
-	#endif
-
-	/* open the file and check syntax */
-	if ( !(rootElement = _XML_IO_Handler_OpenCheckFile( self, filename )) ) {
-		if( self->currDoc )
-			xmlFreeDoc( self->currDoc );
-		return False;
-	}
-	
-	_XML_IO_Handler_ValidateFile( self, filename );
-	
-	/* call parse nodes, starting on the first child */
-	firstElement = rootElement->xmlChildrenNode;
-	_XML_IO_Handler_ParseNodes( self, firstElement, NULL, IO_Handler_DefaultMergeType, NULL );
-	
-	/* free memory */
-	if( self->currDoc )
-		xmlFreeDoc( self->currDoc );
-	xmlCleanupParser();
-	
-	return True;
-}
-
-/** Read all parameters from a file implementation. See IO_Handler_ReadAllFromFile(). It will first check if the file
- * exists, and contains valid XML. 
- * FORCES the source file to be added to each Dictionary_Entry_Source (even if XML didn't have a source entry)*/
-Bool _XML_IO_Handler_ReadAllFromFileForceSource( void* xml_io_handler, Name filename, Dictionary* dictionary ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	xmlNodePtr rootElement = NULL;
-	xmlNodePtr firstElement = NULL;
-	
-	Journal_DPrintf( Journal_Register( Debug_Type, XML_IO_Handler_Type ), "XML_IO_Handler called to read file %s.\n", filename );
-	
-	assert( self && filename && dictionary );
-	
-	/* set the current dictionary to the one being read */
-	self->currDictionary = dictionary;
-	
-	/* setup initial search path (currPath) */
-	if( self->currPath )
-		_XML_IO_Handler_AddSearchPath( self, self->currPath );
-	else
-		_XML_IO_Handler_AddSearchPath( self, "./" );
-	
-	/* open the file and check syntax */
-	if ( !(rootElement = _XML_IO_Handler_OpenCheckFile( self, filename )) ) {
-		xmlCleanupParser();
-		return False;
-	}	
-	
-	/* call parse nodes, starting on the first child */
-	
-
-	firstElement = rootElement->xmlChildrenNode;
-	_XML_IO_Handler_ParseNodes( self, firstElement, NULL, Dictionary_MergeType_Replace, (char*) rootElement->doc->URL );
-	
-	/* free memory */
-	if( self->currDoc )
-		xmlFreeDoc( self->currDoc );
-	xmlCleanupParser();
-	
-	return True;
-}
-
-Bool _XML_IO_Handler_ReadAllFromBuffer( void* xml_io_handler, Name buffer, Dictionary* dictionary ) {
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	xmlNodePtr rootElement = NULL;
-
-	assert( self && buffer && dictionary );
-	
-	/* set the current dictionary to the one being read */
-	self->currDictionary = dictionary;
-	
-	/* open the buffer and check syntax */
-	if ( !(rootElement = _XML_IO_Handler_OpenCheckBuffer( self, buffer )) ) {
-		xmlCleanupParser();
-		return False;
-	}	
-	
-	/* call parse nodes, starting on the first child */
-	_XML_IO_Handler_ParseNodes( self, rootElement, NULL, Dictionary_MergeType_Replace, NULL );
-	
-	/* free memory */
-	if( self->currDoc )
-		xmlFreeDoc( self->currDoc );
-	xmlCleanupParser();
-	
-	return True;
-}
-
-/** Opens a file for reading and checks it contains valid XML code.
- * \return a pointer to the root node if the file is valid, NULL otherwise. */
-static xmlNodePtr _XML_IO_Handler_OpenCheckFile( XML_IO_Handler* self, Name filename )
-{
-   xmlChar		absolute[1024];
-   xmlNodePtr	cur = NULL;
-   Bool			status = False;
-
-   if ( !FindFileInPathList(
-      (char*)absolute,
-      (char*)filename,
-      self->searchPaths,
-      self->searchPathsSize ) )
-   {
-      Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
-      "Error: File %s doesn't exist, not readable, or not valid.\n", filename );
-      exit(EXIT_FAILURE);
-   } 
-
-   _XML_IO_Handler_OpenFile( self, (char*)absolute );
-
-   if( self->currDoc == NULL ) {
-      Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
-      "Error: File %s doesn't exist, not readable, or not valid.\n", filename );
-      exit(EXIT_FAILURE);
-   }
-
-   if( self->currDoc != NULL ) {
-      cur = xmlDocGetRootElement( self->currDoc );
-      status = _XML_IO_Handler_Check( self, self->currDoc );
-
-      if( !status ) {
-         Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
-         "Error: File %s not valid/readable.\n", filename );
-         exit(EXIT_FAILURE);
-      }
-
-      if( status == True )
-         return cur;
-      else
-         return NULL;
-   }
-   else 
-      return NULL; 
-}
-
-static xmlNodePtr _XML_IO_Handler_OpenCheckBuffer( XML_IO_Handler* self, Name buffer ) {
-	xmlNodePtr   rootElement = NULL;
-
-	_XML_IO_Handler_OpenBuffer( self, buffer );
-	if ( self->currDoc == NULL ) {
-		return NULL;
-	}
-
-	rootElement = xmlDocGetRootElement( self->currDoc );
-
-	Journal_Firewall( _XML_IO_Handler_Check( self, self->currDoc ),
-		Journal_Register( Error_Type, XML_IO_Handler_Type ),
-		"Error: XML buffer provided not valid/readable.\n"
-		);
-
-	return rootElement;
-}
-
-#if 0
-static void _processNode(xmlTextReaderPtr reader) {
-	const xmlChar *name, *value;
-
-	name = xmlTextReaderConstName(reader);
-	if (name == NULL)
-	name = BAD_CAST "--";
-
-	value = xmlTextReaderConstValue(reader);
-
-	printf("%d %d %s %d %d", 
-		xmlTextReaderDepth(reader),
-		xmlTextReaderNodeType(reader),
-		name,
-		xmlTextReaderIsEmptyElement(reader),
-		xmlTextReaderHasValue(reader));
-	if (value == NULL)
-		printf("\n");
-	else {
-		if (xmlStrlen(value) > 40)
-			printf(" %.40s...\n", value);
-		else
-			printf(" %s\n", value);
-	}
-}
-#endif
-
-static void _XML_IO_Handler_ValidateFile( XML_IO_Handler* self, Name filename ) {
-	#ifdef LIBXML_VERSION 
-	#if LIBXML_VERSION == 20631
-	xmlTextReaderPtr reader;
-	//int valid;
-	int ret;
-
-	reader = xmlNewTextReaderFilename( filename );
-
-	if ( reader != NULL ) {
-
-		xmlNodePtr cur = NULL;
-		cur = xmlDocGetRootElement( self->currDoc );
-		xmlNsPtr* nsArray = xmlGetNsList( self->currDoc, cur );
-		int i;
-		for (i=0; nsArray[i] != NULL; i++ ) {
-			//if ( *(self->validate) == 1 )
-				//valid = xmlTextReaderSchemaValidate( reader, (Name) nsArray[i]->href );
-		}
-
-
-		ret = xmlTextReaderRead( reader );
-		while ( ret == 1 ) {
-			//_processNode(reader);
-			ret = xmlTextReaderRead( reader );
-		}
-
-		if ( (self->validate) == 1 ) {
-			/*
-			if ( self->schema == NULL )
-				Journal_Firewall( 
-					( self->schema != NULL ), 
-					Journal_Register( Error_Type, XML_IO_Handler_Type ), 
-					"Schema is not provided\n" );
-			*/
-			if ( xmlTextReaderIsValid( reader ) != 1 ) {
-				fprintf( stderr, "%s : failed to parse\n", filename );
-				Journal_Firewall( 
-					xmlTextReaderIsValid( reader ) == 1, 
-					Journal_Register( Error_Type, XML_IO_Handler_Type ), 
-					"Document %s does not validate\n", filename );
-			}
-			else {
-				fprintf( stderr, "Document %s is valid\n", filename );
-			}
-		}
-
-		xmlFreeTextReader( reader );
-		if (ret !=0) {
-			fprintf( stderr, "%s : failed to parse\n", filename );
-		}
-	} else {
-		fprintf( stderr, "unable to open %s\n", filename );
-	}
-	#endif
-	#endif
-    //xmlFree ( reader );
-}
-
-static void _XML_IO_Handler_OpenFile( XML_IO_Handler* self, Name filename ) {
-	/* open an XML file and build an XML tree from it. */
-	/* TODO: validate against simple dtd? */
-	
-	self->currDoc = xmlParseFile( filename );
-	if ( self->currDoc == NULL ) {
-		xmlCleanupParser();
-	}
-	if ( self->resource ) {
-		Memory_Free( self->resource );
-	}
-	self->resource = StG_Strdup( (char*)filename );
-
-}
-
-static void _XML_IO_Handler_OpenBuffer( XML_IO_Handler* self, Name buffer ) {
-	self->currDoc = xmlParseDoc( BAD_CAST buffer );
-	if ( self->resource ) {
-		Memory_Free( self->resource );
-	}
-	self->resource = StG_Strdup( "buffer" );
-}
-
-Bool _XML_IO_Handler_Check( XML_IO_Handler* self, xmlDocPtr currDoc ) {
-	xmlNodePtr	rootElement = NULL;
-	
-	rootElement = xmlDocGetRootElement( self->currDoc );
-	if ( !rootElement ) {
-		Journal_Printf(
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Error: empty document. Not parsing.\n" );
-		return False;
-	}
-	
-	/* check the namespace */
-	if( _XML_IO_Handler_CheckNameSpace( self, rootElement ) == False ) {
-		return False;
-	}
-	
-	/* check root element */
-	if (xmlStrcmp(rootElement->name, (const xmlChar *) ROOT_NODE_NAME)) {
-		Journal_Printf( 
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"resource %s of wrong type, root node =<%s>, should be <%s>.\nNot parsing.\n",
-			self->resource,
-			(Name) rootElement->name, 
-			ROOT_NODE_NAME );
-		return False;
-	}
-	
-	return True;
-}
-
-
-/** given the root node of a document, checks the name space is among the list of allowed ones. If not, or if 
- * version is wrong, prints an appropriate warning.
- * \return True if namespace found among allowed list, false otherwise. */
-Bool _XML_IO_Handler_CheckNameSpace( XML_IO_Handler* self, xmlNodePtr curNode )
-{
-	Bool retVal = True;
-	NameSpaceInfo* currNsInfo = self->nameSpacesList;
-	char* correctNameSpace;
-	int correctLength = ( strlen(currNsInfo->location) + strlen(currNsInfo->version) ) + 1; 
-	
-	Journal_Firewall( NULL != (correctNameSpace = Memory_Alloc_Array_Unnamed( char, correctLength )),
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Error: couldn't allocate memory for namespace.\n" );
-	strcpy( correctNameSpace, currNsInfo->location );
-	strcat( correctNameSpace, currNsInfo->version );
-	
-	if ( (self->currNameSpace = xmlSearchNsByHref( self->currDoc , curNode, (const xmlChar *) correctNameSpace )) )
-	{
-		/* the correct namespace has been found. */
-		retVal = True;
-	}
-	else {
-		xmlNsPtr* nsArray = xmlGetNsList( self->currDoc, curNode );
-		int i;
-		
-		for (i=0; nsArray[i] != NULL; i++ ) {
-			Name lastSlash;
-			int locationLength;
-			
-			self->currNameSpace = nsArray[i];
-			
-			if ( NULL == (lastSlash = strrchr( (Name) nsArray[i]->href, '/' )) ) {
-				Journal_Printf( 
-					Journal_Register( Error_Type, XML_IO_Handler_Type ),
-					"Warning: resource %s has namespace \"%s\" not of expected URI form.\n",
-					self->resource, 
-					nsArray[i]->href );
-				Memory_Free( correctNameSpace );
-				return False;
-			} 
-			locationLength = (char*) lastSlash - (char*) nsArray[i]->href;
-			
-			if ( 0 == xmlStrncmp( nsArray[i]->href, (const xmlChar*) currNsInfo->location, locationLength ) ) {
-				Journal_Printf(
-					Journal_Register( Error_Type, XML_IO_Handler_Type ),
-					"Warning: resource %s of the correct type (\"%s\") but wrong version (\"%s\") as "
-					"compared to correct one of \"%s\".\n", 
-					self->resource,
-					currNsInfo->location, 
-					lastSlash+1,
-					currNsInfo->version );			
-				retVal = False;
-			}
-			else {
-				currNsInfo = currNsInfo->next;
-				
-				/* search the IO_Handler's parent for matches */
-				while ( currNsInfo ) {
-					self->currNameSpace = nsArray[i];
-					if ( 0 == xmlStrncmp( nsArray[i]->href, (const xmlChar*) currNsInfo->location, locationLength ) ) {
-						Journal_Printf(
-							Journal_Register( Error_Type, XML_IO_Handler_Type ),
-							"Warning: resource %s of the type of a parent namespace (\"%s\") as "
-							"compared to correct one of %s. "
-							"Some input features may not work.\n", 
-							self->resource,
-							currNsInfo->location, 
-							correctNameSpace );
-						retVal = False;
-					}
-				}
-				
-				if ( True == retVal ) {
-					Journal_Printf( 
-						Journal_Register( Error_Type, XML_IO_Handler_Type ),
-						"Error: resource %s of the wrong type, unknown namespace wasn't expected "
-						"value of %s.\n", 
-						self->resource, 
-						correctNameSpace );
-					retVal = False;	
-				}
-			}
-		}
-        xmlFree( nsArray );
-	}
-	
-	Memory_Free( correctNameSpace );
-	return retVal;
-}
-
-
-/** given a document node and the parent of that node, parses all the information on that node and any of its children
- * into the Dictionary. */
-static void _XML_IO_Handler_ParseNodes( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, Dictionary_MergeType mergeType, Dictionary_Entry_Source source )
-{
-	/* Process each node at this depth. Allow any order, and warn on unknown nodes */
-	while (cur != NULL) {
-		/* if parameter */
-		if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) ELEMENT_TAG ) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseElement( self, cur, parent, mergeType, source );
-		}
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) PLUGINS_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParsePlugins( self, cur, parent, mergeType, source );
-		} 
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) PLUGIN_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParsePlugin( self, cur, parent, mergeType, source );
-		} 
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) TOOLBOX_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseToolbox( self, cur, parent, mergeType, source );
-		} 
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) IMPORT_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseImport( self, cur, parent, mergeType, source );
-		} 
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) COMPONENTS_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseComponents( self, cur, parent, mergeType, source );
-		} 
-		#ifdef XML_OLD_DTD
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) PARAM_TAG ) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseParameter( self, cur, parent, mergeType, source );
-		}
-		else if	( (0 == xmlStrcmp( cur->name, (const xmlChar *) LIST_TAG ) ) && ( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseList( self, cur , parent, mergeType, source );
-		}
-		else if	( (0 == xmlStrcmp( cur->name, (const xmlChar *) STRUCT_TAG ) ) &&
-			( cur->ns == self->currNameSpace ) ) {
-			_XML_IO_Handler_ParseStruct( self, cur, parent, mergeType, source );
-		}
-		#endif
-		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) SEARCH_PATH_TAG ) ) &&
-			( cur->ns == self->currNameSpace ) )
-		{
-			xmlChar*	tmp;
-			
-			xmlChar* path = xmlNodeListGetString( self->currDoc, cur->xmlChildrenNode, 1 );
-			
-			tmp = Memory_Alloc_Array( xmlChar, 1024, "TmpPath" );
-			
-			/* Handle absolute paths */
-			if( strlen( (char*)path ) ) {
-				if( !(path[0] == '/' || path[0] == '~' || path[0] == '$' ) ) {
-					PathJoin( (char*)tmp, 2, self->currPath, path );
-				}
-				else {
-					strcpy( (char*)tmp, (char*)path );
-				}
-			}
-			else {
-				tmp[0] = 0;
-			}
-			
-			tmp = (xmlChar*)ExpandEnvironmentVariables( (char*)tmp );
-				
-			_XML_IO_Handler_AddSearchPath( self, (char*)tmp );
-
-            xmlFree( path );
-			//free( tmp );
-		}
-		else if	( (0 == xmlStrcmp( cur->name, (const xmlChar *) INCLUDE_TAG ) ) &&
-			( cur->ns == self->currNameSpace ) )
-		{
-			xmlChar* filename = xmlNodeListGetString( self->currDoc, cur->xmlChildrenNode, 1 );
-
-			if ( filename ) {
-				xmlChar*	spaceStrippedFileName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, filename );
-
-				Journal_DPrintf( 
-					Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-					"Trying to parse file %s due to include command.\n", 
-					(char*)spaceStrippedFileName );
-				
-				if ( 0 == xmlStrcmp( spaceStrippedFileName, (const xmlChar*) self->resource ) ) { 
-					Journal_Printf(
-						Journal_Register( Error_Type, XML_IO_Handler_Type ),
-						"Warning- while parsing file %s: Ignoring request to parse same file "
-						"(to avoid infinite loop.\n", 
-						self->resource );
-				}
-				else {
-					xmlChar absolute[1024];
-					Index i;
-					XML_IO_Handler* newHandler = XML_IO_Handler_New_Schema( self );
-					
-					XML_IO_Handler_SetListEncoding( newHandler, self->listEncoding );
-					XML_IO_Handler_SetWriteExplicitTypes( newHandler, self->writeExplicitTypes );
-				
-					for ( i = 0; i < self->searchPathsSize; ++i ) {
-						_XML_IO_Handler_AddSearchPath( newHandler, self->searchPaths[i] );
-					}
-						
-					if ( ! FindFileInPathList(
-						(char*)absolute, 
-						(char*)spaceStrippedFileName, 
-						self->searchPaths, 
-						self->searchPathsSize ) ) {
-					
-						/* Let IO_Handler_ReadAllFromFile() display the errors for opening the file */
-						strcpy( (char*)absolute, (char *)spaceStrippedFileName );
-					}
-					
-					/* TODO: this will need to change once we allow other file type includes */
-					for (i=0; i < Dictionary_Entry_Value_Num_Types; i++ ) {
-						XML_IO_Handler_SetWritingPrecision( newHandler, i, self->writingPrecision[i] );
-					}
-					
-					if( 
-						strlen( (char*)absolute ) == 0 
-						|| (source != NULL && 
-						 	False == IO_Handler_ReadAllFromFileForceSource( newHandler, 
-												        (char*)absolute, 
-													self->currDictionary ) )
-						|| (source == NULL &&
-						 	False == IO_Handler_ReadAllFromFile( newHandler,
-											     (char*)absolute , 
-											     self->currDictionary ) ) )
-					{
-						Journal_Printf(
-							Journal_Register( Error_Type, XML_IO_Handler_Type ),
-							"Warning: Failed to parse file %s from include command.\n", 
-							spaceStrippedFileName );
-					}
-					
-					Stg_Class_Delete( newHandler );
-				}
-				xmlFree( filename );
-				Memory_Free( spaceStrippedFileName );
-			}
-		}
-		/*TODO should we use this or validation? */
-		#if 0
-		else if  {
-			fJournal_Printf( stream, stdout, "Warning- while parsing file %s: unknown tag \"%s\" found, ignoring.\n",
-				self->resource, cur->name );
-		}
-		#endif
-		
-		cur = cur->next;
-	}
-}
-
-static void _XML_IO_Handler_ParseElement( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, Dictionary_MergeType mergeType, Dictionary_Entry_Source source )
-{
-	/* Process each node at this depth. Allow any order, and warn on unknown nodes */
-	xmlChar* name = xmlGetProp( cur, TYPE_ATTR );
-	/* if parameter */
-	if ( (0 == xmlStrcmp( name, (const xmlChar *) PARAM_ATTR ) ) && ( cur->ns == self->currNameSpace ) ) {
-		_XML_IO_Handler_ParseParameter( self, cur, parent, mergeType, source );
-	}
-	else if	( (0 == xmlStrcmp( name, (const xmlChar *) LIST_ATTR ) ) && ( cur->ns == self->currNameSpace ) ) {
-		_XML_IO_Handler_ParseList( self, cur , parent, mergeType, source );
-	}
-	else if	( (0 == xmlStrcmp( name, (const xmlChar *) STRUCT_ATTR ) ) &&
-		( cur->ns == self->currNameSpace ) ) {
-		_XML_IO_Handler_ParseStruct( self, cur, parent, mergeType, source );
-	}
-    xmlFree( name );
-}
-
-static void _XML_IO_Handler_ParseComponents( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
-					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
-{
-	xmlNewProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*) "name" );
-	xmlSetProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*)"components" );
-	_XML_IO_Handler_ParseStruct( self, cur, parent, defaultMergeType, source );
-}
-
-static void _XML_IO_Handler_ParsePlugins( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
-					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
-{
-	xmlNewProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*) "name" );
-	xmlSetProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*)"plugins" );
-	_XML_IO_Handler_ParseList( self, cur, parent, defaultMergeType, source );
-}
-
-static void _XML_IO_Handler_ParsePlugin( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
-					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
-{
-	_XML_IO_Handler_ParseParameter( self, cur, parent, defaultMergeType, source );
-}
-
-static void _XML_IO_Handler_ParseImport( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
-					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
-{
-	xmlNewProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*) "name" );
-	xmlSetProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*)"import" );
-	_XML_IO_Handler_ParseList( self, cur, parent, defaultMergeType, source );
-}
-
-static void _XML_IO_Handler_ParseToolbox( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
-					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
-{
-	_XML_IO_Handler_ParseParameter( self, cur, parent, defaultMergeType, source );
-}
-	
-/** parse list: given a node containing a list, parses the list into the ::Dictionary. (In future might want flags to
- * say whether each element constrained to be same type?) */
-static void _XML_IO_Handler_ParseList( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
-					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
-{	
-	xmlChar* name = xmlGetProp( cur, NAME_ATTR );
-	xmlChar* sourceFile = xmlGetProp( cur, SOURCEFILE_ATTR );
-	xmlChar* mergeTypeStr = xmlGetProp( cur, MERGETYPE_ATTR );
-	xmlChar* childrenMergeTypeStr = xmlGetProp( cur, CHILDRENMERGETYPE_ATTR );
-	xmlChar* spaceStrippedName = NULL;
-	xmlChar* spaceStrippedSourceFile = NULL;
-	Dictionary_Entry_Value* newList = NULL;
-	Dictionary_MergeType mergeType = defaultMergeType;
-	Dictionary_MergeType childrenMergeType = Dictionary_MergeType_Append;
-	
-	if ( name ) {
-		spaceStrippedName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, name );
-	}
-	if ( sourceFile ) {
-		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, sourceFile );
-	}
-	else if (source) {
-		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, (xmlChar*) source );
-	}
-	mergeType = _XML_IO_Handler_GetMergeType( self, mergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, defaultMergeType );
-	childrenMergeType = _XML_IO_Handler_GetMergeType( self, childrenMergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, IO_Handler_DefaultChildrenMergeType );
-
-	Journal_DPrintf(
-		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_ParseList called on tag %s, with name=\"%s\", and mergeType=\"%s\"\n", 
-		(char *) cur->name, 
-		spaceStrippedName, 
-		mergeTypeStr );
-	
-	/* set/add the list */
-	newList = IO_Handler_DictSetAddValueWithSource(
-		self,
-		(char*)spaceStrippedName, 
-		NULL, 
-		Dictionary_Entry_Value_Type_List, 
-		parent, 
-		mergeType,
-		(char*)spaceStrippedSourceFile );
-
-	if ( (NULL != newList) && cur->xmlChildrenNode ) {
-		/* check to see if values presented as columns of binary and ascii data */
-		if	( (0 == xmlStrcmp( cur->xmlChildrenNode->name, (const xmlChar *) ASCII_DATA_TAG ) ) &&
-				( cur->ns == self->currNameSpace ) )
-		{
-			Dictionary_Entry_Value_SetEncoding( newList, RawASCII );
-			_XML_IO_Handler_ParseAsciiData( self, cur->xmlChildrenNode, newList ); 
-		}	
-		else {
-			/* TODO: working out whether to make sure all elements conform to type of first */
-			_XML_IO_Handler_ParseNodes( self, cur->xmlChildrenNode, newList, childrenMergeType, source );
-		}
-		
-		/* if global encoding flag set, change encoding */
-		switch (self->listEncoding) {
-			case PerList:
-				break; /* will be set correctly already */
-			case AllXML:
-				Dictionary_Entry_Value_SetEncoding( newList, Default );
-				break;
-			case AllRawASCII:
-				Dictionary_Entry_Value_SetEncoding( newList, RawASCII );
-				break;
-			case AllRawBinary:
-				Dictionary_Entry_Value_SetEncoding( newList, RawBinary );
-				break;
-		}
-	}
-	
-	xmlFree( name );
-	if ( spaceStrippedName ) {
-		Memory_Free( spaceStrippedName );
-	}
-	xmlFree( sourceFile );
-	if ( spaceStrippedSourceFile ) {
-		Memory_Free( spaceStrippedSourceFile );
-	}
-}			
-
-
-/** parses an ascii data list. If column definitions provided, parses the data in as the defined types. Else, parses
- * in entries as strings into a struct with members called "1" to "x", where x is the number of ascii data pieces on the
- * first line.
- * TODO: generalise using a function pointer to tokeniser to handle raw binary data */
-static void _XML_IO_Handler_ParseAsciiData( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parentList )
-{
-	ColumnInfo columnInfo[MAX_COLUMNS];
-	int numColumns = 0;
-	xmlNodePtr currChild;
-	char** asciiData = NULL;
-	int asciiCount;
-	int asciiSize;
-	char* currAsciiToken;
-	int i = 0; 
-	int countI;
-	
-	currChild = cur->xmlChildrenNode;
-	_XML_IO_Handler_ParseColumnDefinitions( self, currChild, columnInfo, &numColumns );
-	
-	if ( 0 == numColumns ) {
-		
-		/* if asciidata, decide the columns based on the first row. */
-		if ( 0 == xmlStrcmp( cur->name, (const xmlChar *) ASCII_DATA_TAG ) ) { 
-			xmlChar* dataString = xmlNodeListGetString( self->currDoc, currChild, 1 );
-			char* firstLine = strtok( (char*) dataString, "\n" );	
-			char* currValue = strtok( firstLine, ASCII_DELIMITERS );
-			
-			while( currValue ) {
-				columnInfo[numColumns].name = Memory_Alloc_Array( char, MAX_COLUMN_NUM_LENGTH,
-					"columnInfo[numColumns].name" );
-				sprintf( columnInfo[numColumns].name, "%d", numColumns );
-				columnInfo[numColumns].dictValueType = Dictionary_Entry_Value_Type_String;
-				
-				currValue = strtok( NULL, ASCII_DELIMITERS );
-				numColumns++;
-			}
-		}
-		else {
-			Journal_Printf( 
-				Journal_Register( Error_Type, XML_IO_Handler_Type ),
-				"Error - while parsing resource %s: type of binary data must be specified "
-				"through dictionary or <%s> tag. Ignoring data.\n", 
-				self->resource,
-				COLUMN_DEFINITION_TAG );
-			return;
-		}
-	
-	}
-	
-	/* reset the tokeniser if necessary */
-	self->tokeniserCalls = 0;
-	asciiCount = 0;
-	asciiSize = 0;
-
-	/* parse each token into asciiData */ 
-	currAsciiToken = _XML_IO_Handler_GetNextAsciiToken( self, currChild );
-	while ( currAsciiToken ) {
-		if ( asciiSize == 0 ) {
-			asciiSize += numColumns;
-			asciiData = Memory_Alloc_Array( char*, asciiSize, "asciiData"  );
-		}
-		else if ( asciiCount == asciiSize ) {
-			asciiSize += numColumns;
-			asciiData = Memory_Realloc_Array( asciiData, char*, asciiSize ); 
-		}
-		asciiData[asciiCount] = currAsciiToken;
-		asciiCount++;
-		currAsciiToken = _XML_IO_Handler_GetNextAsciiToken( self, currChild );
-	}
-	
-	countI = 0;
-	
-	/* parse all the ascii values into the parent list */
-	while ( countI < asciiCount ) {
-		Bool rowOk = True;
-		Dictionary_Entry_Value* currStruct = Dictionary_Entry_Value_NewStruct(); 
-
-		for (i=0; i < numColumns; i++) {
-			currAsciiToken = asciiData[countI];
-		
-			if ( currAsciiToken ) {
-				_XML_IO_Handler_ParseAsciiValue( currAsciiToken, &columnInfo[i], currStruct );
-			}
-			else {
-				Journal_Printf(
-					Journal_Register( Error_Type, XML_IO_Handler_Type ),
-					"Warning - while parsing resource %s: last row of Ascii data partially full. "
-					"Discarding row.\n", 
-					self->resource );
-				Memory_Free( asciiData );
-				Memory_Free( currStruct );
-				rowOk = False;
-				break;
-			}
-			countI++;	
-		}
-		/* add element to list in dict */
-		if ( True == rowOk ) {
-			Dictionary_Entry_Value_AddElement( parentList, currStruct );
-		}
-	}
-	
-	Memory_Free( asciiData );
-	
-	/* Memory_Free the columnInfo array */
-	for (i=0; i < numColumns; i++ ) {
-		Memory_Free( columnInfo[i].name );
-	}
-}
-
-
-/** recursive function to parse all the column definitions, and ignore whitespace between them */
-static void _XML_IO_Handler_ParseColumnDefinitions( XML_IO_Handler* self, xmlNodePtr cur, 
-	ColumnInfo columnInfo[MAX_COLUMNS], int* const numColumnsPtr )
-{
-	char* stringPtr;
-
-	/* read any column definitions */
-	while ( (XML_ELEMENT_NODE == cur->type) &&
-		(0 == xmlStrcmp( cur->name, (const xmlChar *) COLUMN_DEFINITION_TAG ) ) &&
-		( cur->ns == self->currNameSpace ) )
-	{
-		xmlChar* type = xmlGetProp( cur, PARAMTYPE_ATTR );
-		
-		stringPtr = (char*) xmlGetProp( cur, NAME_ATTR );
-		columnInfo[(*numColumnsPtr)].name = StG_Strdup( stringPtr );
-		xmlFree( stringPtr );
-		columnInfo[(*numColumnsPtr)++].dictValueType = _XML_IO_Handler_GetDictValueType( self, (char*) type );
-		cur = cur->next;
-	}
-	
-	/* read any whitespace nodes */
-	while ( _XML_IO_Handler_IsOnlyWhiteSpace( (char*) xmlNodeListGetString( self->currDoc, cur, 1 ) ) ) {
-		cur = cur->next;
-	}
-	
-	/* if more columns, make a recursive call */
-	if ( (XML_ELEMENT_NODE == cur->type) &&
-		(0 == xmlStrcmp( cur->name, (const xmlChar *) COLUMN_DEFINITION_TAG ) ) &&
-		( cur->ns == self->currNameSpace ) )
-	{
-		_XML_IO_Handler_ParseColumnDefinitions( self, cur, columnInfo, numColumnsPtr );
-	}
-}
-
-
-/** parse a single ascii value, into the given ::Dictionary struct, converting to type defined in the given ::ColumnInfo.*/
-static void _XML_IO_Handler_ParseAsciiValue( char* asciiValue, ColumnInfo* columnInfo, Dictionary_Entry_Value* toDictStruct ) {
-	Dictionary_Entry_Value* newValue = Dictionary_Entry_Value_FromStringTo( asciiValue, columnInfo->dictValueType );
-	
-	Dictionary_Entry_Value_AddMember( toDictStruct, columnInfo->name, newValue );
-}
-
-
-/** get the next ascii token from the list. */
-static char* _XML_IO_Handler_GetNextAsciiToken( XML_IO_Handler* self, xmlNodePtr cur ) {
-	char* retToken;
-	
-	if (0 == self->tokeniserCalls) {
-		xmlChar* dataString = xmlNodeListGetString( self->currDoc, cur, 1 );
-		retToken = strtok( (char*) dataString, ASCII_DELIMITERS );
-	}
-	else {
-		retToken = strtok( NULL, ASCII_DELIMITERS );
-	}
-	
-	self->tokeniserCalls++;
-	return retToken;
-}
-
-
-/** parses a node containing struct info. */
-static void _XML_IO_Handler_ParseStruct( 
-	XML_IO_Handler*			self, 
-	xmlNodePtr					cur, 
-	Dictionary_Entry_Value*	parent, 
-	Dictionary_MergeType		defaultMergeType,
-	Dictionary_Entry_Source	source )
-{
-	xmlChar* name = xmlGetProp( cur, NAME_ATTR );
-	xmlChar* sourceFile = xmlGetProp( cur, SOURCEFILE_ATTR );
-	xmlChar* mergeTypeStr = xmlGetProp( cur, MERGETYPE_ATTR );
-	xmlChar* childrenMergeTypeStr = xmlGetProp( cur, CHILDRENMERGETYPE_ATTR );
-	xmlChar* spaceStrippedName = NULL;
-	xmlChar* spaceStrippedSourceFile = NULL;
-	Dictionary_Entry_Value* newStruct = NULL;
-	Dictionary_MergeType mergeType = defaultMergeType;
-	Dictionary_MergeType childrenMergeType = IO_Handler_DefaultChildrenMergeType;
-	
-	if ( name ) {
-		spaceStrippedName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, name );
-	}
-	if ( sourceFile ) {
-		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, sourceFile );
-	}
-	else if (source) {
-		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, (xmlChar*) source );
-	}
-	mergeType = _XML_IO_Handler_GetMergeType( self, mergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, defaultMergeType );
-	childrenMergeType = _XML_IO_Handler_GetMergeType( self, childrenMergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, IO_Handler_DefaultChildrenMergeType );
-
-	Journal_DPrintf( 
-		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_ParseStruct called on tag %s, with name=\"%s\"\n",
-		(char *) cur->name, 
-		spaceStrippedName );
-	
-	/* set/add the struct */
-	newStruct = IO_Handler_DictSetAddValueWithSource( 
-		self, 
-		(char*)spaceStrippedName, 
-		NULL, 
-		Dictionary_Entry_Value_Type_Struct, 
-		parent, 
-		mergeType,
-		(char*)spaceStrippedSourceFile );
-
-	if ( NULL != newStruct ) {
-		_XML_IO_Handler_ParseNodes( self, cur->xmlChildrenNode, newStruct, childrenMergeType, source );
-	}
-	
-	xmlFree( name );
-	if ( spaceStrippedName ) {
-		Memory_Free( spaceStrippedName );
-	}
-	xmlFree( sourceFile );
-	if ( spaceStrippedSourceFile ) {
-		Memory_Free( spaceStrippedSourceFile );
-	}
-}
-
-
-/** parses a single parameter node. */
-static void _XML_IO_Handler_ParseParameter( 
-	XML_IO_Handler*						self,
-	xmlNodePtr						cur,
-	Dictionary_Entry_Value*					parent,
-	Dictionary_MergeType					defaultMergeType,
-	Dictionary_Entry_Source					source )
-{
-	xmlChar* value = xmlNodeListGetString( self->currDoc, cur->xmlChildrenNode, 1 );
-	xmlChar* name = xmlGetProp( cur, NAME_ATTR );
-	xmlChar* sourceFile = xmlGetProp( cur, SOURCEFILE_ATTR );
-	xmlChar* type = xmlGetProp( cur, PARAMTYPE_ATTR );
-	xmlChar* mergeTypeStr = xmlGetProp( cur, MERGETYPE_ATTR );
-	Dictionary_Entry_Value_Type dictValueType = _XML_IO_Handler_GetDictValueType( self, (char*) type );
-	xmlChar* spaceStrippedName = NULL;
-	xmlChar* spaceStrippedSourceFile = NULL;
-	xmlChar* spaceStrippedType = NULL;
-	xmlChar* strippedVal = NULL;
-	Dictionary_MergeType mergeType = defaultMergeType;
-	
-	if ( name ) {
-		spaceStrippedName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, name );
-	}
-
-	if ( sourceFile ) {
-		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, sourceFile );
-	}
-	else if (source) {
-		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, (xmlChar*) source );
-	}
-
-	mergeType = _XML_IO_Handler_GetMergeType( self, mergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, defaultMergeType );
-
-	if ( NULL == value ) {
-		strippedVal = Memory_Alloc_Array( xmlChar, 1, "strippedVal" );
-		sprintf( (char*)strippedVal, "%s", "" );
-	}
-	else {
-		strippedVal = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, value );
-	}
-	
-	if( type ) {
-		spaceStrippedType = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, type );
-	}
-
-	Journal_DPrintf( 
-		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_ParseParameter called on tag %s, with name=\"%s\", value=\"%s\"\n", 
-		(char *) cur->name, 
-		spaceStrippedName, 
-		strippedVal );
-	
-	
-	/*
-	** Check the type and perform actions
-	*/
-	
-	if( spaceStrippedType ) {
-		/* TODO: move "path" to a constant */
-		if( strcmp( (char*)spaceStrippedType, "path" ) == 0 ) {
-			/* prefix the current path to 'val' */
-			unsigned	size;
-			xmlChar*	newVal;
-			unsigned	pos = 0;
-			
-			size = strlen( (char*)strippedVal ) + 1;
-			if( self->currPath ) {
-				size += strlen( self->currPath );
-				if(
-					self->currPath[0] != '/' && 
-					self->currPath[0] != '~' && 
-					self->currPath[0] != '.' &&
-					strstr( self->currPath, "file:" ) == NULL &&
-					strstr( self->currPath, "http:" ) == NULL &&
-					strstr( self->currPath, "ftp:" ) == NULL )
-				{
-					
-					size += 2;
-				}
-			}
-			
-			newVal = Memory_Alloc_Array( xmlChar, size, "XML_IO_Handler_ParseParameter->newVal" );
-			if( self->currPath ) {
-				if(
-					self->currPath[0] != '/' && 
-					self->currPath[0] != '~' && 
-					self->currPath[0] != '.' &&
-					strstr( self->currPath, "file:" ) == NULL &&
-					strstr( self->currPath, "http:" ) == NULL &&
-					strstr( self->currPath, "ftp:" ) == NULL )
-				{
-					newVal[0] = '.';
-					newVal[1] = '/';
-					pos += 2;
-				}
-				
-				strcpy( (char*)&newVal[pos], (char*)self->currPath );
-				pos += strlen( self->currPath );
-			}
-			
-			strcpy( (char*)&newVal[pos], (char*)strippedVal );
-			Memory_Free( strippedVal );
-			strippedVal = newVal;
-		}
-	}
-	
-	IO_Handler_DictSetAddValueWithSource( 
-				self, 
-				(char*)spaceStrippedName, 
-				(char*)strippedVal, 
-				dictValueType, 
-				parent, 
-				mergeType, 
-				(char*)spaceStrippedSourceFile );
-	
-	xmlFree( name );
-	if ( spaceStrippedName ) {
-		Memory_Free( spaceStrippedName );
-	}
-	xmlFree( value );
-	Memory_Free( strippedVal );
-	xmlFree( sourceFile );
-	if ( spaceStrippedSourceFile ) {
-		Memory_Free( spaceStrippedSourceFile );
-	}
-	
-	if( type ) {
-		xmlFree( type );
-	}
-	if( spaceStrippedType ) {
-		Memory_Free( spaceStrippedType );
-	}
-}
-
-
-/** utility function to get the dictionary type, given a type definition attribute from the xml file.
- * TODO: use a hash table? */
-Dictionary_Entry_Value_Type _XML_IO_Handler_GetDictValueType( XML_IO_Handler* self, char* type )
-{
-	if (NULL == type)
-	{
-		return Dictionary_Entry_Value_Type_String;
-	}
-	else {
-		Dictionary_Entry_Value_Type* result;
-		
-		/* convert to lower case. put in string library one day if we make one or use one */
-		char* lowercaseType = StG_Strdup( type );
-		char* ptr = lowercaseType;
-		for ( ; *ptr != '\0'; ++ptr ) {
-			*ptr = tolower( *ptr );
-		}
-	
-		result = (Dictionary_Entry_Value_Type*)Stg_ObjectList_Get( self->typeKeywords, lowercaseType );
-		Memory_Free( lowercaseType );
-		
-		if ( result == NULL ) {
-			/* if unknown type, return string */
-			return Dictionary_Entry_Value_Type_String;
-		}
-		return *result;
-	}
-}
-
-
-/** utility function to strip leading and trailing whitespace */
-static xmlChar* _XML_IO_Handler_StripLeadingTrailingWhiteSpace( XML_IO_Handler* self, const xmlChar* const value ) {
-	
-	assert( value );
-	
-	if ( '\0' == (*value) ) {
-		return (xmlChar*)StG_Strdup( (char*)value );
-	}
-	else {
-		Name startCharPtr = (const char*)value;
-		Name endCharPtr = (const char*)value + strlen( (char*)value );
-		xmlChar* newString = NULL;
-		size_t newLength = 0;
-		
-		while ( isspace( (char) *startCharPtr ) && (startCharPtr < endCharPtr) ) {
-			startCharPtr++;
-		}
-		
-		if ( startCharPtr == endCharPtr ) {
-			xmlChar* ret = Memory_Alloc_Array( xmlChar, 1, "ret" );
-			*ret = '\0'; /* empty string */
-			return ret;
-		}
-		
-		while ( isspace( (char) *(endCharPtr-1) ) && (endCharPtr > startCharPtr) ) {
-			endCharPtr--;
-		}
-		
-		newLength = endCharPtr - startCharPtr;
-		assert( newLength > 0 );
-		
-		if ( !(newString = Memory_Alloc_Array_Unnamed( xmlChar, newLength + 1 ) ) ) {
-			Journal_Printf( 
-				Journal_Register( Error_Type, XML_IO_Handler_Type ), 
-				"Error - while parsing file %s: out of memory. exiting.\n", 
-				self->resource );
-			exit( EXIT_FAILURE );
-		}
-                {
-                  Index i;
-                  for(i=0;i<newLength;++i)
-                    newString[i]=startCharPtr[i];
-                  newString[newLength]='\0';
-                }
-		
-		return newString;
-	}
-}
-
-
-/** utility function to check if a string is purely whitespace */
-Bool _XML_IO_Handler_IsOnlyWhiteSpace( char* string ) {
-	/* a reasonable maximum so the function doesn't run for ever */
-	const int MAX_WHITESPACE = 100;
-	int charIndex = 0;
-	if ( !string ) return False;
-	
-	for (; (string[charIndex] != '\0') && charIndex < MAX_WHITESPACE; charIndex++ ) {
-		if ( !isspace( string[charIndex] ) ) return False;
-	}
-	
-	return True;
-}
-
-
-/** Write all the entries in a ::Dictionary to an XML file. The functions XML_IO_Handler_SetListEncoding(),
- * XML_IO_Handler_SetWriteExplicitTypes(), and XML_IO_Handler_SetWritingPrecision() can be used to customise the output.
- * see also IO_Handler_WriteAllToFile().
- * \return True on successful write, false otherwise.
- */
-Bool _XML_IO_Handler_WriteAllToFile( void* xml_io_handler, Name filename, Dictionary* dictionary ) {
-	
-	/* create/overwrite new document */
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	xmlNodePtr rootNode;
-	int fileSize = -1;
-	char* correctNameSpace;
-	NameSpaceInfo* currNsInfo = self->nameSpacesList;
-	int correctLength = ( strlen(currNsInfo->location) + strlen(currNsInfo->version) ) + 1; 
-	Stream* stream = Journal_Register( Info_Type, XML_IO_Handler_Type );
-	
-	Journal_Printf(
-		Journal_Register( Info_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_WriteAllToFile called to write to file %s.\n", 
-		filename );
-#if DEBUG
-	assert( self );
-	assert( filename );
-	assert( dictionary );
-#endif
-	
-	/* if overwrite/new */
-	self->currDoc = xmlNewDoc( XML_VERSION );
-	assert( self->currDoc );
-	/* create root element */
-	rootNode = xmlNewNode( NULL, ROOT_NODE_NAME);
-	assert( rootNode );
-	
-	if ( !(correctNameSpace = Memory_Alloc_Array( char, correctLength, "courrectNameSpace" )) ) {
-		Journal_Printf( 
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Error: couldn't allocate memory for namespace.\n" );
-		return False;
-	}
-	strcpy( correctNameSpace, currNsInfo->location );
-	strcat( correctNameSpace, currNsInfo->version );
-	self->currNameSpace = xmlNewNs( rootNode, (xmlChar*) correctNameSpace, NULL );
-	assert( self->currNameSpace );
-	xmlSetNs( rootNode, self->currNameSpace );
-	
-	xmlDocSetRootElement( self->currDoc, rootNode );
-	/* TODO else parse in filename as currDoc, if update set */
-	
-	_XML_IO_Handler_WriteDictionary( self, dictionary, rootNode );
-	
-	/* write result to file */
-	if ( 0 < (fileSize = xmlSaveFormatFile( filename, self->currDoc, 1 )) ) {
-		Journal_Printf( stream, "Writing dictionary contents to file %s successfully concluded.\n", filename );
-	} else
-	{
-		Journal_Printf( 
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			 "Warning: failed to write dictionary contents to file %s.\n", 
-			 filename );
-	}
-	
-	/* Memory_Free memory */
-	if( self->currDoc )
-		xmlFreeDoc( self->currDoc );
-	/*xmlCleanupParser(); */
-	/* TODO if updating, xmlCleanupParser(); */
-	self->currDoc = NULL;
-	self->currNameSpace = NULL;
-	Memory_Free( correctNameSpace );
-	
-	return ( fileSize > 0 ) ? True : False;
-}
-
-
-/** write a single dictionary entry to a file. The dictionary entry needs to be supplied as a name and value.
- * \return True on success, False otherwise. */
-Bool XML_IO_Handler_WriteEntryToFile( void* xml_io_handler, Name filename,
-	Dictionary_Entry_Key name, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
-{
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	
-	assert( self );
-	return self->_writeEntryToFile( xml_io_handler, filename, name, value, source );
-}
-
-
-
-Bool _XML_IO_Handler_WriteEntryToFile( void* xml_io_handler, Name filename,
-	Dictionary_Entry_Key name, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
-{
-	Stream* stream = Journal_Register (Info_Type, XML_IO_Handler_Type );
-	/* create/overwrite new document */
-	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
-	xmlNodePtr rootNode;
-	int fileSize = -1;
-	char* correctNameSpace;
-	NameSpaceInfo* currNsInfo = self->nameSpacesList;
-	int correctLength = ( strlen(currNsInfo->location) + strlen(currNsInfo->version) ) + 1;
-	
-#if DEBUG
-	assert( self );
-	assert( filename );
-	assert( name );
-	assert( value );
-	/*Do not assert source -> it may well be NULL.*/
-#endif
-	Journal_Printf(stream, "_XML_IO_Handler_WriteEntryToFile called to write dictionary entry %s to file %s.\n", name, filename ); 
-	/* if overwrite/new */
-	self->currDoc = xmlNewDoc( XML_VERSION );
-	assert( self->currDoc );
-	/* create root element */
-	rootNode = xmlNewNode( NULL, ROOT_NODE_NAME);
-	assert( rootNode );
-	
-	if ( !(correctNameSpace = Memory_Alloc_Array( char, correctLength, "correctNameSpace" )) ) {
-		Journal_Printf(
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Error: couldn't allocate memory for namespace.\n" );
-		return False;
-	}
-	strcpy( correctNameSpace, currNsInfo->location );
-	strcat( correctNameSpace, currNsInfo->version );
-	self->currNameSpace = xmlNewNs( rootNode, (xmlChar*) correctNameSpace, NULL );
-	assert( self->currNameSpace );
-	xmlSetNs( rootNode, self->currNameSpace );
-	
-	xmlDocSetRootElement( self->currDoc, rootNode );
-	/* TODO else parse in filename as currDoc, if update set */
-	
-	_XML_IO_Handler_WriteNode( self, name, value, source, rootNode );
-	
-	/* write result to file */
-	if ( 0 < (fileSize = xmlSaveFormatFile( filename, self->currDoc, 1 )) ) {
-		Journal_Printf( stream, "Writing dictionary entry %s to file %s successfully concluded.\n", name, filename );
-	}
-	else {
-		Journal_Printf( 
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Warning: failed to write dictionary entry %s to file %s.\n", 
-			name, 
-			filename );
-	}
-	if( self->currDoc )	
-		xmlFreeDoc( self->currDoc );
-	/*xmlCleanupParser();*/
-	/* TODO if updating, xmlCleanupParser(); */
-	self->currDoc = NULL;
-	self->currNameSpace = NULL;
-	Memory_Free( correctNameSpace );
-	
-	return ( fileSize > 0 ) ? True : False;
-}
-
-
-/** Write the contents of a dictionary to a file. Note this can be used for writing #Dictionary_Entry_Value_AsStruct
- * values. */
-static void _XML_IO_Handler_WriteDictionary( XML_IO_Handler* self, Dictionary* dict, xmlNodePtr parent ) {
-	Dictionary_Index index = 0;
-
-	Journal_DPrintf( 
-		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_WriteDictionary called.\n" );
-	
-	// find the plugins tag, and write it first	
-	for (index=0; index < dict->count; index++) {
-		Dictionary_Entry* currEntryPtr = dict->entryPtr[index];
-	
-		if ( strcmp(currEntryPtr->key, (Name)IMPORT_TAG) == 0 ) 
-			_XML_IO_Handler_WriteNode( self, currEntryPtr->key, currEntryPtr->value, currEntryPtr->source, parent );
-	}
-
-	// find the plugins tag, and write it first	
-	for (index=0; index < dict->count; index++) {
-		Dictionary_Entry* currEntryPtr = dict->entryPtr[index];
-	
-		if ( strcmp(currEntryPtr->key, (Name)PLUGINS_TAG) == 0 ) 
-			_XML_IO_Handler_WriteNode( self, currEntryPtr->key, currEntryPtr->value, currEntryPtr->source, parent );
-	}
-
-	// creates the rest of dictionary
-	for (index=0; index < dict->count; index++) {
-		Dictionary_Entry* currEntryPtr = dict->entryPtr[index];
-	
-		if ( ( strcmp(currEntryPtr->key, (Name)IMPORT_TAG) != 0 )  && ( strcmp(currEntryPtr->key, (const char*)PLUGINS_TAG) != 0 ) )  
-			_XML_IO_Handler_WriteNode( self, currEntryPtr->key, currEntryPtr->value, currEntryPtr->source, parent );
-	}
-}
-
-/** write a single node to file, and its children. */
-static void _XML_IO_Handler_WriteNode( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* value, 
-					Name source, xmlNodePtr parent)
-
-{
-	switch ( value->type ) {
-		case Dictionary_Entry_Value_Type_Struct:
-			_XML_IO_Handler_WriteStruct( self, name, value, source, parent );
-			break;
-		case Dictionary_Entry_Value_Type_List:
-			_XML_IO_Handler_WriteList( self, name, value, source, parent );
-			break;
-		default:
-			_XML_IO_Handler_WriteParameter( self, name, value, source, parent );
-	}
-}
-
-
-/** write a list and its children to a file. Depending on the encoding set by either XML_IO_Handler_SetListEncoding(),
- * or stored on the list dictionary entry value itself, will  write out as XML, ascii or binary.*/
-static void _XML_IO_Handler_WriteList( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* list,
-					Name source, xmlNodePtr parent)
-{
-	xmlNodePtr newNode;
-	xmlChar* type= (xmlChar*) "list";
-
-	Journal_DPrintf( Journal_Register( Debug_Type, XML_IO_Handler_Type ), "_XML_IO_Handler_WriteList called.\n" );
-
-	/* create and add list child node */
-	if ( NULL != name ) {
-		if ( strcmp(name, (Name)PLUGINS_TAG) == 0 ) {
-			newNode = xmlNewTextChild( parent, self->currNameSpace, PLUGINS_TAG, NULL );
-		}
-		else if ( strcmp(name, (Name)IMPORT_TAG) == 0 ) {
-			newNode = xmlNewTextChild( parent, self->currNameSpace, IMPORT_TAG, NULL );
-		}
-		else
-		{
-			//newNode = xmlNewTextChild( parent, self->currNameSpace, LIST_ATTR, NULL );
-			newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
-			xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
-			if ( NULL != name ) {
-				xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
-			}
-		}
-	}	
-    else {
-		newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
-		xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
-    }
-	if ( NULL != source ) {
-		xmlNewProp( newNode, (xmlChar*) SOURCEFILE_ATTR, (xmlChar*) source );
-	}	
-	
-	/* write list elements*/
-	switch (self->listEncoding) {
-		case PerList:
-			switch (Dictionary_Entry_Value_GetEncoding( list )) {
-				case Default:
-					_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
-					break;
-				
-				case RawASCII:
-					_XML_IO_Handler_WriteListElementsRawASCII( self, list, newNode );
-					break;
-				
-				case RawBinary:
-					_XML_IO_Handler_WriteListElementsRawBinary( self, list, newNode );
-					break;
-				
-				default:
-					Journal_Printf( 
-						Journal_Register( Error_Type, XML_IO_Handler_Type ),
-						"Warning - while writing file %s: list %s in dictionary specifies "
-						"unknown encoding format. Writing as XML.\n", 
-						self->resource, 
-						name );
-					_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
-			}
-			break;
-		
-		case AllXML:
-			_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
-			break;
-		
-		case AllRawASCII:
-			if ( True == _XML_IO_Handler_CheckListCanBePrintedRaw( list ) ) {
-				_XML_IO_Handler_WriteListElementsRawASCII( self, list, newNode );
-			}
-			else {
-				_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
-			}
-			break;
-		
-		case AllRawBinary:
-			if ( True == _XML_IO_Handler_CheckListCanBePrintedRaw( list ) ) {
-				_XML_IO_Handler_WriteListElementsRawBinary( self, list, newNode );
-			}	
-			else {
-				_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
-			}
-			break;
-		
-		default:
-			assert(0);
-	}
-}
-
-
-/** write the list elements to a file as XML. */
-static void _XML_IO_Handler_WriteListElementsXML( XML_IO_Handler* self, Dictionary_Entry_Value* list,
-	xmlNodePtr listNode )
-{
-	Dictionary_Entry_Value* currChildValue = Dictionary_Entry_Value_GetFirstElement( list );
-	
-	while ( NULL != currChildValue ) {
-		_XML_IO_Handler_WriteNode( self, NULL, currChildValue, NULL, listNode );
-		currChildValue = currChildValue->next; 
-	}
-}
-
-
-/** Checks if a lsit can be printed in raw (ascii or binary) format. Raw data lists should only contain structs,
- * where each member is a 'simple' type (i.e. not a struct or list) */
-static Bool _XML_IO_Handler_CheckListCanBePrintedRaw( Dictionary_Entry_Value* list ) {
-	Dictionary_Entry_Value* firstElement = Dictionary_Entry_Value_GetFirstElement( list );
-	
-	if ( Dictionary_Entry_Value_Type_Struct != firstElement->type ) {
-		return False;
-	}
-	else {
-		Dictionary_Index i;
-		for (i=0; i < firstElement->as.typeStruct->count; i++)
-		{
-			int type = firstElement->as.typeStruct->entryPtr[i]->value->type;
-			if ( (Dictionary_Entry_Value_Type_Struct == type) || (Dictionary_Entry_Value_Type_List == type) )
-			{
-				return False;
-			}
-		}
-		
-		return True;
-	}
-}
-
-
-/** write the elements of a list from a dictionary value to raw ASCII. */
-static void _XML_IO_Handler_WriteListElementsRawASCII( XML_IO_Handler* self, Dictionary_Entry_Value* list, xmlNodePtr listNode ) {
-	Dictionary_Entry_Value* currMemberValue;
-	Dictionary_Entry_Value* currChildStruct;
-	xmlBufferPtr bufferPtr;
-	char* charBuffer = Memory_Alloc_Array_Unnamed( char, ASCII_LIST_STRING_BUFFER_SIZE );
-	unsigned int writtenElementSize;
-	xmlNodePtr rawDataNode;
-	Index i;
-	
-	/* check contents suitable for raw printing, error if not. */
-	if ( False == _XML_IO_Handler_CheckListCanBePrintedRaw( list ) )
-	{
-		Journal_Printf(
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Warning- while writing file %s: _XML_IO_Handler_WriteListElementsRaw called on "
-			"list %s not suited for Raw writing. Printing as plain XML instead.\n", 
-			self->resource,
-			xmlGetProp( listNode, NAME_ATTR ) );
-		_XML_IO_Handler_WriteListElementsXML( self, list, listNode );
-		return;
-	}
-	
-	/* create and add raw data child node from buffer */
-	rawDataNode = xmlNewTextChild( listNode, self->currNameSpace, ASCII_DATA_TAG, NULL );
-	
-	currChildStruct = Dictionary_Entry_Value_GetFirstElement( list );	
-	
-	/* allocate the memory buffer */
-	writtenElementSize = _XML_IO_Handler_GetWrittenElementSize( self, currChildStruct );
-	if ( NULL == (bufferPtr = xmlBufferCreateSize( writtenElementSize ) ) )
-	{
-		Journal_Printf( 
-			Journal_Register( Error_Type, XML_IO_Handler_Type ),
-			"Error- while writing file %s: out of memory allocating raw data buffer. "
-			"Returning.\n", 
-			self->resource );
-		return;
-	}
-	
-	xmlNodeAddContentLen( rawDataNode, (xmlChar*) "\n", 1 ); 
-	
-	/* write the column definition tags */
-	for (i=0; i < Dictionary_Entry_Value_GetCount( currChildStruct ); i++) {
-		xmlNodePtr currColumnDefNode;
-		Name typeString = self->TYPE_KEYWORDS[ (int) currChildStruct->as.typeStruct->entryPtr[i]->value->type ];
-		
-		xmlNodeAddContentLen( rawDataNode, (xmlChar*) "\n", 1 ); 
-		currColumnDefNode = xmlNewTextChild( rawDataNode, self->currNameSpace, COLUMN_DEFINITION_TAG, NULL );
-		xmlNewProp( currColumnDefNode, NAME_ATTR, (xmlChar*) currChildStruct->as.typeStruct->entryPtr[i]->key );
-		xmlNewProp( currColumnDefNode, PARAMTYPE_ATTR, (xmlChar*) typeString );
-	}
-	
-	/* will cause trouble if func generalised for binary */
-	xmlBufferWriteChar( bufferPtr, "\n\n" );
-	
-	/* write element contents to buffer, then node */
-	while ( NULL != currChildStruct ) {
-		/* print the elements into the buffer */
-		for (i=0; i < currChildStruct->as.typeStruct->count; i++) {
-			if ( (currMemberValue = currChildStruct->as.typeStruct->entryPtr[i]->value) )
-			{
-				_XML_IO_Handler_WriteMemberAscii( self, currMemberValue, charBuffer );
-				xmlBufferWriteChar( bufferPtr, charBuffer );
-			}
-		}
-		
-		/* will cause trouble if func generalised for binary */
-		xmlBufferWriteChar( bufferPtr, "\n" );
-		
-		xmlNodeAddContentLen( rawDataNode, xmlBufferContent( bufferPtr ), xmlBufferLength( bufferPtr ) ); 
-		xmlBufferEmpty( bufferPtr );
-		currChildStruct = currChildStruct->next; 
-	}
-	
-	/* will cause trouble if func generalised for binary */
-	xmlNodeAddContentLen( rawDataNode, (xmlChar*) "\n", 1 ); 
-	xmlBufferFree( bufferPtr );
-	Memory_Free( charBuffer );
-}
-
-
-/** calculates how big a text buffer needs to be created to hold the data from a dictionary list entry as raw ascii. */
-static unsigned int _XML_IO_Handler_GetWrittenElementSize( XML_IO_Handler* self, Dictionary_Entry_Value* listElement ) {
-	unsigned int i;	
-	int totalChars = 0; 
-	
-	for ( i=0; i < Dictionary_Entry_Value_GetCount( listElement ); i++ )
-	{
-		totalChars += self->writingFieldWidth[ (int) listElement->as.typeStruct->entryPtr[i]->value->type ];
-	}
-	
-	totalChars++;	/* for the newline character */	
-	
-	return totalChars;
-}
-
-
-/** writes a signle member data element. NOTE: would have been nice just to use Dictionary_Entry_Value_Print(), but
- * then wouldn't have been able to use custom formatting. */
-static void _XML_IO_Handler_WriteMemberAscii( XML_IO_Handler* self, Dictionary_Entry_Value* member, char* buffer ) {
-	unsigned int fw = self->writingFieldWidth[ (int) member->type ];
-	unsigned int precision = self->writingPrecision[ (int) member->type ];
-	char*        string = NULL;
-	Stream*      errorStr = NULL;
-	
-	switch (member->type) {
-		case Dictionary_Entry_Value_Type_String:
-			string = Dictionary_Entry_Value_AsString( member );
-			errorStr = Journal_Register( Error_Type, self->type );
-			Journal_Firewall( ( strlen(string) + 1 < ASCII_LIST_STRING_BUFFER_SIZE ), errorStr,
-				"Error- in %s: asked to write out a string of length %d, but this "
-				"is greater than the max string buffer length of %d. Exiting.\n",
-				__func__, strlen(string), ASCII_LIST_STRING_BUFFER_SIZE );
-			sprintf(buffer, "%*s ", fw, Dictionary_Entry_Value_AsString( member ) );
-			break;
-		
-		case Dictionary_Entry_Value_Type_Double:
-			sprintf(buffer, "%*.*g", fw, precision, Dictionary_Entry_Value_AsDouble( member ) );	
-			break;
-		
-		case Dictionary_Entry_Value_Type_UnsignedInt:
-			sprintf(buffer, "%*.*g", fw, precision, Dictionary_Entry_Value_AsDouble( member ) );	
-			break;
-		
-		case Dictionary_Entry_Value_Type_Int:
-			sprintf(buffer, "%*.*g", fw, precision, Dictionary_Entry_Value_AsDouble( member ) );	
-			break;
-		
-		case Dictionary_Entry_Value_Type_Bool:
-			sprintf(buffer, "%*.*s", fw, precision, Dictionary_Entry_Value_AsString( member ) );	
-			break;
-		
-		default:
-			Journal_Printf( 
-				Journal_Register( Error_Type, XML_IO_Handler_Type ),
-				"Warning- while writing to file %s: unknown type of Dictionary_Entry_Value. "
-				"Outputting as a string.\n", 
-				self->resource );
-			errorStr = Journal_Register( Error_Type, self->type );
-			Journal_Firewall( ( strlen(string) + 1 < ASCII_LIST_STRING_BUFFER_SIZE ), errorStr,
-				"Error- in %s: asked to write out a string of length %d, but this "
-				"is greater than the max string buffer length of %d. Exiting.\n",
-				__func__, strlen(string), ASCII_LIST_STRING_BUFFER_SIZE );
-			sprintf(buffer, "%*.*s ", self->writingFieldWidth[Dictionary_Entry_Value_Type_String],
-				self->writingPrecision[Dictionary_Entry_Value_Type_String],
-				Dictionary_Entry_Value_AsString( member ) );
-			break;
-	}
-}
-
-
-/** TODO: write the lsit elements as raw binary. */
-static void _XML_IO_Handler_WriteListElementsRawBinary( XML_IO_Handler* self, Dictionary_Entry_Value* list, xmlNodePtr listNode ) {
-	Journal_Printf( 
-		Journal_Register( Info_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_WriteListElementsRawBinary stub called." );
-}
-
-
-/** writes a struct dictionary entry to the file */
-static void _XML_IO_Handler_WriteStruct( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* value, 
-						Name source, xmlNodePtr parent)
-{	
-	xmlNodePtr newNode;
-	xmlChar* type= (xmlChar*) "struct";
-
-	Journal_DPrintf( 
-		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-		"_XML_IO_Handler_WriteStruct called.\n" );
-
-	/* create and add struct child node*/
-	if ( NULL != name ) {
-		if ( strcmp(name, (Name)COMPONENTS_TAG) == 0 ) {
-			newNode = xmlNewTextChild( parent, self->currNameSpace, COMPONENTS_TAG, NULL );
-		}
-		else
-		{
-			//newNode = xmlNewTextChild( parent, self->currNameSpace, STRUCT_ATTR, NULL );
-			newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
-			xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
-			xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
-		}
-	}
-	else
-	{
-		newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
-		xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
-		if ( NULL != name ) 
-			xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
-	}
-	if ( NULL != source ) {
-		xmlNewProp( newNode, (xmlChar*) SOURCEFILE_ATTR, (xmlChar*) source );
-	}
-	
-	_XML_IO_Handler_WriteDictionary( self, value->as.typeStruct, newNode ); 
-}
-
-
-/** writes a single dictionary parameter to file. */
-static void _XML_IO_Handler_WriteParameter( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* value,
-						Name source, xmlNodePtr parent)
-{
-	xmlNodePtr newNode;
-	xmlChar* type = (xmlChar*) "param";
-
-
-	Journal_DPrintfL( 
-		Journal_Register( Info_Type, XML_IO_Handler_Type ), 2,
-		"_XML_IO_Handler_WriteParameter called.\n");
-
-	/* add new child to parent, with correct value*/
-	if ( strcmp((char *)parent->name, (Name)PLUGINS_TAG) == 0 ) {
-		newNode = xmlNewTextChild( parent, self->currNameSpace, PLUGIN_TAG, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
-	}
-	else if ( strcmp((char *)parent->name, (Name)IMPORT_TAG) == 0 ) {
-		newNode = xmlNewTextChild( parent, self->currNameSpace, TOOLBOX_TAG, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
-	}
-	else {
-		//newNode = xmlNewTextChild( parent, self->currNameSpace, PARAM_ATTR, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
-		newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
-		xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
-	}
-	if ( NULL != name ) {
-		xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
-	}
-	if ( NULL != source ) {
-		xmlNewProp( newNode, (xmlChar*) SOURCEFILE_ATTR, (xmlChar*) source );
-	}
-	
-	if ( True == self->writeExplicitTypes )
-	{
-		xmlNewProp( newNode, PARAMTYPE_ATTR, (xmlChar*) self->TYPE_KEYWORDS[(int) value->type] );
-	}
-}
-
-static Dictionary_MergeType _XML_IO_Handler_GetMergeType( XML_IO_Handler* self, const xmlChar* mergeTypeStr, 
-		Name funcName, const char* tagStr, xmlChar* entryName, Dictionary_MergeType defaultMergeType )
-{
-	Dictionary_MergeType         mergeType = defaultMergeType;
-	xmlChar*                     spaceStrippedMergeType = NULL;
-
-	if( mergeTypeStr ) {
-		spaceStrippedMergeType = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, mergeTypeStr );
-		if( !xmlStrcmp( spaceStrippedMergeType, APPEND_TAG ) ) {
-			mergeType = Dictionary_MergeType_Append;
-		}
-		else if( !xmlStrcmp( spaceStrippedMergeType, MERGE_TAG ) ) {
-			mergeType = Dictionary_MergeType_Merge;
-		}
-		else if( !xmlStrcmp( spaceStrippedMergeType, REPLACE_TAG ) ) {
-			mergeType = Dictionary_MergeType_Replace;
-		}
-		else {
-			Journal_DPrintf( 
-				Journal_Register( Debug_Type, XML_IO_Handler_Type ),
-				"%s() called on tag %s, with name=\"%s\", and mergeType \"%s\" unknown "
-				"reverting to \"%s\".\n", 
-				__func__,
-				tagStr, 
-				entryName,
-				spaceStrippedMergeType,
-				XML_IO_Handler_MergeTypeMap[defaultMergeType] );
-			mergeType = defaultMergeType;
-		}
-    Memory_Free( spaceStrippedMergeType );
-	}
-	else {
-		mergeType = defaultMergeType;
-	}
-
-	return mergeType;
-}
-
-
-void XML_IO_Handler_LibXMLErrorHandler( void* ctx, Name msg, ... ) {
-   va_list ap;
-   va_start( ap, msg );
-   Stream_Printf( Journal_Register( Error_Type, XML_IO_Handler_Type ), msg, ap );
-   va_end(ap);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/XML_IO_Handler.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/XML_IO_Handler.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,2351 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Dictionary.h"
+#include "Dictionary_Entry.h"
+#include "Dictionary_Entry_Value.h"
+#include "IO_Handler.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "Stream.h"
+#include "PathUtils.h"
+#include <libxml/tree.h>
+#include "XML_IO_Handler.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xmlversion.h>
+
+/* textual class name */
+const Type XML_IO_Handler_Type = "XML_IO_Handler";
+
+/** The Xml search path list. */
+Stg_ObjectList* Project_XMLSearchPaths = NULL;
+
+#define XML_OLD_DTD 1
+
+/* keyword strings for nodes and lists */
+static const xmlChar* INCLUDE_TAG = (const xmlChar*) "include";
+static const xmlChar* NAME_ATTR = (const xmlChar*) "name";
+static const xmlChar* SOURCEFILE_ATTR = (const xmlChar*) "sourceFile";
+static const xmlChar* MERGETYPE_ATTR = (const xmlChar*) "mergeType";
+static const xmlChar* CHILDRENMERGETYPE_ATTR = (const xmlChar*) "childrenMergeType";
+static const xmlChar* TYPE_ATTR = (const xmlChar*) "type";
+static const xmlChar* PARAMTYPE_ATTR = (const xmlChar*) "paramType";
+#ifdef XML_OLD_DTD
+static const xmlChar* LIST_TAG = (const xmlChar*) "list";
+static const xmlChar* STRUCT_TAG = (const xmlChar*) "struct";
+static const xmlChar* PARAM_TAG = (const xmlChar*) "param";
+#endif
+static const xmlChar* LIST_ATTR = (const xmlChar*) "list";
+static const xmlChar* STRUCT_ATTR = (const xmlChar*) "struct";
+static const xmlChar* PARAM_ATTR = (const xmlChar*) "param";
+
+static const xmlChar* ASCII_DATA_TAG = (const xmlChar*) "asciidata";
+static const xmlChar* COLUMN_DEFINITION_TAG = (const xmlChar*) "columnDefinition";
+
+const xmlChar* APPEND_TAG = (const xmlChar*) "append";
+const xmlChar* MERGE_TAG = (const xmlChar*) "merge";
+const xmlChar* REPLACE_TAG = (const xmlChar*) "replace";
+const xmlChar* XML_IO_Handler_MergeTypeMap[3];
+
+static const xmlChar* SEARCH_PATH_TAG = (const xmlChar*) "searchPath";
+static const xmlChar* ELEMENT_TAG = (const xmlChar*) "element";
+
+static const xmlChar* PLUGINS_TAG = (const xmlChar*) "plugins";
+static const xmlChar* PLUGIN_TAG = (const xmlChar*) "plugin";
+static const xmlChar* IMPORT_TAG = (const xmlChar*) "import";
+static const xmlChar* TOOLBOX_TAG = (const xmlChar*) "toolbox";
+static const xmlChar* COMPONENTS_TAG = (const xmlChar*) "components";
+
+
+/* Namespace and root node to validate against - please update on new releases */
+static const xmlChar* ROOT_NODE_NAME = (xmlChar*) "StGermainData";
+static const xmlChar* XML_VERSION = (xmlChar*) "1.0";
+
+/** column handling for ascii/binary data */
+#define MAX_COLUMNS 100
+static const unsigned int MAX_COLUMN_NUM_LENGTH = 3;
+
+/** struct to store column info in */
+typedef struct {
+	char* name;
+	Dictionary_Entry_Value_Type dictValueType;
+} ColumnInfo;	
+
+static Name ASCII_DELIMITERS = " \n\t";
+
+static const unsigned int ASCII_LIST_STRING_BUFFER_SIZE = 1024;
+
+
+/* Reading Function prototypes */
+static xmlNodePtr _XML_IO_Handler_OpenCheckFile( XML_IO_Handler*, Name );
+static xmlNodePtr _XML_IO_Handler_OpenCheckBuffer( XML_IO_Handler*, Name );
+static void _XML_IO_Handler_OpenFile( XML_IO_Handler*, Name );
+static void _XML_IO_Handler_ValidateFile( XML_IO_Handler*, Name );
+static void _XML_IO_Handler_OpenBuffer( XML_IO_Handler*, Name );
+static Bool _XML_IO_Handler_Check( XML_IO_Handler*, xmlDocPtr currDoc );
+static void _XML_IO_Handler_ParseNodes( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source source );
+static void _XML_IO_Handler_ParseList( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParseElement( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParseAsciiData( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value* );
+static void _XML_IO_Handler_ParseColumnDefinitions( XML_IO_Handler*, xmlNodePtr, ColumnInfo [MAX_COLUMNS], int* const );
+static void _XML_IO_Handler_ParseAsciiValue( char* asciiValue, ColumnInfo* columnInfo, Dictionary_Entry_Value* toDictStruct );
+static char* _XML_IO_Handler_GetNextAsciiToken( XML_IO_Handler*, xmlNodePtr );
+static void _XML_IO_Handler_ParseStruct( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParseParameter( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParsePlugins( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParsePlugin( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParseImport( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParseToolbox( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static void _XML_IO_Handler_ParseComponents( XML_IO_Handler*, xmlNodePtr, Dictionary_Entry_Value*, 
+					Dictionary_MergeType, Dictionary_Entry_Source );
+static Dictionary_Entry_Value_Type _XML_IO_Handler_GetDictValueType( XML_IO_Handler* self, char* type );
+static Dictionary_MergeType _XML_IO_Handler_GetMergeType( XML_IO_Handler* self, const xmlChar* mergeTypeStr, 
+		Name funcName, const char* tagStr, xmlChar* entryName, Dictionary_MergeType defaultMergeType );
+static xmlChar* _XML_IO_Handler_StripLeadingTrailingWhiteSpace( XML_IO_Handler* self, const xmlChar* const );
+static Bool _XML_IO_Handler_IsOnlyWhiteSpace( char* );
+/* Writing Function prototypes */
+static void _XML_IO_Handler_WriteDictionary( XML_IO_Handler*, Dictionary*, xmlNodePtr);
+static void _XML_IO_Handler_WriteNode( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
+static void _XML_IO_Handler_WriteList( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
+static void _XML_IO_Handler_WriteListElementsXML( XML_IO_Handler*, Dictionary_Entry_Value*, xmlNodePtr);
+static Bool _XML_IO_Handler_CheckListCanBePrintedRaw( Dictionary_Entry_Value* );
+static void _XML_IO_Handler_WriteListElementsRawASCII( XML_IO_Handler*, Dictionary_Entry_Value*, xmlNodePtr);
+static unsigned int _XML_IO_Handler_GetWrittenElementSize( XML_IO_Handler*, Dictionary_Entry_Value* );
+static void _XML_IO_Handler_WriteMemberAscii( XML_IO_Handler*, Dictionary_Entry_Value*, char* );
+static void _XML_IO_Handler_WriteListElementsRawBinary( XML_IO_Handler*, Dictionary_Entry_Value*, xmlNodePtr);
+static void _XML_IO_Handler_WriteStruct( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
+static void _XML_IO_Handler_WriteParameter( XML_IO_Handler*, Name, Dictionary_Entry_Value*, const char*, xmlNodePtr);
+
+
+XML_IO_Handler* XML_IO_Handler_New( void ) {
+	/* Variables set in this function */
+	SizeT                                                           _sizeOfSelf = sizeof(XML_IO_Handler);
+	Type                                                                   type = XML_IO_Handler_Type;
+	Stg_Class_DeleteFunction*                                           _delete = _XML_IO_Handler_Delete;
+	Stg_Class_PrintFunction*                                             _print = _XML_IO_Handler_Print;
+	Stg_Class_CopyFunction*                                               _copy = NULL;
+	IO_Handler_ReadAllFromFileFunction*                        _readAllFromFile = _XML_IO_Handler_ReadAllFromFile;
+	IO_Handler_ReadAllFromFileForceSourceFunction*  _readAllFromFileForceSource = _XML_IO_Handler_ReadAllFromFileForceSource;
+	IO_Handler_ReadAllFromBufferFunction*                    _readAllFromBuffer = _XML_IO_Handler_ReadAllFromBuffer;
+	IO_Handler_WriteAllToFileFunction*                          _writeAllToFile = _XML_IO_Handler_WriteAllToFile;
+	XML_IO_Handler_WriteEntryToFileFunction*                  _writeEntryToFile = _XML_IO_Handler_WriteEntryToFile;
+	XML_IO_Handler_SetListEncodingFunction*                    _setListEncoding = _XML_IO_Handler_SetListEncoding;
+	XML_IO_Handler_SetWritingPrecisionFunction*            _setWritingPrecision = _XML_IO_Handler_SetWritingPrecision;
+	XML_IO_Handler_SetWriteExplicitTypesFunction*        _setWriteExplicitTypes = _XML_IO_Handler_SetWriteExplicitTypes;
+
+	return _XML_IO_Handler_New(  XML_IO_HANDLER_PASSARGS  );
+}
+
+XML_IO_Handler* XML_IO_Handler_New_Schema( XML_IO_Handler* old );
+
+void XML_IO_Handler_Init( XML_IO_Handler* self ) {
+	/* General info */
+	self->type = XML_IO_Handler_Type;
+	self->_sizeOfSelf = sizeof(XML_IO_Handler);
+	self->_deleteSelf = False;
+	
+	/* Virtual info */
+	self->_delete = _XML_IO_Handler_Delete;
+	self->_print = _XML_IO_Handler_Print;
+	self->_writeEntryToFile = _XML_IO_Handler_WriteEntryToFile;
+	self->_setListEncoding = _XML_IO_Handler_SetListEncoding;
+	self->_setWritingPrecision = _XML_IO_Handler_SetWritingPrecision;
+	self->_setWriteExplicitTypes = _XML_IO_Handler_SetWriteExplicitTypes;
+	_Stg_Class_Init( (Stg_Class*)self );
+	_IO_Handler_Init( (IO_Handler*)self );
+	
+	/* XML_IO_Handler info */
+	_XML_IO_Handler_Init( self );
+}
+
+XML_IO_Handler* _XML_IO_Handler_New(  XML_IO_HANDLER_DEFARGS  )
+{
+	XML_IO_Handler* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(XML_IO_Handler) );
+	self = (XML_IO_Handler*)_IO_Handler_New(  IO_HANDLER_PASSARGS  );
+	
+	/* General info */
+	
+	/* Virtual info */
+	self->_writeEntryToFile = _writeEntryToFile;
+	self->_setListEncoding = _setListEncoding;
+	self->_setWritingPrecision = _setWritingPrecision;
+	self->_setWriteExplicitTypes = _setWriteExplicitTypes;
+	
+	/* WallBoundaryConditionLayout info */
+	_XML_IO_Handler_Init( self );
+	
+	return self;
+}
+
+XML_IO_Handler* XML_IO_Handler_New_Schema( XML_IO_Handler* old ) {
+	XML_IO_Handler* newHandler = XML_IO_Handler_New();
+					
+	// copy the schema and validation from prvious XML_IO_Handler
+
+	newHandler->validate = old->validate;
+	if ( old->schema != NULL ) {
+          newHandler->schema = (char*)malloc( strlen( old->schema ) +1 );
+          strcpy( newHandler->schema, old->schema );
+	}
+	return newHandler;
+}
+
+
+static void LookupTypePrint( void* ptr, struct Stream* stream ) {
+	switch( *(Dictionary_Entry_Value_Type*)ptr ) {
+		case Dictionary_Entry_Value_Type_String:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_String\n" );
+			break;
+		case Dictionary_Entry_Value_Type_Double:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Double\n" );
+			break;
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_UnsignedInt\n" );
+			break;
+		case Dictionary_Entry_Value_Type_Int:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Int\n" );
+			break;
+		case Dictionary_Entry_Value_Type_Bool:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Bool\n" );
+			break;
+		case Dictionary_Entry_Value_Type_Struct:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_Struct\n" );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_List\n" );
+			break;
+		default:
+			Journal_Printf( stream, "Dictionary_Entry_Value_Type_???\n" );
+			break;
+	}
+}
+
+static void* LookupTypeCopy( const void* ptr, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+	Dictionary_Entry_Value_Type* newLookupType;
+	
+	Journal_Firewall( deep, Journal_Register( Error_Type, XML_IO_Handler_Type ), "Shallow copy not yet implemented\n" );
+	
+	newLookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*newLookupType = *(Dictionary_Entry_Value_Type*)ptr;
+	
+	return newLookupType;
+}
+
+void _XML_IO_Handler_Init( XML_IO_Handler* self ) {
+	/* General and Virtual info should already be set */
+
+	Dictionary_Entry_Value_Type* lookupType;
+	
+	/* XML_IO_Handler info */
+	self->nameSpacesList = NULL;
+	_XML_IO_Handler_AddNameSpace( self, "http://www.vpac.org/StGermain/XML_IO_Handler/", "Jun2003" );
+	self->resource = NULL;
+	self->currDoc = NULL;
+	self->currNameSpace = NULL;
+	self->tokeniserCalls = 0;
+	self->listEncoding = PerList;
+	self->validate = 0;
+	
+	self->typeKeywords = Stg_ObjectList_New();
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_String;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "string", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_Double;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "double", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_UnsignedInt;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "uint", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_UnsignedInt;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "unsigned int", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_Int;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "int", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_UnsignedLong;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "unsigned long", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_Bool;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "bool", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_Struct;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "struct", 0, LookupTypePrint, LookupTypeCopy );
+	lookupType = Memory_Alloc( Dictionary_Entry_Value_Type, "Lookup-type" );
+	*lookupType = Dictionary_Entry_Value_Type_List;
+	Stg_ObjectList_PointerAppend( self->typeKeywords, lookupType, "list", 0, LookupTypePrint, LookupTypeCopy );
+	
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_String] = "string";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Double] = "double";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_UnsignedInt] = "uint";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Int] = "int";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_UnsignedLong] = "ulong";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Bool] = "bool";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_Struct] = "struct";
+	self->TYPE_KEYWORDS[Dictionary_Entry_Value_Type_List] = "list";
+	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_String] = 1;
+	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_Double] = 7;
+	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_UnsignedInt] = 6; 
+	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_Int] = 6; 
+	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_UnsignedLong] = 6; 
+	self->WRITING_FIELD_EXTRAS[Dictionary_Entry_Value_Type_Bool] = 1;
+	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_String, 30 );
+	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_Double, 5 );
+	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_UnsignedInt, 5 );
+	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_Int, 5 );
+	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_UnsignedLong, 5 );
+	self->_setWritingPrecision( self, Dictionary_Entry_Value_Type_Bool, 5 );
+	self->writeExplicitTypes = False;
+	
+	/* set so that whitespaces in between tags are not parsed, and indentation is generated in the output */
+	xmlKeepBlanksDefault( False );
+	
+	/* search path info */
+	self->searchPathsSize = 0;
+	self->searchPaths = NULL;
+	
+}
+
+
+/** delete the memory used by this level in the class hierarchy. */
+void _XML_IO_Handler_Delete( void* xml_io_handler ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	NameSpaceInfo* currNameSpaceInfo;
+
+	Index ii;
+
+	assert( self );
+	
+	Stg_ObjectList_DeleteAllObjects( self->typeKeywords );
+	Stg_Class_Delete( self->typeKeywords );
+
+	/* delete this level's memory */
+	currNameSpaceInfo = self->nameSpacesList;
+	while ( currNameSpaceInfo ) {
+		NameSpaceInfo* tempNameSpaceInfo = currNameSpaceInfo;
+		currNameSpaceInfo = currNameSpaceInfo->next;	
+		
+		Memory_Free( tempNameSpaceInfo->location );
+		Memory_Free( tempNameSpaceInfo->version );
+		Memory_Free( tempNameSpaceInfo );
+	}
+	
+	for ( ii = 0; ii < self->searchPathsSize; ++ii ) {
+		Memory_Free( self->searchPaths[ii] );
+	}
+	if ( self->searchPaths ) {
+		Memory_Free( self->searchPaths );
+	}
+
+	/* Stg_Class_Delete Parent Stg_Class */
+	_IO_Handler_Delete( self );
+}
+
+
+/** print implementation */
+void _XML_IO_Handler_Print( void* xml_io_handler, Stream* stream ) {
+	XML_IO_Handler* self = (XML_IO_Handler*)xml_io_handler;
+	
+	/* General info */
+	Journal_Printf( stream, "XML_IO_Handler (ptr): %p\n", self );
+	
+	/* Print parent class */
+	_IO_Handler_Print( self, stream );
+	
+	/* Virtual info */
+	Journal_Printf( stream, "\t_writeEntryToFile (func ptr): %p\n", self->_writeEntryToFile );
+	Journal_Printf( stream, "\t_setListEncoding (func ptr): %p\n", self-> _setListEncoding);
+	Journal_Printf( stream, "\t_setWritingPrecision (func ptr): %p\n", self->_setWritingPrecision );
+	Journal_Printf( stream, "\t_setWriteExplicitTypes (func ptr): %p\n", self->_setWriteExplicitTypes );
+	
+	/* XML_IO_Handler */
+	Journal_Printf( stream, "\tcurDoc (ptr)= %p, ", self->currDoc );
+	if( self->currNameSpace ) {
+		Journal_Printf( stream, "currNameSpace: %s\n", self->currNameSpace->href );
+	}
+	else {
+		Journal_Printf( stream, "currNameSpace: (null)\n" );
+	}	
+}
+
+
+/** sets the type of list encoding you'd like output to be written in, see ::ListEncoding enum. */
+void XML_IO_Handler_SetListEncoding( void* xml_io_handler, ListEncoding listEncoding ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	assert ( self );
+	self->_setListEncoding( self, listEncoding );
+}
+
+void _XML_IO_Handler_SetListEncoding( void* xml_io_handler, ListEncoding listEncoding ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	self->listEncoding = listEncoding;
+}
+
+
+/** sets the precision to which output numbers will be printed. Field width's will be correspondingly adjusted
+ * automatically. */
+void XML_IO_Handler_SetWritingPrecision( void* xml_io_handler, int dictionaryEntryType, int value ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	assert ( self );
+	self->_setWritingPrecision( xml_io_handler, dictionaryEntryType, value );
+}
+
+void _XML_IO_Handler_SetWritingPrecision( void* xml_io_handler, int dictionaryEntryType, int value ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	assert ( self );
+	self->writingPrecision[dictionaryEntryType] = value; 
+	self->writingFieldWidth[dictionaryEntryType] = value + self->WRITING_FIELD_EXTRAS[dictionaryEntryType];
+}
+
+
+/** Determines whether types will be written explicitly in the output (default: no). If set to yes, the type of each
+ * variable will be written as an attribute. */
+void XML_IO_Handler_SetWriteExplicitTypes( void* xml_io_handler, Bool writeExplicitTypes ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	assert ( self );
+	self->_setWriteExplicitTypes( self, writeExplicitTypes );
+}
+
+void _XML_IO_Handler_SetWriteExplicitTypes( void* xml_io_handler, Bool writeExplicitTypes ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	self->writeExplicitTypes = writeExplicitTypes;
+}
+
+
+/** adds a namespace to the list of those that will be checked against when reading a file */
+void _XML_IO_Handler_AddNameSpace( void* xml_io_handler, Name location, const char* version )
+{
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	NameSpaceInfo* newNameSpaceInfo = Memory_Alloc( NameSpaceInfo, "XML_IO_Handler->nameSpaceList" );
+	
+	assert ( self );
+	newNameSpaceInfo->location = StG_Strdup(location);
+	newNameSpaceInfo->version = StG_Strdup(version);
+	newNameSpaceInfo->next = self->nameSpacesList; 
+	self->nameSpacesList = newNameSpaceInfo;
+}
+
+
+/** add a path to the search paths */
+void XML_IO_Handler_AddDirectory( Name name, char* directory ) {
+	Bool				found;
+	Index				dir_i;
+	/* Check if it is a valid path */
+	if ( !directory ) {
+		return;
+	}
+
+	/* Check if dictionary already exists */
+	if(Project_XMLSearchPaths == NULL) {
+		Project_XMLSearchPaths = Stg_ObjectList_New();
+	}
+	
+	/* Add path to global list */
+	found = False;
+	for( dir_i =  0; dir_i < Project_XMLSearchPaths->count; dir_i++ ){
+          if( strcmp( directory, (char*)Stg_ObjectList_ObjectAt( Project_XMLSearchPaths, dir_i ) ) == 0 ) {
+			found = True;
+		}
+	}
+	
+	if( !found ) {
+		Stg_ObjectList_PointerAppend( Project_XMLSearchPaths, StG_Strdup( directory ), name, 0, 0, 0 ); 
+	}
+}	
+/** add a path to the search paths */
+void _XML_IO_Handler_AddSearchPath( void* xml_io_handler, Name path ) {
+	XML_IO_Handler*		self = (XML_IO_Handler*)xml_io_handler;
+
+	if ( !path ) {
+		return;
+	}
+
+	self->searchPathsSize++;
+	
+	if( self->searchPathsSize == 1 ) {
+		self->searchPaths = Memory_Alloc_Array( char*, self->searchPathsSize, "XML_IO_Handler->searchPathsSize" );
+	}
+	else {
+		self->searchPaths = Memory_Realloc_Array( self->searchPaths, char*, self->searchPathsSize );
+	}
+
+	self->searchPaths[ self->searchPathsSize - 1 ] = StG_Strdup( path );
+}
+
+/** Read all parameters from a file implementation. See IO_Handler_ReadAllFromFile(). It will first check if the file
+ * exists, and contains valid XML. */
+Bool _XML_IO_Handler_ReadAllFromFile( void* xml_io_handler, Name filename, Dictionary* dictionary ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	xmlNodePtr rootElement = NULL;
+	xmlNodePtr firstElement = NULL;
+	int rank;
+	
+	Journal_DPrintf( Journal_Register( Debug_Type, XML_IO_Handler_Type ), "XML_IO_Handler called to read file %s.\n", filename );
+	
+	assert( self && filename && dictionary );
+	MPI_Comm_rank( MPI_COMM_WORLD, &rank );	
+	/* set the current dictionary to the one being read */
+	self->currDictionary = dictionary;
+
+	/* Order of search*/
+	/* 1. Current directory */
+	/* 2. XML, searched paths */
+	/* 3. XML paths from other projects */
+	/* 4. Environment Variable */
+	/* 5. Default STG_INCLUDE_PATH */
+
+	/* 1. Current directory */
+	{
+          /* $PWD does not work for all ranks, in all mpi implementations
+             "./" however does so far.
+             char* pwd = getenv( "PWD" ); */
+		Name pwd = "./";
+		if ( pwd != NULL ) {
+			_XML_IO_Handler_AddSearchPath( self, pwd );
+		}
+	}
+
+	/* 2. XML, searched paths */
+	if( self->currPath ) /* setup initial search path (currPath) */
+		_XML_IO_Handler_AddSearchPath( self, self->currPath );
+	else
+		_XML_IO_Handler_AddSearchPath( self, "./" );
+
+	/* 3. XML paths from other projects */
+	if (Project_XMLSearchPaths != NULL) {
+		Index index_I;
+		for (index_I = 0; index_I  < Project_XMLSearchPaths->count; index_I++){
+			_XML_IO_Handler_AddSearchPath( 
+					self, 
+					(char*)Stg_ObjectList_ObjectAt( Project_XMLSearchPaths,index_I )
+				); 
+		}
+	}
+	/* 4. Environment Variable */
+	{
+		char* envValue;
+
+		envValue = getenv( "STG_INCLUDE_PATH" );
+		if ( envValue != NULL ) {
+			char* envCopy; 
+			char* token;
+
+			envCopy = StG_Strdup( envValue );
+			token = strtok( envCopy, ":" );
+			while ( token != NULL ) {
+				_XML_IO_Handler_AddSearchPath( self, token );
+				token = strtok( NULL, ":" );
+			}
+
+			Memory_Free( envCopy );
+		}
+	}
+
+	/* 5. Default STG_INCLUDE_PATH */
+	#ifdef STG_INCLUDE_PATH
+		_XML_IO_Handler_AddSearchPath( self, STG_INCLUDE_PATH );
+	#endif
+
+	/* open the file and check syntax */
+	if ( !(rootElement = _XML_IO_Handler_OpenCheckFile( self, filename )) ) {
+		if( self->currDoc )
+			xmlFreeDoc( self->currDoc );
+		return False;
+	}
+	
+	_XML_IO_Handler_ValidateFile( self, filename );
+	
+	/* call parse nodes, starting on the first child */
+	firstElement = rootElement->xmlChildrenNode;
+	_XML_IO_Handler_ParseNodes( self, firstElement, NULL, IO_Handler_DefaultMergeType, NULL );
+	
+	/* free memory */
+	if( self->currDoc )
+		xmlFreeDoc( self->currDoc );
+	xmlCleanupParser();
+	
+	return True;
+}
+
+/** Read all parameters from a file implementation. See IO_Handler_ReadAllFromFile(). It will first check if the file
+ * exists, and contains valid XML. 
+ * FORCES the source file to be added to each Dictionary_Entry_Source (even if XML didn't have a source entry)*/
+Bool _XML_IO_Handler_ReadAllFromFileForceSource( void* xml_io_handler, Name filename, Dictionary* dictionary ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	xmlNodePtr rootElement = NULL;
+	xmlNodePtr firstElement = NULL;
+	
+	Journal_DPrintf( Journal_Register( Debug_Type, XML_IO_Handler_Type ), "XML_IO_Handler called to read file %s.\n", filename );
+	
+	assert( self && filename && dictionary );
+	
+	/* set the current dictionary to the one being read */
+	self->currDictionary = dictionary;
+	
+	/* setup initial search path (currPath) */
+	if( self->currPath )
+		_XML_IO_Handler_AddSearchPath( self, self->currPath );
+	else
+		_XML_IO_Handler_AddSearchPath( self, "./" );
+	
+	/* open the file and check syntax */
+	if ( !(rootElement = _XML_IO_Handler_OpenCheckFile( self, filename )) ) {
+		xmlCleanupParser();
+		return False;
+	}	
+	
+	/* call parse nodes, starting on the first child */
+	
+
+	firstElement = rootElement->xmlChildrenNode;
+	_XML_IO_Handler_ParseNodes( self, firstElement, NULL, Dictionary_MergeType_Replace, (char*) rootElement->doc->URL );
+	
+	/* free memory */
+	if( self->currDoc )
+		xmlFreeDoc( self->currDoc );
+	xmlCleanupParser();
+	
+	return True;
+}
+
+Bool _XML_IO_Handler_ReadAllFromBuffer( void* xml_io_handler, Name buffer, Dictionary* dictionary ) {
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	xmlNodePtr rootElement = NULL;
+
+	assert( self && buffer && dictionary );
+	
+	/* set the current dictionary to the one being read */
+	self->currDictionary = dictionary;
+	
+	/* open the buffer and check syntax */
+	if ( !(rootElement = _XML_IO_Handler_OpenCheckBuffer( self, buffer )) ) {
+		xmlCleanupParser();
+		return False;
+	}	
+	
+	/* call parse nodes, starting on the first child */
+	_XML_IO_Handler_ParseNodes( self, rootElement, NULL, Dictionary_MergeType_Replace, NULL );
+	
+	/* free memory */
+	if( self->currDoc )
+		xmlFreeDoc( self->currDoc );
+	xmlCleanupParser();
+	
+	return True;
+}
+
+/** Opens a file for reading and checks it contains valid XML code.
+ * \return a pointer to the root node if the file is valid, NULL otherwise. */
+static xmlNodePtr _XML_IO_Handler_OpenCheckFile( XML_IO_Handler* self, Name filename )
+{
+   xmlChar		absolute[1024];
+   xmlNodePtr	cur = NULL;
+   Bool			status = False;
+
+   if ( !FindFileInPathList(
+      (char*)absolute,
+      (char*)filename,
+      self->searchPaths,
+      self->searchPathsSize ) )
+   {
+      Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+      "Error: File %s doesn't exist, not readable, or not valid.\n", filename );
+      exit(EXIT_FAILURE);
+   } 
+
+   _XML_IO_Handler_OpenFile( self, (char*)absolute );
+
+   if( self->currDoc == NULL ) {
+      Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+      "Error: File %s doesn't exist, not readable, or not valid.\n", filename );
+      exit(EXIT_FAILURE);
+   }
+
+   if( self->currDoc != NULL ) {
+      cur = xmlDocGetRootElement( self->currDoc );
+      status = _XML_IO_Handler_Check( self, self->currDoc );
+
+      if( !status ) {
+         Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+         "Error: File %s not valid/readable.\n", filename );
+         exit(EXIT_FAILURE);
+      }
+
+      if( status == True )
+         return cur;
+      else
+         return NULL;
+   }
+   else 
+      return NULL; 
+}
+
+static xmlNodePtr _XML_IO_Handler_OpenCheckBuffer( XML_IO_Handler* self, Name buffer ) {
+	xmlNodePtr   rootElement = NULL;
+
+	_XML_IO_Handler_OpenBuffer( self, buffer );
+	if ( self->currDoc == NULL ) {
+		return NULL;
+	}
+
+	rootElement = xmlDocGetRootElement( self->currDoc );
+
+	Journal_Firewall( _XML_IO_Handler_Check( self, self->currDoc ),
+		Journal_Register( Error_Type, XML_IO_Handler_Type ),
+		"Error: XML buffer provided not valid/readable.\n"
+		);
+
+	return rootElement;
+}
+
+#if 0
+static void _processNode(xmlTextReaderPtr reader) {
+	const xmlChar *name, *value;
+
+	name = xmlTextReaderConstName(reader);
+	if (name == NULL)
+	name = BAD_CAST "--";
+
+	value = xmlTextReaderConstValue(reader);
+
+	printf("%d %d %s %d %d", 
+		xmlTextReaderDepth(reader),
+		xmlTextReaderNodeType(reader),
+		name,
+		xmlTextReaderIsEmptyElement(reader),
+		xmlTextReaderHasValue(reader));
+	if (value == NULL)
+		printf("\n");
+	else {
+		if (xmlStrlen(value) > 40)
+			printf(" %.40s...\n", value);
+		else
+			printf(" %s\n", value);
+	}
+}
+#endif
+
+static void _XML_IO_Handler_ValidateFile( XML_IO_Handler* self, Name filename ) {
+	#ifdef LIBXML_VERSION 
+	#if LIBXML_VERSION == 20631
+	xmlTextReaderPtr reader;
+	//int valid;
+	int ret;
+
+	reader = xmlNewTextReaderFilename( filename );
+
+	if ( reader != NULL ) {
+
+		xmlNodePtr cur = NULL;
+		cur = xmlDocGetRootElement( self->currDoc );
+		xmlNsPtr* nsArray = xmlGetNsList( self->currDoc, cur );
+		int i;
+		for (i=0; nsArray[i] != NULL; i++ ) {
+			//if ( *(self->validate) == 1 )
+				//valid = xmlTextReaderSchemaValidate( reader, (Name) nsArray[i]->href );
+		}
+
+
+		ret = xmlTextReaderRead( reader );
+		while ( ret == 1 ) {
+			//_processNode(reader);
+			ret = xmlTextReaderRead( reader );
+		}
+
+		if ( (self->validate) == 1 ) {
+			/*
+			if ( self->schema == NULL )
+				Journal_Firewall( 
+					( self->schema != NULL ), 
+					Journal_Register( Error_Type, XML_IO_Handler_Type ), 
+					"Schema is not provided\n" );
+			*/
+			if ( xmlTextReaderIsValid( reader ) != 1 ) {
+				fprintf( stderr, "%s : failed to parse\n", filename );
+				Journal_Firewall( 
+					xmlTextReaderIsValid( reader ) == 1, 
+					Journal_Register( Error_Type, XML_IO_Handler_Type ), 
+					"Document %s does not validate\n", filename );
+			}
+			else {
+				fprintf( stderr, "Document %s is valid\n", filename );
+			}
+		}
+
+		xmlFreeTextReader( reader );
+		if (ret !=0) {
+			fprintf( stderr, "%s : failed to parse\n", filename );
+		}
+	} else {
+		fprintf( stderr, "unable to open %s\n", filename );
+	}
+	#endif
+	#endif
+    //xmlFree ( reader );
+}
+
+static void _XML_IO_Handler_OpenFile( XML_IO_Handler* self, Name filename ) {
+	/* open an XML file and build an XML tree from it. */
+	/* TODO: validate against simple dtd? */
+	
+	self->currDoc = xmlParseFile( filename );
+	if ( self->currDoc == NULL ) {
+		xmlCleanupParser();
+	}
+	if ( self->resource ) {
+		Memory_Free( self->resource );
+	}
+	self->resource = StG_Strdup( (char*)filename );
+
+}
+
+static void _XML_IO_Handler_OpenBuffer( XML_IO_Handler* self, Name buffer ) {
+	self->currDoc = xmlParseDoc( BAD_CAST buffer );
+	if ( self->resource ) {
+		Memory_Free( self->resource );
+	}
+	self->resource = StG_Strdup( "buffer" );
+}
+
+Bool _XML_IO_Handler_Check( XML_IO_Handler* self, xmlDocPtr currDoc ) {
+	xmlNodePtr	rootElement = NULL;
+	
+	rootElement = xmlDocGetRootElement( self->currDoc );
+	if ( !rootElement ) {
+		Journal_Printf(
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Error: empty document. Not parsing.\n" );
+		return False;
+	}
+	
+	/* check the namespace */
+	if( _XML_IO_Handler_CheckNameSpace( self, rootElement ) == False ) {
+		return False;
+	}
+	
+	/* check root element */
+	if (xmlStrcmp(rootElement->name, (const xmlChar *) ROOT_NODE_NAME)) {
+		Journal_Printf( 
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"resource %s of wrong type, root node =<%s>, should be <%s>.\nNot parsing.\n",
+			self->resource,
+			(Name) rootElement->name, 
+			ROOT_NODE_NAME );
+		return False;
+	}
+	
+	return True;
+}
+
+
+/** given the root node of a document, checks the name space is among the list of allowed ones. If not, or if 
+ * version is wrong, prints an appropriate warning.
+ * \return True if namespace found among allowed list, false otherwise. */
+Bool _XML_IO_Handler_CheckNameSpace( XML_IO_Handler* self, xmlNodePtr curNode )
+{
+	Bool retVal = True;
+	NameSpaceInfo* currNsInfo = self->nameSpacesList;
+	char* correctNameSpace;
+	int correctLength = ( strlen(currNsInfo->location) + strlen(currNsInfo->version) ) + 1; 
+	
+	Journal_Firewall( NULL != (correctNameSpace = Memory_Alloc_Array_Unnamed( char, correctLength )),
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Error: couldn't allocate memory for namespace.\n" );
+	strcpy( correctNameSpace, currNsInfo->location );
+	strcat( correctNameSpace, currNsInfo->version );
+	
+	if ( (self->currNameSpace = xmlSearchNsByHref( self->currDoc , curNode, (const xmlChar *) correctNameSpace )) )
+	{
+		/* the correct namespace has been found. */
+		retVal = True;
+	}
+	else {
+		xmlNsPtr* nsArray = xmlGetNsList( self->currDoc, curNode );
+		int i;
+		
+		for (i=0; nsArray[i] != NULL; i++ ) {
+			Name lastSlash;
+			int locationLength;
+			
+			self->currNameSpace = nsArray[i];
+			
+			if ( NULL == (lastSlash = strrchr( (Name) nsArray[i]->href, '/' )) ) {
+				Journal_Printf( 
+					Journal_Register( Error_Type, XML_IO_Handler_Type ),
+					"Warning: resource %s has namespace \"%s\" not of expected URI form.\n",
+					self->resource, 
+					nsArray[i]->href );
+				Memory_Free( correctNameSpace );
+				return False;
+			} 
+			locationLength = (char*) lastSlash - (char*) nsArray[i]->href;
+			
+			if ( 0 == xmlStrncmp( nsArray[i]->href, (const xmlChar*) currNsInfo->location, locationLength ) ) {
+				Journal_Printf(
+					Journal_Register( Error_Type, XML_IO_Handler_Type ),
+					"Warning: resource %s of the correct type (\"%s\") but wrong version (\"%s\") as "
+					"compared to correct one of \"%s\".\n", 
+					self->resource,
+					currNsInfo->location, 
+					lastSlash+1,
+					currNsInfo->version );			
+				retVal = False;
+			}
+			else {
+				currNsInfo = currNsInfo->next;
+				
+				/* search the IO_Handler's parent for matches */
+				while ( currNsInfo ) {
+					self->currNameSpace = nsArray[i];
+					if ( 0 == xmlStrncmp( nsArray[i]->href, (const xmlChar*) currNsInfo->location, locationLength ) ) {
+						Journal_Printf(
+							Journal_Register( Error_Type, XML_IO_Handler_Type ),
+							"Warning: resource %s of the type of a parent namespace (\"%s\") as "
+							"compared to correct one of %s. "
+							"Some input features may not work.\n", 
+							self->resource,
+							currNsInfo->location, 
+							correctNameSpace );
+						retVal = False;
+					}
+				}
+				
+				if ( True == retVal ) {
+					Journal_Printf( 
+						Journal_Register( Error_Type, XML_IO_Handler_Type ),
+						"Error: resource %s of the wrong type, unknown namespace wasn't expected "
+						"value of %s.\n", 
+						self->resource, 
+						correctNameSpace );
+					retVal = False;	
+				}
+			}
+		}
+        xmlFree( nsArray );
+	}
+	
+	Memory_Free( correctNameSpace );
+	return retVal;
+}
+
+
+/** given a document node and the parent of that node, parses all the information on that node and any of its children
+ * into the Dictionary. */
+static void _XML_IO_Handler_ParseNodes( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, Dictionary_MergeType mergeType, Dictionary_Entry_Source source )
+{
+	/* Process each node at this depth. Allow any order, and warn on unknown nodes */
+	while (cur != NULL) {
+		/* if parameter */
+		if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) ELEMENT_TAG ) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseElement( self, cur, parent, mergeType, source );
+		}
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) PLUGINS_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParsePlugins( self, cur, parent, mergeType, source );
+		} 
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) PLUGIN_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParsePlugin( self, cur, parent, mergeType, source );
+		} 
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) TOOLBOX_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseToolbox( self, cur, parent, mergeType, source );
+		} 
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) IMPORT_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseImport( self, cur, parent, mergeType, source );
+		} 
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) COMPONENTS_TAG) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseComponents( self, cur, parent, mergeType, source );
+		} 
+		#ifdef XML_OLD_DTD
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) PARAM_TAG ) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseParameter( self, cur, parent, mergeType, source );
+		}
+		else if	( (0 == xmlStrcmp( cur->name, (const xmlChar *) LIST_TAG ) ) && ( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseList( self, cur , parent, mergeType, source );
+		}
+		else if	( (0 == xmlStrcmp( cur->name, (const xmlChar *) STRUCT_TAG ) ) &&
+			( cur->ns == self->currNameSpace ) ) {
+			_XML_IO_Handler_ParseStruct( self, cur, parent, mergeType, source );
+		}
+		#endif
+		else if ( (0 == xmlStrcmp( cur->name, (const xmlChar *) SEARCH_PATH_TAG ) ) &&
+			( cur->ns == self->currNameSpace ) )
+		{
+			xmlChar*	tmp;
+			
+			xmlChar* path = xmlNodeListGetString( self->currDoc, cur->xmlChildrenNode, 1 );
+			
+			tmp = Memory_Alloc_Array( xmlChar, 1024, "TmpPath" );
+			
+			/* Handle absolute paths */
+			if( strlen( (char*)path ) ) {
+				if( !(path[0] == '/' || path[0] == '~' || path[0] == '$' ) ) {
+					PathJoin( (char*)tmp, 2, self->currPath, path );
+				}
+				else {
+					strcpy( (char*)tmp, (char*)path );
+				}
+			}
+			else {
+				tmp[0] = 0;
+			}
+			
+			tmp = (xmlChar*)ExpandEnvironmentVariables( (char*)tmp );
+				
+			_XML_IO_Handler_AddSearchPath( self, (char*)tmp );
+
+            xmlFree( path );
+			//free( tmp );
+		}
+		else if	( (0 == xmlStrcmp( cur->name, (const xmlChar *) INCLUDE_TAG ) ) &&
+			( cur->ns == self->currNameSpace ) )
+		{
+			xmlChar* filename = xmlNodeListGetString( self->currDoc, cur->xmlChildrenNode, 1 );
+
+			if ( filename ) {
+				xmlChar*	spaceStrippedFileName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, filename );
+
+				Journal_DPrintf( 
+					Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+					"Trying to parse file %s due to include command.\n", 
+					(char*)spaceStrippedFileName );
+				
+				if ( 0 == xmlStrcmp( spaceStrippedFileName, (const xmlChar*) self->resource ) ) { 
+					Journal_Printf(
+						Journal_Register( Error_Type, XML_IO_Handler_Type ),
+						"Warning- while parsing file %s: Ignoring request to parse same file "
+						"(to avoid infinite loop.\n", 
+						self->resource );
+				}
+				else {
+					xmlChar absolute[1024];
+					Index i;
+					XML_IO_Handler* newHandler = XML_IO_Handler_New_Schema( self );
+					
+					XML_IO_Handler_SetListEncoding( newHandler, self->listEncoding );
+					XML_IO_Handler_SetWriteExplicitTypes( newHandler, self->writeExplicitTypes );
+				
+					for ( i = 0; i < self->searchPathsSize; ++i ) {
+						_XML_IO_Handler_AddSearchPath( newHandler, self->searchPaths[i] );
+					}
+						
+					if ( ! FindFileInPathList(
+						(char*)absolute, 
+						(char*)spaceStrippedFileName, 
+						self->searchPaths, 
+						self->searchPathsSize ) ) {
+					
+						/* Let IO_Handler_ReadAllFromFile() display the errors for opening the file */
+						strcpy( (char*)absolute, (char *)spaceStrippedFileName );
+					}
+					
+					/* TODO: this will need to change once we allow other file type includes */
+					for (i=0; i < Dictionary_Entry_Value_Num_Types; i++ ) {
+						XML_IO_Handler_SetWritingPrecision( newHandler, i, self->writingPrecision[i] );
+					}
+					
+					if( 
+						strlen( (char*)absolute ) == 0 
+						|| (source != NULL && 
+						 	False == IO_Handler_ReadAllFromFileForceSource( newHandler, 
+												        (char*)absolute, 
+													self->currDictionary ) )
+						|| (source == NULL &&
+						 	False == IO_Handler_ReadAllFromFile( newHandler,
+											     (char*)absolute , 
+											     self->currDictionary ) ) )
+					{
+						Journal_Printf(
+							Journal_Register( Error_Type, XML_IO_Handler_Type ),
+							"Warning: Failed to parse file %s from include command.\n", 
+							spaceStrippedFileName );
+					}
+					
+					Stg_Class_Delete( newHandler );
+				}
+				xmlFree( filename );
+				Memory_Free( spaceStrippedFileName );
+			}
+		}
+		/*TODO should we use this or validation? */
+		#if 0
+		else if  {
+			fJournal_Printf( stream, stdout, "Warning- while parsing file %s: unknown tag \"%s\" found, ignoring.\n",
+				self->resource, cur->name );
+		}
+		#endif
+		
+		cur = cur->next;
+	}
+}
+
+static void _XML_IO_Handler_ParseElement( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, Dictionary_MergeType mergeType, Dictionary_Entry_Source source )
+{
+	/* Process each node at this depth. Allow any order, and warn on unknown nodes */
+	xmlChar* name = xmlGetProp( cur, TYPE_ATTR );
+	/* if parameter */
+	if ( (0 == xmlStrcmp( name, (const xmlChar *) PARAM_ATTR ) ) && ( cur->ns == self->currNameSpace ) ) {
+		_XML_IO_Handler_ParseParameter( self, cur, parent, mergeType, source );
+	}
+	else if	( (0 == xmlStrcmp( name, (const xmlChar *) LIST_ATTR ) ) && ( cur->ns == self->currNameSpace ) ) {
+		_XML_IO_Handler_ParseList( self, cur , parent, mergeType, source );
+	}
+	else if	( (0 == xmlStrcmp( name, (const xmlChar *) STRUCT_ATTR ) ) &&
+		( cur->ns == self->currNameSpace ) ) {
+		_XML_IO_Handler_ParseStruct( self, cur, parent, mergeType, source );
+	}
+    xmlFree( name );
+}
+
+static void _XML_IO_Handler_ParseComponents( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
+					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
+{
+	xmlNewProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*) "name" );
+	xmlSetProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*)"components" );
+	_XML_IO_Handler_ParseStruct( self, cur, parent, defaultMergeType, source );
+}
+
+static void _XML_IO_Handler_ParsePlugins( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
+					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
+{
+	xmlNewProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*) "name" );
+	xmlSetProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*)"plugins" );
+	_XML_IO_Handler_ParseList( self, cur, parent, defaultMergeType, source );
+}
+
+static void _XML_IO_Handler_ParsePlugin( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
+					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
+{
+	_XML_IO_Handler_ParseParameter( self, cur, parent, defaultMergeType, source );
+}
+
+static void _XML_IO_Handler_ParseImport( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
+					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
+{
+	xmlNewProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*) "name" );
+	xmlSetProp( cur, (xmlChar*) NAME_ATTR, (xmlChar*)"import" );
+	_XML_IO_Handler_ParseList( self, cur, parent, defaultMergeType, source );
+}
+
+static void _XML_IO_Handler_ParseToolbox( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
+					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
+{
+	_XML_IO_Handler_ParseParameter( self, cur, parent, defaultMergeType, source );
+}
+	
+/** parse list: given a node containing a list, parses the list into the ::Dictionary. (In future might want flags to
+ * say whether each element constrained to be same type?) */
+static void _XML_IO_Handler_ParseList( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parent, 
+					Dictionary_MergeType defaultMergeType, Dictionary_Entry_Source source )
+{	
+	xmlChar* name = xmlGetProp( cur, NAME_ATTR );
+	xmlChar* sourceFile = xmlGetProp( cur, SOURCEFILE_ATTR );
+	xmlChar* mergeTypeStr = xmlGetProp( cur, MERGETYPE_ATTR );
+	xmlChar* childrenMergeTypeStr = xmlGetProp( cur, CHILDRENMERGETYPE_ATTR );
+	xmlChar* spaceStrippedName = NULL;
+	xmlChar* spaceStrippedSourceFile = NULL;
+	Dictionary_Entry_Value* newList = NULL;
+	Dictionary_MergeType mergeType = defaultMergeType;
+	Dictionary_MergeType childrenMergeType = Dictionary_MergeType_Append;
+	
+	if ( name ) {
+		spaceStrippedName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, name );
+	}
+	if ( sourceFile ) {
+		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, sourceFile );
+	}
+	else if (source) {
+		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, (xmlChar*) source );
+	}
+	mergeType = _XML_IO_Handler_GetMergeType( self, mergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, defaultMergeType );
+	childrenMergeType = _XML_IO_Handler_GetMergeType( self, childrenMergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, IO_Handler_DefaultChildrenMergeType );
+
+	Journal_DPrintf(
+		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_ParseList called on tag %s, with name=\"%s\", and mergeType=\"%s\"\n", 
+		(char *) cur->name, 
+		spaceStrippedName, 
+		mergeTypeStr );
+	
+	/* set/add the list */
+	newList = IO_Handler_DictSetAddValueWithSource(
+		self,
+		(char*)spaceStrippedName, 
+		NULL, 
+		Dictionary_Entry_Value_Type_List, 
+		parent, 
+		mergeType,
+		(char*)spaceStrippedSourceFile );
+
+	if ( (NULL != newList) && cur->xmlChildrenNode ) {
+		/* check to see if values presented as columns of binary and ascii data */
+		if	( (0 == xmlStrcmp( cur->xmlChildrenNode->name, (const xmlChar *) ASCII_DATA_TAG ) ) &&
+				( cur->ns == self->currNameSpace ) )
+		{
+			Dictionary_Entry_Value_SetEncoding( newList, RawASCII );
+			_XML_IO_Handler_ParseAsciiData( self, cur->xmlChildrenNode, newList ); 
+		}	
+		else {
+			/* TODO: working out whether to make sure all elements conform to type of first */
+			_XML_IO_Handler_ParseNodes( self, cur->xmlChildrenNode, newList, childrenMergeType, source );
+		}
+		
+		/* if global encoding flag set, change encoding */
+		switch (self->listEncoding) {
+			case PerList:
+				break; /* will be set correctly already */
+			case AllXML:
+				Dictionary_Entry_Value_SetEncoding( newList, Default );
+				break;
+			case AllRawASCII:
+				Dictionary_Entry_Value_SetEncoding( newList, RawASCII );
+				break;
+			case AllRawBinary:
+				Dictionary_Entry_Value_SetEncoding( newList, RawBinary );
+				break;
+		}
+	}
+	
+	xmlFree( name );
+	if ( spaceStrippedName ) {
+		Memory_Free( spaceStrippedName );
+	}
+	xmlFree( sourceFile );
+	if ( spaceStrippedSourceFile ) {
+		Memory_Free( spaceStrippedSourceFile );
+	}
+}			
+
+
+/** parses an ascii data list. If column definitions provided, parses the data in as the defined types. Else, parses
+ * in entries as strings into a struct with members called "1" to "x", where x is the number of ascii data pieces on the
+ * first line.
+ * TODO: generalise using a function pointer to tokeniser to handle raw binary data */
+static void _XML_IO_Handler_ParseAsciiData( XML_IO_Handler* self, xmlNodePtr cur, Dictionary_Entry_Value* parentList )
+{
+	ColumnInfo columnInfo[MAX_COLUMNS];
+	int numColumns = 0;
+	xmlNodePtr currChild;
+	char** asciiData = NULL;
+	int asciiCount;
+	int asciiSize;
+	char* currAsciiToken;
+	int i = 0; 
+	int countI;
+	
+	currChild = cur->xmlChildrenNode;
+	_XML_IO_Handler_ParseColumnDefinitions( self, currChild, columnInfo, &numColumns );
+	
+	if ( 0 == numColumns ) {
+		
+		/* if asciidata, decide the columns based on the first row. */
+		if ( 0 == xmlStrcmp( cur->name, (const xmlChar *) ASCII_DATA_TAG ) ) { 
+			xmlChar* dataString = xmlNodeListGetString( self->currDoc, currChild, 1 );
+			char* firstLine = strtok( (char*) dataString, "\n" );	
+			char* currValue = strtok( firstLine, ASCII_DELIMITERS );
+			
+			while( currValue ) {
+				columnInfo[numColumns].name = Memory_Alloc_Array( char, MAX_COLUMN_NUM_LENGTH,
+					"columnInfo[numColumns].name" );
+				sprintf( columnInfo[numColumns].name, "%d", numColumns );
+				columnInfo[numColumns].dictValueType = Dictionary_Entry_Value_Type_String;
+				
+				currValue = strtok( NULL, ASCII_DELIMITERS );
+				numColumns++;
+			}
+		}
+		else {
+			Journal_Printf( 
+				Journal_Register( Error_Type, XML_IO_Handler_Type ),
+				"Error - while parsing resource %s: type of binary data must be specified "
+				"through dictionary or <%s> tag. Ignoring data.\n", 
+				self->resource,
+				COLUMN_DEFINITION_TAG );
+			return;
+		}
+	
+	}
+	
+	/* reset the tokeniser if necessary */
+	self->tokeniserCalls = 0;
+	asciiCount = 0;
+	asciiSize = 0;
+
+	/* parse each token into asciiData */ 
+	currAsciiToken = _XML_IO_Handler_GetNextAsciiToken( self, currChild );
+	while ( currAsciiToken ) {
+		if ( asciiSize == 0 ) {
+			asciiSize += numColumns;
+			asciiData = Memory_Alloc_Array( char*, asciiSize, "asciiData"  );
+		}
+		else if ( asciiCount == asciiSize ) {
+			asciiSize += numColumns;
+			asciiData = Memory_Realloc_Array( asciiData, char*, asciiSize ); 
+		}
+		asciiData[asciiCount] = currAsciiToken;
+		asciiCount++;
+		currAsciiToken = _XML_IO_Handler_GetNextAsciiToken( self, currChild );
+	}
+	
+	countI = 0;
+	
+	/* parse all the ascii values into the parent list */
+	while ( countI < asciiCount ) {
+		Bool rowOk = True;
+		Dictionary_Entry_Value* currStruct = Dictionary_Entry_Value_NewStruct(); 
+
+		for (i=0; i < numColumns; i++) {
+			currAsciiToken = asciiData[countI];
+		
+			if ( currAsciiToken ) {
+				_XML_IO_Handler_ParseAsciiValue( currAsciiToken, &columnInfo[i], currStruct );
+			}
+			else {
+				Journal_Printf(
+					Journal_Register( Error_Type, XML_IO_Handler_Type ),
+					"Warning - while parsing resource %s: last row of Ascii data partially full. "
+					"Discarding row.\n", 
+					self->resource );
+				Memory_Free( asciiData );
+				Memory_Free( currStruct );
+				rowOk = False;
+				break;
+			}
+			countI++;	
+		}
+		/* add element to list in dict */
+		if ( True == rowOk ) {
+			Dictionary_Entry_Value_AddElement( parentList, currStruct );
+		}
+	}
+	
+	Memory_Free( asciiData );
+	
+	/* Memory_Free the columnInfo array */
+	for (i=0; i < numColumns; i++ ) {
+		Memory_Free( columnInfo[i].name );
+	}
+}
+
+
+/** recursive function to parse all the column definitions, and ignore whitespace between them */
+static void _XML_IO_Handler_ParseColumnDefinitions( XML_IO_Handler* self, xmlNodePtr cur, 
+	ColumnInfo columnInfo[MAX_COLUMNS], int* const numColumnsPtr )
+{
+	char* stringPtr;
+
+	/* read any column definitions */
+	while ( (XML_ELEMENT_NODE == cur->type) &&
+		(0 == xmlStrcmp( cur->name, (const xmlChar *) COLUMN_DEFINITION_TAG ) ) &&
+		( cur->ns == self->currNameSpace ) )
+	{
+		xmlChar* type = xmlGetProp( cur, PARAMTYPE_ATTR );
+		
+		stringPtr = (char*) xmlGetProp( cur, NAME_ATTR );
+		columnInfo[(*numColumnsPtr)].name = StG_Strdup( stringPtr );
+		xmlFree( stringPtr );
+		columnInfo[(*numColumnsPtr)++].dictValueType = _XML_IO_Handler_GetDictValueType( self, (char*) type );
+		cur = cur->next;
+	}
+	
+	/* read any whitespace nodes */
+	while ( _XML_IO_Handler_IsOnlyWhiteSpace( (char*) xmlNodeListGetString( self->currDoc, cur, 1 ) ) ) {
+		cur = cur->next;
+	}
+	
+	/* if more columns, make a recursive call */
+	if ( (XML_ELEMENT_NODE == cur->type) &&
+		(0 == xmlStrcmp( cur->name, (const xmlChar *) COLUMN_DEFINITION_TAG ) ) &&
+		( cur->ns == self->currNameSpace ) )
+	{
+		_XML_IO_Handler_ParseColumnDefinitions( self, cur, columnInfo, numColumnsPtr );
+	}
+}
+
+
+/** parse a single ascii value, into the given ::Dictionary struct, converting to type defined in the given ::ColumnInfo.*/
+static void _XML_IO_Handler_ParseAsciiValue( char* asciiValue, ColumnInfo* columnInfo, Dictionary_Entry_Value* toDictStruct ) {
+	Dictionary_Entry_Value* newValue = Dictionary_Entry_Value_FromStringTo( asciiValue, columnInfo->dictValueType );
+	
+	Dictionary_Entry_Value_AddMember( toDictStruct, columnInfo->name, newValue );
+}
+
+
+/** get the next ascii token from the list. */
+static char* _XML_IO_Handler_GetNextAsciiToken( XML_IO_Handler* self, xmlNodePtr cur ) {
+	char* retToken;
+	
+	if (0 == self->tokeniserCalls) {
+		xmlChar* dataString = xmlNodeListGetString( self->currDoc, cur, 1 );
+		retToken = strtok( (char*) dataString, ASCII_DELIMITERS );
+	}
+	else {
+		retToken = strtok( NULL, ASCII_DELIMITERS );
+	}
+	
+	self->tokeniserCalls++;
+	return retToken;
+}
+
+
+/** parses a node containing struct info. */
+static void _XML_IO_Handler_ParseStruct( 
+	XML_IO_Handler*			self, 
+	xmlNodePtr					cur, 
+	Dictionary_Entry_Value*	parent, 
+	Dictionary_MergeType		defaultMergeType,
+	Dictionary_Entry_Source	source )
+{
+	xmlChar* name = xmlGetProp( cur, NAME_ATTR );
+	xmlChar* sourceFile = xmlGetProp( cur, SOURCEFILE_ATTR );
+	xmlChar* mergeTypeStr = xmlGetProp( cur, MERGETYPE_ATTR );
+	xmlChar* childrenMergeTypeStr = xmlGetProp( cur, CHILDRENMERGETYPE_ATTR );
+	xmlChar* spaceStrippedName = NULL;
+	xmlChar* spaceStrippedSourceFile = NULL;
+	Dictionary_Entry_Value* newStruct = NULL;
+	Dictionary_MergeType mergeType = defaultMergeType;
+	Dictionary_MergeType childrenMergeType = IO_Handler_DefaultChildrenMergeType;
+	
+	if ( name ) {
+		spaceStrippedName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, name );
+	}
+	if ( sourceFile ) {
+		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, sourceFile );
+	}
+	else if (source) {
+		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, (xmlChar*) source );
+	}
+	mergeType = _XML_IO_Handler_GetMergeType( self, mergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, defaultMergeType );
+	childrenMergeType = _XML_IO_Handler_GetMergeType( self, childrenMergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, IO_Handler_DefaultChildrenMergeType );
+
+	Journal_DPrintf( 
+		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_ParseStruct called on tag %s, with name=\"%s\"\n",
+		(char *) cur->name, 
+		spaceStrippedName );
+	
+	/* set/add the struct */
+	newStruct = IO_Handler_DictSetAddValueWithSource( 
+		self, 
+		(char*)spaceStrippedName, 
+		NULL, 
+		Dictionary_Entry_Value_Type_Struct, 
+		parent, 
+		mergeType,
+		(char*)spaceStrippedSourceFile );
+
+	if ( NULL != newStruct ) {
+		_XML_IO_Handler_ParseNodes( self, cur->xmlChildrenNode, newStruct, childrenMergeType, source );
+	}
+	
+	xmlFree( name );
+	if ( spaceStrippedName ) {
+		Memory_Free( spaceStrippedName );
+	}
+	xmlFree( sourceFile );
+	if ( spaceStrippedSourceFile ) {
+		Memory_Free( spaceStrippedSourceFile );
+	}
+}
+
+
+/** parses a single parameter node. */
+static void _XML_IO_Handler_ParseParameter( 
+	XML_IO_Handler*						self,
+	xmlNodePtr						cur,
+	Dictionary_Entry_Value*					parent,
+	Dictionary_MergeType					defaultMergeType,
+	Dictionary_Entry_Source					source )
+{
+	xmlChar* value = xmlNodeListGetString( self->currDoc, cur->xmlChildrenNode, 1 );
+	xmlChar* name = xmlGetProp( cur, NAME_ATTR );
+	xmlChar* sourceFile = xmlGetProp( cur, SOURCEFILE_ATTR );
+	xmlChar* type = xmlGetProp( cur, PARAMTYPE_ATTR );
+	xmlChar* mergeTypeStr = xmlGetProp( cur, MERGETYPE_ATTR );
+	Dictionary_Entry_Value_Type dictValueType = _XML_IO_Handler_GetDictValueType( self, (char*) type );
+	xmlChar* spaceStrippedName = NULL;
+	xmlChar* spaceStrippedSourceFile = NULL;
+	xmlChar* spaceStrippedType = NULL;
+	xmlChar* strippedVal = NULL;
+	Dictionary_MergeType mergeType = defaultMergeType;
+	
+	if ( name ) {
+		spaceStrippedName = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, name );
+	}
+
+	if ( sourceFile ) {
+		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, sourceFile );
+	}
+	else if (source) {
+		spaceStrippedSourceFile = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, (xmlChar*) source );
+	}
+
+	mergeType = _XML_IO_Handler_GetMergeType( self, mergeTypeStr, __func__, (char*)cur->name, spaceStrippedName, defaultMergeType );
+
+	if ( NULL == value ) {
+		strippedVal = Memory_Alloc_Array( xmlChar, 1, "strippedVal" );
+		sprintf( (char*)strippedVal, "%s", "" );
+	}
+	else {
+		strippedVal = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, value );
+	}
+	
+	if( type ) {
+		spaceStrippedType = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, type );
+	}
+
+	Journal_DPrintf( 
+		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_ParseParameter called on tag %s, with name=\"%s\", value=\"%s\"\n", 
+		(char *) cur->name, 
+		spaceStrippedName, 
+		strippedVal );
+	
+	
+	/*
+	** Check the type and perform actions
+	*/
+	
+	if( spaceStrippedType ) {
+		/* TODO: move "path" to a constant */
+		if( strcmp( (char*)spaceStrippedType, "path" ) == 0 ) {
+			/* prefix the current path to 'val' */
+			unsigned	size;
+			xmlChar*	newVal;
+			unsigned	pos = 0;
+			
+			size = strlen( (char*)strippedVal ) + 1;
+			if( self->currPath ) {
+				size += strlen( self->currPath );
+				if(
+					self->currPath[0] != '/' && 
+					self->currPath[0] != '~' && 
+					self->currPath[0] != '.' &&
+					strstr( self->currPath, "file:" ) == NULL &&
+					strstr( self->currPath, "http:" ) == NULL &&
+					strstr( self->currPath, "ftp:" ) == NULL )
+				{
+					
+					size += 2;
+				}
+			}
+			
+			newVal = Memory_Alloc_Array( xmlChar, size, "XML_IO_Handler_ParseParameter->newVal" );
+			if( self->currPath ) {
+				if(
+					self->currPath[0] != '/' && 
+					self->currPath[0] != '~' && 
+					self->currPath[0] != '.' &&
+					strstr( self->currPath, "file:" ) == NULL &&
+					strstr( self->currPath, "http:" ) == NULL &&
+					strstr( self->currPath, "ftp:" ) == NULL )
+				{
+					newVal[0] = '.';
+					newVal[1] = '/';
+					pos += 2;
+				}
+				
+				strcpy( (char*)&newVal[pos], (char*)self->currPath );
+				pos += strlen( self->currPath );
+			}
+			
+			strcpy( (char*)&newVal[pos], (char*)strippedVal );
+			Memory_Free( strippedVal );
+			strippedVal = newVal;
+		}
+	}
+	
+	IO_Handler_DictSetAddValueWithSource( 
+				self, 
+				(char*)spaceStrippedName, 
+				(char*)strippedVal, 
+				dictValueType, 
+				parent, 
+				mergeType, 
+				(char*)spaceStrippedSourceFile );
+	
+	xmlFree( name );
+	if ( spaceStrippedName ) {
+		Memory_Free( spaceStrippedName );
+	}
+	xmlFree( value );
+	Memory_Free( strippedVal );
+	xmlFree( sourceFile );
+	if ( spaceStrippedSourceFile ) {
+		Memory_Free( spaceStrippedSourceFile );
+	}
+	
+	if( type ) {
+		xmlFree( type );
+	}
+	if( spaceStrippedType ) {
+		Memory_Free( spaceStrippedType );
+	}
+}
+
+
+/** utility function to get the dictionary type, given a type definition attribute from the xml file.
+ * TODO: use a hash table? */
+Dictionary_Entry_Value_Type _XML_IO_Handler_GetDictValueType( XML_IO_Handler* self, char* type )
+{
+	if (NULL == type)
+	{
+		return Dictionary_Entry_Value_Type_String;
+	}
+	else {
+		Dictionary_Entry_Value_Type* result;
+		
+		/* convert to lower case. put in string library one day if we make one or use one */
+		char* lowercaseType = StG_Strdup( type );
+		char* ptr = lowercaseType;
+		for ( ; *ptr != '\0'; ++ptr ) {
+			*ptr = tolower( *ptr );
+		}
+	
+		result = (Dictionary_Entry_Value_Type*)Stg_ObjectList_Get( self->typeKeywords, lowercaseType );
+		Memory_Free( lowercaseType );
+		
+		if ( result == NULL ) {
+			/* if unknown type, return string */
+			return Dictionary_Entry_Value_Type_String;
+		}
+		return *result;
+	}
+}
+
+
+/** utility function to strip leading and trailing whitespace */
+static xmlChar* _XML_IO_Handler_StripLeadingTrailingWhiteSpace( XML_IO_Handler* self, const xmlChar* const value ) {
+	
+	assert( value );
+	
+	if ( '\0' == (*value) ) {
+		return (xmlChar*)StG_Strdup( (char*)value );
+	}
+	else {
+		Name startCharPtr = (const char*)value;
+		Name endCharPtr = (const char*)value + strlen( (char*)value );
+		xmlChar* newString = NULL;
+		size_t newLength = 0;
+		
+		while ( isspace( (char) *startCharPtr ) && (startCharPtr < endCharPtr) ) {
+			startCharPtr++;
+		}
+		
+		if ( startCharPtr == endCharPtr ) {
+			xmlChar* ret = Memory_Alloc_Array( xmlChar, 1, "ret" );
+			*ret = '\0'; /* empty string */
+			return ret;
+		}
+		
+		while ( isspace( (char) *(endCharPtr-1) ) && (endCharPtr > startCharPtr) ) {
+			endCharPtr--;
+		}
+		
+		newLength = endCharPtr - startCharPtr;
+		assert( newLength > 0 );
+		
+		if ( !(newString = Memory_Alloc_Array_Unnamed( xmlChar, newLength + 1 ) ) ) {
+			Journal_Printf( 
+				Journal_Register( Error_Type, XML_IO_Handler_Type ), 
+				"Error - while parsing file %s: out of memory. exiting.\n", 
+				self->resource );
+			exit( EXIT_FAILURE );
+		}
+                {
+                  Index i;
+                  for(i=0;i<newLength;++i)
+                    newString[i]=startCharPtr[i];
+                  newString[newLength]='\0';
+                }
+		
+		return newString;
+	}
+}
+
+
+/** utility function to check if a string is purely whitespace */
+Bool _XML_IO_Handler_IsOnlyWhiteSpace( char* string ) {
+	/* a reasonable maximum so the function doesn't run for ever */
+	const int MAX_WHITESPACE = 100;
+	int charIndex = 0;
+	if ( !string ) return False;
+	
+	for (; (string[charIndex] != '\0') && charIndex < MAX_WHITESPACE; charIndex++ ) {
+		if ( !isspace( string[charIndex] ) ) return False;
+	}
+	
+	return True;
+}
+
+
+/** Write all the entries in a ::Dictionary to an XML file. The functions XML_IO_Handler_SetListEncoding(),
+ * XML_IO_Handler_SetWriteExplicitTypes(), and XML_IO_Handler_SetWritingPrecision() can be used to customise the output.
+ * see also IO_Handler_WriteAllToFile().
+ * \return True on successful write, false otherwise.
+ */
+Bool _XML_IO_Handler_WriteAllToFile( void* xml_io_handler, Name filename, Dictionary* dictionary ) {
+	
+	/* create/overwrite new document */
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	xmlNodePtr rootNode;
+	int fileSize = -1;
+	char* correctNameSpace;
+	NameSpaceInfo* currNsInfo = self->nameSpacesList;
+	int correctLength = ( strlen(currNsInfo->location) + strlen(currNsInfo->version) ) + 1; 
+	Stream* stream = Journal_Register( Info_Type, XML_IO_Handler_Type );
+	
+	Journal_Printf(
+		Journal_Register( Info_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_WriteAllToFile called to write to file %s.\n", 
+		filename );
+#if DEBUG
+	assert( self );
+	assert( filename );
+	assert( dictionary );
+#endif
+	
+	/* if overwrite/new */
+	self->currDoc = xmlNewDoc( XML_VERSION );
+	assert( self->currDoc );
+	/* create root element */
+	rootNode = xmlNewNode( NULL, ROOT_NODE_NAME);
+	assert( rootNode );
+	
+	if ( !(correctNameSpace = Memory_Alloc_Array( char, correctLength, "courrectNameSpace" )) ) {
+		Journal_Printf( 
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Error: couldn't allocate memory for namespace.\n" );
+		return False;
+	}
+	strcpy( correctNameSpace, currNsInfo->location );
+	strcat( correctNameSpace, currNsInfo->version );
+	self->currNameSpace = xmlNewNs( rootNode, (xmlChar*) correctNameSpace, NULL );
+	assert( self->currNameSpace );
+	xmlSetNs( rootNode, self->currNameSpace );
+	
+	xmlDocSetRootElement( self->currDoc, rootNode );
+	/* TODO else parse in filename as currDoc, if update set */
+	
+	_XML_IO_Handler_WriteDictionary( self, dictionary, rootNode );
+	
+	/* write result to file */
+	if ( 0 < (fileSize = xmlSaveFormatFile( filename, self->currDoc, 1 )) ) {
+		Journal_Printf( stream, "Writing dictionary contents to file %s successfully concluded.\n", filename );
+	} else
+	{
+		Journal_Printf( 
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			 "Warning: failed to write dictionary contents to file %s.\n", 
+			 filename );
+	}
+	
+	/* Memory_Free memory */
+	if( self->currDoc )
+		xmlFreeDoc( self->currDoc );
+	/*xmlCleanupParser(); */
+	/* TODO if updating, xmlCleanupParser(); */
+	self->currDoc = NULL;
+	self->currNameSpace = NULL;
+	Memory_Free( correctNameSpace );
+	
+	return ( fileSize > 0 ) ? True : False;
+}
+
+
+/** write a single dictionary entry to a file. The dictionary entry needs to be supplied as a name and value.
+ * \return True on success, False otherwise. */
+Bool XML_IO_Handler_WriteEntryToFile( void* xml_io_handler, Name filename,
+	Dictionary_Entry_Key name, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
+{
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	
+	assert( self );
+	return self->_writeEntryToFile( xml_io_handler, filename, name, value, source );
+}
+
+
+
+Bool _XML_IO_Handler_WriteEntryToFile( void* xml_io_handler, Name filename,
+	Dictionary_Entry_Key name, Dictionary_Entry_Value* value, Dictionary_Entry_Source source )
+{
+	Stream* stream = Journal_Register (Info_Type, XML_IO_Handler_Type );
+	/* create/overwrite new document */
+	XML_IO_Handler* self = (XML_IO_Handler*) xml_io_handler;
+	xmlNodePtr rootNode;
+	int fileSize = -1;
+	char* correctNameSpace;
+	NameSpaceInfo* currNsInfo = self->nameSpacesList;
+	int correctLength = ( strlen(currNsInfo->location) + strlen(currNsInfo->version) ) + 1;
+	
+#if DEBUG
+	assert( self );
+	assert( filename );
+	assert( name );
+	assert( value );
+	/*Do not assert source -> it may well be NULL.*/
+#endif
+	Journal_Printf(stream, "_XML_IO_Handler_WriteEntryToFile called to write dictionary entry %s to file %s.\n", name, filename ); 
+	/* if overwrite/new */
+	self->currDoc = xmlNewDoc( XML_VERSION );
+	assert( self->currDoc );
+	/* create root element */
+	rootNode = xmlNewNode( NULL, ROOT_NODE_NAME);
+	assert( rootNode );
+	
+	if ( !(correctNameSpace = Memory_Alloc_Array( char, correctLength, "correctNameSpace" )) ) {
+		Journal_Printf(
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Error: couldn't allocate memory for namespace.\n" );
+		return False;
+	}
+	strcpy( correctNameSpace, currNsInfo->location );
+	strcat( correctNameSpace, currNsInfo->version );
+	self->currNameSpace = xmlNewNs( rootNode, (xmlChar*) correctNameSpace, NULL );
+	assert( self->currNameSpace );
+	xmlSetNs( rootNode, self->currNameSpace );
+	
+	xmlDocSetRootElement( self->currDoc, rootNode );
+	/* TODO else parse in filename as currDoc, if update set */
+	
+	_XML_IO_Handler_WriteNode( self, name, value, source, rootNode );
+	
+	/* write result to file */
+	if ( 0 < (fileSize = xmlSaveFormatFile( filename, self->currDoc, 1 )) ) {
+		Journal_Printf( stream, "Writing dictionary entry %s to file %s successfully concluded.\n", name, filename );
+	}
+	else {
+		Journal_Printf( 
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Warning: failed to write dictionary entry %s to file %s.\n", 
+			name, 
+			filename );
+	}
+	if( self->currDoc )	
+		xmlFreeDoc( self->currDoc );
+	/*xmlCleanupParser();*/
+	/* TODO if updating, xmlCleanupParser(); */
+	self->currDoc = NULL;
+	self->currNameSpace = NULL;
+	Memory_Free( correctNameSpace );
+	
+	return ( fileSize > 0 ) ? True : False;
+}
+
+
+/** Write the contents of a dictionary to a file. Note this can be used for writing #Dictionary_Entry_Value_AsStruct
+ * values. */
+static void _XML_IO_Handler_WriteDictionary( XML_IO_Handler* self, Dictionary* dict, xmlNodePtr parent ) {
+	Dictionary_Index index = 0;
+
+	Journal_DPrintf( 
+		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_WriteDictionary called.\n" );
+	
+	// find the plugins tag, and write it first	
+	for (index=0; index < dict->count; index++) {
+		Dictionary_Entry* currEntryPtr = dict->entryPtr[index];
+	
+		if ( strcmp(currEntryPtr->key, (Name)IMPORT_TAG) == 0 ) 
+			_XML_IO_Handler_WriteNode( self, currEntryPtr->key, currEntryPtr->value, currEntryPtr->source, parent );
+	}
+
+	// find the plugins tag, and write it first	
+	for (index=0; index < dict->count; index++) {
+		Dictionary_Entry* currEntryPtr = dict->entryPtr[index];
+	
+		if ( strcmp(currEntryPtr->key, (Name)PLUGINS_TAG) == 0 ) 
+			_XML_IO_Handler_WriteNode( self, currEntryPtr->key, currEntryPtr->value, currEntryPtr->source, parent );
+	}
+
+	// creates the rest of dictionary
+	for (index=0; index < dict->count; index++) {
+		Dictionary_Entry* currEntryPtr = dict->entryPtr[index];
+	
+		if ( ( strcmp(currEntryPtr->key, (Name)IMPORT_TAG) != 0 )  && ( strcmp(currEntryPtr->key, (const char*)PLUGINS_TAG) != 0 ) )  
+			_XML_IO_Handler_WriteNode( self, currEntryPtr->key, currEntryPtr->value, currEntryPtr->source, parent );
+	}
+}
+
+/** write a single node to file, and its children. */
+static void _XML_IO_Handler_WriteNode( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* value, 
+					Name source, xmlNodePtr parent)
+
+{
+	switch ( value->type ) {
+		case Dictionary_Entry_Value_Type_Struct:
+			_XML_IO_Handler_WriteStruct( self, name, value, source, parent );
+			break;
+		case Dictionary_Entry_Value_Type_List:
+			_XML_IO_Handler_WriteList( self, name, value, source, parent );
+			break;
+		default:
+			_XML_IO_Handler_WriteParameter( self, name, value, source, parent );
+	}
+}
+
+
+/** write a list and its children to a file. Depending on the encoding set by either XML_IO_Handler_SetListEncoding(),
+ * or stored on the list dictionary entry value itself, will  write out as XML, ascii or binary.*/
+static void _XML_IO_Handler_WriteList( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* list,
+					Name source, xmlNodePtr parent)
+{
+	xmlNodePtr newNode;
+	xmlChar* type= (xmlChar*) "list";
+
+	Journal_DPrintf( Journal_Register( Debug_Type, XML_IO_Handler_Type ), "_XML_IO_Handler_WriteList called.\n" );
+
+	/* create and add list child node */
+	if ( NULL != name ) {
+		if ( strcmp(name, (Name)PLUGINS_TAG) == 0 ) {
+			newNode = xmlNewTextChild( parent, self->currNameSpace, PLUGINS_TAG, NULL );
+		}
+		else if ( strcmp(name, (Name)IMPORT_TAG) == 0 ) {
+			newNode = xmlNewTextChild( parent, self->currNameSpace, IMPORT_TAG, NULL );
+		}
+		else
+		{
+			//newNode = xmlNewTextChild( parent, self->currNameSpace, LIST_ATTR, NULL );
+			newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
+			xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
+			if ( NULL != name ) {
+				xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
+			}
+		}
+	}	
+    else {
+		newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
+		xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
+    }
+	if ( NULL != source ) {
+		xmlNewProp( newNode, (xmlChar*) SOURCEFILE_ATTR, (xmlChar*) source );
+	}	
+	
+	/* write list elements*/
+	switch (self->listEncoding) {
+		case PerList:
+			switch (Dictionary_Entry_Value_GetEncoding( list )) {
+				case Default:
+					_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
+					break;
+				
+				case RawASCII:
+					_XML_IO_Handler_WriteListElementsRawASCII( self, list, newNode );
+					break;
+				
+				case RawBinary:
+					_XML_IO_Handler_WriteListElementsRawBinary( self, list, newNode );
+					break;
+				
+				default:
+					Journal_Printf( 
+						Journal_Register( Error_Type, XML_IO_Handler_Type ),
+						"Warning - while writing file %s: list %s in dictionary specifies "
+						"unknown encoding format. Writing as XML.\n", 
+						self->resource, 
+						name );
+					_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
+			}
+			break;
+		
+		case AllXML:
+			_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
+			break;
+		
+		case AllRawASCII:
+			if ( True == _XML_IO_Handler_CheckListCanBePrintedRaw( list ) ) {
+				_XML_IO_Handler_WriteListElementsRawASCII( self, list, newNode );
+			}
+			else {
+				_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
+			}
+			break;
+		
+		case AllRawBinary:
+			if ( True == _XML_IO_Handler_CheckListCanBePrintedRaw( list ) ) {
+				_XML_IO_Handler_WriteListElementsRawBinary( self, list, newNode );
+			}	
+			else {
+				_XML_IO_Handler_WriteListElementsXML( self, list, newNode );
+			}
+			break;
+		
+		default:
+			assert(0);
+	}
+}
+
+
+/** write the list elements to a file as XML. */
+static void _XML_IO_Handler_WriteListElementsXML( XML_IO_Handler* self, Dictionary_Entry_Value* list,
+	xmlNodePtr listNode )
+{
+	Dictionary_Entry_Value* currChildValue = Dictionary_Entry_Value_GetFirstElement( list );
+	
+	while ( NULL != currChildValue ) {
+		_XML_IO_Handler_WriteNode( self, NULL, currChildValue, NULL, listNode );
+		currChildValue = currChildValue->next; 
+	}
+}
+
+
+/** Checks if a lsit can be printed in raw (ascii or binary) format. Raw data lists should only contain structs,
+ * where each member is a 'simple' type (i.e. not a struct or list) */
+static Bool _XML_IO_Handler_CheckListCanBePrintedRaw( Dictionary_Entry_Value* list ) {
+	Dictionary_Entry_Value* firstElement = Dictionary_Entry_Value_GetFirstElement( list );
+	
+	if ( Dictionary_Entry_Value_Type_Struct != firstElement->type ) {
+		return False;
+	}
+	else {
+		Dictionary_Index i;
+		for (i=0; i < firstElement->as.typeStruct->count; i++)
+		{
+			int type = firstElement->as.typeStruct->entryPtr[i]->value->type;
+			if ( (Dictionary_Entry_Value_Type_Struct == type) || (Dictionary_Entry_Value_Type_List == type) )
+			{
+				return False;
+			}
+		}
+		
+		return True;
+	}
+}
+
+
+/** write the elements of a list from a dictionary value to raw ASCII. */
+static void _XML_IO_Handler_WriteListElementsRawASCII( XML_IO_Handler* self, Dictionary_Entry_Value* list, xmlNodePtr listNode ) {
+	Dictionary_Entry_Value* currMemberValue;
+	Dictionary_Entry_Value* currChildStruct;
+	xmlBufferPtr bufferPtr;
+	char* charBuffer = Memory_Alloc_Array_Unnamed( char, ASCII_LIST_STRING_BUFFER_SIZE );
+	unsigned int writtenElementSize;
+	xmlNodePtr rawDataNode;
+	Index i;
+	
+	/* check contents suitable for raw printing, error if not. */
+	if ( False == _XML_IO_Handler_CheckListCanBePrintedRaw( list ) )
+	{
+		Journal_Printf(
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Warning- while writing file %s: _XML_IO_Handler_WriteListElementsRaw called on "
+			"list %s not suited for Raw writing. Printing as plain XML instead.\n", 
+			self->resource,
+			xmlGetProp( listNode, NAME_ATTR ) );
+		_XML_IO_Handler_WriteListElementsXML( self, list, listNode );
+		return;
+	}
+	
+	/* create and add raw data child node from buffer */
+	rawDataNode = xmlNewTextChild( listNode, self->currNameSpace, ASCII_DATA_TAG, NULL );
+	
+	currChildStruct = Dictionary_Entry_Value_GetFirstElement( list );	
+	
+	/* allocate the memory buffer */
+	writtenElementSize = _XML_IO_Handler_GetWrittenElementSize( self, currChildStruct );
+	if ( NULL == (bufferPtr = xmlBufferCreateSize( writtenElementSize ) ) )
+	{
+		Journal_Printf( 
+			Journal_Register( Error_Type, XML_IO_Handler_Type ),
+			"Error- while writing file %s: out of memory allocating raw data buffer. "
+			"Returning.\n", 
+			self->resource );
+		return;
+	}
+	
+	xmlNodeAddContentLen( rawDataNode, (xmlChar*) "\n", 1 ); 
+	
+	/* write the column definition tags */
+	for (i=0; i < Dictionary_Entry_Value_GetCount( currChildStruct ); i++) {
+		xmlNodePtr currColumnDefNode;
+		Name typeString = self->TYPE_KEYWORDS[ (int) currChildStruct->as.typeStruct->entryPtr[i]->value->type ];
+		
+		xmlNodeAddContentLen( rawDataNode, (xmlChar*) "\n", 1 ); 
+		currColumnDefNode = xmlNewTextChild( rawDataNode, self->currNameSpace, COLUMN_DEFINITION_TAG, NULL );
+		xmlNewProp( currColumnDefNode, NAME_ATTR, (xmlChar*) currChildStruct->as.typeStruct->entryPtr[i]->key );
+		xmlNewProp( currColumnDefNode, PARAMTYPE_ATTR, (xmlChar*) typeString );
+	}
+	
+	/* will cause trouble if func generalised for binary */
+	xmlBufferWriteChar( bufferPtr, "\n\n" );
+	
+	/* write element contents to buffer, then node */
+	while ( NULL != currChildStruct ) {
+		/* print the elements into the buffer */
+		for (i=0; i < currChildStruct->as.typeStruct->count; i++) {
+			if ( (currMemberValue = currChildStruct->as.typeStruct->entryPtr[i]->value) )
+			{
+				_XML_IO_Handler_WriteMemberAscii( self, currMemberValue, charBuffer );
+				xmlBufferWriteChar( bufferPtr, charBuffer );
+			}
+		}
+		
+		/* will cause trouble if func generalised for binary */
+		xmlBufferWriteChar( bufferPtr, "\n" );
+		
+		xmlNodeAddContentLen( rawDataNode, xmlBufferContent( bufferPtr ), xmlBufferLength( bufferPtr ) ); 
+		xmlBufferEmpty( bufferPtr );
+		currChildStruct = currChildStruct->next; 
+	}
+	
+	/* will cause trouble if func generalised for binary */
+	xmlNodeAddContentLen( rawDataNode, (xmlChar*) "\n", 1 ); 
+	xmlBufferFree( bufferPtr );
+	Memory_Free( charBuffer );
+}
+
+
+/** calculates how big a text buffer needs to be created to hold the data from a dictionary list entry as raw ascii. */
+static unsigned int _XML_IO_Handler_GetWrittenElementSize( XML_IO_Handler* self, Dictionary_Entry_Value* listElement ) {
+	unsigned int i;	
+	int totalChars = 0; 
+	
+	for ( i=0; i < Dictionary_Entry_Value_GetCount( listElement ); i++ )
+	{
+		totalChars += self->writingFieldWidth[ (int) listElement->as.typeStruct->entryPtr[i]->value->type ];
+	}
+	
+	totalChars++;	/* for the newline character */	
+	
+	return totalChars;
+}
+
+
+/** writes a signle member data element. NOTE: would have been nice just to use Dictionary_Entry_Value_Print(), but
+ * then wouldn't have been able to use custom formatting. */
+static void _XML_IO_Handler_WriteMemberAscii( XML_IO_Handler* self, Dictionary_Entry_Value* member, char* buffer ) {
+	unsigned int fw = self->writingFieldWidth[ (int) member->type ];
+	unsigned int precision = self->writingPrecision[ (int) member->type ];
+	char*        string = NULL;
+	Stream*      errorStr = NULL;
+	
+	switch (member->type) {
+		case Dictionary_Entry_Value_Type_String:
+			string = Dictionary_Entry_Value_AsString( member );
+			errorStr = Journal_Register( Error_Type, self->type );
+			Journal_Firewall( ( strlen(string) + 1 < ASCII_LIST_STRING_BUFFER_SIZE ), errorStr,
+				"Error- in %s: asked to write out a string of length %d, but this "
+				"is greater than the max string buffer length of %d. Exiting.\n",
+				__func__, strlen(string), ASCII_LIST_STRING_BUFFER_SIZE );
+			sprintf(buffer, "%*s ", fw, Dictionary_Entry_Value_AsString( member ) );
+			break;
+		
+		case Dictionary_Entry_Value_Type_Double:
+			sprintf(buffer, "%*.*g", fw, precision, Dictionary_Entry_Value_AsDouble( member ) );	
+			break;
+		
+		case Dictionary_Entry_Value_Type_UnsignedInt:
+			sprintf(buffer, "%*.*g", fw, precision, Dictionary_Entry_Value_AsDouble( member ) );	
+			break;
+		
+		case Dictionary_Entry_Value_Type_Int:
+			sprintf(buffer, "%*.*g", fw, precision, Dictionary_Entry_Value_AsDouble( member ) );	
+			break;
+		
+		case Dictionary_Entry_Value_Type_Bool:
+			sprintf(buffer, "%*.*s", fw, precision, Dictionary_Entry_Value_AsString( member ) );	
+			break;
+		
+		default:
+			Journal_Printf( 
+				Journal_Register( Error_Type, XML_IO_Handler_Type ),
+				"Warning- while writing to file %s: unknown type of Dictionary_Entry_Value. "
+				"Outputting as a string.\n", 
+				self->resource );
+			errorStr = Journal_Register( Error_Type, self->type );
+			Journal_Firewall( ( strlen(string) + 1 < ASCII_LIST_STRING_BUFFER_SIZE ), errorStr,
+				"Error- in %s: asked to write out a string of length %d, but this "
+				"is greater than the max string buffer length of %d. Exiting.\n",
+				__func__, strlen(string), ASCII_LIST_STRING_BUFFER_SIZE );
+			sprintf(buffer, "%*.*s ", self->writingFieldWidth[Dictionary_Entry_Value_Type_String],
+				self->writingPrecision[Dictionary_Entry_Value_Type_String],
+				Dictionary_Entry_Value_AsString( member ) );
+			break;
+	}
+}
+
+
+/** TODO: write the lsit elements as raw binary. */
+static void _XML_IO_Handler_WriteListElementsRawBinary( XML_IO_Handler* self, Dictionary_Entry_Value* list, xmlNodePtr listNode ) {
+	Journal_Printf( 
+		Journal_Register( Info_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_WriteListElementsRawBinary stub called." );
+}
+
+
+/** writes a struct dictionary entry to the file */
+static void _XML_IO_Handler_WriteStruct( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* value, 
+						Name source, xmlNodePtr parent)
+{	
+	xmlNodePtr newNode;
+	xmlChar* type= (xmlChar*) "struct";
+
+	Journal_DPrintf( 
+		Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+		"_XML_IO_Handler_WriteStruct called.\n" );
+
+	/* create and add struct child node*/
+	if ( NULL != name ) {
+		if ( strcmp(name, (Name)COMPONENTS_TAG) == 0 ) {
+			newNode = xmlNewTextChild( parent, self->currNameSpace, COMPONENTS_TAG, NULL );
+		}
+		else
+		{
+			//newNode = xmlNewTextChild( parent, self->currNameSpace, STRUCT_ATTR, NULL );
+			newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
+			xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
+			xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
+		}
+	}
+	else
+	{
+		newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, NULL );
+		xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
+		if ( NULL != name ) 
+			xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
+	}
+	if ( NULL != source ) {
+		xmlNewProp( newNode, (xmlChar*) SOURCEFILE_ATTR, (xmlChar*) source );
+	}
+	
+	_XML_IO_Handler_WriteDictionary( self, value->as.typeStruct, newNode ); 
+}
+
+
+/** writes a single dictionary parameter to file. */
+static void _XML_IO_Handler_WriteParameter( XML_IO_Handler* self, Name name, Dictionary_Entry_Value* value,
+						Name source, xmlNodePtr parent)
+{
+	xmlNodePtr newNode;
+	xmlChar* type = (xmlChar*) "param";
+
+
+	Journal_DPrintfL( 
+		Journal_Register( Info_Type, XML_IO_Handler_Type ), 2,
+		"_XML_IO_Handler_WriteParameter called.\n");
+
+	/* add new child to parent, with correct value*/
+	if ( strcmp((char *)parent->name, (Name)PLUGINS_TAG) == 0 ) {
+		newNode = xmlNewTextChild( parent, self->currNameSpace, PLUGIN_TAG, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
+	}
+	else if ( strcmp((char *)parent->name, (Name)IMPORT_TAG) == 0 ) {
+		newNode = xmlNewTextChild( parent, self->currNameSpace, TOOLBOX_TAG, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
+	}
+	else {
+		//newNode = xmlNewTextChild( parent, self->currNameSpace, PARAM_ATTR, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
+		newNode = xmlNewTextChild( parent, self->currNameSpace, ELEMENT_TAG, (xmlChar*) Dictionary_Entry_Value_AsString( value ) );
+		xmlNewProp( newNode, (xmlChar*) TYPE_ATTR, (xmlChar*) type );
+	}
+	if ( NULL != name ) {
+		xmlNewProp( newNode, (xmlChar*) NAME_ATTR, (xmlChar*) name );
+	}
+	if ( NULL != source ) {
+		xmlNewProp( newNode, (xmlChar*) SOURCEFILE_ATTR, (xmlChar*) source );
+	}
+	
+	if ( True == self->writeExplicitTypes )
+	{
+		xmlNewProp( newNode, PARAMTYPE_ATTR, (xmlChar*) self->TYPE_KEYWORDS[(int) value->type] );
+	}
+}
+
+static Dictionary_MergeType _XML_IO_Handler_GetMergeType( XML_IO_Handler* self, const xmlChar* mergeTypeStr, 
+		Name funcName, const char* tagStr, xmlChar* entryName, Dictionary_MergeType defaultMergeType )
+{
+	Dictionary_MergeType         mergeType = defaultMergeType;
+	xmlChar*                     spaceStrippedMergeType = NULL;
+
+	if( mergeTypeStr ) {
+		spaceStrippedMergeType = _XML_IO_Handler_StripLeadingTrailingWhiteSpace( self, mergeTypeStr );
+		if( !xmlStrcmp( spaceStrippedMergeType, APPEND_TAG ) ) {
+			mergeType = Dictionary_MergeType_Append;
+		}
+		else if( !xmlStrcmp( spaceStrippedMergeType, MERGE_TAG ) ) {
+			mergeType = Dictionary_MergeType_Merge;
+		}
+		else if( !xmlStrcmp( spaceStrippedMergeType, REPLACE_TAG ) ) {
+			mergeType = Dictionary_MergeType_Replace;
+		}
+		else {
+			Journal_DPrintf( 
+				Journal_Register( Debug_Type, XML_IO_Handler_Type ),
+				"%s() called on tag %s, with name=\"%s\", and mergeType \"%s\" unknown "
+				"reverting to \"%s\".\n", 
+				__func__,
+				tagStr, 
+				entryName,
+				spaceStrippedMergeType,
+				XML_IO_Handler_MergeTypeMap[defaultMergeType] );
+			mergeType = defaultMergeType;
+		}
+    Memory_Free( spaceStrippedMergeType );
+	}
+	else {
+		mergeType = defaultMergeType;
+	}
+
+	return mergeType;
+}
+
+
+void XML_IO_Handler_LibXMLErrorHandler( void* ctx, Name msg, ... ) {
+   va_list ap;
+   va_start( ap, msg );
+   Stream_Printf( Journal_Register( Error_Type, XML_IO_Handler_Type ), msg, ap );
+   va_end(ap);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/shortcuts.c
--- a/Base/IO/src/shortcuts.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: shortcuts.c 3669 2006-07-07 02:52:03Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Dictionary.h"
-#include "Dictionary_Entry_Value.h"
-#include "Dictionary_Entry.h"
-#include "JournalFile.h"
-#include "Stream.h"
-#include "Journal.h"
-
-
-int Dictionary_GetUnsignedInt_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const unsigned int defaultVal ) {
-	return	Dictionary_Entry_Value_AsUnsignedInt( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromUnsignedInt( defaultVal ) ) );
-}
-
-int Dictionary_GetInt_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const int defaultVal ) {
-	return	Dictionary_Entry_Value_AsInt( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromInt( defaultVal ) ) );
-}
-
-double Dictionary_GetDouble_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const double defaultVal ) {
-	return	Dictionary_Entry_Value_AsDouble( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromDouble( defaultVal ) ) );
-}
-
-unsigned long Dictionary_GetUnsignedLong_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const unsigned long defaultVal ) {
-	return	Dictionary_Entry_Value_AsUnsignedLong( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromUnsignedLong( defaultVal ) ) );
-}
-
-float Dictionary_GetFloat_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const float defaultVal ) {
-	return	(float) Dictionary_Entry_Value_AsDouble( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromDouble( (double)defaultVal ) ) );
-}
-
-
-Bool Dictionary_GetBool_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const Bool defaultVal ) {
-	return	Dictionary_Entry_Value_AsBool( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromBool( defaultVal ) ) );
-}
-
-char* Dictionary_GetString_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, Name const defaultVal ) {
-	return	Dictionary_Entry_Value_AsString( 
-		Dictionary_GetDefault( dictionary, key, 
-		Dictionary_Entry_Value_FromString( defaultVal ) ) );
-}
-
-char* Dictionary_GetString_WithPrintfDefault( Dictionary* dictionary, Dictionary_Entry_Key key, Name format, ... ) {
-	char*     returnString;
-	char*     defaultVal;
-	va_list   ap;
-	
-	va_start( ap, format );
-
-	/* Create Default String from format arguments */
-	Stg_vasprintf( &defaultVal, format, ap );
-
-	/* Read Dictionary */
-	returnString = Dictionary_GetString_WithDefault( dictionary, key, defaultVal );
-
-	/* Clean up */
-	Memory_Free( defaultVal );
-	va_end( ap );
-
-	return returnString;
-}
-Bool Stream_RedirectFile_WithPrependedPath( Stream* stream, Name prependedPath, const char* filename ) {
-	Bool result;
-
-	/* Check to make sure output path is emtpy */ 
-	if ( Stg_StringIsEmpty( prependedPath ) )
-		result = Stream_RedirectFile( stream, filename );
-	else {
-		char* prependedFilename;
-
-		Stg_asprintf( &prependedFilename, "%s/%s", prependedPath, filename );
-		result = Stream_RedirectFile( stream, prependedFilename );
-		Memory_Free( prependedFilename );
-	}
-
-	return result;
-}
-Bool Stream_AppendFile_WithPrependedPath( Stream* stream, Name prependedPath, const char* filename ) {
-	Bool result;
-
-	/* Check to make sure output path is emtpy */ 
-	if ( Stg_StringIsEmpty( prependedPath ) )
-		result = Stream_AppendFile( stream, filename );
-	else {
-		char* prependedFilename;
-
-		Stg_asprintf( &prependedFilename, "%s/%s", prependedPath, filename );
-		result = Stream_AppendFile( stream, prependedFilename );
-		Memory_Free( prependedFilename );
-	}
-
-	return result;
-}
-void Journal_PrintString_WithLength( Stream* stream, Name string, int length ) {
-	size_t      stringLength = strlen( string ) ;
-	Name       breakInMiddle = "...";
-	size_t      lengthOfBreak = strlen( breakInMiddle );
-
-	if ( length <= 0 )
-		return;
-	/* If length given is exeedingly short - then print initial */
-	else if ( lengthOfBreak >= (unsigned)length ) {
-		Journal_Printf( stream, "%c", string[0] );
-		Journal_Write( stream, breakInMiddle, sizeof( char ), length - 1 );
-	}
-	/* Shorten String if nessesary */
-	else if ( stringLength > (unsigned)length ) {
-		int charsBeforeBreak = (int) ((float)length * 0.5) - 1;
-		int charsAfterBreak  = length - charsBeforeBreak - lengthOfBreak;
-
-		/* Print first half of string */
-		Journal_Write( stream, string, sizeof( char ), charsBeforeBreak );
-
-		/* Print '...' In middle */
-		Journal_Printf( stream, breakInMiddle );
-
-		/* Print end of string */
-		Journal_Write( stream, &string[ stringLength - charsAfterBreak ], sizeof( char ), charsAfterBreak );
-		return;
-	}
-	else {
-		Index       char_I;
-
-		/* If string is shorter than allowed length - then add empty space */
-		for ( char_I = 0 ; char_I < length - stringLength ; char_I++ )
-			Journal_Printf( stream, " " );
-		
-		/* Print the complete string */
-		Journal_Printf( stream, string );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/shortcuts.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/shortcuts.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,181 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: shortcuts.c 3669 2006-07-07 02:52:03Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Dictionary.h"
+#include "Dictionary_Entry_Value.h"
+#include "Dictionary_Entry.h"
+#include "JournalFile.h"
+#include "Stream.h"
+#include "Journal.h"
+
+
+int Dictionary_GetUnsignedInt_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const unsigned int defaultVal ) {
+	return	Dictionary_Entry_Value_AsUnsignedInt( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromUnsignedInt( defaultVal ) ) );
+}
+
+int Dictionary_GetInt_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const int defaultVal ) {
+	return	Dictionary_Entry_Value_AsInt( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromInt( defaultVal ) ) );
+}
+
+double Dictionary_GetDouble_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const double defaultVal ) {
+	return	Dictionary_Entry_Value_AsDouble( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromDouble( defaultVal ) ) );
+}
+
+unsigned long Dictionary_GetUnsignedLong_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const unsigned long defaultVal ) {
+	return	Dictionary_Entry_Value_AsUnsignedLong( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromUnsignedLong( defaultVal ) ) );
+}
+
+float Dictionary_GetFloat_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const float defaultVal ) {
+	return	(float) Dictionary_Entry_Value_AsDouble( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromDouble( (double)defaultVal ) ) );
+}
+
+
+Bool Dictionary_GetBool_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, const Bool defaultVal ) {
+	return	Dictionary_Entry_Value_AsBool( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromBool( defaultVal ) ) );
+}
+
+char* Dictionary_GetString_WithDefault( Dictionary* dictionary, Dictionary_Entry_Key key, Name const defaultVal ) {
+	return	Dictionary_Entry_Value_AsString( 
+		Dictionary_GetDefault( dictionary, key, 
+		Dictionary_Entry_Value_FromString( defaultVal ) ) );
+}
+
+char* Dictionary_GetString_WithPrintfDefault( Dictionary* dictionary, Dictionary_Entry_Key key, Name format, ... ) {
+	char*     returnString;
+	char*     defaultVal;
+	va_list   ap;
+	
+	va_start( ap, format );
+
+	/* Create Default String from format arguments */
+	Stg_vasprintf( &defaultVal, format, ap );
+
+	/* Read Dictionary */
+	returnString = Dictionary_GetString_WithDefault( dictionary, key, defaultVal );
+
+	/* Clean up */
+	Memory_Free( defaultVal );
+	va_end( ap );
+
+	return returnString;
+}
+Bool Stream_RedirectFile_WithPrependedPath( Stream* stream, Name prependedPath, const char* filename ) {
+	Bool result;
+
+	/* Check to make sure output path is emtpy */ 
+	if ( Stg_StringIsEmpty( prependedPath ) )
+		result = Stream_RedirectFile( stream, filename );
+	else {
+		char* prependedFilename;
+
+		Stg_asprintf( &prependedFilename, "%s/%s", prependedPath, filename );
+		result = Stream_RedirectFile( stream, prependedFilename );
+		Memory_Free( prependedFilename );
+	}
+
+	return result;
+}
+Bool Stream_AppendFile_WithPrependedPath( Stream* stream, Name prependedPath, const char* filename ) {
+	Bool result;
+
+	/* Check to make sure output path is emtpy */ 
+	if ( Stg_StringIsEmpty( prependedPath ) )
+		result = Stream_AppendFile( stream, filename );
+	else {
+		char* prependedFilename;
+
+		Stg_asprintf( &prependedFilename, "%s/%s", prependedPath, filename );
+		result = Stream_AppendFile( stream, prependedFilename );
+		Memory_Free( prependedFilename );
+	}
+
+	return result;
+}
+void Journal_PrintString_WithLength( Stream* stream, Name string, int length ) {
+	size_t      stringLength = strlen( string ) ;
+	Name       breakInMiddle = "...";
+	size_t      lengthOfBreak = strlen( breakInMiddle );
+
+	if ( length <= 0 )
+		return;
+	/* If length given is exeedingly short - then print initial */
+	else if ( lengthOfBreak >= (unsigned)length ) {
+		Journal_Printf( stream, "%c", string[0] );
+		Journal_Write( stream, breakInMiddle, sizeof( char ), length - 1 );
+	}
+	/* Shorten String if nessesary */
+	else if ( stringLength > (unsigned)length ) {
+		int charsBeforeBreak = (int) ((float)length * 0.5) - 1;
+		int charsAfterBreak  = length - charsBeforeBreak - lengthOfBreak;
+
+		/* Print first half of string */
+		Journal_Write( stream, string, sizeof( char ), charsBeforeBreak );
+
+		/* Print '...' In middle */
+		Journal_Printf( stream, breakInMiddle );
+
+		/* Print end of string */
+		Journal_Write( stream, &string[ stringLength - charsAfterBreak ], sizeof( char ), charsAfterBreak );
+		return;
+	}
+	else {
+		Index       char_I;
+
+		/* If string is shorter than allowed length - then add empty space */
+		for ( char_I = 0 ; char_I < length - stringLength ; char_I++ )
+			Journal_Printf( stream, " " );
+		
+		/* Print the complete string */
+		Journal_Printf( stream, string );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/stgmessaging.c
--- a/Base/IO/src/stgmessaging.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: petsccompat.h 3403 2006-01-13 08:33:58Z RobertTurnbull $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "mpi.h"
-
-#include "Base/Foundation/Foundation.h"
-
-#include "types.h"
-#include "shortcuts.h"
-#include "Dictionary.h"
-#include "Dictionary_Entry.h"
-#include "Dictionary_Entry_Value.h"
-#include "Journal.h"
-#include "JournalFile.h"
-#include "CFile.h"
-#include "Stream.h"
-#include "CStream.h"
-#include "MPIStream.h"
-#include "StreamFormatter.h"
-
-
-int Stg_Messaging_GetRank( MPI_Comm comm ) {
-	int rank;
-	MPI_Comm_rank( comm, &rank );
-	return rank;
-}
-
-int Stg_MPI_Send( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Send: tag = %d, count = %d, datatype = %d, dest = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, dest );
-	return MPI_Send( buf, count, datatype, dest, tag, comm );
-}
-
-int Stg_MPI_Ssend( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Ssend: tag = %d, count = %d, datatype = %d, dest = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, dest );
-	return MPI_Ssend( buf, count, datatype, dest, tag, comm );
-}
-int Stg_MPI_Isend( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Isend: tag = %d, count = %d, datatype = %d, dest = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, dest );
-	return MPI_Isend( buf, count, datatype, dest, tag, comm, request );
-}
-int Stg_MPI_Recv( char* file, int line, void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Recv: tag = %d, count = %d, datatype = %d, source = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, source );
-	return MPI_Recv( buf, count, datatype, source, tag, comm, status );
-}
-int Stg_MPI_Irecv( char* file, int line, void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Irecv: tag = %d, count = %d, datatype = %d, source = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, source );
-	return MPI_Irecv( buf, count, datatype, source, tag, comm, request );
-}
-int Stg_MPI_Reduce ( char* file, int line, void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Reduce: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), count, datatype );
-	return MPI_Reduce( sendbuf, recvbuf, count, datatype, op, root, comm );
-}
-int Stg_MPI_Allreduce ( char* file, int line, void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Allreduce: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), count, datatype );
-	return MPI_Allreduce( sendbuf, recvbuf, count, datatype, op, comm );
-}
-int Stg_MPI_Gather ( char* file, int line, void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Gather: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), sendcnt, sendtype );
-	return MPI_Gather( sendbuf, sendcnt, sendtype, recvbuf, recvcount, recvtype, root, comm );
-}
-int Stg_MPI_Allgather ( char* file, int line, void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Allgather: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), sendcount, sendtype );
-	return MPI_Allgather( sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm );
-
-}
-
-int Stg_MPI_Wait ( char* file, int line, MPI_Request *request, MPI_Status *status ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	int result =  MPI_Wait( request, status );
-	Journal_Printf( stream, "%s %d, rank %d MPI_Wait:",
-		file, line, Stg_Messaging_GetRank( MPI_COMM_WORLD ) );
-	if ( MPI_STATUS_IGNORE != (status) ) {
-		Journal_Printf( stream, " tag = %d, source = %d", status->MPI_TAG, status->MPI_SOURCE );
-	}
-	Journal_Printf( stream, "\n" );
-	return result;
-}
-
-
-int Stg_MPI_Test ( char* file, int line, MPI_Request *request, int *flag, MPI_Status *status ) {
-	Stream* stream = Journal_Register( Info_Type, "mpi" );
-	int result = MPI_Test( request, flag, status );
-	if ( *flag ) {
-		Journal_Printf( stream, "%s %d, rank %d MPI_Test: result = %d",
-			file, line, Stg_Messaging_GetRank( MPI_COMM_WORLD ), result );
-		if ( MPI_STATUS_IGNORE != (status) ) {
-			Journal_Printf( stream, ", tag = %d, source = %d", status->MPI_TAG, status->MPI_SOURCE );
-		}
-		Journal_Printf( stream, "\n" );
-	}
-
-	return result;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/src/stgmessaging.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/src/stgmessaging.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,131 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: petsccompat.h 3403 2006-01-13 08:33:58Z RobertTurnbull $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "mpi.h"
+
+#include "Base/Foundation/Foundation.h"
+
+#include "types.h"
+#include "shortcuts.h"
+#include "Dictionary.h"
+#include "Dictionary_Entry.h"
+#include "Dictionary_Entry_Value.h"
+#include "Journal.h"
+#include "JournalFile.h"
+#include "CFile.h"
+#include "Stream.h"
+#include "CStream.h"
+#include "MPIStream.h"
+#include "StreamFormatter.h"
+
+
+int Stg_Messaging_GetRank( MPI_Comm comm ) {
+	int rank;
+	MPI_Comm_rank( comm, &rank );
+	return rank;
+}
+
+int Stg_MPI_Send( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Send: tag = %d, count = %d, datatype = %d, dest = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, dest );
+	return MPI_Send( buf, count, datatype, dest, tag, comm );
+}
+
+int Stg_MPI_Ssend( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Ssend: tag = %d, count = %d, datatype = %d, dest = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, dest );
+	return MPI_Ssend( buf, count, datatype, dest, tag, comm );
+}
+int Stg_MPI_Isend( char* file, int line, void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Isend: tag = %d, count = %d, datatype = %d, dest = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, dest );
+	return MPI_Isend( buf, count, datatype, dest, tag, comm, request );
+}
+int Stg_MPI_Recv( char* file, int line, void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Recv: tag = %d, count = %d, datatype = %d, source = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, source );
+	return MPI_Recv( buf, count, datatype, source, tag, comm, status );
+}
+int Stg_MPI_Irecv( char* file, int line, void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Irecv: tag = %d, count = %d, datatype = %d, source = %d\n", file, line, Stg_Messaging_GetRank( comm ), tag, count, datatype, source );
+	return MPI_Irecv( buf, count, datatype, source, tag, comm, request );
+}
+int Stg_MPI_Reduce ( char* file, int line, void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Reduce: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), count, datatype );
+	return MPI_Reduce( sendbuf, recvbuf, count, datatype, op, root, comm );
+}
+int Stg_MPI_Allreduce ( char* file, int line, void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Allreduce: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), count, datatype );
+	return MPI_Allreduce( sendbuf, recvbuf, count, datatype, op, comm );
+}
+int Stg_MPI_Gather ( char* file, int line, void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Gather: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), sendcnt, sendtype );
+	return MPI_Gather( sendbuf, sendcnt, sendtype, recvbuf, recvcount, recvtype, root, comm );
+}
+int Stg_MPI_Allgather ( char* file, int line, void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Allgather: count = %d, datatype = %d\n", file, line, Stg_Messaging_GetRank( comm ), sendcount, sendtype );
+	return MPI_Allgather( sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm );
+
+}
+
+int Stg_MPI_Wait ( char* file, int line, MPI_Request *request, MPI_Status *status ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	int result =  MPI_Wait( request, status );
+	Journal_Printf( stream, "%s %d, rank %d MPI_Wait:",
+		file, line, Stg_Messaging_GetRank( MPI_COMM_WORLD ) );
+	if ( MPI_STATUS_IGNORE != (status) ) {
+		Journal_Printf( stream, " tag = %d, source = %d", status->MPI_TAG, status->MPI_SOURCE );
+	}
+	Journal_Printf( stream, "\n" );
+	return result;
+}
+
+
+int Stg_MPI_Test ( char* file, int line, MPI_Request *request, int *flag, MPI_Status *status ) {
+	Stream* stream = Journal_Register( Info_Type, "mpi" );
+	int result = MPI_Test( request, flag, status );
+	if ( *flag ) {
+		Journal_Printf( stream, "%s %d, rank %d MPI_Test: result = %d",
+			file, line, Stg_Messaging_GetRank( MPI_COMM_WORLD ), result );
+		if ( MPI_STATUS_IGNORE != (status) ) {
+			Journal_Printf( stream, ", tag = %d, source = %d", status->MPI_TAG, status->MPI_SOURCE );
+		}
+		Journal_Printf( stream, "\n" );
+	}
+
+	return result;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/DictionarySuite.c
--- a/Base/IO/tests/DictionarySuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,496 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests the data->dict functionality
-**
-** $Id: testDictionary.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "DictionarySuite.h"
-
-typedef struct {
-   Dictionary*                   dict;
-   DictionarySuite_TestDictData* testDD;
-} DictionarySuiteData;
-
-
-void DictionarySuite_SetupTestDictData( DictionarySuite_TestDictData* testDD ) {
-   Index                   ii=0;
-   Index                   iter=0;
-   Dictionary_Entry_Value* testStruct; 
-   Dictionary_Entry_Value* testStruct2; 
-   Dictionary_Entry_Value* testList; 
-
-   testDD->testEntriesCount = 8;
-   testDD->testKeys = Memory_Alloc_Array_Unnamed( char*, testDD->testEntriesCount );
-   testDD->testValues = Memory_Alloc_Array_Unnamed( Dictionary_Entry_Value*,
-      testDD->testEntriesCount );
-
-   for ( ii=0; ii< testDD->testEntriesCount; ii++ ) {
-      testDD->testKeys[ii] = NULL;
-      testDD->testValues[ii] = NULL;
-   }
-
-   Stg_asprintf( &testDD->testString, "hello" );
-   testDD->testDouble=45.567;
-   testDD->testUint = 5;
-   testDD->testInt = -5;
-   testDD->testUnsignedlong = 52342423;
-   testDD->testBool = True;
-   iter = 0;
-   Stg_asprintf( &testDD->testKeys[iter], "test_cstring" );
-   testDD->testValues[iter] = Dictionary_Entry_Value_FromString( testDD->testString );
-   Stg_asprintf( &testDD->testKeys[++iter], "test_double" );
-   testDD->testValues[iter] = Dictionary_Entry_Value_FromDouble( testDD->testDouble );
-   Stg_asprintf( &testDD->testKeys[++iter], "test_uint" );
-   testDD->testValues[iter] = Dictionary_Entry_Value_FromUnsignedInt( testDD->testUint );
-   Stg_asprintf( &testDD->testKeys[++iter], "test_int" );
-   testDD->testValues[iter] = Dictionary_Entry_Value_FromInt( testDD->testInt );
-   Stg_asprintf( &testDD->testKeys[++iter], "test_unsignedlong" );
-   testDD->testValues[iter] = Dictionary_Entry_Value_FromUnsignedLong( testDD->testUnsignedlong );
-   Stg_asprintf( &testDD->testKeys[++iter], "test_bool" );
-   testDD->testValues[iter] = Dictionary_Entry_Value_FromUnsignedInt( testDD->testBool );
-
-   /* adding a list */
-   testDD->testListCount = 5;
-   testDD->testList = Memory_Alloc_Array_Unnamed( double, testDD->testListCount );
-   for (ii=0; ii<testDD->testListCount; ii++ ) {
-      testDD->testList[ii] = 10.0 * ii;
-   }
-
-   testList = Dictionary_Entry_Value_NewList();
-   Stg_asprintf( &testDD->testKeys[++iter], "test_list" );
-   testDD->testValues[iter] = testList;
-   for (ii=0; ii < testDD->testListCount; ii++ ) {
-      Dictionary_Entry_Value_AddElement( testList, Dictionary_Entry_Value_FromDouble(testDD->testList[ii]) );
-   }
-
-   /* Adding members to a struct */
-   testDD->testStruct = Memory_Alloc_Unnamed( TestStruct );
-   testDD->testStruct->height = 37;
-   testDD->testStruct->anisotropic = True;
-   Stg_asprintf( &testDD->testStruct->person, "Patrick" );
-   testDD->testStruct->geom.startx = 45;
-   testDD->testStruct->geom.starty = 60;
-   testDD->testStruct->geom.startz = 70;
-
-   testStruct = Dictionary_Entry_Value_NewStruct();
-   Stg_asprintf( &testDD->testKeys[++iter], "test_struct" );
-   testDD->testValues[iter] = testStruct;
-   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"height", Dictionary_Entry_Value_FromDouble( testDD->testStruct->height )  );
-   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"anisotropic", Dictionary_Entry_Value_FromBool( testDD->testStruct->anisotropic )  );
-   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"person", Dictionary_Entry_Value_FromString( testDD->testStruct->person ) );
-
-   /* Adding a 2nd struct within the first struct */
-   testStruct2 = Dictionary_Entry_Value_NewStruct( );
-   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"geom", testStruct2  );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"startx", Dictionary_Entry_Value_FromUnsignedInt( testDD->testStruct->geom.startx )  );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"starty", Dictionary_Entry_Value_FromUnsignedInt( testDD->testStruct->geom.starty )  );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"startz", Dictionary_Entry_Value_FromUnsignedInt( testDD->testStruct->geom.startz ) );
-}
-
-void DictionarySuite_Setup( DictionarySuiteData* data ) {
-   data->dict     = Dictionary_New();
-   data->testDD   = Memory_Alloc_Unnamed( DictionarySuite_TestDictData );
-   DictionarySuite_SetupTestDictData( data->testDD );
-}
-
-void DictionarySuite_Teardown( DictionarySuiteData* data ) {
-   Dictionary_Empty( data->dict );
-   Stg_Class_Delete( data->dict );
-   DictionarySuite_DictionaryData_Free( data->testDD );
-   Memory_Free( data->testDD );
-}
-
-void DictionarySuite_DictionaryData_Free( DictionarySuite_TestDictData* testDD ) {
-   Index ii;
-   for ( ii=0; ii< testDD->testEntriesCount; ii++ ) {
-      Memory_Free( testDD->testKeys[ii]  );
-      /* Note: we don't free the testValues here, as expect that deleting the
-       * dictionary has already done this */
-   }
-   Memory_Free( testDD->testKeys );
-   Memory_Free( testDD->testValues );
-   Memory_Free( testDD->testStruct->person );
-   Memory_Free( testDD->testStruct );
-   Memory_Free( testDD->testList );
-}
-
-
-void DictionarySuite_TestCreateValues( DictionarySuiteData* data ) {
-   Dictionary_Entry_Value*   dev;
-
-   /* Don't use the pre-created test values. Want to do a very fundamental test here */
-   dev = Dictionary_Entry_Value_FromString( "hello" );
-   pcu_check_true( Dictionary_Entry_Value_Type_String == dev->type );
-   pcu_check_streq( "hello", dev->as.typeString );
-   Dictionary_Entry_Value_Delete( dev );
-   dev = Dictionary_Entry_Value_FromDouble( 45.567 );
-   pcu_check_true( Dictionary_Entry_Value_Type_Double == dev->type );
-   pcu_check_true( 45.567 == dev->as.typeDouble );
-   Dictionary_Entry_Value_Delete( dev );
-   dev = Dictionary_Entry_Value_FromUnsignedInt( 5 );
-   pcu_check_true( Dictionary_Entry_Value_Type_UnsignedInt == dev->type );
-   pcu_check_true( 5 == dev->as.typeUnsignedInt );
-   Dictionary_Entry_Value_Delete( dev );
-   dev = Dictionary_Entry_Value_FromInt( -5 );
-   pcu_check_true( Dictionary_Entry_Value_Type_Int == dev->type );
-   pcu_check_true( -5 == dev->as.typeInt );
-   Dictionary_Entry_Value_Delete( dev );
-   dev = Dictionary_Entry_Value_FromUnsignedLong( 52342423 );
-   pcu_check_true( Dictionary_Entry_Value_Type_UnsignedLong == dev->type );
-   pcu_check_true( 52342423 == dev->as.typeUnsignedLong );
-   Dictionary_Entry_Value_Delete( dev );
-   dev = Dictionary_Entry_Value_FromBool( True );
-   pcu_check_true( Dictionary_Entry_Value_Type_Bool == dev->type );
-   pcu_check_true( True == dev->as.typeBool );
-   Dictionary_Entry_Value_Delete( dev );
-
-   /* Since we know the DEV Struct is basically a Dictionary, won't test that one
-    *  until after we've tested Dictionary_Add works */   
-}
-
-
-void DictionarySuite_PopulateDictWithTestValues( Dictionary* dict, DictionarySuite_TestDictData* testDD ) {
-   Index ii;
-
-   for ( ii=0; ii< testDD->testEntriesCount; ii++ ) {
-      Dictionary_Add( dict, testDD->testKeys[ii],\
-         Dictionary_Entry_Value_Copy( testDD->testValues[ii], True ) );
-   }
-}
-
-
-void DictionarySuite_TestCopyCompare( DictionarySuiteData* data ) {
-   Index                    ii=0, jj=0;
-   Dictionary_Entry_Value*  copiedDev;
-   
-   for( ii = 0; ii < data->dict->count; ii++ ) {
-      copiedDev = Dictionary_Entry_Value_Copy( data->testDD->testValues[ii], True );
-      pcu_check_true( Dictionary_Entry_Value_Compare( data->testDD->testValues[ii], copiedDev ) ); 
-      Dictionary_Entry_Value_Delete( copiedDev );
-
-      for( jj = 0; jj < data->dict->count; jj++ ) {
-         if ( ii == jj ) continue;
-         pcu_check_true( False == Dictionary_Entry_Value_Compare( data->testDD->testValues[ii], data->testDD->testValues[jj] ) ); 
-      }
-   }
-}
-
-/* Add a set of values to a dictionary, and check they were added as desired
- * using the Compare functions.
- */
-void DictionarySuite_TestAddEmpty( DictionarySuiteData* data ) {
-   Dictionary_Index        ii;
-   Dictionary_Entry*       entryPtr;
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-
-   pcu_check_true( data->testDD->testEntriesCount == data->dict->count );
-
-   for( ii = 0; ii < data->dict->count; ii++ ) {
-      entryPtr = data->dict->entryPtr[ii];
-      pcu_check_true( Dictionary_Entry_Compare( entryPtr, data->testDD->testKeys[ii] ) ); 
-      pcu_check_true( Dictionary_Entry_Value_Compare( entryPtr->value, data->testDD->testValues[ii] ) ); 
-   }
-
-   Dictionary_Empty( data->dict );
-   pcu_check_true( 0 == data->dict->count );
-}
-
-
-void DictionarySuite_TestGet( DictionarySuiteData* data ) {
-   Dictionary_Entry_Value* yValue;
-   Dictionary_Entry_Value* testStruct;
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-
-   testStruct = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct"  );
-   yValue = Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value_GetMember(testStruct, (Dictionary_Entry_Key)"geom" ), "starty");
-   pcu_check_true( data->testDD->testStruct->geom.starty == Dictionary_Entry_Value_AsDouble( yValue ) );
-}
-
-
-void DictionarySuite_TestSet( DictionarySuiteData* data ) {
-   Dictionary_Entry_Value* currValue;
-   Dictionary_Entry_Value* listValue;
-   double                  newVal1 = 34.3, newVal2 = 38.9;
-   Index                   ii=0;
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-
-   listValue = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_list" );
-   /* getting dictionary out of a list */
-   currValue = Dictionary_Entry_Value_GetFirstElement( listValue  );
-   /* do something to this value */
-   Dictionary_Entry_Value_SetFromDouble( currValue, newVal1 );
-   currValue = currValue->next;
-   /* do something to this value */
-   Dictionary_Entry_Value_SetFromDouble( currValue, newVal2 );
-   
-   pcu_check_true( 5 == Dictionary_Entry_Value_GetCount( listValue ) );
-   currValue = Dictionary_Entry_Value_GetFirstElement( listValue );
-   pcu_check_le( fabs(newVal1 - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
-   currValue = currValue->next;
-   pcu_check_le( fabs(newVal2 - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
-   currValue = currValue->next;
-   for ( ii=2; ii<data->testDD->testListCount; ii++ ) {
-      pcu_check_le( fabs(data->testDD->testList[ii]
-         - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
-      currValue = currValue->next;
-   }
-}
-
-
-void DictionarySuite_TestAddElement( DictionarySuiteData* data ) {
-   Dictionary_Entry_Value* yValue;
-   Dictionary_Entry_Value* testStruct;
-   Dictionary_Entry_Value* currValue;
-   double                  newVal = -45.0;
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-
-   /* turning the starty value into a list using add element */
-   testStruct = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct"  );
-   yValue = Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value_GetMember(testStruct, (Dictionary_Entry_Key)"geom" ), "starty");
-   Dictionary_Entry_Value_AddElement( yValue, Dictionary_Entry_Value_FromDouble(newVal) );
-
-   pcu_check_true( Dictionary_Entry_Value_Type_List == yValue->type );
-   pcu_check_true( 2 == Dictionary_Entry_Value_GetCount( yValue ) );
-
-   currValue = Dictionary_Entry_Value_GetFirstElement( yValue );
-   pcu_check_le( fabs( data->testDD->testStruct->geom.starty - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
-   currValue = currValue->next;
-   pcu_check_le( fabs( newVal - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
-}
-
-
-void DictionarySuite_TestShortcuts( DictionarySuiteData* data ) {
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-
-   /* Testing GetString_WithDefault. If an entry with that key already exists, then
-    *  the value of the existing key should be returned, and the default passed in
-    *  ignored. However if the given key _doesn't_ exist, the default should be 
-    *  returned, and a new entry with the given key added to the dict. */
-   pcu_check_streq( data->testDD->testString, Dictionary_GetString_WithDefault( data->dict, "test_cstring", "heya" ) );
-   pcu_check_streq( "heya", Dictionary_GetString_WithDefault( data->dict, "test_cstring2", "heya" ) );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_cstring2" )  );
-   pcu_check_true( data->testDD->testDouble = Dictionary_GetDouble_WithDefault( data->dict, (Dictionary_Entry_Key)"test_double", 2.8 )  );
-   pcu_check_true( 2.8 == Dictionary_GetDouble_WithDefault( data->dict, (Dictionary_Entry_Key)"test_double2", 2.8 )  );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_double2" )  );
-   pcu_check_true( data->testDD->testUint = Dictionary_GetUnsignedInt_WithDefault( data->dict, "test_uint", 33 ) );
-   pcu_check_true( 33 == Dictionary_GetUnsignedInt_WithDefault( data->dict, "test_uint2", 33 ) );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_uint2" )  );
-   pcu_check_true( data->testDD->testInt = Dictionary_GetInt_WithDefault( data->dict, (Dictionary_Entry_Key)"test_int", -24 )  );
-   pcu_check_true( -24 == Dictionary_GetInt_WithDefault( data->dict, (Dictionary_Entry_Key)"test_int2", -24 )  );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_int2" )  );
-   pcu_check_true( data->testDD->testUnsignedlong = Dictionary_GetUnsignedLong_WithDefault( data->dict, "test_unsignedlong", 32433 ) );
-   pcu_check_true( 32433 == Dictionary_GetUnsignedLong_WithDefault( data->dict, "test_unsignedlong2", 32433 ) );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_unsignedlong2" )  );
-   pcu_check_true( data->testDD->testBool = Dictionary_GetBool_WithDefault( data->dict, (Dictionary_Entry_Key)"test_bool", False )  );
-   pcu_check_true( False == Dictionary_GetBool_WithDefault( data->dict, (Dictionary_Entry_Key)"test_bool2", False )  );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_bool2" )  );
-
-   pcu_check_streq( data->testDD->testString, Dictionary_GetString_WithPrintfDefault( data->dict, "test_cstring", "heya%s%u", "hey", 3 ) );
-   pcu_check_streq( "heyahey3", Dictionary_GetString_WithPrintfDefault( data->dict, "test_cstring3", "heya%s%u", "hey", 3 ) );
-   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_cstring3" ) );
-}
-
-
-void DictionarySuite_TestMerge( DictionarySuiteData* data ) {
-   Dictionary_Entry_Value*    testStruct2=NULL;
-   Dictionary_Entry_Value*    testGeomStruct2=NULL;
-   Dictionary_Entry_Value*    mergedStruct=NULL;
-   Dictionary_Entry_Value*    expectedMergedStruct=NULL;
-
-   testStruct2 = Dictionary_Entry_Value_NewStruct( );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"height", Dictionary_Entry_Value_FromDouble( data->testDD->testStruct->height )  );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"anisotropic", Dictionary_Entry_Value_FromBool( False )  );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"new_person", Dictionary_Entry_Value_FromString( "Luke" ) );
-   testGeomStruct2 = Dictionary_Entry_Value_NewStruct( );
-   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"geom", testGeomStruct2  );
-   Dictionary_Entry_Value_AddMember( testGeomStruct2, (Dictionary_Entry_Key)"startx", Dictionary_Entry_Value_FromUnsignedInt( data->testDD->testStruct->geom.startx )  );
-   Dictionary_Entry_Value_AddMember( testGeomStruct2, (Dictionary_Entry_Key)"startz", Dictionary_Entry_Value_FromUnsignedInt( 222 )  );
-
-   /* Testing Merge_Append */
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-   /* Do a copy of the DEV during merge, since we don't want it being deleted */
-   Dictionary_AddMerge( data->dict, "test_struct", Dictionary_Entry_Value_Copy( testStruct2, True ), Dictionary_MergeType_Append );
-   /* OK: since this was an append, we expect _two_ entries called "test_struct",
-    * one preceding the other, one with the orig data, one with new data */    
-   pcu_check_true( (data->testDD->testEntriesCount+1) == data->dict->count );
-   pcu_check_true( Dictionary_Entry_Value_Compare( data->testDD->testValues[7], Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct" ) )  );
-   pcu_check_true( Dictionary_Entry_Value_Compare( testStruct2, data->dict->entryPtr[8]->value ) );
-   Dictionary_Empty( data->dict );
-
-   /* Testing Merge_Merge */
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-
-   /* The nicest way for this test I think is to manually build a merged struct
-    *  to compare against */
-   expectedMergedStruct = Dictionary_Entry_Value_Copy( data->testDD->testValues[7], True );
-   Dictionary_Set( expectedMergedStruct->as.typeStruct, (Dictionary_Entry_Key)"anisotropic", Dictionary_Entry_Value_FromBool( False )  );
-   Dictionary_Add( expectedMergedStruct->as.typeStruct, (Dictionary_Entry_Key)"new_person", Dictionary_Entry_Value_FromString( "Luke" )  );
-   Dictionary_Set( (Dictionary_Get( expectedMergedStruct->as.typeStruct, (Dictionary_Entry_Key)"geom" ) )->as.typeStruct, "startz", Dictionary_Entry_Value_FromUnsignedInt( 222 ) );
-
-   Dictionary_AddMerge( data->dict, "test_struct", Dictionary_Entry_Value_Copy( testStruct2, True ), Dictionary_MergeType_Merge );
-   /* This time, the new struct should be merged into the existing one */
-   pcu_check_true( data->testDD->testEntriesCount == data->dict->count );
-   mergedStruct = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct"  );
-   pcu_check_true( Dictionary_Entry_Value_Compare( mergedStruct, expectedMergedStruct ) );
-   Dictionary_Empty( data->dict );
-   Dictionary_Entry_Value_Delete( expectedMergedStruct );
-
-   /* Testing Merge_Replace */
-   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
-   Dictionary_AddMerge( data->dict, "test_struct", Dictionary_Entry_Value_Copy( testStruct2, True ), Dictionary_MergeType_Replace );
-   pcu_check_true( data->testDD->testEntriesCount == data->dict->count );
-   pcu_check_true( Dictionary_Entry_Value_Compare( testStruct2, Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct" ) ) );
-   Dictionary_Empty( data->dict );
-
-   Dictionary_Entry_Value_Delete( testStruct2 );
-}
-
-
-void DictionarySuite_TestReadAllParamFromCommandLine( DictionarySuiteData* data  ) {
-   int                        argc;
-   char**                     argv;
-   char**                     expectedKeys;
-   Dictionary_Entry_Value**   expectedVals;
-   Index                      ii;
-   Dictionary_Entry_Value*    tmpStruct=NULL;
-   Dictionary_Entry_Value*    tmpStruct2=NULL;
-   Dictionary_Entry_Value*    tmpList=NULL;
-   Index                      numExp = 7;
-
-   argc = 16;
-   argv = Memory_Alloc_Array_Unnamed( char*, argc );
-   expectedVals = Memory_Alloc_Array_Unnamed( Dictionary_Entry_Value*, numExp );
-   expectedKeys = Memory_Alloc_Array_Unnamed( char*, numExp );
-
-   /* Now fill in our mock command line, and create the expected values to test
-    *  against along the way */   
-   Stg_asprintf( &argv[0], "./testStGermain");
-   Stg_asprintf( &argv[1], "-param=hey");
-   Stg_asprintf( &argv[2], "--option");
-   Stg_asprintf( &argv[3], "--output-dir=");
-   Stg_asprintf( &expectedKeys[0], "output-dir" );
-
-   expectedVals[0] = Dictionary_Entry_Value_FromString( "" );
-   Stg_asprintf( &argv[4], "--Ra=1.0e4");
-   Stg_asprintf( &expectedKeys[1], "Ra" );
-
-   expectedVals[1] = Dictionary_Entry_Value_FromDouble( 1.0e4 );
-   Stg_asprintf( &argv[5], "--foo.bar=5");
-   Stg_asprintf( &expectedKeys[2], "foo" );
-
-   expectedVals[2] = Dictionary_Entry_Value_NewStruct();
-   Dictionary_Entry_Value_AddMember( expectedVals[2], (Dictionary_Entry_Key)"bar", Dictionary_Entry_Value_FromDouble( 5 )  );
-   Stg_asprintf( &argv[6], "--vpac.csd.steve=cool");
-   Stg_asprintf( &expectedKeys[3], "vpac" );
-
-   expectedVals[3] = Dictionary_Entry_Value_NewStruct();
-   Dictionary_Entry_Value_AddMember( expectedVals[3], (Dictionary_Entry_Key)"csd", tmpStruct = Dictionary_Entry_Value_NewStruct()  );
-   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"steve", Dictionary_Entry_Value_FromString( "cool" )  );
-   Stg_asprintf( &argv[7], "--foo.bot=7");
-   Dictionary_Entry_Value_AddMember( expectedVals[2], (Dictionary_Entry_Key)"bot", Dictionary_Entry_Value_FromDouble( 7 )  );
-   Stg_asprintf( &argv[8], "--sports[]=hockey");
-   Stg_asprintf( &expectedKeys[4], "sports" );
-
-   expectedVals[4] = Dictionary_Entry_Value_NewList();
-   Dictionary_Entry_Value_AddElement( expectedVals[4], Dictionary_Entry_Value_FromString( "hockey" ) );
-   Stg_asprintf( &argv[9], "--sports[]=chess");
-   /* This should be overwritten by next entry, so ignore */
-   Stg_asprintf( &argv[10], "--sports[1]=tennis");
-   Dictionary_Entry_Value_AddElement( expectedVals[4], Dictionary_Entry_Value_FromString( "tennis" ) );
-   Stg_asprintf( &argv[11], "--sles[].name=pressure");
-   Stg_asprintf( &expectedKeys[5], "sles" );
-
-   expectedVals[5] = Dictionary_Entry_Value_NewList();
-   Dictionary_Entry_Value_AddElement( expectedVals[5], tmpStruct = Dictionary_Entry_Value_NewStruct() );
-   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"name", Dictionary_Entry_Value_FromString( "pressure" )  );
-   Stg_asprintf( &argv[12], "--sles[].name=temperature");
-   Dictionary_Entry_Value_AddElement( expectedVals[5], tmpStruct2 = Dictionary_Entry_Value_NewStruct() );
-   Dictionary_Entry_Value_AddMember( tmpStruct2, (Dictionary_Entry_Key)"name", Dictionary_Entry_Value_FromString( "temperature" )  );
-   Stg_asprintf( &argv[13], "--sles[0].solver=mg");
-   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"solver", Dictionary_Entry_Value_FromString( "mg" )  );
-   Stg_asprintf( &argv[14], "--sles[1].solver=direct");
-   Dictionary_Entry_Value_AddMember( tmpStruct2, (Dictionary_Entry_Key)"solver", Dictionary_Entry_Value_FromString( "direct" )  );
-   Stg_asprintf( &argv[15], "--some.crazy[].shit=here");
-   Stg_asprintf( &expectedKeys[6], "some" );
-
-   expectedVals[6] = Dictionary_Entry_Value_NewStruct();
-   Dictionary_Entry_Value_AddMember( expectedVals[6], (Dictionary_Entry_Key)"crazy", tmpList = Dictionary_Entry_Value_NewList()  );
-   Dictionary_Entry_Value_AddElement( tmpList, tmpStruct = Dictionary_Entry_Value_NewStruct() );
-   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"shit", Dictionary_Entry_Value_FromString( "here" )  );
-
-   Dictionary_ReadAllParamFromCommandLine( data->dict, argc, argv );
-
-   for (ii=0; ii < numExp; ii++) {
-      pcu_check_true( Dictionary_Entry_Compare( data->dict->entryPtr[ii], expectedKeys[ii]));
-      pcu_check_true( Dictionary_Entry_Value_Compare( expectedVals[ii], data->dict->entryPtr[ii]->value ));
-   }
-
-   for (ii=0; ii < (unsigned)argc; ii++) {
-      Memory_Free( argv[ii] );
-   }
-   Memory_Free( argv );
-
-   for (ii=0; ii < numExp; ii++) {
-      Memory_Free( expectedKeys[ii] );
-      Memory_Free( expectedVals[ii] );
-   }
-   Memory_Free( expectedKeys );
-   Memory_Free( expectedVals );
-}
-
-
-void DictionarySuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, DictionarySuiteData );
-   pcu_suite_setFixtures( suite, DictionarySuite_Setup, DictionarySuite_Teardown );
-   pcu_suite_addTest( suite, DictionarySuite_TestCreateValues );
-   pcu_suite_addTest( suite, DictionarySuite_TestCopyCompare );
-   pcu_suite_addTest( suite, DictionarySuite_TestAddEmpty );
-   pcu_suite_addTest( suite, DictionarySuite_TestGet );
-   pcu_suite_addTest( suite, DictionarySuite_TestSet );
-   pcu_suite_addTest( suite, DictionarySuite_TestAddElement );
-   pcu_suite_addTest( suite, DictionarySuite_TestShortcuts );
-   pcu_suite_addTest( suite, DictionarySuite_TestMerge );
-   pcu_suite_addTest( suite, DictionarySuite_TestReadAllParamFromCommandLine );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/DictionarySuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/tests/DictionarySuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,496 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests the data->dict functionality
+**
+** $Id: testDictionary.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "DictionarySuite.h"
+
+typedef struct {
+   Dictionary*                   dict;
+   DictionarySuite_TestDictData* testDD;
+} DictionarySuiteData;
+
+
+void DictionarySuite_SetupTestDictData( DictionarySuite_TestDictData* testDD ) {
+   Index                   ii=0;
+   Index                   iter=0;
+   Dictionary_Entry_Value* testStruct; 
+   Dictionary_Entry_Value* testStruct2; 
+   Dictionary_Entry_Value* testList; 
+
+   testDD->testEntriesCount = 8;
+   testDD->testKeys = Memory_Alloc_Array_Unnamed( char*, testDD->testEntriesCount );
+   testDD->testValues = Memory_Alloc_Array_Unnamed( Dictionary_Entry_Value*,
+      testDD->testEntriesCount );
+
+   for ( ii=0; ii< testDD->testEntriesCount; ii++ ) {
+      testDD->testKeys[ii] = NULL;
+      testDD->testValues[ii] = NULL;
+   }
+
+   Stg_asprintf( &testDD->testString, "hello" );
+   testDD->testDouble=45.567;
+   testDD->testUint = 5;
+   testDD->testInt = -5;
+   testDD->testUnsignedlong = 52342423;
+   testDD->testBool = True;
+   iter = 0;
+   Stg_asprintf( &testDD->testKeys[iter], "test_cstring" );
+   testDD->testValues[iter] = Dictionary_Entry_Value_FromString( testDD->testString );
+   Stg_asprintf( &testDD->testKeys[++iter], "test_double" );
+   testDD->testValues[iter] = Dictionary_Entry_Value_FromDouble( testDD->testDouble );
+   Stg_asprintf( &testDD->testKeys[++iter], "test_uint" );
+   testDD->testValues[iter] = Dictionary_Entry_Value_FromUnsignedInt( testDD->testUint );
+   Stg_asprintf( &testDD->testKeys[++iter], "test_int" );
+   testDD->testValues[iter] = Dictionary_Entry_Value_FromInt( testDD->testInt );
+   Stg_asprintf( &testDD->testKeys[++iter], "test_unsignedlong" );
+   testDD->testValues[iter] = Dictionary_Entry_Value_FromUnsignedLong( testDD->testUnsignedlong );
+   Stg_asprintf( &testDD->testKeys[++iter], "test_bool" );
+   testDD->testValues[iter] = Dictionary_Entry_Value_FromUnsignedInt( testDD->testBool );
+
+   /* adding a list */
+   testDD->testListCount = 5;
+   testDD->testList = Memory_Alloc_Array_Unnamed( double, testDD->testListCount );
+   for (ii=0; ii<testDD->testListCount; ii++ ) {
+      testDD->testList[ii] = 10.0 * ii;
+   }
+
+   testList = Dictionary_Entry_Value_NewList();
+   Stg_asprintf( &testDD->testKeys[++iter], "test_list" );
+   testDD->testValues[iter] = testList;
+   for (ii=0; ii < testDD->testListCount; ii++ ) {
+      Dictionary_Entry_Value_AddElement( testList, Dictionary_Entry_Value_FromDouble(testDD->testList[ii]) );
+   }
+
+   /* Adding members to a struct */
+   testDD->testStruct = Memory_Alloc_Unnamed( TestStruct );
+   testDD->testStruct->height = 37;
+   testDD->testStruct->anisotropic = True;
+   Stg_asprintf( &testDD->testStruct->person, "Patrick" );
+   testDD->testStruct->geom.startx = 45;
+   testDD->testStruct->geom.starty = 60;
+   testDD->testStruct->geom.startz = 70;
+
+   testStruct = Dictionary_Entry_Value_NewStruct();
+   Stg_asprintf( &testDD->testKeys[++iter], "test_struct" );
+   testDD->testValues[iter] = testStruct;
+   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"height", Dictionary_Entry_Value_FromDouble( testDD->testStruct->height )  );
+   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"anisotropic", Dictionary_Entry_Value_FromBool( testDD->testStruct->anisotropic )  );
+   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"person", Dictionary_Entry_Value_FromString( testDD->testStruct->person ) );
+
+   /* Adding a 2nd struct within the first struct */
+   testStruct2 = Dictionary_Entry_Value_NewStruct( );
+   Dictionary_Entry_Value_AddMember( testStruct, (Dictionary_Entry_Key)"geom", testStruct2  );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"startx", Dictionary_Entry_Value_FromUnsignedInt( testDD->testStruct->geom.startx )  );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"starty", Dictionary_Entry_Value_FromUnsignedInt( testDD->testStruct->geom.starty )  );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"startz", Dictionary_Entry_Value_FromUnsignedInt( testDD->testStruct->geom.startz ) );
+}
+
+void DictionarySuite_Setup( DictionarySuiteData* data ) {
+   data->dict     = Dictionary_New();
+   data->testDD   = Memory_Alloc_Unnamed( DictionarySuite_TestDictData );
+   DictionarySuite_SetupTestDictData( data->testDD );
+}
+
+void DictionarySuite_Teardown( DictionarySuiteData* data ) {
+   Dictionary_Empty( data->dict );
+   Stg_Class_Delete( data->dict );
+   DictionarySuite_DictionaryData_Free( data->testDD );
+   Memory_Free( data->testDD );
+}
+
+void DictionarySuite_DictionaryData_Free( DictionarySuite_TestDictData* testDD ) {
+   Index ii;
+   for ( ii=0; ii< testDD->testEntriesCount; ii++ ) {
+      Memory_Free( testDD->testKeys[ii]  );
+      /* Note: we don't free the testValues here, as expect that deleting the
+       * dictionary has already done this */
+   }
+   Memory_Free( testDD->testKeys );
+   Memory_Free( testDD->testValues );
+   Memory_Free( testDD->testStruct->person );
+   Memory_Free( testDD->testStruct );
+   Memory_Free( testDD->testList );
+}
+
+
+void DictionarySuite_TestCreateValues( DictionarySuiteData* data ) {
+   Dictionary_Entry_Value*   dev;
+
+   /* Don't use the pre-created test values. Want to do a very fundamental test here */
+   dev = Dictionary_Entry_Value_FromString( "hello" );
+   pcu_check_true( Dictionary_Entry_Value_Type_String == dev->type );
+   pcu_check_streq( "hello", dev->as.typeString );
+   Dictionary_Entry_Value_Delete( dev );
+   dev = Dictionary_Entry_Value_FromDouble( 45.567 );
+   pcu_check_true( Dictionary_Entry_Value_Type_Double == dev->type );
+   pcu_check_true( 45.567 == dev->as.typeDouble );
+   Dictionary_Entry_Value_Delete( dev );
+   dev = Dictionary_Entry_Value_FromUnsignedInt( 5 );
+   pcu_check_true( Dictionary_Entry_Value_Type_UnsignedInt == dev->type );
+   pcu_check_true( 5 == dev->as.typeUnsignedInt );
+   Dictionary_Entry_Value_Delete( dev );
+   dev = Dictionary_Entry_Value_FromInt( -5 );
+   pcu_check_true( Dictionary_Entry_Value_Type_Int == dev->type );
+   pcu_check_true( -5 == dev->as.typeInt );
+   Dictionary_Entry_Value_Delete( dev );
+   dev = Dictionary_Entry_Value_FromUnsignedLong( 52342423 );
+   pcu_check_true( Dictionary_Entry_Value_Type_UnsignedLong == dev->type );
+   pcu_check_true( 52342423 == dev->as.typeUnsignedLong );
+   Dictionary_Entry_Value_Delete( dev );
+   dev = Dictionary_Entry_Value_FromBool( True );
+   pcu_check_true( Dictionary_Entry_Value_Type_Bool == dev->type );
+   pcu_check_true( True == dev->as.typeBool );
+   Dictionary_Entry_Value_Delete( dev );
+
+   /* Since we know the DEV Struct is basically a Dictionary, won't test that one
+    *  until after we've tested Dictionary_Add works */   
+}
+
+
+void DictionarySuite_PopulateDictWithTestValues( Dictionary* dict, DictionarySuite_TestDictData* testDD ) {
+   Index ii;
+
+   for ( ii=0; ii< testDD->testEntriesCount; ii++ ) {
+      Dictionary_Add( dict, testDD->testKeys[ii],\
+         Dictionary_Entry_Value_Copy( testDD->testValues[ii], True ) );
+   }
+}
+
+
+void DictionarySuite_TestCopyCompare( DictionarySuiteData* data ) {
+   Index                    ii=0, jj=0;
+   Dictionary_Entry_Value*  copiedDev;
+   
+   for( ii = 0; ii < data->dict->count; ii++ ) {
+      copiedDev = Dictionary_Entry_Value_Copy( data->testDD->testValues[ii], True );
+      pcu_check_true( Dictionary_Entry_Value_Compare( data->testDD->testValues[ii], copiedDev ) ); 
+      Dictionary_Entry_Value_Delete( copiedDev );
+
+      for( jj = 0; jj < data->dict->count; jj++ ) {
+         if ( ii == jj ) continue;
+         pcu_check_true( False == Dictionary_Entry_Value_Compare( data->testDD->testValues[ii], data->testDD->testValues[jj] ) ); 
+      }
+   }
+}
+
+/* Add a set of values to a dictionary, and check they were added as desired
+ * using the Compare functions.
+ */
+void DictionarySuite_TestAddEmpty( DictionarySuiteData* data ) {
+   Dictionary_Index        ii;
+   Dictionary_Entry*       entryPtr;
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+
+   pcu_check_true( data->testDD->testEntriesCount == data->dict->count );
+
+   for( ii = 0; ii < data->dict->count; ii++ ) {
+      entryPtr = data->dict->entryPtr[ii];
+      pcu_check_true( Dictionary_Entry_Compare( entryPtr, data->testDD->testKeys[ii] ) ); 
+      pcu_check_true( Dictionary_Entry_Value_Compare( entryPtr->value, data->testDD->testValues[ii] ) ); 
+   }
+
+   Dictionary_Empty( data->dict );
+   pcu_check_true( 0 == data->dict->count );
+}
+
+
+void DictionarySuite_TestGet( DictionarySuiteData* data ) {
+   Dictionary_Entry_Value* yValue;
+   Dictionary_Entry_Value* testStruct;
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+
+   testStruct = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct"  );
+   yValue = Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value_GetMember(testStruct, (Dictionary_Entry_Key)"geom" ), "starty");
+   pcu_check_true( data->testDD->testStruct->geom.starty == Dictionary_Entry_Value_AsDouble( yValue ) );
+}
+
+
+void DictionarySuite_TestSet( DictionarySuiteData* data ) {
+   Dictionary_Entry_Value* currValue;
+   Dictionary_Entry_Value* listValue;
+   double                  newVal1 = 34.3, newVal2 = 38.9;
+   Index                   ii=0;
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+
+   listValue = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_list" );
+   /* getting dictionary out of a list */
+   currValue = Dictionary_Entry_Value_GetFirstElement( listValue  );
+   /* do something to this value */
+   Dictionary_Entry_Value_SetFromDouble( currValue, newVal1 );
+   currValue = currValue->next;
+   /* do something to this value */
+   Dictionary_Entry_Value_SetFromDouble( currValue, newVal2 );
+   
+   pcu_check_true( 5 == Dictionary_Entry_Value_GetCount( listValue ) );
+   currValue = Dictionary_Entry_Value_GetFirstElement( listValue );
+   pcu_check_le( fabs(newVal1 - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
+   currValue = currValue->next;
+   pcu_check_le( fabs(newVal2 - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
+   currValue = currValue->next;
+   for ( ii=2; ii<data->testDD->testListCount; ii++ ) {
+      pcu_check_le( fabs(data->testDD->testList[ii]
+         - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
+      currValue = currValue->next;
+   }
+}
+
+
+void DictionarySuite_TestAddElement( DictionarySuiteData* data ) {
+   Dictionary_Entry_Value* yValue;
+   Dictionary_Entry_Value* testStruct;
+   Dictionary_Entry_Value* currValue;
+   double                  newVal = -45.0;
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+
+   /* turning the starty value into a list using add element */
+   testStruct = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct"  );
+   yValue = Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value_GetMember(testStruct, (Dictionary_Entry_Key)"geom" ), "starty");
+   Dictionary_Entry_Value_AddElement( yValue, Dictionary_Entry_Value_FromDouble(newVal) );
+
+   pcu_check_true( Dictionary_Entry_Value_Type_List == yValue->type );
+   pcu_check_true( 2 == Dictionary_Entry_Value_GetCount( yValue ) );
+
+   currValue = Dictionary_Entry_Value_GetFirstElement( yValue );
+   pcu_check_le( fabs( data->testDD->testStruct->geom.starty - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
+   currValue = currValue->next;
+   pcu_check_le( fabs( newVal - Dictionary_Entry_Value_AsDouble( currValue )), 0.01 );
+}
+
+
+void DictionarySuite_TestShortcuts( DictionarySuiteData* data ) {
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+
+   /* Testing GetString_WithDefault. If an entry with that key already exists, then
+    *  the value of the existing key should be returned, and the default passed in
+    *  ignored. However if the given key _doesn't_ exist, the default should be 
+    *  returned, and a new entry with the given key added to the dict. */
+   pcu_check_streq( data->testDD->testString, Dictionary_GetString_WithDefault( data->dict, "test_cstring", "heya" ) );
+   pcu_check_streq( "heya", Dictionary_GetString_WithDefault( data->dict, "test_cstring2", "heya" ) );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_cstring2" )  );
+   pcu_check_true( data->testDD->testDouble = Dictionary_GetDouble_WithDefault( data->dict, (Dictionary_Entry_Key)"test_double", 2.8 )  );
+   pcu_check_true( 2.8 == Dictionary_GetDouble_WithDefault( data->dict, (Dictionary_Entry_Key)"test_double2", 2.8 )  );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_double2" )  );
+   pcu_check_true( data->testDD->testUint = Dictionary_GetUnsignedInt_WithDefault( data->dict, "test_uint", 33 ) );
+   pcu_check_true( 33 == Dictionary_GetUnsignedInt_WithDefault( data->dict, "test_uint2", 33 ) );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_uint2" )  );
+   pcu_check_true( data->testDD->testInt = Dictionary_GetInt_WithDefault( data->dict, (Dictionary_Entry_Key)"test_int", -24 )  );
+   pcu_check_true( -24 == Dictionary_GetInt_WithDefault( data->dict, (Dictionary_Entry_Key)"test_int2", -24 )  );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_int2" )  );
+   pcu_check_true( data->testDD->testUnsignedlong = Dictionary_GetUnsignedLong_WithDefault( data->dict, "test_unsignedlong", 32433 ) );
+   pcu_check_true( 32433 == Dictionary_GetUnsignedLong_WithDefault( data->dict, "test_unsignedlong2", 32433 ) );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_unsignedlong2" )  );
+   pcu_check_true( data->testDD->testBool = Dictionary_GetBool_WithDefault( data->dict, (Dictionary_Entry_Key)"test_bool", False )  );
+   pcu_check_true( False == Dictionary_GetBool_WithDefault( data->dict, (Dictionary_Entry_Key)"test_bool2", False )  );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_bool2" )  );
+
+   pcu_check_streq( data->testDD->testString, Dictionary_GetString_WithPrintfDefault( data->dict, "test_cstring", "heya%s%u", "hey", 3 ) );
+   pcu_check_streq( "heyahey3", Dictionary_GetString_WithPrintfDefault( data->dict, "test_cstring3", "heya%s%u", "hey", 3 ) );
+   pcu_check_true( NULL != Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_cstring3" ) );
+}
+
+
+void DictionarySuite_TestMerge( DictionarySuiteData* data ) {
+   Dictionary_Entry_Value*    testStruct2=NULL;
+   Dictionary_Entry_Value*    testGeomStruct2=NULL;
+   Dictionary_Entry_Value*    mergedStruct=NULL;
+   Dictionary_Entry_Value*    expectedMergedStruct=NULL;
+
+   testStruct2 = Dictionary_Entry_Value_NewStruct( );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"height", Dictionary_Entry_Value_FromDouble( data->testDD->testStruct->height )  );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"anisotropic", Dictionary_Entry_Value_FromBool( False )  );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"new_person", Dictionary_Entry_Value_FromString( "Luke" ) );
+   testGeomStruct2 = Dictionary_Entry_Value_NewStruct( );
+   Dictionary_Entry_Value_AddMember( testStruct2, (Dictionary_Entry_Key)"geom", testGeomStruct2  );
+   Dictionary_Entry_Value_AddMember( testGeomStruct2, (Dictionary_Entry_Key)"startx", Dictionary_Entry_Value_FromUnsignedInt( data->testDD->testStruct->geom.startx )  );
+   Dictionary_Entry_Value_AddMember( testGeomStruct2, (Dictionary_Entry_Key)"startz", Dictionary_Entry_Value_FromUnsignedInt( 222 )  );
+
+   /* Testing Merge_Append */
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+   /* Do a copy of the DEV during merge, since we don't want it being deleted */
+   Dictionary_AddMerge( data->dict, "test_struct", Dictionary_Entry_Value_Copy( testStruct2, True ), Dictionary_MergeType_Append );
+   /* OK: since this was an append, we expect _two_ entries called "test_struct",
+    * one preceding the other, one with the orig data, one with new data */    
+   pcu_check_true( (data->testDD->testEntriesCount+1) == data->dict->count );
+   pcu_check_true( Dictionary_Entry_Value_Compare( data->testDD->testValues[7], Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct" ) )  );
+   pcu_check_true( Dictionary_Entry_Value_Compare( testStruct2, data->dict->entryPtr[8]->value ) );
+   Dictionary_Empty( data->dict );
+
+   /* Testing Merge_Merge */
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+
+   /* The nicest way for this test I think is to manually build a merged struct
+    *  to compare against */
+   expectedMergedStruct = Dictionary_Entry_Value_Copy( data->testDD->testValues[7], True );
+   Dictionary_Set( expectedMergedStruct->as.typeStruct, (Dictionary_Entry_Key)"anisotropic", Dictionary_Entry_Value_FromBool( False )  );
+   Dictionary_Add( expectedMergedStruct->as.typeStruct, (Dictionary_Entry_Key)"new_person", Dictionary_Entry_Value_FromString( "Luke" )  );
+   Dictionary_Set( (Dictionary_Get( expectedMergedStruct->as.typeStruct, (Dictionary_Entry_Key)"geom" ) )->as.typeStruct, "startz", Dictionary_Entry_Value_FromUnsignedInt( 222 ) );
+
+   Dictionary_AddMerge( data->dict, "test_struct", Dictionary_Entry_Value_Copy( testStruct2, True ), Dictionary_MergeType_Merge );
+   /* This time, the new struct should be merged into the existing one */
+   pcu_check_true( data->testDD->testEntriesCount == data->dict->count );
+   mergedStruct = Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct"  );
+   pcu_check_true( Dictionary_Entry_Value_Compare( mergedStruct, expectedMergedStruct ) );
+   Dictionary_Empty( data->dict );
+   Dictionary_Entry_Value_Delete( expectedMergedStruct );
+
+   /* Testing Merge_Replace */
+   DictionarySuite_PopulateDictWithTestValues( data->dict, data->testDD );
+   Dictionary_AddMerge( data->dict, "test_struct", Dictionary_Entry_Value_Copy( testStruct2, True ), Dictionary_MergeType_Replace );
+   pcu_check_true( data->testDD->testEntriesCount == data->dict->count );
+   pcu_check_true( Dictionary_Entry_Value_Compare( testStruct2, Dictionary_Get( data->dict, (Dictionary_Entry_Key)"test_struct" ) ) );
+   Dictionary_Empty( data->dict );
+
+   Dictionary_Entry_Value_Delete( testStruct2 );
+}
+
+
+void DictionarySuite_TestReadAllParamFromCommandLine( DictionarySuiteData* data  ) {
+   int                        argc;
+   char**                     argv;
+   char**                     expectedKeys;
+   Dictionary_Entry_Value**   expectedVals;
+   Index                      ii;
+   Dictionary_Entry_Value*    tmpStruct=NULL;
+   Dictionary_Entry_Value*    tmpStruct2=NULL;
+   Dictionary_Entry_Value*    tmpList=NULL;
+   Index                      numExp = 7;
+
+   argc = 16;
+   argv = Memory_Alloc_Array_Unnamed( char*, argc );
+   expectedVals = Memory_Alloc_Array_Unnamed( Dictionary_Entry_Value*, numExp );
+   expectedKeys = Memory_Alloc_Array_Unnamed( char*, numExp );
+
+   /* Now fill in our mock command line, and create the expected values to test
+    *  against along the way */   
+   Stg_asprintf( &argv[0], "./testStGermain");
+   Stg_asprintf( &argv[1], "-param=hey");
+   Stg_asprintf( &argv[2], "--option");
+   Stg_asprintf( &argv[3], "--output-dir=");
+   Stg_asprintf( &expectedKeys[0], "output-dir" );
+
+   expectedVals[0] = Dictionary_Entry_Value_FromString( "" );
+   Stg_asprintf( &argv[4], "--Ra=1.0e4");
+   Stg_asprintf( &expectedKeys[1], "Ra" );
+
+   expectedVals[1] = Dictionary_Entry_Value_FromDouble( 1.0e4 );
+   Stg_asprintf( &argv[5], "--foo.bar=5");
+   Stg_asprintf( &expectedKeys[2], "foo" );
+
+   expectedVals[2] = Dictionary_Entry_Value_NewStruct();
+   Dictionary_Entry_Value_AddMember( expectedVals[2], (Dictionary_Entry_Key)"bar", Dictionary_Entry_Value_FromDouble( 5 )  );
+   Stg_asprintf( &argv[6], "--vpac.csd.steve=cool");
+   Stg_asprintf( &expectedKeys[3], "vpac" );
+
+   expectedVals[3] = Dictionary_Entry_Value_NewStruct();
+   Dictionary_Entry_Value_AddMember( expectedVals[3], (Dictionary_Entry_Key)"csd", tmpStruct = Dictionary_Entry_Value_NewStruct()  );
+   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"steve", Dictionary_Entry_Value_FromString( "cool" )  );
+   Stg_asprintf( &argv[7], "--foo.bot=7");
+   Dictionary_Entry_Value_AddMember( expectedVals[2], (Dictionary_Entry_Key)"bot", Dictionary_Entry_Value_FromDouble( 7 )  );
+   Stg_asprintf( &argv[8], "--sports[]=hockey");
+   Stg_asprintf( &expectedKeys[4], "sports" );
+
+   expectedVals[4] = Dictionary_Entry_Value_NewList();
+   Dictionary_Entry_Value_AddElement( expectedVals[4], Dictionary_Entry_Value_FromString( "hockey" ) );
+   Stg_asprintf( &argv[9], "--sports[]=chess");
+   /* This should be overwritten by next entry, so ignore */
+   Stg_asprintf( &argv[10], "--sports[1]=tennis");
+   Dictionary_Entry_Value_AddElement( expectedVals[4], Dictionary_Entry_Value_FromString( "tennis" ) );
+   Stg_asprintf( &argv[11], "--sles[].name=pressure");
+   Stg_asprintf( &expectedKeys[5], "sles" );
+
+   expectedVals[5] = Dictionary_Entry_Value_NewList();
+   Dictionary_Entry_Value_AddElement( expectedVals[5], tmpStruct = Dictionary_Entry_Value_NewStruct() );
+   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"name", Dictionary_Entry_Value_FromString( "pressure" )  );
+   Stg_asprintf( &argv[12], "--sles[].name=temperature");
+   Dictionary_Entry_Value_AddElement( expectedVals[5], tmpStruct2 = Dictionary_Entry_Value_NewStruct() );
+   Dictionary_Entry_Value_AddMember( tmpStruct2, (Dictionary_Entry_Key)"name", Dictionary_Entry_Value_FromString( "temperature" )  );
+   Stg_asprintf( &argv[13], "--sles[0].solver=mg");
+   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"solver", Dictionary_Entry_Value_FromString( "mg" )  );
+   Stg_asprintf( &argv[14], "--sles[1].solver=direct");
+   Dictionary_Entry_Value_AddMember( tmpStruct2, (Dictionary_Entry_Key)"solver", Dictionary_Entry_Value_FromString( "direct" )  );
+   Stg_asprintf( &argv[15], "--some.crazy[].shit=here");
+   Stg_asprintf( &expectedKeys[6], "some" );
+
+   expectedVals[6] = Dictionary_Entry_Value_NewStruct();
+   Dictionary_Entry_Value_AddMember( expectedVals[6], (Dictionary_Entry_Key)"crazy", tmpList = Dictionary_Entry_Value_NewList()  );
+   Dictionary_Entry_Value_AddElement( tmpList, tmpStruct = Dictionary_Entry_Value_NewStruct() );
+   Dictionary_Entry_Value_AddMember( tmpStruct, (Dictionary_Entry_Key)"shit", Dictionary_Entry_Value_FromString( "here" )  );
+
+   Dictionary_ReadAllParamFromCommandLine( data->dict, argc, argv );
+
+   for (ii=0; ii < numExp; ii++) {
+      pcu_check_true( Dictionary_Entry_Compare( data->dict->entryPtr[ii], expectedKeys[ii]));
+      pcu_check_true( Dictionary_Entry_Value_Compare( expectedVals[ii], data->dict->entryPtr[ii]->value ));
+   }
+
+   for (ii=0; ii < (unsigned)argc; ii++) {
+      Memory_Free( argv[ii] );
+   }
+   Memory_Free( argv );
+
+   for (ii=0; ii < numExp; ii++) {
+      Memory_Free( expectedKeys[ii] );
+      Memory_Free( expectedVals[ii] );
+   }
+   Memory_Free( expectedKeys );
+   Memory_Free( expectedVals );
+}
+
+
+void DictionarySuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, DictionarySuiteData );
+   pcu_suite_setFixtures( suite, DictionarySuite_Setup, DictionarySuite_Teardown );
+   pcu_suite_addTest( suite, DictionarySuite_TestCreateValues );
+   pcu_suite_addTest( suite, DictionarySuite_TestCopyCompare );
+   pcu_suite_addTest( suite, DictionarySuite_TestAddEmpty );
+   pcu_suite_addTest( suite, DictionarySuite_TestGet );
+   pcu_suite_addTest( suite, DictionarySuite_TestSet );
+   pcu_suite_addTest( suite, DictionarySuite_TestAddElement );
+   pcu_suite_addTest( suite, DictionarySuite_TestShortcuts );
+   pcu_suite_addTest( suite, DictionarySuite_TestMerge );
+   pcu_suite_addTest( suite, DictionarySuite_TestReadAllParamFromCommandLine );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/IO_HandlerSuite.c
--- a/Base/IO/tests/IO_HandlerSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,713 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests the IO handler
-**
-** $Id: testIO_Handler-normal.c 3743 2006-08-03 03:14:38Z KentHumphries $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "DictionarySuite.h"  /* Because want to re-use sample dictionary structs/funcs */
-#include "IO_HandlerSuite.h"
-
-
-Name IO_HandlerSuite_XMLStartString1 = "<?xml version=\"1.0\"?>\n";
-Name IO_HandlerSuite_XMLStartString2 = "<StGermainData xmlns=\"http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003\">\n";
-Name IO_HandlerSuite_XMLEndString = "</StGermainData>\n";
-Name IO_HandlerSuite_XMLEmptyDataString = "<StGermainData xmlns=\"http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003\"/>\n";
-
-typedef struct {
-   XML_IO_Handler*                  io_handler;
-   Dictionary*                      dict1;
-   Dictionary*                      dict2;
-   DictionarySuite_TestDictData*    testDD;
-   int										rank;
-   int										nProcs;
-   MPI_Comm                         comm;
-} IO_HandlerSuiteData;
-
-
-void _IO_HandlerSuite_CreateTestXMLFile( Name testXMLFilename, const char* entriesString ) {
-   FILE*         testFile = NULL;
-   testFile = fopen(testXMLFilename, "w");
-   fwrite( IO_HandlerSuite_XMLStartString1, sizeof(char), strlen( IO_HandlerSuite_XMLStartString1 ), testFile );
-   fwrite( IO_HandlerSuite_XMLStartString2, sizeof(char), strlen( IO_HandlerSuite_XMLStartString2 ), testFile );
-   fwrite( entriesString, sizeof(char), strlen( entriesString ), testFile );
-   fwrite( IO_HandlerSuite_XMLEndString, sizeof(char), strlen( IO_HandlerSuite_XMLEndString ), testFile );
-   fclose( testFile );
-}
-
-
-void IO_HandlerSuite_Setup( IO_HandlerSuiteData* data ) {
-   data->comm = MPI_COMM_WORLD;
-   MPI_Comm_rank( data->comm, &data->rank );
-   MPI_Comm_size( data->comm, &data->nProcs );
-
-   data->io_handler = XML_IO_Handler_New();
-   /* We don't want output in the tests by default */
-   Stream_Enable( Journal_Register( Debug_Type, (Name)XML_IO_Handler_Type  ), False );
-   Stream_Enable( Journal_Register( Info_Type, (Name)XML_IO_Handler_Type  ), False );
-   data->dict1 = Dictionary_New();
-   data->dict2 = Dictionary_New();
-   data->testDD   = Memory_Alloc_Unnamed( DictionarySuite_TestDictData );
-   DictionarySuite_SetupTestDictData( data->testDD );
-}
-
-
-void IO_HandlerSuite_Teardown( IO_HandlerSuiteData* data ) {
-   Stg_Class_Delete( data->io_handler );
-   Stg_Class_Delete( data->dict1 );
-   Stg_Class_Delete( data->dict2 );
-   DictionarySuite_DictionaryData_Free( data->testDD );
-   Memory_Free( data->testDD );
-}
-
-
-/* Just populate a test dictionary, write it out to a file, read it back in again to a different dict, and check all the values are the same */
-void IO_HandlerSuite_TestWriteReadNormalEntries( IO_HandlerSuiteData* data ) {
-   Index         ii;
-   Name   xmlTestFilename = "xmlTest.xml";
-   int         rank_I=0;
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
-
-   if (data->rank == 0) {
-      IO_Handler_WriteAllToFile( data->io_handler, xmlTestFilename, data->dict1 );
-   }
-
-   for(rank_I=0; rank_I<data->nProcs;rank_I++) {
-      if ( rank_I == data->rank ) {
-         IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename, data->dict2 ); 
-      }
-      MPI_Barrier( data->comm );
-   }
-
-   pcu_check_true( data->dict1->count == data->dict2->count );
-   if ( data->dict1->count == data->dict2->count ) {
-      for (ii=0; ii<data->dict1->count; ii++) {
-         pcu_check_true( Dictionary_Entry_Compare( data->dict1->entryPtr[ii], data->dict2->entryPtr[ii]->key) );
-         pcu_check_true( Dictionary_Entry_Value_Compare( data->dict1->entryPtr[ii]->value, data->dict2->entryPtr[ii]->value) );
-      }
-   }
-
-   MPI_Barrier( data->comm );
-   if (data->rank==0) {
-      remove(xmlTestFilename);
-   }
-}
-
-
-/* Similar to above test, except using the function to write just one entry at a time */
-void IO_HandlerSuite_TestWriteReadNormalSingleEntry( IO_HandlerSuiteData* data ) {
-   Index          ii;
-   Name    fileName = "singleEntry.xml";
-   int          rank_I=0;
-
-   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
-
-   for (ii=0; ii<data->dict1->count; ii++) {
-      if (data->rank == 0) {
-         XML_IO_Handler_WriteEntryToFile( data->io_handler, fileName, data->testDD->testKeys[ii], data->testDD->testValues[ii], NULL );
-      }
-
-      for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
-         if ( rank_I == data->rank ) {
-            IO_Handler_ReadAllFromFile( data->io_handler, fileName, data->dict2 ); 
-         }
-         MPI_Barrier( data->comm );
-      }
-
-      pcu_check_true( 1 == data->dict2->count );
-      if ( 1 == data->dict2->count ) {
-         pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], data->testDD->testKeys[ii]) );
-         pcu_check_true( Dictionary_Entry_Value_Compare( data->dict2->entryPtr[0]->value, data->testDD->testValues[ii] ) );
-      }
-
-      Dictionary_Empty( data->dict2 );
-      MPI_Barrier( data->comm );
-      if ( data->rank == 0 ) {
-         remove(fileName);
-      }
-   }
-}
-
-
-/* Similar to above test, except test we can write out an empty Dictionary, then read in */
-void IO_HandlerSuite_TestWriteReadEmpty( IO_HandlerSuiteData* data ) {
-   Name    xmlTestFilename = "empty.xml";
-   FILE*          testFile = NULL;
-   const int      MAXLINE = 1000;
-   char*          xmlLine = NULL;
-   int          rank_I;
-
-   if (data->rank == 0) {
-      IO_Handler_WriteAllToFile( data->io_handler, xmlTestFilename, data->dict1 );
-   }
-
-   for (rank_I=0; rank_I<data->nProcs; rank_I++) {
-      if (rank_I==data->rank) {
-         testFile = fopen(xmlTestFilename, "r");
-         rewind( testFile );
-      }
-      MPI_Barrier(data->comm);
-   }
-   xmlLine = Memory_Alloc_Array_Unnamed( char, MAXLINE );
-   pcu_check_true( fgets( xmlLine, MAXLINE, testFile ) );
-   pcu_check_streq( IO_HandlerSuite_XMLStartString1, xmlLine );
-   pcu_check_true( fgets( xmlLine, MAXLINE, testFile ) );
-   pcu_check_streq( IO_HandlerSuite_XMLEmptyDataString, xmlLine );
-   Memory_Free( xmlLine );
-   fclose(testFile);
-
-   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
-      if ( rank_I == data->rank ) {
-         IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename, data->dict2 ); 
-      }
-      MPI_Barrier( data->comm );
-   }
-
-   pcu_check_true( 0 == data->dict2->count );
-
-   MPI_Barrier(data->comm);
-   if (data->rank == 0) {
-      remove(xmlTestFilename);
-   }
-}
-
-
-/* In this case, want to make sure the types are written explicitly into the output, so will
- * check against expected text. */
-void IO_HandlerSuite_TestWriteExplicitTypes( IO_HandlerSuiteData* data ) {
-   Name    testFilename = "xmlTest-explicittypes.xml";
-   char*          explicitTypesExpectedFilename = NULL;
-
-   Dictionary_Empty( data->dict1 );
-   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
-
-   XML_IO_Handler_SetWriteExplicitTypes( data->io_handler, True );
-   if (data->rank == 0) {
-      IO_Handler_WriteAllToFile( data->io_handler, testFilename, data->dict1 );
-   }
-
-   explicitTypesExpectedFilename = Memory_Alloc_Array_Unnamed( char, pcu_filename_expectedLen( "explicitTypesExpected.xml" ));
-   pcu_filename_expected( "explicitTypesExpected.xml", explicitTypesExpectedFilename );
-   pcu_check_fileEq( testFilename, explicitTypesExpectedFilename );
-
-   if (data->rank==0) {
-      remove(testFilename);
-   }
-   
-   Memory_Free( explicitTypesExpectedFilename );
-}
-
-
-void IO_HandlerSuite_TestReadWhitespaceEntries( IO_HandlerSuiteData* data ) {
-   Name       testFilename = "xmlTest-whitespaces.xml";
-   char*             whiteSpacesEntry = NULL;
-   Name       testKey = "spacedKey";
-   Name       testValString = "spacedVal";
-   int             rank_I;
-
-   if( data->rank==0 ) {
-      Stg_asprintf( &whiteSpacesEntry, "<param name=\"    %s   \"> \t %s \n\t</param>\n", testKey, testValString );
-      _IO_HandlerSuite_CreateTestXMLFile( testFilename, whiteSpacesEntry );
-      Memory_Free( whiteSpacesEntry );
-   }
-   MPI_Barrier(data->comm);
-
-   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
-      if ( rank_I == data->rank ) {
-         IO_Handler_ReadAllFromFile( data->io_handler, testFilename, data->dict2 ); 
-      }
-      MPI_Barrier( data->comm );
-   }
-
-   pcu_check_true( 1 == data->dict2->count );
-   if ( 1 == data->dict2->count ) {
-      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)testKey) );
-      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[0]->value ), testValString );
-   }
-
-   MPI_Barrier(data->comm);
-   if (data->rank==0) {
-      remove( testFilename );
-   }
-}
-
-
-/* Testing the functionality of using included files. Including specifying a search path */
-/* Note: it'd be good to use the PCU input fule capabilities, but unfortunately Scons glob doesn't seem to support
- * subdirectories currently. */
-void IO_HandlerSuite_TestReadIncludedFile( IO_HandlerSuiteData* data ) {
-   Name       testFilename = "xmlTest-include.xml";
-   Name       testIncludedFilename = "xmlTest-included.xml";
-   Name       testSearchPathSubdir = "./testXML-subdir";
-   Name       testIncludedFilenameSP = "xmlTest-includedSP.xml";
-   char*             subdirIncludedFilenameSP = NULL;
-   Name       testKey = "regularKey";
-   Name       testValString = "regularVal";
-   Name       testKeyInc = "keyInc";
-   Name       testValStringInc = "valInc";
-   Name       testKeyIncSP = "keyIncSP";
-   Name       testValStringIncSP = "valIncSP";
-   int             rank_I;
-
-   Stg_asprintf( &subdirIncludedFilenameSP, "%s/%s", testSearchPathSubdir, testIncludedFilenameSP );
-
-   if (data->rank==0) {
-      char*             xmlEntry = NULL;
-      char*             xmlTestEntries = NULL;
-      char*             includeLine = NULL;
-      char*             searchPathLine = NULL;
-      char*             includeLineSP = NULL;
-
-      Stg_asprintf( &xmlEntry, "<param name=\"%s\">%s</param>\n", testKey, testValString );
-      Stg_asprintf( &includeLine, "<include>%s</include>\n", testIncludedFilename );
-      Stg_asprintf( &searchPathLine, "<searchPath>%s</searchPath>\n", testSearchPathSubdir );
-      Stg_asprintf( &includeLineSP, "<include>%s</include>\n", testIncludedFilenameSP );
-      Stg_asprintf( &xmlTestEntries, "%s%s%s%s", xmlEntry, includeLine, searchPathLine, includeLineSP );
-      _IO_HandlerSuite_CreateTestXMLFile( testFilename, xmlTestEntries );
-      Memory_Free( xmlEntry );
-      Memory_Free( includeLine );
-      Memory_Free( searchPathLine );
-      Memory_Free( includeLineSP );
-      Memory_Free( xmlTestEntries );
-
-      Stg_asprintf( &xmlEntry, "<param name=\"%s\">%s</param>\n",
-         testKeyInc, testValStringInc );
-      _IO_HandlerSuite_CreateTestXMLFile( testIncludedFilename, xmlEntry );
-      Memory_Free( xmlEntry );
-
-      mkdir( testSearchPathSubdir, 0755 );
-      Stg_asprintf( &xmlEntry, "<param name=\"%s\">%s</param>\n",
-         testKeyIncSP, testValStringIncSP );
-      _IO_HandlerSuite_CreateTestXMLFile( subdirIncludedFilenameSP, xmlEntry );
-      Memory_Free( xmlEntry );
-   }
-   MPI_Barrier(data->comm);
-
-   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
-      if ( rank_I == data->rank ) {
-         IO_Handler_ReadAllFromFile( data->io_handler, testFilename, data->dict2 ); 
-      }
-      MPI_Barrier( data->comm );
-   }
-
-   pcu_check_true( 3 == data->dict2->count );
-   if ( 3 == data->dict2->count ) {
-      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)testKey) );
-      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[0]->value ), testValString );
-      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[1], (Dictionary_Entry_Key)testKeyInc) );
-      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[1]->value ), testValStringInc );
-      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[2], (Dictionary_Entry_Key)testKeyIncSP) );
-      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[2]->value ), testValStringIncSP );
-   }
-
-   MPI_Barrier(data->comm);
-   if (data->rank==0) {
-      remove( testFilename );
-      remove( testIncludedFilename );
-      remove( subdirIncludedFilenameSP );
-      rmdir( testSearchPathSubdir );
-   }
-   Memory_Free( subdirIncludedFilenameSP );
-}
-
-
-void IO_HandlerSuite_TestReadRawDataEntries( IO_HandlerSuiteData* data ) {
-   Index             ii;
-   char*             testFilename=NULL;
-   Name       list1Name = "bcs";
-   const unsigned    list1EntryCount = 2;
-   const int         list1Vals[2][3] = { {1, 3, 6}, {2, 9, 14} };
-   Name       list2Name = "boundary_conditions2";
-   const unsigned    list2EntryCount = 3;
-   Name       list2CompNames[5] = {"side", "xval", "yval", "zval", "active"};
-   Name       list2StringVals[3] = {"top", "bottom", "left"};
-   const int         list2CoordVals[3][3] = { {4,5,8}, {3,5,9}, {9,3,4} };
-   const Bool        list2BoolVals[3] = { True, False, True };
-   int             rank_I;
-
-   testFilename = Memory_Alloc_Array_Unnamed( char, pcu_filename_inputLen( "xmlTest-rawData.xml" ) );
-   pcu_filename_input( "xmlTest-rawData.xml", testFilename );
-
-   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
-      if ( rank_I == data->rank ) {
-         IO_Handler_ReadAllFromFile( data->io_handler, testFilename, data->dict2 ); 
-      }
-      MPI_Barrier( data->comm );
-   }
-
-   {
-      Dictionary_Entry_Value* dev = NULL;
-      int                     intVal = 0;
-      char*                   strVal = 0;
-      Bool                    boolVal = False;
-
-      pcu_check_true( 2 == data->dict2->count );
-      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)list1Name) );
-      pcu_check_true( Dictionary_Entry_Value_Type_List == data->dict2->entryPtr[0]->value->type );
-      for (ii=0; ii < list1EntryCount; ii++ ) {
-         dev = Dictionary_Entry_Value_GetElement( data->dict2->entryPtr[0]->value, ii );
-         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)"0" ) );
-         pcu_check_true( intVal == list1Vals[ii][0]  );
-         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)"1" ) );
-         pcu_check_true( intVal == list1Vals[ii][1]  );
-         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)"2" ) );
-         pcu_check_true( intVal == list1Vals[ii][2]  );
-      }
-      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[1],
-         (Dictionary_Entry_Key)list2Name) );
-      pcu_check_true( Dictionary_Entry_Value_Type_List ==
-         data->dict2->entryPtr[1]->value->type );
-      for (ii=0; ii < list2EntryCount; ii++ ) {
-         dev = Dictionary_Entry_Value_GetElement( data->dict2->entryPtr[1]->value, ii );
-         strVal = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[0] )  );
-         pcu_check_streq( list2StringVals[ii], strVal );
-         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[1] ) );
-         pcu_check_true( intVal == list2CoordVals[ii][0]  );
-         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[2] ) );
-         pcu_check_true( intVal == list2CoordVals[ii][1]  );
-         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[3] ) );
-         pcu_check_true( intVal == list2CoordVals[ii][2]  );
-         boolVal = Dictionary_Entry_Value_AsBool( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[4] ) );
-         pcu_check_true( boolVal == list2BoolVals[ii] );
-      }
-   }
-
-   MPI_Barrier(data->comm);
-   Memory_Free( testFilename );
-}
-
-
-void IO_HandlerSuite_TestReadAllFromCommandLine( IO_HandlerSuiteData* data  ) {
-   Index          ii;
-   char**         xmlTestFilenames;
-   int            argc;
-   char**         argv;
-   unsigned       fakeParamArgsCount = 2;
-   int            rank_I;
-   
-   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
-
-   xmlTestFilenames = Memory_Alloc_Array_Unnamed( char*, data->testDD->testEntriesCount );
-   argc = data->testDD->testEntriesCount + 1 + fakeParamArgsCount;
-   argv = Memory_Alloc_Array_Unnamed( char*, argc );
-
-      for ( ii=0; ii < data->testDD->testEntriesCount; ii++ ) {
-         Stg_asprintf( &xmlTestFilenames[ii], "readFromCommandLineTest%u.xml", ii );
-         if (data->rank == 0) {
-            XML_IO_Handler_WriteEntryToFile( data->io_handler, xmlTestFilenames[ii],
-               data->testDD->testKeys[ii],
-               data->testDD->testValues[ii], 
-               NULL );
-         }
-      }
-
-   /* Create the argv command line */
-   Stg_asprintf( &argv[0], "./testStGermain");
-   for ( ii=0; ii < data->testDD->testEntriesCount; ii++ ) {
-      Stg_asprintf( &argv[1+ii], "%s", xmlTestFilenames[ii] );
-   }
-   /* Now just add a couple of extra cmd line entries, to simulate user passing other 
-    *  parameters, which should be ignored by the XML IO Handler */
-   for ( ii=0; ii < fakeParamArgsCount; ii++ ) {
-      Stg_asprintf( &argv[1+data->testDD->testEntriesCount+ii], "simParam%u=test", ii );
-   }
-
-   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
-      if ( rank_I == data->rank ) {
-         IO_Handler_ReadAllFilesFromCommandLine( data->io_handler, argc, argv, data->dict2 );
-      }
-      MPI_Barrier( data->comm );
-   }
-
-   /* Now, dict2 should correspond to dict1, having read in and combined all the
-    *  separate files. */
-   pcu_check_true( data->dict1->count == data->dict2->count );
-   for (ii=0; ii<data->dict1->count; ii++) {
-      pcu_check_true( Dictionary_Entry_Compare( data->dict1->entryPtr[ii], data->dict2->entryPtr[ii]->key) );
-      pcu_check_true( Dictionary_Entry_Value_Compare( data->dict1->entryPtr[ii]->value, data->dict2->entryPtr[ii]->value) );
-   }
-
-
-   MPI_Barrier(data->comm);
-   for ( ii=0; ii < data->testDD->testEntriesCount; ii++ ) {
-      if (data->rank==0) {
-         remove(xmlTestFilenames[ii]);
-      }
-      Memory_Free( xmlTestFilenames[ii] );
-   }
-   Memory_Free( xmlTestFilenames );
-   for ( ii=0; ii < (unsigned)argc; ii++ ) {
-      Memory_Free( argv[ii] );
-   }
-   Memory_Free( argv );
-}
-
-
-/* It's only worthwhile to test the different mergeType operations for one type (eg struct)
- * in this test - the thorough testing of all the merge operations themselves should be 
- * done in DictionarySuite.c */
-void IO_HandlerSuite_TestReadDuplicateEntryKeys( IO_HandlerSuiteData* data ) {
-   Index                   ii=0;
-   char                    xmlTestFilename1[PCU_PATH_MAX];
-   char                    xmlTestFilename2[PCU_PATH_MAX];
-   char                    xmlTestFilename3_1[PCU_PATH_MAX];
-   char                    xmlTestFilename3_2[PCU_PATH_MAX];
-   Name             struct1Name = "structOne";
-   const unsigned          struct1_OrigParamCount = 2;
-   Name             paramNames[2] = { "paramOne", "paramTwo" };
-   Name             paramNames2[2] = { "2nd-paramOne", "2nd-paramTwo" };
-   const unsigned int      paramVals[2] = { 1, 2 };
-   const unsigned int      paramVals2[2] = { 3, 4 };
-   Dictionary_Entry_Value* structDev = NULL;
-   Dictionary_Entry_Value* elementDev = NULL;
-   Dictionary*             structDict = NULL;
-
-   /* Only do this test for processor 0, to avoid probs with multiple opens */
-   if ( data->rank != 0 ) return;
-   
-   /* Sub-test 1: we expect default behaviour is "replace", therefore the 2nd struct
-    *  should be the only entry */
-   pcu_check_true( IO_Handler_DefaultMergeType == Dictionary_MergeType_Replace );
-
-   pcu_filename_input( "testXML-dupKeys-1.xml", xmlTestFilename1 );
-   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename1, data->dict2 );
-
-   pcu_check_true( 1 == data->dict2->count );
-   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
-   structDev = data->dict2->entryPtr[0]->value;
-   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
-   pcu_check_true( struct1_OrigParamCount == Dictionary_Entry_Value_GetCount( structDev ) );
-   for (ii=0; ii < struct1_OrigParamCount; ii++ ) {
-      elementDev = Dictionary_Entry_Value_GetMember( structDev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)paramNames2[ii] );
-      pcu_check_true( paramVals2[ii] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   }
-   Dictionary_Empty( data->dict2  );
-
-   /* Sub-test 2: with mergeType as "append", the 2 structs should be 2 separate entries */
-   pcu_filename_input( "testXML-dupKeys-2.xml", xmlTestFilename2 );
-   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename2, data->dict2 );
-
-   pcu_check_true( 2 == data->dict2->count );
-   /* First entry should be unchanged */
-   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
-   structDev = data->dict2->entryPtr[0]->value;
-   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
-   pcu_check_true( struct1_OrigParamCount == Dictionary_Entry_Value_GetCount( structDev ) );
-   for (ii=0; ii < struct1_OrigParamCount; ii++ ) {
-      elementDev = Dictionary_Entry_Value_GetMember( structDev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)paramNames[ii] );
-      pcu_check_true( paramVals[ii] == Dictionary_Entry_Value_AsUnsignedInt( elementDev )  );
-   }
-   /* Second entry should be struct2 */
-   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[1], (Dictionary_Entry_Key)struct1Name) );
-   structDev = data->dict2->entryPtr[1]->value;
-   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
-   pcu_check_true( struct1_OrigParamCount == Dictionary_Entry_Value_GetCount( structDev ) );
-   for (ii=0; ii < struct1_OrigParamCount; ii++ ) {
-      elementDev = Dictionary_Entry_Value_GetMember( structDev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)paramNames[ii] );
-      pcu_check_true( paramVals2[ii] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   }
-   Dictionary_Empty( data->dict2  );
-
-   /* Sub-test 3.1: with mergeType as "merge", structs to be merged.
-    * However, default childrenMergeType is "append", so all entries added */
-   pcu_filename_input( "testXML-dupKeys-3_1.xml", xmlTestFilename3_1 );
-   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename3_1, data->dict2 );
-
-   pcu_check_true( 1 == data->dict2->count );
-   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
-   structDev = data->dict2->entryPtr[0]->value;
-   structDict = structDev->as.typeStruct;
-   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
-   pcu_check_true( struct1_OrigParamCount*2 == Dictionary_Entry_Value_GetCount( structDev ) );
-   pcu_check_streq( structDict->entryPtr[0]->key, paramNames[0] );
-   elementDev = structDict->entryPtr[0]->value;
-   pcu_check_true( paramVals[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   pcu_check_streq( structDict->entryPtr[1]->key, paramNames[1] );
-   elementDev = structDict->entryPtr[1]->value;
-   pcu_check_true( paramVals[1] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   pcu_check_streq( structDict->entryPtr[2]->key, paramNames[1] );
-   elementDev = structDict->entryPtr[2]->value;
-   pcu_check_true( paramVals2[1] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   pcu_check_streq( structDict->entryPtr[3]->key, paramNames2[0] );
-   elementDev = structDict->entryPtr[3]->value;
-   pcu_check_true( paramVals2[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   Dictionary_Empty( data->dict2 );
-
-   /* Sub-test 3.2: with mergeType as "merge", structs to be merged.
-    * childrenMergeType set to merge also */
-   pcu_filename_input( "testXML-dupKeys-3_2.xml", xmlTestFilename3_2 );
-   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename3_2, data->dict2 );
-
-   pcu_check_true( 1 == data->dict2->count );
-   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
-   structDev = data->dict2->entryPtr[0]->value;
-   structDict = structDev->as.typeStruct;
-   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
-   pcu_check_true( struct1_OrigParamCount+1 == Dictionary_Entry_Value_GetCount( structDev ) );
-   pcu_check_streq( structDict->entryPtr[0]->key, paramNames[0] );
-   elementDev = structDict->entryPtr[0]->value;
-   pcu_check_true( paramVals[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   pcu_check_streq( structDict->entryPtr[1]->key, paramNames[1] );
-   elementDev = structDict->entryPtr[1]->value;
-   pcu_check_true( paramVals2[1] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-   pcu_check_streq( structDict->entryPtr[2]->key, paramNames2[0] );
-   elementDev = structDict->entryPtr[2]->value;
-   pcu_check_true( paramVals2[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
-}
-
-
-void IO_HandlerSuite_TestReadNonExistent( IO_HandlerSuiteData* data ) {
-   char*		errorFilename;
-   Name		notExistFilename = "I_Dont_Exist.xml";
-   FILE*		errorFile;
-   #define	MAXLINE 1000
-   char		errorLine[MAXLINE];
-   char		expectedErrorMsg[MAXLINE];
-
-   Stg_asprintf( &errorFilename, "./errorMsg-NonExist-%d.txt", data->rank );
-   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
-   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
-
-   if (0 == data->rank ) {
-		#ifdef DEBUG
-			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, notExistFilename, data->dict2 ) );
-		#else
-			IO_Handler_ReadAllFromFile( data->io_handler, notExistFilename, data->dict2 );
-		#endif
-      errorFile = fopen( errorFilename, "r" );
-      pcu_check_true( errorFile );
-
-      pcu_check_true( fgets( errorLine, MAXLINE, errorFile ) );
-      sprintf( expectedErrorMsg, "Error: File %s doesn't exist, not readable, or not valid.\n", notExistFilename );
-      pcu_check_streq( errorLine, expectedErrorMsg );
-      remove( errorFilename );
-   }
-}
-
-
-void IO_HandlerSuite_TestReadInvalid( IO_HandlerSuiteData* data ) {
-   char              invalidXMLFilename[PCU_PATH_MAX];
-   char              expectedErrorFilename[PCU_PATH_MAX];
-   const Name       errorFilename = "errorMsg-Invalid.txt";
-
-   pcu_filename_input( "Invalid.xml", invalidXMLFilename );
-   pcu_filename_expected( errorFilename, expectedErrorFilename );
-
-   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
-   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
-
-   if ( 0 == data->rank  ) {
-		#ifdef DEBUG
-			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, invalidXMLFilename, data->dict2 ) );
-		#else
-			IO_Handler_ReadAllFromFile( data->io_handler, invalidXMLFilename, data->dict2 );
-		#endif
-      pcu_check_fileEq( errorFilename, expectedErrorFilename );
-      remove( errorFilename );
-   }
-}
-
-
-void IO_HandlerSuite_TestReadWrongNS( IO_HandlerSuiteData* data ) {
-   char              wrongNS_XMLFilename[PCU_PATH_MAX];
-   char              expectedErrorFilename[PCU_PATH_MAX];
-   const Name       errorFilename = "errorMsg-wrongNS.txt";
-
-   pcu_filename_input( "WrongNS.xml", wrongNS_XMLFilename );
-   pcu_filename_expected( errorFilename, expectedErrorFilename );
-
-   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
-   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
-
-   if ( 0 == data->rank  ) {
-		#ifdef DEBUG
-			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, wrongNS_XMLFilename, data->dict2 ) );
-		#else
-			IO_Handler_ReadAllFromFile( data->io_handler, wrongNS_XMLFilename, data->dict2 );
-		#endif
-      pcu_check_fileEq( errorFilename, expectedErrorFilename );
-      remove( errorFilename );
-   }
-}
-
-
-void IO_HandlerSuite_TestReadWrongRootNode( IO_HandlerSuiteData* data ) {
-   char          wrongRootNode_XMLFilename[PCU_PATH_MAX];
-   char          expectedErrorFilename[PCU_PATH_MAX];
-   const Name   errorFilename = "./errorMsg-wrongRootNode.txt";
-
-   pcu_filename_input( "WrongRootNode.xml", wrongRootNode_XMLFilename );
-   pcu_filename_expected( errorFilename, expectedErrorFilename );
-
-   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
-   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
-
-   if ( 0 == data->rank  ) {
-		#ifdef DEBUG
-			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, wrongRootNode_XMLFilename, data->dict2 ) );
-		#else
-			IO_Handler_ReadAllFromFile( data->io_handler, wrongRootNode_XMLFilename, data->dict2 );
-		#endif
-      pcu_check_fileEq( errorFilename, expectedErrorFilename ); 
-      remove( errorFilename );
-   }
-}
-
-
-void IO_HandlerSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, IO_HandlerSuiteData );
-   pcu_suite_setFixtures( suite, IO_HandlerSuite_Setup, IO_HandlerSuite_Teardown );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteReadNormalEntries );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteReadNormalSingleEntry );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteReadEmpty );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteExplicitTypes );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadWhitespaceEntries );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadIncludedFile );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadRawDataEntries );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadAllFromCommandLine );
-   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadDuplicateEntryKeys );
-   /* pcu_suite_addTest( suite, IO_HandlerSuite_TestReadNonExistent ); */
-   /*pcu_suite_addTest( suite, IO_HandlerSuite_TestReadInvalid );*/
-   /*pcu_suite_addTest( suite, IO_HandlerSuite_TestReadWrongNS );*/
-   /*pcu_suite_addTest( suite, IO_HandlerSuite_TestReadWrongRootNode );*/
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/IO_HandlerSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/tests/IO_HandlerSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,713 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests the IO handler
+**
+** $Id: testIO_Handler-normal.c 3743 2006-08-03 03:14:38Z KentHumphries $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "DictionarySuite.h"  /* Because want to re-use sample dictionary structs/funcs */
+#include "IO_HandlerSuite.h"
+
+
+Name IO_HandlerSuite_XMLStartString1 = "<?xml version=\"1.0\"?>\n";
+Name IO_HandlerSuite_XMLStartString2 = "<StGermainData xmlns=\"http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003\">\n";
+Name IO_HandlerSuite_XMLEndString = "</StGermainData>\n";
+Name IO_HandlerSuite_XMLEmptyDataString = "<StGermainData xmlns=\"http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003\"/>\n";
+
+typedef struct {
+   XML_IO_Handler*                  io_handler;
+   Dictionary*                      dict1;
+   Dictionary*                      dict2;
+   DictionarySuite_TestDictData*    testDD;
+   int										rank;
+   int										nProcs;
+   MPI_Comm                         comm;
+} IO_HandlerSuiteData;
+
+
+void _IO_HandlerSuite_CreateTestXMLFile( Name testXMLFilename, const char* entriesString ) {
+   FILE*         testFile = NULL;
+   testFile = fopen(testXMLFilename, "w");
+   fwrite( IO_HandlerSuite_XMLStartString1, sizeof(char), strlen( IO_HandlerSuite_XMLStartString1 ), testFile );
+   fwrite( IO_HandlerSuite_XMLStartString2, sizeof(char), strlen( IO_HandlerSuite_XMLStartString2 ), testFile );
+   fwrite( entriesString, sizeof(char), strlen( entriesString ), testFile );
+   fwrite( IO_HandlerSuite_XMLEndString, sizeof(char), strlen( IO_HandlerSuite_XMLEndString ), testFile );
+   fclose( testFile );
+}
+
+
+void IO_HandlerSuite_Setup( IO_HandlerSuiteData* data ) {
+   data->comm = MPI_COMM_WORLD;
+   MPI_Comm_rank( data->comm, &data->rank );
+   MPI_Comm_size( data->comm, &data->nProcs );
+
+   data->io_handler = XML_IO_Handler_New();
+   /* We don't want output in the tests by default */
+   Stream_Enable( Journal_Register( Debug_Type, (Name)XML_IO_Handler_Type  ), False );
+   Stream_Enable( Journal_Register( Info_Type, (Name)XML_IO_Handler_Type  ), False );
+   data->dict1 = Dictionary_New();
+   data->dict2 = Dictionary_New();
+   data->testDD   = Memory_Alloc_Unnamed( DictionarySuite_TestDictData );
+   DictionarySuite_SetupTestDictData( data->testDD );
+}
+
+
+void IO_HandlerSuite_Teardown( IO_HandlerSuiteData* data ) {
+   Stg_Class_Delete( data->io_handler );
+   Stg_Class_Delete( data->dict1 );
+   Stg_Class_Delete( data->dict2 );
+   DictionarySuite_DictionaryData_Free( data->testDD );
+   Memory_Free( data->testDD );
+}
+
+
+/* Just populate a test dictionary, write it out to a file, read it back in again to a different dict, and check all the values are the same */
+void IO_HandlerSuite_TestWriteReadNormalEntries( IO_HandlerSuiteData* data ) {
+   Index         ii;
+   Name   xmlTestFilename = "xmlTest.xml";
+   int         rank_I=0;
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
+
+   if (data->rank == 0) {
+      IO_Handler_WriteAllToFile( data->io_handler, xmlTestFilename, data->dict1 );
+   }
+
+   for(rank_I=0; rank_I<data->nProcs;rank_I++) {
+      if ( rank_I == data->rank ) {
+         IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename, data->dict2 ); 
+      }
+      MPI_Barrier( data->comm );
+   }
+
+   pcu_check_true( data->dict1->count == data->dict2->count );
+   if ( data->dict1->count == data->dict2->count ) {
+      for (ii=0; ii<data->dict1->count; ii++) {
+         pcu_check_true( Dictionary_Entry_Compare( data->dict1->entryPtr[ii], data->dict2->entryPtr[ii]->key) );
+         pcu_check_true( Dictionary_Entry_Value_Compare( data->dict1->entryPtr[ii]->value, data->dict2->entryPtr[ii]->value) );
+      }
+   }
+
+   MPI_Barrier( data->comm );
+   if (data->rank==0) {
+      remove(xmlTestFilename);
+   }
+}
+
+
+/* Similar to above test, except using the function to write just one entry at a time */
+void IO_HandlerSuite_TestWriteReadNormalSingleEntry( IO_HandlerSuiteData* data ) {
+   Index          ii;
+   Name    fileName = "singleEntry.xml";
+   int          rank_I=0;
+
+   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
+
+   for (ii=0; ii<data->dict1->count; ii++) {
+      if (data->rank == 0) {
+         XML_IO_Handler_WriteEntryToFile( data->io_handler, fileName, data->testDD->testKeys[ii], data->testDD->testValues[ii], NULL );
+      }
+
+      for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
+         if ( rank_I == data->rank ) {
+            IO_Handler_ReadAllFromFile( data->io_handler, fileName, data->dict2 ); 
+         }
+         MPI_Barrier( data->comm );
+      }
+
+      pcu_check_true( 1 == data->dict2->count );
+      if ( 1 == data->dict2->count ) {
+         pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], data->testDD->testKeys[ii]) );
+         pcu_check_true( Dictionary_Entry_Value_Compare( data->dict2->entryPtr[0]->value, data->testDD->testValues[ii] ) );
+      }
+
+      Dictionary_Empty( data->dict2 );
+      MPI_Barrier( data->comm );
+      if ( data->rank == 0 ) {
+         remove(fileName);
+      }
+   }
+}
+
+
+/* Similar to above test, except test we can write out an empty Dictionary, then read in */
+void IO_HandlerSuite_TestWriteReadEmpty( IO_HandlerSuiteData* data ) {
+   Name    xmlTestFilename = "empty.xml";
+   FILE*          testFile = NULL;
+   const int      MAXLINE = 1000;
+   char*          xmlLine = NULL;
+   int          rank_I;
+
+   if (data->rank == 0) {
+      IO_Handler_WriteAllToFile( data->io_handler, xmlTestFilename, data->dict1 );
+   }
+
+   for (rank_I=0; rank_I<data->nProcs; rank_I++) {
+      if (rank_I==data->rank) {
+         testFile = fopen(xmlTestFilename, "r");
+         rewind( testFile );
+      }
+      MPI_Barrier(data->comm);
+   }
+   xmlLine = Memory_Alloc_Array_Unnamed( char, MAXLINE );
+   pcu_check_true( fgets( xmlLine, MAXLINE, testFile ) );
+   pcu_check_streq( IO_HandlerSuite_XMLStartString1, xmlLine );
+   pcu_check_true( fgets( xmlLine, MAXLINE, testFile ) );
+   pcu_check_streq( IO_HandlerSuite_XMLEmptyDataString, xmlLine );
+   Memory_Free( xmlLine );
+   fclose(testFile);
+
+   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
+      if ( rank_I == data->rank ) {
+         IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename, data->dict2 ); 
+      }
+      MPI_Barrier( data->comm );
+   }
+
+   pcu_check_true( 0 == data->dict2->count );
+
+   MPI_Barrier(data->comm);
+   if (data->rank == 0) {
+      remove(xmlTestFilename);
+   }
+}
+
+
+/* In this case, want to make sure the types are written explicitly into the output, so will
+ * check against expected text. */
+void IO_HandlerSuite_TestWriteExplicitTypes( IO_HandlerSuiteData* data ) {
+   Name    testFilename = "xmlTest-explicittypes.xml";
+   char*          explicitTypesExpectedFilename = NULL;
+
+   Dictionary_Empty( data->dict1 );
+   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
+
+   XML_IO_Handler_SetWriteExplicitTypes( data->io_handler, True );
+   if (data->rank == 0) {
+      IO_Handler_WriteAllToFile( data->io_handler, testFilename, data->dict1 );
+   }
+
+   explicitTypesExpectedFilename = Memory_Alloc_Array_Unnamed( char, pcu_filename_expectedLen( "explicitTypesExpected.xml" ));
+   pcu_filename_expected( "explicitTypesExpected.xml", explicitTypesExpectedFilename );
+   pcu_check_fileEq( testFilename, explicitTypesExpectedFilename );
+
+   if (data->rank==0) {
+      remove(testFilename);
+   }
+   
+   Memory_Free( explicitTypesExpectedFilename );
+}
+
+
+void IO_HandlerSuite_TestReadWhitespaceEntries( IO_HandlerSuiteData* data ) {
+   Name       testFilename = "xmlTest-whitespaces.xml";
+   char*             whiteSpacesEntry = NULL;
+   Name       testKey = "spacedKey";
+   Name       testValString = "spacedVal";
+   int             rank_I;
+
+   if( data->rank==0 ) {
+      Stg_asprintf( &whiteSpacesEntry, "<param name=\"    %s   \"> \t %s \n\t</param>\n", testKey, testValString );
+      _IO_HandlerSuite_CreateTestXMLFile( testFilename, whiteSpacesEntry );
+      Memory_Free( whiteSpacesEntry );
+   }
+   MPI_Barrier(data->comm);
+
+   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
+      if ( rank_I == data->rank ) {
+         IO_Handler_ReadAllFromFile( data->io_handler, testFilename, data->dict2 ); 
+      }
+      MPI_Barrier( data->comm );
+   }
+
+   pcu_check_true( 1 == data->dict2->count );
+   if ( 1 == data->dict2->count ) {
+      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)testKey) );
+      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[0]->value ), testValString );
+   }
+
+   MPI_Barrier(data->comm);
+   if (data->rank==0) {
+      remove( testFilename );
+   }
+}
+
+
+/* Testing the functionality of using included files. Including specifying a search path */
+/* Note: it'd be good to use the PCU input fule capabilities, but unfortunately Scons glob doesn't seem to support
+ * subdirectories currently. */
+void IO_HandlerSuite_TestReadIncludedFile( IO_HandlerSuiteData* data ) {
+   Name       testFilename = "xmlTest-include.xml";
+   Name       testIncludedFilename = "xmlTest-included.xml";
+   Name       testSearchPathSubdir = "./testXML-subdir";
+   Name       testIncludedFilenameSP = "xmlTest-includedSP.xml";
+   char*             subdirIncludedFilenameSP = NULL;
+   Name       testKey = "regularKey";
+   Name       testValString = "regularVal";
+   Name       testKeyInc = "keyInc";
+   Name       testValStringInc = "valInc";
+   Name       testKeyIncSP = "keyIncSP";
+   Name       testValStringIncSP = "valIncSP";
+   int             rank_I;
+
+   Stg_asprintf( &subdirIncludedFilenameSP, "%s/%s", testSearchPathSubdir, testIncludedFilenameSP );
+
+   if (data->rank==0) {
+      char*             xmlEntry = NULL;
+      char*             xmlTestEntries = NULL;
+      char*             includeLine = NULL;
+      char*             searchPathLine = NULL;
+      char*             includeLineSP = NULL;
+
+      Stg_asprintf( &xmlEntry, "<param name=\"%s\">%s</param>\n", testKey, testValString );
+      Stg_asprintf( &includeLine, "<include>%s</include>\n", testIncludedFilename );
+      Stg_asprintf( &searchPathLine, "<searchPath>%s</searchPath>\n", testSearchPathSubdir );
+      Stg_asprintf( &includeLineSP, "<include>%s</include>\n", testIncludedFilenameSP );
+      Stg_asprintf( &xmlTestEntries, "%s%s%s%s", xmlEntry, includeLine, searchPathLine, includeLineSP );
+      _IO_HandlerSuite_CreateTestXMLFile( testFilename, xmlTestEntries );
+      Memory_Free( xmlEntry );
+      Memory_Free( includeLine );
+      Memory_Free( searchPathLine );
+      Memory_Free( includeLineSP );
+      Memory_Free( xmlTestEntries );
+
+      Stg_asprintf( &xmlEntry, "<param name=\"%s\">%s</param>\n",
+         testKeyInc, testValStringInc );
+      _IO_HandlerSuite_CreateTestXMLFile( testIncludedFilename, xmlEntry );
+      Memory_Free( xmlEntry );
+
+      mkdir( testSearchPathSubdir, 0755 );
+      Stg_asprintf( &xmlEntry, "<param name=\"%s\">%s</param>\n",
+         testKeyIncSP, testValStringIncSP );
+      _IO_HandlerSuite_CreateTestXMLFile( subdirIncludedFilenameSP, xmlEntry );
+      Memory_Free( xmlEntry );
+   }
+   MPI_Barrier(data->comm);
+
+   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
+      if ( rank_I == data->rank ) {
+         IO_Handler_ReadAllFromFile( data->io_handler, testFilename, data->dict2 ); 
+      }
+      MPI_Barrier( data->comm );
+   }
+
+   pcu_check_true( 3 == data->dict2->count );
+   if ( 3 == data->dict2->count ) {
+      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)testKey) );
+      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[0]->value ), testValString );
+      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[1], (Dictionary_Entry_Key)testKeyInc) );
+      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[1]->value ), testValStringInc );
+      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[2], (Dictionary_Entry_Key)testKeyIncSP) );
+      pcu_check_streq( Dictionary_Entry_Value_AsString( data->dict2->entryPtr[2]->value ), testValStringIncSP );
+   }
+
+   MPI_Barrier(data->comm);
+   if (data->rank==0) {
+      remove( testFilename );
+      remove( testIncludedFilename );
+      remove( subdirIncludedFilenameSP );
+      rmdir( testSearchPathSubdir );
+   }
+   Memory_Free( subdirIncludedFilenameSP );
+}
+
+
+void IO_HandlerSuite_TestReadRawDataEntries( IO_HandlerSuiteData* data ) {
+   Index             ii;
+   char*             testFilename=NULL;
+   Name       list1Name = "bcs";
+   const unsigned    list1EntryCount = 2;
+   const int         list1Vals[2][3] = { {1, 3, 6}, {2, 9, 14} };
+   Name       list2Name = "boundary_conditions2";
+   const unsigned    list2EntryCount = 3;
+   Name       list2CompNames[5] = {"side", "xval", "yval", "zval", "active"};
+   Name       list2StringVals[3] = {"top", "bottom", "left"};
+   const int         list2CoordVals[3][3] = { {4,5,8}, {3,5,9}, {9,3,4} };
+   const Bool        list2BoolVals[3] = { True, False, True };
+   int             rank_I;
+
+   testFilename = Memory_Alloc_Array_Unnamed( char, pcu_filename_inputLen( "xmlTest-rawData.xml" ) );
+   pcu_filename_input( "xmlTest-rawData.xml", testFilename );
+
+   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
+      if ( rank_I == data->rank ) {
+         IO_Handler_ReadAllFromFile( data->io_handler, testFilename, data->dict2 ); 
+      }
+      MPI_Barrier( data->comm );
+   }
+
+   {
+      Dictionary_Entry_Value* dev = NULL;
+      int                     intVal = 0;
+      char*                   strVal = 0;
+      Bool                    boolVal = False;
+
+      pcu_check_true( 2 == data->dict2->count );
+      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)list1Name) );
+      pcu_check_true( Dictionary_Entry_Value_Type_List == data->dict2->entryPtr[0]->value->type );
+      for (ii=0; ii < list1EntryCount; ii++ ) {
+         dev = Dictionary_Entry_Value_GetElement( data->dict2->entryPtr[0]->value, ii );
+         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)"0" ) );
+         pcu_check_true( intVal == list1Vals[ii][0]  );
+         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)"1" ) );
+         pcu_check_true( intVal == list1Vals[ii][1]  );
+         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)"2" ) );
+         pcu_check_true( intVal == list1Vals[ii][2]  );
+      }
+      pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[1],
+         (Dictionary_Entry_Key)list2Name) );
+      pcu_check_true( Dictionary_Entry_Value_Type_List ==
+         data->dict2->entryPtr[1]->value->type );
+      for (ii=0; ii < list2EntryCount; ii++ ) {
+         dev = Dictionary_Entry_Value_GetElement( data->dict2->entryPtr[1]->value, ii );
+         strVal = Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[0] )  );
+         pcu_check_streq( list2StringVals[ii], strVal );
+         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[1] ) );
+         pcu_check_true( intVal == list2CoordVals[ii][0]  );
+         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[2] ) );
+         pcu_check_true( intVal == list2CoordVals[ii][1]  );
+         intVal = Dictionary_Entry_Value_AsInt( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[3] ) );
+         pcu_check_true( intVal == list2CoordVals[ii][2]  );
+         boolVal = Dictionary_Entry_Value_AsBool( Dictionary_Entry_Value_GetMember( dev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)list2CompNames[4] ) );
+         pcu_check_true( boolVal == list2BoolVals[ii] );
+      }
+   }
+
+   MPI_Barrier(data->comm);
+   Memory_Free( testFilename );
+}
+
+
+void IO_HandlerSuite_TestReadAllFromCommandLine( IO_HandlerSuiteData* data  ) {
+   Index          ii;
+   char**         xmlTestFilenames;
+   int            argc;
+   char**         argv;
+   unsigned       fakeParamArgsCount = 2;
+   int            rank_I;
+   
+   DictionarySuite_PopulateDictWithTestValues( data->dict1, data->testDD );
+
+   xmlTestFilenames = Memory_Alloc_Array_Unnamed( char*, data->testDD->testEntriesCount );
+   argc = data->testDD->testEntriesCount + 1 + fakeParamArgsCount;
+   argv = Memory_Alloc_Array_Unnamed( char*, argc );
+
+      for ( ii=0; ii < data->testDD->testEntriesCount; ii++ ) {
+         Stg_asprintf( &xmlTestFilenames[ii], "readFromCommandLineTest%u.xml", ii );
+         if (data->rank == 0) {
+            XML_IO_Handler_WriteEntryToFile( data->io_handler, xmlTestFilenames[ii],
+               data->testDD->testKeys[ii],
+               data->testDD->testValues[ii], 
+               NULL );
+         }
+      }
+
+   /* Create the argv command line */
+   Stg_asprintf( &argv[0], "./testStGermain");
+   for ( ii=0; ii < data->testDD->testEntriesCount; ii++ ) {
+      Stg_asprintf( &argv[1+ii], "%s", xmlTestFilenames[ii] );
+   }
+   /* Now just add a couple of extra cmd line entries, to simulate user passing other 
+    *  parameters, which should be ignored by the XML IO Handler */
+   for ( ii=0; ii < fakeParamArgsCount; ii++ ) {
+      Stg_asprintf( &argv[1+data->testDD->testEntriesCount+ii], "simParam%u=test", ii );
+   }
+
+   for ( rank_I=0; rank_I< data->nProcs; rank_I++ ) {
+      if ( rank_I == data->rank ) {
+         IO_Handler_ReadAllFilesFromCommandLine( data->io_handler, argc, argv, data->dict2 );
+      }
+      MPI_Barrier( data->comm );
+   }
+
+   /* Now, dict2 should correspond to dict1, having read in and combined all the
+    *  separate files. */
+   pcu_check_true( data->dict1->count == data->dict2->count );
+   for (ii=0; ii<data->dict1->count; ii++) {
+      pcu_check_true( Dictionary_Entry_Compare( data->dict1->entryPtr[ii], data->dict2->entryPtr[ii]->key) );
+      pcu_check_true( Dictionary_Entry_Value_Compare( data->dict1->entryPtr[ii]->value, data->dict2->entryPtr[ii]->value) );
+   }
+
+
+   MPI_Barrier(data->comm);
+   for ( ii=0; ii < data->testDD->testEntriesCount; ii++ ) {
+      if (data->rank==0) {
+         remove(xmlTestFilenames[ii]);
+      }
+      Memory_Free( xmlTestFilenames[ii] );
+   }
+   Memory_Free( xmlTestFilenames );
+   for ( ii=0; ii < (unsigned)argc; ii++ ) {
+      Memory_Free( argv[ii] );
+   }
+   Memory_Free( argv );
+}
+
+
+/* It's only worthwhile to test the different mergeType operations for one type (eg struct)
+ * in this test - the thorough testing of all the merge operations themselves should be 
+ * done in DictionarySuite.c */
+void IO_HandlerSuite_TestReadDuplicateEntryKeys( IO_HandlerSuiteData* data ) {
+   Index                   ii=0;
+   char                    xmlTestFilename1[PCU_PATH_MAX];
+   char                    xmlTestFilename2[PCU_PATH_MAX];
+   char                    xmlTestFilename3_1[PCU_PATH_MAX];
+   char                    xmlTestFilename3_2[PCU_PATH_MAX];
+   Name             struct1Name = "structOne";
+   const unsigned          struct1_OrigParamCount = 2;
+   Name             paramNames[2] = { "paramOne", "paramTwo" };
+   Name             paramNames2[2] = { "2nd-paramOne", "2nd-paramTwo" };
+   const unsigned int      paramVals[2] = { 1, 2 };
+   const unsigned int      paramVals2[2] = { 3, 4 };
+   Dictionary_Entry_Value* structDev = NULL;
+   Dictionary_Entry_Value* elementDev = NULL;
+   Dictionary*             structDict = NULL;
+
+   /* Only do this test for processor 0, to avoid probs with multiple opens */
+   if ( data->rank != 0 ) return;
+   
+   /* Sub-test 1: we expect default behaviour is "replace", therefore the 2nd struct
+    *  should be the only entry */
+   pcu_check_true( IO_Handler_DefaultMergeType == Dictionary_MergeType_Replace );
+
+   pcu_filename_input( "testXML-dupKeys-1.xml", xmlTestFilename1 );
+   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename1, data->dict2 );
+
+   pcu_check_true( 1 == data->dict2->count );
+   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
+   structDev = data->dict2->entryPtr[0]->value;
+   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
+   pcu_check_true( struct1_OrigParamCount == Dictionary_Entry_Value_GetCount( structDev ) );
+   for (ii=0; ii < struct1_OrigParamCount; ii++ ) {
+      elementDev = Dictionary_Entry_Value_GetMember( structDev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)paramNames2[ii] );
+      pcu_check_true( paramVals2[ii] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   }
+   Dictionary_Empty( data->dict2  );
+
+   /* Sub-test 2: with mergeType as "append", the 2 structs should be 2 separate entries */
+   pcu_filename_input( "testXML-dupKeys-2.xml", xmlTestFilename2 );
+   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename2, data->dict2 );
+
+   pcu_check_true( 2 == data->dict2->count );
+   /* First entry should be unchanged */
+   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
+   structDev = data->dict2->entryPtr[0]->value;
+   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
+   pcu_check_true( struct1_OrigParamCount == Dictionary_Entry_Value_GetCount( structDev ) );
+   for (ii=0; ii < struct1_OrigParamCount; ii++ ) {
+      elementDev = Dictionary_Entry_Value_GetMember( structDev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)paramNames[ii] );
+      pcu_check_true( paramVals[ii] == Dictionary_Entry_Value_AsUnsignedInt( elementDev )  );
+   }
+   /* Second entry should be struct2 */
+   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[1], (Dictionary_Entry_Key)struct1Name) );
+   structDev = data->dict2->entryPtr[1]->value;
+   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
+   pcu_check_true( struct1_OrigParamCount == Dictionary_Entry_Value_GetCount( structDev ) );
+   for (ii=0; ii < struct1_OrigParamCount; ii++ ) {
+      elementDev = Dictionary_Entry_Value_GetMember( structDev, (Dictionary_Entry_Key)(Dictionary_Entry_Key)paramNames[ii] );
+      pcu_check_true( paramVals2[ii] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   }
+   Dictionary_Empty( data->dict2  );
+
+   /* Sub-test 3.1: with mergeType as "merge", structs to be merged.
+    * However, default childrenMergeType is "append", so all entries added */
+   pcu_filename_input( "testXML-dupKeys-3_1.xml", xmlTestFilename3_1 );
+   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename3_1, data->dict2 );
+
+   pcu_check_true( 1 == data->dict2->count );
+   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
+   structDev = data->dict2->entryPtr[0]->value;
+   structDict = structDev->as.typeStruct;
+   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
+   pcu_check_true( struct1_OrigParamCount*2 == Dictionary_Entry_Value_GetCount( structDev ) );
+   pcu_check_streq( structDict->entryPtr[0]->key, paramNames[0] );
+   elementDev = structDict->entryPtr[0]->value;
+   pcu_check_true( paramVals[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   pcu_check_streq( structDict->entryPtr[1]->key, paramNames[1] );
+   elementDev = structDict->entryPtr[1]->value;
+   pcu_check_true( paramVals[1] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   pcu_check_streq( structDict->entryPtr[2]->key, paramNames[1] );
+   elementDev = structDict->entryPtr[2]->value;
+   pcu_check_true( paramVals2[1] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   pcu_check_streq( structDict->entryPtr[3]->key, paramNames2[0] );
+   elementDev = structDict->entryPtr[3]->value;
+   pcu_check_true( paramVals2[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   Dictionary_Empty( data->dict2 );
+
+   /* Sub-test 3.2: with mergeType as "merge", structs to be merged.
+    * childrenMergeType set to merge also */
+   pcu_filename_input( "testXML-dupKeys-3_2.xml", xmlTestFilename3_2 );
+   IO_Handler_ReadAllFromFile( data->io_handler, xmlTestFilename3_2, data->dict2 );
+
+   pcu_check_true( 1 == data->dict2->count );
+   pcu_check_true( Dictionary_Entry_Compare( data->dict2->entryPtr[0], (Dictionary_Entry_Key)struct1Name) );
+   structDev = data->dict2->entryPtr[0]->value;
+   structDict = structDev->as.typeStruct;
+   pcu_check_true( Dictionary_Entry_Value_Type_Struct == structDev->type );
+   pcu_check_true( struct1_OrigParamCount+1 == Dictionary_Entry_Value_GetCount( structDev ) );
+   pcu_check_streq( structDict->entryPtr[0]->key, paramNames[0] );
+   elementDev = structDict->entryPtr[0]->value;
+   pcu_check_true( paramVals[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   pcu_check_streq( structDict->entryPtr[1]->key, paramNames[1] );
+   elementDev = structDict->entryPtr[1]->value;
+   pcu_check_true( paramVals2[1] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+   pcu_check_streq( structDict->entryPtr[2]->key, paramNames2[0] );
+   elementDev = structDict->entryPtr[2]->value;
+   pcu_check_true( paramVals2[0] == Dictionary_Entry_Value_AsUnsignedInt( elementDev ) );
+}
+
+
+void IO_HandlerSuite_TestReadNonExistent( IO_HandlerSuiteData* data ) {
+   char*		errorFilename;
+   Name		notExistFilename = "I_Dont_Exist.xml";
+   FILE*		errorFile;
+   #define	MAXLINE 1000
+   char		errorLine[MAXLINE];
+   char		expectedErrorMsg[MAXLINE];
+
+   Stg_asprintf( &errorFilename, "./errorMsg-NonExist-%d.txt", data->rank );
+   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
+   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
+
+   if (0 == data->rank ) {
+		#ifdef DEBUG
+			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, notExistFilename, data->dict2 ) );
+		#else
+			IO_Handler_ReadAllFromFile( data->io_handler, notExistFilename, data->dict2 );
+		#endif
+      errorFile = fopen( errorFilename, "r" );
+      pcu_check_true( errorFile );
+
+      pcu_check_true( fgets( errorLine, MAXLINE, errorFile ) );
+      sprintf( expectedErrorMsg, "Error: File %s doesn't exist, not readable, or not valid.\n", notExistFilename );
+      pcu_check_streq( errorLine, expectedErrorMsg );
+      remove( errorFilename );
+   }
+}
+
+
+void IO_HandlerSuite_TestReadInvalid( IO_HandlerSuiteData* data ) {
+   char              invalidXMLFilename[PCU_PATH_MAX];
+   char              expectedErrorFilename[PCU_PATH_MAX];
+   const Name       errorFilename = "errorMsg-Invalid.txt";
+
+   pcu_filename_input( "Invalid.xml", invalidXMLFilename );
+   pcu_filename_expected( errorFilename, expectedErrorFilename );
+
+   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
+   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
+
+   if ( 0 == data->rank  ) {
+		#ifdef DEBUG
+			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, invalidXMLFilename, data->dict2 ) );
+		#else
+			IO_Handler_ReadAllFromFile( data->io_handler, invalidXMLFilename, data->dict2 );
+		#endif
+      pcu_check_fileEq( errorFilename, expectedErrorFilename );
+      remove( errorFilename );
+   }
+}
+
+
+void IO_HandlerSuite_TestReadWrongNS( IO_HandlerSuiteData* data ) {
+   char              wrongNS_XMLFilename[PCU_PATH_MAX];
+   char              expectedErrorFilename[PCU_PATH_MAX];
+   const Name       errorFilename = "errorMsg-wrongNS.txt";
+
+   pcu_filename_input( "WrongNS.xml", wrongNS_XMLFilename );
+   pcu_filename_expected( errorFilename, expectedErrorFilename );
+
+   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
+   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
+
+   if ( 0 == data->rank  ) {
+		#ifdef DEBUG
+			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, wrongNS_XMLFilename, data->dict2 ) );
+		#else
+			IO_Handler_ReadAllFromFile( data->io_handler, wrongNS_XMLFilename, data->dict2 );
+		#endif
+      pcu_check_fileEq( errorFilename, expectedErrorFilename );
+      remove( errorFilename );
+   }
+}
+
+
+void IO_HandlerSuite_TestReadWrongRootNode( IO_HandlerSuiteData* data ) {
+   char          wrongRootNode_XMLFilename[PCU_PATH_MAX];
+   char          expectedErrorFilename[PCU_PATH_MAX];
+   const Name   errorFilename = "./errorMsg-wrongRootNode.txt";
+
+   pcu_filename_input( "WrongRootNode.xml", wrongRootNode_XMLFilename );
+   pcu_filename_expected( errorFilename, expectedErrorFilename );
+
+   Stream_RedirectFile( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type  ), errorFilename );
+   Stream_ClearCustomFormatters( Journal_Register( Error_Type, (Name)XML_IO_Handler_Type ) );
+
+   if ( 0 == data->rank  ) {
+		#ifdef DEBUG
+			pcu_check_assert( IO_Handler_ReadAllFromFile( data->io_handler, wrongRootNode_XMLFilename, data->dict2 ) );
+		#else
+			IO_Handler_ReadAllFromFile( data->io_handler, wrongRootNode_XMLFilename, data->dict2 );
+		#endif
+      pcu_check_fileEq( errorFilename, expectedErrorFilename ); 
+      remove( errorFilename );
+   }
+}
+
+
+void IO_HandlerSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, IO_HandlerSuiteData );
+   pcu_suite_setFixtures( suite, IO_HandlerSuite_Setup, IO_HandlerSuite_Teardown );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteReadNormalEntries );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteReadNormalSingleEntry );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteReadEmpty );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestWriteExplicitTypes );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadWhitespaceEntries );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadIncludedFile );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadRawDataEntries );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadAllFromCommandLine );
+   pcu_suite_addTest( suite, IO_HandlerSuite_TestReadDuplicateEntryKeys );
+   /* pcu_suite_addTest( suite, IO_HandlerSuite_TestReadNonExistent ); */
+   /*pcu_suite_addTest( suite, IO_HandlerSuite_TestReadInvalid );*/
+   /*pcu_suite_addTest( suite, IO_HandlerSuite_TestReadWrongNS );*/
+   /*pcu_suite_addTest( suite, IO_HandlerSuite_TestReadWrongRootNode );*/
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/JournalSuite.c
--- a/Base/IO/tests/JournalSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,461 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests the journal functionality
-**
-** $Id: testJournal.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "JournalSuite.h"
-
-
-void JournalSuite_Setup( JournalSuiteData* data ) {
-   data->comm = MPI_COMM_WORLD;  
-   MPI_Comm_rank( data->comm, &data->rank );
-   MPI_Comm_size( data->comm, &data->nProcs );
-
-   /* This is where we'll save the Journal, to be restored after the test, and create one for testing */
-   data->savedJournal = stJournal;
-   stJournal = Journal_New();
-   Journal_SetupDefaultTypedStreams();
-
-   /* For testing, we want our custom Journal to output to saved files */
-   Stg_asprintf( &data->testStdOutFilename, "./testStdOut-%d.txt", data->rank );
-   Stg_asprintf( &data->testStdErrFilename, "./testStdErr-%d.txt", data->rank );
-
-   stJournal->stdOut = CFile_New();
-   stJournal->stdErr = CFile_New();
-   JournalFile_Open( stJournal->stdOut, data->testStdOutFilename );
-   JournalFile_Open( stJournal->stdErr, data->testStdErrFilename );
-
-   Stream_SetFile( Journal_GetTypedStream(Info_Type), stJournal->stdOut );
-   Stream_SetPrintingRank( Journal_GetTypedStream(Info_Type), STREAM_ALL_RANKS );
-   Stream_SetFile( Journal_GetTypedStream(Debug_Type), stJournal->stdOut );
-   Stream_SetPrintingRank( Journal_GetTypedStream(Debug_Type), STREAM_ALL_RANKS );
-   Stream_SetFile( Journal_GetTypedStream(Dump_Type), stJournal->stdOut );
-   Stream_SetPrintingRank( Journal_GetTypedStream(Dump_Type), STREAM_ALL_RANKS );
-   Stream_SetFile( Journal_GetTypedStream(Error_Type), stJournal->stdErr );
-   Stream_SetPrintingRank( Journal_GetTypedStream(Error_Type), STREAM_ALL_RANKS );
-   /* We don't want the rank formatting stuff interefering with tests unnecessarily */
-   Stream_ClearCustomFormatters( Journal_GetTypedStream(Error_Type) );
-
-   data->testStdOutFile = fopen( data->testStdOutFilename, "r" );
-   data->testStdErrFile = fopen( data->testStdErrFilename, "r" );
-}
-
-void JournalSuite_Teardown( JournalSuiteData* data ) {
-   /* Delete temporary Journal, then restore the regular one */
-   Journal_Delete();
-   stJournal = data->savedJournal;
-
-   fclose( data->testStdOutFile );
-   fclose( data->testStdErrFile );
-   remove( data->testStdOutFilename );
-   remove( data->testStdErrFilename );
-}
-
-void JournalSuite_TestRegister( JournalSuiteData* data ) {
-   Journal* testJournal;
-   Stream* myInfo;
-   Stream* myDebug;
-   Stream* myDump;
-   Stream* myError;
-   Stream* allNew;   /* Will use for testing a non-standard type stream */
-   
-   /* We want to test properties of the "real" journal in this test. Thus save & restore our testing one */   
-   testJournal = stJournal;
-   stJournal = data->savedJournal;
-
-   myInfo = Journal_Register( Info_Type, (Name)"MyInfo"  );
-   myDebug = Journal_Register( Debug_Type, (Name)"MyDebug"  );
-   myDump = Journal_Register( Dump_Type, (Name)"MyDump"  );
-   myError = Journal_Register( Error_Type, (Name)"MyError"  );
-   allNew = Journal_Register( "New_Type", (Name)"allNew"  );
-
-   /* Check the streams themselves were created properly */
-   /* Including Louis' requirement that they default to have printingRank 0 */
-   pcu_check_streq( myInfo->name, "MyInfo" );
-   pcu_check_true( myInfo->_parent == Journal_GetTypedStream( Info_Type ) );
-   pcu_check_true( myInfo->_children->count == 0 );
-   pcu_check_true( 0 == Stream_GetPrintingRank( myInfo ));
-   pcu_check_streq( myDebug->name, "MyDebug" );
-   pcu_check_true( myDebug->_parent == Journal_GetTypedStream( Debug_Type ) );
-   pcu_check_true( myDebug->_children->count == 0 );
-   pcu_check_true( 0 == Stream_GetPrintingRank( myDebug ));
-   pcu_check_streq( myDump->name, "MyDump" );
-   pcu_check_true( myDump->_parent == Journal_GetTypedStream( Dump_Type ) );
-   pcu_check_true( myDump->_children->count == 0 );
-   pcu_check_streq( myError->name, "MyError" );
-   pcu_check_true( myError->_parent == Journal_GetTypedStream( Error_Type ) );
-   pcu_check_true( myError->_children->count == 0 );
-   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( myError ));
-   pcu_check_true( myError->_formatterCount == 1 );
-   pcu_check_true( myError->_formatter[0]->type == RankFormatter_Type );
-   pcu_check_streq( allNew->name, "allNew" );
-   pcu_check_true( allNew->_parent == Journal_GetTypedStream( "New_Type" ) );
-   pcu_check_true( allNew->_children->count == 0 );
-   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( allNew ));
-
-   /* Now check they were inserted in Journal hierarchy correctly */
-   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Info_Type)->_children, (Name)"MyInfo" ) == myInfo );
-   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Debug_Type )->_children, "MyDebug" ) == myDebug );
-   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Dump_Type)->_children, (Name)"MyDump" ) == myDump );
-   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Error_Type )->_children, "MyError" ) == myError );
-   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream("New_Type")->_children, (Name)"allNew" ) == allNew  );
-
-   /* Ok, restore the testing journal */
-   stJournal = testJournal;
-}
-
-
-void JournalSuite_TestRegister2( JournalSuiteData* data ) {
-   Stream* register2Stream;
-   Stream* register2Test;
-   
-   register2Stream = Journal_Register2( Info_Type, "Component", "Instance" );
-   register2Test   = Journal_Register( Info_Type, (Name)"Component.Instance"    );
-
-   pcu_check_true( register2Stream == register2Test );
-}
-
-
-void JournalSuite_TestPrintBasics( JournalSuiteData* data ) {
-   Stream*     myInfo;
-   Stream*     myDebug;
-   Stream*     myDump;
-   Stream*     myError;
-   #define     MAXLINE 1000
-   char        outLine[MAXLINE];
-
-   /* Check as is expected - see Base/IO/src/Init.c . Important for later tests */
-   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Info_Type)) == True );
-   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Debug_Type)) == False );
-   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Dump_Type)) == False );
-   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Error_Type)) == True  ) ;
-
-   myInfo = Journal_Register( InfoStream_Type, (Name)"MyInfo" );
-   myDebug = Journal_Register( DebugStream_Type, (Name)"MyDebug"  );
-   myDump = Journal_Register( Dump_Type, (Name)"MyDump"  );
-   myError = Journal_Register( ErrorStream_Type, (Name)"MyError"  );
-
-   Journal_Printf( myInfo, "%s\n", "HELLOInfo" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "HELLOInfo\n" );
-   Journal_Printf( myDebug, "%s\n", "WORLDDebug" );
-   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdErrFile ));
-   Journal_Printf( myDump, "%s\n", "HELLODump" );
-   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
-   Journal_Printf( myError, "%s\n", "WORLDError" );
-   rewind( data->testStdErrFile );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdErrFile ));
-   pcu_check_streq( outLine, "WORLDError\n" );
-
-   Journal_Enable_NamedStream( Info_Type, "MyInfo", False );
-   Journal_Printf( myInfo, "%s\n", "HELLOInfo2" );
-   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
-
-   Journal_Enable_TypedStream( Dump_Type, True );
-   Journal_Enable_NamedStream( Dump_Type, "MyDump", True );
-   Journal_Printf( myDump, "%s\n", "HELLODump2" );
-   /* This stream should have auto-flush set to false. Check first, then flush and check again */
-   pcu_check_true( Journal_GetTypedStream(Dump_Type)->_autoFlush == False );
-   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
-   rewind( data->testStdOutFile );
-   Stream_Flush( Journal_GetTypedStream(Dump_Type) );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "HELLOInfo\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "HELLODump2\n" );
-
-   
-   pcu_check_streq( outLine, "HELLODump2\n" );
-   stJournal->enable = False;
-   Journal_Printf( myDump, "%s\n", "HELLODump3" );
-   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
-}
-
-
-void JournalSuite_TestPrintfL( JournalSuiteData* data ) {
-   Stream* myStream;
-   #define     MAXLINE 1000
-   char        outLine[MAXLINE];
-
-   myStream = Journal_Register( InfoStream_Type, (Name)"myComponent" );
-   Journal_PrintfL( myStream, 1, "Hello\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "Hello\n" );
-   /* We should get a blank line, since level 2 printing not enabled by default */
-   Journal_PrintfL( myStream, 2, "Hello\n" );
-   pcu_check_true( NULL ==fgets( outLine, MAXLINE, data->testStdOutFile ));
-   /* Now enable level 2, and try again */
-   Stream_SetLevel( myStream, 2 );
-   Journal_PrintfL( myStream, 2, "Hello\n" );
-   rewind( data->testStdOutFile );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "Hello\n" );
-}
-
-
-void JournalSuite_TestDPrintf( JournalSuiteData* data ) {
-   Stream*     myInfo;
-   #define     MAXLINE 1000
-   char        outLine[MAXLINE];
-
-   myInfo = Journal_Register( InfoStream_Type, (Name)"MyInfo" );
-   Journal_DPrintf( myInfo, "DPrintf\n" );
-   #ifdef DEBUG
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "DPrintf\n" );
-   #else
-   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
-   #endif
-}
-
-
-void JournalSuite_TestPrintChildStreams( JournalSuiteData* data ) {
-   Stream*     myStream;
-   Stream*     childStream1;
-   Stream*     childStream2;
-   #define     MAXLINE 1000
-   char        outLine[MAXLINE];
-
-  /* Make sure the hierarchy works*/
-   myStream = Journal_Register( InfoStream_Type, (Name)"myComponent" );
-   childStream1 = Stream_RegisterChild( myStream, "child1" );
-   childStream2 = Stream_RegisterChild( childStream1, "child2" );
-
-   Journal_Printf( myStream, "0 no indent\n" );
-   Stream_IndentBranch( myStream );
-   Journal_Printf( childStream1, "1 with 1 indent\n" );
-   Stream_IndentBranch( myStream );
-   Journal_Printf( childStream2, "2 with 2 indent\n" );
-   Stream_UnIndentBranch( myStream );
-   Journal_Printf( childStream2, "2 with 1 indent\n" );
-   Stream_UnIndentBranch( myStream );
-   Journal_Printf( childStream1, "1 with no indent\n" );
-   Journal_Printf( childStream2, "2 with no indent\n" );
-
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "0 no indent\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "\t1 with 1 indent\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "\t\t2 with 2 indent\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "\t2 with 1 indent\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "1 with no indent\n" );
-   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
-   pcu_check_streq( outLine, "2 with no indent\n" );
-}
-
-
-void JournalSuite_TestReadFromDictionary( JournalSuiteData* data ) {
-   Dictionary* testDict = Dictionary_New();
-   Stream*     infoTest1;
-   Stream*     infoTest2;
-   Stream*     debugTest1;
-   Stream*     debugTest2;
-   Stream*     dumpTest1;
-   Stream*     dumpTest2;
-   Stream*     newTest1;
-   Stream*     newTest2;
-   Stream*     fileTest1;
-   Stream*     fileTest2;
-   Stream*     propTest1;
-   Stream*     propTest2;
-   Name testNewTypeFilename1 = "./testJournal-out1.txt";
-   Name testNewTypeFilename2 = "./testJournal-out2.txt";
-
-   infoTest1 = Journal_Register( Info_Type, (Name)"test1"  );
-   infoTest2 = Journal_Register( Info_Type, (Name)"test2"  );
-   debugTest1 = Journal_Register( Debug_Type, (Name)"test1"  );
-   debugTest2 = Journal_Register( Debug_Type, (Name)"test2"  );
-   dumpTest1 = Journal_Register( Dump_Type, (Name)"test1"  );
-   dumpTest2 = Journal_Register( Dump_Type, (Name)"test2"  );
-
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.debug.test1", Dictionary_Entry_Value_FromBool(  True ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.dump.test1", Dictionary_Entry_Value_FromBool(  True ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test2", Dictionary_Entry_Value_FromBool( False ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test2", Dictionary_Entry_Value_FromBool( False ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test1.new1", Dictionary_Entry_Value_FromBool(  True ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test1.new2", Dictionary_Entry_Value_FromBool(  False ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-level.info.test1.new1", Dictionary_Entry_Value_FromUnsignedInt( 3 ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.newtype", Dictionary_Entry_Value_FromBool(  True ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-file.newtype", Dictionary_Entry_Value_FromString( testNewTypeFilename1 ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-file.newtype.other", Dictionary_Entry_Value_FromString( testNewTypeFilename2 ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-rank.info.propertiestest1", Dictionary_Entry_Value_FromUnsignedInt( 0 ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-rank.info.propertiestest2", Dictionary_Entry_Value_FromUnsignedInt( 5 ) );
-   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-autoflush.info.propertiestest1", Dictionary_Entry_Value_FromBool( False ));
-
-   Journal_ReadFromDictionary( testDict );
-
-   pcu_check_true( True == debugTest1->_enable );
-   pcu_check_true( True == dumpTest1->_enable );
-   pcu_check_true( False == infoTest2->_enable  );
-
-   newTest1 = Journal_Register( Info_Type, (Name)"test1.new1"  );
-   newTest2 = Journal_Register( Info_Type, (Name)"test1.new2" );
-   pcu_check_true( True == newTest1->_enable );
-   pcu_check_true( False == newTest2->_enable );
-   pcu_check_true( 3 == newTest1->_level );
-   
-   /* Just do the rest of this test with 1 proc to avoid parallel I/O problems */
-   if ( data->rank==0  ) {
-      FILE*       testNewTypeFile1;
-      FILE*       testNewTypeFile2;
-      #define     MAXLINE 1000
-      char        outLine[MAXLINE];
-
-      /* We do actually need to do some printing to the newtype streams, as the filename isn't stored
-       *  on the CFile or JournalFile struct*/
-      fileTest1 = Journal_Register( "newtype", (Name)"hello"  );
-      fileTest2 = Journal_Register( "newtype", (Name)"other"  );
-      Journal_Printf( fileTest1, "yay!\n" );
-      Journal_Printf( fileTest2, "double yay!\n" );
-      Stream_Flush( fileTest1 );
-      Stream_Flush( fileTest2 );
-      testNewTypeFile1 = fopen( testNewTypeFilename1, "r" );
-      testNewTypeFile2 = fopen( testNewTypeFilename2, "r" );
-      pcu_check_true(         fgets( outLine, MAXLINE, testNewTypeFile1 ));
-      pcu_check_streq( outLine, "yay!\n" );
-      pcu_check_true(         fgets( outLine, MAXLINE, testNewTypeFile2 ));
-      pcu_check_streq( outLine, "double yay!\n" );
-
-      propTest1 = Journal_Register( Info_Type, (Name)"propertiestest1"  );
-      propTest2 = Journal_Register( Info_Type, (Name)"propertiestest2" );
-      pcu_check_true( 0 == Stream_GetPrintingRank( propTest1 ));
-      pcu_check_true( 5 == Stream_GetPrintingRank( propTest2 ));
-      pcu_check_true( False == Stream_GetAutoFlush( propTest1 ));
-
-      fclose( testNewTypeFile1 );
-      fclose( testNewTypeFile2 );
-      remove( testNewTypeFilename1 );
-      remove( testNewTypeFilename2 );
-   }
-   Stg_Class_Delete( testDict );
-}
-
-
-void JournalSuite_TestPrintString_WithLength( JournalSuiteData* data  ) {
-   Stream*      myStream    = Journal_Register( Info_Type, (Name)"TestStream" );
-   Name        string        = "helloWorldHowDoYouDo";
-   int          char_I;
-   const Name  stringLengthTestFilename = "testJournalPrintStringWithLength.txt" ;
-   char         expectedFilename[PCU_PATH_MAX];
-
-   /* Just do this test with rank 0 */
-   if (data->rank != 0 ) return;
-
-   Stream_RedirectFile( myStream, stringLengthTestFilename );
-
-   for ( char_I = -1 ; char_I < 25 ; char_I++ ) {
-      Journal_PrintString_WithLength( myStream, string, char_I );
-      Journal_Printf( myStream, "\n" );
-   }
-
-   pcu_filename_expected( stringLengthTestFilename, expectedFilename );
-   pcu_check_fileEq( stringLengthTestFilename, expectedFilename ); 
-
-   remove( stringLengthTestFilename );
-}
-
-
-void JournalSuite_TestShortcuts( JournalSuiteData* data ) {
-   Stream*      myStream    = Journal_Register( Info_Type, (Name)"TestStream"  );
-   Name        string        = "helloWorldHowDoYouDo";
-   double       doubleValue   = 3142e20;
-   double       floatValue    = 2.173425;
-   int          intValue      = 3;
-   unsigned int uintValue     = 3980;
-   char         charValue     = 'V';
-   double       doubleArray[] = { 10.23, 393.1, -89, 1231 };        
-   Index        uintArray[]   = { 10, 2021, 231, 2, 3, 4, 55 };
-   const Name  shortcutTestFilename = "./testJournalPrintShortcuts.txt" ;
-   char         expectedFilename[PCU_PATH_MAX];
-
-   /* Testing String Printing Shortcuts */
-
-   Stream_RedirectFile( myStream, shortcutTestFilename );
-
-   Journal_PrintString( myStream, string );
-   Journal_PrintValue( myStream, doubleValue );
-   Journal_PrintValue( myStream, floatValue );
-   Journal_PrintValue( myStream, intValue );
-   Journal_PrintValue( myStream, uintValue );
-   Journal_PrintChar(  myStream, charValue );
-   Journal_PrintArray( myStream, doubleArray, 4 );
-   Journal_PrintArray( myStream, uintArray, 7 );
-
-   pcu_filename_expected( shortcutTestFilename, expectedFilename );
-   pcu_check_fileEq( shortcutTestFilename, expectedFilename ); 
-
-   remove( shortcutTestFilename );
-}
-
-
-void JournalSuite_TestFirewall( JournalSuiteData* data ) {
-   Stream*      myInfo = NULL;
-
-   myInfo = Journal_Register( Info_Type, (Name)"MyInfo" );
-
-   stJournal->firewallProducesAssert = True;
-
-   /* We expect nothing to happen on this first run - in effect the test would "fail" if an uncaught assert( )
-    *  terminated the program */   
-   Journal_Firewall( 1, myInfo, "Firewall\n" );
-   /* We can use pcu_check_assert to make sure a pcu_assert is generated. This is actually quite important
-    *  as many other tests rely on this functionality. */   
-   pcu_check_assert( Journal_Firewall( 1 == 0, myInfo, "Firewall\n" ) );
-}
-
-
-void JournalSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, JournalSuiteData );
-   pcu_suite_setFixtures( suite, JournalSuite_Setup, JournalSuite_Teardown );
-   pcu_suite_addTest( suite, JournalSuite_TestRegister );
-   pcu_suite_addTest( suite, JournalSuite_TestRegister2 );
-   pcu_suite_addTest( suite, JournalSuite_TestPrintBasics );
-   pcu_suite_addTest( suite, JournalSuite_TestPrintfL );
-   pcu_suite_addTest( suite, JournalSuite_TestDPrintf );
-   pcu_suite_addTest( suite, JournalSuite_TestPrintChildStreams );
-   pcu_suite_addTest( suite, JournalSuite_TestReadFromDictionary );
-   pcu_suite_addTest( suite, JournalSuite_TestPrintString_WithLength );
-   pcu_suite_addTest( suite, JournalSuite_TestShortcuts );
-   pcu_suite_addTest( suite, JournalSuite_TestFirewall );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/JournalSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/tests/JournalSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,461 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests the journal functionality
+**
+** $Id: testJournal.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "JournalSuite.h"
+
+
+void JournalSuite_Setup( JournalSuiteData* data ) {
+   data->comm = MPI_COMM_WORLD;  
+   MPI_Comm_rank( data->comm, &data->rank );
+   MPI_Comm_size( data->comm, &data->nProcs );
+
+   /* This is where we'll save the Journal, to be restored after the test, and create one for testing */
+   data->savedJournal = stJournal;
+   stJournal = Journal_New();
+   Journal_SetupDefaultTypedStreams();
+
+   /* For testing, we want our custom Journal to output to saved files */
+   Stg_asprintf( &data->testStdOutFilename, "./testStdOut-%d.txt", data->rank );
+   Stg_asprintf( &data->testStdErrFilename, "./testStdErr-%d.txt", data->rank );
+
+   stJournal->stdOut = CFile_New();
+   stJournal->stdErr = CFile_New();
+   JournalFile_Open( stJournal->stdOut, data->testStdOutFilename );
+   JournalFile_Open( stJournal->stdErr, data->testStdErrFilename );
+
+   Stream_SetFile( Journal_GetTypedStream(Info_Type), stJournal->stdOut );
+   Stream_SetPrintingRank( Journal_GetTypedStream(Info_Type), STREAM_ALL_RANKS );
+   Stream_SetFile( Journal_GetTypedStream(Debug_Type), stJournal->stdOut );
+   Stream_SetPrintingRank( Journal_GetTypedStream(Debug_Type), STREAM_ALL_RANKS );
+   Stream_SetFile( Journal_GetTypedStream(Dump_Type), stJournal->stdOut );
+   Stream_SetPrintingRank( Journal_GetTypedStream(Dump_Type), STREAM_ALL_RANKS );
+   Stream_SetFile( Journal_GetTypedStream(Error_Type), stJournal->stdErr );
+   Stream_SetPrintingRank( Journal_GetTypedStream(Error_Type), STREAM_ALL_RANKS );
+   /* We don't want the rank formatting stuff interefering with tests unnecessarily */
+   Stream_ClearCustomFormatters( Journal_GetTypedStream(Error_Type) );
+
+   data->testStdOutFile = fopen( data->testStdOutFilename, "r" );
+   data->testStdErrFile = fopen( data->testStdErrFilename, "r" );
+}
+
+void JournalSuite_Teardown( JournalSuiteData* data ) {
+   /* Delete temporary Journal, then restore the regular one */
+   Journal_Delete();
+   stJournal = data->savedJournal;
+
+   fclose( data->testStdOutFile );
+   fclose( data->testStdErrFile );
+   remove( data->testStdOutFilename );
+   remove( data->testStdErrFilename );
+}
+
+void JournalSuite_TestRegister( JournalSuiteData* data ) {
+   Journal* testJournal;
+   Stream* myInfo;
+   Stream* myDebug;
+   Stream* myDump;
+   Stream* myError;
+   Stream* allNew;   /* Will use for testing a non-standard type stream */
+   
+   /* We want to test properties of the "real" journal in this test. Thus save & restore our testing one */   
+   testJournal = stJournal;
+   stJournal = data->savedJournal;
+
+   myInfo = Journal_Register( Info_Type, (Name)"MyInfo"  );
+   myDebug = Journal_Register( Debug_Type, (Name)"MyDebug"  );
+   myDump = Journal_Register( Dump_Type, (Name)"MyDump"  );
+   myError = Journal_Register( Error_Type, (Name)"MyError"  );
+   allNew = Journal_Register( "New_Type", (Name)"allNew"  );
+
+   /* Check the streams themselves were created properly */
+   /* Including Louis' requirement that they default to have printingRank 0 */
+   pcu_check_streq( myInfo->name, "MyInfo" );
+   pcu_check_true( myInfo->_parent == Journal_GetTypedStream( Info_Type ) );
+   pcu_check_true( myInfo->_children->count == 0 );
+   pcu_check_true( 0 == Stream_GetPrintingRank( myInfo ));
+   pcu_check_streq( myDebug->name, "MyDebug" );
+   pcu_check_true( myDebug->_parent == Journal_GetTypedStream( Debug_Type ) );
+   pcu_check_true( myDebug->_children->count == 0 );
+   pcu_check_true( 0 == Stream_GetPrintingRank( myDebug ));
+   pcu_check_streq( myDump->name, "MyDump" );
+   pcu_check_true( myDump->_parent == Journal_GetTypedStream( Dump_Type ) );
+   pcu_check_true( myDump->_children->count == 0 );
+   pcu_check_streq( myError->name, "MyError" );
+   pcu_check_true( myError->_parent == Journal_GetTypedStream( Error_Type ) );
+   pcu_check_true( myError->_children->count == 0 );
+   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( myError ));
+   pcu_check_true( myError->_formatterCount == 1 );
+   pcu_check_true( myError->_formatter[0]->type == RankFormatter_Type );
+   pcu_check_streq( allNew->name, "allNew" );
+   pcu_check_true( allNew->_parent == Journal_GetTypedStream( "New_Type" ) );
+   pcu_check_true( allNew->_children->count == 0 );
+   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( allNew ));
+
+   /* Now check they were inserted in Journal hierarchy correctly */
+   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Info_Type)->_children, (Name)"MyInfo" ) == myInfo );
+   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Debug_Type )->_children, "MyDebug" ) == myDebug );
+   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Dump_Type)->_children, (Name)"MyDump" ) == myDump );
+   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream(Error_Type )->_children, "MyError" ) == myError );
+   pcu_check_true( Stg_ObjectList_Get( Journal_GetTypedStream("New_Type")->_children, (Name)"allNew" ) == allNew  );
+
+   /* Ok, restore the testing journal */
+   stJournal = testJournal;
+}
+
+
+void JournalSuite_TestRegister2( JournalSuiteData* data ) {
+   Stream* register2Stream;
+   Stream* register2Test;
+   
+   register2Stream = Journal_Register2( Info_Type, "Component", "Instance" );
+   register2Test   = Journal_Register( Info_Type, (Name)"Component.Instance"    );
+
+   pcu_check_true( register2Stream == register2Test );
+}
+
+
+void JournalSuite_TestPrintBasics( JournalSuiteData* data ) {
+   Stream*     myInfo;
+   Stream*     myDebug;
+   Stream*     myDump;
+   Stream*     myError;
+   #define     MAXLINE 1000
+   char        outLine[MAXLINE];
+
+   /* Check as is expected - see Base/IO/src/Init.c . Important for later tests */
+   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Info_Type)) == True );
+   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Debug_Type)) == False );
+   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Dump_Type)) == False );
+   pcu_check_true( Stream_IsEnable( Journal_GetTypedStream(Error_Type)) == True  ) ;
+
+   myInfo = Journal_Register( InfoStream_Type, (Name)"MyInfo" );
+   myDebug = Journal_Register( DebugStream_Type, (Name)"MyDebug"  );
+   myDump = Journal_Register( Dump_Type, (Name)"MyDump"  );
+   myError = Journal_Register( ErrorStream_Type, (Name)"MyError"  );
+
+   Journal_Printf( myInfo, "%s\n", "HELLOInfo" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "HELLOInfo\n" );
+   Journal_Printf( myDebug, "%s\n", "WORLDDebug" );
+   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdErrFile ));
+   Journal_Printf( myDump, "%s\n", "HELLODump" );
+   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
+   Journal_Printf( myError, "%s\n", "WORLDError" );
+   rewind( data->testStdErrFile );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdErrFile ));
+   pcu_check_streq( outLine, "WORLDError\n" );
+
+   Journal_Enable_NamedStream( Info_Type, "MyInfo", False );
+   Journal_Printf( myInfo, "%s\n", "HELLOInfo2" );
+   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
+
+   Journal_Enable_TypedStream( Dump_Type, True );
+   Journal_Enable_NamedStream( Dump_Type, "MyDump", True );
+   Journal_Printf( myDump, "%s\n", "HELLODump2" );
+   /* This stream should have auto-flush set to false. Check first, then flush and check again */
+   pcu_check_true( Journal_GetTypedStream(Dump_Type)->_autoFlush == False );
+   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
+   rewind( data->testStdOutFile );
+   Stream_Flush( Journal_GetTypedStream(Dump_Type) );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "HELLOInfo\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "HELLODump2\n" );
+
+   
+   pcu_check_streq( outLine, "HELLODump2\n" );
+   stJournal->enable = False;
+   Journal_Printf( myDump, "%s\n", "HELLODump3" );
+   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
+}
+
+
+void JournalSuite_TestPrintfL( JournalSuiteData* data ) {
+   Stream* myStream;
+   #define     MAXLINE 1000
+   char        outLine[MAXLINE];
+
+   myStream = Journal_Register( InfoStream_Type, (Name)"myComponent" );
+   Journal_PrintfL( myStream, 1, "Hello\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "Hello\n" );
+   /* We should get a blank line, since level 2 printing not enabled by default */
+   Journal_PrintfL( myStream, 2, "Hello\n" );
+   pcu_check_true( NULL ==fgets( outLine, MAXLINE, data->testStdOutFile ));
+   /* Now enable level 2, and try again */
+   Stream_SetLevel( myStream, 2 );
+   Journal_PrintfL( myStream, 2, "Hello\n" );
+   rewind( data->testStdOutFile );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "Hello\n" );
+}
+
+
+void JournalSuite_TestDPrintf( JournalSuiteData* data ) {
+   Stream*     myInfo;
+   #define     MAXLINE 1000
+   char        outLine[MAXLINE];
+
+   myInfo = Journal_Register( InfoStream_Type, (Name)"MyInfo" );
+   Journal_DPrintf( myInfo, "DPrintf\n" );
+   #ifdef DEBUG
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "DPrintf\n" );
+   #else
+   pcu_check_true( NULL == fgets( outLine, MAXLINE, data->testStdOutFile ));
+   #endif
+}
+
+
+void JournalSuite_TestPrintChildStreams( JournalSuiteData* data ) {
+   Stream*     myStream;
+   Stream*     childStream1;
+   Stream*     childStream2;
+   #define     MAXLINE 1000
+   char        outLine[MAXLINE];
+
+  /* Make sure the hierarchy works*/
+   myStream = Journal_Register( InfoStream_Type, (Name)"myComponent" );
+   childStream1 = Stream_RegisterChild( myStream, "child1" );
+   childStream2 = Stream_RegisterChild( childStream1, "child2" );
+
+   Journal_Printf( myStream, "0 no indent\n" );
+   Stream_IndentBranch( myStream );
+   Journal_Printf( childStream1, "1 with 1 indent\n" );
+   Stream_IndentBranch( myStream );
+   Journal_Printf( childStream2, "2 with 2 indent\n" );
+   Stream_UnIndentBranch( myStream );
+   Journal_Printf( childStream2, "2 with 1 indent\n" );
+   Stream_UnIndentBranch( myStream );
+   Journal_Printf( childStream1, "1 with no indent\n" );
+   Journal_Printf( childStream2, "2 with no indent\n" );
+
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "0 no indent\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "\t1 with 1 indent\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "\t\t2 with 2 indent\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "\t2 with 1 indent\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "1 with no indent\n" );
+   pcu_check_true(         fgets( outLine, MAXLINE, data->testStdOutFile ));
+   pcu_check_streq( outLine, "2 with no indent\n" );
+}
+
+
+void JournalSuite_TestReadFromDictionary( JournalSuiteData* data ) {
+   Dictionary* testDict = Dictionary_New();
+   Stream*     infoTest1;
+   Stream*     infoTest2;
+   Stream*     debugTest1;
+   Stream*     debugTest2;
+   Stream*     dumpTest1;
+   Stream*     dumpTest2;
+   Stream*     newTest1;
+   Stream*     newTest2;
+   Stream*     fileTest1;
+   Stream*     fileTest2;
+   Stream*     propTest1;
+   Stream*     propTest2;
+   Name testNewTypeFilename1 = "./testJournal-out1.txt";
+   Name testNewTypeFilename2 = "./testJournal-out2.txt";
+
+   infoTest1 = Journal_Register( Info_Type, (Name)"test1"  );
+   infoTest2 = Journal_Register( Info_Type, (Name)"test2"  );
+   debugTest1 = Journal_Register( Debug_Type, (Name)"test1"  );
+   debugTest2 = Journal_Register( Debug_Type, (Name)"test2"  );
+   dumpTest1 = Journal_Register( Dump_Type, (Name)"test1"  );
+   dumpTest2 = Journal_Register( Dump_Type, (Name)"test2"  );
+
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.debug.test1", Dictionary_Entry_Value_FromBool(  True ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.dump.test1", Dictionary_Entry_Value_FromBool(  True ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test2", Dictionary_Entry_Value_FromBool( False ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test2", Dictionary_Entry_Value_FromBool( False ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test1.new1", Dictionary_Entry_Value_FromBool(  True ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.info.test1.new2", Dictionary_Entry_Value_FromBool(  False ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-level.info.test1.new1", Dictionary_Entry_Value_FromUnsignedInt( 3 ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal.newtype", Dictionary_Entry_Value_FromBool(  True ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-file.newtype", Dictionary_Entry_Value_FromString( testNewTypeFilename1 ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-file.newtype.other", Dictionary_Entry_Value_FromString( testNewTypeFilename2 ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-rank.info.propertiestest1", Dictionary_Entry_Value_FromUnsignedInt( 0 ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-rank.info.propertiestest2", Dictionary_Entry_Value_FromUnsignedInt( 5 ) );
+   Dictionary_Add( testDict, (Dictionary_Entry_Key)"journal-autoflush.info.propertiestest1", Dictionary_Entry_Value_FromBool( False ));
+
+   Journal_ReadFromDictionary( testDict );
+
+   pcu_check_true( True == debugTest1->_enable );
+   pcu_check_true( True == dumpTest1->_enable );
+   pcu_check_true( False == infoTest2->_enable  );
+
+   newTest1 = Journal_Register( Info_Type, (Name)"test1.new1"  );
+   newTest2 = Journal_Register( Info_Type, (Name)"test1.new2" );
+   pcu_check_true( True == newTest1->_enable );
+   pcu_check_true( False == newTest2->_enable );
+   pcu_check_true( 3 == newTest1->_level );
+   
+   /* Just do the rest of this test with 1 proc to avoid parallel I/O problems */
+   if ( data->rank==0  ) {
+      FILE*       testNewTypeFile1;
+      FILE*       testNewTypeFile2;
+      #define     MAXLINE 1000
+      char        outLine[MAXLINE];
+
+      /* We do actually need to do some printing to the newtype streams, as the filename isn't stored
+       *  on the CFile or JournalFile struct*/
+      fileTest1 = Journal_Register( "newtype", (Name)"hello"  );
+      fileTest2 = Journal_Register( "newtype", (Name)"other"  );
+      Journal_Printf( fileTest1, "yay!\n" );
+      Journal_Printf( fileTest2, "double yay!\n" );
+      Stream_Flush( fileTest1 );
+      Stream_Flush( fileTest2 );
+      testNewTypeFile1 = fopen( testNewTypeFilename1, "r" );
+      testNewTypeFile2 = fopen( testNewTypeFilename2, "r" );
+      pcu_check_true(         fgets( outLine, MAXLINE, testNewTypeFile1 ));
+      pcu_check_streq( outLine, "yay!\n" );
+      pcu_check_true(         fgets( outLine, MAXLINE, testNewTypeFile2 ));
+      pcu_check_streq( outLine, "double yay!\n" );
+
+      propTest1 = Journal_Register( Info_Type, (Name)"propertiestest1"  );
+      propTest2 = Journal_Register( Info_Type, (Name)"propertiestest2" );
+      pcu_check_true( 0 == Stream_GetPrintingRank( propTest1 ));
+      pcu_check_true( 5 == Stream_GetPrintingRank( propTest2 ));
+      pcu_check_true( False == Stream_GetAutoFlush( propTest1 ));
+
+      fclose( testNewTypeFile1 );
+      fclose( testNewTypeFile2 );
+      remove( testNewTypeFilename1 );
+      remove( testNewTypeFilename2 );
+   }
+   Stg_Class_Delete( testDict );
+}
+
+
+void JournalSuite_TestPrintString_WithLength( JournalSuiteData* data  ) {
+   Stream*      myStream    = Journal_Register( Info_Type, (Name)"TestStream" );
+   Name        string        = "helloWorldHowDoYouDo";
+   int          char_I;
+   const Name  stringLengthTestFilename = "testJournalPrintStringWithLength.txt" ;
+   char         expectedFilename[PCU_PATH_MAX];
+
+   /* Just do this test with rank 0 */
+   if (data->rank != 0 ) return;
+
+   Stream_RedirectFile( myStream, stringLengthTestFilename );
+
+   for ( char_I = -1 ; char_I < 25 ; char_I++ ) {
+      Journal_PrintString_WithLength( myStream, string, char_I );
+      Journal_Printf( myStream, "\n" );
+   }
+
+   pcu_filename_expected( stringLengthTestFilename, expectedFilename );
+   pcu_check_fileEq( stringLengthTestFilename, expectedFilename ); 
+
+   remove( stringLengthTestFilename );
+}
+
+
+void JournalSuite_TestShortcuts( JournalSuiteData* data ) {
+   Stream*      myStream    = Journal_Register( Info_Type, (Name)"TestStream"  );
+   Name        string        = "helloWorldHowDoYouDo";
+   double       doubleValue   = 3142e20;
+   double       floatValue    = 2.173425;
+   int          intValue      = 3;
+   unsigned int uintValue     = 3980;
+   char         charValue     = 'V';
+   double       doubleArray[] = { 10.23, 393.1, -89, 1231 };        
+   Index        uintArray[]   = { 10, 2021, 231, 2, 3, 4, 55 };
+   const Name  shortcutTestFilename = "./testJournalPrintShortcuts.txt" ;
+   char         expectedFilename[PCU_PATH_MAX];
+
+   /* Testing String Printing Shortcuts */
+
+   Stream_RedirectFile( myStream, shortcutTestFilename );
+
+   Journal_PrintString( myStream, string );
+   Journal_PrintValue( myStream, doubleValue );
+   Journal_PrintValue( myStream, floatValue );
+   Journal_PrintValue( myStream, intValue );
+   Journal_PrintValue( myStream, uintValue );
+   Journal_PrintChar(  myStream, charValue );
+   Journal_PrintArray( myStream, doubleArray, 4 );
+   Journal_PrintArray( myStream, uintArray, 7 );
+
+   pcu_filename_expected( shortcutTestFilename, expectedFilename );
+   pcu_check_fileEq( shortcutTestFilename, expectedFilename ); 
+
+   remove( shortcutTestFilename );
+}
+
+
+void JournalSuite_TestFirewall( JournalSuiteData* data ) {
+   Stream*      myInfo = NULL;
+
+   myInfo = Journal_Register( Info_Type, (Name)"MyInfo" );
+
+   stJournal->firewallProducesAssert = True;
+
+   /* We expect nothing to happen on this first run - in effect the test would "fail" if an uncaught assert( )
+    *  terminated the program */   
+   Journal_Firewall( 1, myInfo, "Firewall\n" );
+   /* We can use pcu_check_assert to make sure a pcu_assert is generated. This is actually quite important
+    *  as many other tests rely on this functionality. */   
+   pcu_check_assert( Journal_Firewall( 1 == 0, myInfo, "Firewall\n" ) );
+}
+
+
+void JournalSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, JournalSuiteData );
+   pcu_suite_setFixtures( suite, JournalSuite_Setup, JournalSuite_Teardown );
+   pcu_suite_addTest( suite, JournalSuite_TestRegister );
+   pcu_suite_addTest( suite, JournalSuite_TestRegister2 );
+   pcu_suite_addTest( suite, JournalSuite_TestPrintBasics );
+   pcu_suite_addTest( suite, JournalSuite_TestPrintfL );
+   pcu_suite_addTest( suite, JournalSuite_TestDPrintf );
+   pcu_suite_addTest( suite, JournalSuite_TestPrintChildStreams );
+   pcu_suite_addTest( suite, JournalSuite_TestReadFromDictionary );
+   pcu_suite_addTest( suite, JournalSuite_TestPrintString_WithLength );
+   pcu_suite_addTest( suite, JournalSuite_TestShortcuts );
+   pcu_suite_addTest( suite, JournalSuite_TestFirewall );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/MPIStreamSuite.c
--- a/Base/IO/tests/MPIStreamSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "MPIStreamSuite.h"
-
-#define MAXLINE 1000
-
-typedef struct {
-   MPI_Comm       comm;
-   int            rank;
-   int            numProcs;
-   Dictionary*    dict;
-} MPIStreamSuiteData;
-
-
-void MPIStreamSuite_Setup( MPIStreamSuiteData* data ) {
-   MPI_Comm_dup( MPI_COMM_WORLD, &data->comm );
-   MPI_Comm_size( data->comm, &data->numProcs );
-   MPI_Comm_rank( data->comm, &data->rank );
-   data->dict = Dictionary_New();
-}
-
-void MPIStreamSuite_Teardown( MPIStreamSuiteData* data ) {
-   Stg_Class_Delete( data->dict );
-}
-   
-
-void MPIStreamSuite_TestWriteAllProcessors( MPIStreamSuiteData* data ) {
-   Index          ii;
-   Stream*        stream1;
-   Name    testMPIFilename = "./test-mpi1.txt";
-   FILE*          testMPIFile;
-   char           outLine[MAXLINE];
-   char           compString[MAXLINE];
-   #define        PER_RANK_COUNT 2
-   char           dataArray[PER_RANK_COUNT];
-   Index          rank_I;
-
-   Dictionary_AddFromString( data->dict, "journal-file.MPIStream.one", testMPIFilename );
-   Dictionary_AddFromUnsignedInt( data->dict, "journal-mpi-offset.MPIStream.one", 100 );
-   Journal_ReadFromDictionary( data->dict );
-
-   stream1 = Journal_Register( MPIStream_Type, (Name)"one" );
-   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( stream1 ) );
-
-   /* Write half the alphabet to each process */
-   for ( ii = 0; ii < PER_RANK_COUNT; ++ii  ) {
-      dataArray[ii] = 'a' + PER_RANK_COUNT * data->rank + ii;
-   }
-   
-   /* Print the data */
-   MPIStream_WriteAllProcessors( stream1, dataArray, sizeof(char), PER_RANK_COUNT, data->comm );
-   Stream_Flush( stream1 );
-
-   /* Now build up the comparison string. Depends on how many processes are running. */
-   for (rank_I=0; rank_I < (unsigned)(data->numProcs); rank_I++ ) {
-      for ( ii = 0; ii < PER_RANK_COUNT; ++ii ) {
-         compString[PER_RANK_COUNT*rank_I+ii] = 'a' + PER_RANK_COUNT*rank_I + ii;
-      }
-   }
-   compString[data->numProcs*PER_RANK_COUNT] = '\0';
-
-   /* Do the following since in parallel on some systems, the file
-    * doesn't get re-opened at the start automatically. */
-   for ( rank_I = 0; rank_I < (unsigned)(data->numProcs); rank_I++ ) {
-      MPI_Barrier( data->comm );
-      if ( rank_I == (unsigned)(data->rank) ) {
-         testMPIFile = fopen( testMPIFilename, "r" );
-         rewind( testMPIFile );
-      }
-   }
-
-   pcu_check_true( fgets( outLine, MAXLINE, testMPIFile ));
-   pcu_check_streq( outLine, compString );
-   fclose( testMPIFile );
-   /* Make sure not to delete the file until all processors have read from it */
-   MPI_Barrier( data->comm );
-   if ( data->rank == 0 ) {
-      remove( testMPIFilename );
-   }
-}
-
-
-void MPIStreamSuite_TestPrintWithOffset( MPIStreamSuiteData* data ) {
-   Stream*     stream2;
-   Name testMPIFilename = "./test-mpi2.txt";
-   FILE*       testMPIFile;
-   char        outLine[MAXLINE];
-   char        rankPrintString[MAXLINE];
-   char        compString[MAXLINE];
-   int         rank_I;
-   int         ii;
-   Index       startPoint = 0;
-   unsigned    stringLength=0;
-
-   Dictionary_AddFromString( data->dict, "journal-file.MPIStream.two", testMPIFilename );
-   Journal_ReadFromDictionary( data->dict );
-
-   stream2 = Journal_Register( MPIStream_Type, (Name)"two" );
-   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( stream2 ) );
-
-   for( ii=0; ii <10*(data->rank+1); ii++ ) {
-      rankPrintString[ii] = 'a' + data->rank;
-   }
-   rankPrintString[10*(data->rank+1)] = '\0';
-
-   stringLength = 10*(data->rank+1 );
-
-   MPIStream_SetOffset( stream2, stringLength*sizeof(char), data->comm );
-
-   /* now print the data */
-   Journal_Printf( stream2, "%s", rankPrintString );
-   Stream_Flush( stream2 );
-
-   /* Now build up the comparison string. Depends on how many processes are running. */
-   startPoint = 0;
-   for (rank_I=0; rank_I < data->numProcs; rank_I++ ) {
-      for ( ii = 0; ii < 10*(rank_I+1); ii++ ) {
-         compString[startPoint+ii] = 'a' + rank_I;
-      }
-      startPoint += 10*(rank_I+1);
-   }
-   compString[startPoint] = '\0';
-
-   /* Do the following since in parallel on some systems, the file
-    * doesn't get re-opened at the start automatically. */
-   for ( rank_I = 0; rank_I < data->numProcs; rank_I++ ) {
-      MPI_Barrier( data->comm );
-      if ( rank_I == data->rank ) {
-         testMPIFile = fopen( testMPIFilename, "r" );
-         rewind( testMPIFile );
-      }
-   }
-
-   pcu_check_true( fgets( outLine, MAXLINE, testMPIFile ));
-   pcu_check_streq( outLine, compString );
-   fclose( testMPIFile );
-   /* Make sure not to delete the file until all processors have read from it */
-   MPI_Barrier( data->comm );
-   if ( data->rank == 0 ) {
-      remove( testMPIFilename );
-   }
-}
-
-
-void MPIStreamSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, MPIStreamSuiteData );
-   pcu_suite_setFixtures( suite, MPIStreamSuite_Setup, MPIStreamSuite_Teardown );
-   pcu_suite_addTest( suite, MPIStreamSuite_TestWriteAllProcessors );
-   pcu_suite_addTest( suite, MPIStreamSuite_TestPrintWithOffset );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/MPIStreamSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/tests/MPIStreamSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,188 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "MPIStreamSuite.h"
+
+#define MAXLINE 1000
+
+typedef struct {
+   MPI_Comm       comm;
+   int            rank;
+   int            numProcs;
+   Dictionary*    dict;
+} MPIStreamSuiteData;
+
+
+void MPIStreamSuite_Setup( MPIStreamSuiteData* data ) {
+   MPI_Comm_dup( MPI_COMM_WORLD, &data->comm );
+   MPI_Comm_size( data->comm, &data->numProcs );
+   MPI_Comm_rank( data->comm, &data->rank );
+   data->dict = Dictionary_New();
+}
+
+void MPIStreamSuite_Teardown( MPIStreamSuiteData* data ) {
+   Stg_Class_Delete( data->dict );
+}
+   
+
+void MPIStreamSuite_TestWriteAllProcessors( MPIStreamSuiteData* data ) {
+   Index          ii;
+   Stream*        stream1;
+   Name    testMPIFilename = "./test-mpi1.txt";
+   FILE*          testMPIFile;
+   char           outLine[MAXLINE];
+   char           compString[MAXLINE];
+   #define        PER_RANK_COUNT 2
+   char           dataArray[PER_RANK_COUNT];
+   Index          rank_I;
+
+   Dictionary_AddFromString( data->dict, "journal-file.MPIStream.one", testMPIFilename );
+   Dictionary_AddFromUnsignedInt( data->dict, "journal-mpi-offset.MPIStream.one", 100 );
+   Journal_ReadFromDictionary( data->dict );
+
+   stream1 = Journal_Register( MPIStream_Type, (Name)"one" );
+   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( stream1 ) );
+
+   /* Write half the alphabet to each process */
+   for ( ii = 0; ii < PER_RANK_COUNT; ++ii  ) {
+      dataArray[ii] = 'a' + PER_RANK_COUNT * data->rank + ii;
+   }
+   
+   /* Print the data */
+   MPIStream_WriteAllProcessors( stream1, dataArray, sizeof(char), PER_RANK_COUNT, data->comm );
+   Stream_Flush( stream1 );
+
+   /* Now build up the comparison string. Depends on how many processes are running. */
+   for (rank_I=0; rank_I < (unsigned)(data->numProcs); rank_I++ ) {
+      for ( ii = 0; ii < PER_RANK_COUNT; ++ii ) {
+         compString[PER_RANK_COUNT*rank_I+ii] = 'a' + PER_RANK_COUNT*rank_I + ii;
+      }
+   }
+   compString[data->numProcs*PER_RANK_COUNT] = '\0';
+
+   /* Do the following since in parallel on some systems, the file
+    * doesn't get re-opened at the start automatically. */
+   for ( rank_I = 0; rank_I < (unsigned)(data->numProcs); rank_I++ ) {
+      MPI_Barrier( data->comm );
+      if ( rank_I == (unsigned)(data->rank) ) {
+         testMPIFile = fopen( testMPIFilename, "r" );
+         rewind( testMPIFile );
+      }
+   }
+
+   pcu_check_true( fgets( outLine, MAXLINE, testMPIFile ));
+   pcu_check_streq( outLine, compString );
+   fclose( testMPIFile );
+   /* Make sure not to delete the file until all processors have read from it */
+   MPI_Barrier( data->comm );
+   if ( data->rank == 0 ) {
+      remove( testMPIFilename );
+   }
+}
+
+
+void MPIStreamSuite_TestPrintWithOffset( MPIStreamSuiteData* data ) {
+   Stream*     stream2;
+   Name testMPIFilename = "./test-mpi2.txt";
+   FILE*       testMPIFile;
+   char        outLine[MAXLINE];
+   char        rankPrintString[MAXLINE];
+   char        compString[MAXLINE];
+   int         rank_I;
+   int         ii;
+   Index       startPoint = 0;
+   unsigned    stringLength=0;
+
+   Dictionary_AddFromString( data->dict, "journal-file.MPIStream.two", testMPIFilename );
+   Journal_ReadFromDictionary( data->dict );
+
+   stream2 = Journal_Register( MPIStream_Type, (Name)"two" );
+   pcu_check_true( STREAM_ALL_RANKS == Stream_GetPrintingRank( stream2 ) );
+
+   for( ii=0; ii <10*(data->rank+1); ii++ ) {
+      rankPrintString[ii] = 'a' + data->rank;
+   }
+   rankPrintString[10*(data->rank+1)] = '\0';
+
+   stringLength = 10*(data->rank+1 );
+
+   MPIStream_SetOffset( stream2, stringLength*sizeof(char), data->comm );
+
+   /* now print the data */
+   Journal_Printf( stream2, "%s", rankPrintString );
+   Stream_Flush( stream2 );
+
+   /* Now build up the comparison string. Depends on how many processes are running. */
+   startPoint = 0;
+   for (rank_I=0; rank_I < data->numProcs; rank_I++ ) {
+      for ( ii = 0; ii < 10*(rank_I+1); ii++ ) {
+         compString[startPoint+ii] = 'a' + rank_I;
+      }
+      startPoint += 10*(rank_I+1);
+   }
+   compString[startPoint] = '\0';
+
+   /* Do the following since in parallel on some systems, the file
+    * doesn't get re-opened at the start automatically. */
+   for ( rank_I = 0; rank_I < data->numProcs; rank_I++ ) {
+      MPI_Barrier( data->comm );
+      if ( rank_I == data->rank ) {
+         testMPIFile = fopen( testMPIFilename, "r" );
+         rewind( testMPIFile );
+      }
+   }
+
+   pcu_check_true( fgets( outLine, MAXLINE, testMPIFile ));
+   pcu_check_streq( outLine, compString );
+   fclose( testMPIFile );
+   /* Make sure not to delete the file until all processors have read from it */
+   MPI_Barrier( data->comm );
+   if ( data->rank == 0 ) {
+      remove( testMPIFilename );
+   }
+}
+
+
+void MPIStreamSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, MPIStreamSuiteData );
+   pcu_suite_setFixtures( suite, MPIStreamSuite_Setup, MPIStreamSuite_Teardown );
+   pcu_suite_addTest( suite, MPIStreamSuite_TestWriteAllProcessors );
+   pcu_suite_addTest( suite, MPIStreamSuite_TestPrintWithOffset );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/PathUtilsSuite.c
--- a/Base/IO/tests/PathUtilsSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**   Tests the PathUtilsSuite
-**
-** $Id: testPathUtils.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <mpi.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "PathUtilsSuite.h"
-#include "sys/stat.h"
-
-typedef struct {
-   int rank;
-} PathUtilsSuiteData;
-
-
-void PathUtilsSuite_Setup( PathUtilsSuiteData* data ) {
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
-}
-
-void PathUtilsSuite_Teardown( PathUtilsSuiteData* data ) {
-}
-
-
-void PathUtilsSuite_TestPathJoin( PathUtilsSuiteData* data ) {
-   char      searchPaths[1024];
-   unsigned  len;
-   
-   PathJoin( searchPaths, 1, "." );
-   len = strlen( searchPaths );
-   searchPaths[len] = ':';
-   
-   PathJoin( &searchPaths[len + 1], 2,  ".", "data" );
-   len = strlen( searchPaths );
-   searchPaths[len] = ':';
-   
-   PathJoin( &searchPaths[len + 1], 6, "..", "..", "..", "does", "not", "exist" );
-   
-   pcu_check_streq( searchPaths, ".:./data:../../../does/not/exist" );
-}
-
-
-void PathUtilsSuite_TestFindFile( PathUtilsSuiteData* data ) {
-   char*       searchPaths = NULL;
-   char        fullPath[1024];
-   Name subDir = "./testSubDir";
-   Name subDirFilename = "./testSubDir/subDirTest.xml";
-   Name currDirFilename = "./currDirTest.xml";
-
-
-   Stg_asprintf( &searchPaths, ".:%s:/does/not/exist", subDir );
-   /* Create necessary test files/dirs */
-   if (data->rank==0) {
-      FILE*       subDirFile = NULL;
-      FILE*       currDirFile = NULL;
-
-      currDirFile = fopen( currDirFilename, "w" );
-      fputs( "test.\n", currDirFile );
-      fclose( currDirFile );
-      mkdir( subDir, 0755 );
-      subDirFile = fopen( subDirFilename, "w" );
-      fputs( "test.\n", subDirFile );
-      fclose( subDirFile );
-   }
-   MPI_Barrier(MPI_COMM_WORLD);
-
-   /* try and open some files using the search path */
-   /* Only do this using proc 0 - for why, see warning in Doxygen comment for the function. */
-   if (data->rank==0) {
-      /* This first test is to make sure it can handle files preceded with ./ */
-      FindFile( fullPath, currDirFilename, searchPaths );
-      pcu_check_streq( fullPath, currDirFilename );
-
-      FindFile( fullPath, "currDirTest.xml", searchPaths );
-      pcu_check_streq( fullPath, currDirFilename );
-      
-      FindFile( fullPath, "subDirTest.xml", searchPaths );
-      pcu_check_streq( fullPath, subDirFilename );
-      
-      FindFile( fullPath, "nofile.man", searchPaths );
-      pcu_check_streq( fullPath, "" );
-      
-      FindFile( fullPath, "/Users/luke/Projects/StGermain/env_vars", searchPaths );
-      pcu_check_streq( fullPath, "" );
-   }
-
-   if (data->rank==0) {
-      remove( currDirFilename );
-      remove( subDirFilename );
-      rmdir( subDir );
-   }
-}
-
-
-void PathUtilsSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, PathUtilsSuiteData );
-   pcu_suite_setFixtures( suite, PathUtilsSuite_Setup, PathUtilsSuite_Teardown );
-   pcu_suite_addTest( suite, PathUtilsSuite_TestPathJoin );
-   pcu_suite_addTest( suite, PathUtilsSuite_TestFindFile );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/PathUtilsSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/tests/PathUtilsSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,135 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**   Tests the PathUtilsSuite
+**
+** $Id: testPathUtils.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mpi.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "PathUtilsSuite.h"
+#include "sys/stat.h"
+
+typedef struct {
+   int rank;
+} PathUtilsSuiteData;
+
+
+void PathUtilsSuite_Setup( PathUtilsSuiteData* data ) {
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->rank );
+}
+
+void PathUtilsSuite_Teardown( PathUtilsSuiteData* data ) {
+}
+
+
+void PathUtilsSuite_TestPathJoin( PathUtilsSuiteData* data ) {
+   char      searchPaths[1024];
+   unsigned  len;
+   
+   PathJoin( searchPaths, 1, "." );
+   len = strlen( searchPaths );
+   searchPaths[len] = ':';
+   
+   PathJoin( &searchPaths[len + 1], 2,  ".", "data" );
+   len = strlen( searchPaths );
+   searchPaths[len] = ':';
+   
+   PathJoin( &searchPaths[len + 1], 6, "..", "..", "..", "does", "not", "exist" );
+   
+   pcu_check_streq( searchPaths, ".:./data:../../../does/not/exist" );
+}
+
+
+void PathUtilsSuite_TestFindFile( PathUtilsSuiteData* data ) {
+   char*       searchPaths = NULL;
+   char        fullPath[1024];
+   Name subDir = "./testSubDir";
+   Name subDirFilename = "./testSubDir/subDirTest.xml";
+   Name currDirFilename = "./currDirTest.xml";
+
+
+   Stg_asprintf( &searchPaths, ".:%s:/does/not/exist", subDir );
+   /* Create necessary test files/dirs */
+   if (data->rank==0) {
+      FILE*       subDirFile = NULL;
+      FILE*       currDirFile = NULL;
+
+      currDirFile = fopen( currDirFilename, "w" );
+      fputs( "test.\n", currDirFile );
+      fclose( currDirFile );
+      mkdir( subDir, 0755 );
+      subDirFile = fopen( subDirFilename, "w" );
+      fputs( "test.\n", subDirFile );
+      fclose( subDirFile );
+   }
+   MPI_Barrier(MPI_COMM_WORLD);
+
+   /* try and open some files using the search path */
+   /* Only do this using proc 0 - for why, see warning in Doxygen comment for the function. */
+   if (data->rank==0) {
+      /* This first test is to make sure it can handle files preceded with ./ */
+      FindFile( fullPath, currDirFilename, searchPaths );
+      pcu_check_streq( fullPath, currDirFilename );
+
+      FindFile( fullPath, "currDirTest.xml", searchPaths );
+      pcu_check_streq( fullPath, currDirFilename );
+      
+      FindFile( fullPath, "subDirTest.xml", searchPaths );
+      pcu_check_streq( fullPath, subDirFilename );
+      
+      FindFile( fullPath, "nofile.man", searchPaths );
+      pcu_check_streq( fullPath, "" );
+      
+      FindFile( fullPath, "/Users/luke/Projects/StGermain/env_vars", searchPaths );
+      pcu_check_streq( fullPath, "" );
+   }
+
+   if (data->rank==0) {
+      remove( currDirFilename );
+      remove( subDirFilename );
+      rmdir( subDir );
+   }
+}
+
+
+void PathUtilsSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, PathUtilsSuiteData );
+   pcu_suite_setFixtures( suite, PathUtilsSuite_Setup, PathUtilsSuite_Teardown );
+   pcu_suite_addTest( suite, PathUtilsSuite_TestPathJoin );
+   pcu_suite_addTest( suite, PathUtilsSuite_TestFindFile );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/RankFormatterSuite.c
--- a/Base/IO/tests/RankFormatterSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain/Base/Foundation/Foundation.h"
-#include "StGermain/Base/IO/IO.h"
-#include "RankFormatterSuite.h"
-
-typedef struct {
-   int            myRank;
-   int            nProcs;
-} RankFormatterSuiteData;
-
-
-void RankFormatterSuite_Setup( RankFormatterSuiteData* data ) {
-   MPI_Comm_rank( MPI_COMM_WORLD, &data->myRank );
-   MPI_Comm_size( MPI_COMM_WORLD, &data->nProcs );
-}
-
-void RankFormatterSuite_Teardown( RankFormatterSuiteData* data ) {
-}
-   
-
-void RankFormatterSuite_TestPrintWithRank( RankFormatterSuiteData* data ) {
-   Index       ii=0;
-   Stream*     myInfo = NULL;      
-   #define     MAXLINE 1000
-   char        expLine[MAXLINE];
-   char        outLine[MAXLINE];
-   char*       testOutFilename = NULL;
-   FILE*       testOutFile = NULL;
-   char*       prefixStr = NULL;
-
-   Stg_asprintf( &testOutFilename, "./testRankFormatter.%d.txt", data->myRank );
-
-   if ( 1 == data->nProcs ) {
-      Stg_asprintf( &prefixStr, "");
-   }
-   else {
-      Stg_asprintf( &prefixStr, "%d: ", data->myRank );
-   }
-
-   myInfo = Journal_Register( Info_Type, (Name)"MyInfo"  );
-   Stream_AddFormatter( myInfo, RankFormatter_New() );
-   Stream_SetPrintingRank( myInfo, STREAM_ALL_RANKS );
-   Stream_RedirectFile( myInfo, testOutFilename );
-
-   testOutFile = fopen( testOutFilename, "r" );
-
-   Journal_Printf( myInfo, "Hello world\n" );
-   sprintf( expLine, "%sHello world\n", prefixStr );
-   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
-   pcu_check_streq( outLine, expLine );
-   Journal_Printf( myInfo, "\n\n\n" );
-   sprintf( expLine, "%s\n", prefixStr );
-   for (ii=0; ii<3; ii++ ) {
-      pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
-      pcu_check_streq( outLine, expLine );
-   }
-   Journal_Printf( myInfo, "abc\ndef\nghi\n" );
-   sprintf( expLine, "%sabc\n", prefixStr );
-   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
-   pcu_check_streq( outLine, expLine );
-   sprintf( expLine, "%sdef\n", prefixStr );
-   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
-   pcu_check_streq( outLine, expLine );
-   sprintf( expLine, "%sghi\n", prefixStr );
-   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
-   pcu_check_streq( outLine, expLine );
-
-   fclose( testOutFile );
-   remove( testOutFilename );
-}
-
-
-void RankFormatterSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, RankFormatterSuiteData );
-   pcu_suite_setFixtures( suite, RankFormatterSuite_Setup, RankFormatterSuite_Teardown );
-   pcu_suite_addTest( suite, RankFormatterSuite_TestPrintWithRank );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/IO/tests/RankFormatterSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/IO/tests/RankFormatterSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,113 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain/Base/Foundation/Foundation.h"
+#include "StGermain/Base/IO/IO.h"
+#include "RankFormatterSuite.h"
+
+typedef struct {
+   int            myRank;
+   int            nProcs;
+} RankFormatterSuiteData;
+
+
+void RankFormatterSuite_Setup( RankFormatterSuiteData* data ) {
+   MPI_Comm_rank( MPI_COMM_WORLD, &data->myRank );
+   MPI_Comm_size( MPI_COMM_WORLD, &data->nProcs );
+}
+
+void RankFormatterSuite_Teardown( RankFormatterSuiteData* data ) {
+}
+   
+
+void RankFormatterSuite_TestPrintWithRank( RankFormatterSuiteData* data ) {
+   Index       ii=0;
+   Stream*     myInfo = NULL;      
+   #define     MAXLINE 1000
+   char        expLine[MAXLINE];
+   char        outLine[MAXLINE];
+   char*       testOutFilename = NULL;
+   FILE*       testOutFile = NULL;
+   char*       prefixStr = NULL;
+
+   Stg_asprintf( &testOutFilename, "./testRankFormatter.%d.txt", data->myRank );
+
+   if ( 1 == data->nProcs ) {
+      Stg_asprintf( &prefixStr, "");
+   }
+   else {
+      Stg_asprintf( &prefixStr, "%d: ", data->myRank );
+   }
+
+   myInfo = Journal_Register( Info_Type, (Name)"MyInfo"  );
+   Stream_AddFormatter( myInfo, RankFormatter_New() );
+   Stream_SetPrintingRank( myInfo, STREAM_ALL_RANKS );
+   Stream_RedirectFile( myInfo, testOutFilename );
+
+   testOutFile = fopen( testOutFilename, "r" );
+
+   Journal_Printf( myInfo, "Hello world\n" );
+   sprintf( expLine, "%sHello world\n", prefixStr );
+   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
+   pcu_check_streq( outLine, expLine );
+   Journal_Printf( myInfo, "\n\n\n" );
+   sprintf( expLine, "%s\n", prefixStr );
+   for (ii=0; ii<3; ii++ ) {
+      pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
+      pcu_check_streq( outLine, expLine );
+   }
+   Journal_Printf( myInfo, "abc\ndef\nghi\n" );
+   sprintf( expLine, "%sabc\n", prefixStr );
+   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
+   pcu_check_streq( outLine, expLine );
+   sprintf( expLine, "%sdef\n", prefixStr );
+   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
+   pcu_check_streq( outLine, expLine );
+   sprintf( expLine, "%sghi\n", prefixStr );
+   pcu_check_true(         fgets( outLine, MAXLINE, testOutFile ));
+   pcu_check_streq( outLine, expLine );
+
+   fclose( testOutFile );
+   remove( testOutFilename );
+}
+
+
+void RankFormatterSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, RankFormatterSuiteData );
+   pcu_suite_setFixtures( suite, RankFormatterSuite_Setup, RankFormatterSuite_Teardown );
+   pcu_suite_addTest( suite, RankFormatterSuite_TestPrintWithRank );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/ListPlugins/src/main.c
--- a/Base/ListPlugins/src/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	David May, PhD Student Monash University, VPAC. (davidm at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**	Reads an XML file (potentially with includes) and then outputs as a single file
-**
-** $Id: main.c 190 2005-06-20 04:56:57Z RobertTurnbull $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <mpi.h>
-
-#include "Base/Base.h"
-
-void SingleRegister( void* c ) {}
-
-int main( int argc, char* argv[] ) 
-{
-	Dictionary*			dictionary;
-	XML_IO_Handler*			ioHandler;
-	Stream*				stream;
-	Stream*				error;
-	Dictionary_Entry_Value*		pluginList;
-
-	Index plugin_I, count;
-
-
-	MPI_Init( &argc, &argv );
-	if( !Base_Init( &argc, &argv ) ) {
-		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
-		exit( EXIT_FAILURE );
-	}
-	stream = Journal_Register( Info_Type, __FILE__ );
-	error = Journal_Register( Info_Type, __FILE__ );
-	
-	dictionary = Dictionary_New();
-
-	/* Read input */
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-
-	Stream_Enable( stream, True );
-	Stream_Enable( error, True );
-
-	pluginList = Dictionary_Get( dictionary, "plugins" );
-	count = Dictionary_Entry_Value_GetCount( pluginList );
-	for ( plugin_I = 0; plugin_I < count; ++plugin_I ) {
-		Journal_Printf( stream, "%s\n", Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( pluginList, plugin_I ) ) );
-	}
-
-	Stg_Class_Delete( dictionary );
-	Stg_Class_Delete( ioHandler );
-
-	Base_Finalise();
-	MPI_Finalize();
-
-	return 0; /* success */
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/ListPlugins/src/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/ListPlugins/src/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,88 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student Monash University, VPAC. (davidm at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**	Reads an XML file (potentially with includes) and then outputs as a single file
+**
+** $Id: main.c 190 2005-06-20 04:56:57Z RobertTurnbull $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <mpi.h>
+
+#include "Base/Base.h"
+
+void SingleRegister( void* c ) {}
+
+int main( int argc, char* argv[] ) 
+{
+	Dictionary*			dictionary;
+	XML_IO_Handler*			ioHandler;
+	Stream*				stream;
+	Stream*				error;
+	Dictionary_Entry_Value*		pluginList;
+
+	Index plugin_I, count;
+
+
+	MPI_Init( &argc, &argv );
+	if( !Base_Init( &argc, &argv ) ) {
+		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
+		exit( EXIT_FAILURE );
+	}
+	stream = Journal_Register( Info_Type, __FILE__ );
+	error = Journal_Register( Info_Type, __FILE__ );
+	
+	dictionary = Dictionary_New();
+
+	/* Read input */
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+
+	Stream_Enable( stream, True );
+	Stream_Enable( error, True );
+
+	pluginList = Dictionary_Get( dictionary, "plugins" );
+	count = Dictionary_Entry_Value_GetCount( pluginList );
+	for ( plugin_I = 0; plugin_I < count; ++plugin_I ) {
+		Journal_Printf( stream, "%s\n", Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( pluginList, plugin_I ) ) );
+	}
+
+	Stg_Class_Delete( dictionary );
+	Stg_Class_Delete( ioHandler );
+
+	Base_Finalise();
+	MPI_Finalize();
+
+	return 0; /* success */
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Context/bindings.c
--- a/Base/Python/Bindings/Context/bindings.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: bindings.c 4204 2008-01-15 02:48:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-
-#include <mpi.h>
-#include "StGermain/Base/Base.h"
-#include "bindings.h"
-#include "misc.h"
-
-struct PyMethodDef Context_Python_Methods[] = {
-	{ Context_Python_copyright__name__,	Context_Python_copyright,	METH_VARARGS, Context_Python_copyright__doc__		},
-	{ Context_Python_Print__name__,		Context_Python_Print,		METH_VARARGS, Context_Python_Print__doc__		},
-	{ Context_Python_Delete__name__,	Context_Python_Delete,		METH_VARARGS, Context_Python_Delete__doc__		},
-	{ Context_Python_AssignFromXML__name__,	Context_Python_AssignFromXML,	METH_VARARGS, Context_Python_AssignFromXML__doc__		},
-	{ Context_Python_Build__name__,		Context_Python_Build,		METH_VARARGS, Context_Python_Build__doc__		},
-	{ Context_Python_Initialise__name__,	Context_Python_Initialise,	METH_VARARGS, Context_Python_Initialise__doc__		},
-	{ Context_Python_Execute__name__,	Context_Python_Execute,		METH_VARARGS, Context_Python_Execute__doc__		},
-	{ Context_Python_Destroy__name__,	Context_Python_Destroy,		METH_VARARGS, Context_Python_Destroy__doc__		},
-	{ Context_Python_Dt__name__,		Context_Python_Dt,		METH_VARARGS, Context_Python_Dt__doc__			},
-	{ Context_Python_Step__name__,		Context_Python_Step,		METH_VARARGS, Context_Python_Step__doc__		},
-	{ Context_Python_GetDictionary__name__,	Context_Python_GetDictionary,	METH_VARARGS, Context_Python_GetDictionary__doc__	},
-	{ Context_Python_SetTime__name__,	Context_Python_SetTime,		METH_VARARGS, Context_Python_SetTime__doc__		},
-	{ Context_Python_SetTimeStep__name__,	Context_Python_SetTimeStep,	METH_VARARGS, Context_Python_SetTimeStep__doc__		},
-	{ 0, 0, 0, 0 }
-};
-
-
-/* "Print" member */
-char Context_Python_Print__doc__[] = "Print the Context";
-char Context_Python_Print__name__[] = "Print";
-PyObject* Context_Python_Print( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	Stream* stream = Journal_Register (Info_Type, "myString");
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	Stg_Class_Print( context, stream );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Delete" member */
-char Context_Python_Delete__doc__[] = "Delete/destroy the Context";
-char Context_Python_Delete__name__[] = "Delete";
-PyObject* Context_Python_Delete( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	Stg_Class_Delete( context );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Construct" member */
-char Context_Python_Construct__doc__[] = "Construct the Context...";
-char Context_Python_Construct__name__[] = "Construct";
-PyObject* Context_Python_AssignFromXML( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-
-	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True );
-
-	/* Return */
-	Py_INCREF( Py_None );
-	return PyCObject_FromVoidPtr( context, 0 );
-	}
-
-/* "Build" member */
-char Context_Python_Build__doc__[] = "Build the Context... allocates memory (builds arrays)";
-char Context_Python_Build__name__[] = "Build";
-PyObject* Context_Python_Build( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	Stg_Component_Build( context, 0 /* dummy */, False );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Initialise" member */
-char Context_Python_Initialise__doc__[] = "Initialise the Context ... initialises memory (fills arrays with initial values)";
-char Context_Python_Initialise__name__[] = "Initialise";
-PyObject* Context_Python_Initialise( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	Stg_Component_Initialise( context, 0 /* dummy */, False );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Execute" member */
-char Context_Python_Execute__doc__[] = "Execute the Context";
-char Context_Python_Execute__name__[] = "Execute";
-PyObject* Context_Python_Execute( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	Stg_Component_Execute( context, 0 /* dummy */, False );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Destroy" member */
-char Context_Python_Destroy__doc__[] = "Destroy the Context";
-char Context_Python_Destroy__name__[] = "Destroy";
-PyObject* Context_Python_Destroy( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	Stg_Component_Destroy( context, 0 /* dummy */, False );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Dt" member */
-char Context_Python_Dt__doc__[] = "Obtain the desired dt of the Context";
-char Context_Python_Dt__name__[] = "Dt";
-PyObject* Context_Python_Dt( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function and return value*/
-	return PyFloat_FromDouble( AbstractContext_Dt( context ) );
-}
-
-/* "Step" member */
-char Context_Python_Step__doc__[] = "Step the Context";
-char Context_Python_Step__name__[] = "Step";
-PyObject* Context_Python_Step( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	double		dt;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "Od:", &pyContext, &dt ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	context->currentTime += dt;
-	AbstractContext_Step( context, dt );
-	context->timeStep++;	
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "GetDictionary" member */
-char Context_Python_GetDictionary__doc__[] = "Get Dictionary of the Context";
-char Context_Python_GetDictionary__name__[] = "GetDictionary";
-PyObject* Context_Python_GetDictionary( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function and return value*/
-	return PyCObject_FromVoidPtr( context->dictionary, 0 );
-}
-
-
-/* "SetTimeStep" member */
-char Context_Python_SetTimeStep__doc__[] = "Set the Context timeStep";
-char Context_Python_SetTimeStep__name__[] = "SetTimeStep";
-PyObject* Context_Python_SetTimeStep( PyObject* self, PyObject* args ) {
-	unsigned int	timeStep;
-	PyObject*	pyContext;
-	Context*	context;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "Oi:", &pyContext, &timeStep ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	context->timeStep = timeStep;
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}	
-
-	
-/* "SetTime" member */
-char Context_Python_SetTime__doc__[] = "Set the Context time";
-char Context_Python_SetTime__name__[] = "SetTime";
-PyObject* Context_Python_SetTime( PyObject* self, PyObject* args ) {
-	PyObject*	pyContext;
-	Context*	context;
-	double		currentTime;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "Od:", &pyContext, &currentTime ) ) {
-		return NULL;
-	}
-	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
-	
-	/* Run function */
-	context->currentTime = currentTime;
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}	
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Context/bindings.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Python/Bindings/Context/bindings.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,306 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: bindings.c 4204 2008-01-15 02:48:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+
+#include <mpi.h>
+#include "StGermain/Base/Base.h"
+#include "bindings.h"
+#include "misc.h"
+
+struct PyMethodDef Context_Python_Methods[] = {
+	{ Context_Python_copyright__name__,	Context_Python_copyright,	METH_VARARGS, Context_Python_copyright__doc__		},
+	{ Context_Python_Print__name__,		Context_Python_Print,		METH_VARARGS, Context_Python_Print__doc__		},
+	{ Context_Python_Delete__name__,	Context_Python_Delete,		METH_VARARGS, Context_Python_Delete__doc__		},
+	{ Context_Python_AssignFromXML__name__,	Context_Python_AssignFromXML,	METH_VARARGS, Context_Python_AssignFromXML__doc__		},
+	{ Context_Python_Build__name__,		Context_Python_Build,		METH_VARARGS, Context_Python_Build__doc__		},
+	{ Context_Python_Initialise__name__,	Context_Python_Initialise,	METH_VARARGS, Context_Python_Initialise__doc__		},
+	{ Context_Python_Execute__name__,	Context_Python_Execute,		METH_VARARGS, Context_Python_Execute__doc__		},
+	{ Context_Python_Destroy__name__,	Context_Python_Destroy,		METH_VARARGS, Context_Python_Destroy__doc__		},
+	{ Context_Python_Dt__name__,		Context_Python_Dt,		METH_VARARGS, Context_Python_Dt__doc__			},
+	{ Context_Python_Step__name__,		Context_Python_Step,		METH_VARARGS, Context_Python_Step__doc__		},
+	{ Context_Python_GetDictionary__name__,	Context_Python_GetDictionary,	METH_VARARGS, Context_Python_GetDictionary__doc__	},
+	{ Context_Python_SetTime__name__,	Context_Python_SetTime,		METH_VARARGS, Context_Python_SetTime__doc__		},
+	{ Context_Python_SetTimeStep__name__,	Context_Python_SetTimeStep,	METH_VARARGS, Context_Python_SetTimeStep__doc__		},
+	{ 0, 0, 0, 0 }
+};
+
+
+/* "Print" member */
+char Context_Python_Print__doc__[] = "Print the Context";
+char Context_Python_Print__name__[] = "Print";
+PyObject* Context_Python_Print( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	Stream* stream = Journal_Register (Info_Type, "myString");
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	Stg_Class_Print( context, stream );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Delete" member */
+char Context_Python_Delete__doc__[] = "Delete/destroy the Context";
+char Context_Python_Delete__name__[] = "Delete";
+PyObject* Context_Python_Delete( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	Stg_Class_Delete( context );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Construct" member */
+char Context_Python_Construct__doc__[] = "Construct the Context...";
+char Context_Python_Construct__name__[] = "Construct";
+PyObject* Context_Python_AssignFromXML( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+
+	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True );
+
+	/* Return */
+	Py_INCREF( Py_None );
+	return PyCObject_FromVoidPtr( context, 0 );
+	}
+
+/* "Build" member */
+char Context_Python_Build__doc__[] = "Build the Context... allocates memory (builds arrays)";
+char Context_Python_Build__name__[] = "Build";
+PyObject* Context_Python_Build( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	Stg_Component_Build( context, 0 /* dummy */, False );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Initialise" member */
+char Context_Python_Initialise__doc__[] = "Initialise the Context ... initialises memory (fills arrays with initial values)";
+char Context_Python_Initialise__name__[] = "Initialise";
+PyObject* Context_Python_Initialise( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	Stg_Component_Initialise( context, 0 /* dummy */, False );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Execute" member */
+char Context_Python_Execute__doc__[] = "Execute the Context";
+char Context_Python_Execute__name__[] = "Execute";
+PyObject* Context_Python_Execute( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	Stg_Component_Execute( context, 0 /* dummy */, False );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Destroy" member */
+char Context_Python_Destroy__doc__[] = "Destroy the Context";
+char Context_Python_Destroy__name__[] = "Destroy";
+PyObject* Context_Python_Destroy( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	Stg_Component_Destroy( context, 0 /* dummy */, False );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Dt" member */
+char Context_Python_Dt__doc__[] = "Obtain the desired dt of the Context";
+char Context_Python_Dt__name__[] = "Dt";
+PyObject* Context_Python_Dt( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function and return value*/
+	return PyFloat_FromDouble( AbstractContext_Dt( context ) );
+}
+
+/* "Step" member */
+char Context_Python_Step__doc__[] = "Step the Context";
+char Context_Python_Step__name__[] = "Step";
+PyObject* Context_Python_Step( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	double		dt;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "Od:", &pyContext, &dt ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	context->currentTime += dt;
+	AbstractContext_Step( context, dt );
+	context->timeStep++;	
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "GetDictionary" member */
+char Context_Python_GetDictionary__doc__[] = "Get Dictionary of the Context";
+char Context_Python_GetDictionary__name__[] = "GetDictionary";
+PyObject* Context_Python_GetDictionary( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyContext ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function and return value*/
+	return PyCObject_FromVoidPtr( context->dictionary, 0 );
+}
+
+
+/* "SetTimeStep" member */
+char Context_Python_SetTimeStep__doc__[] = "Set the Context timeStep";
+char Context_Python_SetTimeStep__name__[] = "SetTimeStep";
+PyObject* Context_Python_SetTimeStep( PyObject* self, PyObject* args ) {
+	unsigned int	timeStep;
+	PyObject*	pyContext;
+	Context*	context;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "Oi:", &pyContext, &timeStep ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	context->timeStep = timeStep;
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}	
+
+	
+/* "SetTime" member */
+char Context_Python_SetTime__doc__[] = "Set the Context time";
+char Context_Python_SetTime__name__[] = "SetTime";
+PyObject* Context_Python_SetTime( PyObject* self, PyObject* args ) {
+	PyObject*	pyContext;
+	Context*	context;
+	double		currentTime;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "Od:", &pyContext, &currentTime ) ) {
+		return NULL;
+	}
+	context = (Context*)( PyCObject_AsVoidPtr( pyContext ) );
+	
+	/* Run function */
+	context->currentTime = currentTime;
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}	
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Context/init.c
--- a/Base/Python/Bindings/Context/init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "bindings.h"
-#include "misc.h"
-
-char Context_Python__doc__[] = "";
-
-void initContext() {
-	Py_InitModule4( "Context", Context_Python_Methods, Context_Python__doc__, 0, PYTHON_API_VERSION );
-	if( PyErr_Occurred() ) {
-		Py_FatalError( "can't initialize module Context" );
-	}
-	return;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Context/init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Python/Bindings/Context/init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,45 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "bindings.h"
+#include "misc.h"
+
+char Context_Python__doc__[] = "";
+
+void initContext() {
+	Py_InitModule4( "Context", Context_Python_Methods, Context_Python__doc__, 0, PYTHON_API_VERSION );
+	if( PyErr_Occurred() ) {
+		Py_FatalError( "can't initialize module Context" );
+	}
+	return;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Context/misc.c
--- a/Base/Python/Bindings/Context/misc.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "misc.h"
-
-
-char Context_Python_copyright__doc__[] = "";
-char Context_Python_copyright__name__[] = "copyright";
-
-PyObject* Context_Python_copyright( PyObject* self, PyObject* args ) {
-    return Py_BuildValue( "s", "StGermain.Base.Bindings.Context Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Context/misc.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Python/Bindings/Context/misc.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,42 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "misc.h"
+
+
+char Context_Python_copyright__doc__[] = "";
+char Context_Python_copyright__name__[] = "copyright";
+
+PyObject* Context_Python_copyright( PyObject* self, PyObject* args ) {
+    return Py_BuildValue( "s", "StGermain.Base.Bindings.Context Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Dictionary/bindings.c
--- a/Base/Python/Bindings/Dictionary/bindings.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: bindings.c 4204 2008-01-15 02:48:13Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-
-#include <mpi.h>
-#include "StGermain/Base/Base.h"
-#include <limits.h>
-#include "bindings.h"
-#include "misc.h"
-
-struct PyMethodDef Dictionary_Python_Methods[] = {
-	{ Dictionary_Python_copyright__name__,		Dictionary_Python_copyright,		METH_VARARGS, Dictionary_Python_copyright__doc__	},
-	{ Dictionary_Python_New__name__,		Dictionary_Python_New,			METH_VARARGS, Dictionary_Python_New__doc__		},
-	{ Dictionary_Python_Print__name__,		Dictionary_Python_Print,		METH_VARARGS, Dictionary_Python_Print__doc__		},
-	{ Dictionary_Python_Delete__name__,		Dictionary_Python_Delete,		METH_VARARGS, Dictionary_Python_Delete__doc__		},
-	{ Dictionary_Python_AddString__name__,		Dictionary_Python_AddString,		METH_VARARGS, Dictionary_Python_AddString__doc__	},
-	{ Dictionary_Python_AddStruct__name__,		Dictionary_Python_AddStruct,		METH_VARARGS, Dictionary_Python_AddStruct__doc__	},
-	{ Dictionary_Python_LoadFromFile__name__,	Dictionary_Python_LoadFromFile,		METH_VARARGS, Dictionary_Python_LoadFromFile__doc__	},
-	{ 0, 0, 0, 0 }
-};
-
-
-/* "New" member */
-char Dictionary_Python_New__doc__[] = "Create a new Dictionary";
-char Dictionary_Python_New__name__[] = "New";
-PyObject* Dictionary_Python_New( PyObject* self, PyObject* args ) {
-	return PyCObject_FromVoidPtr( Dictionary_New(), 0 );
-}
-
-/* "Print" member */
-char Dictionary_Python_Print__doc__[] = "Print the Dictionary";
-char Dictionary_Python_Print__name__[] = "Print";
-PyObject* Dictionary_Python_Print( PyObject* self, PyObject* args) {
-	PyObject*	pyDictionary;
-	Dictionary*	dictionary;
-	Stream*		stream = Journal_Register (Info_Type, "myStream");
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyDictionary ) ) {
-		return NULL;
-	}
-	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
-	
-	/* Run function */
-	Stg_Class_Print( dictionary, stream );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "Stg_Class_Delete" member */
-char Dictionary_Python_Delete__doc__[] = "Stg_Class_Delete/destroy the Dictionary";
-char Dictionary_Python_Delete__name__[] = "Stg_Class_Delete";
-PyObject* Dictionary_Python_Delete( PyObject* self, PyObject* args ) {
-	PyObject*	pyDictionary;
-	Dictionary*	dictionary;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "O:", &pyDictionary ) ) {
-		return NULL;
-	}
-	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
-	
-	/* Run function */
-	Stg_Class_Delete( dictionary );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "AddString" member */
-char Dictionary_Python_AddString__doc__[] = "Add an item (scalar) to the Dictionary";
-char Dictionary_Python_AddString__name__[] = "AddString";
-PyObject* Dictionary_Python_AddString( PyObject* self, PyObject* args ) {
-	PyObject*	pyDictionary;
-	Dictionary*	dictionary;
-	char*		name;
-	char*		value;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "Oss:", &pyDictionary, &name, &value ) ) {
-		return NULL;
-	}
-	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
-	
-	/* Run function */
-	Dictionary_Add( dictionary, name, Dictionary_Entry_Value_FromString( value ) );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "AddStruct" member */
-char Dictionary_Python_AddStruct__doc__[] = "Add a struct (Dictionary) to the Dictionary";
-char Dictionary_Python_AddStruct__name__[] = "AddStruct";
-PyObject* Dictionary_Python_AddStruct( PyObject* self, PyObject* args ) {
-	PyObject*	pyDictionary;
-	Dictionary*	dictionary;
-	char*		name;
-	PyObject*	pyValue;
-	Dictionary*	value;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "OsO:", &pyDictionary, &name, &pyValue ) ) {
-		return NULL;
-	}
-	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
-	value = (Dictionary*)( PyCObject_AsVoidPtr( pyValue ) );
-	
-	/* Run function */
-	Dictionary_Add( dictionary, name, Dictionary_Entry_Value_FromStruct( value ) );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "AddToList" member */
-char Dictionary_Python_AddStringToList__doc__[] = "Add an item (scalar) to a list of the Dictionary";
-char Dictionary_Python_AddStringToList__name__[] = "AddStringToList";
-PyObject* Dictionary_Python_AddStringToList( PyObject* self, PyObject* args ) {
-	PyObject*		pyDictionary;
-	Dictionary*		dictionary;
-	char*			name;
-	char*			value;
-	Dictionary_Entry_Value*	list;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "Oss:", &pyDictionary, &name, &value ) ) {
-		return NULL;
-	}
-	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
-	
-	/* Run function */
-	list = Dictionary_Get( dictionary, name );
-	Dictionary_Entry_Value_AddElement( list, Dictionary_Entry_Value_FromString( value ) );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-/* "LoadFromFile" member */
-char Dictionary_Python_LoadFromFile__doc__[] = "Load the contents of a file into the Dictionary";
-char Dictionary_Python_LoadFromFile__name__[] = "LoadFromFile";
-PyObject* Dictionary_Python_LoadFromFile( PyObject* self, PyObject* args ) {
-	PyObject*	pyDictionary;
-	Dictionary*	dictionary;
-	XML_IO_Handler*	ioHandler;
-	char*		filename;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "Os:", &pyDictionary, &filename ) ) {
-		return NULL;
-	}
-	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
-	
-	/* Run function */
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromFile( ioHandler, filename, dictionary );
-	Stg_Class_Delete( ioHandler );
-	
-	/* Return */
-	Py_INCREF( Py_None );
-	return Py_None;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Dictionary/bindings.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Python/Bindings/Dictionary/bindings.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,199 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: bindings.c 4204 2008-01-15 02:48:13Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+
+#include <mpi.h>
+#include "StGermain/Base/Base.h"
+#include <limits.h>
+#include "bindings.h"
+#include "misc.h"
+
+struct PyMethodDef Dictionary_Python_Methods[] = {
+	{ Dictionary_Python_copyright__name__,		Dictionary_Python_copyright,		METH_VARARGS, Dictionary_Python_copyright__doc__	},
+	{ Dictionary_Python_New__name__,		Dictionary_Python_New,			METH_VARARGS, Dictionary_Python_New__doc__		},
+	{ Dictionary_Python_Print__name__,		Dictionary_Python_Print,		METH_VARARGS, Dictionary_Python_Print__doc__		},
+	{ Dictionary_Python_Delete__name__,		Dictionary_Python_Delete,		METH_VARARGS, Dictionary_Python_Delete__doc__		},
+	{ Dictionary_Python_AddString__name__,		Dictionary_Python_AddString,		METH_VARARGS, Dictionary_Python_AddString__doc__	},
+	{ Dictionary_Python_AddStruct__name__,		Dictionary_Python_AddStruct,		METH_VARARGS, Dictionary_Python_AddStruct__doc__	},
+	{ Dictionary_Python_LoadFromFile__name__,	Dictionary_Python_LoadFromFile,		METH_VARARGS, Dictionary_Python_LoadFromFile__doc__	},
+	{ 0, 0, 0, 0 }
+};
+
+
+/* "New" member */
+char Dictionary_Python_New__doc__[] = "Create a new Dictionary";
+char Dictionary_Python_New__name__[] = "New";
+PyObject* Dictionary_Python_New( PyObject* self, PyObject* args ) {
+	return PyCObject_FromVoidPtr( Dictionary_New(), 0 );
+}
+
+/* "Print" member */
+char Dictionary_Python_Print__doc__[] = "Print the Dictionary";
+char Dictionary_Python_Print__name__[] = "Print";
+PyObject* Dictionary_Python_Print( PyObject* self, PyObject* args) {
+	PyObject*	pyDictionary;
+	Dictionary*	dictionary;
+	Stream*		stream = Journal_Register (Info_Type, "myStream");
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyDictionary ) ) {
+		return NULL;
+	}
+	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
+	
+	/* Run function */
+	Stg_Class_Print( dictionary, stream );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "Stg_Class_Delete" member */
+char Dictionary_Python_Delete__doc__[] = "Stg_Class_Delete/destroy the Dictionary";
+char Dictionary_Python_Delete__name__[] = "Stg_Class_Delete";
+PyObject* Dictionary_Python_Delete( PyObject* self, PyObject* args ) {
+	PyObject*	pyDictionary;
+	Dictionary*	dictionary;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "O:", &pyDictionary ) ) {
+		return NULL;
+	}
+	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
+	
+	/* Run function */
+	Stg_Class_Delete( dictionary );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "AddString" member */
+char Dictionary_Python_AddString__doc__[] = "Add an item (scalar) to the Dictionary";
+char Dictionary_Python_AddString__name__[] = "AddString";
+PyObject* Dictionary_Python_AddString( PyObject* self, PyObject* args ) {
+	PyObject*	pyDictionary;
+	Dictionary*	dictionary;
+	char*		name;
+	char*		value;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "Oss:", &pyDictionary, &name, &value ) ) {
+		return NULL;
+	}
+	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
+	
+	/* Run function */
+	Dictionary_Add( dictionary, name, Dictionary_Entry_Value_FromString( value ) );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "AddStruct" member */
+char Dictionary_Python_AddStruct__doc__[] = "Add a struct (Dictionary) to the Dictionary";
+char Dictionary_Python_AddStruct__name__[] = "AddStruct";
+PyObject* Dictionary_Python_AddStruct( PyObject* self, PyObject* args ) {
+	PyObject*	pyDictionary;
+	Dictionary*	dictionary;
+	char*		name;
+	PyObject*	pyValue;
+	Dictionary*	value;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "OsO:", &pyDictionary, &name, &pyValue ) ) {
+		return NULL;
+	}
+	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
+	value = (Dictionary*)( PyCObject_AsVoidPtr( pyValue ) );
+	
+	/* Run function */
+	Dictionary_Add( dictionary, name, Dictionary_Entry_Value_FromStruct( value ) );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "AddToList" member */
+char Dictionary_Python_AddStringToList__doc__[] = "Add an item (scalar) to a list of the Dictionary";
+char Dictionary_Python_AddStringToList__name__[] = "AddStringToList";
+PyObject* Dictionary_Python_AddStringToList( PyObject* self, PyObject* args ) {
+	PyObject*		pyDictionary;
+	Dictionary*		dictionary;
+	char*			name;
+	char*			value;
+	Dictionary_Entry_Value*	list;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "Oss:", &pyDictionary, &name, &value ) ) {
+		return NULL;
+	}
+	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
+	
+	/* Run function */
+	list = Dictionary_Get( dictionary, name );
+	Dictionary_Entry_Value_AddElement( list, Dictionary_Entry_Value_FromString( value ) );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+/* "LoadFromFile" member */
+char Dictionary_Python_LoadFromFile__doc__[] = "Load the contents of a file into the Dictionary";
+char Dictionary_Python_LoadFromFile__name__[] = "LoadFromFile";
+PyObject* Dictionary_Python_LoadFromFile( PyObject* self, PyObject* args ) {
+	PyObject*	pyDictionary;
+	Dictionary*	dictionary;
+	XML_IO_Handler*	ioHandler;
+	char*		filename;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "Os:", &pyDictionary, &filename ) ) {
+		return NULL;
+	}
+	dictionary = (Dictionary*)( PyCObject_AsVoidPtr( pyDictionary ) );
+	
+	/* Run function */
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromFile( ioHandler, filename, dictionary );
+	Stg_Class_Delete( ioHandler );
+	
+	/* Return */
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Dictionary/init.c
--- a/Base/Python/Bindings/Dictionary/init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "bindings.h"
-#include "misc.h"
-
-char Dictionary_Python__doc__[] = "Dictionary is an information repository designed to take information from various sources and of \
-various types but provide a common interface to the information with implicit type conversions. ";
-
-void initDictionary() {
-	Py_InitModule4( "Dictionary", Dictionary_Python_Methods, Dictionary_Python__doc__, 0, PYTHON_API_VERSION );
-	if( PyErr_Occurred() ) {
-		Py_FatalError( "Can't initialize module Dictionary" );
-	}
-	return;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Dictionary/init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Python/Bindings/Dictionary/init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,46 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "bindings.h"
+#include "misc.h"
+
+char Dictionary_Python__doc__[] = "Dictionary is an information repository designed to take information from various sources and of \
+various types but provide a common interface to the information with implicit type conversions. ";
+
+void initDictionary() {
+	Py_InitModule4( "Dictionary", Dictionary_Python_Methods, Dictionary_Python__doc__, 0, PYTHON_API_VERSION );
+	if( PyErr_Occurred() ) {
+		Py_FatalError( "Can't initialize module Dictionary" );
+	}
+	return;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Dictionary/misc.c
--- a/Base/Python/Bindings/Dictionary/misc.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "misc.h"
-
-
-char Dictionary_Python_copyright__doc__[] = "";
-char Dictionary_Python_copyright__name__[] = "copyright";
-
-PyObject* Dictionary_Python_copyright( PyObject* self, PyObject* args ) {
-	return Py_BuildValue( "s", "StGermain.Base.Bindings.Dictionary Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/Python/Bindings/Dictionary/misc.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/Python/Bindings/Dictionary/misc.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,42 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "misc.h"
+
+
+char Dictionary_Python_copyright__doc__[] = "";
+char Dictionary_Python_copyright__name__[] = "copyright";
+
+PyObject* Dictionary_Python_copyright( PyObject* self, PyObject* args ) {
+	return Py_BuildValue( "s", "StGermain.Base.Bindings.Dictionary Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/src/Finalise.c
--- a/Base/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-#include "Base/Context/Context.h"
-
-#include "Finalise.h"
-
-#include <stdio.h>
-
-/* Note: this function is a duplicate of StGermain_Finalise currently - since StGermain_Finalise doesn't call Base_Finalise */
-Bool StGermainBase_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	/* Delete the global objects : xmlSearchPaths and moduleDirectories */
-	Stg_ObjectList_DeleteAllObjects( moduleDirectories );
-	Stg_Class_Delete( moduleDirectories );
-	
-	Stg_ObjectList_DeleteAllObjects( Project_XMLSearchPaths );
-	Stg_Class_Delete( Project_XMLSearchPaths );
-
-	/* Finalise all the bits and pieces */
-	BaseContext_Finalise();
-//#if 0
-	BaseExtensibility_Finalise();
-//#endif
-	BaseAutomation_Finalise();
-	BaseContainer_Finalise();
-	BaseIO_Finalise();
-	BaseFoundation_Finalise();
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,68 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+#include "Base/Context/Context.h"
+
+#include "Finalise.h"
+
+#include <stdio.h>
+
+/* Note: this function is a duplicate of StGermain_Finalise currently - since StGermain_Finalise doesn't call Base_Finalise */
+Bool StGermainBase_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	/* Delete the global objects : xmlSearchPaths and moduleDirectories */
+	Stg_ObjectList_DeleteAllObjects( moduleDirectories );
+	Stg_Class_Delete( moduleDirectories );
+	
+	Stg_ObjectList_DeleteAllObjects( Project_XMLSearchPaths );
+	Stg_Class_Delete( Project_XMLSearchPaths );
+
+	/* Finalise all the bits and pieces */
+	BaseContext_Finalise();
+//#if 0
+	BaseExtensibility_Finalise();
+//#endif
+	BaseAutomation_Finalise();
+	BaseContainer_Finalise();
+	BaseIO_Finalise();
+	BaseFoundation_Finalise();
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/src/Init.c
--- a/Base/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-#include "Base/Context/Context.h"
-
-#include "Init.h"
-
-#include <stdio.h>
-
-Bool StGermainBase_Init( int* argc, char** argv[] ) {
-	char* directory;
-	int tmp;
-	
-	/* Initialise enough bits and pieces to get IO going */
-	BaseFoundation_Init( argc, argv );
-	BaseIO_Init( argc, argv );
-
-	/* Write out the copyright message */
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	tmp = Stream_GetPrintingRank( Journal_Register( InfoStream_Type, "Context" ) );
-	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), 0 );
-	Journal_Printf( /* DO NOT CHANGE OR REMOVE */
-		Journal_Register( InfoStream_Type, "Context" ), 
-		"StGermain Framework revision %s. Copyright (C) 2003-2005 VPAC.\n", VERSION );
-	Stream_Flush( Journal_Register( InfoStream_Type, "Context" ) );
-	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), tmp );
-	
-	/* Initialise the remaining bits and pieces */
-	BaseContainer_Init( argc, argv );
-	BaseAutomation_Init( argc, argv );
-	BaseExtensibility_Init( argc, argv );
-	BaseContext_Init( argc, argv );
-	
-	/* Add the StGermain path to the global xml path dictionary */
-	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
-	sprintf( directory, "%s%s", LIB_DIR, "/StGermain" );
-	XML_IO_Handler_AddDirectory( "StGermain", directory  );
-	Memory_Free( directory );
-	
-	/* Add the plugin path to the global plugin list */
-	ModulesManager_AddDirectory( "StGermain", LIB_DIR );
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,80 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+#include "Base/Context/Context.h"
+
+#include "Init.h"
+
+#include <stdio.h>
+
+Bool StGermainBase_Init( int* argc, char** argv[] ) {
+	char* directory;
+	int tmp;
+	
+	/* Initialise enough bits and pieces to get IO going */
+	BaseFoundation_Init( argc, argv );
+	BaseIO_Init( argc, argv );
+
+	/* Write out the copyright message */
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	tmp = Stream_GetPrintingRank( Journal_Register( InfoStream_Type, "Context" ) );
+	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), 0 );
+	Journal_Printf( /* DO NOT CHANGE OR REMOVE */
+		Journal_Register( InfoStream_Type, "Context" ), 
+		"StGermain Framework revision %s. Copyright (C) 2003-2005 VPAC.\n", VERSION );
+	Stream_Flush( Journal_Register( InfoStream_Type, "Context" ) );
+	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), tmp );
+	
+	/* Initialise the remaining bits and pieces */
+	BaseContainer_Init( argc, argv );
+	BaseAutomation_Init( argc, argv );
+	BaseExtensibility_Init( argc, argv );
+	BaseContext_Init( argc, argv );
+	
+	/* Add the StGermain path to the global xml path dictionary */
+	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
+	sprintf( directory, "%s%s", LIB_DIR, "/StGermain" );
+	XML_IO_Handler_AddDirectory( "StGermain", directory  );
+	Memory_Free( directory );
+	
+	/* Add the plugin path to the global plugin list */
+	ModulesManager_AddDirectory( "StGermain", LIB_DIR );
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Base/tests/testLibBase.c
--- a/Base/tests/testLibBase.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** Role:
-**	Tests EntryPoint in the most basic sence... creation on default values, run with hooks added, and delete.
-**
-** $Id: testLibBase.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "StGermain/Base/Base.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int main( int argc, char* argv[] ) {
-	MPI_Comm		CommWorld;
-	int			rank;
-	int			numProcessors;
-	int			procToWatch;
-	
-	/* Initialise MPI, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-	/* Read input */
-
-	if( !StGermainBase_Init( &argc, &argv ) ) {
-		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
-		exit( EXIT_FAILURE );
-	}
-	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
-
-	if( argc >= 2 ) {
-		procToWatch = atoi( argv[1] );
-	}
-	else {
-		procToWatch = 0;
-	}
-	if( rank == procToWatch ) printf( "Watching rank: %i\n", rank );
-	
-	StGermainBase_Finalise();
-	
-	/* Close off MPI */
-	MPI_Finalize();
-
-	return 0; /* success */
-}
-
-Bool LinearAlgebra_Init( int* argc, char** argv[] ) {
-	return True;
-}
-
-Bool LinearAlgebra_Finalise( void ) {
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Base/tests/testLibBase.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/testLibBase.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,83 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** Role:
+**	Tests EntryPoint in the most basic sence... creation on default values, run with hooks added, and delete.
+**
+** $Id: testLibBase.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "StGermain/Base/Base.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm		CommWorld;
+	int			rank;
+	int			numProcessors;
+	int			procToWatch;
+	
+	/* Initialise MPI, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	/* Read input */
+
+	if( !StGermainBase_Init( &argc, &argv ) ) {
+		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
+		exit( EXIT_FAILURE );
+	}
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+
+	if( argc >= 2 ) {
+		procToWatch = atoi( argv[1] );
+	}
+	else {
+		procToWatch = 0;
+	}
+	if( rank == procToWatch ) printf( "Watching rank: %i\n", rank );
+	
+	StGermainBase_Finalise();
+	
+	/* Close off MPI */
+	MPI_Finalize();
+
+	return 0; /* success */
+}
+
+Bool LinearAlgebra_Init( int* argc, char** argv[] ) {
+	return True;
+}
+
+Bool LinearAlgebra_Finalise( void ) {
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/checkDiff/main.c
--- a/Regresstor/ClientPrograms/checkDiff/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Makes a web service call to submit the results of a make */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libcsoap/soap-client.h>
-
-
-Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
-Name Regresstor_SubmitCheckMethod = "submitCheck";	/* The name of the web service function */
-
-/* Index Positions to the paramter array */
-#define RunID_Pos		0
-#define UnitName_Pos		1
-#define TestName_Pos		2
-#define Passed_Pos		3
-#define OutputLocation_Pos	4
-#define URL_Pos			5		/* The URL for the submit build function */
-
-/* The number of paramters in the submit build function */
-#define Parameter_Num_Pos	6
-
-/* The parameter names to the submit build function */
-Name parameterNames[Parameter_Num_Pos] = {
-	"RunID",
-	"UnitName",
-	"TestName",
-	"Passed",
-	"OutputLocation",
-	"URL" };
-
-void printUsage();
-void initParametersArray( char** parameters );
-void fetchParametersFromArgv( char** parameters, int argc, char** argv );
-int checkParameters( char** parameters );
-char* getFileContents( char* filename );
-int interpretResponse( SoapCtx* response, xmlChar** buildID );
-
-int main( int argc, char** argv ) {
-
-	SoapCtx* request;
-	SoapCtx* response;
-	herror_t error;
-	int ii;
-
-	/* The array of parameter values to be fetched from argv. */
-	char* parameters[Parameter_Num_Pos];
-
-	xmlChar* buildID;
-
-	if ( argc != Parameter_Num_Pos + 1 ) {
-		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	initParametersArray( parameters );
-	fetchParametersFromArgv( parameters, argc, argv );
-
-	if ( ! checkParameters( parameters ) ) {
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	printf( "Regresstor: calling web service %s(), %s at %s.\n",
-		Regresstor_SubmitCheckMethod,
-		Regresstor_URN,
-		parameters[URL_Pos]);
-
-	/* SOAP CALL */
-	error = soap_client_init_args( argc, argv );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-	
-	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitCheckMethod, &request );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-
-	/* Add parameters into envelope except for the URL */
-	soap_env_push_item( request->env, NULL, "parameters" );
-
-	for ( ii = 0; ii < URL_Pos; ++ii ) {
-		if ( ii == OutputLocation_Pos ) {
-			/* Attach file */
-			char* contents;
-			char* paramName = NULL;
-			int sendDummyFile = 1;
-
-			paramName = "Output";
-
-			if ( strcmp( parameters[ii], "none" ) != 0 ) {
-				contents = getFileContents( parameters[ii] );
-				if ( contents != NULL ) {
-					soap_env_add_item( request->env, "xsd:string", paramName, contents );
-					free( contents );
-					sendDummyFile = 0;
-				}
-			}
-			if ( sendDummyFile ) {
-				soap_env_add_item( request->env, "xsd:string", paramName, "No output file" );
-			}
-		}
-		else
-		{
-			soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
-		}
-	}
-
-	/* Check commandline to see if diff passed. If fail, add a "Diff Failed" sub test */
-	if ( strcmp( parameters[Passed_Pos], "0" ) == 0 ) {
-		/* Add the sub test */
-		soap_env_add_item( request->env, "xsd:string", "FailedSubTests", "Diff failed" );
-	}
-	
-	soap_env_pop_item( request->env );
-	
-	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
-                                                                                                                                    
-	if ( error != H_OK ) {
-		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
-		herror_release( error );
-		soap_ctx_free( request );
-		return EXIT_FAILURE;
-	}
-
-	interpretResponse( response, &buildID );
-
-	soap_ctx_free( request );
-	soap_ctx_free( response );
-
-	soap_client_destroy();
-
-
-	return EXIT_SUCCESS;
-}
-
-void printUsage() {
-	int ii;
-	
-	printf( "Usage:\n" );
-	printf( "\t./regresstorCheckDiff (param)=(value)\n" );
-	printf( "All parameters must be given!\n" );
-	printf( "Parameters:\n" );
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		printf( "\t%s\n", parameterNames[ii] );
-	}
-}
-
-/* Initialises all values to NULL */
-void initParametersArray( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		parameters[ii] = NULL;
-	}
-}
-void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
-	int ii, jj;
-	char* param;
-	char* value;
-	int pos;
-
-	for ( ii = 1; ii < argc; ++ii ) {
-		if ( !strchr( argv[ii], '=' ) ) {
-			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
-			return;
-		}
-
-		param = strtok( argv[ii], "=" );
-		value = strtok( NULL, "=" );
-
-		if ( !param ) {
-			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
-			return;
-		}
-		if ( !value ) {
-			printf( "Regresstor: Parameter %s needs a value.\n", param );
-			return;
-		}
-
-		pos = -1;
-		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
-			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
-				pos = jj;
-				break;
-			}
-		}
-		if ( pos == -1 ) {
-			printf( "Regresstor: Invalid param %s\n", argv[ii] );
-			return;
-		}
-		printf("\t%s=%s\n", parameterNames[pos], value );
-		parameters[pos] = value;
-	}
-}
-int checkParameters( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		if ( parameters[ii] == NULL ) {
-			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
-			return 0;
-		}
-	}
-
-	return 1;
-}
-char* getFileContents( char* filename ) {
-	FILE* file;
-	long size;
-	char* contents;
-                                                                                                                                    
-	file = fopen( filename, "r" );
-	if ( !file ) {
-		return NULL;
-	}
-	if( fseek( file, 0L, SEEK_END ) != 0 ) {
-		return NULL;
-	}
-	size = ftell( file ) + 1;
-	if ( size < 1 ) {
-		return NULL;
-	}
-	contents = (char*)malloc( size );
-	if ( contents == NULL ) {
-		return NULL;
-	}
-	rewind( file );
-	fread( contents, 1, size - 1, file );
-	contents[ size - 1 ] = '\0';
-
-	fclose( file );
-
-	return contents;
-}
-int interpretResponse( SoapCtx* response, xmlChar** buildID ) {
-	xmlNodePtr method;
-	xmlNodePtr node;
-	xmlChar* value;
-                                                                                                                                    
-	method = soap_env_get_method( response->env );
-
-	if ( method ) {
-		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
-			printf( "Regresstor: A SOAP error has occured:\n" );
-			node = soap_xml_get_children( method );
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-				printf( "Regresstor: %s=%s\n", node->name, value );
-				node = soap_xml_get_next(node);
-			}
-			return 0;
-		}
-		
-		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
-
-		if ( node->children ) {
-			/* This is where the response values are */
-			node = node->children;
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-
-				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
-					printf( "Regresstor: Error - %s\n", value );
-					return 0;
-				}
-				
-				node = soap_xml_get_next(node);
-			}
-		}
-	}
-	else {
-		printf( "Regresstor: Non-SOAP response.\n" );
-	}
-	printf( "Regresstor: Successfully submited check.\n" );
-	return 1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/checkDiff/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/ClientPrograms/checkDiff/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,314 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Makes a web service call to submit the results of a make */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <libcsoap/soap-client.h>
+
+
+Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
+Name Regresstor_SubmitCheckMethod = "submitCheck";	/* The name of the web service function */
+
+/* Index Positions to the paramter array */
+#define RunID_Pos		0
+#define UnitName_Pos		1
+#define TestName_Pos		2
+#define Passed_Pos		3
+#define OutputLocation_Pos	4
+#define URL_Pos			5		/* The URL for the submit build function */
+
+/* The number of paramters in the submit build function */
+#define Parameter_Num_Pos	6
+
+/* The parameter names to the submit build function */
+Name parameterNames[Parameter_Num_Pos] = {
+	"RunID",
+	"UnitName",
+	"TestName",
+	"Passed",
+	"OutputLocation",
+	"URL" };
+
+void printUsage();
+void initParametersArray( char** parameters );
+void fetchParametersFromArgv( char** parameters, int argc, char** argv );
+int checkParameters( char** parameters );
+char* getFileContents( char* filename );
+int interpretResponse( SoapCtx* response, xmlChar** buildID );
+
+int main( int argc, char** argv ) {
+
+	SoapCtx* request;
+	SoapCtx* response;
+	herror_t error;
+	int ii;
+
+	/* The array of parameter values to be fetched from argv. */
+	char* parameters[Parameter_Num_Pos];
+
+	xmlChar* buildID;
+
+	if ( argc != Parameter_Num_Pos + 1 ) {
+		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	initParametersArray( parameters );
+	fetchParametersFromArgv( parameters, argc, argv );
+
+	if ( ! checkParameters( parameters ) ) {
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	printf( "Regresstor: calling web service %s(), %s at %s.\n",
+		Regresstor_SubmitCheckMethod,
+		Regresstor_URN,
+		parameters[URL_Pos]);
+
+	/* SOAP CALL */
+	error = soap_client_init_args( argc, argv );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+	
+	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitCheckMethod, &request );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+
+	/* Add parameters into envelope except for the URL */
+	soap_env_push_item( request->env, NULL, "parameters" );
+
+	for ( ii = 0; ii < URL_Pos; ++ii ) {
+		if ( ii == OutputLocation_Pos ) {
+			/* Attach file */
+			char* contents;
+			char* paramName = NULL;
+			int sendDummyFile = 1;
+
+			paramName = "Output";
+
+			if ( strcmp( parameters[ii], "none" ) != 0 ) {
+				contents = getFileContents( parameters[ii] );
+				if ( contents != NULL ) {
+					soap_env_add_item( request->env, "xsd:string", paramName, contents );
+					free( contents );
+					sendDummyFile = 0;
+				}
+			}
+			if ( sendDummyFile ) {
+				soap_env_add_item( request->env, "xsd:string", paramName, "No output file" );
+			}
+		}
+		else
+		{
+			soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
+		}
+	}
+
+	/* Check commandline to see if diff passed. If fail, add a "Diff Failed" sub test */
+	if ( strcmp( parameters[Passed_Pos], "0" ) == 0 ) {
+		/* Add the sub test */
+		soap_env_add_item( request->env, "xsd:string", "FailedSubTests", "Diff failed" );
+	}
+	
+	soap_env_pop_item( request->env );
+	
+	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
+                                                                                                                                    
+	if ( error != H_OK ) {
+		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
+		herror_release( error );
+		soap_ctx_free( request );
+		return EXIT_FAILURE;
+	}
+
+	interpretResponse( response, &buildID );
+
+	soap_ctx_free( request );
+	soap_ctx_free( response );
+
+	soap_client_destroy();
+
+
+	return EXIT_SUCCESS;
+}
+
+void printUsage() {
+	int ii;
+	
+	printf( "Usage:\n" );
+	printf( "\t./regresstorCheckDiff (param)=(value)\n" );
+	printf( "All parameters must be given!\n" );
+	printf( "Parameters:\n" );
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		printf( "\t%s\n", parameterNames[ii] );
+	}
+}
+
+/* Initialises all values to NULL */
+void initParametersArray( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		parameters[ii] = NULL;
+	}
+}
+void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
+	int ii, jj;
+	char* param;
+	char* value;
+	int pos;
+
+	for ( ii = 1; ii < argc; ++ii ) {
+		if ( !strchr( argv[ii], '=' ) ) {
+			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
+			return;
+		}
+
+		param = strtok( argv[ii], "=" );
+		value = strtok( NULL, "=" );
+
+		if ( !param ) {
+			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
+			return;
+		}
+		if ( !value ) {
+			printf( "Regresstor: Parameter %s needs a value.\n", param );
+			return;
+		}
+
+		pos = -1;
+		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
+			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
+				pos = jj;
+				break;
+			}
+		}
+		if ( pos == -1 ) {
+			printf( "Regresstor: Invalid param %s\n", argv[ii] );
+			return;
+		}
+		printf("\t%s=%s\n", parameterNames[pos], value );
+		parameters[pos] = value;
+	}
+}
+int checkParameters( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		if ( parameters[ii] == NULL ) {
+			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
+			return 0;
+		}
+	}
+
+	return 1;
+}
+char* getFileContents( char* filename ) {
+	FILE* file;
+	long size;
+	char* contents;
+                                                                                                                                    
+	file = fopen( filename, "r" );
+	if ( !file ) {
+		return NULL;
+	}
+	if( fseek( file, 0L, SEEK_END ) != 0 ) {
+		return NULL;
+	}
+	size = ftell( file ) + 1;
+	if ( size < 1 ) {
+		return NULL;
+	}
+	contents = (char*)malloc( size );
+	if ( contents == NULL ) {
+		return NULL;
+	}
+	rewind( file );
+	fread( contents, 1, size - 1, file );
+	contents[ size - 1 ] = '\0';
+
+	fclose( file );
+
+	return contents;
+}
+int interpretResponse( SoapCtx* response, xmlChar** buildID ) {
+	xmlNodePtr method;
+	xmlNodePtr node;
+	xmlChar* value;
+                                                                                                                                    
+	method = soap_env_get_method( response->env );
+
+	if ( method ) {
+		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
+			printf( "Regresstor: A SOAP error has occured:\n" );
+			node = soap_xml_get_children( method );
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+				printf( "Regresstor: %s=%s\n", node->name, value );
+				node = soap_xml_get_next(node);
+			}
+			return 0;
+		}
+		
+		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
+
+		if ( node->children ) {
+			/* This is where the response values are */
+			node = node->children;
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+
+				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
+					printf( "Regresstor: Error - %s\n", value );
+					return 0;
+				}
+				
+				node = soap_xml_get_next(node);
+			}
+		}
+	}
+	else {
+		printf( "Regresstor: Non-SOAP response.\n" );
+	}
+	printf( "Regresstor: Successfully submited check.\n" );
+	return 1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/checkExecution/main.c
--- a/Regresstor/ClientPrograms/checkExecution/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Makes a web service call to submit the results of a make */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libcsoap/soap-client.h>
-
-
-Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
-Name Regresstor_SubmitCheckMethod = "submitCheck";	/* The name of the web service function */
-
-/* Index Positions to the paramter array */
-#define RunID_Pos		0
-#define UnitName_Pos		1
-#define TestName_Pos		2
-#define Passed_Pos		3
-#define OutputLocation_Pos	4
-#define URL_Pos			5		/* The URL for the submit build function */
-
-/* The number of paramters in the submit build function */
-#define Parameter_Num_Pos	6
-
-/* The parameter names to the submit build function */
-Name parameterNames[Parameter_Num_Pos] = {
-	"RunID",
-	"UnitName",
-	"TestName",
-	"Passed",
-	"OutputLocation",
-	"URL" };
-
-void printUsage();
-void initParametersArray( char** parameters );
-void fetchParametersFromArgv( char** parameters, int argc, char** argv );
-int checkParameters( char** parameters );
-char* getFileContents( char* filename );
-int interpretResponse( SoapCtx* response, xmlChar** buildID );
-
-int main( int argc, char** argv ) {
-
-	SoapCtx* request;
-	SoapCtx* response;
-	herror_t error;
-	int ii;
-
-	/* The array of parameter values to be fetched from argv. */
-	char* parameters[Parameter_Num_Pos];
-
-	xmlChar* buildID;
-
-	if ( argc != Parameter_Num_Pos + 1 ) {
-		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	initParametersArray( parameters );
-	fetchParametersFromArgv( parameters, argc, argv );
-
-	if ( ! checkParameters( parameters ) ) {
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	printf( "Regresstor: calling web service %s(), %s at %s.\n",
-		Regresstor_SubmitCheckMethod,
-		Regresstor_URN,
-		parameters[URL_Pos]);
-
-	/* SOAP CALL */
-	error = soap_client_init_args( argc, argv );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-	
-	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitCheckMethod, &request );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-
-	/* Add parameters into envelope except for the URL */
-	soap_env_push_item( request->env, NULL, "parameters" );
-
-	for ( ii = 0; ii < URL_Pos; ++ii ) {
-		if ( ii == OutputLocation_Pos ) {
-			/* Attach file */
-			char* contents;
-			char* paramName = NULL;
-			int sendDummyFile = 1;
-
-			paramName = "Output";
-
-			if ( strcmp( parameters[ii], "none" ) != 0 ) {
-				contents = getFileContents( parameters[ii] );
-				if ( contents != NULL ) {
-					soap_env_add_item( request->env, "xsd:string", paramName, contents );
-					free( contents );
-					sendDummyFile = 0;
-				}
-			}
-			if ( sendDummyFile ) {
-				soap_env_add_item( request->env, "xsd:string", paramName, "No output file" );
-			}
-		}
-		else
-		{
-			soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
-		}
-	}
-
-	/* Check commandline to see if diff passed. If fail, add a "Diff Failed" sub test */
-	if ( strcmp( parameters[Passed_Pos], "0" ) == 0 ) {
-		/* Add the sub test */
-		soap_env_add_item( request->env, "xsd:string", "FailedSubTests", "Error failure" );
-	}
-	
-	soap_env_pop_item( request->env );
-	
-	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
-                                                                                                                                    
-	if ( error != H_OK ) {
-		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
-		herror_release( error );
-		soap_ctx_free( request );
-		return EXIT_FAILURE;
-	}
-
-	interpretResponse( response, &buildID );
-
-	soap_ctx_free( request );
-	soap_ctx_free( response );
-
-	soap_client_destroy();
-
-
-	return EXIT_SUCCESS;
-}
-
-void printUsage() {
-	int ii;
-	
-	printf( "Usage:\n" );
-	printf( "\t./regresstorCheckError (param)=(value)\n" );
-	printf( "All parameters must be given!\n" );
-	printf( "Parameters:\n" );
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		printf( "\t%s\n", parameterNames[ii] );
-	}
-}
-
-/* Initialises all values to NULL */
-void initParametersArray( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		parameters[ii] = NULL;
-	}
-}
-void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
-	int ii, jj;
-	char* param;
-	char* value;
-	int pos;
-
-	for ( ii = 1; ii < argc; ++ii ) {
-		if ( !strchr( argv[ii], '=' ) ) {
-			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
-			return;
-		}
-
-		param = strtok( argv[ii], "=" );
-		value = strtok( NULL, "=" );
-
-		if ( !param ) {
-			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
-			return;
-		}
-		if ( !value ) {
-			printf( "Regresstor: Parameter %s needs a value.\n", param );
-			return;
-		}
-
-		pos = -1;
-		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
-			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
-				pos = jj;
-				break;
-			}
-		}
-		if ( pos == -1 ) {
-			printf( "Regresstor: Invalid param %s\n", argv[ii] );
-			return;
-		}
-		printf("\t%s=%s\n", parameterNames[pos], value );
-		parameters[pos] = value;
-	}
-}
-int checkParameters( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		if ( parameters[ii] == NULL ) {
-			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
-			return 0;
-		}
-	}
-
-	return 1;
-}
-char* getFileContents( char* filename ) {
-	FILE* file;
-	long size;
-	char* contents;
-                                                                                                                                    
-	file = fopen( filename, "r" );
-	if ( !file ) {
-		return NULL;
-	}
-	if( fseek( file, 0L, SEEK_END ) != 0 ) {
-		return NULL;
-	}
-	size = ftell( file ) + 1;
-	if ( size < 1 ) {
-		return NULL;
-	}
-	contents = (char*)malloc( size );
-	if ( contents == NULL ) {
-		return NULL;
-	}
-	rewind( file );
-	fread( contents, 1, size - 1, file );
-	contents[ size - 1 ] = '\0';
-
-	fclose( file );
-
-	return contents;
-}
-int interpretResponse( SoapCtx* response, xmlChar** buildID ) {
-	xmlNodePtr method;
-	xmlNodePtr node;
-	xmlChar* value;
-                                                                                                                                    
-	method = soap_env_get_method( response->env );
-
-	if ( method ) {
-		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
-			printf( "Regresstor: A SOAP error has occured:\n" );
-			node = soap_xml_get_children( method );
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-				printf( "Regresstor: %s=%s\n", node->name, value );
-				node = soap_xml_get_next(node);
-			}
-			return 0;
-		}
-		
-		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
-
-		if ( node->children ) {
-			/* This is where the response values are */
-			node = node->children;
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-
-				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
-					printf( "Regresstor: Error - %s\n", value );
-					return 0;
-				}
-				
-				node = soap_xml_get_next(node);
-			}
-		}
-	}
-	else {
-		printf( "Regresstor: Non-SOAP response.\n" );
-	}
-	printf( "Regresstor: Successfully submited check.\n" );
-	return 1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/checkExecution/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/ClientPrograms/checkExecution/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,314 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Makes a web service call to submit the results of a make */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <libcsoap/soap-client.h>
+
+
+Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
+Name Regresstor_SubmitCheckMethod = "submitCheck";	/* The name of the web service function */
+
+/* Index Positions to the paramter array */
+#define RunID_Pos		0
+#define UnitName_Pos		1
+#define TestName_Pos		2
+#define Passed_Pos		3
+#define OutputLocation_Pos	4
+#define URL_Pos			5		/* The URL for the submit build function */
+
+/* The number of paramters in the submit build function */
+#define Parameter_Num_Pos	6
+
+/* The parameter names to the submit build function */
+Name parameterNames[Parameter_Num_Pos] = {
+	"RunID",
+	"UnitName",
+	"TestName",
+	"Passed",
+	"OutputLocation",
+	"URL" };
+
+void printUsage();
+void initParametersArray( char** parameters );
+void fetchParametersFromArgv( char** parameters, int argc, char** argv );
+int checkParameters( char** parameters );
+char* getFileContents( char* filename );
+int interpretResponse( SoapCtx* response, xmlChar** buildID );
+
+int main( int argc, char** argv ) {
+
+	SoapCtx* request;
+	SoapCtx* response;
+	herror_t error;
+	int ii;
+
+	/* The array of parameter values to be fetched from argv. */
+	char* parameters[Parameter_Num_Pos];
+
+	xmlChar* buildID;
+
+	if ( argc != Parameter_Num_Pos + 1 ) {
+		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	initParametersArray( parameters );
+	fetchParametersFromArgv( parameters, argc, argv );
+
+	if ( ! checkParameters( parameters ) ) {
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	printf( "Regresstor: calling web service %s(), %s at %s.\n",
+		Regresstor_SubmitCheckMethod,
+		Regresstor_URN,
+		parameters[URL_Pos]);
+
+	/* SOAP CALL */
+	error = soap_client_init_args( argc, argv );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+	
+	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitCheckMethod, &request );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+
+	/* Add parameters into envelope except for the URL */
+	soap_env_push_item( request->env, NULL, "parameters" );
+
+	for ( ii = 0; ii < URL_Pos; ++ii ) {
+		if ( ii == OutputLocation_Pos ) {
+			/* Attach file */
+			char* contents;
+			char* paramName = NULL;
+			int sendDummyFile = 1;
+
+			paramName = "Output";
+
+			if ( strcmp( parameters[ii], "none" ) != 0 ) {
+				contents = getFileContents( parameters[ii] );
+				if ( contents != NULL ) {
+					soap_env_add_item( request->env, "xsd:string", paramName, contents );
+					free( contents );
+					sendDummyFile = 0;
+				}
+			}
+			if ( sendDummyFile ) {
+				soap_env_add_item( request->env, "xsd:string", paramName, "No output file" );
+			}
+		}
+		else
+		{
+			soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
+		}
+	}
+
+	/* Check commandline to see if diff passed. If fail, add a "Diff Failed" sub test */
+	if ( strcmp( parameters[Passed_Pos], "0" ) == 0 ) {
+		/* Add the sub test */
+		soap_env_add_item( request->env, "xsd:string", "FailedSubTests", "Error failure" );
+	}
+	
+	soap_env_pop_item( request->env );
+	
+	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
+                                                                                                                                    
+	if ( error != H_OK ) {
+		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
+		herror_release( error );
+		soap_ctx_free( request );
+		return EXIT_FAILURE;
+	}
+
+	interpretResponse( response, &buildID );
+
+	soap_ctx_free( request );
+	soap_ctx_free( response );
+
+	soap_client_destroy();
+
+
+	return EXIT_SUCCESS;
+}
+
+void printUsage() {
+	int ii;
+	
+	printf( "Usage:\n" );
+	printf( "\t./regresstorCheckError (param)=(value)\n" );
+	printf( "All parameters must be given!\n" );
+	printf( "Parameters:\n" );
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		printf( "\t%s\n", parameterNames[ii] );
+	}
+}
+
+/* Initialises all values to NULL */
+void initParametersArray( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		parameters[ii] = NULL;
+	}
+}
+void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
+	int ii, jj;
+	char* param;
+	char* value;
+	int pos;
+
+	for ( ii = 1; ii < argc; ++ii ) {
+		if ( !strchr( argv[ii], '=' ) ) {
+			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
+			return;
+		}
+
+		param = strtok( argv[ii], "=" );
+		value = strtok( NULL, "=" );
+
+		if ( !param ) {
+			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
+			return;
+		}
+		if ( !value ) {
+			printf( "Regresstor: Parameter %s needs a value.\n", param );
+			return;
+		}
+
+		pos = -1;
+		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
+			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
+				pos = jj;
+				break;
+			}
+		}
+		if ( pos == -1 ) {
+			printf( "Regresstor: Invalid param %s\n", argv[ii] );
+			return;
+		}
+		printf("\t%s=%s\n", parameterNames[pos], value );
+		parameters[pos] = value;
+	}
+}
+int checkParameters( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		if ( parameters[ii] == NULL ) {
+			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
+			return 0;
+		}
+	}
+
+	return 1;
+}
+char* getFileContents( char* filename ) {
+	FILE* file;
+	long size;
+	char* contents;
+                                                                                                                                    
+	file = fopen( filename, "r" );
+	if ( !file ) {
+		return NULL;
+	}
+	if( fseek( file, 0L, SEEK_END ) != 0 ) {
+		return NULL;
+	}
+	size = ftell( file ) + 1;
+	if ( size < 1 ) {
+		return NULL;
+	}
+	contents = (char*)malloc( size );
+	if ( contents == NULL ) {
+		return NULL;
+	}
+	rewind( file );
+	fread( contents, 1, size - 1, file );
+	contents[ size - 1 ] = '\0';
+
+	fclose( file );
+
+	return contents;
+}
+int interpretResponse( SoapCtx* response, xmlChar** buildID ) {
+	xmlNodePtr method;
+	xmlNodePtr node;
+	xmlChar* value;
+                                                                                                                                    
+	method = soap_env_get_method( response->env );
+
+	if ( method ) {
+		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
+			printf( "Regresstor: A SOAP error has occured:\n" );
+			node = soap_xml_get_children( method );
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+				printf( "Regresstor: %s=%s\n", node->name, value );
+				node = soap_xml_get_next(node);
+			}
+			return 0;
+		}
+		
+		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
+
+		if ( node->children ) {
+			/* This is where the response values are */
+			node = node->children;
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+
+				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
+					printf( "Regresstor: Error - %s\n", value );
+					return 0;
+				}
+				
+				node = soap_xml_get_next(node);
+			}
+		}
+	}
+	else {
+		printf( "Regresstor: Non-SOAP response.\n" );
+	}
+	printf( "Regresstor: Successfully submited check.\n" );
+	return 1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/endRun/main.c
--- a/Regresstor/ClientPrograms/endRun/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Makes a web service call to submit the results of a make */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libcsoap/soap-client.h>
-
-
-Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
-Name Regresstor_EndRunMethod = "endRun";
-
-/* Index Positions to the paramter array */
-#define RunID			0
-#define URL_Pos			1		/* The URL for the submit build function */
-
-/* The number of paramters in the submit build function */
-#define Parameter_Num_Pos	2
-
-/* The parameter names to the submit build function */
-Name parameterNames[Parameter_Num_Pos] = {
-	"RunID",
-	"URL" };
-
-void printUsage();
-void initParametersArray( char** parameters );
-void fetchParametersFromArgv( char** parameters, int argc, char** argv );
-int checkParameters( char** parameters );
-int interpretResponse( SoapCtx* response, xmlChar** buildID );
-
-int main( int argc, char** argv ) {
-
-	SoapCtx* request;
-	SoapCtx* response;
-	herror_t error;
-	int ii;
-
-	/* The array of parameter values to be fetched from argv. */
-	char* parameters[Parameter_Num_Pos];
-
-	if ( argc != Parameter_Num_Pos + 1 ) {
-		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	initParametersArray( parameters );
-	fetchParametersFromArgv( parameters, argc, argv );
-
-	if ( ! checkParameters( parameters ) ) {
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	printf( "Regresstor: calling web service %s(), %s at %s.\n",
-		Regresstor_EndRunMethod,
-		Regresstor_URN,
-		parameters[URL_Pos]);
-
-	/* SOAP CALL */
-	error = soap_client_init_args( argc, argv );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-	
-	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_EndRunMethod, &request );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-
-	/* Add parameters into envelope except for the URL */
-	soap_env_push_item( request->env, NULL, "parameters" );
-
-	for ( ii = 0; ii < URL_Pos; ++ii ) {
-		soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
-	}
-
-	soap_env_pop_item( request->env );
-	
-	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
-                                                                                                                                    
-	if ( error != H_OK ) {
-		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
-		herror_release( error );
-		soap_ctx_free( request );
-		return EXIT_FAILURE;
-	}
-
-	interpretResponse( response, NULL );
-
-	soap_ctx_free( request );
-	soap_ctx_free( response );
-
-	soap_client_destroy();
-
-
-	return EXIT_SUCCESS;
-}
-
-void printUsage() {
-	int ii;
-	
-	printf( "Usage:\n" );
-	printf( "\t./regresstorEndRun (param)=(value)\n" );
-	printf( "All parameters must be given!\n" );
-	printf( "Parameters:\n" );
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		printf( "\t%s\n", parameterNames[ii] );
-	}
-}
-
-/* Initialises all values to NULL */
-void initParametersArray( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		parameters[ii] = NULL;
-	}
-}
-void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
-	int ii, jj;
-	char* param;
-	char* value;
-	int pos;
-
-	for ( ii = 1; ii < argc; ++ii ) {
-		if ( !strchr( argv[ii], '=' ) ) {
-			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
-			return;
-		}
-
-		param = strtok( argv[ii], "=" );
-		value = strtok( NULL, "=" );
-
-		if ( !param ) {
-			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
-			return;
-		}
-		if ( !value ) {
-			printf( "Regresstor: Parameter %s needs a value.\n", param );
-			return;
-		}
-
-		pos = -1;
-		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
-			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
-				pos = jj;
-				break;
-			}
-		}
-		if ( pos == -1 ) {
-			printf( "Regresstor: Invalid param %s\n", argv[ii] );
-			return;
-		}
-		printf("\t%s=%s\n", parameterNames[pos], value );
-		parameters[pos] = value;
-	}
-}
-int checkParameters( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		if ( parameters[ii] == NULL ) {
-			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
-			return 0;
-		}
-	}
-
-	return 1;
-}
-
-int interpretResponse( SoapCtx* response, xmlChar** runID ) {
-	xmlNodePtr method;
-	xmlNodePtr node;
-	xmlChar* value;
-                                                                                                                                    
-	method = soap_env_get_method( response->env );
-
-	if ( method ) {
-		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
-			printf( "Regresstor: A SOAP error has occured:\n" );
-			node = soap_xml_get_children( method );
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-				printf( "Regresstor: %s=%s\n", node->name, value );
-				node = soap_xml_get_next(node);
-			}
-			return 0;
-		}
-		
-		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
-
-		if ( node->children ) {
-			/* This is where the response values are */
-			node = node->children;
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-
-				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
-					printf( "Regresstor: Error - %s\n", value );
-					return 0;
-				}
-				
-				node = soap_xml_get_next(node);
-			}
-		}
-	}
-	else {
-		printf( "Regresstor: Non-SOAP response.\n" );
-	}
-	printf( "Regresstor: Successfully end run.\n" );
-	return 1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/endRun/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/ClientPrograms/endRun/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,247 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Makes a web service call to submit the results of a make */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <libcsoap/soap-client.h>
+
+
+Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
+Name Regresstor_EndRunMethod = "endRun";
+
+/* Index Positions to the paramter array */
+#define RunID			0
+#define URL_Pos			1		/* The URL for the submit build function */
+
+/* The number of paramters in the submit build function */
+#define Parameter_Num_Pos	2
+
+/* The parameter names to the submit build function */
+Name parameterNames[Parameter_Num_Pos] = {
+	"RunID",
+	"URL" };
+
+void printUsage();
+void initParametersArray( char** parameters );
+void fetchParametersFromArgv( char** parameters, int argc, char** argv );
+int checkParameters( char** parameters );
+int interpretResponse( SoapCtx* response, xmlChar** buildID );
+
+int main( int argc, char** argv ) {
+
+	SoapCtx* request;
+	SoapCtx* response;
+	herror_t error;
+	int ii;
+
+	/* The array of parameter values to be fetched from argv. */
+	char* parameters[Parameter_Num_Pos];
+
+	if ( argc != Parameter_Num_Pos + 1 ) {
+		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	initParametersArray( parameters );
+	fetchParametersFromArgv( parameters, argc, argv );
+
+	if ( ! checkParameters( parameters ) ) {
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	printf( "Regresstor: calling web service %s(), %s at %s.\n",
+		Regresstor_EndRunMethod,
+		Regresstor_URN,
+		parameters[URL_Pos]);
+
+	/* SOAP CALL */
+	error = soap_client_init_args( argc, argv );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+	
+	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_EndRunMethod, &request );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+
+	/* Add parameters into envelope except for the URL */
+	soap_env_push_item( request->env, NULL, "parameters" );
+
+	for ( ii = 0; ii < URL_Pos; ++ii ) {
+		soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
+	}
+
+	soap_env_pop_item( request->env );
+	
+	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
+                                                                                                                                    
+	if ( error != H_OK ) {
+		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
+		herror_release( error );
+		soap_ctx_free( request );
+		return EXIT_FAILURE;
+	}
+
+	interpretResponse( response, NULL );
+
+	soap_ctx_free( request );
+	soap_ctx_free( response );
+
+	soap_client_destroy();
+
+
+	return EXIT_SUCCESS;
+}
+
+void printUsage() {
+	int ii;
+	
+	printf( "Usage:\n" );
+	printf( "\t./regresstorEndRun (param)=(value)\n" );
+	printf( "All parameters must be given!\n" );
+	printf( "Parameters:\n" );
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		printf( "\t%s\n", parameterNames[ii] );
+	}
+}
+
+/* Initialises all values to NULL */
+void initParametersArray( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		parameters[ii] = NULL;
+	}
+}
+void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
+	int ii, jj;
+	char* param;
+	char* value;
+	int pos;
+
+	for ( ii = 1; ii < argc; ++ii ) {
+		if ( !strchr( argv[ii], '=' ) ) {
+			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
+			return;
+		}
+
+		param = strtok( argv[ii], "=" );
+		value = strtok( NULL, "=" );
+
+		if ( !param ) {
+			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
+			return;
+		}
+		if ( !value ) {
+			printf( "Regresstor: Parameter %s needs a value.\n", param );
+			return;
+		}
+
+		pos = -1;
+		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
+			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
+				pos = jj;
+				break;
+			}
+		}
+		if ( pos == -1 ) {
+			printf( "Regresstor: Invalid param %s\n", argv[ii] );
+			return;
+		}
+		printf("\t%s=%s\n", parameterNames[pos], value );
+		parameters[pos] = value;
+	}
+}
+int checkParameters( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		if ( parameters[ii] == NULL ) {
+			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
+			return 0;
+		}
+	}
+
+	return 1;
+}
+
+int interpretResponse( SoapCtx* response, xmlChar** runID ) {
+	xmlNodePtr method;
+	xmlNodePtr node;
+	xmlChar* value;
+                                                                                                                                    
+	method = soap_env_get_method( response->env );
+
+	if ( method ) {
+		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
+			printf( "Regresstor: A SOAP error has occured:\n" );
+			node = soap_xml_get_children( method );
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+				printf( "Regresstor: %s=%s\n", node->name, value );
+				node = soap_xml_get_next(node);
+			}
+			return 0;
+		}
+		
+		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
+
+		if ( node->children ) {
+			/* This is where the response values are */
+			node = node->children;
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+
+				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
+					printf( "Regresstor: Error - %s\n", value );
+					return 0;
+				}
+				
+				node = soap_xml_get_next(node);
+			}
+		}
+	}
+	else {
+		printf( "Regresstor: Non-SOAP response.\n" );
+	}
+	printf( "Regresstor: Successfully end run.\n" );
+	return 1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/startRun/main.c
--- a/Regresstor/ClientPrograms/startRun/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,261 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Makes a web service call to submit the results of a make */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libcsoap/soap-client.h>
-
-
-Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
-Name Regresstor_StartRunMethod = "beginRun";
-
-/* Index Positions to the paramter array */
-#define BuildID			0
-#define URL_Pos			1		/* The URL for the submit build function */
-
-/* The number of paramters in the submit build function */
-#define Parameter_Num_Pos	2
-
-/* The parameter names to the submit build function */
-Name parameterNames[Parameter_Num_Pos] = {
-	"BuildID",
-	"URL" };
-
-void printUsage();
-void initParametersArray( char** parameters );
-void fetchParametersFromArgv( char** parameters, int argc, char** argv );
-int checkParameters( char** parameters );
-int interpretResponse( SoapCtx* response, xmlChar** buildID );
-
-int main( int argc, char** argv ) {
-
-	SoapCtx* request;
-	SoapCtx* response;
-	herror_t error;
-	int ii;
-
-	/* The array of parameter values to be fetched from argv. */
-	char* parameters[Parameter_Num_Pos];
-
-	xmlChar* runID;
-
-	if ( argc != Parameter_Num_Pos + 1 ) {
-		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	initParametersArray( parameters );
-	fetchParametersFromArgv( parameters, argc, argv );
-
-	if ( ! checkParameters( parameters ) ) {
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	printf( "Regresstor: calling web service %s(), %s at %s.\n",
-		Regresstor_StartRunMethod,
-		Regresstor_URN,
-		parameters[URL_Pos]);
-
-	/* SOAP CALL */
-	error = soap_client_init_args( argc, argv );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-	
-	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_StartRunMethod, &request );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-
-	/* Add parameters into envelope except for the URL */
-	soap_env_push_item( request->env, NULL, "parameters" );
-
-	for ( ii = 0; ii < URL_Pos; ++ii ) {
-		soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
-	}
-
-	soap_env_pop_item( request->env );
-	
-	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
-                                                                                                                                    
-	if ( error != H_OK ) {
-		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
-		herror_release( error );
-		soap_ctx_free( request );
-		return EXIT_FAILURE;
-	}
-
-	if ( interpretResponse( response, &runID ) ) {
-		FILE* runFile;
-		runFile = fopen( "./RUNID", "w" );
-		if ( runFile ) {
-			fprintf( runFile, "%s", runID );
-		}
-		else {
-			printf( "Unable to write to ./RUNID.\n" );
-		}
-	}
-
-	soap_ctx_free( request );
-	soap_ctx_free( response );
-
-	soap_client_destroy();
-
-
-	return EXIT_SUCCESS;
-}
-
-void printUsage() {
-	int ii;
-	
-	printf( "Usage:\n" );
-	printf( "\t./regresstorStartRun (param)=(value)\n" );
-	printf( "All parameters must be given!\n" );
-	printf( "Parameters:\n" );
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		printf( "\t%s\n", parameterNames[ii] );
-	}
-}
-
-/* Initialises all values to NULL */
-void initParametersArray( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		parameters[ii] = NULL;
-	}
-}
-void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
-	int ii, jj;
-	char* param;
-	char* value;
-	int pos;
-
-	for ( ii = 1; ii < argc; ++ii ) {
-		if ( !strchr( argv[ii], '=' ) ) {
-			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
-			return;
-		}
-
-		param = strtok( argv[ii], "=" );
-		value = strtok( NULL, "=" );
-
-		if ( !param ) {
-			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
-			return;
-		}
-		if ( !value ) {
-			printf( "Regresstor: Parameter %s needs a value.\n", param );
-			return;
-		}
-
-		pos = -1;
-		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
-			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
-				pos = jj;
-				break;
-			}
-		}
-		if ( pos == -1 ) {
-			printf( "Regresstor: Invalid param %s\n", argv[ii] );
-			return;
-		}
-		printf("\t%s=%s\n", parameterNames[pos], value );
-		parameters[pos] = value;
-	}
-}
-int checkParameters( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		if ( parameters[ii] == NULL ) {
-			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
-			return 0;
-		}
-	}
-
-	return 1;
-}
-
-int interpretResponse( SoapCtx* response, xmlChar** runID ) {
-	xmlNodePtr method;
-	xmlNodePtr node;
-	xmlChar* value;
-                                                                                                                                    
-	method = soap_env_get_method( response->env );
-
-	if ( method ) {
-		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
-			printf( "Regresstor: A SOAP error has occured:\n" );
-			node = soap_xml_get_children( method );
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-				printf( "Regresstor: %s=%s\n", node->name, value );
-				node = soap_xml_get_next(node);
-			}
-			return 0;
-		}
-		
-		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
-
-		if ( node->children ) {
-			/* This is where the response values are */
-			node = node->children;
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-
-				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
-					printf( "Regresstor: Error - %s\n", value );
-					return 0;
-				}
-				else if ( strcmp( (char*)node->name, "runID" ) == 0 ) {
-					*runID = value;
-				}
-				
-				node = soap_xml_get_next(node);
-			}
-		}
-	}
-	else {
-		printf( "Regresstor: Non-SOAP response.\n" );
-	}
-	printf( "Regresstor: Successfully begin run.\n" );
-	return 1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/startRun/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/ClientPrograms/startRun/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,261 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Makes a web service call to submit the results of a make */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <libcsoap/soap-client.h>
+
+
+Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
+Name Regresstor_StartRunMethod = "beginRun";
+
+/* Index Positions to the paramter array */
+#define BuildID			0
+#define URL_Pos			1		/* The URL for the submit build function */
+
+/* The number of paramters in the submit build function */
+#define Parameter_Num_Pos	2
+
+/* The parameter names to the submit build function */
+Name parameterNames[Parameter_Num_Pos] = {
+	"BuildID",
+	"URL" };
+
+void printUsage();
+void initParametersArray( char** parameters );
+void fetchParametersFromArgv( char** parameters, int argc, char** argv );
+int checkParameters( char** parameters );
+int interpretResponse( SoapCtx* response, xmlChar** buildID );
+
+int main( int argc, char** argv ) {
+
+	SoapCtx* request;
+	SoapCtx* response;
+	herror_t error;
+	int ii;
+
+	/* The array of parameter values to be fetched from argv. */
+	char* parameters[Parameter_Num_Pos];
+
+	xmlChar* runID;
+
+	if ( argc != Parameter_Num_Pos + 1 ) {
+		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	initParametersArray( parameters );
+	fetchParametersFromArgv( parameters, argc, argv );
+
+	if ( ! checkParameters( parameters ) ) {
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	printf( "Regresstor: calling web service %s(), %s at %s.\n",
+		Regresstor_StartRunMethod,
+		Regresstor_URN,
+		parameters[URL_Pos]);
+
+	/* SOAP CALL */
+	error = soap_client_init_args( argc, argv );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+	
+	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_StartRunMethod, &request );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+
+	/* Add parameters into envelope except for the URL */
+	soap_env_push_item( request->env, NULL, "parameters" );
+
+	for ( ii = 0; ii < URL_Pos; ++ii ) {
+		soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
+	}
+
+	soap_env_pop_item( request->env );
+	
+	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
+                                                                                                                                    
+	if ( error != H_OK ) {
+		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
+		herror_release( error );
+		soap_ctx_free( request );
+		return EXIT_FAILURE;
+	}
+
+	if ( interpretResponse( response, &runID ) ) {
+		FILE* runFile;
+		runFile = fopen( "./RUNID", "w" );
+		if ( runFile ) {
+			fprintf( runFile, "%s", runID );
+		}
+		else {
+			printf( "Unable to write to ./RUNID.\n" );
+		}
+	}
+
+	soap_ctx_free( request );
+	soap_ctx_free( response );
+
+	soap_client_destroy();
+
+
+	return EXIT_SUCCESS;
+}
+
+void printUsage() {
+	int ii;
+	
+	printf( "Usage:\n" );
+	printf( "\t./regresstorStartRun (param)=(value)\n" );
+	printf( "All parameters must be given!\n" );
+	printf( "Parameters:\n" );
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		printf( "\t%s\n", parameterNames[ii] );
+	}
+}
+
+/* Initialises all values to NULL */
+void initParametersArray( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		parameters[ii] = NULL;
+	}
+}
+void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
+	int ii, jj;
+	char* param;
+	char* value;
+	int pos;
+
+	for ( ii = 1; ii < argc; ++ii ) {
+		if ( !strchr( argv[ii], '=' ) ) {
+			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
+			return;
+		}
+
+		param = strtok( argv[ii], "=" );
+		value = strtok( NULL, "=" );
+
+		if ( !param ) {
+			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
+			return;
+		}
+		if ( !value ) {
+			printf( "Regresstor: Parameter %s needs a value.\n", param );
+			return;
+		}
+
+		pos = -1;
+		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
+			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
+				pos = jj;
+				break;
+			}
+		}
+		if ( pos == -1 ) {
+			printf( "Regresstor: Invalid param %s\n", argv[ii] );
+			return;
+		}
+		printf("\t%s=%s\n", parameterNames[pos], value );
+		parameters[pos] = value;
+	}
+}
+int checkParameters( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		if ( parameters[ii] == NULL ) {
+			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
+			return 0;
+		}
+	}
+
+	return 1;
+}
+
+int interpretResponse( SoapCtx* response, xmlChar** runID ) {
+	xmlNodePtr method;
+	xmlNodePtr node;
+	xmlChar* value;
+                                                                                                                                    
+	method = soap_env_get_method( response->env );
+
+	if ( method ) {
+		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
+			printf( "Regresstor: A SOAP error has occured:\n" );
+			node = soap_xml_get_children( method );
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+				printf( "Regresstor: %s=%s\n", node->name, value );
+				node = soap_xml_get_next(node);
+			}
+			return 0;
+		}
+		
+		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
+
+		if ( node->children ) {
+			/* This is where the response values are */
+			node = node->children;
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+
+				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
+					printf( "Regresstor: Error - %s\n", value );
+					return 0;
+				}
+				else if ( strcmp( (char*)node->name, "runID" ) == 0 ) {
+					*runID = value;
+				}
+				
+				node = soap_xml_get_next(node);
+			}
+		}
+	}
+	else {
+		printf( "Regresstor: Non-SOAP response.\n" );
+	}
+	printf( "Regresstor: Successfully begin run.\n" );
+	return 1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/submitBuild/main.c
--- a/Regresstor/ClientPrograms/submitBuild/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,343 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* Makes a web service call to submit the results of a make */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libcsoap/soap-client.h>
-
-
-Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
-Name Regresstor_SubmitBuildMethod = "submitBuild";	/* The name of the web service function */
-
-/* Index Positions to the paramter array */
-#define Project_Pos		0
-#define BuildOptions_Pos	1
-#define CC_Pos			2
-#define Revision_Pos		3
-#define MachineName_Pos		4
-#define Hardware_Pos		5
-#define OS_Pos			6
-#define Kernel_Pos		7
-#define Who_Pos			8
-#define LocalModification_Pos	9
-#define Compiled_Pos		10
-#define MakefileLocation_Pos	11		/* Full path to Makefile.system */
-#define LogLocation_Pos		12		/* Full path to make log */
-#define URL_Pos			13		/* The URL for the submit build function */
-
-/* The number of parameters in the submit build function */
-#define Parameter_Num_Pos	14
-
-/* The parameter names to the submit build function */
-Name parameterNames[Parameter_Num_Pos] = {
-	"Project",
-	"BuildOptions",
-	"CC",
-	"Revision",
-	"MachineName",
-	"Hardware",
-	"OS",
-	"Kernel",
-	"Who",
-	"LocalModification",
-	"Compiled",
-	"MakefileLocation",
-	"LogLocation",
-	"URL" };
-
-void printUsage();
-void initParametersArray( char** parameters );
-void fetchParametersFromArgv( char** parameters, int argc, char** argv );
-int checkParameters( char** parameters );
-char* getFileContents( char* filename );
-int interpretResponse( SoapCtx* response, xmlChar** buildID );
-
-int main( int argc, char** argv ) {
-
-	SoapCtx* request;
-	SoapCtx* response;
-	herror_t error;
-	int ii;
-
-	/* The array of parameter values to be fetched from argv. */
-	char* parameters[Parameter_Num_Pos];
-
-	xmlChar* buildID;
-
-	if ( argc != Parameter_Num_Pos + 1 ) {
-		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	initParametersArray( parameters );
-	fetchParametersFromArgv( parameters, argc, argv );
-
-	if ( ! checkParameters( parameters ) ) {
-		printUsage();
-		return EXIT_FAILURE;
-	}
-
-	printf( "Regresstor: calling web service %s(), %s at %s.\n",
-		Regresstor_SubmitBuildMethod,
-		Regresstor_URN,
-		parameters[URL_Pos]);
-
-	/* SOAP CALL */
-	error = soap_client_init_args( argc, argv );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-	
-	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitBuildMethod, &request );
-	if ( error != H_OK ) {
-		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
-		herror_release(error);
-		return EXIT_FAILURE;
-	}
-
-	soap_env_push_item( request->env, NULL, "parameters" );
-
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		if ( ii == MakefileLocation_Pos || ii == LogLocation_Pos ) {
-			/* Make file attachements */
-			char* contents;
-			char* paramName = NULL;
-			switch ( ii ) {
-				case MakefileLocation_Pos:
-					paramName = "Makefile";
-					break;
-				case LogLocation_Pos:
-					paramName = "Log";
-					break;
-			}
-			contents = getFileContents( parameters[ii] );
-			if ( contents == NULL ) {
-				soap_env_add_item( request->env, "xsd:string", paramName, "No attachment" );
-			}
-			else {
-				soap_env_add_item( request->env, "xsd:string", paramName, contents );
-				free( contents );
-			}
-		}
-		else if ( ii != URL_Pos ) {
-			/* Add parameters into envelope except for the URL */
-			soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
-		}
-	}
-	soap_env_pop_item( request->env );
-	
-	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
-                                                                                                                                    
-	if ( error != H_OK ) {
-		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
-		herror_release( error );
-		soap_ctx_free( request );
-		return EXIT_FAILURE;
-	}
-
-	if ( interpretResponse( response, &buildID ) ) {
-		FILE* buildFile;
-		buildFile = fopen( "./BUILDID", "w" );
-		if ( buildFile ) {
-			fprintf( buildFile, "%s", buildID );
-		}
-		else {
-			printf( "Unable to write to ./BUILDID.\n" );
-		}
-	}
-
-	soap_ctx_free( request );
-	soap_ctx_free( response );
-
-	soap_client_destroy();
-
-
-	return EXIT_SUCCESS;
-}
-
-void printUsage() {
-	int ii;
-	
-	printf( "Usage:\n" );
-	printf( "\t./regresstorSubmitBuild (param)=(value)\n" );
-	printf( "All parameters must be given!\n" );
-	printf( "Parameters:\n" );
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		printf( "\t%s\n", parameterNames[ii] );
-	}
-}
-
-/* Initialises all values to NULL */
-void initParametersArray( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		parameters[ii] = NULL;
-	}
-}
-void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
-	int ii, jj;
-	char* param;
-	char* value;
-	int pos;
-
-	for ( ii = 1; ii < argc; ++ii ) {
-		if ( !strchr( argv[ii], '=' ) ) {
-			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
-			return;
-		}
-
-		param = strtok( argv[ii], "=" );
-		value = strtok( NULL, "=" );
-
-		if ( !param ) {
-			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
-			return;
-		}
-		if ( !value ) {
-			/* Special case for BuildOptions which can be none */
-			if ( strcmp( param, parameterNames[BuildOptions_Pos] ) == 0 ) {
-				value = "none";
-			}
-			else {
-				printf( "Regresstor: Parameter %s needs a value.\n", param );
-				return;
-			}
-		}
-
-		pos = -1;
-		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
-			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
-				pos = jj;
-				break;
-			}
-		}
-		if ( pos == -1 ) {
-			printf( "Regresstor: Invalid param %s\n", argv[ii] );
-			return;
-		}
-		printf("\t%s=%s\n", parameterNames[pos], value );
-		parameters[pos] = value;
-	}
-}
-int checkParameters( char** parameters ) {
-	int ii;
-	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
-		if ( parameters[ii] == NULL ) {
-			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
-			return 0;
-		}
-	}
-
-	return 1;
-}
-
-char* getFileContents( char* filename ) {
-	FILE* file;
-	long size;
-	char* contents;
-
-	file = fopen( filename, "r" );
-	if ( !file ) {
-		return NULL;
-	}
-	if( fseek( file, 0L, SEEK_END ) != 0 ) {
-		return NULL;
-	}
-	size = ftell( file ) + 1;
-	if ( size < 1 ) {
-		return NULL;
-	}
-	contents = (char*)malloc( size );
-	if ( contents == NULL ) {
-		return NULL;
-	}
-	rewind( file );
-	fread( contents, 1, size - 1, file );
-	contents[ size - 1 ] = '\0';
-
-	fclose( file );
-	
-	return contents;
-}
-
-int interpretResponse( SoapCtx* response, xmlChar** buildID ) {
-	xmlNodePtr method;
-	xmlNodePtr node;
-	xmlChar* value;
-                                                                                                                                    
-	method = soap_env_get_method( response->env );
-
-	if ( method ) {
-		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
-			printf( "Regresstor: A SOAP error has occured:\n" );
-			node = soap_xml_get_children( method );
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-				printf( "Regresstor: %s=%s\n", node->name, value );
-				node = soap_xml_get_next(node);
-			}
-			return 0;
-		}
-		
-		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
-
-		if ( node->children ) {
-			/* This is where the response values are */
-			node = node->children;
-			while ( node ) {
-				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
-
-				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
-					printf( "Regresstor: Error - %s\n", value );
-					return 0;
-				}
-				else if ( strcmp( (char*)node->name, "buildID" ) == 0 ) {
-					*buildID = value;
-				}
-				
-				node = soap_xml_get_next(node);
-			}
-		}
-	}
-	else {
-		printf( "Regresstor: Non-SOAP response.\n" );
-	}
-	printf( "Regresstor: Successfully submited build.\n" );
-	return 1;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/ClientPrograms/submitBuild/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/ClientPrograms/submitBuild/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,343 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Class.c 2933 2005-05-12 06:13:10Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* Makes a web service call to submit the results of a make */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <libcsoap/soap-client.h>
+
+
+Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
+Name Regresstor_SubmitBuildMethod = "submitBuild";	/* The name of the web service function */
+
+/* Index Positions to the paramter array */
+#define Project_Pos		0
+#define BuildOptions_Pos	1
+#define CC_Pos			2
+#define Revision_Pos		3
+#define MachineName_Pos		4
+#define Hardware_Pos		5
+#define OS_Pos			6
+#define Kernel_Pos		7
+#define Who_Pos			8
+#define LocalModification_Pos	9
+#define Compiled_Pos		10
+#define MakefileLocation_Pos	11		/* Full path to Makefile.system */
+#define LogLocation_Pos		12		/* Full path to make log */
+#define URL_Pos			13		/* The URL for the submit build function */
+
+/* The number of parameters in the submit build function */
+#define Parameter_Num_Pos	14
+
+/* The parameter names to the submit build function */
+Name parameterNames[Parameter_Num_Pos] = {
+	"Project",
+	"BuildOptions",
+	"CC",
+	"Revision",
+	"MachineName",
+	"Hardware",
+	"OS",
+	"Kernel",
+	"Who",
+	"LocalModification",
+	"Compiled",
+	"MakefileLocation",
+	"LogLocation",
+	"URL" };
+
+void printUsage();
+void initParametersArray( char** parameters );
+void fetchParametersFromArgv( char** parameters, int argc, char** argv );
+int checkParameters( char** parameters );
+char* getFileContents( char* filename );
+int interpretResponse( SoapCtx* response, xmlChar** buildID );
+
+int main( int argc, char** argv ) {
+
+	SoapCtx* request;
+	SoapCtx* response;
+	herror_t error;
+	int ii;
+
+	/* The array of parameter values to be fetched from argv. */
+	char* parameters[Parameter_Num_Pos];
+
+	xmlChar* buildID;
+
+	if ( argc != Parameter_Num_Pos + 1 ) {
+		printf( "Regresstor: Invalid Number of arguments! Num given: %d\n", argc );
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	initParametersArray( parameters );
+	fetchParametersFromArgv( parameters, argc, argv );
+
+	if ( ! checkParameters( parameters ) ) {
+		printUsage();
+		return EXIT_FAILURE;
+	}
+
+	printf( "Regresstor: calling web service %s(), %s at %s.\n",
+		Regresstor_SubmitBuildMethod,
+		Regresstor_URN,
+		parameters[URL_Pos]);
+
+	/* SOAP CALL */
+	error = soap_client_init_args( argc, argv );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+	
+	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitBuildMethod, &request );
+	if ( error != H_OK ) {
+		log_error4( "%s():%s [%d]", herror_func(error), herror_message(error), herror_code(error) );
+		herror_release(error);
+		return EXIT_FAILURE;
+	}
+
+	soap_env_push_item( request->env, NULL, "parameters" );
+
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		if ( ii == MakefileLocation_Pos || ii == LogLocation_Pos ) {
+			/* Make file attachements */
+			char* contents;
+			char* paramName = NULL;
+			switch ( ii ) {
+				case MakefileLocation_Pos:
+					paramName = "Makefile";
+					break;
+				case LogLocation_Pos:
+					paramName = "Log";
+					break;
+			}
+			contents = getFileContents( parameters[ii] );
+			if ( contents == NULL ) {
+				soap_env_add_item( request->env, "xsd:string", paramName, "No attachment" );
+			}
+			else {
+				soap_env_add_item( request->env, "xsd:string", paramName, contents );
+				free( contents );
+			}
+		}
+		else if ( ii != URL_Pos ) {
+			/* Add parameters into envelope except for the URL */
+			soap_env_add_item( request->env, "xsd:string", parameterNames[ii], parameters[ii] );
+		}
+	}
+	soap_env_pop_item( request->env );
+	
+	error = soap_client_invoke( request, &response, parameters[URL_Pos], "");
+                                                                                                                                    
+	if ( error != H_OK ) {
+		log_error4( "[%d] %s(): %s ", herror_code(error), herror_func(error), herror_message(error) );
+		herror_release( error );
+		soap_ctx_free( request );
+		return EXIT_FAILURE;
+	}
+
+	if ( interpretResponse( response, &buildID ) ) {
+		FILE* buildFile;
+		buildFile = fopen( "./BUILDID", "w" );
+		if ( buildFile ) {
+			fprintf( buildFile, "%s", buildID );
+		}
+		else {
+			printf( "Unable to write to ./BUILDID.\n" );
+		}
+	}
+
+	soap_ctx_free( request );
+	soap_ctx_free( response );
+
+	soap_client_destroy();
+
+
+	return EXIT_SUCCESS;
+}
+
+void printUsage() {
+	int ii;
+	
+	printf( "Usage:\n" );
+	printf( "\t./regresstorSubmitBuild (param)=(value)\n" );
+	printf( "All parameters must be given!\n" );
+	printf( "Parameters:\n" );
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		printf( "\t%s\n", parameterNames[ii] );
+	}
+}
+
+/* Initialises all values to NULL */
+void initParametersArray( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		parameters[ii] = NULL;
+	}
+}
+void fetchParametersFromArgv( char** parameters, int argc, char** argv ) {
+	int ii, jj;
+	char* param;
+	char* value;
+	int pos;
+
+	for ( ii = 1; ii < argc; ++ii ) {
+		if ( !strchr( argv[ii], '=' ) ) {
+			printf( "Regresstor: Invalid argument %s. Assign (param)=(value)\n", argv[ii] );
+			return;
+		}
+
+		param = strtok( argv[ii], "=" );
+		value = strtok( NULL, "=" );
+
+		if ( !param ) {
+			printf( "Regresstor: Invalid argument %s.\n", argv[ii] );
+			return;
+		}
+		if ( !value ) {
+			/* Special case for BuildOptions which can be none */
+			if ( strcmp( param, parameterNames[BuildOptions_Pos] ) == 0 ) {
+				value = "none";
+			}
+			else {
+				printf( "Regresstor: Parameter %s needs a value.\n", param );
+				return;
+			}
+		}
+
+		pos = -1;
+		for ( jj = 0; jj < Parameter_Num_Pos; ++jj ) {
+			if ( strcmp( param, parameterNames[jj] ) == 0 ) {
+				pos = jj;
+				break;
+			}
+		}
+		if ( pos == -1 ) {
+			printf( "Regresstor: Invalid param %s\n", argv[ii] );
+			return;
+		}
+		printf("\t%s=%s\n", parameterNames[pos], value );
+		parameters[pos] = value;
+	}
+}
+int checkParameters( char** parameters ) {
+	int ii;
+	for ( ii = 0; ii < Parameter_Num_Pos; ++ii ) {
+		if ( parameters[ii] == NULL ) {
+			printf( "Regresstor: Parameter %s was not given.\n", parameterNames[ii] );
+			return 0;
+		}
+	}
+
+	return 1;
+}
+
+char* getFileContents( char* filename ) {
+	FILE* file;
+	long size;
+	char* contents;
+
+	file = fopen( filename, "r" );
+	if ( !file ) {
+		return NULL;
+	}
+	if( fseek( file, 0L, SEEK_END ) != 0 ) {
+		return NULL;
+	}
+	size = ftell( file ) + 1;
+	if ( size < 1 ) {
+		return NULL;
+	}
+	contents = (char*)malloc( size );
+	if ( contents == NULL ) {
+		return NULL;
+	}
+	rewind( file );
+	fread( contents, 1, size - 1, file );
+	contents[ size - 1 ] = '\0';
+
+	fclose( file );
+	
+	return contents;
+}
+
+int interpretResponse( SoapCtx* response, xmlChar** buildID ) {
+	xmlNodePtr method;
+	xmlNodePtr node;
+	xmlChar* value;
+                                                                                                                                    
+	method = soap_env_get_method( response->env );
+
+	if ( method ) {
+		if ( strcmp( (char*)method->name, "Fault" ) == 0 ) {
+			printf( "Regresstor: A SOAP error has occured:\n" );
+			node = soap_xml_get_children( method );
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+				printf( "Regresstor: %s=%s\n", node->name, value );
+				node = soap_xml_get_next(node);
+			}
+			return 0;
+		}
+		
+		node = soap_xml_get_children( method );		/* The s-gensym3 struct */
+
+		if ( node->children ) {
+			/* This is where the response values are */
+			node = node->children;
+			while ( node ) {
+				value = xmlNodeListGetString( node->doc, node->xmlChildrenNode, 1 );
+
+				if ( strcmp( (char*)node->name, "errorMsg" ) == 0 ) {
+					printf( "Regresstor: Error - %s\n", value );
+					return 0;
+				}
+				else if ( strcmp( (char*)node->name, "buildID" ) == 0 ) {
+					*buildID = value;
+				}
+				
+				node = soap_xml_get_next(node);
+			}
+		}
+	}
+	else {
+		printf( "Regresstor: Non-SOAP response.\n" );
+	}
+	printf( "Regresstor: Successfully submited build.\n" );
+	return 1;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/libRegresstor/src/FailedSubTest.c
--- a/Regresstor/libRegresstor/src/FailedSubTest.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-
-#include <stdlib.h>
-
-#include "types.h"
-#include "FailedSubTest.h"
-
-FailedSubTest* FailedSubTest_New( Name subTestName ) {
-	FailedSubTest* result;
-
-	result = (FailedSubTest*)malloc( sizeof(FailedSubTest) );
-	
-	result->subTestName = subTestName;
-
-	return result;
-}
-
-void FailedSubTest_Delete( FailedSubTest* self ) {
-
-	if ( self ) {
-		free( self );
-	}
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/libRegresstor/src/FailedSubTest.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/libRegresstor/src/FailedSubTest.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,24 @@
+
+#include <stdlib.h>
+
+#include "types.h"
+#include "FailedSubTest.h"
+
+FailedSubTest* FailedSubTest_New( Name subTestName ) {
+	FailedSubTest* result;
+
+	result = (FailedSubTest*)malloc( sizeof(FailedSubTest) );
+	
+	result->subTestName = subTestName;
+
+	return result;
+}
+
+void FailedSubTest_Delete( FailedSubTest* self ) {
+
+	if ( self ) {
+		free( self );
+	}
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/libRegresstor/src/RegressionTest.c
--- a/Regresstor/libRegresstor/src/RegressionTest.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-
-
-#include "forwardDecl.h"
-
-#include "types.h"
-#include "FailedSubTest.h"
-#include "UnitTest.h"
-#include "RegressionTest.h"
-
-#include <stdlib.h>
-#include <signal.h>
-#include <libcsoap/soap-client.h>
-#include <libxml/xmlIO.h>
-
-Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
-Name Regresstor_SubmitCheckMethod = "submitCheck";       /* The name of the web service function */
-
-UnitTest* stgRegressionTest = 0;
-
-typedef void (*Regresstor_HandlePtr)(int);
-void RegressionTest_CrashHandler( int sig );
-Regresstor_HandlePtr prevSegvHandler;
-Regresstor_HandlePtr prevBusHandler;
-
-/* Interface functions */
-void RegressionTest_Init_Func( Name url, char* runID, char* unitName, char* testName ) {
-
-	stgRegressionTest = UnitTest_New( url, runID, unitName, testName );
-
-	prevSegvHandler = signal( SIGSEGV, RegressionTest_CrashHandler );
-	prevBusHandler = signal( SIGBUS, RegressionTest_CrashHandler );
-}
-void RegressionTest_Finalise_Func() {
-	SoapCtx* request;
-	SoapCtx* response;
-	herror_t error;
-	
-	int dummyArgc = 0;
-	char** dummyArgv = NULL;
-
-	if ( !stgRegressionTest ) {
-		return;
-	}
-	if ( !stgRegressionTest->url || !stgRegressionTest->runID ) {
-		return;
-	}
-
-	error = soap_client_init_args( dummyArgc, dummyArgv );
-	if ( error != H_OK ) {
-		/* Print Error */
-		herror_release(error);
-		return;
-	}
-
-	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitCheckMethod, &request );
-	if ( error != H_OK ) {
-		/* Print Error */
-		herror_release(error);
-		return;
-	}
-
-	soap_env_push_item( request->env, NULL, "parameters" );
-
-	soap_env_add_item( request->env, "xsd:string", "RunID", stgRegressionTest->runID );
-	soap_env_add_item( request->env, "xsd:string", "UnitName", stgRegressionTest->unitName );
-	soap_env_add_item( request->env, "xsd:string", "TestName", stgRegressionTest->testName );
-
-	if ( stgRegressionTest->subTestCount > 0 ) {
-		int ii;
-/*		xmlNodePtr failedSubTests;*/
-
-/*		failedSubTests = soap_env_push_item( request->env, NULL, "FailedSubTests" ); */
-
-		/* Make this an 'array' data type for SOAP */
-/*		xmlNewProp( failedSubTests, (xmlChar*)"xsi:type", (xmlChar*)"SOAP-ENC:Array" );
-		xmlNewProp( failedSubTests, (xmlChar*)"SOAP-ENC:arrayType", (xmlChar*)"xsd:string[2]" );
-*/
-		/* Added the array elements */
-		for ( ii = 0; ii < stgRegressionTest->subTestCount; ++ii ) {
-/*			soap_env_add_item( request->env, "xsd:string", "subTest", stgRegressionTest->subTests[ii]->subTestName );*/
-			soap_env_add_item( request->env, "xsd:string", "FailedSubTests", stgRegressionTest->subTests[ii]->subTestName );
-		}
-
-		/* End array */
-/*		soap_env_pop_item( request->env );*/
-	}
-
-	soap_env_pop_item( request->env );
-
-/*	soap_xml_doc_print( request->env->root->doc );*/
-	
-	error = soap_client_invoke( request, &response, stgRegressionTest->url, "");
-                                                                                                                                    
-	if ( error != H_OK ) {
-		/* Print Error */
-		herror_release( error );
-		soap_ctx_free( request );
-		return;
-	}
-
-/*	soap_xml_doc_print( response->env->root->doc );*/
-
-	soap_ctx_free( request );
-	soap_ctx_free( response );
-
-	soap_client_destroy();
-
-	UnitTest_Delete( stgRegressionTest );
-}
-
-/* Private member functions */
-void RegressionTest_Check_Func( UnitTest* self, int expression, void* stream, char* subTestName, char* description ) {
-	if ( !stgRegressionTest ) {
-		return;
-	}
-
-	if ( expression ) {
-		/* Pass */
-		Journal_Printf( stream, "Passed test %s: %s\n", subTestName, description );
-	}
-	else {
-		/* Fail */
-		Journal_Printf( stream, "Failed test %s: %s\n", subTestName, description );
-
-		UnitTest_Add_FailedSubTest( stgRegressionTest, FailedSubTest_New( subTestName ) );
-	}
-}
-
-
-void RegressionTest_CrashHandler( int sig ) {
-
-	switch ( sig ) {
-		case SIGSEGV:
-			UnitTest_Add_FailedSubTest( stgRegressionTest, FailedSubTest_New( "SIGSEGV: Invalid memory reference" ) );
-			break;
-		case SIGBUS:
-			UnitTest_Add_FailedSubTest( stgRegressionTest, FailedSubTest_New( "SIGBUS: Bad memory access" ) );
-			break;
-	}
-
-	RegressionTest_Finalise();
-
-	switch ( sig ) {
-		case SIGSEGV:
-			prevSegvHandler( sig );
-			break;
-		case SIGBUS:
-			prevBusHandler( sig );
-			break;
-	}
-	
-	exit( 1 );
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/libRegresstor/src/RegressionTest.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/libRegresstor/src/RegressionTest.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,156 @@
+
+
+#include "forwardDecl.h"
+
+#include "types.h"
+#include "FailedSubTest.h"
+#include "UnitTest.h"
+#include "RegressionTest.h"
+
+#include <stdlib.h>
+#include <signal.h>
+#include <libcsoap/soap-client.h>
+#include <libxml/xmlIO.h>
+
+Name Regresstor_URN = "urn:Regresstor";			/* The name of the web service class */
+Name Regresstor_SubmitCheckMethod = "submitCheck";       /* The name of the web service function */
+
+UnitTest* stgRegressionTest = 0;
+
+typedef void (*Regresstor_HandlePtr)(int);
+void RegressionTest_CrashHandler( int sig );
+Regresstor_HandlePtr prevSegvHandler;
+Regresstor_HandlePtr prevBusHandler;
+
+/* Interface functions */
+void RegressionTest_Init_Func( Name url, char* runID, char* unitName, char* testName ) {
+
+	stgRegressionTest = UnitTest_New( url, runID, unitName, testName );
+
+	prevSegvHandler = signal( SIGSEGV, RegressionTest_CrashHandler );
+	prevBusHandler = signal( SIGBUS, RegressionTest_CrashHandler );
+}
+void RegressionTest_Finalise_Func() {
+	SoapCtx* request;
+	SoapCtx* response;
+	herror_t error;
+	
+	int dummyArgc = 0;
+	char** dummyArgv = NULL;
+
+	if ( !stgRegressionTest ) {
+		return;
+	}
+	if ( !stgRegressionTest->url || !stgRegressionTest->runID ) {
+		return;
+	}
+
+	error = soap_client_init_args( dummyArgc, dummyArgv );
+	if ( error != H_OK ) {
+		/* Print Error */
+		herror_release(error);
+		return;
+	}
+
+	error = soap_ctx_new_with_method( Regresstor_URN, Regresstor_SubmitCheckMethod, &request );
+	if ( error != H_OK ) {
+		/* Print Error */
+		herror_release(error);
+		return;
+	}
+
+	soap_env_push_item( request->env, NULL, "parameters" );
+
+	soap_env_add_item( request->env, "xsd:string", "RunID", stgRegressionTest->runID );
+	soap_env_add_item( request->env, "xsd:string", "UnitName", stgRegressionTest->unitName );
+	soap_env_add_item( request->env, "xsd:string", "TestName", stgRegressionTest->testName );
+
+	if ( stgRegressionTest->subTestCount > 0 ) {
+		int ii;
+/*		xmlNodePtr failedSubTests;*/
+
+/*		failedSubTests = soap_env_push_item( request->env, NULL, "FailedSubTests" ); */
+
+		/* Make this an 'array' data type for SOAP */
+/*		xmlNewProp( failedSubTests, (xmlChar*)"xsi:type", (xmlChar*)"SOAP-ENC:Array" );
+		xmlNewProp( failedSubTests, (xmlChar*)"SOAP-ENC:arrayType", (xmlChar*)"xsd:string[2]" );
+*/
+		/* Added the array elements */
+		for ( ii = 0; ii < stgRegressionTest->subTestCount; ++ii ) {
+/*			soap_env_add_item( request->env, "xsd:string", "subTest", stgRegressionTest->subTests[ii]->subTestName );*/
+			soap_env_add_item( request->env, "xsd:string", "FailedSubTests", stgRegressionTest->subTests[ii]->subTestName );
+		}
+
+		/* End array */
+/*		soap_env_pop_item( request->env );*/
+	}
+
+	soap_env_pop_item( request->env );
+
+/*	soap_xml_doc_print( request->env->root->doc );*/
+	
+	error = soap_client_invoke( request, &response, stgRegressionTest->url, "");
+                                                                                                                                    
+	if ( error != H_OK ) {
+		/* Print Error */
+		herror_release( error );
+		soap_ctx_free( request );
+		return;
+	}
+
+/*	soap_xml_doc_print( response->env->root->doc );*/
+
+	soap_ctx_free( request );
+	soap_ctx_free( response );
+
+	soap_client_destroy();
+
+	UnitTest_Delete( stgRegressionTest );
+}
+
+/* Private member functions */
+void RegressionTest_Check_Func( UnitTest* self, int expression, void* stream, char* subTestName, char* description ) {
+	if ( !stgRegressionTest ) {
+		return;
+	}
+
+	if ( expression ) {
+		/* Pass */
+		Journal_Printf( stream, "Passed test %s: %s\n", subTestName, description );
+	}
+	else {
+		/* Fail */
+		Journal_Printf( stream, "Failed test %s: %s\n", subTestName, description );
+
+		UnitTest_Add_FailedSubTest( stgRegressionTest, FailedSubTest_New( subTestName ) );
+	}
+}
+
+
+void RegressionTest_CrashHandler( int sig ) {
+
+	switch ( sig ) {
+		case SIGSEGV:
+			UnitTest_Add_FailedSubTest( stgRegressionTest, FailedSubTest_New( "SIGSEGV: Invalid memory reference" ) );
+			break;
+		case SIGBUS:
+			UnitTest_Add_FailedSubTest( stgRegressionTest, FailedSubTest_New( "SIGBUS: Bad memory access" ) );
+			break;
+	}
+
+	RegressionTest_Finalise();
+
+	switch ( sig ) {
+		case SIGSEGV:
+			prevSegvHandler( sig );
+			break;
+		case SIGBUS:
+			prevBusHandler( sig );
+			break;
+	}
+	
+	exit( 1 );
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 Regresstor/libRegresstor/src/UnitTest.c
--- a/Regresstor/libRegresstor/src/UnitTest.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-
-#include <stdlib.h>
-
-#include "types.h"
-#include "FailedSubTest.h"
-#include "UnitTest.h"
-
-
-
-UnitTest* UnitTest_New( Name url, Name runID, Name unitName, Name testName ) {
-	UnitTest* result;
-
-	result = (UnitTest*)malloc( sizeof(UnitTest) );
-
-	result->url = url;
-	result->runID = runID;
-	result->unitName = unitName;
-	result->testName = testName;
-	result->subTests = NULL;
-	result->subTestCount = 0;
-	result->subTestSize = 0;
-
-	return result;
-}
-
-void UnitTest_Delete( UnitTest* self ) {
-
-	if ( self ) {
-		int ii;
-		
-		for ( ii = 0; ii < self->subTestCount; ++ii ) {
-			if ( self->subTests[ii] ) {
-				FailedSubTest_Delete( self->subTests[ii] );
-				self->subTests[ii] = NULL;
-			}
-		}
-		if ( self->subTests ) {
-			free( self->subTests );
-		}
-		
-		free( self );
-	}
-}
-
-
-void UnitTest_Add_FailedSubTest( UnitTest* self, FailedSubTest* test ) {
-	if ( !self || !test ) {
-		return;
-	}
-
-	if ( self->subTestCount >= self->subTestSize ) {
-		self->subTestSize++;
-		self->subTests = (FailedSubTest**)realloc( self->subTests, sizeof(FailedSubTest*) * self->subTestSize );
-	}
-	self->subTests[self->subTestCount] = test;
-	self->subTestCount++;
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 Regresstor/libRegresstor/src/UnitTest.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Regresstor/libRegresstor/src/UnitTest.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,60 @@
+
+#include <stdlib.h>
+
+#include "types.h"
+#include "FailedSubTest.h"
+#include "UnitTest.h"
+
+
+
+UnitTest* UnitTest_New( Name url, Name runID, Name unitName, Name testName ) {
+	UnitTest* result;
+
+	result = (UnitTest*)malloc( sizeof(UnitTest) );
+
+	result->url = url;
+	result->runID = runID;
+	result->unitName = unitName;
+	result->testName = testName;
+	result->subTests = NULL;
+	result->subTestCount = 0;
+	result->subTestSize = 0;
+
+	return result;
+}
+
+void UnitTest_Delete( UnitTest* self ) {
+
+	if ( self ) {
+		int ii;
+		
+		for ( ii = 0; ii < self->subTestCount; ++ii ) {
+			if ( self->subTests[ii] ) {
+				FailedSubTest_Delete( self->subTests[ii] );
+				self->subTests[ii] = NULL;
+			}
+		}
+		if ( self->subTests ) {
+			free( self->subTests );
+		}
+		
+		free( self );
+	}
+}
+
+
+void UnitTest_Add_FailedSubTest( UnitTest* self, FailedSubTest* test ) {
+	if ( !self || !test ) {
+		return;
+	}
+
+	if ( self->subTestCount >= self->subTestSize ) {
+		self->subTestSize++;
+		self->subTests = (FailedSubTest**)realloc( self->subTests, sizeof(FailedSubTest*) * self->subTestSize );
+	}
+	self->subTests[self->subTestCount] = test;
+	self->subTestCount++;
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 SConscript
--- a/SConscript	Wed May 11 13:26:45 2011 -0700
+++ b/SConscript	Thu May 12 11:18:29 2011 -0700
@@ -89,8 +89,8 @@ for d in dirs:
         cpppath = new_cpppath
 
     # Build our source files.
-    srcs = Glob(src_dir + '/*.c')
-    srcs = [s for s in srcs if s.path.find('-meta.c') == -1]
+    srcs = Glob(src_dir + '/*.cxx')
+    srcs = [s for s in srcs if s.path.find('-meta.cxx') == -1]
     objs += env.SharedObject(srcs, CPPDEFINES=cpp_defs,
                              CPPPATH=cpppath)
 
@@ -103,7 +103,7 @@ for d in dirs:
         env.Depends(hdrs + objs, defs)
 
     # Build any test suites we might find.
-    suites += env.Object(Glob(tst_dir + '/*Suite.c'))
+    suites += env.Object(Glob(tst_dir + '/*Suite.cxx'))
 
     # Install any test expected and input files
     tst_exp += env.Install(tst_install_dir + '/expected', Glob(tst_exp_dir + '/*'))
@@ -133,8 +133,8 @@ if env['static_libs']:
     dir = Dir(env['build_dir'] + '/StGermain').abspath
     if not os.path.exists(dir):
         os.makedirs(dir)
-    f = File(env['build_dir'] + '/StGermain/stg_static_modules.c')
-    Execute(Copy(f.abspath, File('libStGermain/src/stg_static_modules.c.tmpl')))
+    f = File(env['build_dir'] + '/StGermain/stg_static_modules.cxx')
+    Execute(Copy(f.abspath, File('libStGermain/src/stg_static_modules.cxx.tmpl')))
 
     # Now build the library.
     l = env.StaticLibrary(env['build_dir'] + '/lib/StGermain', objs)
@@ -145,9 +145,9 @@ if env['static_libs']:
 #
 
 libs = ['StGermain'] + env.get('LIBS', [])
-env.Program('bin/FlattenXML', 'Base/FlattenXML/src/main.c', LIBS=libs)
+env.Program('bin/FlattenXML', 'Base/FlattenXML/src/main.cxx', LIBS=libs)
 if env['shared_libs']:
-    env.Program('bin/StGermain', 'src/main.c', LIBS=libs)
+    env.Program('bin/StGermain', 'src/main.cxx', LIBS=libs)
 env.PCUTest('tests/testStGermain', suites,
     PCU_LIBHEADERS="#include <StGermain/StGermain.h>",
     PCU_SETUP="StGermain_Init(&argc, &argv);",
diff -r 4a864caece0b -r f9c376288955 StgSCons
--- a/StgSCons	Wed May 11 13:26:45 2011 -0700
+++ b/StgSCons	Thu May 12 11:18:29 2011 -0700
@@ -103,7 +103,7 @@ def copy_includes(env, files, dst, inc_n
 # Builder helpers.
 #
 
-def get_target_name(env, src, suffix='.c'):
+def get_target_name(env, src, suffix='.cxx'):
     return os.path.join(env['buildPath'], env.project_name, src[:-len(suffix)])
 
 def build_defines(env, files, dst):
@@ -188,13 +188,13 @@ def build_directory(env, dir, extra_objs
     env.build_defines(env.glob(os.path.join(srcDir, '*.def')), hdrDir)
     env.build_headers(env.glob(os.path.join(srcDir, '*.h')), hdrDir)
     env.build_metadata(env.glob(os.path.join(srcDir, '*.meta')), dir)
-    env.build_objects(env.glob(os.path.join(srcDir, '*.c')), dir)
+    env.build_objects(env.glob(os.path.join(srcDir, '*.cxx')), dir)
     if build_lib:
         objs = env.get_hnodes(env.SharedObject, dir)
         env.build_library(objs + extra_objs, mod)
     if os.path.exists(tstDir):
-        tst_files = env.glob(os.path.join(tstDir, 'test*.c'))
-        sup_gen = env.glob(os.path.join(tstDir, '*.c'))
+        tst_files = env.glob(os.path.join(tstDir, 'test*.cxx'))
+        sup_gen = env.glob(os.path.join(tstDir, '*.cxx'))
         sup_files = [f for f in sup_gen if f not in tst_files]
         sup = env.build_objects(sup_files, dir, False)
         env.build_tests(tst_files, mod,
@@ -209,7 +209,7 @@ def build_plugin(env, dir, hpath, prefix
     hdr_dir = os.path.join(env.project_name, hpath.split(os.path.sep)[-1])
 
     env.build_headers(env.glob(os.path.join(dir, '*.h')), hdr_dir)
-    objs = env.build_objects(env.glob(os.path.join(dir, '*.c')),
+    objs = env.build_objects(env.glob(os.path.join(dir, '*.cxx')),
                          hpath, False)
     env.build_library(objs, name, [env.project_name], True)
 
@@ -283,7 +283,7 @@ def create_meta(target, source, env):
 ''')
 
 def gen_meta_suffix(env, sources):
-    return "-meta.c"
+    return "-meta.cxx"
 
 Import('env')
 env['BUILDERS']['Meta']=Builder(action=create_meta,src_suffix="meta",
diff -r 4a864caece0b -r f9c376288955 Utils/src/Progress.c
--- a/Utils/src/Progress.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd,
-** 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/Base/Foundation/Foundation.h>
-#include <StGermain/Base/IO/IO.h>
-#include "types.h"
-#include "Progress.h"
-
-
-void Progress_PrintStatus( void* self );
-Bool Progress_CalcStatus( Progress* self );
-
-
-const Type Progress_Type = "Progress";
-
-
-Progress* Progress_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(Progress);
-	Type                              type = Progress_Type;
-	Stg_Class_DeleteFunction*      _delete = _Progress_Delete;
-	Stg_Class_PrintFunction*        _print = _Progress_Print;
-	Stg_Class_CopyFunction*          _copy = NULL;
-
-   return _Progress_New(  PROGRESS_PASSARGS  );
-}
-
-
-Progress* _Progress_New(  PROGRESS_DEFARGS  )
-{
-   Progress* self;
-
-   /* Allocate memory */
-   assert( _sizeOfSelf >= sizeof(Progress) );
-   self = (Progress*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
-   _Progress_Init( self );
-
-   return self;
-}
-
-
-void _Progress_Init( void* _self ) {
-   Progress* self = (Progress*)_self;
-
-   MPI_Comm_rank( MPI_COMM_WORLD, &self->rank );
-   self->title = NULL;
-   self->printTitle = True;
-   self->preStr = NULL;
-   self->width = 40;
-   self->start = 0;
-   self->end = 0;
-   self->pos = 0;
-   self->perc = 0;
-   self->nBars = 0;
-   self->nSpaces = 0;
-}
-
-
-void _Progress_Delete( void* _self ) {
-   Progress* self = (Progress*)_self;
-
-   if( self->preStr )
-      MemFree( self->preStr );
-   if( self->title )
-      MemFree( self->title );
-   _Stg_Class_Delete( self );
-}
-
-
-void _Progress_Print( void* _self, struct Stream* stream) {
-}
-
-
-void Progress_SetStream( void* _self, Stream* strm ) {
-   Progress* self = (Progress*)_self;
-
-   self->strm = strm;
-}
-
-
-void Progress_SetTitle( void* _self, Name str ) {
-   Progress* self = (Progress*)_self;
-
-   if( self->title )
-      MemFree( self->title );
-   self->title = StG_Strdup( str );
-}
-
-
-void Progress_SetPrefix( void* _self, Name str ) {
-   Progress* self = (Progress*)_self;
-
-   if( self->preStr )
-      MemFree( self->preStr );
-   self->preStr = StG_Strdup( str );
-}
-
-
-void Progress_SetRange( void* _self, int start, int end ) {
-   Progress* self = (Progress*)_self;
-
-   assert( start <= end );
-   self->start = start;
-   self->end = end;
-   Progress_Restart( self );
-}
-
-
-void Progress_Restart( void* _self ) {
-   Progress* self = (Progress*)_self;
-
-   self->printTitle = True;
-   self->pos = self->start;
-   self->perc = 0;
-   self->nBars = 0;
-   self->nSpaces = 0;
-   Progress_CalcStatus( self );
-}
-
-
-void Progress_Update( void* _self ) {
-   Progress* self = (Progress*)_self;
-
-   if( self->rank != 0 || !self->strm )
-      return;
-
-   if( self->printTitle && self->title ) {
-      Journal_Printf( self->strm, "%s\n", self->title );
-      self->printTitle = False;
-   }
-
-   Progress_PrintStatus( self );
-}
-
-
-void Progress_Increment( void* _self ) {
-   Progress* self = (Progress*)_self;
-
-   self->pos++;
-   if( Progress_CalcStatus( self ) )
-      Progress_Update( self );
-}
-
-
-void Progress_PrintStatus( void* _self ) {
-   Progress* self = (Progress*)_self;
-   int ii;
-
-   if( self->rank != 0 || !self->strm )
-      return;
-
-   assert( self->width >= 8 );
-   if( self->preStr )
-      Journal_Printf( self->strm, "%s", self->preStr );
-   Journal_Printf( self->strm, "[%3d%%|", self->perc );
-   for( ii = 0; ii < self->nBars; ii++ )
-      Journal_Printf( self->strm, "=" );
-   for( ii = 0; ii < self->nSpaces; ii++ )
-      Journal_Printf( self->strm, " " );
-   Journal_Printf( self->strm, "]" );
-   if( self->perc == 100 )
-      Journal_Printf( self->strm, "\n" );
-   else
-      Journal_Printf( self->strm, "\r" );
-}
-
-Bool Progress_CalcStatus( Progress* self ) {
-   int oldPerc, oldnBars;
-   float frac;
-
-   oldPerc = self->perc;
-   oldnBars = self->nBars;
-
-   if( self->start != self->end )
-      frac = (float)(self->pos - self->start) / (float)(self->end - self->start);
-   else
-      frac = 0.0;
-   self->perc = (int)(frac * 100);
-   self->nBars = (int)(frac * (float)(self->width - 7));
-   self->nSpaces = self->width - 7 - self->nBars;
-
-   return (self->perc != oldPerc || self->nBars != oldnBars) ? True : False;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Utils/src/Progress.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/Progress.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,211 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd,
+** 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/Base/Foundation/Foundation.h>
+#include <StGermain/Base/IO/IO.h>
+#include "types.h"
+#include "Progress.h"
+
+
+void Progress_PrintStatus( void* self );
+Bool Progress_CalcStatus( Progress* self );
+
+
+const Type Progress_Type = "Progress";
+
+
+Progress* Progress_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(Progress);
+	Type                              type = Progress_Type;
+	Stg_Class_DeleteFunction*      _delete = _Progress_Delete;
+	Stg_Class_PrintFunction*        _print = _Progress_Print;
+	Stg_Class_CopyFunction*          _copy = NULL;
+
+   return _Progress_New(  PROGRESS_PASSARGS  );
+}
+
+
+Progress* _Progress_New(  PROGRESS_DEFARGS  )
+{
+   Progress* self;
+
+   /* Allocate memory */
+   assert( _sizeOfSelf >= sizeof(Progress) );
+   self = (Progress*)_Stg_Class_New(  STG_CLASS_PASSARGS  );
+   _Progress_Init( self );
+
+   return self;
+}
+
+
+void _Progress_Init( void* _self ) {
+   Progress* self = (Progress*)_self;
+
+   MPI_Comm_rank( MPI_COMM_WORLD, &self->rank );
+   self->title = NULL;
+   self->printTitle = True;
+   self->preStr = NULL;
+   self->width = 40;
+   self->start = 0;
+   self->end = 0;
+   self->pos = 0;
+   self->perc = 0;
+   self->nBars = 0;
+   self->nSpaces = 0;
+}
+
+
+void _Progress_Delete( void* _self ) {
+   Progress* self = (Progress*)_self;
+
+   if( self->preStr )
+      MemFree( self->preStr );
+   if( self->title )
+      MemFree( self->title );
+   _Stg_Class_Delete( self );
+}
+
+
+void _Progress_Print( void* _self, struct Stream* stream) {
+}
+
+
+void Progress_SetStream( void* _self, Stream* strm ) {
+   Progress* self = (Progress*)_self;
+
+   self->strm = strm;
+}
+
+
+void Progress_SetTitle( void* _self, Name str ) {
+   Progress* self = (Progress*)_self;
+
+   if( self->title )
+      MemFree( self->title );
+   self->title = StG_Strdup( str );
+}
+
+
+void Progress_SetPrefix( void* _self, Name str ) {
+   Progress* self = (Progress*)_self;
+
+   if( self->preStr )
+      MemFree( self->preStr );
+   self->preStr = StG_Strdup( str );
+}
+
+
+void Progress_SetRange( void* _self, int start, int end ) {
+   Progress* self = (Progress*)_self;
+
+   assert( start <= end );
+   self->start = start;
+   self->end = end;
+   Progress_Restart( self );
+}
+
+
+void Progress_Restart( void* _self ) {
+   Progress* self = (Progress*)_self;
+
+   self->printTitle = True;
+   self->pos = self->start;
+   self->perc = 0;
+   self->nBars = 0;
+   self->nSpaces = 0;
+   Progress_CalcStatus( self );
+}
+
+
+void Progress_Update( void* _self ) {
+   Progress* self = (Progress*)_self;
+
+   if( self->rank != 0 || !self->strm )
+      return;
+
+   if( self->printTitle && self->title ) {
+      Journal_Printf( self->strm, "%s\n", self->title );
+      self->printTitle = False;
+   }
+
+   Progress_PrintStatus( self );
+}
+
+
+void Progress_Increment( void* _self ) {
+   Progress* self = (Progress*)_self;
+
+   self->pos++;
+   if( Progress_CalcStatus( self ) )
+      Progress_Update( self );
+}
+
+
+void Progress_PrintStatus( void* _self ) {
+   Progress* self = (Progress*)_self;
+   int ii;
+
+   if( self->rank != 0 || !self->strm )
+      return;
+
+   assert( self->width >= 8 );
+   if( self->preStr )
+      Journal_Printf( self->strm, "%s", self->preStr );
+   Journal_Printf( self->strm, "[%3d%%|", self->perc );
+   for( ii = 0; ii < self->nBars; ii++ )
+      Journal_Printf( self->strm, "=" );
+   for( ii = 0; ii < self->nSpaces; ii++ )
+      Journal_Printf( self->strm, " " );
+   Journal_Printf( self->strm, "]" );
+   if( self->perc == 100 )
+      Journal_Printf( self->strm, "\n" );
+   else
+      Journal_Printf( self->strm, "\r" );
+}
+
+Bool Progress_CalcStatus( Progress* self ) {
+   int oldPerc, oldnBars;
+   float frac;
+
+   oldPerc = self->perc;
+   oldnBars = self->nBars;
+
+   if( self->start != self->end )
+      frac = (float)(self->pos - self->start) / (float)(self->end - self->start);
+   else
+      frac = 0.0;
+   self->perc = (int)(frac * 100);
+   self->nBars = (int)(frac * (float)(self->width - 7));
+   self->nSpaces = self->width - 7 - self->nBars;
+
+   return (self->perc != oldPerc || self->nBars != oldnBars) ? True : False;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 Utils/tests/ProgressSuite.c
--- a/Utils/tests/ProgressSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include "pcu/pcu.h"
-#include "StGermain/Base/Base.h"
-#include "StGermain/Utils/Utils.h"
-#include "ProgressSuite.h"
-
-
-typedef struct {
-      Progress* prog;
-} ProgressSuiteData;
-
-
-void ProgressSuite_TestSetStream( ProgressSuiteData* data ) {
-   Progress_SetStream( data->prog, NULL );
-   pcu_check_true( data->prog->strm == NULL );
-   Progress_SetStream( data->prog, (Stream*)1 );
-   pcu_check_true( data->prog->strm == (void*)1 );
-   Progress_SetStream( data->prog, NULL );
-}
-
-void ProgressSuite_TestSetTitle( ProgressSuiteData* data ) {
-   Progress_SetTitle( data->prog, NULL );
-   pcu_check_true( data->prog->title == NULL );
-   Progress_SetTitle( data->prog, "foo" );
-   pcu_check_streq( data->prog->title, "foo" );
-   Progress_SetTitle( data->prog, NULL );
-   pcu_check_true( data->prog->title == NULL );
-}
-
-void ProgressSuite_TestSetPrefix( ProgressSuiteData* data ) {
-   Progress_SetPrefix( data->prog, NULL );
-   pcu_check_true( data->prog->preStr == NULL );
-   Progress_SetPrefix( data->prog, "foo" );
-   pcu_check_streq( data->prog->preStr, "foo" );
-   Progress_SetPrefix( data->prog, NULL );
-   pcu_check_true( data->prog->preStr == NULL );
-}
-
-void ProgressSuite_TestSetRange( ProgressSuiteData* data ) {
-   Progress_SetRange( data->prog, 5, 10 );
-   pcu_check_true( data->prog->start == 5 );
-   pcu_check_true( data->prog->end == 10 );
-   Progress_SetPrefix( data->prog, "foo" );
-   pcu_check_streq( data->prog->preStr, "foo" );
-   Progress_SetPrefix( data->prog, NULL );
-   pcu_check_true( data->prog->preStr == NULL );
-}
-
-void ProgressSuite_TestCalcStatus( ProgressSuiteData* data ) {
-   int ii;
-
-   Progress_SetRange( data->prog, 0, 100 );
-   pcu_check_true( data->prog->perc == 0 );
-   pcu_check_true( data->prog->nBars == 0 );
-   for( ii = 0; ii < 99; ii++ ) {
-      Progress_Increment( data->prog );
-      pcu_check_true( data->prog->perc == ii );
-      /*pcu_check_true( data->prog->nBars == ii );*/
-   }
-}
-
-void ProgressSuite_Setup( ProgressSuiteData* data ) {
-   data->prog = Progress_New();
-}
-
-void ProgressSuite_Teardown( ProgressSuiteData* data ) {
-   Stg_Class_Delete( data->prog );
-}
-
-void ProgressSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, ProgressSuiteData );
-   pcu_suite_setFixtures( suite, ProgressSuite_Setup, ProgressSuite_Teardown );
-   pcu_suite_addTest( suite, ProgressSuite_TestSetStream );
-   pcu_suite_addTest( suite, ProgressSuite_TestSetTitle );
-   pcu_suite_addTest( suite, ProgressSuite_TestSetPrefix );
-   pcu_suite_addTest( suite, ProgressSuite_TestSetRange );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 Utils/tests/ProgressSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/tests/ProgressSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,80 @@
+#include <stdlib.h>
+#include <string.h>
+#include "pcu/pcu.h"
+#include "StGermain/Base/Base.h"
+#include "StGermain/Utils/Utils.h"
+#include "ProgressSuite.h"
+
+
+typedef struct {
+      Progress* prog;
+} ProgressSuiteData;
+
+
+void ProgressSuite_TestSetStream( ProgressSuiteData* data ) {
+   Progress_SetStream( data->prog, NULL );
+   pcu_check_true( data->prog->strm == NULL );
+   Progress_SetStream( data->prog, (Stream*)1 );
+   pcu_check_true( data->prog->strm == (void*)1 );
+   Progress_SetStream( data->prog, NULL );
+}
+
+void ProgressSuite_TestSetTitle( ProgressSuiteData* data ) {
+   Progress_SetTitle( data->prog, NULL );
+   pcu_check_true( data->prog->title == NULL );
+   Progress_SetTitle( data->prog, "foo" );
+   pcu_check_streq( data->prog->title, "foo" );
+   Progress_SetTitle( data->prog, NULL );
+   pcu_check_true( data->prog->title == NULL );
+}
+
+void ProgressSuite_TestSetPrefix( ProgressSuiteData* data ) {
+   Progress_SetPrefix( data->prog, NULL );
+   pcu_check_true( data->prog->preStr == NULL );
+   Progress_SetPrefix( data->prog, "foo" );
+   pcu_check_streq( data->prog->preStr, "foo" );
+   Progress_SetPrefix( data->prog, NULL );
+   pcu_check_true( data->prog->preStr == NULL );
+}
+
+void ProgressSuite_TestSetRange( ProgressSuiteData* data ) {
+   Progress_SetRange( data->prog, 5, 10 );
+   pcu_check_true( data->prog->start == 5 );
+   pcu_check_true( data->prog->end == 10 );
+   Progress_SetPrefix( data->prog, "foo" );
+   pcu_check_streq( data->prog->preStr, "foo" );
+   Progress_SetPrefix( data->prog, NULL );
+   pcu_check_true( data->prog->preStr == NULL );
+}
+
+void ProgressSuite_TestCalcStatus( ProgressSuiteData* data ) {
+   int ii;
+
+   Progress_SetRange( data->prog, 0, 100 );
+   pcu_check_true( data->prog->perc == 0 );
+   pcu_check_true( data->prog->nBars == 0 );
+   for( ii = 0; ii < 99; ii++ ) {
+      Progress_Increment( data->prog );
+      pcu_check_true( data->prog->perc == ii );
+      /*pcu_check_true( data->prog->nBars == ii );*/
+   }
+}
+
+void ProgressSuite_Setup( ProgressSuiteData* data ) {
+   data->prog = Progress_New();
+}
+
+void ProgressSuite_Teardown( ProgressSuiteData* data ) {
+   Stg_Class_Delete( data->prog );
+}
+
+void ProgressSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, ProgressSuiteData );
+   pcu_suite_setFixtures( suite, ProgressSuite_Setup, ProgressSuite_Teardown );
+   pcu_suite_addTest( suite, ProgressSuite_TestSetStream );
+   pcu_suite_addTest( suite, ProgressSuite_TestSetTitle );
+   pcu_suite_addTest( suite, ProgressSuite_TestSetPrefix );
+   pcu_suite_addTest( suite, ProgressSuite_TestSetRange );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 compatibility/mpipython/main.c
--- a/compatibility/mpipython/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: main.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include <stdio.h>
-#include <mpi.h>
-
-DL_EXPORT(int) Py_Main( int, char ** );
-
-int main( int argc, char **argv ) {
-	int status;
-	
-	status = MPI_Init( &argc, &argv );
-	if( status != MPI_SUCCESS ) {
-		printf( "%s: MPI_Init failed! Exiting ...\n", argv[0] );
-		return status;
-	}
-
-	status = Py_Main( argc, argv );
-
-	MPI_Finalize();
-
-	return status;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 compatibility/mpipython/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compatibility/mpipython/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,53 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: main.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include <stdio.h>
+#include <mpi.h>
+
+DL_EXPORT(int) Py_Main( int, char ** );
+
+int main( int argc, char **argv ) {
+	int status;
+	
+	status = MPI_Init( &argc, &argv );
+	if( status != MPI_SUCCESS ) {
+		printf( "%s: MPI_Init failed! Exiting ...\n", argv[0] );
+		return status;
+	}
+
+	status = Py_Main( argc, argv );
+
+	MPI_Finalize();
+
+	return status;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/General/bindings.c
--- a/libStGermain/Python/Bindings/General/bindings.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: bindings.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-
-#include <mpi.h>
-#include "StGermain/StGermain.h"
-#include <limits.h>
-#include "bindings.h"
-#include "misc.h"
-
-struct PyMethodDef General_Python_Methods[] = {
-	{ General_Python_copyright__name__,	General_Python_copyright,		METH_VARARGS, General_Python_copyright__doc__	},
-	{ General_Python_Initialise__name__,	General_Python_Initialise,	METH_VARARGS, General_Python_Initialise__doc__	},
-	{ 0, 0, 0, 0 }
-};
-
-/* "Initialise" member */
-char General_Python_Initialise__doc__[] = "Initialise all StGermain C modules";
-char General_Python_Initialise__name__[] = "Initialise";
-PyObject* General_Python_Initialise( PyObject* self, PyObject* args ) {
-	int result = 0;
-	int argc = 0;
-	char **argv = NULL;
-	
-	/*
-	TODO: grab the argc and argv values to pass in correctly
-	*/
-	/* Obtain arguements */
-	#if 0
-	if( !PyArg_ParseTuple( args, "iO:", &, &len ) ) {
-		return NULL;
-	}
-	#endif
-
-	result = StGermain_Init( &argc, &argv );
-	return Py_BuildValue("i", result);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/General/bindings.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/Python/Bindings/General/bindings.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,67 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: bindings.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+
+#include <mpi.h>
+#include "StGermain/StGermain.h"
+#include <limits.h>
+#include "bindings.h"
+#include "misc.h"
+
+struct PyMethodDef General_Python_Methods[] = {
+	{ General_Python_copyright__name__,	General_Python_copyright,		METH_VARARGS, General_Python_copyright__doc__	},
+	{ General_Python_Initialise__name__,	General_Python_Initialise,	METH_VARARGS, General_Python_Initialise__doc__	},
+	{ 0, 0, 0, 0 }
+};
+
+/* "Initialise" member */
+char General_Python_Initialise__doc__[] = "Initialise all StGermain C modules";
+char General_Python_Initialise__name__[] = "Initialise";
+PyObject* General_Python_Initialise( PyObject* self, PyObject* args ) {
+	int result = 0;
+	int argc = 0;
+	char **argv = NULL;
+	
+	/*
+	TODO: grab the argc and argv values to pass in correctly
+	*/
+	/* Obtain arguements */
+	#if 0
+	if( !PyArg_ParseTuple( args, "iO:", &, &len ) ) {
+		return NULL;
+	}
+	#endif
+
+	result = StGermain_Init( &argc, &argv );
+	return Py_BuildValue("i", result);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/General/init.c
--- a/libStGermain/Python/Bindings/General/init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "bindings.h"
-#include "misc.h"
-
-char General_Python__doc__[] = "This module is for general StGermain bindings, such as initialisation.";
-
-void initGeneral() {
-	Py_InitModule4( "General", General_Python_Methods, General_Python__doc__, 0, PYTHON_API_VERSION );
-	if( PyErr_Occurred() ) {
-		Py_FatalError( "Can't initialize module General" );
-	}
-	return;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/General/init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/Python/Bindings/General/init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,45 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "bindings.h"
+#include "misc.h"
+
+char General_Python__doc__[] = "This module is for general StGermain bindings, such as initialisation.";
+
+void initGeneral() {
+	Py_InitModule4( "General", General_Python_Methods, General_Python__doc__, 0, PYTHON_API_VERSION );
+	if( PyErr_Occurred() ) {
+		Py_FatalError( "Can't initialize module General" );
+	}
+	return;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/General/misc.c
--- a/libStGermain/Python/Bindings/General/misc.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "misc.h"
-
-
-char General_Python_copyright__doc__[] = "";
-char General_Python_copyright__name__[] = "copyright";
-
-PyObject* General_Python_copyright( PyObject* self, PyObject* args ) {
-	return Py_BuildValue( "s", "StGermain.Bindings.General Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/General/misc.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/Python/Bindings/General/misc.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,42 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "misc.h"
+
+
+char General_Python_copyright__doc__[] = "";
+char General_Python_copyright__name__[] = "copyright";
+
+PyObject* General_Python_copyright( PyObject* self, PyObject* args ) {
+	return Py_BuildValue( "s", "StGermain.Bindings.General Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/MPI/bindings.c
--- a/libStGermain/Python/Bindings/MPI/bindings.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: bindings.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-
-#include <mpi.h>
-#include "StGermain/StGermain.h"
-#include "bindings.h"
-#include "misc.h"
-
-struct PyMethodDef MPI_Python_Methods[] = {
-	{ MPI_Python_copyright__name__,		MPI_Python_copyright,	METH_VARARGS, MPI_Python_copyright__doc__	},
-	{ MPI_Python_COMM_WORLD__name__,	MPI_Python_COMM_WORLD,	METH_VARARGS, MPI_Python_COMM_WORLD__doc__	},
-	{ MPI_Python_Comm_size__name__,		MPI_Python_Comm_size,	METH_VARARGS, MPI_Python_Comm_size__doc__	},
-	{ MPI_Python_Comm_rank__name__,		MPI_Python_Comm_rank,	METH_VARARGS, MPI_Python_Comm_rank__doc__	},
-	{ 0, 0, 0, 0 }
-};
-
-
-/* "COMM_WORLD" member */
-char MPI_Python_COMM_WORLD__doc__[] = "Get the world communicator";
-char MPI_Python_COMM_WORLD__name__[] = "COMM_WORLD";
-PyObject* MPI_Python_COMM_WORLD( PyObject* self, PyObject* args ) {
-	return Py_BuildValue( "i", MPI_COMM_WORLD );
-}
-
-
-/* "Comm_size" member */
-char MPI_Python_Comm_size__doc__[] = "Get the size of the communicator";
-char MPI_Python_Comm_size__name__[] = "Comm_size";
-PyObject* MPI_Python_Comm_size( PyObject* self, PyObject* args ) {
-	MPI_Comm	communicator;
-	int		size;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "i:", &communicator ) ) {
-		return NULL;
-	}
-	
-	/* Run function */
-	MPI_Comm_size( communicator, &size );
-	
-	/* Return */
-	return Py_BuildValue( "i", size );
-}
-
-/* "Comm_rank" member */
-char MPI_Python_Comm_rank__doc__[] = "Get the rank of this processor in this communicator";
-char MPI_Python_Comm_rank__name__[] = "Comm_rank";
-PyObject* MPI_Python_Comm_rank( PyObject* self, PyObject* args ) {
-	MPI_Comm	communicator;
-	int		rank;
-	
-	/* Obtain arguements */
-	if( !PyArg_ParseTuple( args, "i:", &communicator ) ) {
-		return NULL;
-	}
-	
-	/* Run function */
-	MPI_Comm_rank( communicator, &rank );
-	
-	/* Return */
-	return Py_BuildValue( "i", rank );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/MPI/bindings.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/Python/Bindings/MPI/bindings.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,93 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: bindings.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+
+#include <mpi.h>
+#include "StGermain/StGermain.h"
+#include "bindings.h"
+#include "misc.h"
+
+struct PyMethodDef MPI_Python_Methods[] = {
+	{ MPI_Python_copyright__name__,		MPI_Python_copyright,	METH_VARARGS, MPI_Python_copyright__doc__	},
+	{ MPI_Python_COMM_WORLD__name__,	MPI_Python_COMM_WORLD,	METH_VARARGS, MPI_Python_COMM_WORLD__doc__	},
+	{ MPI_Python_Comm_size__name__,		MPI_Python_Comm_size,	METH_VARARGS, MPI_Python_Comm_size__doc__	},
+	{ MPI_Python_Comm_rank__name__,		MPI_Python_Comm_rank,	METH_VARARGS, MPI_Python_Comm_rank__doc__	},
+	{ 0, 0, 0, 0 }
+};
+
+
+/* "COMM_WORLD" member */
+char MPI_Python_COMM_WORLD__doc__[] = "Get the world communicator";
+char MPI_Python_COMM_WORLD__name__[] = "COMM_WORLD";
+PyObject* MPI_Python_COMM_WORLD( PyObject* self, PyObject* args ) {
+	return Py_BuildValue( "i", MPI_COMM_WORLD );
+}
+
+
+/* "Comm_size" member */
+char MPI_Python_Comm_size__doc__[] = "Get the size of the communicator";
+char MPI_Python_Comm_size__name__[] = "Comm_size";
+PyObject* MPI_Python_Comm_size( PyObject* self, PyObject* args ) {
+	MPI_Comm	communicator;
+	int		size;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "i:", &communicator ) ) {
+		return NULL;
+	}
+	
+	/* Run function */
+	MPI_Comm_size( communicator, &size );
+	
+	/* Return */
+	return Py_BuildValue( "i", size );
+}
+
+/* "Comm_rank" member */
+char MPI_Python_Comm_rank__doc__[] = "Get the rank of this processor in this communicator";
+char MPI_Python_Comm_rank__name__[] = "Comm_rank";
+PyObject* MPI_Python_Comm_rank( PyObject* self, PyObject* args ) {
+	MPI_Comm	communicator;
+	int		rank;
+	
+	/* Obtain arguements */
+	if( !PyArg_ParseTuple( args, "i:", &communicator ) ) {
+		return NULL;
+	}
+	
+	/* Run function */
+	MPI_Comm_rank( communicator, &rank );
+	
+	/* Return */
+	return Py_BuildValue( "i", rank );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/MPI/init.c
--- a/libStGermain/Python/Bindings/MPI/init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "bindings.h"
-#include "misc.h"
-
-char MPI_Python_module__doc__[] = "Context doc";
-
-void initMPI() {
-	Py_InitModule4( "MPI", MPI_Python_Methods, MPI_Python_module__doc__, 0, PYTHON_API_VERSION );
-	if( PyErr_Occurred() ) {
-		Py_FatalError( "Can't initialize module MPI" );
-	}
-
-	return;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/MPI/init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/Python/Bindings/MPI/init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,46 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: init.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "bindings.h"
+#include "misc.h"
+
+char MPI_Python_module__doc__[] = "Context doc";
+
+void initMPI() {
+	Py_InitModule4( "MPI", MPI_Python_Methods, MPI_Python_module__doc__, 0, PYTHON_API_VERSION );
+	if( PyErr_Occurred() ) {
+		Py_FatalError( "Can't initialize module MPI" );
+	}
+
+	return;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/MPI/misc.c
--- a/libStGermain/Python/Bindings/MPI/misc.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <Python.h>
-#include "misc.h"
-
-
-char MPI_Python_copyright__doc__[] = "";
-char MPI_Python_copyright__name__[] = "copyright";
-
-PyObject* MPI_Python_copyright( PyObject* self, PyObject* args ) {
-    return Py_BuildValue( "s", "StGermain.Bindings.MPI Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/Python/Bindings/MPI/misc.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/Python/Bindings/MPI/misc.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,42 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: misc.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <Python.h>
+#include "misc.h"
+
+
+char MPI_Python_copyright__doc__[] = "";
+char MPI_Python_copyright__name__[] = "copyright";
+
+PyObject* MPI_Python_copyright( PyObject* self, PyObject* args ) {
+    return Py_BuildValue( "s", "StGermain.Bindings.MPI Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia." );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/dynamic/dummy.c
--- a/libStGermain/dynamic/dummy.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: dummy.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* exists only such that MM doesn't fail to create an empty ".a" */
-                                                                                
-										/* dummy function so that Tru64 CC doesn't complain about doing nothing */
-const int StGermain_Dummy = 0;
-
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/dynamic/dummy.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/dynamic/dummy.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,37 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: dummy.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* exists only such that MM doesn't fail to create an empty ".a" */
+                                                                                
+										/* dummy function so that Tru64 CC doesn't complain about doing nothing */
+const int StGermain_Dummy = 0;
+
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/Finalise.c
--- a/libStGermain/src/Finalise.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Finalise.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-#include "Base/Context/Context.h"
-
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool StGermain_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	/* Delete the global objects : xmlSearchPaths and moduleDirectories */
-	Stg_ObjectList_DeleteAllObjects( moduleDirectories );
-	Stg_Class_Delete( moduleDirectories );
-	
-	Stg_ObjectList_DeleteAllObjects(Project_XMLSearchPaths);
-	Stg_Class_Delete( Project_XMLSearchPaths );
-
-	/* Finalise all the bits and pieces */
-	BaseContext_Finalise();
-//#if 0
-	BaseExtensibility_Finalise();
-//#endif
-	BaseAutomation_Finalise();
-	BaseContainer_Finalise();
-	BaseIO_Finalise();
-	BaseFoundation_Finalise();
-
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/src/Finalise.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,67 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Finalise.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+#include "Base/Context/Context.h"
+
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool StGermain_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	/* Delete the global objects : xmlSearchPaths and moduleDirectories */
+	Stg_ObjectList_DeleteAllObjects( moduleDirectories );
+	Stg_Class_Delete( moduleDirectories );
+	
+	Stg_ObjectList_DeleteAllObjects(Project_XMLSearchPaths);
+	Stg_Class_Delete( Project_XMLSearchPaths );
+
+	/* Finalise all the bits and pieces */
+	BaseContext_Finalise();
+//#if 0
+	BaseExtensibility_Finalise();
+//#endif
+	BaseAutomation_Finalise();
+	BaseContainer_Finalise();
+	BaseIO_Finalise();
+	BaseFoundation_Finalise();
+
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/Init.c
--- a/libStGermain/src/Init.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: Init.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdarg.h>
-#include <mpi.h>
-#include "Base/Foundation/Foundation.h"
-#include "Base/IO/IO.h"
-#include "Base/Container/Container.h"
-#include "Base/Automation/Automation.h"
-#include "Base/Extensibility/Extensibility.h"
-#include "Base/Context/Context.h"
-
-#include "Init.h"
-
-#include <stdio.h>
-
-Bool StGermain_Init( int* argc, char** argv[] ) {
-	char* directory;
-	int tmp;
-	
-	/* Initialise enough bits and pieces to get IO going */
-	BaseFoundation_Init( argc, argv );
-	BaseIO_Init( argc, argv );
-
-	/* Write out the copyright message */
-	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	tmp = Stream_GetPrintingRank( Journal_Register( InfoStream_Type, "Context" ) );
-	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), 0 );
-	Journal_Printf( /* DO NOT CHANGE OR REMOVE */
-		Journal_Register( InfoStream_Type, "Context" ), 
-		"StGermain Framework revision %s. Copyright (C) 2003-2005 VPAC.\n", VERSION );
-	Stream_Flush( Journal_Register( InfoStream_Type, "Context" ) );
-	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), tmp );
-	
-	/* Initialise the remaining bits and pieces */
-	BaseContainer_Init( argc, argv );
-	BaseAutomation_Init( argc, argv );
-	BaseExtensibility_Init( argc, argv );
-	BaseContext_Init( argc, argv );
-	
-	/* Add the StGermain path to the global xml path dictionary */
-	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
-	sprintf( directory, "%s%s", LIB_DIR, "/StGermain" );
-	XML_IO_Handler_AddDirectory( "StGermain", directory  );
-	Memory_Free( directory );
-	
-	/* Add the plugin path to the global plugin list */
-	ModulesManager_AddDirectory( "StGermain", LIB_DIR );
-	
-	return True;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/src/Init.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,80 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Init.c 4200 2007-12-05 04:11:33Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdarg.h>
+#include <mpi.h>
+#include "Base/Foundation/Foundation.h"
+#include "Base/IO/IO.h"
+#include "Base/Container/Container.h"
+#include "Base/Automation/Automation.h"
+#include "Base/Extensibility/Extensibility.h"
+#include "Base/Context/Context.h"
+
+#include "Init.h"
+
+#include <stdio.h>
+
+Bool StGermain_Init( int* argc, char** argv[] ) {
+	char* directory;
+	int tmp;
+	
+	/* Initialise enough bits and pieces to get IO going */
+	BaseFoundation_Init( argc, argv );
+	BaseIO_Init( argc, argv );
+
+	/* Write out the copyright message */
+	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	tmp = Stream_GetPrintingRank( Journal_Register( InfoStream_Type, "Context" ) );
+	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), 0 );
+	Journal_Printf( /* DO NOT CHANGE OR REMOVE */
+		Journal_Register( InfoStream_Type, "Context" ), 
+		"StGermain Framework revision %s. Copyright (C) 2003-2005 VPAC.\n", VERSION );
+	Stream_Flush( Journal_Register( InfoStream_Type, "Context" ) );
+	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), tmp );
+	
+	/* Initialise the remaining bits and pieces */
+	BaseContainer_Init( argc, argv );
+	BaseAutomation_Init( argc, argv );
+	BaseExtensibility_Init( argc, argv );
+	BaseContext_Init( argc, argv );
+	
+	/* Add the StGermain path to the global xml path dictionary */
+	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
+	sprintf( directory, "%s%s", LIB_DIR, "/StGermain" );
+	XML_IO_Handler_AddDirectory( "StGermain", directory  );
+	Memory_Free( directory );
+	
+	/* Add the plugin path to the global plugin list */
+	ModulesManager_AddDirectory( "StGermain", LIB_DIR );
+	
+	return True;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/main.c
--- a/libStGermain/src/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
-**	Melbourne, 3053, Australia.
-**
-** Primary Contributing Organisations:
-**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
-**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
-**	Monash Cluster Computing - http://www.mcc.monash.edu.au
-**	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
-**
-** Contributors:
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
-**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
-**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
-**	Kent Humphries, Software Engineer, VPAC. (kenth at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: main.c 532 2006-04-04 00:21:59Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include "StGermain/Base/Base.h"
-
-#include "main.h"
-
-#include <stdio.h>
-
-
-void stgMain( Dictionary* dictionary, MPI_Comm communicator ) {
-	Stg_ComponentFactory*	cf;
-
-	cf = stgMainConstruct( dictionary, communicator, NULL );
-	stgMainLoop( cf );
-	stgMainDestroy( cf );
-
-	Stg_Class_Delete( cf );
-}
-
-/* TODO: need to find a way to add different communicators for different contexts */
-Stg_ComponentFactory* stgMainConstruct( Dictionary* dictionary, MPI_Comm communicator, void* _context ) {
-	Stg_ComponentFactory*	cf;
-	Dictionary*					componentDict;
-	Stg_Component*				component;
-	AbstractContext*			context;
-	unsigned						component_I;
-
-	if( ( componentDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, "components" ) ) ) == NULL )
-		componentDict = Dictionary_New();
-	
-	CheckDictionaryKeys( componentDict, "Component dictionary must have unique names\n" );
-	cf = Stg_ComponentFactory_New( dictionary, componentDict );
-
-	if( _context ) {
-		context = (AbstractContext*)_context;
-		context->CF = cf;
-		context->dictionary = dictionary;
-		context->communicator = communicator;
-		LiveComponentRegister_Add( cf->LCRegister,
-                                           (Stg_Component*)context );
-	}
-
-	/* Instantion phase -------------------------------------------------------------------------------------------------*/
-	Stg_ComponentFactory_CreateComponents( cf );
-
-	/* Assign the dictionary, componentFactory & the communicator for the contexts */
-	/* TODO: if different contexts require different communicators, then StG. components will be required for these, and 
-	 * they should be passed in from the XML */
-	/* Also, this is a little hacky, as nothing is known about the other layers of StG or their associated contexts here */
-	for( component_I = 0; component_I < LiveComponentRegister_GetCount( cf->LCRegister ); component_I++ ) {
-		component = LiveComponentRegister_At( cf->LCRegister, component_I );
-		if( Stg_CompareType( component, AbstractContext ) ) { 
-			Journal_Firewall( dictionary->count, Journal_Register( Error_Type, "Error Stream" ), 
-				 "Error in %s: The dictionary is empty, meaning no input parameters have been feed into your program. Perhaps you've forgot to pass any input files ( or command-line arguments ) in.\n", __func__); 	
-			context = (AbstractContext*)component;
-			context->dictionary = dictionary;
-			context->CF = cf;
-			context->communicator = communicator;
-		}
-	}
-	/* Construction phase -----------------------------------------------------------------------------------------------*/
-	Stg_ComponentFactory_ConstructComponents( cf, NULL );
-	
-	return cf;
-}
-
-void stgMainBuildAndInitialise( Stg_ComponentFactory* cf ) {
-	/* Building phase ---------------------------------------------------------------------------------------------------*/
-	Stg_ComponentFactory_BuildComponents( cf, NULL );
-	
-	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
-	Stg_ComponentFactory_InitialiseComponents( cf, NULL );
-}
-
-Stg_ComponentFactory* stgMainInitFromXML( char* xmlInputFilename, MPI_Comm communicator, void* _context ) {
-   Dictionary*       		dictionary = NULL;
-   Bool              		result;
-   XML_IO_Handler*   		ioHandler;
-   Stg_ComponentFactory*	cf;
-
-   dictionary = Dictionary_New();
-   ioHandler = XML_IO_Handler_New();
-   result = IO_Handler_ReadAllFromFile( ioHandler, xmlInputFilename, dictionary );
-   /* In case the user has put any journal configuration in the XML, read here */
-   Journal_ReadFromDictionary( dictionary );
-
-   cf = stgMainConstruct( dictionary, communicator, _context );
-   
-   /* We don't need the XML IO handler again (however don't delete the dictionary as it's 
-    * 'owned' by the context from hereon */
-   Stg_Class_Delete( ioHandler );
-
-   return cf;
-}
-
-	
-void stgMainLoop( Stg_ComponentFactory* cf ) {
-	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
-	/* do this by running the contexts, which manage the entry points which call the _Execute() funcs for the other components */
-	unsigned component_i;
-	Stg_Component* component;
-	AbstractContext* context;
-	
-	for( component_i = 0; component_i < LiveComponentRegister_GetCount( cf->LCRegister ); component_i++ ) {
-		component = LiveComponentRegister_At( cf->LCRegister, component_i );
-		if( Stg_CompareType( component, AbstractContext ) ) { 
-			context = (AbstractContext*)component;
-			AbstractContext_Dump( context );
-			Stg_Component_Execute( context, 0, True );
-		}
-	}
-}
-
-void stgMainDestroy( Stg_ComponentFactory* cf ) {
-   /* Destruct phase ---------------------------------------------------------------------------------------------------*/
-   LiveComponentRegister_DestroyAll( cf->LCRegister );
-   Stg_Class_Delete( cf ); /* this will call the LCRegister Delete func */
-}
-
-void stgImportToolbox( Dictionary* dictionary, char* toolboxName ) {
-	Dictionary_Entry_Value* dev = Dictionary_Get( dictionary, "import" );
-	
-	if( !dev ) {
-		dev = Dictionary_Entry_Value_NewList();
-		Dictionary_Add( dictionary, "import", dev );
-	}
-	
-	Dictionary_Entry_Value_AddElement( dev, Dictionary_Entry_Value_FromString( toolboxName ) );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/src/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,172 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
+**
+** Contributors:
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**	Kent Humphries, Software Engineer, VPAC. (kenth at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: main.c 532 2006-04-04 00:21:59Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "StGermain/Base/Base.h"
+
+#include "main.h"
+
+#include <stdio.h>
+
+
+void stgMain( Dictionary* dictionary, MPI_Comm communicator ) {
+	Stg_ComponentFactory*	cf;
+
+	cf = stgMainConstruct( dictionary, communicator, NULL );
+	stgMainLoop( cf );
+	stgMainDestroy( cf );
+
+	Stg_Class_Delete( cf );
+}
+
+/* TODO: need to find a way to add different communicators for different contexts */
+Stg_ComponentFactory* stgMainConstruct( Dictionary* dictionary, MPI_Comm communicator, void* _context ) {
+	Stg_ComponentFactory*	cf;
+	Dictionary*					componentDict;
+	Stg_Component*				component;
+	AbstractContext*			context;
+	unsigned						component_I;
+
+	if( ( componentDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( dictionary, "components" ) ) ) == NULL )
+		componentDict = Dictionary_New();
+	
+	CheckDictionaryKeys( componentDict, "Component dictionary must have unique names\n" );
+	cf = Stg_ComponentFactory_New( dictionary, componentDict );
+
+	if( _context ) {
+		context = (AbstractContext*)_context;
+		context->CF = cf;
+		context->dictionary = dictionary;
+		context->communicator = communicator;
+		LiveComponentRegister_Add( cf->LCRegister,
+                                           (Stg_Component*)context );
+	}
+
+	/* Instantion phase -------------------------------------------------------------------------------------------------*/
+	Stg_ComponentFactory_CreateComponents( cf );
+
+	/* Assign the dictionary, componentFactory & the communicator for the contexts */
+	/* TODO: if different contexts require different communicators, then StG. components will be required for these, and 
+	 * they should be passed in from the XML */
+	/* Also, this is a little hacky, as nothing is known about the other layers of StG or their associated contexts here */
+	for( component_I = 0; component_I < LiveComponentRegister_GetCount( cf->LCRegister ); component_I++ ) {
+		component = LiveComponentRegister_At( cf->LCRegister, component_I );
+		if( Stg_CompareType( component, AbstractContext ) ) { 
+			Journal_Firewall( dictionary->count, Journal_Register( Error_Type, "Error Stream" ), 
+				 "Error in %s: The dictionary is empty, meaning no input parameters have been feed into your program. Perhaps you've forgot to pass any input files ( or command-line arguments ) in.\n", __func__); 	
+			context = (AbstractContext*)component;
+			context->dictionary = dictionary;
+			context->CF = cf;
+			context->communicator = communicator;
+		}
+	}
+	/* Construction phase -----------------------------------------------------------------------------------------------*/
+	Stg_ComponentFactory_ConstructComponents( cf, NULL );
+	
+	return cf;
+}
+
+void stgMainBuildAndInitialise( Stg_ComponentFactory* cf ) {
+	/* Building phase ---------------------------------------------------------------------------------------------------*/
+	Stg_ComponentFactory_BuildComponents( cf, NULL );
+	
+	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
+	Stg_ComponentFactory_InitialiseComponents( cf, NULL );
+}
+
+Stg_ComponentFactory* stgMainInitFromXML( char* xmlInputFilename, MPI_Comm communicator, void* _context ) {
+   Dictionary*       		dictionary = NULL;
+   Bool              		result;
+   XML_IO_Handler*   		ioHandler;
+   Stg_ComponentFactory*	cf;
+
+   dictionary = Dictionary_New();
+   ioHandler = XML_IO_Handler_New();
+   result = IO_Handler_ReadAllFromFile( ioHandler, xmlInputFilename, dictionary );
+   /* In case the user has put any journal configuration in the XML, read here */
+   Journal_ReadFromDictionary( dictionary );
+
+   cf = stgMainConstruct( dictionary, communicator, _context );
+   
+   /* We don't need the XML IO handler again (however don't delete the dictionary as it's 
+    * 'owned' by the context from hereon */
+   Stg_Class_Delete( ioHandler );
+
+   return cf;
+}
+
+	
+void stgMainLoop( Stg_ComponentFactory* cf ) {
+	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
+	/* do this by running the contexts, which manage the entry points which call the _Execute() funcs for the other components */
+	unsigned component_i;
+	Stg_Component* component;
+	AbstractContext* context;
+	
+	for( component_i = 0; component_i < LiveComponentRegister_GetCount( cf->LCRegister ); component_i++ ) {
+		component = LiveComponentRegister_At( cf->LCRegister, component_i );
+		if( Stg_CompareType( component, AbstractContext ) ) { 
+			context = (AbstractContext*)component;
+			AbstractContext_Dump( context );
+			Stg_Component_Execute( context, 0, True );
+		}
+	}
+}
+
+void stgMainDestroy( Stg_ComponentFactory* cf ) {
+   /* Destruct phase ---------------------------------------------------------------------------------------------------*/
+   LiveComponentRegister_DestroyAll( cf->LCRegister );
+   Stg_Class_Delete( cf ); /* this will call the LCRegister Delete func */
+}
+
+void stgImportToolbox( Dictionary* dictionary, char* toolboxName ) {
+	Dictionary_Entry_Value* dev = Dictionary_Get( dictionary, "import" );
+	
+	if( !dev ) {
+		dev = Dictionary_Entry_Value_NewList();
+		Dictionary_Add( dictionary, "import", dev );
+	}
+	
+	Dictionary_Entry_Value_AddElement( dev, Dictionary_Entry_Value_FromString( toolboxName ) );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/stg_static_modules.c.tmpl
--- a/libStGermain/src/stg_static_modules.c.tmpl	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-void register_static_modules() {
-    /* REPLACE WITH REGISTERY CALLS */
-}
diff -r 4a864caece0b -r f9c376288955 libStGermain/src/stg_static_modules.cxx.tmpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/src/stg_static_modules.cxx.tmpl	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,3 @@
+void register_static_modules() {
+    /* REPLACE WITH REGISTERY CALLS */
+}
diff -r 4a864caece0b -r f9c376288955 libStGermain/static/dummy.c
--- a/libStGermain/static/dummy.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: dummy.c 3462 2006-02-19 06:53:24Z WalterLandry $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-/* exists only such that MM doesn't fail to create an empty ".a" */
-                                                                                
-										/* dummy function so that Tru64 CC doesn't complain about doing nothing */
-const int StGermain_Dummy = 0;
-
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/static/dummy.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/static/dummy.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,37 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: dummy.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* exists only such that MM doesn't fail to create an empty ".a" */
+                                                                                
+										/* dummy function so that Tru64 CC doesn't complain about doing nothing */
+const int StGermain_Dummy = 0;
+
+
+
diff -r 4a864caece0b -r f9c376288955 libStGermain/tests/LibStGermainSuite.c
--- a/libStGermain/tests/LibStGermainSuite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-**
-** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcu/pcu.h"
-#include "StGermain.h"
-#include "LibStGermainSuite.h"
-
-typedef struct {
-} LibStGermainSuiteData;
-
-
-void LibStGermainSuite_Setup( LibStGermainSuiteData* data ) {
-}
-
-void LibStGermainSuite_Teardown( LibStGermainSuiteData* data ) {
-}
-   
-
-void LibStGermainSuite_TestXMLLibraryPath( LibStGermainSuiteData* data ) {
-   Stg_Object* testDirectory;
-   /* Testing entries in xmlDictionary */
-   testDirectory = (Stg_Object*)Stg_ObjectList_Get( Project_XMLSearchPaths,"StGermain" );
-   pcu_check_true(testDirectory != NULL);
-}
-
-
-void LibStGermainSuite( pcu_suite_t* suite ) {
-   pcu_suite_setData( suite, LibStGermainSuiteData );
-   pcu_suite_setFixtures( suite, LibStGermainSuite_Setup, LibStGermainSuite_Teardown );
-   pcu_suite_addTest( suite, LibStGermainSuite_TestXMLLibraryPath );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 libStGermain/tests/LibStGermainSuite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libStGermain/tests/LibStGermainSuite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,64 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**   Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**   Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**   Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**   Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**   Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**   Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+**
+** $Id: testJournal-Dictionary.c 2745 2005-03-05 08:12:18Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcu/pcu.h"
+#include "StGermain.h"
+#include "LibStGermainSuite.h"
+
+typedef struct {
+} LibStGermainSuiteData;
+
+
+void LibStGermainSuite_Setup( LibStGermainSuiteData* data ) {
+}
+
+void LibStGermainSuite_Teardown( LibStGermainSuiteData* data ) {
+}
+   
+
+void LibStGermainSuite_TestXMLLibraryPath( LibStGermainSuiteData* data ) {
+   Stg_Object* testDirectory;
+   /* Testing entries in xmlDictionary */
+   testDirectory = (Stg_Object*)Stg_ObjectList_Get( Project_XMLSearchPaths,"StGermain" );
+   pcu_check_true(testDirectory != NULL);
+}
+
+
+void LibStGermainSuite( pcu_suite_t* suite ) {
+   pcu_suite_setData( suite, LibStGermainSuiteData );
+   pcu_suite_setFixtures( suite, LibStGermainSuite_Setup, LibStGermainSuite_Teardown );
+   pcu_suite_addTest( suite, LibStGermainSuite_TestXMLLibraryPath );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/SConscript
--- a/pcu/SConscript	Wed May 11 13:26:45 2011 -0700
+++ b/pcu/SConscript	Thu May 12 11:18:29 2011 -0700
@@ -14,7 +14,7 @@ env.Install('include/pcu', Glob('src/*.h
 env.Install('include/pcu', Glob('src/*.h'))
 
 # Build our source files.
-objs = env.SharedObject(Glob('src/*.c'))
+objs = env.SharedObject(Glob('src/*.cxx'))
 
 # Build a library (if needed) and register destination.
 if env['static_libs']:
diff -r 4a864caece0b -r f9c376288955 pcu/script/pcutest.py
--- a/pcu/script/pcutest.py	Wed May 11 13:26:45 2011 -0700
+++ b/pcu/script/pcutest.py	Thu May 12 11:18:29 2011 -0700
@@ -90,9 +90,9 @@ def generate(env, **kw):
 
     def PCUSuite(env, target, source, **kw):
         """Create an object/header pair out of a
-        *Suite.c/*Suite.h pair. The target should just
+        *Suite.cxx/*Suite.h pair. The target should just
         be the name of the suite. So, if target were
-        "Happy", the sources would be "HappySuite.c" and
+        "Happy", the sources would be "HappySuite.cxx" and
         "HappySuite.h\""""
         obj = env.Object(target[0], source[0])
         return [obj + [File(os.path.splitext(source[0].abspath)[0] + ".h")]]
@@ -106,7 +106,7 @@ def generate(env, **kw):
             hdrs.append(File(os.path.splitext(s.srcnode().abspath)[0] + '.h'))
 
         # Generate the program source.
-        prog_src = build_suite_runner(env, File(str(target[0]) + ".c"), hdrs, objs, **kw)
+        prog_src = build_suite_runner(env, File(str(target[0]) + ".cxx"), hdrs, objs, **kw)
 
         # Build everything.
         exps = multiget([kw, env], 'PCU_EXP', [])
diff -r 4a864caece0b -r f9c376288955 pcu/src/checks.c
--- a/pcu/src/checks.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <mpi.h>
-#include "types.h"
-#include "test.h"
-#include "checks.h"
-
-void _pcu_check_fileEq( const char* const fileName1, const char* const fileName2,
-      const char* const fName1Expr, const char* const fName2Expr, pcu_suite_t* pcu_cursuite,
-      const char* sourceFile, const unsigned int sourceLine )
-{
-   const int      MAXLINE = 10000;
-   FILE*          testFile1=NULL;
-   FILE*          testFile2=NULL;
-   char           file1Line[MAXLINE];
-   char           file2Line[MAXLINE];
-   char           file2LineCopy[MAXLINE];
-   int				rank;
-   char*          ret1;
-   char*          ret2;
-   unsigned int   ii=0;
-   char           exprString[5000];
-   char           msgString[5000];
-   unsigned int   file2LineLen = 0;
-
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-
-   if ( rank != 0 ) return;   /* Only do file I/O with proc 0: otherwise errors can result */
-
-   sprintf( exprString, "%s equal file to %s", fName1Expr, fName2Expr );
-
-   // TODO: we need to pass in the actual string expression somehow. Otherwise can't recover it.
-   _pcu_check_eval2( fileName1 != NULL, exprString, "First filename passed was a NULL pointer",
-      "equal files-preCheck", sourceFile, sourceLine );
-   _pcu_check_eval2( fileName2 != NULL, exprString, "Second filename passed was a NULL pointer",
-      "equal files-preCheck", sourceFile, sourceLine );
-
-   if ( !fileName1 || !fileName2 ) return;
-
-   _pcu_check_eval2( testFile1 = fopen(fileName1, "r"), exprString, "Unable to open first filename",
-      "equal files-preCheck", sourceFile, sourceLine );
-   _pcu_check_eval2( testFile2 = fopen(fileName2, "r"), exprString, "Unable to open second filename",
-      "equal files-preCheck", sourceFile, sourceLine );
-
-   if ( !testFile1 || !testFile2 ) return;
-
-   for ( ii=1; 1 ; ii++ ) {
-      ret1 = fgets( file1Line, MAXLINE, testFile1 );
-      ret2 = fgets( file2Line, MAXLINE, testFile2 );
-      if ( !ret1 && ret2 ) {
-         sprintf( msgString, "Different file lengths: file %s (%s) has %u lines, but file %s (%s) has >=%u lines.", fName1Expr, fileName1, ii-1,
-            fName2Expr, fileName2, ii );
-         _pcu_check_eval2( 0, exprString, msgString, "equal files", sourceFile, sourceLine );
-         break;
-      }
-      else if ( ret1 && !ret2 ) {
-         sprintf( msgString, "Different file lengths: file %s (%s) has >=%u lines, but file %s (%s) has %u lines.", fName1Expr, fileName1, ii,
-            fName2Expr, fileName2, ii-1 );
-         _pcu_check_eval2( 0, exprString, msgString, "equal files", sourceFile, sourceLine );
-         break;
-      }
-      else if ( !ret1 && !ret2 ) {
-         /* End of both files reached simultaneously: good. */
-         break;
-      }
-      else {
-         /* Get rid of 2nd newline that will be unnecessary in printed msg */
-         strcpy( file2LineCopy, file2Line );
-         file2LineLen = strlen( file2Line );
-         if ( file2LineCopy[file2LineLen-1] == '\n' ) {
-            file2LineCopy[file2LineLen-1] = '\0';
-         }
-         sprintf( msgString, "Mismatched line:\nLine %u in %s (%s):\n%sLine %u in %s (%s):\n%s", ii, fName1Expr, fileName1, file1Line,
-            ii, fName2Expr, fileName2, file2LineCopy );
-         _pcu_check_eval2( 0 == strcmp( file1Line, file2Line), exprString, msgString, "equal files", sourceFile, sourceLine );
-      }
-   }
-   fclose(testFile1);
-   fclose(testFile2);
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/checks.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/checks.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,102 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <mpi.h>
+#include "types.h"
+#include "test.h"
+#include "checks.h"
+
+void _pcu_check_fileEq( const char* const fileName1, const char* const fileName2,
+      const char* const fName1Expr, const char* const fName2Expr, pcu_suite_t* pcu_cursuite,
+      const char* sourceFile, const unsigned int sourceLine )
+{
+   const int      MAXLINE = 10000;
+   FILE*          testFile1=NULL;
+   FILE*          testFile2=NULL;
+   char           file1Line[MAXLINE];
+   char           file2Line[MAXLINE];
+   char           file2LineCopy[MAXLINE];
+   int				rank;
+   char*          ret1;
+   char*          ret2;
+   unsigned int   ii=0;
+   char           exprString[5000];
+   char           msgString[5000];
+   unsigned int   file2LineLen = 0;
+
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+
+   if ( rank != 0 ) return;   /* Only do file I/O with proc 0: otherwise errors can result */
+
+   sprintf( exprString, "%s equal file to %s", fName1Expr, fName2Expr );
+
+   // TODO: we need to pass in the actual string expression somehow. Otherwise can't recover it.
+   _pcu_check_eval2( fileName1 != NULL, exprString, "First filename passed was a NULL pointer",
+      "equal files-preCheck", sourceFile, sourceLine );
+   _pcu_check_eval2( fileName2 != NULL, exprString, "Second filename passed was a NULL pointer",
+      "equal files-preCheck", sourceFile, sourceLine );
+
+   if ( !fileName1 || !fileName2 ) return;
+
+   _pcu_check_eval2( testFile1 = fopen(fileName1, "r"), exprString, "Unable to open first filename",
+      "equal files-preCheck", sourceFile, sourceLine );
+   _pcu_check_eval2( testFile2 = fopen(fileName2, "r"), exprString, "Unable to open second filename",
+      "equal files-preCheck", sourceFile, sourceLine );
+
+   if ( !testFile1 || !testFile2 ) return;
+
+   for ( ii=1; 1 ; ii++ ) {
+      ret1 = fgets( file1Line, MAXLINE, testFile1 );
+      ret2 = fgets( file2Line, MAXLINE, testFile2 );
+      if ( !ret1 && ret2 ) {
+         sprintf( msgString, "Different file lengths: file %s (%s) has %u lines, but file %s (%s) has >=%u lines.", fName1Expr, fileName1, ii-1,
+            fName2Expr, fileName2, ii );
+         _pcu_check_eval2( 0, exprString, msgString, "equal files", sourceFile, sourceLine );
+         break;
+      }
+      else if ( ret1 && !ret2 ) {
+         sprintf( msgString, "Different file lengths: file %s (%s) has >=%u lines, but file %s (%s) has %u lines.", fName1Expr, fileName1, ii,
+            fName2Expr, fileName2, ii-1 );
+         _pcu_check_eval2( 0, exprString, msgString, "equal files", sourceFile, sourceLine );
+         break;
+      }
+      else if ( !ret1 && !ret2 ) {
+         /* End of both files reached simultaneously: good. */
+         break;
+      }
+      else {
+         /* Get rid of 2nd newline that will be unnecessary in printed msg */
+         strcpy( file2LineCopy, file2Line );
+         file2LineLen = strlen( file2Line );
+         if ( file2LineCopy[file2LineLen-1] == '\n' ) {
+            file2LineCopy[file2LineLen-1] = '\0';
+         }
+         sprintf( msgString, "Mismatched line:\nLine %u in %s (%s):\n%sLine %u in %s (%s):\n%s", ii, fName1Expr, fileName1, file1Line,
+            ii, fName2Expr, fileName2, file2LineCopy );
+         _pcu_check_eval2( 0 == strcmp( file1Line, file2Line), exprString, msgString, "equal files", sourceFile, sourceLine );
+      }
+   }
+   fclose(testFile1);
+   fclose(testFile2);
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/filename.c
--- a/pcu/src/filename.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-#include "types.h"
-
-
-unsigned _pcu_filename_expectedLen( const char* expectedFileName, const char* moduleDir ) {
-   const char*          fileType = "expected";
-
-   assert( expectedFileName );
-
-   return 1+1+strlen(moduleDir)+1+strlen(fileType)+1+strlen(expectedFileName) + 1;
-}
-
-
-/* Callers of this function should already have allocated the fullPathFileName buffer to the correct size using
- * pcu_filename_expectedLen */
-void _pcu_filename_expected( const char* const expectedFileName, char* const fullPathFileName,
-      const char* moduleDir )
-{
-   const char*          fileType = "expected";
-
-   assert( expectedFileName );
-   assert( fullPathFileName );
-   sprintf( fullPathFileName, "./%s/%s/%s", moduleDir, fileType, expectedFileName );
-}
-
-
-unsigned _pcu_filename_inputLen( const char* inputFileName, const char* moduleDir ) {
-   const char*          fileType = "input";
-
-   assert( inputFileName );
-
-   return 1+1+strlen(moduleDir)+1+strlen(fileType)+1+strlen(inputFileName) + 1;
-}
-
-
-void _pcu_filename_input( const char* const inputFileName, char* const fullPathFileName,
-      const char* moduleDir )
-{
-   const char*          fileType = "input";
-
-   sprintf( fullPathFileName, "./%s/%s/%s", moduleDir, fileType, inputFileName );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/filename.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/filename.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,67 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+#include "types.h"
+
+
+unsigned _pcu_filename_expectedLen( const char* expectedFileName, const char* moduleDir ) {
+   const char*          fileType = "expected";
+
+   assert( expectedFileName );
+
+   return 1+1+strlen(moduleDir)+1+strlen(fileType)+1+strlen(expectedFileName) + 1;
+}
+
+
+/* Callers of this function should already have allocated the fullPathFileName buffer to the correct size using
+ * pcu_filename_expectedLen */
+void _pcu_filename_expected( const char* const expectedFileName, char* const fullPathFileName,
+      const char* moduleDir )
+{
+   const char*          fileType = "expected";
+
+   assert( expectedFileName );
+   assert( fullPathFileName );
+   sprintf( fullPathFileName, "./%s/%s/%s", moduleDir, fileType, expectedFileName );
+}
+
+
+unsigned _pcu_filename_inputLen( const char* inputFileName, const char* moduleDir ) {
+   const char*          fileType = "input";
+
+   assert( inputFileName );
+
+   return 1+1+strlen(moduleDir)+1+strlen(fileType)+1+strlen(inputFileName) + 1;
+}
+
+
+void _pcu_filename_input( const char* const inputFileName, char* const fullPathFileName,
+      const char* moduleDir )
+{
+   const char*          fileType = "input";
+
+   sprintf( fullPathFileName, "./%s/%s/%s", moduleDir, fileType, inputFileName );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/pcuassert.c
--- a/pcu/src/pcuassert.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#include <stdlib.h>
-#include "pcuassert.h"
-
-int pcu_jump_ready = 0;
-jmp_buf pcu_jump_env;
-char* pcu_assert_cur = NULL;
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/pcuassert.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/pcuassert.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,8 @@
+#include <stdlib.h>
+#include "pcuassert.h"
+
+int pcu_jump_ready = 0;
+jmp_buf pcu_jump_env;
+char* pcu_assert_cur = NULL;
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/runner.c
--- a/pcu/src/runner.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include "types.h"
-#include "runner.h"
-#include "suite.h"
-#include "test.h"
-#include "source.h"
-
-int pcu_nsuites;
-pcu_suite_t* pcu_suites;
-pcu_suite_t* pcu_cursuite;
-
-int pcu_nnames;
-char** pcu_names;
-
-int PCU_PRINT_DOCS=0;
-
-void pcu_runner_searchHierarchy( pcu_suite_t* suite );
-
-void pcu_runner_init( int argc, char* argv[] ) {
-   /* Clear global values. */
-   pcu_nsuites = 0;
-   pcu_suites = NULL;
-   pcu_cursuite = NULL;
-
-   /* Extract suite names from the command line. */
-   if ( argc > 1 && 0 == strcmp( argv[1], "--withDocs" ) ) {
-      pcu_nnames = argc - 2;
-      pcu_names = argv + 2;
-      PCU_PRINT_DOCS = 1;
-   }
-   else {
-      pcu_nnames = argc - 1;
-      pcu_names = argv + 1;
-   }
-
-}
-
-void pcu_runner_finalise() {
-   pcu_suite_t* tmp;
-
-   while( pcu_suites ) {
-      pcu_suite_clear( pcu_suites );
-      tmp = pcu_suites->next;
-      free( pcu_suites );
-      pcu_suites = tmp;
-   }
-}
-
-PCU_Runner_Status pcu_runner_run( pcu_listener_t* lsnr ) {
-   pcu_suite_t* cur;
-   unsigned int totalPasses=0; 
-   unsigned int totalTests=0; 
-   PCU_Runner_Status returnStatus;
-
-   cur = pcu_suites;
-   while( cur ) {
-      pcu_suite_run( cur, lsnr );
-      totalPasses += cur->npassed;
-      totalTests += cur->ntests;
-      cur = cur->next;
-   }
-
-   if ( pcu_nsuites >= 1 ) {
-      printf( "-----------------------------------------------------------\n" );
-      printf( "[PCU] Total Passes: (%d/%d)\n", totalPasses, totalTests );
-      printf( "-----------------------------------------------------------\n" );
-   }
-
-   if ( totalPasses == totalTests ) {
-      returnStatus = PCU_RUNNER_ALLPASS;
-   }
-   else {
-      returnStatus = PCU_RUNNER_FAILS;
-   }
-   
-   return returnStatus;
-}
-
-void _pcu_runner_addSuite( const char* name, void (initfunc)( pcu_suite_t* ), const char* moduleDir ) {
-   pcu_suite_t* suite;
-
-   assert( initfunc );
-   assert( name );
-   assert( moduleDir );
-
-   /* Setup the new suite. */
-   suite = (pcu_suite_t*)malloc( sizeof(pcu_suite_t) );
-   suite->name = strdup( name );
-   suite->moduleDir = strdup( moduleDir );
-   suite->ntests = 0;
-   suite->tests = NULL;
-   suite->npassed = 0;
-   suite->curtest = NULL;
-   suite->lsnr = NULL;
-   suite->next = NULL;
-   suite->nsubsuites = 0;
-   suite->subsuites = NULL;
-   suite->setup = NULL;
-   suite->teardown = NULL;
-   suite->data = NULL;
-   initfunc( suite );
-
-   /* Don't add the suite if it's not in our list of names. */
-   pcu_runner_searchHierarchy( suite );
-}
-
-void pcu_runner_searchHierarchy( pcu_suite_t* suite ) {
-   if( pcu_nnames ) {
-      int ii;
-
-      for( ii = 0; ii < pcu_nnames; ii++ ) {
-	 if( !strcmp( pcu_names[ii], suite->name ) )
-	    break;
-      }
-      if( ii == pcu_nnames ) {
-         pcu_suite_t* cur;
-
-         cur = suite->subsuites;
-         while( cur ) {
-            pcu_runner_searchHierarchy( cur );
-            cur = cur->next;
-         }
-         pcu_suite_clear( suite );
-         free( suite );
-         return;
-      }
-   }
-
-   /* Add to the list of current suites. */
-   if( pcu_suites ) {
-      pcu_suite_t* cur;
-
-      cur = pcu_suites;
-      while( cur->next )
-	 cur = cur->next;
-      cur->next = suite;
-   }
-   else
-      pcu_suites = suite;
-   pcu_nsuites++;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/runner.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/runner.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,165 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include "types.h"
+#include "runner.h"
+#include "suite.h"
+#include "test.h"
+#include "source.h"
+
+int pcu_nsuites;
+pcu_suite_t* pcu_suites;
+pcu_suite_t* pcu_cursuite;
+
+int pcu_nnames;
+char** pcu_names;
+
+int PCU_PRINT_DOCS=0;
+
+void pcu_runner_searchHierarchy( pcu_suite_t* suite );
+
+void pcu_runner_init( int argc, char* argv[] ) {
+   /* Clear global values. */
+   pcu_nsuites = 0;
+   pcu_suites = NULL;
+   pcu_cursuite = NULL;
+
+   /* Extract suite names from the command line. */
+   if ( argc > 1 && 0 == strcmp( argv[1], "--withDocs" ) ) {
+      pcu_nnames = argc - 2;
+      pcu_names = argv + 2;
+      PCU_PRINT_DOCS = 1;
+   }
+   else {
+      pcu_nnames = argc - 1;
+      pcu_names = argv + 1;
+   }
+
+}
+
+void pcu_runner_finalise() {
+   pcu_suite_t* tmp;
+
+   while( pcu_suites ) {
+      pcu_suite_clear( pcu_suites );
+      tmp = pcu_suites->next;
+      free( pcu_suites );
+      pcu_suites = tmp;
+   }
+}
+
+PCU_Runner_Status pcu_runner_run( pcu_listener_t* lsnr ) {
+   pcu_suite_t* cur;
+   unsigned int totalPasses=0; 
+   unsigned int totalTests=0; 
+   PCU_Runner_Status returnStatus;
+
+   cur = pcu_suites;
+   while( cur ) {
+      pcu_suite_run( cur, lsnr );
+      totalPasses += cur->npassed;
+      totalTests += cur->ntests;
+      cur = cur->next;
+   }
+
+   if ( pcu_nsuites >= 1 ) {
+      printf( "-----------------------------------------------------------\n" );
+      printf( "[PCU] Total Passes: (%d/%d)\n", totalPasses, totalTests );
+      printf( "-----------------------------------------------------------\n" );
+   }
+
+   if ( totalPasses == totalTests ) {
+      returnStatus = PCU_RUNNER_ALLPASS;
+   }
+   else {
+      returnStatus = PCU_RUNNER_FAILS;
+   }
+   
+   return returnStatus;
+}
+
+void _pcu_runner_addSuite( const char* name, void (initfunc)( pcu_suite_t* ), const char* moduleDir ) {
+   pcu_suite_t* suite;
+
+   assert( initfunc );
+   assert( name );
+   assert( moduleDir );
+
+   /* Setup the new suite. */
+   suite = (pcu_suite_t*)malloc( sizeof(pcu_suite_t) );
+   suite->name = strdup( name );
+   suite->moduleDir = strdup( moduleDir );
+   suite->ntests = 0;
+   suite->tests = NULL;
+   suite->npassed = 0;
+   suite->curtest = NULL;
+   suite->lsnr = NULL;
+   suite->next = NULL;
+   suite->nsubsuites = 0;
+   suite->subsuites = NULL;
+   suite->setup = NULL;
+   suite->teardown = NULL;
+   suite->data = NULL;
+   initfunc( suite );
+
+   /* Don't add the suite if it's not in our list of names. */
+   pcu_runner_searchHierarchy( suite );
+}
+
+void pcu_runner_searchHierarchy( pcu_suite_t* suite ) {
+   if( pcu_nnames ) {
+      int ii;
+
+      for( ii = 0; ii < pcu_nnames; ii++ ) {
+	 if( !strcmp( pcu_names[ii], suite->name ) )
+	    break;
+      }
+      if( ii == pcu_nnames ) {
+         pcu_suite_t* cur;
+
+         cur = suite->subsuites;
+         while( cur ) {
+            pcu_runner_searchHierarchy( cur );
+            cur = cur->next;
+         }
+         pcu_suite_clear( suite );
+         free( suite );
+         return;
+      }
+   }
+
+   /* Add to the list of current suites. */
+   if( pcu_suites ) {
+      pcu_suite_t* cur;
+
+      cur = pcu_suites;
+      while( cur->next )
+	 cur = cur->next;
+      cur->next = suite;
+   }
+   else
+      pcu_suites = suite;
+   pcu_nsuites++;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/source.c
--- a/pcu/src/source.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-#include "types.h"
-#include "utils.h"
-#include "source.h"
-#include "test.h"
-#include "suite.h"
-
-void pcu_source_init( pcu_source_t* src ) {
-   assert( src );
-   memset( src, 0, sizeof(pcu_source_t) );
-}
-
-pcu_source_t* pcu_source_create( int result, const char* type,
-				 const char* file, int line,
-				 const char* expr, const char* msg,
-				 pcu_test_t* test )
-{
-   pcu_source_t* src;
-
-   src = (pcu_source_t*)malloc( sizeof(pcu_source_t) );
-   src->result = result;
-   src->type = pcu_strdup( type );
-   src->file = pcu_strdup( file );
-   src->line = line;
-   src->expr = pcu_strdup( expr );
-   src->msg = pcu_strdup( msg );
-   src->test = test;
-   src->next = NULL;
-   MPI_Comm_rank( MPI_COMM_WORLD, &src->rank );
-
-   return src;
-}
-
-int pcu_source_getPackLen( pcu_source_t* src ) {
-   int len = 0;
-
-   len += sizeof(int);
-
-   len += sizeof(int);
-   len += strlen( src->type ) + 1;
-
-   len += sizeof(int);
-   len += strlen( src->file ) + 1;
-
-   len += sizeof(int);
-
-   len += sizeof(int);
-   len += strlen( src->expr ) + 1;
-
-   len += sizeof(int);
-   if( src->msg )
-      len += strlen( src->msg ) + 1;
-
-   len += sizeof(int);
-
-   return len;
-}
-
-void pcu_source_pack( pcu_source_t* src, void* buf ) {
-   char* tmp = (char*)buf;
-   int len;
-
-   assert( tmp );
-
-   *((int*)tmp) = src->result;
-   tmp += sizeof(int);
-
-   len = strlen( src->type ) + 1;
-   *((int*)tmp) = len;
-   tmp += sizeof(int);
-   memcpy( tmp, src->type, len * sizeof(char) );
-   tmp += len;
-
-   len = strlen( src->file ) + 1;
-   *((int*)tmp) = len;
-   tmp += sizeof(int);
-   memcpy( tmp, src->file, len * sizeof(char) );
-   tmp += len;
-
-   *((int*)tmp) = src->line;
-   tmp += sizeof(int);
-
-   len = strlen( src->expr ) + 1;
-   *((int*)tmp) = len;
-   tmp += sizeof(int);
-   memcpy( tmp, src->expr, len * sizeof(char) );
-   tmp += len;
-
-   if( src->msg ) {
-      len = strlen( src->msg ) + 1;
-      *((int*)tmp) = len;
-      tmp += sizeof(int);
-      memcpy( tmp, src->msg, len * sizeof(char) );
-      tmp += len;
-   }
-   else {
-      *((int*)tmp) = 0;
-      tmp += sizeof(int);
-   }
-
-   *((int*)tmp) = src->rank;
-   tmp += sizeof(int);
-}
-
-void pcu_source_unpack( pcu_source_t* src, void* buf ) {
-   char* tmp = (char*)buf;
-   int len;
-
-   pcu_source_clear( src );
-
-   src->result = *(int*)tmp;
-   tmp += sizeof(int);
-
-   len = *(int*)tmp;
-   tmp += sizeof(int);
-   src->type = (char*)pcu_memdup( tmp, len );
-   tmp += len;
-
-   len = *(int*)tmp;
-   tmp += sizeof(int);
-   src->file = (char*)pcu_memdup( tmp, len );
-
-   tmp += len;
-   src->line = *(int*)tmp;
-   tmp += sizeof(int);
-
-   len = *(int*)tmp;
-   tmp += sizeof(int);
-   src->expr = (char*)pcu_memdup( tmp, len );
-   tmp += len;
-
-   len = *(int*)tmp;
-   tmp += sizeof(int);
-   if( len ) {
-      src->msg = (char*)pcu_memdup( tmp, len );
-      tmp += len;
-   }
-
-   src->rank = *(int*)tmp;
-   tmp += sizeof(int);
-
-   src->next = NULL;
-}
-
-void pcu_source_clear( pcu_source_t* src ) {
-   assert( src );
-   if( src->type ) {
-      free( src->type );
-      src->type = NULL;
-   }
-   if( src->file ) {
-      free( src->file );
-      src->file = NULL;
-   }
-   if( src->expr ) {
-      free( src->expr );
-      src->expr = NULL;
-   }
-   if( src->msg ) {
-      free( src->msg );
-      src->msg = NULL;
-   }
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/source.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/source.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,187 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+#include "types.h"
+#include "utils.h"
+#include "source.h"
+#include "test.h"
+#include "suite.h"
+
+void pcu_source_init( pcu_source_t* src ) {
+   assert( src );
+   memset( src, 0, sizeof(pcu_source_t) );
+}
+
+pcu_source_t* pcu_source_create( int result, const char* type,
+				 const char* file, int line,
+				 const char* expr, const char* msg,
+				 pcu_test_t* test )
+{
+   pcu_source_t* src;
+
+   src = (pcu_source_t*)malloc( sizeof(pcu_source_t) );
+   src->result = result;
+   src->type = pcu_strdup( type );
+   src->file = pcu_strdup( file );
+   src->line = line;
+   src->expr = pcu_strdup( expr );
+   src->msg = pcu_strdup( msg );
+   src->test = test;
+   src->next = NULL;
+   MPI_Comm_rank( MPI_COMM_WORLD, &src->rank );
+
+   return src;
+}
+
+int pcu_source_getPackLen( pcu_source_t* src ) {
+   int len = 0;
+
+   len += sizeof(int);
+
+   len += sizeof(int);
+   len += strlen( src->type ) + 1;
+
+   len += sizeof(int);
+   len += strlen( src->file ) + 1;
+
+   len += sizeof(int);
+
+   len += sizeof(int);
+   len += strlen( src->expr ) + 1;
+
+   len += sizeof(int);
+   if( src->msg )
+      len += strlen( src->msg ) + 1;
+
+   len += sizeof(int);
+
+   return len;
+}
+
+void pcu_source_pack( pcu_source_t* src, void* buf ) {
+   char* tmp = (char*)buf;
+   int len;
+
+   assert( tmp );
+
+   *((int*)tmp) = src->result;
+   tmp += sizeof(int);
+
+   len = strlen( src->type ) + 1;
+   *((int*)tmp) = len;
+   tmp += sizeof(int);
+   memcpy( tmp, src->type, len * sizeof(char) );
+   tmp += len;
+
+   len = strlen( src->file ) + 1;
+   *((int*)tmp) = len;
+   tmp += sizeof(int);
+   memcpy( tmp, src->file, len * sizeof(char) );
+   tmp += len;
+
+   *((int*)tmp) = src->line;
+   tmp += sizeof(int);
+
+   len = strlen( src->expr ) + 1;
+   *((int*)tmp) = len;
+   tmp += sizeof(int);
+   memcpy( tmp, src->expr, len * sizeof(char) );
+   tmp += len;
+
+   if( src->msg ) {
+      len = strlen( src->msg ) + 1;
+      *((int*)tmp) = len;
+      tmp += sizeof(int);
+      memcpy( tmp, src->msg, len * sizeof(char) );
+      tmp += len;
+   }
+   else {
+      *((int*)tmp) = 0;
+      tmp += sizeof(int);
+   }
+
+   *((int*)tmp) = src->rank;
+   tmp += sizeof(int);
+}
+
+void pcu_source_unpack( pcu_source_t* src, void* buf ) {
+   char* tmp = (char*)buf;
+   int len;
+
+   pcu_source_clear( src );
+
+   src->result = *(int*)tmp;
+   tmp += sizeof(int);
+
+   len = *(int*)tmp;
+   tmp += sizeof(int);
+   src->type = (char*)pcu_memdup( tmp, len );
+   tmp += len;
+
+   len = *(int*)tmp;
+   tmp += sizeof(int);
+   src->file = (char*)pcu_memdup( tmp, len );
+
+   tmp += len;
+   src->line = *(int*)tmp;
+   tmp += sizeof(int);
+
+   len = *(int*)tmp;
+   tmp += sizeof(int);
+   src->expr = (char*)pcu_memdup( tmp, len );
+   tmp += len;
+
+   len = *(int*)tmp;
+   tmp += sizeof(int);
+   if( len ) {
+      src->msg = (char*)pcu_memdup( tmp, len );
+      tmp += len;
+   }
+
+   src->rank = *(int*)tmp;
+   tmp += sizeof(int);
+
+   src->next = NULL;
+}
+
+void pcu_source_clear( pcu_source_t* src ) {
+   assert( src );
+   if( src->type ) {
+      free( src->type );
+      src->type = NULL;
+   }
+   if( src->file ) {
+      free( src->file );
+      src->file = NULL;
+   }
+   if( src->expr ) {
+      free( src->expr );
+      src->expr = NULL;
+   }
+   if( src->msg ) {
+      free( src->msg );
+      src->msg = NULL;
+   }
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/suite.c
--- a/pcu/src/suite.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include "types.h"
-#include "listener.h"
-#include "test.h"
-#include "source.h"
-#include "suite.h"
-
-extern pcu_suite_t* pcu_cursuite;
-
-void pcu_suite_run( pcu_suite_t* suite, pcu_listener_t* lsnr ) {
-   /* Must have a listener. */
-   assert( lsnr );
-
-   /* Temporarily set the listener, we need this so assert
-      macros can work properly. */
-   assert( suite );
-   suite->lsnr = lsnr;
-   suite->npassed = 0;
-
-   /* Run all sub-suites first. */
-   if( suite->subsuites ) {
-      pcu_suite_t* sub;
-
-      sub = suite->subsuites;
-      while( sub ) {
-         pcu_suite_run( sub, lsnr );
-         sub = sub->next;
-      }
-   }
-
-   /* Set this as the active suite. */
-   pcu_cursuite = suite;
-
-   /* Begin this suite. */
-   lsnr->suitebegin( lsnr, suite );
-
-   /* Temporarily set the current test, once again needed
-      for assert macros. */
-   suite->curtest = suite->tests;
-
-   /* Loop over all the tests. */
-   while( suite->curtest ) {
-      /* Run the test. */
-      if( suite->setup )
-         suite->setup( suite->data );
-      pcu_test_run( suite->curtest, lsnr );
-      if( suite->teardown )
-         suite->teardown( suite->data );
-
-      /* Move to the next test. */
-      suite->curtest = suite->curtest->next;
-   }
-
-   /* End the suite. */
-   lsnr->suiteend( lsnr, suite );
-
-   /* Clear temporary settings. */
-   suite->curtest = NULL;
-   suite->lsnr = NULL;
-   pcu_cursuite = NULL;
-}
-
-void _pcu_suite_setFixtures( pcu_suite_t* suite, 
-			     pcu_fixture_t* setup, pcu_fixture_t* teardown )
-{
-   assert( suite );
-   suite->setup = setup;
-   suite->teardown = teardown;
-}
-
-void _pcu_suite_setData( pcu_suite_t* suite, int size ) {
-   if( suite->data )
-      free( suite->data );
-   if( size )
-      suite->data = malloc( size );
-   else
-      suite->data = NULL;
-}
-
-void _pcu_suite_addTest( pcu_suite_t* suite, pcu_testfunc_t* func, const char* name ) {
-   pcu_test_t* test;
-
-   /* Extract test name. */
-   /* TODO */
-
-   /* Create the new test. */
-   test = (pcu_test_t*)malloc( sizeof(pcu_test_t) );
-   test->name = strdup( name );
-   test->suite = suite;
-   test->func = func;
-   test->next = NULL;
-   test->nsrcs = 0;
-   test->srcs = NULL;
-   test->lastSrc = NULL;
-   test->docString = NULL; /* Don't document when test created - user needs to call explicit function to
-                              Add a document string */
-
-   /* Add the new test. */
-   if( suite->tests ) {
-      pcu_test_t* cur = suite->tests;
-
-      while( cur->next )
-	 cur = cur->next;
-      cur->next = test;
-   }
-   else
-      suite->tests = test;
-   suite->ntests++;
-}
-
-void _pcu_suite_addSubSuite( pcu_suite_t* suite, const char* name,
-                             void (initfunc)( pcu_suite_t* ),
-                             const char* moduleDir )
-{
-   pcu_suite_t* subsuite;
-
-   assert( initfunc );
-
-   /* Setup the new suite. */
-   subsuite = (pcu_suite_t*)malloc( sizeof(pcu_suite_t) );
-   subsuite->name = strdup( name );
-   subsuite->moduleDir = strdup( moduleDir );
-   subsuite->ntests = 0;
-   subsuite->tests = NULL;
-   subsuite->npassed = 0;
-   subsuite->curtest = NULL;
-   subsuite->lsnr = NULL;
-   subsuite->next = NULL;
-   subsuite->nsubsuites = 0;
-   subsuite->subsuites = NULL;
-   subsuite->setup = NULL;
-   subsuite->teardown = NULL;
-   subsuite->data = NULL;
-   initfunc( subsuite );
-
-   /* Add to our list. */
-   if( suite->subsuites ) {
-      pcu_suite_t* cur;
-
-      cur = suite->subsuites;
-      while( cur->next )
-	 cur = cur->next;
-      cur->next = subsuite;
-   }
-   else
-     suite->subsuites = subsuite;
-
-   suite->nsubsuites++;
-}
-
-void pcu_suite_clear( pcu_suite_t* suite ) {
-   pcu_test_t* tst;
-   pcu_source_t* src;
-   pcu_suite_t* sub;
-
-   free( suite->name );
-   free( suite->moduleDir );
-
-   while( suite->tests ) {
-      while( suite->tests->srcs ) {
-         src = suite->tests->srcs->next;
-         pcu_source_clear( suite->tests->srcs );
-         free( suite->tests->srcs );
-         suite->tests->srcs = src;
-      }
-      free( suite->tests->name );
-      if ( suite->tests->docString ) {
-         free( suite->tests->docString );
-      }
-
-      tst = suite->tests->next;
-      free( suite->tests );
-      suite->tests = tst;
-   }
-   suite->ntests = 0;
-   suite->curtest = NULL;
-
-   while( suite->subsuites ) {
-      pcu_suite_clear( suite->subsuites );
-      sub = suite->subsuites->next;
-      free( suite->subsuites );
-      suite->subsuites = sub;
-   }
-
-   if( suite->data ) {
-      free( suite->data );
-      suite->data = NULL;
-   }
-}
-
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/suite.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/suite.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,214 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include "types.h"
+#include "listener.h"
+#include "test.h"
+#include "source.h"
+#include "suite.h"
+
+extern pcu_suite_t* pcu_cursuite;
+
+void pcu_suite_run( pcu_suite_t* suite, pcu_listener_t* lsnr ) {
+   /* Must have a listener. */
+   assert( lsnr );
+
+   /* Temporarily set the listener, we need this so assert
+      macros can work properly. */
+   assert( suite );
+   suite->lsnr = lsnr;
+   suite->npassed = 0;
+
+   /* Run all sub-suites first. */
+   if( suite->subsuites ) {
+      pcu_suite_t* sub;
+
+      sub = suite->subsuites;
+      while( sub ) {
+         pcu_suite_run( sub, lsnr );
+         sub = sub->next;
+      }
+   }
+
+   /* Set this as the active suite. */
+   pcu_cursuite = suite;
+
+   /* Begin this suite. */
+   lsnr->suitebegin( lsnr, suite );
+
+   /* Temporarily set the current test, once again needed
+      for assert macros. */
+   suite->curtest = suite->tests;
+
+   /* Loop over all the tests. */
+   while( suite->curtest ) {
+      /* Run the test. */
+      if( suite->setup )
+         suite->setup( suite->data );
+      pcu_test_run( suite->curtest, lsnr );
+      if( suite->teardown )
+         suite->teardown( suite->data );
+
+      /* Move to the next test. */
+      suite->curtest = suite->curtest->next;
+   }
+
+   /* End the suite. */
+   lsnr->suiteend( lsnr, suite );
+
+   /* Clear temporary settings. */
+   suite->curtest = NULL;
+   suite->lsnr = NULL;
+   pcu_cursuite = NULL;
+}
+
+void _pcu_suite_setFixtures( pcu_suite_t* suite, 
+			     pcu_fixture_t* setup, pcu_fixture_t* teardown )
+{
+   assert( suite );
+   suite->setup = setup;
+   suite->teardown = teardown;
+}
+
+void _pcu_suite_setData( pcu_suite_t* suite, int size ) {
+   if( suite->data )
+      free( suite->data );
+   if( size )
+      suite->data = malloc( size );
+   else
+      suite->data = NULL;
+}
+
+void _pcu_suite_addTest( pcu_suite_t* suite, pcu_testfunc_t* func, const char* name ) {
+   pcu_test_t* test;
+
+   /* Extract test name. */
+   /* TODO */
+
+   /* Create the new test. */
+   test = (pcu_test_t*)malloc( sizeof(pcu_test_t) );
+   test->name = strdup( name );
+   test->suite = suite;
+   test->func = func;
+   test->next = NULL;
+   test->nsrcs = 0;
+   test->srcs = NULL;
+   test->lastSrc = NULL;
+   test->docString = NULL; /* Don't document when test created - user needs to call explicit function to
+                              Add a document string */
+
+   /* Add the new test. */
+   if( suite->tests ) {
+      pcu_test_t* cur = suite->tests;
+
+      while( cur->next )
+	 cur = cur->next;
+      cur->next = test;
+   }
+   else
+      suite->tests = test;
+   suite->ntests++;
+}
+
+void _pcu_suite_addSubSuite( pcu_suite_t* suite, const char* name,
+                             void (initfunc)( pcu_suite_t* ),
+                             const char* moduleDir )
+{
+   pcu_suite_t* subsuite;
+
+   assert( initfunc );
+
+   /* Setup the new suite. */
+   subsuite = (pcu_suite_t*)malloc( sizeof(pcu_suite_t) );
+   subsuite->name = strdup( name );
+   subsuite->moduleDir = strdup( moduleDir );
+   subsuite->ntests = 0;
+   subsuite->tests = NULL;
+   subsuite->npassed = 0;
+   subsuite->curtest = NULL;
+   subsuite->lsnr = NULL;
+   subsuite->next = NULL;
+   subsuite->nsubsuites = 0;
+   subsuite->subsuites = NULL;
+   subsuite->setup = NULL;
+   subsuite->teardown = NULL;
+   subsuite->data = NULL;
+   initfunc( subsuite );
+
+   /* Add to our list. */
+   if( suite->subsuites ) {
+      pcu_suite_t* cur;
+
+      cur = suite->subsuites;
+      while( cur->next )
+	 cur = cur->next;
+      cur->next = subsuite;
+   }
+   else
+     suite->subsuites = subsuite;
+
+   suite->nsubsuites++;
+}
+
+void pcu_suite_clear( pcu_suite_t* suite ) {
+   pcu_test_t* tst;
+   pcu_source_t* src;
+   pcu_suite_t* sub;
+
+   free( suite->name );
+   free( suite->moduleDir );
+
+   while( suite->tests ) {
+      while( suite->tests->srcs ) {
+         src = suite->tests->srcs->next;
+         pcu_source_clear( suite->tests->srcs );
+         free( suite->tests->srcs );
+         suite->tests->srcs = src;
+      }
+      free( suite->tests->name );
+      if ( suite->tests->docString ) {
+         free( suite->tests->docString );
+      }
+
+      tst = suite->tests->next;
+      free( suite->tests );
+      suite->tests = tst;
+   }
+   suite->ntests = 0;
+   suite->curtest = NULL;
+
+   while( suite->subsuites ) {
+      pcu_suite_clear( suite->subsuites );
+      sub = suite->subsuites->next;
+      free( suite->subsuites );
+      suite->subsuites = sub;
+   }
+
+   if( suite->data ) {
+      free( suite->data );
+      suite->data = NULL;
+   }
+}
+
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/test.c
--- a/pcu/src/test.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <mpi.h>
-#include "types.h"
-#include "test.h"
-#include "source.h"
-#include "suite.h"
-#include "listener.h"
-
-/* Need to access this for docstring functions */
-extern pcu_suite_t* pcu_cursuite;
-
-void pcu_test_gathersources( pcu_test_t* test );
-
-
-void pcu_docstring( const char* docString ) {
-   assert( pcu_cursuite );
-   pcu_test_doc( pcu_cursuite->curtest, docString );
-}
-
-void pcu_test_doc( pcu_test_t* test, const char* docString ) {
-   assert( test );
-   assert( docString );
-   
-   test->docString = strdup( docString );
-}
-
-void pcu_test_run( pcu_test_t* test, pcu_listener_t* lsnr ) {
-   int rank;
-   int passed;
-   pcu_source_t* src;
-
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-
-   /* Must have a listener. */
-   assert( lsnr );
-
-   /* Begin this test. */
-   lsnr->testbegin( lsnr, test );
-
-   /* Run the test. */
-   assert( test->func );
-   assert( test->suite );
-   test->func( test->suite->data );
-
-   /* Need to collect information from all ranks to
-      determine if the test passed. */
-   passed = 1;
-   src = test->srcs;
-   while( src ) {
-      if( !src->result ) {
-	 passed = 0;
-	 break;
-      }
-      src = src->next;
-   }
-   MPI_Reduce( &passed, &test->globalresult, 1, MPI_INT, MPI_LAND, 
-	       0, MPI_COMM_WORLD ); /* did anyone fail? */
-
-   /* Update the suite's passed count. */
-   if( rank == 0 && test->globalresult )
-      test->suite->npassed++;
-
-   /* Gather up all the sources onto the master rank. */
-   pcu_test_gathersources( test );
-
-   /* End the test. */
-   lsnr->testend( lsnr, test );
-}
-
-pcu_source_t* pcu_test_addSource( pcu_test_t* test, pcu_source_t* src ) {
-   assert( test );
-   assert( src );
-   if( test->srcs ) {
-      test->lastSrc->next = src;
-      test->lastSrc = src;
-   }
-   else {
-      test->srcs = src;
-      test->lastSrc = src;
-   }
-   test->nsrcs++;
-
-   return src;
-}
-
-void pcu_test_gathersources( pcu_test_t* test ) {
-   int rank, nranks;
-   int buflen;
-   pcu_source_t* cur;
-   void* buf;
-   void* ptr;
-   int totalsize;
-   void* totalbuf;
-   int* alllens;
-   int* disps;
-   int ii;
-
-   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-   MPI_Comm_size( MPI_COMM_WORLD, &nranks );
-
-   /* Pack all our sources. */
-   buflen = 0;
-   cur = test->srcs;
-   while( cur ) {
-      buflen += pcu_source_getPackLen( cur );
-      cur = cur->next;
-   }
-   if( buflen )
-      buf = malloc( buflen );
-   else
-      buf = NULL;
-   ptr = buf;
-   while( test->srcs ) {
-      pcu_source_pack( test->srcs, ptr );
-      ptr += pcu_source_getPackLen( test->srcs );
-      cur = test->srcs->next;
-      pcu_source_clear( test->srcs );
-      free( test->srcs );
-      test->srcs = cur;
-   }
-   test->nsrcs = 0;
-   test->srcs = NULL;
-
-   /* Gather them all up. */
-   totalsize = 0;
-   MPI_Allreduce( &buflen, &totalsize, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
-   if( totalsize ) {
-      if( rank == 0 ) {
-         totalbuf = malloc( totalsize );
-         alllens = (int*)malloc( nranks * sizeof(int) );
-         disps = (int*)malloc( nranks * sizeof(int) );
-      }
-      MPI_Gather( &buflen, 1, MPI_INT, alllens, 1, MPI_INT, 0, MPI_COMM_WORLD );
-      if( rank == 0 ) {
-         disps[0] = 0;
-         for( ii = 1; ii < nranks; ii++ )
-            disps[ii] = disps[ii - 1] + alllens[ii - 1];
-      }
-      MPI_Gatherv( buf, buflen, MPI_BYTE, totalbuf, alllens, disps, 
-                   MPI_BYTE, 0, MPI_COMM_WORLD );
-      if( buf )
-         free( buf );
-
-      if( rank == 0 ) {
-         /* Free arrays. */
-         if( alllens )
-            free( alllens );
-         if( disps )
-            free( disps );
-
-         /* Unpack sources into the list. */
-         ptr = totalbuf;
-         while( ptr < totalbuf + totalsize ) {
-            cur = (pcu_source_t*)malloc( sizeof(pcu_source_t) );
-            pcu_source_init( cur );
-            pcu_source_unpack( cur, ptr );
-            cur->test = test;
-            ptr += pcu_source_getPackLen( cur );
-            pcu_test_addSource( test, cur );
-         }
-
-         /* Free global buffer. */
-         if( totalbuf )
-            free( totalbuf );
-      }
-   }
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/test.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/test.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,190 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+#include "types.h"
+#include "test.h"
+#include "source.h"
+#include "suite.h"
+#include "listener.h"
+
+/* Need to access this for docstring functions */
+extern pcu_suite_t* pcu_cursuite;
+
+void pcu_test_gathersources( pcu_test_t* test );
+
+
+void pcu_docstring( const char* docString ) {
+   assert( pcu_cursuite );
+   pcu_test_doc( pcu_cursuite->curtest, docString );
+}
+
+void pcu_test_doc( pcu_test_t* test, const char* docString ) {
+   assert( test );
+   assert( docString );
+   
+   test->docString = strdup( docString );
+}
+
+void pcu_test_run( pcu_test_t* test, pcu_listener_t* lsnr ) {
+   int rank;
+   int passed;
+   pcu_source_t* src;
+
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+
+   /* Must have a listener. */
+   assert( lsnr );
+
+   /* Begin this test. */
+   lsnr->testbegin( lsnr, test );
+
+   /* Run the test. */
+   assert( test->func );
+   assert( test->suite );
+   test->func( test->suite->data );
+
+   /* Need to collect information from all ranks to
+      determine if the test passed. */
+   passed = 1;
+   src = test->srcs;
+   while( src ) {
+      if( !src->result ) {
+	 passed = 0;
+	 break;
+      }
+      src = src->next;
+   }
+   MPI_Reduce( &passed, &test->globalresult, 1, MPI_INT, MPI_LAND, 
+	       0, MPI_COMM_WORLD ); /* did anyone fail? */
+
+   /* Update the suite's passed count. */
+   if( rank == 0 && test->globalresult )
+      test->suite->npassed++;
+
+   /* Gather up all the sources onto the master rank. */
+   pcu_test_gathersources( test );
+
+   /* End the test. */
+   lsnr->testend( lsnr, test );
+}
+
+pcu_source_t* pcu_test_addSource( pcu_test_t* test, pcu_source_t* src ) {
+   assert( test );
+   assert( src );
+   if( test->srcs ) {
+      test->lastSrc->next = src;
+      test->lastSrc = src;
+   }
+   else {
+      test->srcs = src;
+      test->lastSrc = src;
+   }
+   test->nsrcs++;
+
+   return src;
+}
+
+void pcu_test_gathersources( pcu_test_t* test ) {
+   int rank, nranks;
+   int buflen;
+   pcu_source_t* cur;
+   void* buf;
+   void* ptr;
+   int totalsize;
+   void* totalbuf;
+   int* alllens;
+   int* disps;
+   int ii;
+
+   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+   MPI_Comm_size( MPI_COMM_WORLD, &nranks );
+
+   /* Pack all our sources. */
+   buflen = 0;
+   cur = test->srcs;
+   while( cur ) {
+      buflen += pcu_source_getPackLen( cur );
+      cur = cur->next;
+   }
+   if( buflen )
+      buf = malloc( buflen );
+   else
+      buf = NULL;
+   ptr = buf;
+   while( test->srcs ) {
+      pcu_source_pack( test->srcs, ptr );
+      ptr += pcu_source_getPackLen( test->srcs );
+      cur = test->srcs->next;
+      pcu_source_clear( test->srcs );
+      free( test->srcs );
+      test->srcs = cur;
+   }
+   test->nsrcs = 0;
+   test->srcs = NULL;
+
+   /* Gather them all up. */
+   totalsize = 0;
+   MPI_Allreduce( &buflen, &totalsize, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
+   if( totalsize ) {
+      if( rank == 0 ) {
+         totalbuf = malloc( totalsize );
+         alllens = (int*)malloc( nranks * sizeof(int) );
+         disps = (int*)malloc( nranks * sizeof(int) );
+      }
+      MPI_Gather( &buflen, 1, MPI_INT, alllens, 1, MPI_INT, 0, MPI_COMM_WORLD );
+      if( rank == 0 ) {
+         disps[0] = 0;
+         for( ii = 1; ii < nranks; ii++ )
+            disps[ii] = disps[ii - 1] + alllens[ii - 1];
+      }
+      MPI_Gatherv( buf, buflen, MPI_BYTE, totalbuf, alllens, disps, 
+                   MPI_BYTE, 0, MPI_COMM_WORLD );
+      if( buf )
+         free( buf );
+
+      if( rank == 0 ) {
+         /* Free arrays. */
+         if( alllens )
+            free( alllens );
+         if( disps )
+            free( disps );
+
+         /* Unpack sources into the list. */
+         ptr = totalbuf;
+         while( ptr < totalbuf + totalsize ) {
+            cur = (pcu_source_t*)malloc( sizeof(pcu_source_t) );
+            pcu_source_init( cur );
+            pcu_source_unpack( cur, ptr );
+            cur->test = test;
+            ptr += pcu_source_getPackLen( cur );
+            pcu_test_addSource( test, cur );
+         }
+
+         /* Free global buffer. */
+         if( totalbuf )
+            free( totalbuf );
+      }
+   }
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/textoutput.c
--- a/pcu/src/textoutput.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <mpi.h>
-#include "types.h"
-#include "listener.h"
-#include "test.h"
-#include "suite.h"
-#include "textoutput.h"
-#include "test.h"
-#include "source.h"
-
-extern int PCU_PRINT_DOCS;
-
-typedef struct {
-	int rank;
-} textoutputdata_t;
-
-void printsuitestatus( pcu_listener_t* lsnr, pcu_suite_t* suite, int final );
-void printteststatus( pcu_listener_t* lsnr, pcu_suite_t* suite, char* testname, int final );
-void printsources( pcu_listener_t* lsnr, pcu_suite_t* suite );
-
-void pcu_textoutput_suitebegin( pcu_listener_t* lsnr, pcu_suite_t* suite ) {
-	printsuitestatus( lsnr, suite, 0 );
-   /*printstatus( lsnr, suite, 0 );*/
-}
-
-void pcu_textoutput_suiteend( pcu_listener_t* lsnr, pcu_suite_t* suite ) {
-   printsuitestatus( lsnr, suite, 1 );
-   printsources( lsnr, suite );
-}
-
-void pcu_textoutput_testbegin( pcu_listener_t* lsnr, pcu_test_t* test ) {
-}
-
-void pcu_textoutput_testend( pcu_listener_t* lsnr, pcu_test_t* test ) {
-   printteststatus( lsnr, test->suite, test->name, 0 );
-}
-
-void pcu_textoutput_checkdone( pcu_listener_t* lsnr, pcu_source_t* src ) {
-}
-
-pcu_listener_t* pcu_textoutput_create( int printdocs ) {
-   pcu_listener_t* lsnr;
-
-   lsnr = (pcu_listener_t*)malloc( sizeof(pcu_listener_t) );
-   lsnr->suitebegin = pcu_textoutput_suitebegin;
-   lsnr->suiteend = pcu_textoutput_suiteend;
-   lsnr->testbegin = pcu_textoutput_testbegin;
-   lsnr->testend = pcu_textoutput_testend;
-   lsnr->checkdone = pcu_textoutput_checkdone;
-   lsnr->data = malloc( sizeof(textoutputdata_t) );
-   assert( printdocs == 1 || printdocs == 0 );
-   lsnr->printdocs = printdocs;
-   MPI_Comm_rank( MPI_COMM_WORLD, &((textoutputdata_t*)lsnr->data)->rank );
-
-   return lsnr;
-}
-
-void pcu_textoutput_destroy( pcu_listener_t* lsnr ) {
-   if( lsnr->data )
-      free( lsnr->data );
-   free( lsnr );
-}
-
-void printsuitestatus( pcu_listener_t* lsnr, pcu_suite_t* suite, int final ) { 
-   if( ((textoutputdata_t*)lsnr->data)->rank )
-      return;
-
-	if( final ) {
-		printf( "[PCU] Status: %s\n", suite->npassed == suite->ntests ? "PASSED" : "FAILED" ); 
-	}
-	else {
-		printf( "------------------------------------------------------------------------\n" );
-		printf( "[PCU] Testing '%s':\n", suite->name );  
-	}
-}
-
-void printteststatus( pcu_listener_t* lsnr, pcu_suite_t* suite, char* testname, int final ) {
-   if( ((textoutputdata_t*)lsnr->data)->rank )
-      return;
-
-	printf( "[PCU]     Test Case: '%s', Passes: (%d/%d)\n", testname, suite->npassed, suite->ntests );
-}
-
-void printsources( pcu_listener_t* lsnr, pcu_suite_t* suite ) {
-   pcu_test_t* test;
-   pcu_source_t* src;
-   int nfails;
-
-   if( ((textoutputdata_t*)lsnr->data)->rank )
-      return;
-
-   nfails = 0;
-   test = suite->tests;
-   while( test ) {
-      if( lsnr->printdocs ) {
-         if (test->globalresult ) {
-            printf( " * (P) Test %s: ", test->name );
-         }
-         else {
-            printf( " * (F) Test %s: ", test->name );
-         }
-         if ( test->docString ) {
-            printf( "%s\n", test->docString );
-         }
-         else {
-            printf( "(undocumented)\n" );
-         }
-      }
-      src = test->srcs;
-      while( src ) {
-	 if( !src->result ) {
-	    printf( "\n\tCheck '%s' failed:\n", src->type );
-	    printf( "\t\tLocation: \t%s:%d\n", src->file, src->line );
-	    printf( "\t\tTest name: \t%s\n", src->test->name );
-	    printf( "\t\tExpression: \t%s\n", src->expr );
-            if( src->msg )
-               printf( "\t\tMessage: \t%s\n", src->msg );
-	    printf( "\t\tRank: \t\t%d\n", src->rank );
-	    nfails++;
-	 }
-	 src = src->next;
-      }
-      test = test->next;
-   }
-
-   if( nfails )
-     printf( "\n" );
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/textoutput.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/textoutput.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,151 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <mpi.h>
+#include "types.h"
+#include "listener.h"
+#include "test.h"
+#include "suite.h"
+#include "textoutput.h"
+#include "test.h"
+#include "source.h"
+
+extern int PCU_PRINT_DOCS;
+
+typedef struct {
+	int rank;
+} textoutputdata_t;
+
+void printsuitestatus( pcu_listener_t* lsnr, pcu_suite_t* suite, int final );
+void printteststatus( pcu_listener_t* lsnr, pcu_suite_t* suite, char* testname, int final );
+void printsources( pcu_listener_t* lsnr, pcu_suite_t* suite );
+
+void pcu_textoutput_suitebegin( pcu_listener_t* lsnr, pcu_suite_t* suite ) {
+	printsuitestatus( lsnr, suite, 0 );
+   /*printstatus( lsnr, suite, 0 );*/
+}
+
+void pcu_textoutput_suiteend( pcu_listener_t* lsnr, pcu_suite_t* suite ) {
+   printsuitestatus( lsnr, suite, 1 );
+   printsources( lsnr, suite );
+}
+
+void pcu_textoutput_testbegin( pcu_listener_t* lsnr, pcu_test_t* test ) {
+}
+
+void pcu_textoutput_testend( pcu_listener_t* lsnr, pcu_test_t* test ) {
+   printteststatus( lsnr, test->suite, test->name, 0 );
+}
+
+void pcu_textoutput_checkdone( pcu_listener_t* lsnr, pcu_source_t* src ) {
+}
+
+pcu_listener_t* pcu_textoutput_create( int printdocs ) {
+   pcu_listener_t* lsnr;
+
+   lsnr = (pcu_listener_t*)malloc( sizeof(pcu_listener_t) );
+   lsnr->suitebegin = pcu_textoutput_suitebegin;
+   lsnr->suiteend = pcu_textoutput_suiteend;
+   lsnr->testbegin = pcu_textoutput_testbegin;
+   lsnr->testend = pcu_textoutput_testend;
+   lsnr->checkdone = pcu_textoutput_checkdone;
+   lsnr->data = malloc( sizeof(textoutputdata_t) );
+   assert( printdocs == 1 || printdocs == 0 );
+   lsnr->printdocs = printdocs;
+   MPI_Comm_rank( MPI_COMM_WORLD, &((textoutputdata_t*)lsnr->data)->rank );
+
+   return lsnr;
+}
+
+void pcu_textoutput_destroy( pcu_listener_t* lsnr ) {
+   if( lsnr->data )
+      free( lsnr->data );
+   free( lsnr );
+}
+
+void printsuitestatus( pcu_listener_t* lsnr, pcu_suite_t* suite, int final ) { 
+   if( ((textoutputdata_t*)lsnr->data)->rank )
+      return;
+
+	if( final ) {
+		printf( "[PCU] Status: %s\n", suite->npassed == suite->ntests ? "PASSED" : "FAILED" ); 
+	}
+	else {
+		printf( "------------------------------------------------------------------------\n" );
+		printf( "[PCU] Testing '%s':\n", suite->name );  
+	}
+}
+
+void printteststatus( pcu_listener_t* lsnr, pcu_suite_t* suite, char* testname, int final ) {
+   if( ((textoutputdata_t*)lsnr->data)->rank )
+      return;
+
+	printf( "[PCU]     Test Case: '%s', Passes: (%d/%d)\n", testname, suite->npassed, suite->ntests );
+}
+
+void printsources( pcu_listener_t* lsnr, pcu_suite_t* suite ) {
+   pcu_test_t* test;
+   pcu_source_t* src;
+   int nfails;
+
+   if( ((textoutputdata_t*)lsnr->data)->rank )
+      return;
+
+   nfails = 0;
+   test = suite->tests;
+   while( test ) {
+      if( lsnr->printdocs ) {
+         if (test->globalresult ) {
+            printf( " * (P) Test %s: ", test->name );
+         }
+         else {
+            printf( " * (F) Test %s: ", test->name );
+         }
+         if ( test->docString ) {
+            printf( "%s\n", test->docString );
+         }
+         else {
+            printf( "(undocumented)\n" );
+         }
+      }
+      src = test->srcs;
+      while( src ) {
+	 if( !src->result ) {
+	    printf( "\n\tCheck '%s' failed:\n", src->type );
+	    printf( "\t\tLocation: \t%s:%d\n", src->file, src->line );
+	    printf( "\t\tTest name: \t%s\n", src->test->name );
+	    printf( "\t\tExpression: \t%s\n", src->expr );
+            if( src->msg )
+               printf( "\t\tMessage: \t%s\n", src->msg );
+	    printf( "\t\tRank: \t\t%d\n", src->rank );
+	    nfails++;
+	 }
+	 src = src->next;
+      }
+      test = test->next;
+   }
+
+   if( nfails )
+     printf( "\n" );
+}
+
+
diff -r 4a864caece0b -r f9c376288955 pcu/src/utils.c
--- a/pcu/src/utils.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-**  Copyright 2008 Luke Hodkinson
-**
-**  This file is part of pcu.
-**
-**  pcu is free software: you can redistribute it and/or modify
-**  it under the terms of the GNU General Public License as published by
-**  the Free Software Foundation, either version 3 of the License, or
-**  (at your option) any later version.
-**
-**  Foobar is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include "utils.h"
-
-void* pcu_memdup( const void* buf, int len ) {
-   void* tmp;
-
-   tmp = malloc( len );
-   memcpy( tmp, buf, len );
-   return tmp;
-}
-
-char* pcu_strdup( const char* str ) {
-   return str ? (char*)pcu_memdup( str, strlen( str ) + 1 ) : NULL;
-}
-
-
diff -r 4a864caece0b -r f9c376288955 pcu/src/utils.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcu/src/utils.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,36 @@
+/*
+**  Copyright 2008 Luke Hodkinson
+**
+**  This file is part of pcu.
+**
+**  pcu is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  Foobar is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include "utils.h"
+
+void* pcu_memdup( const void* buf, int len ) {
+   void* tmp;
+
+   tmp = malloc( len );
+   memcpy( tmp, buf, len );
+   return tmp;
+}
+
+char* pcu_strdup( const char* str ) {
+   return str ? (char*)pcu_memdup( str, strlen( str ) + 1 ) : NULL;
+}
+
+
diff -r 4a864caece0b -r f9c376288955 script/createDoxygen.py
--- a/script/createDoxygen.py	Wed May 11 13:26:45 2011 -0700
+++ b/script/createDoxygen.py	Thu May 12 11:18:29 2011 -0700
@@ -7,7 +7,7 @@
 ## Extracted from C and python documentation, this has details on all classes defined in
 ## the code, including 'pseudo-classes' based on macros.
 ## \section Files
-## Contains the extracted *.c, *.h and *.py files.
+## Contains the extracted *.cxx, *.h and *.py files.
 ## \section Directories
 ## Contains a listing of all directories in the code base.
 ## \section Namespaces
diff -r 4a864caece0b -r f9c376288955 script/scons.py
--- a/script/scons.py	Wed May 11 13:26:45 2011 -0700
+++ b/script/scons.py	Thu May 12 11:18:29 2011 -0700
@@ -60,10 +60,10 @@ def build_directory(env, dir, dst_dir=''
     obj_dir = env.project_name + '/' + dst_dir
     env.build_files(env.glob(dir + '/src/*.def'), inc_dir)
     env.build_headers(env.glob(dir + '/src/*.h'), inc_dir)
-    env.src_objs += env.build_sources(env.glob(dir + '/src/*.c'), obj_dir)
+    env.src_objs += env.build_sources(env.glob(dir + '/src/*.cxx'), obj_dir)
     env.src_objs += env.build_metas(env.glob(dir + '/src/*.meta'), obj_dir)
     env.suite_hdrs += env.glob(dir + '/tests/*Suite.h')
-    env.suite_objs += env.build_sources(env.glob(dir + '/tests/*Suite.c'), obj_dir)
+    env.suite_objs += env.build_sources(env.glob(dir + '/tests/*Suite.cxx'), obj_dir)
 
 def build_plugin(env, dir, dst_dir='', name='', with_lib=True):
     if not env.check_dir_target(dir): return
@@ -73,7 +73,7 @@ def build_plugin(env, dir, dst_dir='', n
         name = env.project_name + '_' + dir.split('/')[-1]
     mod_name = name + 'module'
     env.build_headers(env.glob(dir + '/*.h'), 'include/' + env.project_name + '/' + dir.split('/')[-1])
-    objs = env.build_sources(env.glob(dir + '/*.c'), env.project_name + '/' + dir)
+    objs = env.build_sources(env.glob(dir + '/*.cxx'), env.project_name + '/' + dir)
     if env['shared_libraries']:
         if with_lib:
             libs = [env.project_name] + env.get('LIBS', [])
@@ -97,7 +97,7 @@ def build_toolbox(env, dir, dst_dir=''):
     if not env.check_dir_target(dir): return
     if not dst_dir:
         dst_dir = env.project_name + '/' + dir
-    objs = env.build_sources(env.glob(dir + '/*.c'), dst_dir)
+    objs = env.build_sources(env.glob(dir + '/*.cxx'), dst_dir)
     objs += env.build_metas(env.glob(dir + '/*.meta'), dst_dir)
     if env['shared_libraries']:
         env.SharedLibrary(env.get_target_name('lib/' + env.project_name + '_Toolboxmodule'), objs,
@@ -300,7 +300,7 @@ def create_meta(target, source, env):
 	output_file.close()
 
 def gen_meta_suffix(env, sources):
-    return "-meta.c"
+    return "-meta.cxx"
 
 Import('env')
 env['BUILDERS']['Meta']=Builder(action=create_meta,src_suffix="meta",
diff -r 4a864caece0b -r f9c376288955 script/stg.py
--- a/script/stg.py	Wed May 11 13:26:45 2011 -0700
+++ b/script/stg.py	Thu May 12 11:18:29 2011 -0700
@@ -51,7 +51,7 @@ def generate(env, **kw):
         return env.StaticObject(target, metas, **kw)
 
     def gen_meta_suffix(env, source):
-        return "-meta.c"
+        return "-meta.cxx"
 
     env['BUILDERS']['stgMeta'] = Builder(action=stgMeta, single_source=True,
                                          suffix=gen_meta_suffix, src_suffix='meta')
diff -r 4a864caece0b -r f9c376288955 src/SConscript
--- a/src/SConscript	Wed May 11 13:26:45 2011 -0700
+++ b/src/SConscript	Thu May 12 11:18:29 2011 -0700
@@ -3,5 +3,5 @@ Import('env')
 
 # Build the program.
 curLibs = env['LIBS'] if 'LIBS' in env._dict else []
-env.Program('#build/bin/Gale', 'main.c',
+env.Program('#build/bin/Gale', 'main.cxx',
             LIBS=curLibs + ['StGermain'])
diff -r 4a864caece0b -r f9c376288955 src/main.c
--- a/src/main.c	Wed May 11 13:26:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,303 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
-**	Melbourne, 3053, Australia.
-**
-** Primary Contributing Organisations:
-**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
-**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
-**	Monash Cluster Computing - http://www.mcc.monash.edu.au
-**	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
-**
-** Contributors:
-**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
-**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
-**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
-**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
-**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
-**	Kent Humphries, Software Engineer, VPAC. (kenth at vpac.org)
-**
-**  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2.1 of the License, or (at your option) any later version.
-**
-**  This library is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-**  Lesser General Public License for more details.
-**
-**  You should have received a copy of the GNU Lesser General Public
-**  License along with this library; if not, write to the Free Software
-**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-**
-** $Id: main.c 532 2006-04-04 00:21:59Z PatrickSunter $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_PYTHON
-	#include <Python.h>
-#endif
-#ifdef HAVE_SDL /* On Mac OS X, SDL needs to redefine main() so SDL.h must be included here */
-   #include <SDL/SDL.h>
-#endif
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-const Type StGermain_Type = "StGermain";
-
-static void deleteListArgItem( void* ptr ) {
-	/* Correct way to delete result of stgParseList[All]CmdLineArg */
-	Memory_Free( ptr );
-}
-
-typedef void (ForEachFunc) ( Stream* stream, Type componentType );
-
-static void forEachComponent( Stream* stream, ForEachFunc* forEach ) {
-   int i;
-	Stg_ComponentRegister* cr;
-	Stg_ComponentRegisterElement* cre;
-
-	cr = Stg_ComponentRegister_Get_ComponentRegister();
-	for(i = 0; i < Stg_ComponentRegister_GetCount(cr); i++) {
-      cre = Stg_ComponentRegister_GetByIndex(cr, i);
-		Type componentType = Stg_ComponentRegisterElement_GetType( cre );
-		forEach( stream, componentType );
-	}
-}
-
-static void forEachLiveComponent( Stream* stream, ForEachFunc* forEach ) {
-	Stg_ObjectList* uniqueComponentTypes;
-	Index i;
-
-	/* Add each instantiated component type to a list, ensuring the list is of unique entries */
-	uniqueComponentTypes = Stg_ObjectList_New();
-	for( i = 0; i < LiveComponentRegister_GetCount( stgLiveComponentRegister ); i ++ ) {
-		Type componentType = Stg_Class_GetType( LiveComponentRegister_At( stgLiveComponentRegister, i ) );
-		Index j;
-		Bool found;
-
-		found = False;
-		for( j = 0; componentType && j < Stg_ObjectList_Count( uniqueComponentTypes ); j++ ) {
-			char* added = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( uniqueComponentTypes, j ) );
-			if( strcmp( componentType, added ) == 0 ) {
-				found = True;
-			}
-		}
-		if( componentType && !found ) {
-                  Stg_ObjectList_PointerAppend( uniqueComponentTypes, (void*)componentType, 0, 0, 0, 0 );
-		}
-	}
-
-	for( i = 0; i < Stg_ObjectList_Count( uniqueComponentTypes ); i ++ ) {
-		Type componentType = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( uniqueComponentTypes, i ) );
-		forEach( stream, componentType );
-	}
-	
-	Stg_Class_Delete( uniqueComponentTypes );
-}
-
-static void printComponentListItem( Stream* stream, Type componentType ) {
-	Journal_Printf( stream, "\t'%s'\n", componentType );
-}
-
-static void printReferencesListItem( Stream* stream, Type componentType ) {
-	char* reference = Stg_Meta_GetReference( Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" ) );
-	Journal_Printf( 
-		stream, 
-		"\t'%s': %s\n", 
-		componentType,
-		( reference && reference[0] ) ? reference : "(None provided)" );
-		/* i.e. if not null and not an empty string print the value else default */
-}
-
-static void printEquationsListItem( Stream* stream, Type componentType ) {
-	char* equation = Stg_Meta_GetEquation( Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" ) );
-	Journal_Printf( 
-		stream, 
-		"\t'%s': %s\n", 
-		componentType,
-		( equation && equation[0] ) ? equation : "(None provided)" );
-		/* i.e. if not null and not an empty string print the value else default */
-}
-
-static void printRightsListItem( Stream* stream, Type componentType ) {
-	char* rights = Stg_Meta_GetRights( Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" ) );
-	Journal_Printf( 
-		stream, 
-		"\t'%s': %s\n", 
-		componentType,
-		( rights && rights[0] ) ? rights : "(None provided)" );
-		/* i.e. if not null and not an empty string print the value else default */
-}
-
-void register_static_modules();
-int main( int argc, char* argv[] ) {
-	/* StGermain standard bits & pieces */
-	MPI_Comm						CommWorld;
-	int							rank;
-	int							numProcessors;
-	Dictionary*					dictionary;
-	XML_IO_Handler*			ioHandler;
-	Stream*						stream;
-	char*							helpTopic;
-	char*							listAllTopic;
-	Stg_ObjectList*			listAllTopics;
-	char*							listTopic;
-	Stg_ObjectList*			listTopics;
-	Dictionary*					componentDict;
-	Stg_ComponentFactory*	cf;
-
-	/* Initialise PETSc, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-	StGermain_Init( &argc, &argv );
-	stream = Journal_Register( Info_Type, StGermain_Type );
-	#ifdef HAVE_PYTHON
-		Py_Initialize();
-	#endif	
-	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
-
-
-#ifdef NOSHARED
-	register_static_modules();
-#endif
-	
-	
-	/* Create the application's dictionary & read input */
-	dictionary = Dictionary_New();
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-	Journal_ReadFromDictionary( dictionary );
-	
-	/* Parse the additional (stgermain exe specific) commandline arguments */
-	helpTopic = stgParseHelpCmdLineArg( &argc, &argv );
-	listAllTopics = Stg_ObjectList_New();
-	while( (listAllTopic = stgParseListAllCmdLineArg( &argc, &argv )) != 0 ) {
-		Stg_ObjectList_Append( listAllTopics, Stg_ObjectAdaptor_NewOfPointer( listAllTopic, 0, True, False, deleteListArgItem, 0, 0 ) );
-	}
-	listTopics = Stg_ObjectList_New();
-	while( (listTopic = stgParseListCmdLineArg( &argc, &argv )) != 0 ) {
-		Stg_ObjectList_PointerAppend( listTopics, listTopic, 0, deleteListArgItem, 0, 0 );
-	}
-
-	/* if the command line arguments ask for "help" or "list-all", then load the toolboxes and plugins (to include all 
-		symbols/components, and print the help for the selected component, but don't run the wholse app. There can be
-		multiple "list-all"s. */
-	if( helpTopic || Stg_ObjectList_Count( listAllTopics ) ) {
-		PluginsManager* plugins = PluginsManager_New();
-		Dictionary* metadata;
-		Index i;
-
-		ModulesManager_Load( stgToolboxesManager, dictionary, "" );
-		ModulesManager_Load( plugins, dictionary, "context" );
-
-		/* "--help" parameter */
-		if( helpTopic ) {
-			metadata = Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), helpTopic, "0" );
-			if( metadata ) {
-				Stg_Meta_Print( metadata, stream );
-			}
-			else {
-				Journal_Printf( stream, "Help topic '%s' not found.\n", helpTopic );
-			}
-			Memory_Free( helpTopic );
-			helpTopic = 0;
-		}
-
-		/* "--list-all" parameters */
-		for( i = 0; i < Stg_ObjectList_Count( listAllTopics ); i++ ) {
-			listAllTopic = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( listAllTopics, i ) );
-
-			if( strcmp( listAllTopic, "components" ) == 0 ) {
-				Journal_Printf( stream, "Registered components are:\n" );
-				forEachComponent( stream, printComponentListItem );
-			}
-			else if( strcmp( listAllTopic, "references" ) == 0 ) {
-				Journal_Printf( stream, "Registered components references are:\n" );
-				forEachComponent( stream, printReferencesListItem );
-			}
-			else if( strcmp( listAllTopic, "equations" ) == 0 ) {
-				Journal_Printf( stream, "Registered components equations are:\n" );
-				forEachComponent( stream, printEquationsListItem );
-			}
-			else if( strcmp( listAllTopic, "rights" ) == 0 ) {
-				Journal_Printf( stream, "Registered components rights are:\n" );
-				forEachComponent( stream, printRightsListItem );
-			}
-			else {
-				Journal_Printf( stream, "List-all topic '%s' not found.\n", listAllTopic );
-				Journal_Printf( stream, "Available topics are:\n\t'components'\n\t'references'\n\t'equations'\n\t'rights'\n", listAllTopic );
-			}
-		}
-
-		/* metadata is provided as a reference - don't delete */
-		Stg_Class_Delete( plugins );
-	}
-	else {  /* ... run the app */
-		Index i;
-		PluginsManager* lucPluginManager = PluginsManager_New();
-
-		/* the lucPlugin is not associated with a given context, as other plugins are, so load it in manually, assuming it exists */
-		ModulesManager_Load( lucPluginManager, dictionary, "lucPluginContext" );
-
-		ModulesManager_Load( stgToolboxesManager, dictionary, "" );
-
-		/* Magic happens here! */
-		cf = stgMainConstruct( dictionary, CommWorld, NULL );
-		stgMainBuildAndInitialise( cf );
-		stgMainLoop( cf );
-
-		/* "--list" parameters */
-		for( i = 0; i < Stg_ObjectList_Count( listTopics ); i++ ) {
-			listTopic = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( listTopics, i ) );
-
-			if( strcmp( listTopic, "components" ) == 0 ) {
-				Journal_Printf( stream, "Instantiated/used components are:\n" );
-				forEachLiveComponent( stream, printComponentListItem );
-			}
-			else if( strcmp( listTopic, "references" ) == 0 ) {
-				Journal_Printf( stream, "Instantiated/used components references are:\n" );
-				forEachLiveComponent( stream, printReferencesListItem );
-			}
-			else if( strcmp( listTopic, "equations" ) == 0 ) {
-				Journal_Printf( stream, "Instantiated/used components equations are:\n" );
-				forEachLiveComponent( stream, printEquationsListItem );
-			}
-			else if( strcmp( listTopic, "rights" ) == 0 ) {
-				Journal_Printf( stream, "Instantiated/used components rights are:\n" );
-				forEachLiveComponent( stream, printRightsListItem );
-			}
-			else {
-				Journal_Printf( stream, "List topic '%s' not found.\n", listTopic );
-				Journal_Printf( stream, "Available topics are:\n\t'components'\n\t'references'\n\t'equations'\n\t'rights'\n", listTopic );
-			}
-		}
-
-		stgMainDestroy( cf );
-	}
-
-	/* Close off everything */
-	Stg_Class_Delete( listAllTopics );
-	Stg_Class_Delete( listTopics );
-	#ifdef HAVE_PYTHON
-		Py_Finalize();
-	#endif
-	StGermain_Finalise();
-	MPI_Finalize();
-	
-	return 0; /* success */
-}
-
-
diff -r 4a864caece0b -r f9c376288955 src/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main.cxx	Thu May 12 11:18:29 2011 -0700
@@ -0,0 +1,303 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
+**
+** Contributors:
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**	Kent Humphries, Software Engineer, VPAC. (kenth at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: main.c 532 2006-04-04 00:21:59Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_PYTHON
+	#include <Python.h>
+#endif
+#ifdef HAVE_SDL /* On Mac OS X, SDL needs to redefine main() so SDL.h must be included here */
+   #include <SDL/SDL.h>
+#endif
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+const Type StGermain_Type = "StGermain";
+
+static void deleteListArgItem( void* ptr ) {
+	/* Correct way to delete result of stgParseList[All]CmdLineArg */
+	Memory_Free( ptr );
+}
+
+typedef void (ForEachFunc) ( Stream* stream, Type componentType );
+
+static void forEachComponent( Stream* stream, ForEachFunc* forEach ) {
+   int i;
+	Stg_ComponentRegister* cr;
+	Stg_ComponentRegisterElement* cre;
+
+	cr = Stg_ComponentRegister_Get_ComponentRegister();
+	for(i = 0; i < Stg_ComponentRegister_GetCount(cr); i++) {
+      cre = Stg_ComponentRegister_GetByIndex(cr, i);
+		Type componentType = Stg_ComponentRegisterElement_GetType( cre );
+		forEach( stream, componentType );
+	}
+}
+
+static void forEachLiveComponent( Stream* stream, ForEachFunc* forEach ) {
+	Stg_ObjectList* uniqueComponentTypes;
+	Index i;
+
+	/* Add each instantiated component type to a list, ensuring the list is of unique entries */
+	uniqueComponentTypes = Stg_ObjectList_New();
+	for( i = 0; i < LiveComponentRegister_GetCount( stgLiveComponentRegister ); i ++ ) {
+		Type componentType = Stg_Class_GetType( LiveComponentRegister_At( stgLiveComponentRegister, i ) );
+		Index j;
+		Bool found;
+
+		found = False;
+		for( j = 0; componentType && j < Stg_ObjectList_Count( uniqueComponentTypes ); j++ ) {
+			char* added = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( uniqueComponentTypes, j ) );
+			if( strcmp( componentType, added ) == 0 ) {
+				found = True;
+			}
+		}
+		if( componentType && !found ) {
+                  Stg_ObjectList_PointerAppend( uniqueComponentTypes, (void*)componentType, 0, 0, 0, 0 );
+		}
+	}
+
+	for( i = 0; i < Stg_ObjectList_Count( uniqueComponentTypes ); i ++ ) {
+		Type componentType = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( uniqueComponentTypes, i ) );
+		forEach( stream, componentType );
+	}
+	
+	Stg_Class_Delete( uniqueComponentTypes );
+}
+
+static void printComponentListItem( Stream* stream, Type componentType ) {
+	Journal_Printf( stream, "\t'%s'\n", componentType );
+}
+
+static void printReferencesListItem( Stream* stream, Type componentType ) {
+	char* reference = Stg_Meta_GetReference( Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" ) );
+	Journal_Printf( 
+		stream, 
+		"\t'%s': %s\n", 
+		componentType,
+		( reference && reference[0] ) ? reference : "(None provided)" );
+		/* i.e. if not null and not an empty string print the value else default */
+}
+
+static void printEquationsListItem( Stream* stream, Type componentType ) {
+	char* equation = Stg_Meta_GetEquation( Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" ) );
+	Journal_Printf( 
+		stream, 
+		"\t'%s': %s\n", 
+		componentType,
+		( equation && equation[0] ) ? equation : "(None provided)" );
+		/* i.e. if not null and not an empty string print the value else default */
+}
+
+static void printRightsListItem( Stream* stream, Type componentType ) {
+	char* rights = Stg_Meta_GetRights( Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), componentType, "0" ) );
+	Journal_Printf( 
+		stream, 
+		"\t'%s': %s\n", 
+		componentType,
+		( rights && rights[0] ) ? rights : "(None provided)" );
+		/* i.e. if not null and not an empty string print the value else default */
+}
+
+void register_static_modules();
+int main( int argc, char* argv[] ) {
+	/* StGermain standard bits & pieces */
+	MPI_Comm						CommWorld;
+	int							rank;
+	int							numProcessors;
+	Dictionary*					dictionary;
+	XML_IO_Handler*			ioHandler;
+	Stream*						stream;
+	char*							helpTopic;
+	char*							listAllTopic;
+	Stg_ObjectList*			listAllTopics;
+	char*							listTopic;
+	Stg_ObjectList*			listTopics;
+	Dictionary*					componentDict;
+	Stg_ComponentFactory*	cf;
+
+	/* Initialise PETSc, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	StGermain_Init( &argc, &argv );
+	stream = Journal_Register( Info_Type, StGermain_Type );
+	#ifdef HAVE_PYTHON
+		Py_Initialize();
+	#endif	
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+
+
+#ifdef NOSHARED
+	register_static_modules();
+#endif
+	
+	
+	/* Create the application's dictionary & read input */
+	dictionary = Dictionary_New();
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+	Journal_ReadFromDictionary( dictionary );
+	
+	/* Parse the additional (stgermain exe specific) commandline arguments */
+	helpTopic = stgParseHelpCmdLineArg( &argc, &argv );
+	listAllTopics = Stg_ObjectList_New();
+	while( (listAllTopic = stgParseListAllCmdLineArg( &argc, &argv )) != 0 ) {
+		Stg_ObjectList_Append( listAllTopics, Stg_ObjectAdaptor_NewOfPointer( listAllTopic, 0, True, False, deleteListArgItem, 0, 0 ) );
+	}
+	listTopics = Stg_ObjectList_New();
+	while( (listTopic = stgParseListCmdLineArg( &argc, &argv )) != 0 ) {
+		Stg_ObjectList_PointerAppend( listTopics, listTopic, 0, deleteListArgItem, 0, 0 );
+	}
+
+	/* if the command line arguments ask for "help" or "list-all", then load the toolboxes and plugins (to include all 
+		symbols/components, and print the help for the selected component, but don't run the wholse app. There can be
+		multiple "list-all"s. */
+	if( helpTopic || Stg_ObjectList_Count( listAllTopics ) ) {
+		PluginsManager* plugins = PluginsManager_New();
+		Dictionary* metadata;
+		Index i;
+
+		ModulesManager_Load( stgToolboxesManager, dictionary, "" );
+		ModulesManager_Load( plugins, dictionary, "context" );
+
+		/* "--help" parameter */
+		if( helpTopic ) {
+			metadata = Stg_ComponentRegister_GetMetadata( Stg_ComponentRegister_Get_ComponentRegister(), helpTopic, "0" );
+			if( metadata ) {
+				Stg_Meta_Print( metadata, stream );
+			}
+			else {
+				Journal_Printf( stream, "Help topic '%s' not found.\n", helpTopic );
+			}
+			Memory_Free( helpTopic );
+			helpTopic = 0;
+		}
+
+		/* "--list-all" parameters */
+		for( i = 0; i < Stg_ObjectList_Count( listAllTopics ); i++ ) {
+			listAllTopic = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( listAllTopics, i ) );
+
+			if( strcmp( listAllTopic, "components" ) == 0 ) {
+				Journal_Printf( stream, "Registered components are:\n" );
+				forEachComponent( stream, printComponentListItem );
+			}
+			else if( strcmp( listAllTopic, "references" ) == 0 ) {
+				Journal_Printf( stream, "Registered components references are:\n" );
+				forEachComponent( stream, printReferencesListItem );
+			}
+			else if( strcmp( listAllTopic, "equations" ) == 0 ) {
+				Journal_Printf( stream, "Registered components equations are:\n" );
+				forEachComponent( stream, printEquationsListItem );
+			}
+			else if( strcmp( listAllTopic, "rights" ) == 0 ) {
+				Journal_Printf( stream, "Registered components rights are:\n" );
+				forEachComponent( stream, printRightsListItem );
+			}
+			else {
+				Journal_Printf( stream, "List-all topic '%s' not found.\n", listAllTopic );
+				Journal_Printf( stream, "Available topics are:\n\t'components'\n\t'references'\n\t'equations'\n\t'rights'\n", listAllTopic );
+			}
+		}
+
+		/* metadata is provided as a reference - don't delete */
+		Stg_Class_Delete( plugins );
+	}
+	else {  /* ... run the app */
+		Index i;
+		PluginsManager* lucPluginManager = PluginsManager_New();
+
+		/* the lucPlugin is not associated with a given context, as other plugins are, so load it in manually, assuming it exists */
+		ModulesManager_Load( lucPluginManager, dictionary, "lucPluginContext" );
+
+		ModulesManager_Load( stgToolboxesManager, dictionary, "" );
+
+		/* Magic happens here! */
+		cf = stgMainConstruct( dictionary, CommWorld, NULL );
+		stgMainBuildAndInitialise( cf );
+		stgMainLoop( cf );
+
+		/* "--list" parameters */
+		for( i = 0; i < Stg_ObjectList_Count( listTopics ); i++ ) {
+			listTopic = (char*)Stg_ObjectAdaptor_Object( (Stg_ObjectAdaptor*)Stg_ObjectList_At( listTopics, i ) );
+
+			if( strcmp( listTopic, "components" ) == 0 ) {
+				Journal_Printf( stream, "Instantiated/used components are:\n" );
+				forEachLiveComponent( stream, printComponentListItem );
+			}
+			else if( strcmp( listTopic, "references" ) == 0 ) {
+				Journal_Printf( stream, "Instantiated/used components references are:\n" );
+				forEachLiveComponent( stream, printReferencesListItem );
+			}
+			else if( strcmp( listTopic, "equations" ) == 0 ) {
+				Journal_Printf( stream, "Instantiated/used components equations are:\n" );
+				forEachLiveComponent( stream, printEquationsListItem );
+			}
+			else if( strcmp( listTopic, "rights" ) == 0 ) {
+				Journal_Printf( stream, "Instantiated/used components rights are:\n" );
+				forEachLiveComponent( stream, printRightsListItem );
+			}
+			else {
+				Journal_Printf( stream, "List topic '%s' not found.\n", listTopic );
+				Journal_Printf( stream, "Available topics are:\n\t'components'\n\t'references'\n\t'equations'\n\t'rights'\n", listTopic );
+			}
+		}
+
+		stgMainDestroy( cf );
+	}
+
+	/* Close off everything */
+	Stg_Class_Delete( listAllTopics );
+	Stg_Class_Delete( listTopics );
+	#ifdef HAVE_PYTHON
+		Py_Finalize();
+	#endif
+	StGermain_Finalise();
+	MPI_Finalize();
+	
+	return 0; /* success */
+}
+
+



More information about the CIG-COMMITS mailing list