[Avida-cvs] [avida-svn] r444 - development/source/targets/avida-viewer

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Sat Jan 21 11:59:58 PST 2006


Author: brysonda
Date: 2006-01-21 14:59:58 -0500 (Sat, 21 Jan 2006)
New Revision: 444

Modified:
   development/source/targets/avida-viewer/cBarScreen.cc
   development/source/targets/avida-viewer/cEnvironmentScreen.cc
   development/source/targets/avida-viewer/cHistScreen.cc
   development/source/targets/avida-viewer/cMapScreen.cc
   development/source/targets/avida-viewer/cMenuWindow.cc
   development/source/targets/avida-viewer/cOptionsScreen.cc
   development/source/targets/avida-viewer/cStatsScreen.cc
   development/source/targets/avida-viewer/cView.cc
   development/source/targets/avida-viewer/cZoomScreen.cc
Log:
Fix avida-viewer's deprecated cString usage.

Modified: development/source/targets/avida-viewer/cBarScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cBarScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cBarScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -23,7 +23,7 @@
 
   int offset = prog_name.GetSize() + 4;
   VLine(Width() - offset - 2);
-  Print(1, Width() - offset, "%s", prog_name());
+  Print(1, Width() - offset, "%s", static_cast<const char*>(prog_name));
 
   Print(1, 2, "Update:");
 

Modified: development/source/targets/avida-viewer/cEnvironmentScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cEnvironmentScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cEnvironmentScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -167,7 +167,7 @@
   }
   
   SetBoldColor(COLOR_WHITE);
-  Print(res_lib.GetSize()+3, 37, "%s", res_lib.GetResource(res_selection)->GetName());
+  Print(res_lib.GetSize()+3, 37, "%s", static_cast<const char*>(res_lib.GetResource(res_selection)->GetName()));
   Print(res_lib.GetSize()+3, res_lib.GetResource(res_selection)->GetName().GetSize()+37, ":");
   Print(res_lib.GetSize()+3, res_lib.GetResource(res_selection)->GetName().GetSize()+38, "        ");
   
@@ -210,7 +210,7 @@
     offset++;  
   }
   SetBoldColor(COLOR_WHITE);
-  Print(rxn_lib.GetSize()+3, 37, "%s", rxn_lib.GetReaction(rxn_selection)->GetName());
+  Print(rxn_lib.GetSize()+3, 37, "%s", static_cast<const char*>(rxn_lib.GetReaction(rxn_selection)->GetName()));
   Print(rxn_lib.GetSize()+3, rxn_lib.GetReaction(rxn_selection)->GetName().GetSize()+37, ":");
   Print(rxn_lib.GetSize()+3, rxn_lib.GetReaction(rxn_selection)->GetName().GetSize()+38, "        ");
   

Modified: development/source/targets/avida-viewer/cHistScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cHistScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cHistScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -25,7 +25,7 @@
   PrintFitness(in_pos, 0, in_gen->GetFitness());
 
   SetBoldColor(COLOR_WHITE);
-  Print(in_pos, 8, "%s: ", in_gen->GetName()());
+  Print(in_pos, 8, "%s: ", static_cast<const char*>(in_gen->GetName()));
 
   int max_stars = Width() - 28;
   int star_size = (max_num / max_stars);

Modified: development/source/targets/avida-viewer/cMapScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cMapScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cMapScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -212,7 +212,7 @@
     Print(Height() - 1, 33, "(%2d, %2d) - %s",
 		       info.GetActiveID() % x_size,
 		       info.GetActiveID() / x_size,
-		       cpu_gen->GetName()());
+		       static_cast<const char*>(cpu_gen->GetName()));
   }
 
   if (x_offset == 0 || x_offset == Width()/2 - 1) {

Modified: development/source/targets/avida-viewer/cMenuWindow.cc
===================================================================
--- development/source/targets/avida-viewer/cMenuWindow.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cMenuWindow.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -153,7 +153,7 @@
   int col_id  = option_id / lines;
   int x_pos = col_id * (max_width + 2) + 2;
   int y_pos = line_id + ((title.IsEmpty()) ? 2 : 4);
-  window->Print(y_pos, x_pos, option_list[option_id]());
+  window->Print(y_pos, x_pos, static_cast<const char*>(option_list[option_id]));
 
   int hot_pos = FindHotkeyPos(option_list[option_id]);
   if (hot_pos != -1) {

Modified: development/source/targets/avida-viewer/cOptionsScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cOptionsScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cOptionsScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -85,9 +85,9 @@
   Print(7, 15, "%d", info.GetRandom().GetSeed());
   Print(8, 15, "%d", info.GetConfig().THRESHOLD.Get());
 
-  Print(11, 15, "%s", info.GetConfig().INST_SET.Get()());
-  Print(12, 15, "%s", info.GetConfig().ENVIRONMENT_FILE.Get()());
-  Print(13, 15, "%s", info.GetConfig().EVENT_FILE.Get()());
+  Print(11, 15, "%s", static_cast<const char*>(info.GetConfig().INST_SET.Get()));
+  Print(12, 15, "%s", static_cast<const char*>(info.GetConfig().ENVIRONMENT_FILE.Get()));
+  Print(13, 15, "%s", static_cast<const char*>(info.GetConfig().EVENT_FILE.Get()));
 
   switch(info.GetConfig().SLICING_METHOD.Get()) {
   case SLICE_CONSTANT:
@@ -168,7 +168,7 @@
   Print(1, 15, "(%d, %d)",
 		     info.GetActiveID() % info.GetPopulation().GetWorldX(),
 		     info.GetActiveID() / info.GetPopulation().GetWorldY());
-  Print(2, 15, "%s", info.GetActiveName()());
+  Print(2, 15, "%s", static_cast<const char*>(info.GetActiveName()));
   Print(3, 15, "%d", info.GetActiveID());
 
   SetColor(COLOR_WHITE);

Modified: development/source/targets/avida-viewer/cStatsScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cStatsScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cStatsScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -64,7 +64,7 @@
 	 row_id < 15 + task_rows && task_num < info.GetWorld().GetNumTasks();
 	 row_id++) {
       Print(row_id, col_id, ".........:");
-      Print(row_id, col_id, "%s", task_lib.GetTask(task_num).GetName()());
+      Print(row_id, col_id, "%s", static_cast<const char*>(task_lib.GetTask(task_num).GetName()));
       task_num++;
     }
   }
@@ -105,7 +105,7 @@
   Print(11, 13, "%5d", stats.GetNumThreshold());
   Print(12, 13, "%5d", stats.GetNumSpecies());
 
-  Print(2, 37, "%s",  best_gen->GetName()());
+  Print(2, 37, "%s",  static_cast<const char*>(best_gen->GetName()));
   Print(3, 37, "%9d", best_gen->GetID());
   Print(4, 37, "%9d", (best_gen->GetSpecies()) ?
 	(best_gen->GetSpecies()->GetID()) : -1);

Modified: development/source/targets/avida-viewer/cView.cc
===================================================================
--- development/source/targets/avida-viewer/cView.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cView.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -298,10 +298,10 @@
 {
   cString filename;
   filename.Set("clone.%d", info.GetWorld().GetStats().GetUpdate());
-  ofstream fp(filename());
+  ofstream fp(static_cast<const char*>(filename));
   info.GetPopulation().SaveClone(fp);
   cString message;
-  message.Set("Saved clone to file: %s", filename());
+  message.Set("Saved clone to file: %s", static_cast<const char*>(filename));
   Notify(message);
 }
 
@@ -313,7 +313,7 @@
   if (gen_name == "(no name)")
     gen_name.Set("%03d-unnamed", cur_gen->GetLength());
 
-  if (cur_screen) cur_screen->Print(20, 0, "Extracting %s...", gen_name());
+  if (cur_screen) cur_screen->Print(20, 0, "Extracting %s...", static_cast<const char*>(gen_name));
 
   cTestUtil::PrintGenome(&info.GetWorld(), cur_gen->GetGenome(), gen_name);
 
@@ -324,7 +324,7 @@
 }
 
 
-void cView::ChangeCurScreen(cScreen * new_screen)
+void cView::ChangeCurScreen(cScreen* new_screen)
 {
   if (cur_screen) cur_screen->Exit();
 
@@ -390,7 +390,7 @@
     = new cTextWindow(3, mess_length + 10, 10, (70 - mess_length) / 2);
   conf_win->Box();
   conf_win->SetBoldColor(COLOR_WHITE);
-  conf_win->Print(1, 2, "%s (y/n)", message());
+  conf_win->Print(1, 2, "%s (y/n)", static_cast<const char*>(message));
   conf_win->SetBoldColor(COLOR_CYAN);
   conf_win->Print(1, mess_length + 4, 'y');
   conf_win->Print(1, mess_length + 6, 'n');
@@ -451,7 +451,7 @@
   notify_win->Box();
   notify_win->SetBoldColor(COLOR_WHITE);
   for (int j = 0; j < num_lines; j++) {
-    notify_win->Print(1 + j, 2, "%s", line_array[j]());
+    notify_win->Print(1 + j, 2, "%s", static_cast<const char*>(line_array[j]));
   }
   notify_win->Refresh();
 

Modified: development/source/targets/avida-viewer/cZoomScreen.cc
===================================================================
--- development/source/targets/avida-viewer/cZoomScreen.cc	2006-01-20 21:35:49 UTC (rev 443)
+++ development/source/targets/avida-viewer/cZoomScreen.cc	2006-01-21 19:59:58 UTC (rev 444)
@@ -178,7 +178,7 @@
          cur_row < Height() - 1 && task_num < info.GetWorld().GetNumTasks();
          cur_row++) {
       Print(cur_row, cur_col, "........:");
-      Print(cur_row, cur_col, "%s", task_lib.GetTask(task_num).GetName()());
+      Print(cur_row, cur_col, "%s", static_cast<const char*>(task_lib.GetTask(task_num).GetName()));
       task_num++;
     }
     col_num++;
@@ -567,7 +567,7 @@
   
   // if there is an Active Genotype name AND it is not empty, show it
   Print(1, 12, "%9d", info.GetActiveGenotypeID());
-  Print(2, 12, "%s", info.GetActiveName()());
+  Print(2, 12, "%s", static_cast<const char*>(info.GetActiveName()));
   
   if (info.GetActiveSpecies())
     Print(3, 12, "%9d", info.GetActiveSpeciesID());
@@ -694,7 +694,7 @@
     if (pos == 1) SetColor(COLOR_CYAN);
     
     // Draw the current instruction.
-    Print(17+pos, 29, "%s",	inst_set.GetName(inst_ptr.GetInst())());
+    Print(17+pos, 29, "%s",	static_cast<const char*>(inst_set.GetName(inst_ptr.GetInst())));
     inst_ptr.Advance();
   }
   
@@ -708,9 +708,9 @@
   // @CAO assume no parasites for now.
   int cur_id = info.GetActiveCell()->GetID();
   //active_inst_ptr.GetCurHardware()->GetOrganism()->GetEnvironment()->GetID();
-  Print(11, 36, "%12s", cStringUtil::Stringf("[%2d,%2d] : %2d",
+  Print(11, 36, "%12s", static_cast<const char*>(cStringUtil::Stringf("[%2d,%2d] : %2d",
                                              cur_id % population.GetWorldX(), cur_id / population.GetWorldX(),
-                                             active_inst_ptr.GetPosition())() );
+                                             active_inst_ptr.GetPosition())) );
 }
 
 void cZoomScreen::UpdateStats_4Stack(cHardwareBase & hardware)
@@ -735,7 +735,7 @@
     if (pos == 1) SetColor(COLOR_CYAN);
     
     // Draw the current instruction.
-    Print(17+pos, 29, "%s",	inst_set.GetName(inst_ptr.GetInst())());
+    Print(17+pos, 29, "%s",	static_cast<const char*>(inst_set.GetName(inst_ptr.GetInst())));
     inst_ptr.Advance();
   }
   
@@ -744,9 +744,9 @@
   // @CAO assume no parasites for now.
   //int cur_id = info.GetActiveCell()->GetID();
   //active_inst_ptr.GetCurHardware()->GetOrganism()->GetEnvironment()->GetID();
-  Print(11, 36, "%12s", cStringUtil::Stringf("(%2d, %2d)",
+  Print(11, 36, "%12s", static_cast<const char*>(cStringUtil::Stringf("(%2d, %2d)",
                                              active_inst_ptr.GetMemSpace(),
-                                             active_inst_ptr.GetPosition())() );
+                                             active_inst_ptr.GetPosition())) );
 }
 
 void cZoomScreen::UpdateStats_SMT(cHardwareBase & hardware)
@@ -771,7 +771,7 @@
     if (pos == 1) SetColor(COLOR_CYAN);
     
     // Draw the current instruction.
-    Print(17+pos, 29, "%s",	inst_set.GetName(inst_ptr.GetInst())());
+    Print(17+pos, 29, "%s",	static_cast<const char*>(inst_set.GetName(inst_ptr.GetInst())));
     inst_ptr.Advance();
   }
   
@@ -780,9 +780,9 @@
   // @CAO assume no parasites for now.
   //int cur_id = info.GetActiveCell()->GetID();
   //active_inst_ptr.GetCurHardware()->GetOrganism()->GetEnvironment()->GetID();
-  Print(11, 36, "%12s", cStringUtil::Stringf("(%2d, %2d)",
+  Print(11, 36, "%12s", static_cast<const char*>(cStringUtil::Stringf("(%2d, %2d)",
                                              active_inst_ptr.GetMemSpace(),
-                                             active_inst_ptr.GetPosition())() );
+                                             active_inst_ptr.GetPosition())) );
 }
 
 void cZoomScreen::UpdateCPU(cHardwareBase & hardware)
@@ -799,7 +799,7 @@
   }
   
   Print(14, 69, "%10d", info.GetActiveGenotypeID());
-  Print(15, 69, "%10s", info.GetActiveName()());
+  Print(15, 69, "%10s", static_cast<const char*>(info.GetActiveName()));
   
   cPhenotype & phenotype = info.GetActiveCell()->GetOrganism()->GetPhenotype();
   Print(17, 69, "%10d", phenotype.GetCurNumErrors());
@@ -829,7 +829,7 @@
     SetBoldColor(COLOR_RED);
     Print(FAULT_Y, FAULT_X, "Fault:");
     SetBoldColor(COLOR_CYAN);
-    Print(FAULT_Y, FAULT_X + 7, cur_fault());
+    Print(FAULT_Y, FAULT_X + 7, static_cast<const char*>(cur_fault));
   } else {
     Print(FAULT_Y, FAULT_X, "                                        ");
   }
@@ -940,7 +940,7 @@
       
       // Print the instruction...
       Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 6, "%8s ",
-            inst_set.GetName( memory[adj_inst_ptr] )());
+            static_cast<const char*>(inst_set.GetName(memory[adj_inst_ptr])));
       
       Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15,
             "                    ");
@@ -1080,7 +1080,7 @@
       
       // Print the instruction...
       Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 6, "%8s ",
-            inst_set.GetName( memory[adj_inst_ptr] )());
+            static_cast<const char*>(inst_set.GetName(memory[adj_inst_ptr])));
       
       Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15,
             "                    ");
@@ -1223,7 +1223,7 @@
       
       // Print the instruction...
       Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 6, "%8s ",
-            inst_set.GetName( memory[adj_inst_ptr] )());
+            static_cast<const char*>(inst_set.GetName(memory[adj_inst_ptr])));
       
       Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15,
             "                    ");
@@ -1271,7 +1271,7 @@
   SetBoldColor(COLOR_CYAN);
   
   Print(1, 12, "%9d", info.GetActiveGenotypeID());
-  Print(2, 12, "%9s", info.GetActiveName()());
+  Print(2, 12, "%9s", static_cast<const char*>(info.GetActiveName()));
   Print(3, 12, "%9d", info.GetActiveSpeciesID());
   
   if (info.GetActiveGenotype() != NULL) {
@@ -1366,7 +1366,7 @@
     cMenuWindow inst_menu(inst_set.GetSize());
     inst_menu.SetTitle("Choose new instruction: ");
     for (int j = 0; j < inst_set.GetSize(); j++) {
-      inst_menu.AddOption(j, inst_set.GetName(j)());
+      inst_menu.AddOption(j, static_cast<const char*>(inst_set.GetName(j)));
     }
     inst_menu.SetActive(edit_head.GetInst().GetOp());
     new_inst = inst_menu.Activate();
@@ -1477,7 +1477,7 @@
   const cInstSet & inst_set = hardware.GetInstSet();
   
   window->SetBoldColor(COLOR_YELLOW);
-  window->Print(2, 16, "%s", inst_set.GetName(inst_ptr.GetInst())());
+  window->Print(2, 16, "%s", static_cast<const char*>(inst_set.GetName(inst_ptr.GetInst())));
   
   window->SetBoldColor(COLOR_WHITE);
   




More information about the Avida-cvs mailing list