[Avida-SVN] r1328 - in development: Avida.xcodeproj source/actions source/cpu source/main source/targets/avida-viewer

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Sat Feb 17 13:03:30 PST 2007


Author: brysonda
Date: 2007-02-17 16:03:30 -0500 (Sat, 17 Feb 2007)
New Revision: 1328

Removed:
   development/source/cpu/cInstLibCPU.h
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/actions/LandscapeActions.cc
   development/source/cpu/SConscript
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareCPU.h
   development/source/cpu/cHardwareExperimental.cc
   development/source/cpu/cHardwareExperimental.h
   development/source/cpu/cHardwareManager.cc
   development/source/cpu/cHardwareManager.h
   development/source/cpu/cHardwareSMT.cc
   development/source/cpu/cHardwareTransSMT.cc
   development/source/cpu/cHeadCPU.h
   development/source/cpu/cInstSet.cc
   development/source/cpu/cInstSet.h
   development/source/main/cEnvironment.cc
   development/source/main/cEnvironment.h
   development/source/main/cGenomeUtil.cc
   development/source/main/cMxCodeArray.cc
   development/source/main/cPhenotype.cc
   development/source/main/cStats.cc
   development/source/main/cWorld.cc
   development/source/targets/avida-viewer/cViewInfo.cc
   development/source/targets/avida-viewer/cViewInfo.h
Log:
Standardize all hardware classes on the use of tInstLibEntry.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/Avida.xcodeproj/project.pbxproj	2007-02-17 21:03:30 UTC (rev 1328)
@@ -451,7 +451,7 @@
 		700E12610A097A0800B604CD /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
 		700E12630A097A1700B604CD /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
 		700E28CF0859FFD700CF158A /* tObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tObjectFactory.h; sourceTree = "<group>"; };
-		700E2B83085DE50C00CF158A /* avida-viewer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "avida-viewer"; sourceTree = BUILT_PRODUCTS_DIR; };
+		700E2B83085DE50C00CF158A /* avida-viewer */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = "avida-viewer"; sourceTree = BUILT_PRODUCTS_DIR; };
 		7013845F09028B3E0087ED2E /* cAvidaConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cAvidaConfig.h; sourceTree = "<group>"; };
 		7013846009028B3E0087ED2E /* cAvidaConfig.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cAvidaConfig.cc; sourceTree = "<group>"; };
 		701384A10902A16F0087ED2E /* defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = defs.h; sourceTree = "<group>"; };
@@ -814,7 +814,6 @@
 		70C1F01508C3C6FC00F50912 /* cHardwareStatusPrinter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHardwareStatusPrinter.h; sourceTree = "<group>"; };
 		70C1F01908C3C6FC00F50912 /* cHardwareTracer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHardwareTracer.h; sourceTree = "<group>"; };
 		70C1F01B08C3C6FC00F50912 /* cHeadCPU.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHeadCPU.h; sourceTree = "<group>"; };
-		70C1F01D08C3C6FC00F50912 /* cInstLibCPU.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cInstLibCPU.h; sourceTree = "<group>"; };
 		70C1F01F08C3C6FC00F50912 /* cTestCPU.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTestCPU.h; sourceTree = "<group>"; };
 		70C1F02308C3C71300F50912 /* cHardwareSMT.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cHardwareSMT.cc; sourceTree = "<group>"; };
 		70C1F02408C3C71300F50912 /* cHardwareStatusPrinter.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cHardwareStatusPrinter.cc; sourceTree = "<group>"; };
@@ -1409,7 +1408,6 @@
 				70C1F01908C3C6FC00F50912 /* cHardwareTracer.h */,
 				70C1F02608C3C71300F50912 /* cHeadCPU.cc */,
 				70C1F01B08C3C6FC00F50912 /* cHeadCPU.h */,
-				70C1F01D08C3C6FC00F50912 /* cInstLibCPU.h */,
 				70C1EF6108C3954700F50912 /* cCPUStack.cc */,
 				70C1EF6008C3953A00F50912 /* cCPUStack.h */,
 				70C1F02808C3C71300F50912 /* cTestCPU.cc */,

Modified: development/source/actions/LandscapeActions.cc
===================================================================
--- development/source/actions/LandscapeActions.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/actions/LandscapeActions.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -33,6 +33,7 @@
 #include "cGenotype.h"
 #include "cGenotypeBatch.h"
 #include "cHardwareManager.h"
+#include "cInstSet.h"
 #include "cLandscape.h"
 #include "cMutationalNeighborhood.h"
 #include "cMutationalNeighborhoodResults.h"

Modified: development/source/cpu/SConscript
===================================================================
--- development/source/cpu/SConscript	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/SConscript	2007-02-17 21:03:30 UTC (rev 1328)
@@ -18,7 +18,6 @@
   'cHardwareTrans.h',
   'cHeadCPU.h',
   'cInstLibBase.h',
-  'cInstLibCPU.h',
   'cInstSet.h',
   'cTestCPU.h',
   'cTestCPUInterface.h',

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareCPU.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -33,7 +33,6 @@
 #include "cGenotype.h"
 #include "cHardwareManager.h"
 #include "cHardwareTracer.h"
-#include "cInstLibCPU.h"
 #include "cInstSet.h"
 #include "cMutation.h"
 #include "cMutationLib.h"
@@ -44,6 +43,7 @@
 #include "cTestCPU.h"
 #include "cWorldDriver.h"
 #include "cWorld.h"
+#include "tInstLibEntry.h"
 
 #include <limits.h>
 #include <fstream>
@@ -51,12 +51,9 @@
 using namespace std;
 
 
-const cInstruction cInstLibCPU::inst_error(255);
-const cInstruction cInstLibCPU::inst_default(0);
+tInstLib<cHardwareCPU::tMethod>* cHardwareCPU::s_inst_slib = cHardwareCPU::initInstLib();
 
-cInstLibCPU *cHardwareCPU::s_inst_slib = cHardwareCPU::initInstLib();
-
-cInstLibCPU *cHardwareCPU::initInstLib(void)
+tInstLib<cHardwareCPU::tMethod>* cHardwareCPU::initInstLib(void)
 {
   struct cNOPEntryCPU {
     cString name;
@@ -67,327 +64,267 @@
   static const cNOPEntryCPU s_n_array[] = {
     cNOPEntryCPU("nop-A", REG_AX),
     cNOPEntryCPU("nop-B", REG_BX),
-    cNOPEntryCPU("nop-C", REG_CX),
-    cNOPEntryCPU("nop-D", REG_DX),
-    cNOPEntryCPU("nop-E", REG_EX),
-    cNOPEntryCPU("nop-F", REG_FX)
+    cNOPEntryCPU("nop-C", REG_CX)
   };
   
-  struct cInstEntryCPU { 
-    const cString name;
-    const tHardwareCPUMethod function;
-    const bool is_default;
-    const cString desc;
-    
-    cInstEntryCPU(const cString & _name, tHardwareCPUMethod _fun,
-                  bool _def=false, const cString & _desc="")
-      : name(_name), function(_fun), is_default(_def), desc(_desc) {}
-  };
-  static const cInstEntryCPU s_f_array[] = {
+  static const tInstLibEntry<tMethod> s_f_array[] = {
     /*
      Note: all entries of cNOPEntryCPU s_n_array must have corresponding
-     in the same order in cInstEntryCPU s_f_array, and these entries must
+     in the same order in tInstLibEntry<tMethod> s_f_array, and these entries must
      be the first elements of s_f_array.
      */
-    cInstEntryCPU("nop-A",     &cHardwareCPU::Inst_Nop, true,
-                  "No-operation instruction; modifies other instructions"),
-    cInstEntryCPU("nop-B",     &cHardwareCPU::Inst_Nop, true,
-                  "No-operation instruction; modifies other instructions"),
-    cInstEntryCPU("nop-C",     &cHardwareCPU::Inst_Nop, true,
-                  "No-operation instruction; modifies other instructions"),
-    cInstEntryCPU("nop-D",     &cHardwareCPU::Inst_Nop, true,
-                  "No-operation instruction; modifies other instructions"),
-    cInstEntryCPU("nop-E",     &cHardwareCPU::Inst_Nop, true,
-                  "No-operation instruction; modifies other instructions"),
-    cInstEntryCPU("nop-F",     &cHardwareCPU::Inst_Nop, true,
-                  "No-operation instruction; modifies other instructions"),
+    tInstLibEntry<tMethod>("nop-A", &cHardwareCPU::Inst_Nop, (nInstFlag::DEFAULT & nInstFlag::NOP), "No-operation instruction; modifies other instructions"),
+    tInstLibEntry<tMethod>("nop-B", &cHardwareCPU::Inst_Nop, (nInstFlag::DEFAULT & nInstFlag::NOP), "No-operation instruction; modifies other instructions"),
+    tInstLibEntry<tMethod>("nop-C", &cHardwareCPU::Inst_Nop, (nInstFlag::DEFAULT & nInstFlag::NOP), "No-operation instruction; modifies other instructions"),
     
-    cInstEntryCPU("NULL",      &cHardwareCPU::Inst_Nop, false,
-                  "True no-operation instruction: does nothing"),
-    cInstEntryCPU("nop-X",     &cHardwareCPU::Inst_Nop, false,
-                  "True no-operation instruction: does nothing"),
-    cInstEntryCPU("if-equ-0",  &cHardwareCPU::Inst_If0, false,
-                  "Execute next instruction if ?BX?==0, else skip it"),
-    cInstEntryCPU("if-not-0",  &cHardwareCPU::Inst_IfNot0, false,
-                  "Execute next instruction if ?BX?!=0, else skip it"),
-    cInstEntryCPU("if-n-equ",  &cHardwareCPU::Inst_IfNEqu, true,
-                  "Execute next instruction if ?BX?!=?CX?, else skip it"),
-    cInstEntryCPU("if-equ",    &cHardwareCPU::Inst_IfEqu, false,
-                  "Execute next instruction if ?BX?==?CX?, else skip it"),
-    cInstEntryCPU("if-grt-0",  &cHardwareCPU::Inst_IfGr0),
-    cInstEntryCPU("if-grt",    &cHardwareCPU::Inst_IfGr),
-    cInstEntryCPU("if->=-0",   &cHardwareCPU::Inst_IfGrEqu0),
-    cInstEntryCPU("if->=",     &cHardwareCPU::Inst_IfGrEqu),
-    cInstEntryCPU("if-les-0",  &cHardwareCPU::Inst_IfLess0),
-    cInstEntryCPU("if-less",   &cHardwareCPU::Inst_IfLess, true,
-                  "Execute next instruction if ?BX? < ?CX?, else skip it"),
-    cInstEntryCPU("if-<=-0",   &cHardwareCPU::Inst_IfLsEqu0),
-    cInstEntryCPU("if-<=",     &cHardwareCPU::Inst_IfLsEqu),
-    cInstEntryCPU("if-A!=B",   &cHardwareCPU::Inst_IfANotEqB),
-    cInstEntryCPU("if-B!=C",   &cHardwareCPU::Inst_IfBNotEqC),
-    cInstEntryCPU("if-A!=C",   &cHardwareCPU::Inst_IfANotEqC),
-    cInstEntryCPU("if-bit-1",  &cHardwareCPU::Inst_IfBit1),
+    tInstLibEntry<tMethod>("NULL", &cHardwareCPU::Inst_Nop, 0, "True no-operation instruction: does nothing"),
+    tInstLibEntry<tMethod>("nop-X", &cHardwareCPU::Inst_Nop, 0, "True no-operation instruction: does nothing"),
+    tInstLibEntry<tMethod>("if-equ-0", &cHardwareCPU::Inst_If0, 0, "Execute next instruction if ?BX?==0, else skip it"),
+    tInstLibEntry<tMethod>("if-not-0", &cHardwareCPU::Inst_IfNot0, 0, "Execute next instruction if ?BX?!=0, else skip it"),
+    tInstLibEntry<tMethod>("if-n-equ", &cHardwareCPU::Inst_IfNEqu, nInstFlag::DEFAULT, "Execute next instruction if ?BX?!=?CX?, else skip it"),
+    tInstLibEntry<tMethod>("if-equ", &cHardwareCPU::Inst_IfEqu, 0, "Execute next instruction if ?BX?==?CX?, else skip it"),
+    tInstLibEntry<tMethod>("if-grt-0", &cHardwareCPU::Inst_IfGr0),
+    tInstLibEntry<tMethod>("if-grt", &cHardwareCPU::Inst_IfGr),
+    tInstLibEntry<tMethod>("if->=-0", &cHardwareCPU::Inst_IfGrEqu0),
+    tInstLibEntry<tMethod>("if->=", &cHardwareCPU::Inst_IfGrEqu),
+    tInstLibEntry<tMethod>("if-les-0", &cHardwareCPU::Inst_IfLess0),
+    tInstLibEntry<tMethod>("if-less", &cHardwareCPU::Inst_IfLess, nInstFlag::DEFAULT, "Execute next instruction if ?BX? < ?CX?, else skip it"),
+    tInstLibEntry<tMethod>("if-<=-0", &cHardwareCPU::Inst_IfLsEqu0),
+    tInstLibEntry<tMethod>("if-<=", &cHardwareCPU::Inst_IfLsEqu),
+    tInstLibEntry<tMethod>("if-A!=B", &cHardwareCPU::Inst_IfANotEqB),
+    tInstLibEntry<tMethod>("if-B!=C", &cHardwareCPU::Inst_IfBNotEqC),
+    tInstLibEntry<tMethod>("if-A!=C", &cHardwareCPU::Inst_IfANotEqC),
+    tInstLibEntry<tMethod>("if-bit-1", &cHardwareCPU::Inst_IfBit1),
     
-    cInstEntryCPU("jump-f",    &cHardwareCPU::Inst_JumpF),
-    cInstEntryCPU("jump-b",    &cHardwareCPU::Inst_JumpB),
-    cInstEntryCPU("call",      &cHardwareCPU::Inst_Call),
-    cInstEntryCPU("return",    &cHardwareCPU::Inst_Return),
+    tInstLibEntry<tMethod>("jump-f", &cHardwareCPU::Inst_JumpF),
+    tInstLibEntry<tMethod>("jump-b", &cHardwareCPU::Inst_JumpB),
+    tInstLibEntry<tMethod>("call", &cHardwareCPU::Inst_Call),
+    tInstLibEntry<tMethod>("return", &cHardwareCPU::Inst_Return),
 
-    cInstEntryCPU("throw",     &cHardwareCPU::Inst_Throw),
-    cInstEntryCPU("throwif=0", &cHardwareCPU::Inst_ThrowIf0),    
-    cInstEntryCPU("throwif!=0",&cHardwareCPU::Inst_ThrowIfNot0),
-    cInstEntryCPU("catch",     &cHardwareCPU::Inst_Catch),
+    tInstLibEntry<tMethod>("throw", &cHardwareCPU::Inst_Throw),
+    tInstLibEntry<tMethod>("throwif=0", &cHardwareCPU::Inst_ThrowIf0),    
+    tInstLibEntry<tMethod>("throwif!=0", &cHardwareCPU::Inst_ThrowIfNot0),
+    tInstLibEntry<tMethod>("catch", &cHardwareCPU::Inst_Catch),
     
-    cInstEntryCPU("goto",      &cHardwareCPU::Inst_Goto),
-    cInstEntryCPU("goto-if=0", &cHardwareCPU::Inst_GotoIf0),    
-    cInstEntryCPU("goto-if!=0",&cHardwareCPU::Inst_GotoIfNot0),
-    cInstEntryCPU("label",     &cHardwareCPU::Inst_Label),
+    tInstLibEntry<tMethod>("goto", &cHardwareCPU::Inst_Goto),
+    tInstLibEntry<tMethod>("goto-if=0", &cHardwareCPU::Inst_GotoIf0),    
+    tInstLibEntry<tMethod>("goto-if!=0", &cHardwareCPU::Inst_GotoIfNot0),
+    tInstLibEntry<tMethod>("label", &cHardwareCPU::Inst_Label),
     
-    cInstEntryCPU("pop",       &cHardwareCPU::Inst_Pop, true,
-                  "Remove top number from stack and place into ?BX?"),
-    cInstEntryCPU("push",      &cHardwareCPU::Inst_Push, true,
-                  "Copy number from ?BX? and place it into the stack"),
-    cInstEntryCPU("swap-stk",  &cHardwareCPU::Inst_SwitchStack, true,
-                  "Toggle which stack is currently being used"),
-    cInstEntryCPU("flip-stk",  &cHardwareCPU::Inst_FlipStack),
-    cInstEntryCPU("swap",      &cHardwareCPU::Inst_Swap, true,
-                  "Swap the contents of ?BX? with ?CX?"),
-    cInstEntryCPU("swap-AB",   &cHardwareCPU::Inst_SwapAB),
-    cInstEntryCPU("swap-BC",   &cHardwareCPU::Inst_SwapBC),
-    cInstEntryCPU("swap-AC",   &cHardwareCPU::Inst_SwapAC),
-    cInstEntryCPU("copy-reg",  &cHardwareCPU::Inst_CopyReg),
-    cInstEntryCPU("set_A=B",   &cHardwareCPU::Inst_CopyRegAB),
-    cInstEntryCPU("set_A=C",   &cHardwareCPU::Inst_CopyRegAC),
-    cInstEntryCPU("set_B=A",   &cHardwareCPU::Inst_CopyRegBA),
-    cInstEntryCPU("set_B=C",   &cHardwareCPU::Inst_CopyRegBC),
-    cInstEntryCPU("set_C=A",   &cHardwareCPU::Inst_CopyRegCA),
-    cInstEntryCPU("set_C=B",   &cHardwareCPU::Inst_CopyRegCB),
-    cInstEntryCPU("reset",     &cHardwareCPU::Inst_Reset),
+    tInstLibEntry<tMethod>("pop", &cHardwareCPU::Inst_Pop, nInstFlag::DEFAULT, "Remove top number from stack and place into ?BX?"),
+    tInstLibEntry<tMethod>("push", &cHardwareCPU::Inst_Push, nInstFlag::DEFAULT, "Copy number from ?BX? and place it into the stack"),
+    tInstLibEntry<tMethod>("swap-stk", &cHardwareCPU::Inst_SwitchStack, nInstFlag::DEFAULT, "Toggle which stack is currently being used"),
+    tInstLibEntry<tMethod>("flip-stk", &cHardwareCPU::Inst_FlipStack),
+    tInstLibEntry<tMethod>("swap", &cHardwareCPU::Inst_Swap, nInstFlag::DEFAULT, "Swap the contents of ?BX? with ?CX?"),
+    tInstLibEntry<tMethod>("swap-AB", &cHardwareCPU::Inst_SwapAB),
+    tInstLibEntry<tMethod>("swap-BC", &cHardwareCPU::Inst_SwapBC),
+    tInstLibEntry<tMethod>("swap-AC", &cHardwareCPU::Inst_SwapAC),
+    tInstLibEntry<tMethod>("copy-reg", &cHardwareCPU::Inst_CopyReg),
+    tInstLibEntry<tMethod>("set_A=B", &cHardwareCPU::Inst_CopyRegAB),
+    tInstLibEntry<tMethod>("set_A=C", &cHardwareCPU::Inst_CopyRegAC),
+    tInstLibEntry<tMethod>("set_B=A", &cHardwareCPU::Inst_CopyRegBA),
+    tInstLibEntry<tMethod>("set_B=C", &cHardwareCPU::Inst_CopyRegBC),
+    tInstLibEntry<tMethod>("set_C=A", &cHardwareCPU::Inst_CopyRegCA),
+    tInstLibEntry<tMethod>("set_C=B", &cHardwareCPU::Inst_CopyRegCB),
+    tInstLibEntry<tMethod>("reset", &cHardwareCPU::Inst_Reset),
     
-    cInstEntryCPU("pop-A",     &cHardwareCPU::Inst_PopA),
-    cInstEntryCPU("pop-B",     &cHardwareCPU::Inst_PopB),
-    cInstEntryCPU("pop-C",     &cHardwareCPU::Inst_PopC),
-    cInstEntryCPU("push-A",    &cHardwareCPU::Inst_PushA),
-    cInstEntryCPU("push-B",    &cHardwareCPU::Inst_PushB),
-    cInstEntryCPU("push-C",    &cHardwareCPU::Inst_PushC),
+    tInstLibEntry<tMethod>("pop-A", &cHardwareCPU::Inst_PopA),
+    tInstLibEntry<tMethod>("pop-B", &cHardwareCPU::Inst_PopB),
+    tInstLibEntry<tMethod>("pop-C", &cHardwareCPU::Inst_PopC),
+    tInstLibEntry<tMethod>("push-A", &cHardwareCPU::Inst_PushA),
+    tInstLibEntry<tMethod>("push-B", &cHardwareCPU::Inst_PushB),
+    tInstLibEntry<tMethod>("push-C", &cHardwareCPU::Inst_PushC),
     
-    cInstEntryCPU("shift-r",   &cHardwareCPU::Inst_ShiftR, true,
-                  "Shift bits in ?BX? right by one (divide by two)"),
-    cInstEntryCPU("shift-l",   &cHardwareCPU::Inst_ShiftL, true,
-                  "Shift bits in ?BX? left by one (multiply by two)"),
-    cInstEntryCPU("bit-1",     &cHardwareCPU::Inst_Bit1),
-    cInstEntryCPU("set-num",   &cHardwareCPU::Inst_SetNum),
-    cInstEntryCPU("val-grey",  &cHardwareCPU::Inst_ValGrey),
-    cInstEntryCPU("val-dir",   &cHardwareCPU::Inst_ValDir),
-    cInstEntryCPU("val-add-p", &cHardwareCPU::Inst_ValAddP),
-    cInstEntryCPU("val-fib",   &cHardwareCPU::Inst_ValFib),
-    cInstEntryCPU("val-poly-c",&cHardwareCPU::Inst_ValPolyC),
-    cInstEntryCPU("inc",       &cHardwareCPU::Inst_Inc, true,
-                  "Increment ?BX? by one"),
-    cInstEntryCPU("dec",       &cHardwareCPU::Inst_Dec, true,
-                  "Decrement ?BX? by one"),
-    cInstEntryCPU("zero",      &cHardwareCPU::Inst_Zero, false,
-                  "Set ?BX? to zero"),
-    cInstEntryCPU("neg",       &cHardwareCPU::Inst_Neg),
-    cInstEntryCPU("square",    &cHardwareCPU::Inst_Square),
-    cInstEntryCPU("sqrt",      &cHardwareCPU::Inst_Sqrt),
-    cInstEntryCPU("not",       &cHardwareCPU::Inst_Not),
+    tInstLibEntry<tMethod>("shift-r", &cHardwareCPU::Inst_ShiftR, nInstFlag::DEFAULT, "Shift bits in ?BX? right by one (divide by two)"),
+    tInstLibEntry<tMethod>("shift-l", &cHardwareCPU::Inst_ShiftL, nInstFlag::DEFAULT, "Shift bits in ?BX? left by one (multiply by two)"),
+    tInstLibEntry<tMethod>("bit-1", &cHardwareCPU::Inst_Bit1),
+    tInstLibEntry<tMethod>("set-num", &cHardwareCPU::Inst_SetNum),
+    tInstLibEntry<tMethod>("val-grey", &cHardwareCPU::Inst_ValGrey),
+    tInstLibEntry<tMethod>("val-dir", &cHardwareCPU::Inst_ValDir),
+    tInstLibEntry<tMethod>("val-add-p", &cHardwareCPU::Inst_ValAddP),
+    tInstLibEntry<tMethod>("val-fib", &cHardwareCPU::Inst_ValFib),
+    tInstLibEntry<tMethod>("val-poly-c", &cHardwareCPU::Inst_ValPolyC),
+    tInstLibEntry<tMethod>("inc", &cHardwareCPU::Inst_Inc, nInstFlag::DEFAULT, "Increment ?BX? by one"),
+    tInstLibEntry<tMethod>("dec", &cHardwareCPU::Inst_Dec, nInstFlag::DEFAULT, "Decrement ?BX? by one"),
+    tInstLibEntry<tMethod>("zero", &cHardwareCPU::Inst_Zero, 0, "Set ?BX? to zero"),
+    tInstLibEntry<tMethod>("neg", &cHardwareCPU::Inst_Neg),
+    tInstLibEntry<tMethod>("square", &cHardwareCPU::Inst_Square),
+    tInstLibEntry<tMethod>("sqrt", &cHardwareCPU::Inst_Sqrt),
+    tInstLibEntry<tMethod>("not", &cHardwareCPU::Inst_Not),
     
-    cInstEntryCPU("add",       &cHardwareCPU::Inst_Add, true,
-                  "Add BX to CX and place the result in ?BX?"),
-    cInstEntryCPU("sub",       &cHardwareCPU::Inst_Sub, true,
-                  "Subtract CX from BX and place the result in ?BX?"),
-    cInstEntryCPU("mult",      &cHardwareCPU::Inst_Mult, false,
-                  "Multiple BX by CX and place the result in ?BX?"),
-    cInstEntryCPU("div",       &cHardwareCPU::Inst_Div, false,
-                  "Divide BX by CX and place the result in ?BX?"),
-    cInstEntryCPU("mod",       &cHardwareCPU::Inst_Mod),
-    cInstEntryCPU("nand",      &cHardwareCPU::Inst_Nand, true,
-                  "Nand BX by CX and place the result in ?BX?"),
-    cInstEntryCPU("nor",       &cHardwareCPU::Inst_Nor),
-    cInstEntryCPU("and",       &cHardwareCPU::Inst_And),
-    cInstEntryCPU("order",     &cHardwareCPU::Inst_Order),
-    cInstEntryCPU("xor",       &cHardwareCPU::Inst_Xor),
+    tInstLibEntry<tMethod>("add", &cHardwareCPU::Inst_Add, nInstFlag::DEFAULT, "Add BX to CX and place the result in ?BX?"),
+    tInstLibEntry<tMethod>("sub", &cHardwareCPU::Inst_Sub, nInstFlag::DEFAULT, "Subtract CX from BX and place the result in ?BX?"),
+    tInstLibEntry<tMethod>("mult", &cHardwareCPU::Inst_Mult, 0, "Multiple BX by CX and place the result in ?BX?"),
+    tInstLibEntry<tMethod>("div", &cHardwareCPU::Inst_Div, 0, "Divide BX by CX and place the result in ?BX?"),
+    tInstLibEntry<tMethod>("mod", &cHardwareCPU::Inst_Mod),
+    tInstLibEntry<tMethod>("nand", &cHardwareCPU::Inst_Nand, nInstFlag::DEFAULT, "Nand BX by CX and place the result in ?BX?"),
+    tInstLibEntry<tMethod>("nor", &cHardwareCPU::Inst_Nor),
+    tInstLibEntry<tMethod>("and", &cHardwareCPU::Inst_And),
+    tInstLibEntry<tMethod>("order", &cHardwareCPU::Inst_Order),
+    tInstLibEntry<tMethod>("xor", &cHardwareCPU::Inst_Xor),
     
-    cInstEntryCPU("copy",      &cHardwareCPU::Inst_Copy),
-    cInstEntryCPU("read",      &cHardwareCPU::Inst_ReadInst),
-    cInstEntryCPU("write",     &cHardwareCPU::Inst_WriteInst),
-    cInstEntryCPU("stk-read",  &cHardwareCPU::Inst_StackReadInst),
-    cInstEntryCPU("stk-writ",  &cHardwareCPU::Inst_StackWriteInst),
+    tInstLibEntry<tMethod>("copy", &cHardwareCPU::Inst_Copy),
+    tInstLibEntry<tMethod>("read", &cHardwareCPU::Inst_ReadInst),
+    tInstLibEntry<tMethod>("write", &cHardwareCPU::Inst_WriteInst),
+    tInstLibEntry<tMethod>("stk-read", &cHardwareCPU::Inst_StackReadInst),
+    tInstLibEntry<tMethod>("stk-writ", &cHardwareCPU::Inst_StackWriteInst),
     
-    cInstEntryCPU("compare",   &cHardwareCPU::Inst_Compare),
-    cInstEntryCPU("if-n-cpy",  &cHardwareCPU::Inst_IfNCpy),
-    cInstEntryCPU("allocate",  &cHardwareCPU::Inst_Allocate),
-    cInstEntryCPU("divide",    &cHardwareCPU::Inst_Divide),
-    cInstEntryCPU("divideRS",  &cHardwareCPU::Inst_DivideRS),
-    cInstEntryCPU("c-alloc",   &cHardwareCPU::Inst_CAlloc),
-    cInstEntryCPU("c-divide",  &cHardwareCPU::Inst_CDivide),
-    cInstEntryCPU("inject",    &cHardwareCPU::Inst_Inject),
-    cInstEntryCPU("inject-r",  &cHardwareCPU::Inst_InjectRand),
-    cInstEntryCPU("transposon",&cHardwareCPU::Inst_Transposon),
-    cInstEntryCPU("search-f",  &cHardwareCPU::Inst_SearchF),
-    cInstEntryCPU("search-b",  &cHardwareCPU::Inst_SearchB),
-    cInstEntryCPU("mem-size",  &cHardwareCPU::Inst_MemSize),
+    tInstLibEntry<tMethod>("compare", &cHardwareCPU::Inst_Compare),
+    tInstLibEntry<tMethod>("if-n-cpy", &cHardwareCPU::Inst_IfNCpy),
+    tInstLibEntry<tMethod>("allocate", &cHardwareCPU::Inst_Allocate),
+    tInstLibEntry<tMethod>("divide", &cHardwareCPU::Inst_Divide),
+    tInstLibEntry<tMethod>("divideRS", &cHardwareCPU::Inst_DivideRS),
+    tInstLibEntry<tMethod>("c-alloc", &cHardwareCPU::Inst_CAlloc),
+    tInstLibEntry<tMethod>("c-divide", &cHardwareCPU::Inst_CDivide),
+    tInstLibEntry<tMethod>("inject", &cHardwareCPU::Inst_Inject),
+    tInstLibEntry<tMethod>("inject-r", &cHardwareCPU::Inst_InjectRand),
+    tInstLibEntry<tMethod>("transposon", &cHardwareCPU::Inst_Transposon),
+    tInstLibEntry<tMethod>("search-f", &cHardwareCPU::Inst_SearchF),
+    tInstLibEntry<tMethod>("search-b", &cHardwareCPU::Inst_SearchB),
+    tInstLibEntry<tMethod>("mem-size", &cHardwareCPU::Inst_MemSize),
     
-    cInstEntryCPU("get",       &cHardwareCPU::Inst_TaskGet),
-    cInstEntryCPU("stk-get",   &cHardwareCPU::Inst_TaskStackGet),
-    cInstEntryCPU("stk-load",  &cHardwareCPU::Inst_TaskStackLoad),
-    cInstEntryCPU("put",       &cHardwareCPU::Inst_TaskPut),
-    cInstEntryCPU("put-clear", &cHardwareCPU::Inst_TaskPutClearInput), 
-    cInstEntryCPU("put-reset", &cHardwareCPU::Inst_TaskPutResetInputs), 
-    cInstEntryCPU("put-bcost2", &cHardwareCPU::Inst_TaskPutBonusCost2),
-    cInstEntryCPU("put-mcost2", &cHardwareCPU::Inst_TaskPutMeritCost2),
-    cInstEntryCPU("IO",        &cHardwareCPU::Inst_TaskIO, true,
-                  "Output ?BX?, and input new number back into ?BX?"),
-    cInstEntryCPU("IO-Feedback",        &cHardwareCPU::Inst_TaskIO_Feedback, true,\
-                  "Output ?BX?, and input new number back into ?BX?,  and push 1,0,\
-                  or -1 onto stack1 if merit increased, stayed the same, or decreased"),
-    cInstEntryCPU("match-strings", &cHardwareCPU::Inst_MatchStrings),
-    cInstEntryCPU("sell", &cHardwareCPU::Inst_Sell),
-    cInstEntryCPU("buy", &cHardwareCPU::Inst_Buy),
-    cInstEntryCPU("send",      &cHardwareCPU::Inst_Send),
-    cInstEntryCPU("receive",   &cHardwareCPU::Inst_Receive),
-    cInstEntryCPU("sense",     &cHardwareCPU::Inst_SenseLog2),
-    cInstEntryCPU("sense-unit",     &cHardwareCPU::Inst_SenseUnit),
-    cInstEntryCPU("sense-m100",     &cHardwareCPU::Inst_SenseMult100),
+    tInstLibEntry<tMethod>("get", &cHardwareCPU::Inst_TaskGet),
+    tInstLibEntry<tMethod>("stk-get", &cHardwareCPU::Inst_TaskStackGet),
+    tInstLibEntry<tMethod>("stk-load", &cHardwareCPU::Inst_TaskStackLoad),
+    tInstLibEntry<tMethod>("put", &cHardwareCPU::Inst_TaskPut),
+    tInstLibEntry<tMethod>("put-clear", &cHardwareCPU::Inst_TaskPutClearInput), 
+    tInstLibEntry<tMethod>("put-reset", &cHardwareCPU::Inst_TaskPutResetInputs), 
+    tInstLibEntry<tMethod>("put-bcost2", &cHardwareCPU::Inst_TaskPutBonusCost2),
+    tInstLibEntry<tMethod>("put-mcost2", &cHardwareCPU::Inst_TaskPutMeritCost2),
+    tInstLibEntry<tMethod>("IO", &cHardwareCPU::Inst_TaskIO, nInstFlag::DEFAULT, "Output ?BX?, and input new number back into ?BX?"),
+    tInstLibEntry<tMethod>("IO-Feedback", &cHardwareCPU::Inst_TaskIO_Feedback, 0, "Output ?BX?, and input new number back into ?BX?,  and push 1,0,  or -1 onto stack1 if merit increased, stayed the same, or decreased"),
+    tInstLibEntry<tMethod>("match-strings", &cHardwareCPU::Inst_MatchStrings),
+    tInstLibEntry<tMethod>("sell", &cHardwareCPU::Inst_Sell),
+    tInstLibEntry<tMethod>("buy", &cHardwareCPU::Inst_Buy),
+    tInstLibEntry<tMethod>("send", &cHardwareCPU::Inst_Send),
+    tInstLibEntry<tMethod>("receive", &cHardwareCPU::Inst_Receive),
+    tInstLibEntry<tMethod>("sense", &cHardwareCPU::Inst_SenseLog2),
+    tInstLibEntry<tMethod>("sense-unit", &cHardwareCPU::Inst_SenseUnit),
+    tInstLibEntry<tMethod>("sense-m100", &cHardwareCPU::Inst_SenseMult100),
     
-    cInstEntryCPU("donate-rnd",  &cHardwareCPU::Inst_DonateRandom),
-    cInstEntryCPU("donate-kin",  &cHardwareCPU::Inst_DonateKin),
-    cInstEntryCPU("donate-edt",  &cHardwareCPU::Inst_DonateEditDist),
-    cInstEntryCPU("donate-NUL",  &cHardwareCPU::Inst_DonateNULL),
+    tInstLibEntry<tMethod>("donate-rnd", &cHardwareCPU::Inst_DonateRandom),
+    tInstLibEntry<tMethod>("donate-kin", &cHardwareCPU::Inst_DonateKin),
+    tInstLibEntry<tMethod>("donate-edt", &cHardwareCPU::Inst_DonateEditDist),
+    tInstLibEntry<tMethod>("donate-NUL", &cHardwareCPU::Inst_DonateNULL),
     
-    cInstEntryCPU("rotate-l",  &cHardwareCPU::Inst_RotateL),
-    cInstEntryCPU("rotate-r",  &cHardwareCPU::Inst_RotateR),
+    tInstLibEntry<tMethod>("rotate-l", &cHardwareCPU::Inst_RotateL),
+    tInstLibEntry<tMethod>("rotate-r", &cHardwareCPU::Inst_RotateR),
     
-    cInstEntryCPU("set-cmut",  &cHardwareCPU::Inst_SetCopyMut),
-    cInstEntryCPU("mod-cmut",  &cHardwareCPU::Inst_ModCopyMut),
+    tInstLibEntry<tMethod>("set-cmut", &cHardwareCPU::Inst_SetCopyMut),
+    tInstLibEntry<tMethod>("mod-cmut", &cHardwareCPU::Inst_ModCopyMut),
     
     // Threading instructions
-    cInstEntryCPU("fork-th",   &cHardwareCPU::Inst_ForkThread),
-    cInstEntryCPU("kill-th",   &cHardwareCPU::Inst_KillThread),
-    cInstEntryCPU("id-th",     &cHardwareCPU::Inst_ThreadID),
+    tInstLibEntry<tMethod>("fork-th", &cHardwareCPU::Inst_ForkThread),
+    tInstLibEntry<tMethod>("kill-th", &cHardwareCPU::Inst_KillThread),
+    tInstLibEntry<tMethod>("id-th", &cHardwareCPU::Inst_ThreadID),
     
     // Head-based instructions
-    cInstEntryCPU("h-alloc",   &cHardwareCPU::Inst_MaxAlloc, true,
-                  "Allocate maximum allowed space"),
-    cInstEntryCPU("h-divide",  &cHardwareCPU::Inst_HeadDivide, true,
-                  "Divide code between read and write heads."),
-    cInstEntryCPU("h-divide1RS",  &cHardwareCPU::Inst_HeadDivide1RS, true,
-		  "Divide code between read and write heads, at most one mutation on divide, resample if reverted."),
-    cInstEntryCPU("h-divide2RS",  &cHardwareCPU::Inst_HeadDivide2RS, true,
-                  "Divide code between read and write heads, at most two mutations on divide, resample if reverted."),
-    cInstEntryCPU("h-divideRS",  &cHardwareCPU::Inst_HeadDivideRS, true,
-                  "Divide code between read and write heads, resample if reverted."),
-    cInstEntryCPU("h-read",    &cHardwareCPU::Inst_HeadRead),
-    cInstEntryCPU("h-write",   &cHardwareCPU::Inst_HeadWrite),
-    cInstEntryCPU("h-copy",    &cHardwareCPU::Inst_HeadCopy, true,
-                  "Copy from read-head to write-head; advance both"),
-    cInstEntryCPU("h-search",  &cHardwareCPU::Inst_HeadSearch, true,
-                  "Find complement template and make with flow head"),
-    cInstEntryCPU("h-push",    &cHardwareCPU::Inst_HeadPush),
-    cInstEntryCPU("h-pop",     &cHardwareCPU::Inst_HeadPop),
-    cInstEntryCPU("set-head",  &cHardwareCPU::Inst_SetHead),
-    cInstEntryCPU("adv-head",  &cHardwareCPU::Inst_AdvanceHead),
-    cInstEntryCPU("mov-head",  &cHardwareCPU::Inst_MoveHead, true,
-                  "Move head ?IP? to the flow head"),
-    cInstEntryCPU("jmp-head",  &cHardwareCPU::Inst_JumpHead, true,
-                  "Move head ?IP? by amount in CX register; CX = old pos."),
-    cInstEntryCPU("get-head",  &cHardwareCPU::Inst_GetHead, true,
-                  "Copy the position of the ?IP? head into CX"),
-    cInstEntryCPU("if-label",  &cHardwareCPU::Inst_IfLabel, true,
-                  "Execute next if we copied complement of attached label"),
-    cInstEntryCPU("if-label2",  &cHardwareCPU::Inst_IfLabel2, true,
-                  "If copied label compl., exec next inst; else SKIP W/NOPS"),
-    cInstEntryCPU("set-flow",  &cHardwareCPU::Inst_SetFlow, true,
-                  "Set flow-head to position in ?CX?"),
+    tInstLibEntry<tMethod>("h-alloc", &cHardwareCPU::Inst_MaxAlloc, nInstFlag::DEFAULT, "Allocate maximum allowed space"),
+    tInstLibEntry<tMethod>("h-divide", &cHardwareCPU::Inst_HeadDivide, nInstFlag::DEFAULT, "Divide code between read and write heads."),
+    tInstLibEntry<tMethod>("h-divide1RS", &cHardwareCPU::Inst_HeadDivide1RS, 0, "Divide code between read and write heads, at most one mutation on divide, resample if reverted."),
+    tInstLibEntry<tMethod>("h-divide2RS", &cHardwareCPU::Inst_HeadDivide2RS, 0, "Divide code between read and write heads, at most two mutations on divide, resample if reverted."),
+    tInstLibEntry<tMethod>("h-divideRS", &cHardwareCPU::Inst_HeadDivideRS, 0, "Divide code between read and write heads, resample if reverted."),
+    tInstLibEntry<tMethod>("h-read", &cHardwareCPU::Inst_HeadRead),
+    tInstLibEntry<tMethod>("h-write", &cHardwareCPU::Inst_HeadWrite),
+    tInstLibEntry<tMethod>("h-copy", &cHardwareCPU::Inst_HeadCopy, nInstFlag::DEFAULT, "Copy from read-head to write-head; advance both"),
+    tInstLibEntry<tMethod>("h-search", &cHardwareCPU::Inst_HeadSearch, nInstFlag::DEFAULT, "Find complement template and make with flow head"),
+    tInstLibEntry<tMethod>("h-push", &cHardwareCPU::Inst_HeadPush),
+    tInstLibEntry<tMethod>("h-pop", &cHardwareCPU::Inst_HeadPop),
+    tInstLibEntry<tMethod>("set-head", &cHardwareCPU::Inst_SetHead),
+    tInstLibEntry<tMethod>("adv-head", &cHardwareCPU::Inst_AdvanceHead),
+    tInstLibEntry<tMethod>("mov-head", &cHardwareCPU::Inst_MoveHead, nInstFlag::DEFAULT, "Move head ?IP? to the flow head"),
+    tInstLibEntry<tMethod>("jmp-head", &cHardwareCPU::Inst_JumpHead, nInstFlag::DEFAULT, "Move head ?IP? by amount in CX register; CX = old pos."),
+    tInstLibEntry<tMethod>("get-head", &cHardwareCPU::Inst_GetHead, nInstFlag::DEFAULT, "Copy the position of the ?IP? head into CX"),
+    tInstLibEntry<tMethod>("if-label", &cHardwareCPU::Inst_IfLabel, nInstFlag::DEFAULT, "Execute next if we copied complement of attached label"),
+    tInstLibEntry<tMethod>("if-label2", &cHardwareCPU::Inst_IfLabel2, 0, "If copied label compl., exec next inst; else SKIP W/NOPS"),
+    tInstLibEntry<tMethod>("set-flow", &cHardwareCPU::Inst_SetFlow, nInstFlag::DEFAULT, "Set flow-head to position in ?CX?"),
     
-    cInstEntryCPU("h-copy2",    &cHardwareCPU::Inst_HeadCopy2),
-    cInstEntryCPU("h-copy3",    &cHardwareCPU::Inst_HeadCopy3),
-    cInstEntryCPU("h-copy4",    &cHardwareCPU::Inst_HeadCopy4),
-    cInstEntryCPU("h-copy5",    &cHardwareCPU::Inst_HeadCopy5),
-    cInstEntryCPU("h-copy6",    &cHardwareCPU::Inst_HeadCopy6),
-    cInstEntryCPU("h-copy7",    &cHardwareCPU::Inst_HeadCopy7),
-    cInstEntryCPU("h-copy8",    &cHardwareCPU::Inst_HeadCopy8),
-    cInstEntryCPU("h-copy9",    &cHardwareCPU::Inst_HeadCopy9),
-    cInstEntryCPU("h-copy10",   &cHardwareCPU::Inst_HeadCopy10),
+    tInstLibEntry<tMethod>("h-copy2", &cHardwareCPU::Inst_HeadCopy2),
+    tInstLibEntry<tMethod>("h-copy3", &cHardwareCPU::Inst_HeadCopy3),
+    tInstLibEntry<tMethod>("h-copy4", &cHardwareCPU::Inst_HeadCopy4),
+    tInstLibEntry<tMethod>("h-copy5", &cHardwareCPU::Inst_HeadCopy5),
+    tInstLibEntry<tMethod>("h-copy6", &cHardwareCPU::Inst_HeadCopy6),
+    tInstLibEntry<tMethod>("h-copy7", &cHardwareCPU::Inst_HeadCopy7),
+    tInstLibEntry<tMethod>("h-copy8", &cHardwareCPU::Inst_HeadCopy8),
+    tInstLibEntry<tMethod>("h-copy9", &cHardwareCPU::Inst_HeadCopy9),
+    tInstLibEntry<tMethod>("h-copy10", &cHardwareCPU::Inst_HeadCopy10),
     
-    cInstEntryCPU("divide-sex",    &cHardwareCPU::Inst_HeadDivideSex),
-    cInstEntryCPU("divide-asex",   &cHardwareCPU::Inst_HeadDivideAsex),
+    tInstLibEntry<tMethod>("divide-sex", &cHardwareCPU::Inst_HeadDivideSex),
+    tInstLibEntry<tMethod>("divide-asex", &cHardwareCPU::Inst_HeadDivideAsex),
     
-    cInstEntryCPU("div-sex",    &cHardwareCPU::Inst_HeadDivideSex),
-    cInstEntryCPU("div-asex",   &cHardwareCPU::Inst_HeadDivideAsex),
-    cInstEntryCPU("div-asex-w",   &cHardwareCPU::Inst_HeadDivideAsexWait),
-    cInstEntryCPU("div-sex-MS",   &cHardwareCPU::Inst_HeadDivideMateSelect),
+    tInstLibEntry<tMethod>("div-sex", &cHardwareCPU::Inst_HeadDivideSex),
+    tInstLibEntry<tMethod>("div-asex", &cHardwareCPU::Inst_HeadDivideAsex),
+    tInstLibEntry<tMethod>("div-asex-w", &cHardwareCPU::Inst_HeadDivideAsexWait),
+    tInstLibEntry<tMethod>("div-sex-MS", &cHardwareCPU::Inst_HeadDivideMateSelect),
     
-    cInstEntryCPU("h-divide1",      &cHardwareCPU::Inst_HeadDivide1),
-    cInstEntryCPU("h-divide2",      &cHardwareCPU::Inst_HeadDivide2),
-    cInstEntryCPU("h-divide3",      &cHardwareCPU::Inst_HeadDivide3),
-    cInstEntryCPU("h-divide4",      &cHardwareCPU::Inst_HeadDivide4),
-    cInstEntryCPU("h-divide5",      &cHardwareCPU::Inst_HeadDivide5),
-    cInstEntryCPU("h-divide6",      &cHardwareCPU::Inst_HeadDivide6),
-    cInstEntryCPU("h-divide7",      &cHardwareCPU::Inst_HeadDivide7),
-    cInstEntryCPU("h-divide8",      &cHardwareCPU::Inst_HeadDivide8),
-    cInstEntryCPU("h-divide9",      &cHardwareCPU::Inst_HeadDivide9),
-    cInstEntryCPU("h-divide10",     &cHardwareCPU::Inst_HeadDivide10),
-    cInstEntryCPU("h-divide16",     &cHardwareCPU::Inst_HeadDivide16),
-    cInstEntryCPU("h-divide32",     &cHardwareCPU::Inst_HeadDivide32),
-    cInstEntryCPU("h-divide50",     &cHardwareCPU::Inst_HeadDivide50),
-    cInstEntryCPU("h-divide100",    &cHardwareCPU::Inst_HeadDivide100),
-    cInstEntryCPU("h-divide500",    &cHardwareCPU::Inst_HeadDivide500),
-    cInstEntryCPU("h-divide1000",   &cHardwareCPU::Inst_HeadDivide1000),
-    cInstEntryCPU("h-divide5000",   &cHardwareCPU::Inst_HeadDivide5000),
-    cInstEntryCPU("h-divide10000",  &cHardwareCPU::Inst_HeadDivide10000),
-    cInstEntryCPU("h-divide50000",  &cHardwareCPU::Inst_HeadDivide50000),
-    cInstEntryCPU("h-divide0.5",    &cHardwareCPU::Inst_HeadDivide0_5),
-    cInstEntryCPU("h-divide0.1",    &cHardwareCPU::Inst_HeadDivide0_1),
-    cInstEntryCPU("h-divide0.05",   &cHardwareCPU::Inst_HeadDivide0_05),
-    cInstEntryCPU("h-divide0.01",   &cHardwareCPU::Inst_HeadDivide0_01),
-    cInstEntryCPU("h-divide0.001",  &cHardwareCPU::Inst_HeadDivide0_001),
+    tInstLibEntry<tMethod>("h-divide1", &cHardwareCPU::Inst_HeadDivide1),
+    tInstLibEntry<tMethod>("h-divide2", &cHardwareCPU::Inst_HeadDivide2),
+    tInstLibEntry<tMethod>("h-divide3", &cHardwareCPU::Inst_HeadDivide3),
+    tInstLibEntry<tMethod>("h-divide4", &cHardwareCPU::Inst_HeadDivide4),
+    tInstLibEntry<tMethod>("h-divide5", &cHardwareCPU::Inst_HeadDivide5),
+    tInstLibEntry<tMethod>("h-divide6", &cHardwareCPU::Inst_HeadDivide6),
+    tInstLibEntry<tMethod>("h-divide7", &cHardwareCPU::Inst_HeadDivide7),
+    tInstLibEntry<tMethod>("h-divide8", &cHardwareCPU::Inst_HeadDivide8),
+    tInstLibEntry<tMethod>("h-divide9", &cHardwareCPU::Inst_HeadDivide9),
+    tInstLibEntry<tMethod>("h-divide10", &cHardwareCPU::Inst_HeadDivide10),
+    tInstLibEntry<tMethod>("h-divide16", &cHardwareCPU::Inst_HeadDivide16),
+    tInstLibEntry<tMethod>("h-divide32", &cHardwareCPU::Inst_HeadDivide32),
+    tInstLibEntry<tMethod>("h-divide50", &cHardwareCPU::Inst_HeadDivide50),
+    tInstLibEntry<tMethod>("h-divide100", &cHardwareCPU::Inst_HeadDivide100),
+    tInstLibEntry<tMethod>("h-divide500", &cHardwareCPU::Inst_HeadDivide500),
+    tInstLibEntry<tMethod>("h-divide1000", &cHardwareCPU::Inst_HeadDivide1000),
+    tInstLibEntry<tMethod>("h-divide5000", &cHardwareCPU::Inst_HeadDivide5000),
+    tInstLibEntry<tMethod>("h-divide10000", &cHardwareCPU::Inst_HeadDivide10000),
+    tInstLibEntry<tMethod>("h-divide50000", &cHardwareCPU::Inst_HeadDivide50000),
+    tInstLibEntry<tMethod>("h-divide0.5", &cHardwareCPU::Inst_HeadDivide0_5),
+    tInstLibEntry<tMethod>("h-divide0.1", &cHardwareCPU::Inst_HeadDivide0_1),
+    tInstLibEntry<tMethod>("h-divide0.05", &cHardwareCPU::Inst_HeadDivide0_05),
+    tInstLibEntry<tMethod>("h-divide0.01", &cHardwareCPU::Inst_HeadDivide0_01),
+    tInstLibEntry<tMethod>("h-divide0.001", &cHardwareCPU::Inst_HeadDivide0_001),
     
     // High-level instructions
-    cInstEntryCPU("repro",      &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-A",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-B",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-C",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-D",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-E",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-F",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-G",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-H",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-I",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-J",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-K",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-L",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-M",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-N",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-O",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-P",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-Q",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-R",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-S",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-T",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-U",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-V",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-W",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-X",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-Y",    &cHardwareCPU::Inst_Repro),
-    cInstEntryCPU("repro-Z",    &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-A", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-B", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-C", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-D", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-E", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-F", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-G", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-H", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-I", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-J", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-K", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-L", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-M", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-N", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-O", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-P", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-Q", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-R", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-S", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-T", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-U", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-V", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-W", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-X", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-Y", &cHardwareCPU::Inst_Repro),
+    tInstLibEntry<tMethod>("repro-Z", &cHardwareCPU::Inst_Repro),
 
-    cInstEntryCPU("IO-repro",   &cHardwareCPU::Inst_IORepro),
-    cInstEntryCPU("put-repro",  &cHardwareCPU::Inst_TaskPutRepro),
-    cInstEntryCPU("putc-repro", &cHardwareCPU::Inst_TaskPutClearInputRepro),
-    cInstEntryCPU("metabolize", &cHardwareCPU::Inst_TaskPutResetInputsRepro),        
+    tInstLibEntry<tMethod>("IO-repro", &cHardwareCPU::Inst_IORepro),
+    tInstLibEntry<tMethod>("put-repro", &cHardwareCPU::Inst_TaskPutRepro),
+    tInstLibEntry<tMethod>("putc-repro", &cHardwareCPU::Inst_TaskPutClearInputRepro),
+    tInstLibEntry<tMethod>("metabolize", &cHardwareCPU::Inst_TaskPutResetInputsRepro),        
 
-    cInstEntryCPU("spawn-deme", &cHardwareCPU::Inst_SpawnDeme),
+    tInstLibEntry<tMethod>("spawn-deme", &cHardwareCPU::Inst_SpawnDeme),
     
     // Suicide
-    cInstEntryCPU("kazi",	&cHardwareCPU::Inst_Kazi),
-    cInstEntryCPU("kazi5",	&cHardwareCPU::Inst_Kazi5),
-    cInstEntryCPU("die",	&cHardwareCPU::Inst_Die),
+    tInstLibEntry<tMethod>("kazi",	&cHardwareCPU::Inst_Kazi),
+    tInstLibEntry<tMethod>("kazi5", &cHardwareCPU::Inst_Kazi5),
+    tInstLibEntry<tMethod>("die", &cHardwareCPU::Inst_Die),
 	    
     // Placebo instructions
-    // nop-x (included with nops)
-    cInstEntryCPU("skip",      &cHardwareCPU::Inst_Skip)
+    tInstLibEntry<tMethod>("skip", &cHardwareCPU::Inst_Skip)
   };
   
   const int n_size = sizeof(s_n_array)/sizeof(cNOPEntryCPU);
@@ -399,15 +336,18 @@
     nop_mods[i] = s_n_array[i].nop_mod;
   }
   
-  const int f_size = sizeof(s_f_array)/sizeof(cInstEntryCPU);
+  const int f_size = sizeof(s_f_array)/sizeof(tInstLibEntry<tMethod>);
   static cString f_names[f_size];
-  static tHardwareCPUMethod functions[f_size];
+  static tMethod functions[f_size];
   for (int i = 0; i < f_size; i++){
     f_names[i] = s_f_array[i].name;
     functions[i] = s_f_array[i].function;
   }
+
+	const cInstruction error(255);
+	const cInstruction def(0);
   
-  return new cInstLibCPU(n_size, f_size, n_names, f_names, nop_mods, functions);
+  return new tInstLib<tMethod>(n_size, f_size, n_names, f_names, nop_mods, functions, error, def);
 }
 
 cHardwareCPU::cHardwareCPU(cWorld* world, cOrganism* in_organism, cInstSet* in_m_inst_set)

Modified: development/source/cpu/cHardwareCPU.h
===================================================================
--- development/source/cpu/cHardwareCPU.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareCPU.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -29,15 +29,9 @@
 #include <iomanip>
 #include <vector>
 
-#ifndef defs_h
-#include "defs.h"
-#endif
 #ifndef cCodeLabel_h
 #include "cCodeLabel.h"
 #endif
-#ifndef nHardware_h
-#include "nHardware.h"
-#endif
 #ifndef cHeadCPU_h
 #include "cHeadCPU.h"
 #endif
@@ -53,13 +47,23 @@
 #ifndef cString_h
 #include "cString.h"
 #endif
+#ifndef cStats_h
+#include "cStats.h"
+#endif
 #ifndef tArray_h
 #include "tArray.h"
 #endif
-#ifndef cStats_h
-#include "cStats.h"
+#ifndef tInstLib_h
+#include "tInstLib.h"
 #endif
 
+#ifndef defs_h
+#include "defs.h"
+#endif
+#ifndef nHardware_h
+#include "nHardware.h"
+#endif
+
 /**
  * Each organism may have a cHardwareCPU structure which keeps track of the
  * current status of all the components of the simulated hardware.
@@ -69,15 +73,15 @@
 
 class cInjectGenotype;
 class cInstLibBase;
-class cInstLibCPU;
 class cInstSet;
 class cMutation;
 class cOrganism;
 
+
 class cHardwareCPU : public cHardwareBase
 {
 public:
-  typedef bool (cHardwareCPU::*tHardwareCPUMethod)(cAvidaContext& ctx);
+  typedef bool (cHardwareCPU::*tMethod)(cAvidaContext& ctx);
 
 protected:
   // --------  Structure Constants  --------
@@ -115,12 +119,12 @@
 
     
   // --------  Static Variables  --------
-  static cInstLibCPU* s_inst_slib;
-  static cInstLibCPU* initInstLib(void);
+  static tInstLib<tMethod>* s_inst_slib;
+  static tInstLib<tMethod>* initInstLib(void);
 
 
   // --------  Member Variables  --------
-  tHardwareCPUMethod* m_functions;
+  tMethod* m_functions;
 
   cCPUMemory m_memory;          // Memory...
   cCPUStack m_global_stack;     // A stack that all threads share.
@@ -209,7 +213,7 @@
   cHardwareCPU(cWorld* world, cOrganism* in_organism, cInstSet* in_inst_set);
   explicit cHardwareCPU(const cHardwareCPU&);
   ~cHardwareCPU() { ; }
-  static cInstLibCPU* GetInstLib() { return s_inst_slib; }
+  static tInstLib<tMethod>* GetInstLib() { return s_inst_slib; }
   static cString GetDefaultInstFilename() { return "instset-classic.cfg"; }
 
   void Reset();

Modified: development/source/cpu/cHardwareExperimental.cc
===================================================================
--- development/source/cpu/cHardwareExperimental.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareExperimental.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -33,7 +33,6 @@
 #include "cGenotype.h"
 #include "cHardwareManager.h"
 #include "cHardwareTracer.h"
-#include "cInstLibCPU.h"
 #include "cInstSet.h"
 #include "cMutation.h"
 #include "cMutationLib.h"

Modified: development/source/cpu/cHardwareExperimental.h
===================================================================
--- development/source/cpu/cHardwareExperimental.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareExperimental.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -86,7 +86,7 @@
   static const int NUM_REGISTERS = 4;
   static const int NUM_HEADS = nHardware::NUM_HEADS >= NUM_REGISTERS ? nHardware::NUM_HEADS : NUM_REGISTERS;
   enum tRegisters { REG_AX = 0, REG_BX, REG_CX, REG_DX, REG_EX, REG_FX };
-  static const int NUM_NOPS = 4;
+  static const int NUM_NOPS = NUM_REGISTERS;
   
   // --------  Data Structures  --------
   struct cLocalThread

Modified: development/source/cpu/cHardwareManager.cc
===================================================================
--- development/source/cpu/cHardwareManager.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareManager.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -29,42 +29,38 @@
 #include "cHardwareSMT.h"
 #include "cHardwareTransSMT.h"
 #include "cInitFile.h"
-#include "cInstLibCPU.h"
 #include "cInstSet.h"
 #include "cWorld.h"
 #include "cWorldDriver.h"
 #include "tDictionary.h"
 
 cHardwareManager::cHardwareManager(cWorld* world)
-: m_world(world), m_inst_set(world), m_type(world->GetConfig().HARDWARE_TYPE.Get()) /*, m_testres(world) */
+: m_world(world), m_type(world->GetConfig().HARDWARE_TYPE.Get()) /*, m_testres(world) */
 {
-  LoadInstSet(world->GetConfig().INST_SET.Get());
-}
+  cString filename = world->GetConfig().INST_SET.Get();
 
-void cHardwareManager::LoadInstSet(cString filename)
-{
   // Setup the instruction library and collect the default filename
   cString default_filename;
 	switch (m_type)
 	{
 		case HARDWARE_TYPE_CPU_ORIGINAL:
-      m_inst_set.SetInstLib(cHardwareCPU::GetInstLib());
+      m_inst_set = new cInstSet(world, cHardwareCPU::GetInstLib());
 			default_filename = cHardwareCPU::GetDefaultInstFilename();
 			break;
 		case HARDWARE_TYPE_CPU_SMT:
-      m_inst_set.SetInstLib(cHardwareSMT::GetInstLib());
+      m_inst_set = new cInstSet(world, cHardwareSMT::GetInstLib());
 			default_filename = cHardwareSMT::GetDefaultInstFilename();
 			break;
 		case HARDWARE_TYPE_CPU_TRANSSMT:
-      m_inst_set.SetInstLib(cHardwareTransSMT::GetInstLib());
+      m_inst_set = new cInstSet(world, cHardwareTransSMT::GetInstLib());
 			default_filename = cHardwareTransSMT::GetDefaultInstFilename();
 			break;
 		case HARDWARE_TYPE_CPU_EXPERIMENTAL:
-      m_inst_set.SetInstLib(cHardwareExperimental::GetInstLib());
+      m_inst_set = new cInstSet(world, cHardwareExperimental::GetInstLib());
 			default_filename = cHardwareExperimental::GetDefaultInstFilename();
 			break;
 		default:
-			default_filename = "unknown";
+      m_world->GetDriver().RaiseFatalException(1, "Unknown/Unsupported HARDWARE_TYPE specified");
   }
   
   if (filename == "" || filename == "-") {
@@ -82,12 +78,12 @@
   file.Compress();
   
   tDictionary<int> nop_dict;
-  for(int i = 0; i < m_inst_set.GetInstLib()->GetNumNops(); i++)
-    nop_dict.Add(m_inst_set.GetInstLib()->GetNopName(i), i);
+  for(int i = 0; i < m_inst_set->GetInstLib()->GetNumNops(); i++)
+    nop_dict.Add(m_inst_set->GetInstLib()->GetNopName(i), i);
   
   tDictionary<int> inst_dict;
-  for(int i = 0; i < m_inst_set.GetInstLib()->GetSize(); i++)
-    inst_dict.Add(m_inst_set.GetInstLib()->GetName(i), i);
+  for(int i = 0; i < m_inst_set->GetInstLib()->GetSize(); i++)
+    inst_dict.Add(m_inst_set->GetInstLib()->GetName(i), i);
   
   for (int line_id = 0; line_id < file.GetNumLines(); line_id++) {
     cString cur_line = file.GetLine(line_id);
@@ -111,14 +107,14 @@
     // First, determine if it is a nop...
     int nop_mod = -1;
     if(nop_dict.Find(inst_name, nop_mod) == true) {
-      m_inst_set.AddNop(nop_mod, redundancy, ft_cost, cost, prob_fail, addl_time_cost);
+      m_inst_set->AddNop(nop_mod, redundancy, ft_cost, cost, prob_fail, addl_time_cost);
       continue;
     }
     
     // Otherwise, it had better be in the main dictionary...
     int fun_id = -1;
     if(inst_dict.Find(inst_name, fun_id) == true){
-      m_inst_set.AddInst(fun_id, redundancy, ft_cost, cost, prob_fail, addl_time_cost);
+      m_inst_set->AddInst(fun_id, redundancy, ft_cost, cost, prob_fail, addl_time_cost);
       continue;
     }
     
@@ -135,13 +131,13 @@
   switch (m_type)
   {
     case HARDWARE_TYPE_CPU_ORIGINAL:
-      return new cHardwareCPU(m_world, in_org, &m_inst_set);
+      return new cHardwareCPU(m_world, in_org, m_inst_set);
     case HARDWARE_TYPE_CPU_SMT:
-      return new cHardwareSMT(m_world, in_org, &m_inst_set);
+      return new cHardwareSMT(m_world, in_org, m_inst_set);
     case HARDWARE_TYPE_CPU_TRANSSMT:
-      return new cHardwareTransSMT(m_world, in_org, &m_inst_set);
+      return new cHardwareTransSMT(m_world, in_org, m_inst_set);
     case HARDWARE_TYPE_CPU_EXPERIMENTAL:
-      return new cHardwareExperimental(m_world, in_org, &m_inst_set);
+      return new cHardwareExperimental(m_world, in_org, m_inst_set);
     default:
       return NULL;
   }

Modified: development/source/cpu/cHardwareManager.h
===================================================================
--- development/source/cpu/cHardwareManager.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareManager.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -25,9 +25,6 @@
 #ifndef cHardwareManager_h
 #define cHardwareManager_h
 
-#ifndef cInstSet_h
-#include "cInstSet.h"
-#endif
 #ifndef cTestCPU_h
 #include "cTestCPU.h"
 #endif
@@ -38,11 +35,12 @@
 # endif
 #endif
 
-
-class cOrganism;
 class cHardwareBase;
+class cInstSet;
+class cOrganism;
 class cWorld;
 
+
 class cHardwareManager
 {
 #if USE_tMemTrack
@@ -50,12 +48,10 @@
 #endif
 private:
   cWorld* m_world;
-  cInstSet m_inst_set;
+  cInstSet* m_inst_set;
   int m_type;
 //  cTestResources m_testres;
   
-  void LoadInstSet(cString filename);
-  
   cHardwareManager(); // @not_implemented
   cHardwareManager(const cHardwareManager&); // @not_implemented
   cHardwareManager& operator=(const cHardwareManager&); // @not_implemented
@@ -68,8 +64,8 @@
   cHardwareBase* Create(cOrganism* in_org);
   cTestCPU* CreateTestCPU() { return new cTestCPU(m_world /*, &m_testres*/); }
 
-  const cInstSet& GetInstSet() const { return m_inst_set; }
-  cInstSet& GetInstSet() { return m_inst_set; }
+  const cInstSet& GetInstSet() const { return *m_inst_set; }
+  cInstSet& GetInstSet() { return *m_inst_set; }
 };
 
 

Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareSMT.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -36,6 +36,7 @@
 #include "cRandom.h"
 #include "cTestCPU.h"
 #include "cWorld.h"
+#include "tInstLibEntry.h"
 
 #include "functions.h"
 #include "nMutation.h"
@@ -60,62 +61,57 @@
     cNOPEntry("Nop-D", STACK_DX),
   };
 	
-  struct cInstEntry {
-    cInstEntry(const cString &name, tMethod function):name(name), function(function){}
-    cString name;
-    tMethod function;
-  };
-  static const cInstEntry s_f_array[] = {
-    cInstEntry("Nop-A", &cHardwareSMT::Inst_Nop),
-    cInstEntry("Nop-B", &cHardwareSMT::Inst_Nop),
-    cInstEntry("Nop-C", &cHardwareSMT::Inst_Nop),
-    cInstEntry("Nop-D", &cHardwareSMT::Inst_Nop),
-    cInstEntry("Alt", &cHardwareSMT::Inst_Alt),
-    cInstEntry("Val-Shift", &cHardwareSMT::Inst_ValShift),
-    cInstEntry("Val-Nand", &cHardwareSMT::Inst_ValNand),
-    cInstEntry("Val-Add", &cHardwareSMT::Inst_ValAdd),
-    cInstEntry("Val-Sub", &cHardwareSMT::Inst_ValSub),
-    cInstEntry("Val-Negate", &cHardwareSMT::Inst_ValNegate),
-    cInstEntry("Val-Mult", &cHardwareSMT::Inst_ValMult),
-    cInstEntry("Val-Div", &cHardwareSMT::Inst_ValDiv),
-    cInstEntry("Val-Mod", &cHardwareSMT::Inst_ValMod),
-    cInstEntry("Val-Inc", &cHardwareSMT::Inst_ValInc),
-    cInstEntry("Val-Dec", &cHardwareSMT::Inst_ValDec),
-    cInstEntry("Val-Copy", &cHardwareSMT::Inst_ValCopy),
-    cInstEntry("Val-Delete", &cHardwareSMT::Inst_ValDelete),
-    cInstEntry("Stack-Delete", &cHardwareSMT::Inst_StackDelete),
-    cInstEntry("Push-Next", &cHardwareSMT::Inst_PushNext),
-    cInstEntry("Push-Prev", &cHardwareSMT::Inst_PushPrev),
-    cInstEntry("Push-Comp", &cHardwareSMT::Inst_PushComp),
-    cInstEntry("Mem-Set", &cHardwareSMT::Inst_MemSet),
-    cInstEntry("Mem-Mark", &cHardwareSMT::Inst_MemMark),
-    cInstEntry("Mem-Split", &cHardwareSMT::Inst_MemSplit),
-    cInstEntry("Mem-Merge", &cHardwareSMT::Inst_MemMerge),
-    cInstEntry("Divide", &cHardwareSMT::Inst_Divide),
-    cInstEntry("Inject", &cHardwareSMT::Inst_Inject),
-    cInstEntry("Inst-Read", &cHardwareSMT::Inst_InstRead),
-    cInstEntry("Inst-Write", &cHardwareSMT::Inst_InstWrite),
-    cInstEntry("Block-Read", &cHardwareSMT::Inst_BlockRead),
-    cInstEntry("Block-Write", &cHardwareSMT::Inst_BlockWrite),
-    cInstEntry("If-Equal", &cHardwareSMT::Inst_IfEqual),
-    cInstEntry("If-Not-Equal", &cHardwareSMT::Inst_IfNotEqual),
-    cInstEntry("If-Less", &cHardwareSMT::Inst_IfLess),
-    cInstEntry("If-Greater", &cHardwareSMT::Inst_IfGreater),
-    cInstEntry("Head-Push", &cHardwareSMT::Inst_HeadPush),
-    cInstEntry("Head-Pop", &cHardwareSMT::Inst_HeadPop),
-    cInstEntry("Head-Move", &cHardwareSMT::Inst_HeadMove),
-    cInstEntry("Head-Set", &cHardwareSMT::Inst_HeadSet),
-    cInstEntry("Call", &cHardwareSMT::Inst_Call),
-    cInstEntry("Return", &cHardwareSMT::Inst_Return),
-    cInstEntry("Search", &cHardwareSMT::Inst_Search),
-    cInstEntry("Search-Mem", &cHardwareSMT::Inst_SearchMem),
-    cInstEntry("IO", &cHardwareSMT::Inst_IO),
-    cInstEntry("Thread-Set", &cHardwareSMT::Inst_ThreadSet),
-    cInstEntry("Thread-Get", &cHardwareSMT::Inst_ThreadGet),
+  static const tInstLibEntry<tMethod> s_f_array[] = {
+    tInstLibEntry<tMethod>("Nop-A", &cHardwareSMT::Inst_Nop),
+    tInstLibEntry<tMethod>("Nop-B", &cHardwareSMT::Inst_Nop),
+    tInstLibEntry<tMethod>("Nop-C", &cHardwareSMT::Inst_Nop),
+    tInstLibEntry<tMethod>("Nop-D", &cHardwareSMT::Inst_Nop),
+    tInstLibEntry<tMethod>("Alt", &cHardwareSMT::Inst_Alt),
+    tInstLibEntry<tMethod>("Val-Shift", &cHardwareSMT::Inst_ValShift),
+    tInstLibEntry<tMethod>("Val-Nand", &cHardwareSMT::Inst_ValNand),
+    tInstLibEntry<tMethod>("Val-Add", &cHardwareSMT::Inst_ValAdd),
+    tInstLibEntry<tMethod>("Val-Sub", &cHardwareSMT::Inst_ValSub),
+    tInstLibEntry<tMethod>("Val-Negate", &cHardwareSMT::Inst_ValNegate),
+    tInstLibEntry<tMethod>("Val-Mult", &cHardwareSMT::Inst_ValMult),
+    tInstLibEntry<tMethod>("Val-Div", &cHardwareSMT::Inst_ValDiv),
+    tInstLibEntry<tMethod>("Val-Mod", &cHardwareSMT::Inst_ValMod),
+    tInstLibEntry<tMethod>("Val-Inc", &cHardwareSMT::Inst_ValInc),
+    tInstLibEntry<tMethod>("Val-Dec", &cHardwareSMT::Inst_ValDec),
+    tInstLibEntry<tMethod>("Val-Copy", &cHardwareSMT::Inst_ValCopy),
+    tInstLibEntry<tMethod>("Val-Delete", &cHardwareSMT::Inst_ValDelete),
+    tInstLibEntry<tMethod>("Stack-Delete", &cHardwareSMT::Inst_StackDelete),
+    tInstLibEntry<tMethod>("Push-Next", &cHardwareSMT::Inst_PushNext),
+    tInstLibEntry<tMethod>("Push-Prev", &cHardwareSMT::Inst_PushPrev),
+    tInstLibEntry<tMethod>("Push-Comp", &cHardwareSMT::Inst_PushComp),
+    tInstLibEntry<tMethod>("Mem-Set", &cHardwareSMT::Inst_MemSet),
+    tInstLibEntry<tMethod>("Mem-Mark", &cHardwareSMT::Inst_MemMark),
+    tInstLibEntry<tMethod>("Mem-Split", &cHardwareSMT::Inst_MemSplit),
+    tInstLibEntry<tMethod>("Mem-Merge", &cHardwareSMT::Inst_MemMerge),
+    tInstLibEntry<tMethod>("Divide", &cHardwareSMT::Inst_Divide),
+    tInstLibEntry<tMethod>("Inject", &cHardwareSMT::Inst_Inject),
+    tInstLibEntry<tMethod>("Inst-Read", &cHardwareSMT::Inst_InstRead),
+    tInstLibEntry<tMethod>("Inst-Write", &cHardwareSMT::Inst_InstWrite),
+    tInstLibEntry<tMethod>("Block-Read", &cHardwareSMT::Inst_BlockRead),
+    tInstLibEntry<tMethod>("Block-Write", &cHardwareSMT::Inst_BlockWrite),
+    tInstLibEntry<tMethod>("If-Equal", &cHardwareSMT::Inst_IfEqual),
+    tInstLibEntry<tMethod>("If-Not-Equal", &cHardwareSMT::Inst_IfNotEqual),
+    tInstLibEntry<tMethod>("If-Less", &cHardwareSMT::Inst_IfLess),
+    tInstLibEntry<tMethod>("If-Greater", &cHardwareSMT::Inst_IfGreater),
+    tInstLibEntry<tMethod>("Head-Push", &cHardwareSMT::Inst_HeadPush),
+    tInstLibEntry<tMethod>("Head-Pop", &cHardwareSMT::Inst_HeadPop),
+    tInstLibEntry<tMethod>("Head-Move", &cHardwareSMT::Inst_HeadMove),
+    tInstLibEntry<tMethod>("Head-Set", &cHardwareSMT::Inst_HeadSet),
+    tInstLibEntry<tMethod>("Call", &cHardwareSMT::Inst_Call),
+    tInstLibEntry<tMethod>("Return", &cHardwareSMT::Inst_Return),
+    tInstLibEntry<tMethod>("Search", &cHardwareSMT::Inst_Search),
+    tInstLibEntry<tMethod>("Search-Mem", &cHardwareSMT::Inst_SearchMem),
+    tInstLibEntry<tMethod>("IO", &cHardwareSMT::Inst_IO),
+    tInstLibEntry<tMethod>("Thread-Set", &cHardwareSMT::Inst_ThreadSet),
+    tInstLibEntry<tMethod>("Thread-Get", &cHardwareSMT::Inst_ThreadGet),
     
-    cInstEntry("Apoptosis", &cHardwareSMT::Inst_Apoptosis),
+    tInstLibEntry<tMethod>("Apoptosis", &cHardwareSMT::Inst_Apoptosis),
     
-    cInstEntry("NULL", &cHardwareSMT::Inst_Nop) // Last Instruction Always NULL
+    tInstLibEntry<tMethod>("NULL", &cHardwareSMT::Inst_Nop) // Last Instruction Always NULL
   };
 	
   const int n_size = sizeof(s_n_array)/sizeof(cNOPEntry);
@@ -127,7 +123,7 @@
     nop_mods[i] = s_n_array[i].nop_mod;
   }
 	
-  const int f_size = sizeof(s_f_array)/sizeof(cInstEntry);
+  const int f_size = sizeof(s_f_array)/sizeof(tInstLibEntry<tMethod>);
   static cString f_names[f_size];
   static tMethod functions[f_size];
   for (int i = 0; i < f_size; i++){

Modified: development/source/cpu/cHardwareTransSMT.cc
===================================================================
--- development/source/cpu/cHardwareTransSMT.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHardwareTransSMT.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -36,6 +36,7 @@
 #include "cRandom.h"
 #include "cTestCPU.h"
 #include "cWorld.h"
+#include "tInstLibEntry.h"
 
 #include "functions.h"
 #include "nMutation.h"
@@ -60,61 +61,56 @@
     cNOPEntry("Nop-D", STACK_DX),
   };
 	
-  struct cInstEntry {
-    cInstEntry(const cString &name, tMethod function):name(name), function(function){}
-    cString name;
-    tMethod function;
-  };
-  static const cInstEntry s_f_array[] = {
-    cInstEntry("Nop-A", &cHardwareTransSMT::Inst_Nop), // 1
-    cInstEntry("Nop-B", &cHardwareTransSMT::Inst_Nop), // 2
-    cInstEntry("Nop-C", &cHardwareTransSMT::Inst_Nop), // 3
-    cInstEntry("Nop-D", &cHardwareTransSMT::Inst_Nop), // 4
-    cInstEntry("Nop-X", &cHardwareTransSMT::Inst_Nop), // 5
-    cInstEntry("Val-Shift-R", &cHardwareTransSMT::Inst_ShiftR), // 6
-    cInstEntry("Val-Shift-L", &cHardwareTransSMT::Inst_ShiftL), // 7
-    cInstEntry("Val-Nand", &cHardwareTransSMT::Inst_Val_Nand), // 8
-    cInstEntry("Val-Add", &cHardwareTransSMT::Inst_Val_Add), // 9
-    cInstEntry("Val-Sub", &cHardwareTransSMT::Inst_Val_Sub), // 10
-    cInstEntry("Val-Mult", &cHardwareTransSMT::Inst_Val_Mult), // 11
-    cInstEntry("Val-Div", &cHardwareTransSMT::Inst_Val_Div), // 12
-    cInstEntry("Val-Mod", &cHardwareTransSMT::Inst_Val_Mod), // 13
-    cInstEntry("Val-Inc", &cHardwareTransSMT::Inst_Val_Inc), // 14
-    cInstEntry("Val-Dec", &cHardwareTransSMT::Inst_Val_Dec), // 15
-    cInstEntry("SetMemory", &cHardwareTransSMT::Inst_SetMemory), // 16
-    cInstEntry("Divide", &cHardwareTransSMT::Inst_Divide), // 17
-    cInstEntry("Inst-Read", &cHardwareTransSMT::Inst_HeadRead), // 18
-    cInstEntry("Inst-Write", &cHardwareTransSMT::Inst_HeadWrite), // 19
-    cInstEntry("If-Equal", &cHardwareTransSMT::Inst_IfEqual), // 20
-    cInstEntry("If-Not-Equal", &cHardwareTransSMT::Inst_IfNotEqual), // 21
-    cInstEntry("If-Less", &cHardwareTransSMT::Inst_IfLess), // 22
-    cInstEntry("If-Greater", &cHardwareTransSMT::Inst_IfGreater), // 23
-    cInstEntry("Head-Push", &cHardwareTransSMT::Inst_HeadPush), // 24
-    cInstEntry("Head-Pop", &cHardwareTransSMT::Inst_HeadPop), // 25
-    cInstEntry("Head-Move", &cHardwareTransSMT::Inst_HeadMove), // 26
-    cInstEntry("Search", &cHardwareTransSMT::Inst_Search), // 27
-    cInstEntry("Push-Next", &cHardwareTransSMT::Inst_PushNext), // 28
-    cInstEntry("Push-Prev", &cHardwareTransSMT::Inst_PushPrevious), // 29
-    cInstEntry("Push-Comp", &cHardwareTransSMT::Inst_PushComplement), // 30
-    cInstEntry("Val-Delete", &cHardwareTransSMT::Inst_ValDelete), // 31
-    cInstEntry("Val-Copy", &cHardwareTransSMT::Inst_ValCopy), // 32
-    cInstEntry("IO", &cHardwareTransSMT::Inst_IO), // 33
-    cInstEntry("Thread-Create", &cHardwareTransSMT::Inst_ThreadCreate), // 34
-    cInstEntry("Thread-Cancel", &cHardwareTransSMT::Inst_ThreadCancel), // 35
-    cInstEntry("Thread-Kill", &cHardwareTransSMT::Inst_ThreadKill), // 36
-    cInstEntry("Inject", &cHardwareTransSMT::Inst_Inject), // 37
-    cInstEntry("Apoptosis", &cHardwareTransSMT::Inst_Apoptosis), // 38
-    cInstEntry("Net-Get", &cHardwareTransSMT::Inst_NetGet), // 39
-    cInstEntry("Net-Send", &cHardwareTransSMT::Inst_NetSend), // 40
-    cInstEntry("Net-Receive", &cHardwareTransSMT::Inst_NetReceive), // 41
-    cInstEntry("Net-Last", &cHardwareTransSMT::Inst_NetLast), // 42
-    cInstEntry("Rotate-Left", &cHardwareTransSMT::Inst_RotateLeft), // 43
-    cInstEntry("Rotate-Right", &cHardwareTransSMT::Inst_RotateRight), // 44
-    cInstEntry("Call-Flow", &cHardwareTransSMT::Inst_CallFlow), // 44
-    cInstEntry("Call-Label", &cHardwareTransSMT::Inst_CallLabel), // 44
-    cInstEntry("Return", &cHardwareTransSMT::Inst_Return), // 44
+  static const tInstLibEntry<tMethod> s_f_array[] = {
+    tInstLibEntry<tMethod>("Nop-A", &cHardwareTransSMT::Inst_Nop), // 1
+    tInstLibEntry<tMethod>("Nop-B", &cHardwareTransSMT::Inst_Nop), // 2
+    tInstLibEntry<tMethod>("Nop-C", &cHardwareTransSMT::Inst_Nop), // 3
+    tInstLibEntry<tMethod>("Nop-D", &cHardwareTransSMT::Inst_Nop), // 4
+    tInstLibEntry<tMethod>("Nop-X", &cHardwareTransSMT::Inst_Nop), // 5
+    tInstLibEntry<tMethod>("Val-Shift-R", &cHardwareTransSMT::Inst_ShiftR), // 6
+    tInstLibEntry<tMethod>("Val-Shift-L", &cHardwareTransSMT::Inst_ShiftL), // 7
+    tInstLibEntry<tMethod>("Val-Nand", &cHardwareTransSMT::Inst_Val_Nand), // 8
+    tInstLibEntry<tMethod>("Val-Add", &cHardwareTransSMT::Inst_Val_Add), // 9
+    tInstLibEntry<tMethod>("Val-Sub", &cHardwareTransSMT::Inst_Val_Sub), // 10
+    tInstLibEntry<tMethod>("Val-Mult", &cHardwareTransSMT::Inst_Val_Mult), // 11
+    tInstLibEntry<tMethod>("Val-Div", &cHardwareTransSMT::Inst_Val_Div), // 12
+    tInstLibEntry<tMethod>("Val-Mod", &cHardwareTransSMT::Inst_Val_Mod), // 13
+    tInstLibEntry<tMethod>("Val-Inc", &cHardwareTransSMT::Inst_Val_Inc), // 14
+    tInstLibEntry<tMethod>("Val-Dec", &cHardwareTransSMT::Inst_Val_Dec), // 15
+    tInstLibEntry<tMethod>("SetMemory", &cHardwareTransSMT::Inst_SetMemory), // 16
+    tInstLibEntry<tMethod>("Divide", &cHardwareTransSMT::Inst_Divide), // 17
+    tInstLibEntry<tMethod>("Inst-Read", &cHardwareTransSMT::Inst_HeadRead), // 18
+    tInstLibEntry<tMethod>("Inst-Write", &cHardwareTransSMT::Inst_HeadWrite), // 19
+    tInstLibEntry<tMethod>("If-Equal", &cHardwareTransSMT::Inst_IfEqual), // 20
+    tInstLibEntry<tMethod>("If-Not-Equal", &cHardwareTransSMT::Inst_IfNotEqual), // 21
+    tInstLibEntry<tMethod>("If-Less", &cHardwareTransSMT::Inst_IfLess), // 22
+    tInstLibEntry<tMethod>("If-Greater", &cHardwareTransSMT::Inst_IfGreater), // 23
+    tInstLibEntry<tMethod>("Head-Push", &cHardwareTransSMT::Inst_HeadPush), // 24
+    tInstLibEntry<tMethod>("Head-Pop", &cHardwareTransSMT::Inst_HeadPop), // 25
+    tInstLibEntry<tMethod>("Head-Move", &cHardwareTransSMT::Inst_HeadMove), // 26
+    tInstLibEntry<tMethod>("Search", &cHardwareTransSMT::Inst_Search), // 27
+    tInstLibEntry<tMethod>("Push-Next", &cHardwareTransSMT::Inst_PushNext), // 28
+    tInstLibEntry<tMethod>("Push-Prev", &cHardwareTransSMT::Inst_PushPrevious), // 29
+    tInstLibEntry<tMethod>("Push-Comp", &cHardwareTransSMT::Inst_PushComplement), // 30
+    tInstLibEntry<tMethod>("Val-Delete", &cHardwareTransSMT::Inst_ValDelete), // 31
+    tInstLibEntry<tMethod>("Val-Copy", &cHardwareTransSMT::Inst_ValCopy), // 32
+    tInstLibEntry<tMethod>("IO", &cHardwareTransSMT::Inst_IO), // 33
+    tInstLibEntry<tMethod>("Thread-Create", &cHardwareTransSMT::Inst_ThreadCreate), // 34
+    tInstLibEntry<tMethod>("Thread-Cancel", &cHardwareTransSMT::Inst_ThreadCancel), // 35
+    tInstLibEntry<tMethod>("Thread-Kill", &cHardwareTransSMT::Inst_ThreadKill), // 36
+    tInstLibEntry<tMethod>("Inject", &cHardwareTransSMT::Inst_Inject), // 37
+    tInstLibEntry<tMethod>("Apoptosis", &cHardwareTransSMT::Inst_Apoptosis), // 38
+    tInstLibEntry<tMethod>("Net-Get", &cHardwareTransSMT::Inst_NetGet), // 39
+    tInstLibEntry<tMethod>("Net-Send", &cHardwareTransSMT::Inst_NetSend), // 40
+    tInstLibEntry<tMethod>("Net-Receive", &cHardwareTransSMT::Inst_NetReceive), // 41
+    tInstLibEntry<tMethod>("Net-Last", &cHardwareTransSMT::Inst_NetLast), // 42
+    tInstLibEntry<tMethod>("Rotate-Left", &cHardwareTransSMT::Inst_RotateLeft), // 43
+    tInstLibEntry<tMethod>("Rotate-Right", &cHardwareTransSMT::Inst_RotateRight), // 44
+    tInstLibEntry<tMethod>("Call-Flow", &cHardwareTransSMT::Inst_CallFlow), // 44
+    tInstLibEntry<tMethod>("Call-Label", &cHardwareTransSMT::Inst_CallLabel), // 44
+    tInstLibEntry<tMethod>("Return", &cHardwareTransSMT::Inst_Return), // 44
     
-    cInstEntry("NULL", &cHardwareTransSMT::Inst_Nop) // Last Instruction Always NULL
+    tInstLibEntry<tMethod>("NULL", &cHardwareTransSMT::Inst_Nop) // Last Instruction Always NULL
   };
 	
   const int n_size = sizeof(s_n_array)/sizeof(cNOPEntry);
@@ -126,7 +122,7 @@
     nop_mods[i] = s_n_array[i].nop_mod;
   }
 	
-  const int f_size = sizeof(s_f_array)/sizeof(cInstEntry);
+  const int f_size = sizeof(s_f_array)/sizeof(tInstLibEntry<tMethod>);
   static cString f_names[f_size];
   static tMethod functions[f_size];
   for (int i = 0; i < f_size; i++){

Modified: development/source/cpu/cHeadCPU.h
===================================================================
--- development/source/cpu/cHeadCPU.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cHeadCPU.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -162,7 +162,7 @@
 
 inline const cInstruction& cHeadCPU::GetNextInst() const
 {
-  return (AtEnd()) ? cInstSet::GetInstError() : GetMemory()[m_position + 1];
+  return (AtEnd()) ? m_hardware->GetInstSet().GetInstError() : GetMemory()[m_position + 1];
 }
 
 

Deleted: development/source/cpu/cInstLibCPU.h
===================================================================
--- development/source/cpu/cInstLibCPU.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cInstLibCPU.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -1,112 +0,0 @@
-/*
- *  cInstLibCPU.h
- *  Avida
- *
- *  Called "inst_lib_cpu.hh" prior to 11/30/05.
- *  Copyright 1999-2007 Michigan State University. All rights reserved.
- *
- *
- *  This program 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; version 2
- *  of the License.
- *
- *  This program is distributed in the hope that 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 this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- */
-
-#ifndef cInstLibCPU_h
-#define cInstLibCPU_h
-
-#ifndef cInstLibBase_h
-#include "cInstLibBase.h"
-#endif
-#ifndef cHardwareCPU_h
-#include "cHardwareCPU.h"
-#endif
-#ifndef cInstruction_h
-#include "cInstruction.h"
-#endif
-
-class cString;
-
-class cInstLibCPU : public cInstLibBase
-{
-private:
-  const size_t m_nopmods_array_size;
-  const size_t m_function_array_size;
-  cString *m_nopmod_names;
-  cString *m_function_names;
-  const int *m_nopmods;
-  cHardwareCPU::tHardwareCPUMethod *m_functions;
-  static const cInstruction inst_error;
-  static const cInstruction inst_default;
-
-protected:
-  friend class cHardwareCPU;
-  
-  cInstLibCPU(
-    size_t nopmod_array_size,
-    size_t function_array_size,
-    cString *nopmod_names,
-    cString *function_names,
-    const int *nopmods,
-    cHardwareCPU::tHardwareCPUMethod *functions
-  ):m_nopmods_array_size(nopmod_array_size),
-    m_function_array_size(function_array_size),
-    m_nopmod_names(nopmod_names),
-    m_function_names(function_names),
-    m_nopmods(nopmods),
-    m_functions(functions)
-  {}
-  cHardwareCPU::tHardwareCPUMethod *GetFunctions(void){ return m_functions; } 
-
-public:
-  const cString &GetName(const unsigned int id) {
-    assert(id < m_function_array_size);
-    return m_function_names[id];
-  }
-  const cString &GetNopName(const unsigned int id) {
-    assert(id < m_nopmods_array_size);
-    return m_nopmod_names[id];
-  }
-  int GetNopMod(const unsigned int id){
-    assert(id < m_nopmods_array_size);
-    return m_nopmods[id];
-  }
-  int GetNopMod(const cInstruction & inst){
-    return GetNopMod(inst.GetOp());
-  }
-  int GetSize(){ return m_function_array_size; }
-  int GetNumNops(){ return m_nopmods_array_size; }
-  cInstruction GetInst(const cString & in_name){
-    for (unsigned int i = 0; i < m_function_array_size; i++) {
-      if (m_function_names[i] == in_name) return cInstruction(i);
-    }
-    return cInstLibCPU::GetInstError();
-  }
-  const cInstruction GetInstDefault(){ return inst_default; }
-  const cInstruction GetInstError(){ return inst_error; }
-};
-
-
-#ifdef ENABLE_UNIT_TESTS
-namespace nInstLibCPU {
-  /**
-   * Run unit tests
-   *
-   * @param full Run full test suite; if false, just the fast tests.
-   **/
-  void UnitTests(bool full = false);
-}
-#endif  
-
-
-#endif

Modified: development/source/cpu/cInstSet.cc
===================================================================
--- development/source/cpu/cInstSet.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cInstSet.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -32,12 +32,6 @@
 using namespace std;
 
 
-// Initialize static variables
-const cInstruction cInstSet::inst_default(0);
-cInstruction cInstSet::inst_default2(0);
-cInstruction cInstSet::inst_error2(255);
-
-
 bool cInstSet::OK() const
 {
   assert(m_lib_name_map.GetSize() < 256);

Modified: development/source/cpu/cInstSet.h
===================================================================
--- development/source/cpu/cInstSet.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/cpu/cInstSet.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -58,7 +58,7 @@
 {
 public:
   cWorld* m_world;
-  cInstLibBase *m_inst_lib;
+  cInstLibBase* m_inst_lib;
   class cInstEntry {
   public:
     int lib_fun_id;
@@ -73,15 +73,14 @@
   tArray<int> m_mutation_chart;     // ID's represented by redundancy values.
 
   // Static components...
-  static cInstruction inst_error2;
-  static cInstruction inst_default2;
-  static const cInstruction inst_default;
+  cInstruction m_inst_error;
+  cInstruction m_inst_default;
   
-  
   cInstSet(); // @not_implemented
 
 public:
-  inline cInstSet(cWorld* world) : m_world(world) { ; }
+  inline cInstSet(cWorld* world, cInstLibBase* inst_lib) : m_world(world), m_inst_lib(inst_lib),
+    m_inst_error(inst_lib->GetInstError()), m_inst_default(inst_lib->GetInstDefault()) { ; }
   inline cInstSet(const cInstSet& is);
   inline ~cInstSet() { ; }
 
@@ -120,20 +119,13 @@
 
   // accessors for instruction library
   cInstLibBase* GetInstLib() { return m_inst_lib; }
-  void SetInstLib(cInstLibBase* inst_lib)
-  {
-    m_inst_lib = inst_lib;
-    inst_error2 = inst_lib->GetInstError();
-    inst_default2 = inst_lib->GetInstDefault();
-  }
 
   inline cInstruction GetInst(const cString& in_name) const;
   cString FindBestMatch(const cString& in_name) const;
   bool InstInSet(const cString& in_name) const;
 
-  // Static methods..
-  static const cInstruction& GetInstDefault() { return inst_default2; }
-  static const cInstruction & GetInstError() { return inst_error2; }
+  const cInstruction& GetInstDefault() const { return m_inst_default; }
+  const cInstruction& GetInstError() const { return m_inst_error; }
 };
 
 

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cEnvironment.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -29,6 +29,7 @@
 #include "cEnvReqs.h"
 #include "cHardwareManager.h"
 #include "cInitFile.h"
+#include "cInstSet.h"
 #include "nMutation.h"
 #include "cRandom.h"
 #include "cReaction.h"

Modified: development/source/main/cEnvironment.h
===================================================================
--- development/source/main/cEnvironment.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cEnvironment.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -26,9 +26,6 @@
 #ifndef cEnvironment_h
 #define cEnvironment_h
 
-#ifndef cInstSet_h
-#include "cInstSet.h"
-#endif
 #ifndef cMutationLib_h
 #include "cMutationLib.h"
 #endif
@@ -83,7 +80,6 @@
   cReactionLib reaction_lib;
   cMutationLib mutation_lib;
   cTaskLib m_tasklib;
-  cInstSet inst_set;
   cMutationRates mut_rates;
 
   int m_input_size;
@@ -155,13 +151,9 @@
   bool SetReactionInst(const cString& name, cString inst_name);
 };
 
-inline cEnvironment::cEnvironment(cWorld* world)
-  : m_world(world)
-  , m_tasklib(world)
-  , inst_set(world)
-  , m_input_size(INPUT_SIZE_DEFAULT)
-  , m_output_size(OUTPUT_SIZE_DEFAULT)
-  , m_true_rand(false)
+
+inline cEnvironment::cEnvironment(cWorld* world) : m_world(world) , m_tasklib(world),
+  m_input_size(INPUT_SIZE_DEFAULT), m_output_size(OUTPUT_SIZE_DEFAULT), m_true_rand(false)
 {
   mut_rates.Setup(world);
 }

Modified: development/source/main/cGenomeUtil.cc
===================================================================
--- development/source/main/cGenomeUtil.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cGenomeUtil.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -262,7 +262,7 @@
     cString cur_line = input_file.GetLine(line_num);
     new_genome[line_num] = inst_set.GetInst(cur_line);
     
-    if (new_genome[line_num] == cInstSet::GetInstError()) {
+    if (new_genome[line_num] == inst_set.GetInstError()) {
       // You're using the wrong instruction set!  YOU FOOL!
       if (success) {
         cerr << "Error: Cannot load organism '" << filename << "'" << endl;
@@ -294,7 +294,7 @@
     fp >> cur_line;
     new_genome[line_num] = inst_set.GetInst(cur_line);
     
-    if (new_genome[line_num] == cInstSet::GetInstError()) {
+    if (new_genome[line_num] == inst_set.GetInstError()) {
       // You're using the wrong instruction set!  YOU FOOL!
       cerr << "Cannot load creature from stream:" << endl
       << "       Unknown line: " << cur_line << endl;

Modified: development/source/main/cMxCodeArray.cc
===================================================================
--- development/source/main/cMxCodeArray.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cMxCodeArray.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -200,11 +200,8 @@
  **/
 void cMxCodeArray::Clear()
 {
-  int i;
-  for (i = 0; i < size; i++)
-    {
-      data[i] = cInstSet::GetInstDefault();
-    }
+  cInstruction def = m_world->GetHardwareManager().GetInstSet().GetInstDefault();
+  for (int i = 0; i < size; i++) data[i] = def;
 }
 
 /**

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cPhenotype.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -27,6 +27,7 @@
 
 #include "cEnvironment.h"
 #include "cHardwareManager.h"
+#include "cInstSet.h"
 #include "cReactionResult.h"
 #include "cTaskState.h"
 #include "cTools.h"

Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cStats.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -27,13 +27,15 @@
 
 #include "cDataFile.h"
 #include "cEnvironment.h"
-#include "functions.h"
+#include "cHardwareManager.h"
+#include "cInstSet.h"
 #include "cStringUtil.h"
-#include "tDataEntry.h"
 #include "cWorld.h"
 #include "cWorldDriver.h"
-#include "cHardwareManager.h"
+#include "tDataEntry.h"
 
+#include "functions.h"
+
 #include <float.h>
 #include <math.h>
 

Modified: development/source/main/cWorld.cc
===================================================================
--- development/source/main/cWorld.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/main/cWorld.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -30,6 +30,7 @@
 #include "cEnvironment.h"
 #include "cEventList.h"
 #include "cHardwareManager.h"
+#include "cInstSet.h"
 #include "cPopulation.h"
 #include "cStats.h"
 #include "cTestCPU.h"

Modified: development/source/targets/avida-viewer/cViewInfo.cc
===================================================================
--- development/source/targets/avida-viewer/cViewInfo.cc	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/targets/avida-viewer/cViewInfo.cc	2007-02-17 21:03:30 UTC (rev 1328)
@@ -27,7 +27,6 @@
 cViewInfo::cViewInfo(cWorld* world, cView_Base* view)
   : m_world(world)
   , m_view(view)
-  , alt_inst_set(world)
 {
   active_cell = NULL;
   pause_level = PAUSE_OFF;

Modified: development/source/targets/avida-viewer/cViewInfo.h
===================================================================
--- development/source/targets/avida-viewer/cViewInfo.h	2007-02-17 20:59:06 UTC (rev 1327)
+++ development/source/targets/avida-viewer/cViewInfo.h	2007-02-17 21:03:30 UTC (rev 1328)
@@ -64,7 +64,6 @@
 
   // Instruction Libraries.
   cInstSet const * saved_inst_set;
-  cInstSet alt_inst_set;
 
   // Symbol information
   cGenotype * genotype_chart[NUM_SYMBOLS];




More information about the Avida-cvs mailing list