[Avida-cvs] [avida-svn] r651 - in development/source: . classification cpu main

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri May 5 08:19:57 PDT 2006


Author: brysonda
Date: 2006-05-05 11:19:56 -0400 (Fri, 05 May 2006)
New Revision: 651

Modified:
   development/source/classification/cSpecies.cc
   development/source/cpu/cHardware4Stack.cc
   development/source/cpu/cHardware4Stack.h
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareCPU.h
   development/source/cpu/cHardwareSMT.cc
   development/source/cpu/cHardwareSMT.h
   development/source/cpu/cHeadCPU.cc
   development/source/cpu/cHeadMultiMem.cc
   development/source/cpu/cTestCPU.cc
   development/source/cpu/cTestCPU.h
   development/source/defs.h
   development/source/main/avida.cc
   development/source/main/cOrganism.cc
   development/source/main/cPopulation.cc
   development/source/main/cStats.cc
   development/source/main/cStats.h
Log:
Add additional feature tags (unit tests, memtrack, etc.) to the version string.

Clean up unused items in defs.h. Move various #define blocks over to enumerations.  Change various #ifdef's to #if's so that the feature settings can more easily be overridden via a build system.

Modified: development/source/classification/cSpecies.cc
===================================================================
--- development/source/classification/cSpecies.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/classification/cSpecies.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -53,7 +53,7 @@
     total_count += genotype_distance[i];
   }
 
-#ifdef TEST
+#ifdef SPECIES_TEST
   // Only print out the non-trivial species.
 
   if (total_count > 1) {

Modified: development/source/cpu/cHardware4Stack.cc
===================================================================
--- development/source/cpu/cHardware4Stack.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHardware4Stack.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -259,7 +259,7 @@
 , thread_id_chart(hardware_4stack.thread_id_chart)
 , cur_thread(hardware_4stack.cur_thread)
 , inst_cost(hardware_4stack.inst_cost)
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
 , inst_ft_cost(hardware_4stack.inst_ft_cost)
 , inst_remainder(hardware_4stack.inst_remainder)
 #endif
@@ -296,7 +296,7 @@
   // Reset all stacks (local and global)
   for(int i = 0; i < nHardware4Stack::NUM_STACKS; i++) Stack(i).Clear();
   
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // instruction cost arrays
   const int num_inst_cost = m_inst_set->GetSize();
   inst_cost.Resize(num_inst_cost);
@@ -330,7 +330,7 @@
     AdvanceIP() = true;
     IP().Adjust();
     
-#ifdef BREAKPOINTS
+#if BREAKPOINTS
     if (IP().FlagBreakpoint()) {
       organism->DoBreakpoint();
     }
@@ -377,7 +377,7 @@
 // should proceed.
 bool cHardware4Stack::SingleProcess_PayCosts(cAvidaContext& ctx, const cInstruction& cur_inst)
 {
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   assert(cur_inst.GetOp() < inst_cost.GetSize());
   
   // If first time cost hasn't been paid off...
@@ -423,7 +423,7 @@
   IP().SetFlagExecuted();
 	
   
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   // instruction execution count incremeneted
   organism->GetPhenotype().IncCurInstCount(actual_inst.GetOp());
 #endif
@@ -431,7 +431,7 @@
   // And execute it.
   const bool exec_success = (this->*(m_functions[inst_idx]))(ctx);
 	
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   // decremenet if the instruction was not executed successfully
   if (exec_success == false) {
     organism->GetPhenotype().DecCurInstCount(actual_inst.GetOp());
@@ -1230,7 +1230,7 @@
   // lineages need to be updated.
   Divide_TestFitnessMeasures(ctx);
   
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
     inst_ft_cost[i] = m_inst_set->GetFTCost(cInstruction(i));

Modified: development/source/cpu/cHardware4Stack.h
===================================================================
--- development/source/cpu/cHardware4Stack.h	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHardware4Stack.h	2006-05-05 15:19:56 UTC (rev 651)
@@ -83,7 +83,7 @@
   int cur_thread;
 
   // Instruction costs...
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   tArray<int> inst_cost;
   tArray<int> inst_ft_cost;
 #endif

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHardwareCPU.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -390,7 +390,7 @@
 , mal_active(hardware_cpu.mal_active)
 , advance_ip(hardware_cpu.advance_ip)
 , executedmatchstrings(hardware_cpu.executedmatchstrings)
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
 , inst_cost(hardware_cpu.inst_cost)
 , inst_ft_cost(hardware_cpu.inst_ft_cost)
 #endif
@@ -418,7 +418,7 @@
   mal_active = false;
   executedmatchstrings = false;
   
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // instruction cost arrays
   const int num_inst_cost = m_inst_set->GetSize();
   inst_cost.Resize(num_inst_cost);
@@ -457,7 +457,7 @@
     advance_ip = true;
     IP().Adjust();
     
-#ifdef BREAKPOINTS
+#if BREAKPOINTS
     if (IP().FlagBreakpoint()) {
       organism->DoBreakpoint();
     }
@@ -505,7 +505,7 @@
 // should proceed.
 bool cHardwareCPU::SingleProcess_PayCosts(cAvidaContext& ctx, const cInstruction& cur_inst)
 {
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   assert(cur_inst.GetOp() < inst_cost.GetSize());
   
   // If first time cost hasn't been paid off...
@@ -551,7 +551,7 @@
   IP().SetFlagExecuted();
 	
   
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   // instruction execution count incremeneted
   organism->GetPhenotype().IncCurInstCount(actual_inst.GetOp());
 #endif
@@ -559,7 +559,7 @@
   // And execute it.
   const bool exec_success = (this->*(m_functions[inst_idx]))(ctx);
 	
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   // decremenet if the instruction was not executed successfully
   if (exec_success == false) {
     organism->GetPhenotype().DecCurInstCount(actual_inst.GetOp());
@@ -1246,7 +1246,7 @@
   // lineages need to be updated.
   Divide_TestFitnessMeasures(ctx);
   
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
     inst_ft_cost[i] = m_inst_set->GetFTCost(cInstruction(i));
@@ -2064,7 +2064,7 @@
   // lineages need to be updated.
   Divide_TestFitnessMeasures(ctx);
   
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
     inst_ft_cost[i] = m_inst_set->GetFTCost(cInstruction(i));

Modified: development/source/cpu/cHardwareCPU.h
===================================================================
--- development/source/cpu/cHardwareCPU.h	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHardwareCPU.h	2006-05-05 15:19:56 UTC (rev 651)
@@ -87,7 +87,7 @@
   bool executedmatchstrings;	// Have we already executed the match strings instruction?
 
   // Instruction costs...
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   tArray<int> inst_cost;
   tArray<int> inst_ft_cost;
 #endif

Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHardwareSMT.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -157,7 +157,7 @@
 		Stack(i).Clear();
 	}
 	
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // instruction cost arrays
   const int num_inst_cost = m_inst_set->GetSize();
   inst_cost.Resize(num_inst_cost);
@@ -206,7 +206,7 @@
     AdvanceIP() = true;
     IP().Adjust();
 		
-#ifdef BREAKPOINTS
+#if BREAKPOINTS
     if (IP().FlagBreakpoint()) organism->DoBreakpoint();
 #endif
     
@@ -249,7 +249,7 @@
 // should proceed.
 bool cHardwareSMT::SingleProcess_PayCosts(cAvidaContext& ctx, const cInstruction& cur_inst)
 {
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   assert(cur_inst.GetOp() < inst_cost.GetSize());
 	
   // If first time cost hasn't been paid off...
@@ -295,7 +295,7 @@
   IP().SetFlagExecuted();
 	
 	
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   // instruction execution count incremeneted
   organism->GetPhenotype().IncCurInstCount(actual_inst.GetOp());
 #endif
@@ -303,7 +303,7 @@
   // And execute it.
   const bool exec_success = (this->*(m_functions[inst_idx]))(ctx);
 	
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   // decremenet if the instruction was not executed successfully
   if (exec_success == false) {
     organism->GetPhenotype().DecCurInstCount(actual_inst.GetOp());
@@ -1048,7 +1048,7 @@
   // lineages need to be updated.
   Divide_TestFitnessMeasures(ctx);
 	
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
     inst_ft_cost[i] = m_inst_set->GetFTCost(cInstruction(i));
@@ -1103,7 +1103,7 @@
 bool cHardwareSMT::Inst_ShiftR(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(dst);
 #else
   const int src = dst;
@@ -1118,7 +1118,7 @@
 bool cHardwareSMT::Inst_ShiftL(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(dst);
 #else
   const int src = dst;
@@ -1133,7 +1133,7 @@
 bool cHardwareSMT::Inst_Val_Nand(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op1 = FindModifiedStack(STACK_BX);
   const int op2 = FindModifiedNextStack(op1);
 #else
@@ -1148,7 +1148,7 @@
 bool cHardwareSMT::Inst_Val_Add(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op1 = FindModifiedStack(STACK_BX);
   const int op2 = FindModifiedNextStack(op1);
 #else
@@ -1163,7 +1163,7 @@
 bool cHardwareSMT::Inst_Val_Sub(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op1 = FindModifiedStack(STACK_BX);
   const int op2 = FindModifiedNextStack(op1);
 #else
@@ -1178,7 +1178,7 @@
 bool cHardwareSMT::Inst_Val_Mult(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op1 = FindModifiedStack(STACK_BX);
   const int op2 = FindModifiedNextStack(op1);
 #else
@@ -1193,7 +1193,7 @@
 bool cHardwareSMT::Inst_Val_Div(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op1 = FindModifiedStack(STACK_BX);
   const int op2 = FindModifiedNextStack(op1);
 #else
@@ -1216,7 +1216,7 @@
 bool cHardwareSMT::Inst_Val_Mod(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op1 = FindModifiedStack(STACK_BX);
   const int op2 = FindModifiedNextStack(op1);
 #else
@@ -1239,7 +1239,7 @@
 bool cHardwareSMT::Inst_Val_Inc(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(dst);
 #else
   const int src = dst;
@@ -1253,7 +1253,7 @@
 bool cHardwareSMT::Inst_Val_Dec(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(dst);
 #else
   const int src = dst;
@@ -1289,7 +1289,7 @@
 bool cHardwareSMT::Inst_HeadRead(cAvidaContext& ctx)
 {
   const int head_id = FindModifiedHead(nHardware::HEAD_READ);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int dst = FindModifiedStack(STACK_AX);
 #else
   const int dst = STACK_AX;
@@ -1318,7 +1318,7 @@
 bool cHardwareSMT::Inst_HeadWrite(cAvidaContext& ctx)
 {
   const int head_id = FindModifiedHead(nHardware::HEAD_WRITE);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(STACK_AX);
 #else
   const int src = STACK_AX;
@@ -1350,7 +1350,7 @@
 bool cHardwareSMT::Inst_IfEqual(cAvidaContext& ctx)      // Execute next if bx == ?cx?
 {
   const int op1 = FindModifiedStack(STACK_AX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op2 = FindModifiedNextStack(op1);
 #else
   const int op2 = FindNextStack(op1);
@@ -1363,7 +1363,7 @@
 bool cHardwareSMT::Inst_IfNotEqual(cAvidaContext& ctx)     // Execute next if bx != ?cx?
 {
   const int op1 = FindModifiedStack(STACK_AX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op2 = FindModifiedNextStack(op1);
 #else
   const int op2 = FindNextStack(op1);
@@ -1376,7 +1376,7 @@
 bool cHardwareSMT::Inst_IfLess(cAvidaContext& ctx)       // Execute next if ?bx? < ?cx?
 {
   const int op1 = FindModifiedStack(STACK_AX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op2 = FindModifiedNextStack(op1);
 #else
   const int op2 = FindNextStack(op1);
@@ -1389,7 +1389,7 @@
 bool cHardwareSMT::Inst_IfGreater(cAvidaContext& ctx)       // Execute next if bx > ?cx?
 {
   const int op1 = FindModifiedStack(STACK_AX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int op2 = FindModifiedNextStack(op1);
 #else
   const int op2 = FindNextStack(op1);
@@ -1402,7 +1402,7 @@
 bool cHardwareSMT::Inst_HeadPush(cAvidaContext& ctx)
 {
   const int head_used = FindModifiedHead(nHardware::HEAD_IP);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int dst = FindModifiedStack(STACK_BX);
 #else
   const int dst = STACK_BX;
@@ -1415,7 +1415,7 @@
 bool cHardwareSMT::Inst_HeadPop(cAvidaContext& ctx)
 {
   const int head_used = FindModifiedHead(nHardware::HEAD_IP);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(STACK_BX);
 #else
   const int src = STACK_BX;
@@ -1468,7 +1468,7 @@
 bool cHardwareSMT::Inst_PushNext(cAvidaContext& ctx) 
 {
   const int src = FindModifiedStack(STACK_AX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int dst = FindModifiedNextStack(src);
 #else
   const int dst = FindNextStack(src);
@@ -1481,7 +1481,7 @@
 bool cHardwareSMT::Inst_PushPrevious(cAvidaContext& ctx) 
 {
   const int src = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int dst = FindModifiedPreviousStack(src);
 #else
   const int dst = FindPreviousStack(src);
@@ -1494,7 +1494,7 @@
 bool cHardwareSMT::Inst_PushComplement(cAvidaContext& ctx) 
 {
   int src = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int dst = FindModifiedComplementStack(src);
 #else
   const int dst = FindComplementStack(src);
@@ -1515,7 +1515,7 @@
 bool cHardwareSMT::Inst_ValCopy(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(dst);
 #else
   const int src = dst;
@@ -1528,7 +1528,7 @@
 bool cHardwareSMT::Inst_IO(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int src = FindModifiedStack(dst);
 #else
   const int src = dst;
@@ -1609,7 +1609,7 @@
 bool cHardwareSMT::Inst_NetGet(cAvidaContext& ctx)
 {
   const int dst = FindModifiedStack(STACK_BX);
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   const int seq_dst = FindModifiedNextStack(dst);
 #else
   const int seq_dst = FindNextStack(dst);

Modified: development/source/cpu/cHardwareSMT.h
===================================================================
--- development/source/cpu/cHardwareSMT.h	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHardwareSMT.h	2006-05-05 15:19:56 UTC (rev 651)
@@ -108,7 +108,7 @@
   int m_cur_thread;
 	
   // Instruction costs...
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   tArray<int> inst_cost;
   tArray<int> inst_ft_cost;
 #endif

Modified: development/source/cpu/cHeadCPU.cc
===================================================================
--- development/source/cpu/cHeadCPU.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHeadCPU.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -183,7 +183,7 @@
 void cHeadCPU::SetInst(const cInstruction & value)
 {
   assert(cur_hardware != NULL);
-#ifdef WRITE_PROTECTION
+#if WRITE_PROTECTION
   if (main_hardware == cur_hardware) cur_hardware->GetMemory()[position] = value;
 #else
   cur_hardware->GetMemory()[position] = value;
@@ -195,7 +195,7 @@
 void cHeadCPU::InsertInst(const cInstruction & value)
 {
   assert(cur_hardware != NULL);
-#ifdef WRITE_PROTECTION
+#if WRITE_PROTECTION
   if (main_hardware == cur_hardware) cur_hardware->GetMemory().Insert(position, value);
 #else
   cur_hardware->GetMemory().Insert(position, value);
@@ -206,7 +206,7 @@
 void cHeadCPU::RemoveInst()
 {
   assert(cur_hardware != NULL);
-#ifdef WRITE_PROTECTION
+#if WRITE_PROTECTION
   if (main_hardware == cur_hardware) cur_hardware->GetMemory().Remove(position);
 #else
   cur_hardware->GetMemory().Remove(position);

Modified: development/source/cpu/cHeadMultiMem.cc
===================================================================
--- development/source/cpu/cHeadMultiMem.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cHeadMultiMem.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -108,7 +108,7 @@
 void cHeadMultiMem::SetInst(const cInstruction & value)
 {
   assert(cur_hardware != NULL);
-#ifdef WRITE_PROTECTION
+#if WRITE_PROTECTION
   if (main_hardware == cur_hardware) GetMemory()[position] = value;
 #else
   GetMemory()[position] = value;
@@ -119,7 +119,7 @@
 void cHeadMultiMem::InsertInst(const cInstruction & value)
 {
   assert(cur_hardware != NULL);
-#ifdef WRITE_PROTECTION
+#if WRITE_PROTECTION
   if (main_hardware == cur_hardware) GetMemory().Insert(position, value);
 #else
   GetMemory().Insert(position, value);
@@ -130,7 +130,7 @@
 void cHeadMultiMem::RemoveInst()
 {
   assert(cur_hardware != NULL);
-#ifdef WRITE_PROTECTION
+#if WRITE_PROTECTION
   if (main_hardware == cur_hardware) GetMemory().Remove(position);
 #else
   GetMemory().Remove(position);

Modified: development/source/cpu/cTestCPU.cc
===================================================================
--- development/source/cpu/cTestCPU.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cTestCPU.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -97,9 +97,6 @@
   // Determine how long this organism should be tested for...
   int time_allocated = m_world->GetConfig().TEST_CPU_TIME_MOD.Get() * organism.GetGenome().GetSize();
 
-  // Make sure this genome stands a chance...
-  if (TestIntegrity(organism.GetGenome()) == false)  time_allocated = 0;
-
   // Prepare the inputs...
   cur_input = 0;
   cur_receive = 0;
@@ -278,43 +275,3 @@
   test_info.PrintThreads();
   cTestCPU::TestGenome(ctx, test_info, genome);
 }
-
-
-bool cTestCPU::TestIntegrity(const cGenome & test_genome)
-{
-#ifdef QUICK_BASE_TEST_CPU
-  // This checks to make sure a 'copy', 'divide', and 'allocate' are all in
-  // the creatures, and if not doesn't even bother to test it.
-  static unsigned char copy_id  = inst_set->GetInstID("copy");
-  static unsigned char div_id   = inst_set->GetInstID("divide");
-  static unsigned char alloc_id = inst_set->GetInstID("allocate");
-#endif
-
-#ifdef QUICK_HEAD_TEST_CPU
-  // This checks to make sure a 'copy', 'divide', and 'allocate' are all in
-  // the creatures, and if not doesn't even bother to test it.
-  static unsigned char copy_id  = inst_set->GetInstID("h-copy");
-  static unsigned char div_id   = inst_set->GetInstID("h-divide");
-  static unsigned char alloc_id = inst_set->GetInstID("h-alloc");
-#endif
-
-
-#ifdef QUICK_TEST_CPU
-  bool copy_found = false;
-  bool div_found = false;
-  bool alloc_found = false;
-
-  for (int i = 0; i < test_genome.GetSize(); i++) {
-    if (test_genome[i].GetOp() == copy_id)  copy_found  = true;
-    if (test_genome[i].GetOp() == div_id)   div_found   = true;
-    if (test_genome[i].GetOp() == alloc_id) alloc_found = true;
-  }
-
-  if (copy_found == false || div_found == false || alloc_found == false) {
-    return false;
-  }
-#endif
-
-  return true;
-}
-

Modified: development/source/cpu/cTestCPU.h
===================================================================
--- development/source/cpu/cTestCPU.h	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/cpu/cTestCPU.h	2006-05-05 15:19:56 UTC (rev 651)
@@ -84,10 +84,6 @@
   void TestThreads(cAvidaContext& ctx, const cGenome& genome);
   void PrintThreads(cAvidaContext& ctx, const cGenome& genome);
 
-  // Test if a genome has any chance of being a replicator (i.e., in the
-  // default set, has an allocate, a copy, and a divide).
-  bool TestIntegrity(const cGenome & test_genome);
-
   inline int GetInput();
   inline int GetInputAt(int & input_pointer);
   inline int GetReceiveValue();

Modified: development/source/defs.h
===================================================================
--- development/source/defs.h	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/defs.h	2006-05-05 15:19:56 UTC (rev 651)
@@ -14,78 +14,42 @@
 #define VERSION "2.5.0"
 #define VERSION_TAG "Jedi"
 
-// -= Various view modes =-
-#define VIEW_NEWVIEWER
-// #define VIEW_VISTA
-// #define VIEW_PRIMITIVE
-// #define VIEW_EXTERNAL
-// #define VIEW_CURSES
-// #define VIEW_NCURSES
+// -= Various view modes
 // #define VIEW_ANSI
 
 
-// #define BREAKPOINTS
-// #define QUICK_BASE_TEST_CPU
-// #define QUICK_HEAD_TEST_CPU
-#define INSTRUCTION_COSTS
-#define INSTRUCTION_COUNT
-
-// -= Toggles =-      (define these to actually turn features on)
-
-#define SMT_FULLY_ASSOCIATIVE
-
-#define WRITE_PROTECTION
-// #define FATAL_ERRORS
-// #define FATAL_WARNINGS
-#define SINGLE_IO_BUFFER
-
-// Test to see if search approx equals size... value is +- tolerance
-// #define TEST_SEARCH_SIZE .25
-
-// #define DEBUG
-// #define DEBUG_CHECK_OK
-// #define DEBUG_MEMTRACK
-// #define INTEGRITY_CHECK
-// #define DEBUG_MEM_CHECK
-// #define TEST
-
-
-////// Compiler Compatability Stuff //////////
-
-// old compiler //
-//#define explicit
-//#define LONGINT int
-
-// snazzy compiler //
-#define LONGINT long int
-
-
-////// Don't change anything below this line. /////
-#ifdef QUICK_BASE_TEST_CPU
-#define QUICK_TEST_CPU
+// -= Configurable Features
+#ifndef BREAKPOINTS
+#define BREAKPOINTS 0
 #endif
-
-#ifdef QUICK_HEAD_TEST_CPU
-#define QUICK_TEST_CPU
+#ifndef INSTRUCTION_COSTS
+#define INSTRUCTION_COSTS 1
 #endif
-
-#ifdef VIEW_primitive
-#define VIEW_PRIMITIVE
+#ifndef INSTRUCTION_COUNT
+#define INSTRUCTION_COUNT 1
 #endif
-#ifdef VIEW_external
-#define VIEW_EXTERNAL
+#ifndef SMT_FULLY_ASSOCIATIVE
+#define SMT_FULLY_ASSOCIATIVE 1
 #endif
-#ifdef VIEW_curses
-#define VIEW_CURSES
+#ifndef WRITE_PROTECTION
+#define WRITE_PROTECTION 1
 #endif
-#ifdef VIEW_ncurses
-#define VIEW_NCURSES
+#ifndef FATAL_ERRORS
+#define FATAL_ERRORS 0
 #endif
-#ifdef VIEW_vista
-#define VIEW_VISTA
-#define VIEW_PRIMITIVE
+#ifndef FATAL_WARNINGS
+#define FATAL_WARNINGS 0
 #endif
 
+// #define SPECIES_TEST
+
+
+// -= Compiler Compatability Stuff
+#define LONGINT long int
+
+
+////// Don't change anything below this line. /////
+
 #ifdef VIEW_ANSI
 #define PLATFORM_WINDOWS     // enable to compile for Win32 console
 #define MSVC_COMPILER        // enable to compile with Microsoft VC++
@@ -116,37 +80,28 @@
  #endif
 #endif
 
-#define MAX_INT 4294967295
-#define MAX_INST_SET_SIZE 64
-
-// #ifndef FALSE
-//  #define FALSE 0
-//  #define TRUE !FALSE
-// #endif
-
 #ifndef NULL
  #define NULL 0
 #endif
 
-#define TOOLS_DIR tools
-#define CPU_DIR   cpu
-#define MAIN_DIR  main
-#define VIEW_DIR  viewers
+const int MIN_CREATURE_SIZE = 8;
+const int MAX_CREATURE_SIZE = 2048;
 
-#define MIN_CREATURE_SIZE 8
-#define MAX_CREATURE_SIZE 2048
+const int MIN_INJECT_SIZE = 8;
 
-#define MIN_INJECT_SIZE 8
-
 // Number of distinct input and outputs stored in the IOBufs (to test tasks)
-#define INPUT_BUF_SIZE  3
-#define OUTPUT_BUF_SIZE 3
-#define SEND_BUF_SIZE 3
-#define RECEIVE_BUF_SIZE 3
+const int INPUT_BUF_SIZE = 3;
+const int OUTPUT_BUF_SIZE = 3;
+const int SEND_BUF_SIZE = 3;
+const int RECEIVE_BUF_SIZE = 3;
 
-#define FILE_TYPE_TEXT 0
-#define FILE_TYPE_HTML 1
 
+enum tFileType
+{
+  FILE_TYPE_TEXT,
+  FILE_TYPE_HTML
+};
+
 enum tHARDWARE_TYPE
 {
 	HARDWARE_TYPE_CPU_ORIGINAL = 0,
@@ -154,41 +109,60 @@
 	HARDWARE_TYPE_CPU_SMT
 };
 
-#define SLICE_CONSTANT         0
-#define SLICE_PROB_MERIT       1
-#define SLICE_INTEGRATED_MERIT 2
+enum tTIMESLICE
+{
+  SLICE_CONSTANT = 0,
+  SLICE_PROB_MERIT,
+  SLICE_INTEGRATED_MERIT
+};
 
-#define POSITION_CHILD_RANDOM           0
-#define POSITION_CHILD_AGE              1
-#define POSITION_CHILD_MERIT            2
-#define POSITION_CHILD_EMPTY            3
-#define NUM_LOCAL_POSITION_CHILD        4
+enum tPOSITION_CHILD
+{
+  POSITION_CHILD_RANDOM = 0,
+  POSITION_CHILD_AGE,
+  POSITION_CHILD_MERIT,
+  POSITION_CHILD_EMPTY,
+  POSITION_CHILD_FULL_SOUP_RANDOM,
+  POSITION_CHILD_FULL_SOUP_ELDEST,
+  POSITION_CHILD_DEME_RANDOM
+};
+const int NUM_LOCAL_POSITION_CHILD = POSITION_CHILD_FULL_SOUP_RANDOM;
 
-#define POSITION_CHILD_FULL_SOUP_RANDOM 4
-#define POSITION_CHILD_FULL_SOUP_ELDEST 5
-#define POSITION_CHILD_DEME_RANDOM      6
+enum tDEATH_METHOD
+{
+  DEATH_METHOD_OFF = 0,
+  DEATH_METHOD_CONST,
+  DEATH_METHOD_MULTIPLE
+};
 
-#define DEATH_METHOD_OFF       0
-#define DEATH_METHOD_CONST     1
-#define DEATH_METHOD_MULTIPLE  2
+enum tALLOC_METHOD
+{
+  ALLOC_METHOD_DEFAULT = 0,
+  ALLOC_METHOD_NECRO,
+  ALLOC_METHOD_RANDOM
+};
 
-#define ALLOC_METHOD_DEFAULT   0
-#define ALLOC_METHOD_NECRO     1
-#define ALLOC_METHOD_RANDOM    2
+enum tDIVIDE_METHOD
+{
+  DIVIDE_METHOD_OFFSPRING = 0,
+  DIVIDE_METHOD_SPLIT,
+  DIVIDE_METHOD_BIRTH
+};
 
-#define DIVIDE_METHOD_OFFSPRING 0
-#define DIVIDE_METHOD_SPLIT     1
-#define DIVIDE_METHOD_BIRTH     2
+enum tGENERATION_INCREMENT
+{
+  GENERATION_INC_OFFSPRING = 0,
+  GENERATION_INC_BOTH
+};
 
-#define GENERATION_INC_OFFSPRING 0
-#define GENERATION_INC_BOTH      1
+enum tSIZE_MERIT
+{
+  SIZE_MERIT_OFF = 0,
+  SIZE_MERIT_COPIED,
+  SIZE_MERIT_EXECUTED,
+  SIZE_MERIT_FULL,
+  SIZE_MERIT_LEAST,
+  SIZE_MERIT_SQRT_LEAST
+};
 
-#define SIZE_MERIT_OFF         0
-#define SIZE_MERIT_COPIED      1
-#define SIZE_MERIT_EXECUTED    2
-#define SIZE_MERIT_FULL        3
-#define SIZE_MERIT_LEAST       4
-#define SIZE_MERIT_SQRT_LEAST  5
-
-
 #endif

Modified: development/source/main/avida.cc
===================================================================
--- development/source/main/avida.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/main/avida.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -38,21 +38,30 @@
 #ifdef DEBUG
   version += " debug";
 #endif
-#ifdef BREAKPOINTS
+#if BREAKPOINTS
   version += " breakp";
 #endif
 #ifdef EXECUTION_ERRORS
   version += " exec_err";
 #endif
-#ifdef INSTRUCTION_COSTS
+#if INSTRUCTION_COSTS
   version += " inst_cost";
 #endif
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   version += " inst_cnt";
 #endif
-#ifdef SMT_FULLY_ASSOCIATIVE
+#if SMT_FULLY_ASSOCIATIVE
   version += " smt_fa";
 #endif
+#if WRITE_PROTECTION
+  version += " wp";
+#endif
+#ifdef ENABLE_UNIT_TESTS
+  version += " ut";
+#endif
+#if USE_tMemTrack
+  version += " memt";
+#endif
   
   return version;
 }

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/main/cOrganism.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -60,7 +60,7 @@
   m_hardware = m_world->GetHardwareManager().Create(this);
   cpu_stats.Setup();
 
-  if (m_world->GetConfig().DEATH_METHOD.Get() > 0) {
+  if (m_world->GetConfig().DEATH_METHOD.Get() > DEATH_METHOD_OFF) {
     max_executed = m_world->GetConfig().AGE_LIMIT.Get();
     if (m_world->GetConfig().AGE_DEVIATION.Get() > 0.0) {
       max_executed += (int) (ctx.GetRandom().GetRandNormal() * m_world->GetConfig().AGE_DEVIATION.Get());
@@ -459,19 +459,19 @@
   (void) fault_type;
   (void) fault_desc;
 
-#ifdef FATAL_ERRORS
+#if FATAL_ERRORS
   if (fault_type == FAULT_TYPE_ERROR) {
     phenotype.IsFertile() = false;
   }
 #endif
 
-#ifdef FATAL_WARNINGS
+#if FATAL_WARNINGS
   if (fault_type == FAULT_TYPE_WARNING) {
     phenotype.IsFertile() = false;
   }
 #endif
 
-#ifdef BREAKPOINTS
+#if BREAKPOINTS
   phenotype.SetFault(fault_desc);
 #endif
 

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/main/cPopulation.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -1086,7 +1086,7 @@
   
   stats.ZeroTasks();
   
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   stats.ZeroInst();
 #endif
   
@@ -1142,7 +1142,7 @@
     stats.SumExeSize().Add(phenotype.GetExecutedSize());
     stats.SetGenoMapElement(i, organism->GetGenotype()->GetID());
     
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
     for (int j=0; j < m_world->GetNumInstructions(); j++) {
       stats.SumExeInst()[j].Add(organism->GetPhenotype().GetLastInstCount()[j]);
     }

Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/main/cStats.cc	2006-05-05 15:19:56 UTC (rev 651)
@@ -102,7 +102,7 @@
   task_last_max_quality.SetAll(0);
   task_exe_count.SetAll(0);
 
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   sum_exe_inst_array.Resize( m_world->GetNumInstructions() );
   ZeroInst();
 #endif
@@ -224,7 +224,7 @@
 }
 
 
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
 void cStats::ZeroInst()
 {
   for( int i=0; i < sum_exe_inst_array.GetSize(); i++ ){
@@ -836,7 +836,7 @@
   df.WriteComment( "Avida instruction execution data" );
   df.WriteTimeStamp();
 
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   df.Write( GetUpdate(), "Update" );
   for( int i=0; i < sum_exe_inst_array.GetSize(); i++ ){
     df.Write( (int) sum_exe_inst_array[i].Sum(), inst_names[i] );

Modified: development/source/main/cStats.h
===================================================================
--- development/source/main/cStats.h	2006-05-05 02:51:24 UTC (rev 650)
+++ development/source/main/cStats.h	2006-05-05 15:19:56 UTC (rev 651)
@@ -352,7 +352,7 @@
   cDoubleSum& SumExeSize()       { return sum_exe_size; }
   cDoubleSum& SumMemSize()       { return sum_mem_size; }
 
-#ifdef INSTRUCTION_COUNT
+#if INSTRUCTION_COUNT
   void ZeroInst();
 #endif
   tArray<cIntSum>& SumExeInst() { return sum_exe_inst_array; }




More information about the Avida-cvs mailing list