[Avida-cvs] [Avida2-svn] r392 - in development: Avida.xcodeproj source/analyze source/main

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Nov 11 11:40:03 PST 2005


Author: brysonda
Date: 2005-11-11 14:40:03 -0500 (Fri, 11 Nov 2005)
New Revision: 392

Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/analyze/cAnalyze.cc
   development/source/analyze/cAnalyzeGenotype.cc
   development/source/analyze/cAnalyzeGenotype.h
   development/source/main/cAvidaDriver_Analyze.cc
   development/source/main/cAvidaDriver_Analyze.h
Log:
Fix some incorrectly merged changes.  Dramatically improve Xcode revision support via the RunScript build phase.  Revision support should now correctly rebuild avida.cc when the revision has changed, but not when the revision hasn't changed.  It should also now be using the actual checked out revision, rather than the repository's revision number.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2005-11-11 16:45:22 UTC (rev 391)
+++ development/Avida.xcodeproj/project.pbxproj	2005-11-11 19:40:03 UTC (rev 392)
@@ -2041,10 +2041,11 @@
 			inputPaths = (
 			);
 			outputPaths = (
+				"$(DERIVED_FILE_DIR)/revision.h",
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/bash;
-			shellScript = "mkdir -p $DERIVED_FILES_DIR\necho \"#ifndef revision_h\" > $DERIVED_FILES_DIR/revision.h\necho \"#define revision_h\" >> $DERIVED_FILES_DIR/revision.h\nif (test -x /usr/bin/svn)\nthen /usr/bin/svn status -qu | sed '$!d' | sed 's/Status against revision: *\\([0-9]*\\)/#define REVISION \"\\1\"/' >> $DERIVED_FILES_DIR/revision.h\nelif (test -x /usr/local/bin/svn)\nthen /usr/local/bin/svn status -qu | sed '$!d' | sed 's/Status against revision: *\\([0-9]*\\)/#define REVISION \"\\1\"/' >> $DERIVED_FILES_DIR/revision.h\nelif (test -x /usr/local/svn/bin/svn);\nthen /usr/local/svn/bin/svn status -qu | sed '$!d' | sed 's/Status against revision: *\\([0-9]*\\)/#define REVISION \"\\1\"/' >> $DERIVED_FILES_DIR/revision.h\nelse echo '#define REVISION \"???\"' >> $DERIVED_FILES_DIR/revision.h\nfi;\n\necho \"#endif\" >> $DERIVED_FILES_DIR/revision.h\n";
+			shellScript = "mkdir -p $DERIVED_FILE_DIR\nif (test -x /usr/bin/svn)\nthen svncmd=/usr/bin/svn\nelif (test -x /usr/local/bin/svn)\nthen svncmd=/usr/local/bin/svn\nelif (test -x /usr/local/svn/bin/svn)\nthen svncmd=/usr/local/svn/bin/svn\nelse\n  echo \"Warning: 'svn' not found, please install subversion\"\n  if [[ ! -f $DERIVED_FILE_DIR/revision.h ]]\n  then\n    echo \"#ifndef revision_h\" > $DERIVED_FILE_DIR/revision.h\n    echo \"#define revision_h\" >> $DERIVED_FILE_DIR/revision.h\n    echo \"#define REVISION \\\"???\\\"\" >> $DERIVED_FILE_DIR/revision.h\n    echo \"#endif\" >> $DERIVED_FILE_DIR/revision.h\n  fi\nfi\n\necho \"#ifndef revision_h\" > /tmp/newrev.tmp\necho \"#define revision_h\" >> /tmp/newrev.tmp\n$svncmd status -v Avida.xcodeproj/project.pbxproj | sed '1!d' | sed 's/[^ ]* *\\([0-9]*\\).*/#define REVISION \"\\1\"/' >> /tmp/newrev.tmp\necho \"#endif\" >> /tmp/newrev.tmp\n\nif [[ -f $DERIVED_FILE_DIR/revision.h ]]\nthen\n  revdiff=`diff $DERIVED_FILE_DIR!
 /revision.h /tmp/newrev.tmp`\nelse\n  revdiff=\"yes\"\nfi\n\nif [[ -n \"$revdiff\" ]]\nthen\n  echo \"New revision.h Generated\"\n  cp /tmp/newrev.tmp $DERIVED_FILE_DIR/revision.h\n  touch $SRCROOT/source/main/avida.cc\nfi\n\nrm /tmp/newrev.tmp\n";
 		};
 		704EAD9808FF3C1F005D5C24 /* ShellScript */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -2054,10 +2055,11 @@
 			inputPaths = (
 			);
 			outputPaths = (
+				"$(DERIVED_FILE_DIR)/revision.h",
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/bash;
-			shellScript = "mkdir -p $DERIVED_FILES_DIR\necho \"#ifndef revision_h\" > $DERIVED_FILES_DIR/revision.h\necho \"#define revision_h\" >> $DERIVED_FILES_DIR/revision.h\nif (test -x /usr/bin/svn)\nthen /usr/bin/svn status -qu | sed '$!d' | sed 's/Status against revision: *\\([0-9]*\\)/#define REVISION \"\\1\"/' >> $DERIVED_FILES_DIR/revision.h\nelif (test -x /usr/local/bin/svn)\nthen /usr/local/bin/svn status -qu | sed '$!d' | sed 's/Status against revision: *\\([0-9]*\\)/#define REVISION \"\\1\"/' >> $DERIVED_FILES_DIR/revision.h\nelif (test -x /usr/local/svn/bin/svn);\nthen /usr/local/svn/bin/svn status -qu | sed '$!d' | sed 's/Status against revision: *\\([0-9]*\\)/#define REVISION \"\\1\"/' >> $DERIVED_FILES_DIR/revision.h\nelse echo '#define REVISION \"???\"' >> $DERIVED_FILES_DIR/revision.h\nfi;\n\necho \"#endif\" >> $DERIVED_FILES_DIR/revision.h\n";
+			shellScript = "mkdir -p $DERIVED_FILE_DIR\nif (test -x /usr/bin/svn)\nthen svncmd=/usr/bin/svn\nelif (test -x /usr/local/bin/svn)\nthen svncmd=/usr/local/bin/svn\nelif (test -x /usr/local/svn/bin/svn)\nthen svncmd=/usr/local/svn/bin/svn\nelse\n  echo \"Warning: 'svn' not found, please install subversion\"\n  if [[ ! -f $DERIVED_FILE_DIR/revision.h ]]\n  then\n    echo \"#ifndef revision_h\" > $DERIVED_FILE_DIR/revision.h\n    echo \"#define revision_h\" >> $DERIVED_FILE_DIR/revision.h\n    echo \"#define REVISION \\\"???\\\"\" >> $DERIVED_FILE_DIR/revision.h\n    echo \"#endif\" >> $DERIVED_FILE_DIR/revision.h\n  fi\nfi\n\necho \"#ifndef revision_h\" > /tmp/newrev.tmp\necho \"#define revision_h\" >> /tmp/newrev.tmp\n$svncmd status -v Avida.xcodeproj/project.pbxproj | sed '1!d' | sed 's/[^ ]* *\\([0-9]*\\).*/#define REVISION \"\\1\"/' >> /tmp/newrev.tmp\necho \"#endif\" >> /tmp/newrev.tmp\n\nif [[ -f $DERIVED_FILE_DIR/revision.h ]]\nthen\n  revdiff=`diff $DERIVED_FILE_DIR!
 /revision.h /tmp/newrev.tmp`\nelse\n  revdiff=\"yes\"\nfi\n\nif [[ -n \"$revdiff\" ]]\nthen\n  echo \"New revision.h Generated\"\n  cp /tmp/newrev.tmp $DERIVED_FILE_DIR/revision.h\n  touch $SRCROOT/source/main/avida.cc\nfi\n\nrm /tmp/newrev.tmp\n";
 		};
 /* End PBXShellScriptBuildPhase section */
 

Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc	2005-11-11 16:45:22 UTC (rev 391)
+++ development/source/analyze/cAnalyze.cc	2005-11-11 19:40:03 UTC (rev 392)
@@ -3723,7 +3723,7 @@
           int cur_inst2 = base_genome[line2].GetOp();
           mod_genome[line1] = null_inst;
           mod_genome[line2] = null_inst;
-          cAnalyzeGenotype ko_genotype(mod_genome, ko_inst_set);
+          cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
           ko_genotype.Recalculate();
           
           double ko_fitness = ko_genotype.GetFitness();

Modified: development/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotype.cc	2005-11-11 16:45:22 UTC (rev 391)
+++ development/source/analyze/cAnalyzeGenotype.cc	2005-11-11 19:40:03 UTC (rev 392)
@@ -174,7 +174,7 @@
   // Calculate the base fitness for the genotype we're working with...
   // (This may not have been run already, and cost negligiably more time
   // considering the number of knockouts we need to do.
-  cAnalyzeGenotype base_genotype(genome, inst_set);
+  cAnalyzeGenotype base_genotype(m_world, genome, inst_set);
   base_genotype.Recalculate();      
   double base_fitness = base_genotype.GetFitness();
   
@@ -208,7 +208,7 @@
     // Save a copy of the current instruction and replace it with "NULL"
     int cur_inst = mod_genome[line_num].GetOp();
     mod_genome[line_num] = null_inst;
-    cAnalyzeGenotype ko_genotype(mod_genome, ko_inst_set);
+    cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
     ko_genotype.Recalculate();
     
     double ko_fitness = ko_genotype.GetFitness();
@@ -261,7 +261,7 @@
       int cur_inst2 = mod_genome[line2].GetOp();
       mod_genome[line1] = null_inst;
       mod_genome[line2] = null_inst;
-      cAnalyzeGenotype ko_genotype(mod_genome, ko_inst_set);
+      cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
       ko_genotype.Recalculate();
       
       double ko_fitness = ko_genotype.GetFitness();

Modified: development/source/analyze/cAnalyzeGenotype.h
===================================================================
--- development/source/analyze/cAnalyzeGenotype.h	2005-11-11 16:45:22 UTC (rev 391)
+++ development/source/analyze/cAnalyzeGenotype.h	2005-11-11 19:40:03 UTC (rev 392)
@@ -140,6 +140,7 @@
   }
 
   int CalcMaxGestation() const;
+  void CalcKnockouts(bool check_pairs=false) const;
   void CalcLandscape() const;
 public:
   cAnalyzeGenotype(cWorld* world, cString symbol_string, cInstSet & in_inst_set);

Modified: development/source/main/cAvidaDriver_Analyze.cc
===================================================================
--- development/source/main/cAvidaDriver_Analyze.cc	2005-11-11 16:45:22 UTC (rev 391)
+++ development/source/main/cAvidaDriver_Analyze.cc	2005-11-11 19:40:03 UTC (rev 392)
@@ -5,18 +5,11 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef AVIDA_DRIVER_ANALYZE_HH
 #include "cAvidaDriver_Analyze.h"
-#endif
 
-#ifndef ANALYZE_HH
 #include "cAnalyze.h"
-#endif
+#include "cWorld.h"
 
-#ifndef ENVIRONMENT_HH
-#include "cEnvironment.h"
-#endif
-
 #include <iostream>
 
 using namespace std;
@@ -30,6 +23,8 @@
 {
 }
 
+cAvidaDriver_Analyze::~cAvidaDriver_Analyze() { delete m_world; }
+
 void cAvidaDriver_Analyze::Run()
 {
   cout << "In analyze mode!!" << endl;

Modified: development/source/main/cAvidaDriver_Analyze.h
===================================================================
--- development/source/main/cAvidaDriver_Analyze.h	2005-11-11 16:45:22 UTC (rev 391)
+++ development/source/main/cAvidaDriver_Analyze.h	2005-11-11 19:40:03 UTC (rev 392)
@@ -22,7 +22,7 @@
   cWorld* m_world;
 public:
   cAvidaDriver_Analyze(cWorld* world, bool _interactive=false);
-  ~cAvidaDriver_Analyze() { delete m_world; }
+  ~cAvidaDriver_Analyze();
   
   virtual void Run();
 };




More information about the Avida-cvs mailing list