[Avida-cvs] [Avida2-svn] r291 - in branches/brysonda/source: cpu main tools

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Thu Aug 25 12:26:56 PDT 2005


Author: brysonda
Date: 2005-08-25 15:26:56 -0400 (Thu, 25 Aug 2005)
New Revision: 291

Modified:
   branches/brysonda/source/cpu/hardware_util.cc
   branches/brysonda/source/main/analyze.cc
   branches/brysonda/source/main/avida_driver_population.cc
   branches/brysonda/source/main/environment.cc
   branches/brysonda/source/main/inst_set.hh
   branches/brysonda/source/main/population.cc
   branches/brysonda/source/main/primitive.cc
   branches/brysonda/source/tools/init_file.cc
   branches/brysonda/source/tools/tools.cc
Log:
Clean up primitive startup debug messages

Modified: branches/brysonda/source/cpu/hardware_util.cc
===================================================================
--- branches/brysonda/source/cpu/hardware_util.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/cpu/hardware_util.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -94,7 +94,7 @@
     else
 		{
       cerr << "Error: Could not open instruction set '" << filename
-           << "'.  Halting." << endl;
+           << "'.  Exiting..." << endl;
       exit(1);
     }
   }
@@ -110,9 +110,6 @@
   for(int i = 0; i < inst_set.GetInstLib()->GetSize(); i++)
     inst_dict.Add(inst_set.GetInstLib()->GetName(i), i);
   
-  cout << "Instruction Library has " << inst_dict.GetSize()
-       << " instructions and " << nop_dict.GetSize() <<  " nops." << endl;
-  
   for (int line_id = 0; line_id < file.GetNumLines(); line_id++) {
     cString cur_line = file.GetLine(line_id);
     cString inst_name = cur_line.PopWord();
@@ -124,7 +121,7 @@
     // If this instruction has 0 redundancy, we don't want it!
     if (redundancy < 0) continue;
     if (redundancy > 256) {
-      cerr << "Error: Max redundancy is 256.  Resetting redundancy of \""
+      cerr << "Warning: Max redundancy is 256.  Resetting redundancy of \""
       << inst_name << "\" from " << redundancy << " to 256." << endl;
       redundancy = 256;
     }
@@ -148,12 +145,9 @@
     cerr << endl
       << "Error: Could not find instruction '" << inst_name << "'" << endl
       << "       (Best match = '"
-      << inst_dict.NearMatch(inst_name) << "')" << endl;
+      << inst_dict.NearMatch(inst_name) << "').  Exiting..." << endl;
     exit(1);
   }
-  
-  cerr << "Loaded Instruction Set \"" << filename
-    << "\" with " << inst_set.GetSize() << " instructions." << endl;
 }
 
 cInstSet & cHardwareUtil::DefaultInstSet(const cString & inst_filename)

Modified: branches/brysonda/source/main/analyze.cc
===================================================================
--- branches/brysonda/source/main/analyze.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/main/analyze.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -4821,7 +4821,7 @@
   
   // Make sure we have everything we need.
   if (batch[cur_batch].IsAligned() == false) {
-    cout << "  ERROR: sequences not aligned." << endl;
+    cout << "  Error: sequences not aligned." << endl;
     return;
   }
   

Modified: branches/brysonda/source/main/avida_driver_population.cc
===================================================================
--- branches/brysonda/source/main/avida_driver_population.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/main/avida_driver_population.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -38,9 +38,7 @@
 cAvidaDriver_Population::cAvidaDriver_Population(cEnvironment & environment, cChangeList * change_list)
   : population(NULL), event_manager(NULL), event_list(NULL)
 {
-  // Setup Population
-  cout << endl << "Initializing Population..." << endl;
-    
+  // Setup Population    
   cPopulationInterface default_interface;
   default_interface.SetFun_NewHardware(&cCallbackUtil::CB_NewHardware);
   default_interface.SetFun_Recycle(&cCallbackUtil::CB_RecycleHardware);
@@ -64,25 +62,18 @@
   default_interface.SetFun_UpdateMerit(&cCallbackUtil::CB_UpdateMerit);
 
   population = new cPopulation(default_interface, environment, change_list);
-  cout << "-- Population Loaded --" << endl << endl;
 
   //Setup Event List
-  cout << "Initializing Event Factory Manager..." << endl;
   event_manager = new cEventFactoryManager;
   cStats & stats = population->GetStats();
   event_list = new cEventList( event_manager, new cAvidaTriggers(stats) );
   
-  cout << "- Loading Factories" << endl;
   // in principle, one could add more than one event factory here.
   // however, this is not a good idea, because the automatic documentation
   // system cannot cope with this at this point. Claus
   event_manager->AddFactory(new cPopulationEventFactory(population));
-  cout << "-- Event Factory Manager Loaded --" << endl << endl;
 
-  cout << "Reading Event List File..." << endl;
   ReadEventListFile(cConfig::GetEventFilename());
-  event_list->PrintEventList();
-  cout << "-- End of Event List --" << endl << endl;
   
   // Make sure the directory 'genebank' exits!
   cTools::MkDir("genebank", true);

Modified: branches/brysonda/source/main/environment.cc
===================================================================
--- branches/brysonda/source/main/environment.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/main/environment.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -151,8 +151,6 @@
 
 bool cEnvironment::LoadReactionProcess(cReaction * reaction, cString desc)
 {
-  //  cerr << "ENV: Loading reaction process '" << desc << "'." << endl;
-
   cReactionProcess * new_process = reaction->AddProcess();
 
   // Loop through all entries in description.
@@ -251,8 +249,6 @@
 
 bool cEnvironment::LoadReactionRequisite(cReaction * reaction, cString desc)
 {
-  // cerr << "ENV: Loading reaction requisite '" << desc << "'." << endl;
-
   cReactionRequisite * new_requisite = reaction->AddRequisite();
 
   // Loop through all entries in description.
@@ -303,8 +299,6 @@
 
 bool cEnvironment::LoadResource(cString desc)
 {
-  cerr << "ENV: Loading resource '" << desc << "'." << endl;
-
   if (desc.GetSize() == 0) {
     cerr << "Warning: Resource line with no resources listed." << endl;
     return false;
@@ -435,7 +429,6 @@
 
   // If only a name was present, assume this reaction is a pre-declaration.
   if (desc.GetSize() == 0) {
-    // cerr << "ENV: Pre-declaring reaction '" << name << "'." << endl;
     return true;
   }
 
@@ -448,8 +441,6 @@
 
   // Finish loading in this reaction.
   const cString trigger = desc.PopWord();
-  cerr << "ENV: Loading reaction '" << name << "' with trigger '"
-       << trigger << "'." << endl;
 
   // Load the task trigger
   cTaskEntry * cur_task = task_lib.AddTask(trigger);
@@ -490,8 +481,6 @@
 
 bool cEnvironment::LoadMutation(cString desc)
 {
-  cerr << "ENV: Loading mutation '" << desc << "'." << endl;
-
   // Make sure this mutation has a description...
   if (desc.CountNumWords() < 5) {
     cerr << "Error: Each mutation must include a name, trigger, scope, type, and rate." << endl;
@@ -643,9 +632,6 @@
 
 bool cEnvironment::Load(const cString & filename)
 {
-  cerr << "--- ENVIRONMENT SETUP ---" << endl;
-  cerr << "ENV: Loading file '" << filename << "'." << endl;
-
   cInitFile infile(filename);
   if (infile.Good() == false) {
     cerr << "Error: Failed to load environment '" << filename << "'." << endl;
@@ -656,8 +642,6 @@
   infile.Close();
   infile.Compress();
 
-  // cerr << "ENV: found " << infile.GetNumLines() << " commands." << endl;
-
   for (int line_id = 0; line_id < infile.GetNumLines(); line_id++) {
     // Load the next line from the file.
     bool load_ok = LoadLine(infile.GetLine(line_id));
@@ -674,8 +658,6 @@
     }
   }
 
-  cerr << "--- FINISHED ENVIRONMENT SETUP---" << endl;
-
   return true;
 }
 

Modified: branches/brysonda/source/main/inst_set.hh
===================================================================
--- branches/brysonda/source/main/inst_set.hh	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/main/inst_set.hh	2005-08-25 19:26:56 UTC (rev 291)
@@ -182,7 +182,7 @@
   }
 
   // @CAO Hacking this to make sure we don't have defaults...
-  cerr << "ERROR: Unknown instruction '" << in_name << "'.  Halting." << endl;
+  cerr << "Error: Unknown instruction '" << in_name << "'.  Exiting..." << endl;
   exit(1);
 
 

Modified: branches/brysonda/source/main/population.cc
===================================================================
--- branches/brysonda/source/main/population.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/main/population.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -56,8 +56,6 @@
 , num_organisms(0)
 , sync_events(false)
 {
-  cout << "<cPopulation>" << endl;
-  
   // Setup the genebank.
   genebank = new cGenebank(stats);
   inject_genebank = new cInjectGenebank(stats);
@@ -98,6 +96,7 @@
   } else {
     cout << "Geometry: Unknown" << endl;
   }
+  cout << endl;
   
   cell_array.Resize(num_cells);
   resource_count.ResizeSpatialGrids(world_x, world_y);
@@ -167,7 +166,7 @@
   BuildTimeSlicer(change_list);
   
   if (SetupDemes() == false) {
-    cerr << "Error -- failed to setup demes.  Exiting." << endl;
+    cerr << "Error: Failed to setup demes.  Exiting..." << endl;
     exit(1);
   }
   
@@ -224,7 +223,7 @@
       
       ifstream fp(fname);
       if( !fp.good() ){
-        fprintf(stderr, "ERROR: Failed to load population file %s\n",fname());
+        fprintf(stderr, "Error: Failed to load population file %s. Exiting...\n",fname());
         exit(2);
       }
       LoadPopulation(fp);
@@ -1826,20 +1825,16 @@
 {
   switch (cConfig::GetSlicingMethod()) {
     case SLICE_CONSTANT:
-      cout << "...Building Constant Time Slicer..." << endl;
       schedule = new cConstSchedule(cell_array.GetSize());
       break;
     case SLICE_PROB_MERIT:
-      cout << "...Building Probablistic Time Slicer..." << endl;
       schedule = new cProbSchedule(cell_array.GetSize());
       break;
     case SLICE_INTEGRATED_MERIT:
-      cout << "...Building Integrated Time Slicer..." << endl;
       schedule = new cIntegratedSchedule(cell_array.GetSize());
       break;
     default:
-      cout << "...Requested Time Slicer not found, defaulting to Integrated..."
-      << endl;
+      cout << "Warning: Requested Time Slicer not found, defaulting to Integrated." << endl;
       schedule = new cIntegratedSchedule(cell_array.GetSize());
       break;
   }

Modified: branches/brysonda/source/main/primitive.cc
===================================================================
--- branches/brysonda/source/main/primitive.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/main/primitive.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -78,30 +78,15 @@
   signal(SIGINT, ExitAvida);
 
   // output copyright message
-  printf( "Avida %s\nCopyright (C) 1993-2003 California Institute of Technology.\n\n", AVIDA_VERSION );
-  printf( "Avida comes with ABSOLUTELY NO WARRANTY.\n" );
-  printf( "This is free software, and you are welcome to redistribute it\nunder certain conditions. See file COPYING for details.\n\n" );
+  cout << "Avida " << AVIDA_VERSION << endl;
+  cout << "----------------------------------------------------------------------" << endl;
+  cout << "Copyright (C) 1993-2003 California Institute of Technology." << endl;
+  cout << "Copyright (C) 1999-2005 Michigan State University." << endl << endl;
   
+  cout << "Avida comes with ABSOLUTELY NO WARRANTY." << endl;
+  cout << "This is free software, and you are welcome to redistribute it" << endl;
+  cout << "under certain conditions. See file COPYING for details." << endl << endl;
   
-  cout << "cHardwareCPU InstLib -"
-    << " size: " << cHardwareCPU::GetInstLib()->GetSize()
-    << " num nops: " << cHardwareCPU::GetInstLib()->GetNumNops() 
-    << " last inst name: " << cHardwareCPU::GetInstLib()->GetName(cHardwareCPU::GetInstLib()->GetSize() - 1)
-    << endl;
-	  
-  cout << "cHardware4Stack InstLib -"
-    << " size: " << cHardware4Stack::GetInstLib()->GetSize()
-    << " num nops: " << cHardware4Stack::GetInstLib()->GetNumNops() 
-    << " last inst name: " << cHardware4Stack::GetInstLib()->GetName(cHardware4Stack::GetInstLib()->GetSize() - 1)
-    << endl;
-  
-  cout << "cHardwareSMT InstLib -"
-    << " size: " << cHardwareSMT::GetInstLib()->GetSize()
-    << " num nops: " << cHardwareSMT::GetInstLib()->GetNumNops() 
-    << " last name: " << cHardwareSMT::GetInstLib()->GetName(cHardwareSMT::GetInstLib()->GetSize() - 1)
-    << endl << endl;
-  
-  
   // Initialize the configuration data...
   cConfig::InitGroupList();
   cConfig::Setup(argc, argv);
@@ -120,6 +105,8 @@
     cAvidaDriver_Base::main_driver = new cAvidaDriver_Population(environment);
   }
 
+  cout << endl;
+  
   cAvidaDriver_Base::main_driver->Run();
 
   // Exit Nicely

Modified: branches/brysonda/source/tools/init_file.cc
===================================================================
--- branches/brysonda/source/tools/init_file.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/tools/init_file.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -259,15 +259,14 @@
   for (int i = 0; i < line_array.GetSize(); i++) {
     if (line_array[i].used == false) {
       if (found == false) {
-	found = true;
-	cerr << "Warning unknown lines in input file '" << filename
-	     << "':" << endl;
+        found = true;
+        cerr << "Warning: unknown lines in input file '" << filename << "':" << endl;
       }
-      cerr << " " << line_array[i].line_num + 1
-	   << ": " << line_array[i].line
-	   << endl;
+      cerr << " " << line_array[i].line_num + 1 << ": " << line_array[i].line << endl;
     }
   }
+  
+  if (found == true) cerr << endl;
 
   return found;
 }

Modified: branches/brysonda/source/tools/tools.cc
===================================================================
--- branches/brysonda/source/tools/tools.cc	2005-08-25 18:43:56 UTC (rev 290)
+++ branches/brysonda/source/tools/tools.cc	2005-08-25 19:26:56 UTC (rev 291)
@@ -30,26 +30,26 @@
 
 bool cTools::MkDir(const cString & dirname, bool verbose)
 {
-  if (verbose) cout << "Checking for directory '" << dirname << "'..." << endl;
+  if (verbose) cout << "Checking for directory '" << dirname << "'..." << flush;
 
   FILE * fp = fopen ( dirname(), "r" );
   if (fp == 0) {
     if (errno == ENOENT) {
-      if (verbose) cout << "  ...not found.  Has to be created..." << endl;
+      if (verbose) cout << "  not found, creating..." << flush;
       if (mkdir( dirname(), (S_IRWXU|S_IRWXG|S_IRWXO) )) {
-	if (verbose) cerr << "  ...ERROR!  Failed to create directory '"
-			  << dirname << "'.  This may cause problems..."
-			  << endl;
-	return false;
+        if (verbose)
+          cerr << endl << "Warning: Failed to create directory '" << dirname << "'." << endl;
+        return false;
       }
 
-      if (verbose) cout << "  ...done!" << endl;
+      if (verbose) cout << " done." << endl;
       return true;
     }
 
-    if (verbose) cout << "  ...ERROR! -- Failed to open directory!  This may cause problems." << endl;
+    if (verbose) cout << "Warning: Failed to open '" << dirname << "'." << endl;
     return false;
   }
 
+  if (verbose) cout << " found." << endl;
   return true;
 }




More information about the Avida-cvs mailing list