[Avida-SVN] r1456 - development/source/cpu

barrick at myxo.css.msu.edu barrick at myxo.css.msu.edu
Wed Apr 4 06:43:36 PDT 2007


Author: barrick
Date: 2007-04-04 09:43:36 -0400 (Wed, 04 Apr 2007)
New Revision: 1456

Modified:
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareCPU.h
Log:
Fixed promoter functions declared with "bool" return values that were not returning anything, causing problems on Windows.



Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2007-04-04 13:22:44 UTC (rev 1455)
+++ development/source/cpu/cHardwareCPU.cc	2007-04-04 13:43:36 UTC (rev 1456)
@@ -3590,13 +3590,13 @@
 {
   const int reg_used = FindModifiedRegister(REG_CX);
   GetHead(nHardware::HEAD_FLOW).Set(GetRegister(reg_used));
-return true; 
+  return true; 
 }
 
 //// Promoter Model ////
 
 // Starting at the current position reads a promoter pattern
-bool cHardwareCPU::GetPromoterPattern(tArray<int>& promoter)
+void cHardwareCPU::GetPromoterPattern(tArray<int>& promoter)
 {
   // For now a constant that defines behavior
   const int max_size = 6;
@@ -3609,18 +3609,13 @@
     count++;
     inst_ptr++;
     promoter.Push(inst_ptr.GetInst().GetOp());
-    // If this is the first line of the template, mark it executed.
-    //if (GetLabel().GetSize() <=	m_world->GetConfig().MAX_LABEL_EXE_SIZE.Get()) {
-    //  inst_ptr->SetFlagExecuted();
-    //}
   }
-
 }
 
 
 // Adjust the weight at promoter positions that match the downstream pattern
 // allowing wildcards and matching of instructions
-bool cHardwareCPU::RegulatePromoter(cAvidaContext& ctx, bool up)
+void cHardwareCPU::RegulatePromoter(cAvidaContext& ctx, bool up)
 {
   static cInstruction promoter_inst = GetInstSet().GetInst(cStringUtil::Stringf("promoter"));
 
@@ -3629,7 +3624,7 @@
 
   tArray<int> promoter;
   GetPromoterPattern(promoter);
-  if (promoter.GetSize() == 0) return true;
+  if (promoter.GetSize() == 0) return;
 
   // nop-A is a wildcard of length 1
   // nop-B is a wildcard of length 1
@@ -3678,7 +3673,7 @@
 }
 
 // Adjust the weight at promoter positions that match the downstream nop pattern
-bool cHardwareCPU::RegulatePromoterNop(cAvidaContext& ctx, bool up)
+void cHardwareCPU::RegulatePromoterNop(cAvidaContext& ctx, bool up)
 {
   static cInstruction promoter_inst = GetInstSet().GetInst(cStringUtil::Stringf("promoter"));
 
@@ -3688,7 +3683,7 @@
   ReadLabel();
   
   // Don't allow zero-length label matches. These are too powerful.
-  if (GetLabel().GetSize() == 0) return true;
+  if (GetLabel().GetSize() == 0) return;
  
   cHeadCPU search_head(IP());
   do {

Modified: development/source/cpu/cHardwareCPU.h
===================================================================
--- development/source/cpu/cHardwareCPU.h	2007-04-04 13:22:44 UTC (rev 1455)
+++ development/source/cpu/cHardwareCPU.h	2007-04-04 13:43:36 UTC (rev 1456)
@@ -512,13 +512,13 @@
   bool Inst_HeadDivide0_001(cAvidaContext& ctx);
 
   //// Promoter Model ////
-  bool GetPromoterPattern(tArray<int>& promoter);
-  bool RegulatePromoter(cAvidaContext& ctx, bool up);
-  bool Inst_UpRegulatePromoter(cAvidaContext& ctx) { RegulatePromoter(ctx, true); }
-  bool Inst_DownRegulatePromoter(cAvidaContext& ctx) { RegulatePromoter(ctx, false); }
-  bool RegulatePromoterNop(cAvidaContext& ctx, bool up);
-  bool Inst_UpRegulatePromoterNop(cAvidaContext& ctx) { RegulatePromoterNop(ctx, true); }
-  bool Inst_DownRegulatePromoterNop(cAvidaContext& ctx) { RegulatePromoterNop(ctx, false); }  
+  void GetPromoterPattern(tArray<int>& promoter);
+  void RegulatePromoter(cAvidaContext& ctx, bool up);
+  bool Inst_UpRegulatePromoter(cAvidaContext& ctx) { RegulatePromoter(ctx, true); return true; }
+  bool Inst_DownRegulatePromoter(cAvidaContext& ctx) { RegulatePromoter(ctx, false); return true; }
+  void RegulatePromoterNop(cAvidaContext& ctx, bool up);
+  bool Inst_UpRegulatePromoterNop(cAvidaContext& ctx) { RegulatePromoterNop(ctx, true); return true; }
+  bool Inst_DownRegulatePromoterNop(cAvidaContext& ctx) { RegulatePromoterNop(ctx, false); return true; }  
   bool Inst_UpRegulatePromoterNopDecay(cAvidaContext& ctx);
   bool Inst_DownRegulatePromoterNopDecay(cAvidaContext& ctx);
   bool Inst_Terminate(cAvidaContext& ctx);




More information about the Avida-cvs mailing list