[Avida-cvs] [Avida2-svn] r292 - in branches/brysonda/source: main tools viewers

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Thu Aug 25 12:42:44 PDT 2005


Author: brysonda
Date: 2005-08-25 15:42:44 -0400 (Thu, 25 Aug 2005)
New Revision: 292

Modified:
   branches/brysonda/source/main/population.cc
   branches/brysonda/source/main/primitive.cc
   branches/brysonda/source/tools/block_struct.cc
   branches/brysonda/source/tools/histogram.cc
   branches/brysonda/source/tools/indexed_block_struct.cc
   branches/brysonda/source/viewers/viewer.cc
Log:
Convert a number of printf statements to iostream equivalents

Modified: branches/brysonda/source/main/population.cc
===================================================================
--- branches/brysonda/source/main/population.cc	2005-08-25 19:26:56 UTC (rev 291)
+++ branches/brysonda/source/main/population.cc	2005-08-25 19:42:44 UTC (rev 292)
@@ -212,7 +212,7 @@
   // Load a saved population if one is provided.
   cString fname(cConfig::GetLoadPopFilename());
   if (fname != "") {
-    fprintf(stderr,"Loding Population from %s\n", fname());
+    cout << "Loading Population from " <<  fname() << endl;
     
     // If last three chars of filename are ".gz" , gunzip it first
     if (fname.Find(".gz") == fname.GetSize() - 3) {
@@ -223,7 +223,7 @@
       
       ifstream fp(fname);
       if( !fp.good() ){
-        fprintf(stderr, "Error: Failed to load population file %s. Exiting...\n",fname());
+        cerr << "Error: Failed to load population file " << fname() << ". Exiting...\n" << endl;
         exit(2);
       }
       LoadPopulation(fp);

Modified: branches/brysonda/source/main/primitive.cc
===================================================================
--- branches/brysonda/source/main/primitive.cc	2005-08-25 19:26:56 UTC (rev 291)
+++ branches/brysonda/source/main/primitive.cc	2005-08-25 19:42:44 UTC (rev 292)
@@ -65,13 +65,6 @@
 
 using namespace std;
 
-//void ExitAvidaPrimitive(int exit_code)
-//{
-//  signal(SIGINT, SIG_IGN);          // Ignore all future interupts.
-//  delete cAvidaDriver_Base::main_driver;
-//  exit(exit_code);
-//}
-
 int main(int argc, char * argv[])
 {
   // Catch Interrupt making sure to close appropriately

Modified: branches/brysonda/source/tools/block_struct.cc
===================================================================
--- branches/brysonda/source/tools/block_struct.cc	2005-08-25 19:26:56 UTC (rev 291)
+++ branches/brysonda/source/tools/block_struct.cc	2005-08-25 19:42:44 UTC (rev 292)
@@ -9,6 +9,10 @@
 #include "block_struct.hh"
 #endif
 
+#include <iostream>
+
+using namespace std;
+
 ////////////////////
 //  cBlockStruct
 ////////////////////
@@ -59,7 +63,7 @@
 int cBlockStruct::Process()
 {
   if (!fixed_size) {
-    printf("Error! No fixed size!\n");
+    cerr << "Error: No fixed size!" << endl;
     return -1;
   }
 
@@ -118,7 +122,7 @@
     size_left -= fixed_size;
   }
 
-  printf("END Process() : Ran out of fixed_blocks...\n");
+  cout << "END Process() : Ran out of fixed_blocks..." << endl;
   
   return -1;
 }
@@ -188,7 +192,7 @@
     size_left -= fixed_size;
   }
 
-  printf("END Update() : Ran out of fixed_blocks...\n");
+  cout << "END Update() : Ran out of fixed_blocks..." << endl;
   
   return -1;
 }

Modified: branches/brysonda/source/tools/histogram.cc
===================================================================
--- branches/brysonda/source/tools/histogram.cc	2005-08-25 19:26:56 UTC (rev 291)
+++ branches/brysonda/source/tools/histogram.cc	2005-08-25 19:42:44 UTC (rev 292)
@@ -17,6 +17,10 @@
 #include <stdio.h>
 }
 
+#include <iostream>
+
+using namespace std;
+
 // cHistogram /////////////////////////////////////////////////////////////////
 
 cHistogram::cHistogram(int in_max, int in_min) {
@@ -34,8 +38,7 @@
 {
 #ifdef DEBUG
   if (new_max < new_min) {
-    fprintf(stderr, "ERROR: Trying to resize histogram to [%d,%d]\n",
-	    new_min, new_max);
+    cerr << "Error: Trying to resize histogram to [" << new_min << "," << new_max << "]" << endl;
     return;
   }
 #endif

Modified: branches/brysonda/source/tools/indexed_block_struct.cc
===================================================================
--- branches/brysonda/source/tools/indexed_block_struct.cc	2005-08-25 19:26:56 UTC (rev 291)
+++ branches/brysonda/source/tools/indexed_block_struct.cc	2005-08-25 19:42:44 UTC (rev 292)
@@ -9,6 +9,10 @@
 #include "indexed_block_struct.hh"
 #endif
 
+#include <iostream>
+
+using namespace std;
+
 //////////////////////////
 //  cIndexedBlockStruct
 //////////////////////////
@@ -249,8 +253,7 @@
   scaled_used = write_loc;
 
   if (scaled_used != num_data)
-    printf("Warning: after Compress() scaled_used = %d, while num_data = %d\n",
-	   scaled_used, num_data);
+    cout << "Warning: after Compress() scaled_used = " << scaled_used << ", while num_data = " << num_data << endl;
 
   return scaled_used;
 }

Modified: branches/brysonda/source/viewers/viewer.cc
===================================================================
--- branches/brysonda/source/viewers/viewer.cc	2005-08-25 19:26:56 UTC (rev 291)
+++ branches/brysonda/source/viewers/viewer.cc	2005-08-25 19:42:44 UTC (rev 292)
@@ -32,10 +32,15 @@
   signal(SIGINT, ExitAvida);
 
   // output copyright message
-  printf( "Avida version %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;
+  
   // Initialize the configuration data...
   cConfig::InitGroupList();
   cConfig::Setup(argc, argv);




More information about the Avida-cvs mailing list