[avida-cvs] avida CVS commits: /current/source defs.hh /current/source/cpu hardware_4stack.cc

wisnelaw avida-cvs at alife.org
Fri Sep 26 00:26:30 PDT 2003


wisnelaw		Thu Sep 25 16:26:30 2003 EDT

  Modified files:              
    /avida/current/source	defs.hh 
    /avida/current/source/cpu	hardware_4stack.cc 
  Log:
  fixed a problem with the 4 stack inject command.
  
  
  
Index: avida/current/source/defs.hh
diff -u avida/current/source/defs.hh:1.32 avida/current/source/defs.hh:1.33
--- avida/current/source/defs.hh:1.32	Wed Sep 24 01:12:00 2003
+++ avida/current/source/defs.hh	Thu Sep 25 16:26:29 2003
@@ -163,6 +163,8 @@
 #define MIN_CREATURE_SIZE 8
 #define MAX_CREATURE_SIZE 2048
 
+#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 1
Index: avida/current/source/cpu/hardware_4stack.cc
diff -u avida/current/source/cpu/hardware_4stack.cc:1.12 avida/current/source/cpu/hardware_4stack.cc:1.13
--- avida/current/source/cpu/hardware_4stack.cc:1.12	Thu Aug  7 20:24:18 2003
+++ avida/current/source/cpu/hardware_4stack.cc	Thu Sep 25 16:26:30 2003
@@ -964,19 +964,22 @@
 {
   const int end_pos = GetHead(HEAD_WRITE).GetPosition();
   const int mem_space_used = GetHead(HEAD_WRITE).GetMemSpace();
-
+  
   // Make sure the creature will still be above the minimum size,
+  // TEMPORARY!  INJECTED CODE CAN 
   if (end_pos <= 0) {
     Fault(FAULT_LOC_INJECT, FAULT_TYPE_ERROR, "inject: no code to inject");
     return false; // (inject fails)
   }
   
-  if (end_pos < MIN_CREATURE_SIZE) {
+  if (end_pos < MIN_INJECT_SIZE) {
+    GetMemory(mem_space_used)=cGenome(ConvertToInstruction(mem_space_used)); 
     Fault(FAULT_LOC_INJECT, FAULT_TYPE_ERROR, "inject: new size too small");
     return false; // (inject fails)
   }
 
   GetMemory(mem_space_used).Resize(end_pos);
+
   cCPUMemory injected_code = GetMemory(mem_space_used);
 
   Inject_DoMutations(mut_multiplier, injected_code);






More information about the Avida-cvs mailing list