[avida-cvs] avida(kaben) CVS commits: /current configure.in /current/source modules.pri /current/source/cpu hardware_cpu.cc /current/source/qt-viewer Makefile.am activate_watcher.hh activate_watcher_proto.hh avd_avida_driver.cc avd_avida_driver.hh avd_avida_thread_drvr_dbg.hh avd_avida_thread_drvr_dbg_proto.hh avd_connections.cc avd_connections.hh avd_driver_controller.cc avd_driver_controller.hh avd_gui_msg_event.hh avd_instruction_viewer_controller.cc avd_instruction_viewer_controller.hh avd_message_display.cc avd_message_display.hh avd_message_display_proto.hh avd_message_display_typetrack.hh avd_message_display_typetrack_proto.hh avd_mission_control.cc avd_mission_control.hh avd_qstr_message_display.cc main.cc n_orig_instruction_buttons_widget.cc n_orig_instruction_buttons_widget.hh n_orig_instruction_cpu_widget.cc n_orig_instruction_cpu_widget.hh n_orig_instruction_field_widget.cc n_orig_instruction_field_widget.hh n_orig_instruction_line_widget.cc n_orig_instruction_line_widget.hh n_orig_instruction_scrollview.cc n_orig_instruction_scrollview.hh n_orig_instruction_view_widget.cc n_orig_instruction_view_widget.hh n_orig_instruction_viewer.cc n_orig_instruction_viewer.hh qt-viewer.pro retainable.cc retainable.hh retainable_dbg.hh retainable_dbg_proto.hh retainable_proto.hh setup_avida.cc tRList.hh tRList_proto.hh tRetainable_list.hh tRetainable_list_proto.hh watch_retains.cc watch_retains.hh watch_retains_proto.hh /current/source/third-party Makefile.am

kaben avida-cvs at alife.org
Tue Aug 26 02:46:27 PDT 2003


kaben		Mon Aug 25 18:46:27 2003 EDT

  Added files:                 (Branch: kaben)
    /avida/current/source/qt-viewer	activate_watcher.hh 
                                   	activate_watcher_proto.hh 
                                   	avd_avida_thread_drvr_dbg.hh 
                                   	avd_avida_thread_drvr_dbg_proto.hh 
                                   	avd_connections.cc 
                                   	avd_connections.hh 
                                   	avd_message_display.cc 
                                   	avd_message_display.hh 
                                   	avd_message_display_proto.hh 
                                   	avd_message_display_typetrack.hh 
                                   	avd_message_display_typetrack_proto.hh 
                                   	avd_qstr_message_display.cc 
                                   	retainable.cc retainable.hh 
                                   	retainable_dbg.hh 
                                   	retainable_dbg_proto.hh 
                                   	retainable_proto.hh tRList.hh 
                                   	tRList_proto.hh tRetainable_list.hh 
                                   	tRetainable_list_proto.hh 
                                   	watch_retains.cc watch_retains.hh 
                                   	watch_retains_proto.hh 

  Modified files:              
    /avida/current	configure.in 
    /avida/current/source	modules.pri 
    /avida/current/source/cpu	hardware_cpu.cc 
    /avida/current/source/qt-viewer	Makefile.am avd_avida_driver.cc 
                                   	avd_avida_driver.hh 
                                   	avd_driver_controller.cc 
                                   	avd_driver_controller.hh 
                                   	avd_gui_msg_event.hh 
                                   	avd_instruction_viewer_controller.cc 
                                   	avd_instruction_viewer_controller.hh 
                                   	avd_mission_control.cc 
                                   	avd_mission_control.hh main.cc 
                                   	n_orig_instruction_buttons_widget.cc 
                                   	n_orig_instruction_buttons_widget.hh 
                                   	n_orig_instruction_cpu_widget.cc 
                                   	n_orig_instruction_cpu_widget.hh 
                                   	n_orig_instruction_field_widget.cc 
                                   	n_orig_instruction_field_widget.hh 
                                   	n_orig_instruction_line_widget.cc 
                                   	n_orig_instruction_line_widget.hh 
                                   	n_orig_instruction_scrollview.cc 
                                   	n_orig_instruction_scrollview.hh 
                                   	n_orig_instruction_view_widget.cc 
                                   	n_orig_instruction_view_widget.hh 
                                   	n_orig_instruction_viewer.cc 
                                   	n_orig_instruction_viewer.hh 
                                   	qt-viewer.pro setup_avida.cc 
    /avida/current/source/third-party	Makefile.am 
  Log:
  
  Stabilizing qt-viewer for avida 2.0b5
  - Resolved conflict between cPopulationInterface class and its subclass in
    the qt-viewer
  - Replacement of thread driver with smaller more robust version
  - Addition of retain-counting memory management classes, and
    the support classes they require
  
  
  
-------------- next part --------------
Index: avida/current/configure.in
diff -u avida/current/configure.in:1.22.2.6 avida/current/configure.in:1.22.2.7
--- avida/current/configure.in:1.22.2.6	Tue May 20 05:12:19 2003
+++ avida/current/configure.in	Mon Aug 25 18:46:25 2003
@@ -181,6 +181,7 @@
   source/Makefile
   source/third-party/Makefile
   source/third-party/trio-1.9/Makefile
+  source/third-party/Loki/Makefile
   source/tools/Makefile source/cpu/Makefile
   source/event/Makefile source/viewers/Makefile
   source/main/Makefile
Index: avida/current/source/modules.pri
diff -u avida/current/source/modules.pri:1.1.2.3 avida/current/source/modules.pri:1.1.2.4
--- avida/current/source/modules.pri:1.1.2.3	Thu May 15 05:46:36 2003
+++ avida/current/source/modules.pri	Mon Aug 25 18:46:26 2003
@@ -1,12 +1,14 @@
 
 CPU_CC    = $$AVIDA_SRC_DIR/cpu
 EVENT_CC  = $$AVIDA_SRC_DIR/event
+LOKI_CC   = $$AVIDA_SRC_DIR/third-party/Loki
 MAIN_CC   = $$AVIDA_SRC_DIR/main
 TRIO_C    = $$AVIDA_SRC_DIR/third-party/trio-1.9
 TOOLS_CC  = $$AVIDA_SRC_DIR/tools
 
 CPU_HH    = $$CPU_CC
 EVENT_HH  = $$EVENT_CC
+LOKI_HH   = $$LOKI_CC
 MAIN_HH   = $$MAIN_CC
 TRIO_H    = $$TRIO_C
 TOOLS_HH  = $$TOOLS_CC
@@ -15,6 +17,7 @@
 DEPENDPATH += ;$$CPU_HH
 DEPENDPATH += ;$$EVENT_HH
 DEPENDPATH += ;$$MAIN_HH
+DEPENDPATH += ;$$LOKI_HH
 DEPENDPATH += ;$$TRIO_H
 DEPENDPATH += ;$$TOOLS_HH
 
@@ -22,6 +25,7 @@
 
 include($$CPU_CC/cpu.pri)
 include($$EVENT_CC/event.pri)
+include($$LOKI_CC/Loki.pri)
 include($$MAIN_CC/main_sub.pri)
 include($$TRIO_C/trio.pri)
 include($$TOOLS_CC/tools.pri)
Index: avida/current/source/cpu/hardware_cpu.cc
diff -u avida/current/source/cpu/hardware_cpu.cc:1.34.2.7 avida/current/source/cpu/hardware_cpu.cc:1.34.2.8
--- avida/current/source/cpu/hardware_cpu.cc:1.34.2.7	Thu May 29 11:47:51 2003
+++ avida/current/source/cpu/hardware_cpu.cc	Mon Aug 25 18:46:26 2003
@@ -2881,7 +2881,8 @@
   DoOutput(value_out);  // Check for tasks compleated.
 
   // Do the "get" component
-  const int value_in = organism->GetInput();
+  //std::cout << "<cHardwareCPU::Inst_TaskIO> about to organism->GetInputAt()..." << std::endl;
+  const int value_in = organism->GetInputAt(threads[GetCurThread()].input_pointer);
   Register(reg_used) = value_in;
   DoInput(value_in);
   return true;
Index: avida/current/source/qt-viewer/Makefile.am
diff -u avida/current/source/qt-viewer/Makefile.am:1.44.2.10 avida/current/source/qt-viewer/Makefile.am:1.44.2.11
--- avida/current/source/qt-viewer/Makefile.am:1.44.2.10	Fri May 30 13:43:03 2003
+++ avida/current/source/qt-viewer/Makefile.am	Mon Aug 25 18:46:26 2003
@@ -3,7 +3,7 @@
 
 BUILT_SOURCES = qt-viewer.qmakefile
 
-QMAKE_OPTIONS=
+QMAKE_OPTIONS="CONFIG*=exceptions"
 
 if QMAKE_DEBUG
 QMAKE_OPTIONS+="CONFIG*=debug"
@@ -112,6 +112,28 @@
             setup_wizard_page2.hh \
             \
             testwizard.hh \
+            \
+            avd_message_display.hh \
+            avd_message_display_proto.hh \
+            avd_message_display_typetrack.hh \
+            avd_message_display_typetrack_proto.hh \
+            \
+            activate_watcher.hh \
+            activate_watcher_proto.hh \
+            retainable.hh \
+            retainable_dbg.hh \
+            retainable_dbg_proto.hh \
+            retainable_proto.hh \
+            watch_retains.hh \
+            watch_retains_proto.hh \
+            \
+            tRList.hh \
+            tRList_proto.hh \
+            tRetainable_list.hh \
+            tRetainable_list_proto.hh \
+            \
+            avd_connections.hh \
+            \
             event_chooser.ui \
             event_list_editor.ui \
             plot_select_dia.ui \
@@ -172,4 +194,12 @@
             setup_wizard_config.cc \
             setup_wizard_constants.cc \
             setup_wizard_page.cc \
-            setup_wizard_page2.cc
+            setup_wizard_page2.cc \
+            \
+            avd_message_display.cc \
+            avd_qstr_message_display.cc \
+            \
+            retainable.cc \
+            watch_retains.cc \
+            \
+            avd_connections.cc
Index: avida/current/source/qt-viewer/avd_avida_driver.cc
diff -u avida/current/source/qt-viewer/avd_avida_driver.cc:1.1.2.2 avida/current/source/qt-viewer/avd_avida_driver.cc:1.1.2.3
--- avida/current/source/qt-viewer/avd_avida_driver.cc:1.1.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/avd_avida_driver.cc	Mon Aug 25 18:46:26 2003
@@ -1,30 +1,3 @@
-
-
-#ifndef STRING_HH
-#include "../tools/string.hh"
-#endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
-#endif
-
-#ifndef AVD_AVIDA_DRIVER_HH
-#include "avd_avida_driver.hh"
-#endif
-
-#ifndef AVD_MISSION_CONTROL_HH
-#include "avd_mission_control.hh"
-#endif
-#ifndef AVD_GUI_MSG_EVENT_HH
-#include "avd_gui_msg_event.hh"
-#endif
-
-#ifndef CONFIG_HH
-#include "../main/config.hh"
-#endif
-#ifndef POPULATION_HH
-#include "../main/population.hh"
-#endif
-
 #ifndef QAPPLICATION_H
 #include <qapplication.h>
 #endif
@@ -41,941 +14,272 @@
 #include <qtimer.h>
 #endif
 
+#ifndef GENEBANK_HH
+#include "genebank.hh"
+#endif
+#ifndef GENOTYPE_HH
+#include "genotype.hh"
+#endif
+#ifndef POPULATION_CELL_HH
+#include "population_cell.hh"
+#endif
+#ifndef HARDWARE_FACTORY_HH
+#include "hardware_factory.hh"
+#endif
+#ifndef ORGANISM_HH
+#include "organism.hh"
+#endif
+#ifndef HARDWARE_BASE_HH
+#include "hardware_base.hh"
+#endif
+#ifndef STRING_HH
+#include "string.hh"
+#endif
+#ifndef CONFIG_HH
+#include "config.hh"
+#endif
+#ifndef POPULATION_HH
+#include "population.hh"
+#endif
 
-using namespace std;
-
+#ifndef AVD_AVIDA_THREAD_DRVR_DBG_HH
+#include "avd_avida_thread_drvr_dbg.hh"
+#endif
+#ifndef AVD_GUI_MSG_EVENT_HH
+#include "avd_gui_msg_event.hh"
+#endif
 
-const QString
-  avd_AvidaDriver::update_avida_message("UpdateAvida"),
-  avd_AvidaDriver::step_organism_message("StepOrganism"),
-  avd_AvidaDriver::exit_avida_message("ExitAvida"),
-  
-  avd_AvidaDriver::avida_updated_message("AvidaUpdated"),
-  avd_AvidaDriver::organism_stepped_message("OrganismStepped"),
-  avd_AvidaDriver::avida_breakpoint_message("AvidaBreakpoint"),
-  avd_AvidaDriver::avida_exited_message("AvidaExited"),
-                                                                                    
-  avd_AvidaDriver::hello_query_message("Hello?"),                                   
-  avd_AvidaDriver::hello_response_message("Hello..."),
-  
-  avd_AvidaDriver::malformed_message_to_avida("AvidaMessageMalformed"),
-  avd_AvidaDriver::null_message("(null)"),
-  
-  avd_AvidaDriver::avida_threadstat_breakpoint("Breakpoint"),
-  avd_AvidaDriver::avida_threadstat_stepping("Stepping"),
-  avd_AvidaDriver::avida_threadstat_waiting("Waiting");
+#ifndef AVD_AVIDA_DRIVER_HH
+#include "avd_avida_driver.hh"
+#endif
 
+using namespace std;
 
+cPopulation *avdAvidaThreadDrvr::getPopulation(){ return population; }
+cEventList *avdAvidaThreadDrvr::getEventList(){ return event_list; }
 
-avd_AvidaDriver::avd_AvidaDriver(avd_MissionControl *mission_control, cEnvironment &environment)
-: m_mission_control(mission_control),
-  cAvidaDriver_Population(environment)
+avdAvidaThreadDrvr::avdAvidaThreadDrvr(cEnvironment &environment, QMutex *mutex)
+: cAvidaDriver_Population(environment), m_mutex(mutex)
 {
-  m_avida_thread_q = new avd_MessageQueue<QString>(
-    null_message,
-    m_mission_control->getMutex()
-  );
-  m_gui_thread_q = new avd_MessageQueue<QString>(
-    null_message,
-    m_mission_control->getMutex()
-  );
- 
-  m_mission_control->setPopulation(population);
-  m_mission_control->setEventList(event_list);
-
-  // signals to avida from gui.
-  connect(
-    m_mission_control, SIGNAL(startAvidaSig()),
-    this, SLOT(startAvidaSlot())
-  );
-  connect(
-    m_mission_control, SIGNAL(updateAvidaSig()),
-    this, SLOT(updateAvidaSlot())
-  );
-  connect(
-    m_mission_control, SIGNAL(stepAvidaSig(int)),
-    this, SLOT(stepOrganismSlot(int))
-  );
-  connect(
-    m_mission_control, SIGNAL(stopAvidaSig()),
-    this, SLOT(stopAvidaSlot())
-  );
-  connect(
-    m_mission_control, SIGNAL(exitAvidaSig()),
-    this, SLOT(exitAvidaSlot())
-  );
-  connect(
-    m_mission_control, SIGNAL(isAvidaRunningSig()),
-    this, SLOT(isAvidaRunningSlot())
-  );
-}
-
-/* FIXME: complete. */
-avd_AvidaDriver::~avd_AvidaDriver(void){
-  m_mission_control->setPopulation(0);
-  m_mission_control->setEventList(0);
-}
-
-void
-avd_AvidaDriver::run(void){
-  GenDebug << "entered.";
-  avidaMainMessageCatcher();
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::Run(void){
-  GenDebug << "entered.";
-  m_expected_avida_state = STOPPED;
-  m_gui_step_organism = -1; // no step organism yet.
-
-  // variables to support running average of max number of organisms to
-  // process at a time before checking for messages from gui, in order
-  // to keep the processing thread responsive.  see description in
-  // header file.
-  m_desired_update_chunk_time_interval_in_milliseconds = 20;
-  m_update_chunking_timer = new QTime();
-  m_required_chunk_size_in_organisms = 1;
-
-  // this is fantastically stupid:  in X11, Qt does not check for
-  // nonspontaneous events (i.e. not generated by the windowing system)
-  // except in passing when a spontaneous event occurs.  the
-  // 50-millisecond timer below doesn't connect to anything in this
-  // class, but its timer events are considered spontaneous and make Qt
-  // pay attention to nonspontaneous events -- in particular,
-  // notification from the processing thread of a message for the gui
-  // thread.
-  //
-  // OSX doesn't require this; probably neither does Windows.  We'll
-  // see.
-  startTimer(50);
-
-  // inherited start() causes avd_AvidaDriver::run(void) to run in its
-  // own thread.             note the lowercase^^^!
-  // run() is defined right before Run(), just a few lines above this
-  // one.
-  start();
-}
-
-
-void
-avd_AvidaDriver::isAvidaRunningSlot(void){
-  GenDebug << "called.n";
-  m_mission_control->emitAvidaStatusSig(avidaIsRunning());
-  GenDebug << "done.n";
-}
-
-
-void
-avd_AvidaDriver::scheduleUpdateSlot(void){
-  GenDebug << "called.n";
-
-  switch(m_expected_avida_state){
-  case STEPPING:
-    GenDebug << " --- trying to resume stepping mode.";
-
-    stepOrganismSlot(m_gui_step_organism);
-    break;
-  case RUNNING:
-    m_gui_step_organism = -1;
-    /*
-    FIXME:  scheduleUpdateSlot() and updateAvidaSlot() can be joined if
-    I decide to do away with the delay timer.
-    */
-    GenDebug << " --- trying to enter running mode.";
-    updateAvidaSlot();
-    break;
-  case STOPPED:
-    GenDebug << " --- m_expected_avida_state == STOPPED.\n"
-      " --- (not updating.)\n"
-      " --- sending avidaStoppedSig()." ;
-    m_mission_control->emitAvidaStoppedSig();
-    break;
-  default:
-    GenDebug <<
-      " --- m_expected_avida_state == INSANE.\n"
-      " --- (m_expected_avida_state shouldn't have this value.)\n"
-      " --- dying gracelessly."
-    ;
-    GenFatal("m_expected_avida_state has insane value.");
-    break;  // never reached.
-  }
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::updateAvidaSlot(void){
-  GenDebug << "called." ;
-  m_gui_step_organism = -1;
-  m_avida_thread_q->send(update_avida_message);
-  GenDebug << "sent \""
-  << update_avida_message << "\"." ;
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::stepOrganismSlot(int cell_id){
-  GenDebug << "called.";
-
-  /* FIXME:  verify that cell_id is in the grid.  -- K.
+  Debug << "avdAvidaThreadDrvr ctor...";
+  nameWatched("(<avdAvidaThreadDrvr>)");
+  m_mode_function = &avdAvidaThreadDrvr::fastMode;
+  m_fast_stage_function = &avdAvidaThreadDrvr::preUpdate;
+  m_step_stage_function = &avdAvidaThreadDrvr::preUpdate;
+  m_emit_function = &avdAvidaThreadDrvr::emitUpdatedSig;
+  m_run_continuously = false;
+  m_step_mode = false;
+  m_step_cell_id = 0;
+  m_breakpoint_cell_id = 0;
+  //m_mutex = new QMutex(false);
+  Debug << "avdAvidaThreadDrvr ctor done.";
+}
+
+avdAvidaThreadDrvr::~avdAvidaThreadDrvr(void){
+  Debug << "avdAvidaThreadDrvr dtor...";
+  doCloseAvidaSlot();
+  //delete m_mutex;
+  Debug << "avdAvidaThreadDrvr dtor done.";
+}
+
+void avdAvidaThreadDrvr::Run(void){
+  Debug << "starting avida processing thread....";
+  /*
+  Qt/X11 doesn't check for non-X11 events except in passing when an X11
+  event occurs.  The 50-millisecond timer below doesn't connect to
+  anything, but timer events are really X11 events, and they make Qt
+  check for notification events from the Avida processing thread to the
+  gui thread.
+  
+  OSX doesn't require this; probably neither does Windows.  We'll see.
   */
-  m_expected_avida_state = STEPPING;
-  m_gui_step_organism = cell_id;
-  m_avida_thread_q->send( (step_organism_message + ",%1").arg(cell_id));
-
-  GenDebug << "sent \""
-    << (step_organism_message + ",%1").arg(cell_id) << "\"." ;
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::startAvidaSlot(void){
-  GenDebug << "called.";
-  m_expected_avida_state = RUNNING;
-  scheduleUpdateSlot();
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::stopAvidaSlot(void){
-  GenDebug << "called.";
-  m_expected_avida_state = STOPPED;
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::exitAvidaSlot(void){
-  GenDebug << "called.";
-  m_avida_thread_q->urgent(exit_avida_message);
-  GenDebug << "sent \""
-    << exit_avida_message << "\".  waiting...";
-  wait();
-  m_expected_avida_state = STOPPED;
-  m_mission_control->emitAvidaExitedSig();
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::helloAvidaSlot(void){
-  GenDebug << "called.";
-  m_avida_thread_q->urgent(hello_query_message);
-  GenDebug << "sent \""
-    << hello_query_message << "\".";
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::malformedMessageToAvidaSlot(void){
-  GenDebug << "called.";
-  m_avida_thread_q->send("fooey");
-  GenDebug << " --- sent \"fooey\".";
-  GenDebug << "done.";
-}
-
-
-// GUI thread management
-
-void
-avd_AvidaDriver::customEvent(QCustomEvent *custom_event){
-  GenDebug << "entered.";
-  if (custom_event->type() == avd_GuiMsgEvent::EventType){
-    GenDebug << "avd_GuiMsgEvent::EventType.";
-    guiMessageCatcher();
-  }
-  GenDebug << "done.";
-}
-
-void
-avd_AvidaDriver::guiMessageCatcher(void){
-  QString message = m_gui_thread_q->receive(0);
-  if (message != null_message){
-    GenDebug
-    << " --- got message \"" << message << "\".";
-
-    QStringList components = QStringList::split(",", message);
-    if(components[0] == avida_updated_message){
-      if(!avidaUpdated(components)) avidaSentBunkMessage(components);
-    } else
-    if(components[0] == organism_stepped_message){
-      if(!organismStepped(components)) avidaSentBunkMessage(components);
-    } else
-    if(components[0] == avida_breakpoint_message){
-      if(!avidaBreakpoint(components)) avidaSentBunkMessage(components);
-    } else
-    if(components[0] == avida_exited_message){
-      if(!avidaExited(components)) avidaSentBunkMessage(components);
-    } else
-    if(components[0] == hello_response_message){
-      if(!avidaSaysHi(components)) avidaSentBunkMessage(components);
-    } else
-    if(components[0] == malformed_message_to_avida){
-      avidaGotBunkMessage(components);
-    } else {
-      avidaSentBunkMessage(components);
-    }
-  }
-}
-
-bool
-avd_AvidaDriver::avidaUpdated(const QStringList &components){
-  GenDebug << "called.";
-
-  if (components.size() != 1){
-    return false;
-  }
-  m_mission_control->emitAvidaUpdatedSig();
-
-  scheduleUpdateSlot();
-
-  GenDebug << "called scheduleUpdateSlot().";
-  GenDebug << "done.";
-
-  return true;
+  startTimer(50);
+  start(); /* Starts the processing thread. */
+  Debug << "done starting processing thread.";
 }
 
-bool
-avd_AvidaDriver::organismStepped(const QStringList &components){
-  GenDebug << "called.";
-
-  if (components.size() != 2){
-    return false;
-  }
-
-  bool ok;
-  int cell_id = components[1].toInt(&ok);
-  if(!ok
-    /*
-    use of m_gui_step_organism as a sanity check may be a bad idea;
-    things may run fine under a mismatch.
-
-    FIXME:  if this turns out to hold, ditch m_gui_step_organism.
-    */
-    /*
-    ||
-    cell_id != m_gui_step_organism
-    */
-  ){
-    GenDebug << "early exit.";
-    return false;
-  }
-
-  m_expected_avida_state = STOPPED;
-  m_mission_control->emitAvidaSteppedSig(cell_id);
-  GenDebug << "done.";
-  return true;
+void avdAvidaThreadDrvr::doStartAvidaSlot(){ wakeProcessingThread(true, false); }
+void avdAvidaThreadDrvr::doUpdateAvidaSlot(){ wakeProcessingThread(false, false); }
+void avdAvidaThreadDrvr::doStepAvidaSlot(int cell_id){
+  m_mutex->lock();
+  m_step_cell_id = cell_id;
+  m_mutex->unlock();
+  wakeProcessingThread(false, true);
+}
+void avdAvidaThreadDrvr::doPauseAvidaSlot(){
+  m_mutex->lock();
+  m_run_continuously = false;
+  m_mutex->unlock();
+}
+void avdAvidaThreadDrvr::doCloseAvidaSlot(){
+  m_mutex->lock();
+  m_mode_function = &avdAvidaThreadDrvr::closingMode;
+  m_mutex->unlock();
+  m_wait_condition.wakeAll();
+  wait();
 }
-
-bool
-avd_AvidaDriver::avidaBreakpoint(const QStringList &components){
-  GenDebug << "called.";
-
-  if (components.size() != 2){
-    GenDebug << "early exit.";
-    return false;
-  }
-
-  bool ok;
-  int cell_id = components[1].toInt(&ok);
-  if(!ok
-    /*
-    use of m_gui_step_organism as a sanity check may be a bad idea;
-    things may run fine under a mismatch.
-
-    FIXME:  if this turns out to hold, ditch m_gui_step_organism.
-    */
-    /*
-    ||
-    cell_id != m_gui_step_organism
-    */
-  ){
-    GenDebug << "early exit.";
-    return false;
-  }
-
-  m_expected_avida_state = STOPPED;
-  m_mission_control->emitAvidaBreakpointSig(cell_id);
-  GenDebug << "done.";
+void avdAvidaThreadDrvr::wakeProcessingThread(bool continuous, bool step){
+  m_mutex->lock();
+  m_run_continuously = continuous;
+  m_step_mode = step;
+  m_mutex->unlock();
+  m_wait_condition.wakeAll();
+}
+
+/* Main loop of the Avida processing thread. */
+void avdAvidaThreadDrvr::run(void){
+  Debug << "in processing thread.";
+  m_mutex->lock();
+  for(;;){
+    m_wait_condition.wait(m_mutex);
+    while((this->*(m_mode_function))())
+    { m_mutex->unlock(); m_mutex->lock(); }
+    QApplication::postEvent(this, new avdGuiMsgEvent);
+} }
+
+bool avdAvidaThreadDrvr::fastMode(){ return (this->*(m_fast_stage_function))(); }
+bool avdAvidaThreadDrvr::stepMode(){ return (this->*(m_step_stage_function))(); }
+bool avdAvidaThreadDrvr::closingMode(){
+  m_emit_function = &avdAvidaThreadDrvr::emitClosedSig;
+  m_mutex->unlock();
+  QApplication::postEvent(this, new avdGuiMsgEvent);
+  exit(); /* Terminates the processing thread. */
+  return false; /* never reached. */
+}
+
+bool avdAvidaThreadDrvr::preUpdate() {
+  GetEvents();
+  if (done_flag == true){
+    m_emit_function = &avdAvidaThreadDrvr::emitClosedSig;
+    return false; }
+  // Increment the Update.
+  cStats & stats = population->GetStats();
+  stats.IncCurrentUpdate();
+  // Handle all data collection for previous update.
+  if (stats.GetUpdate() > 0) {
+    // Tell the stats object to do update calculations and printing.
+    stats.ProcessUpdate();
+    // Update all the genotypes for the end of this update.
+    cGenebank & genebank = population->GetGenebank();
+    for(cGenotype * cur_genotype = genebank.ResetThread(0);
+	      cur_genotype != NULL && cur_genotype->GetThreshold();
+	      cur_genotype = genebank.NextGenotype(0)){
+      cur_genotype->UpdateReset();
+  } }
+  m_UD_size = cConfig::GetAveTimeslice() * population->GetNumOrganisms();
+  m_step_size = 1. / (double) m_UD_size;
+  m_UD_progress = 0;
+  m_fast_stage_function = &avdAvidaThreadDrvr::fastUpdate;
+  m_step_stage_function = &avdAvidaThreadDrvr::stepUpdate;
   return true;
 }
-
-
-/* FIXME: complete. */
-bool
-avd_AvidaDriver::avidaExited(const QStringList &components){
-  GenDebug << "called.\n";
-
-  if (components.size() != 1){
-    GenDebug << "early exit.";
-    return false;
-  }
-  m_expected_avida_state = STOPPED;
-  m_mission_control->emitAvidaExitedSig();
-  GenDebug << "done.";
+bool avdAvidaThreadDrvr::fastUpdate() {
+  const int bite_size = cConfig::GetAveTimeslice();
+  for(int i = 0; i < bite_size; i++){
+    if(m_UD_progress < m_UD_size){
+      m_UD_progress++;
+      m_current_cell_id = population->ScheduleOrganism();
+      population->ProcessStep(m_step_size, m_current_cell_id); }
+    else {
+      m_fast_stage_function = &avdAvidaThreadDrvr::postUpdate;
+      m_step_stage_function = &avdAvidaThreadDrvr::postUpdate;
+      return true;
+  } }
   return true;
 }
-
-/* FIXME: complete. */
-bool
-avd_AvidaDriver::avidaSaysHi(const QStringList &components){
-  GenDebug << "called.\n";
-
-  if (components.size() != 2){
-    return false;
-  }
-  GenDebug
-  << " --- message: \"" << components.join(",") << "\".\n"
-  << " --- NOT FULLY IMPLEMENTED.";
+bool avdAvidaThreadDrvr::stepUpdate() {
+  const int bite_size = cConfig::GetAveTimeslice();
+  for(int i = 0; i < bite_size; i++){
+    if(m_UD_progress < m_UD_size){
+      m_UD_progress++;
+      m_current_cell_id = population->ScheduleOrganism();
+      population->ProcessStep(m_step_size, m_current_cell_id);
+      if (m_current_cell_id == m_step_cell_id){
+        //cout << "Stepping through instructions in cell "
+        //  << m_current_cell_id << "." << endl;
+        Message << "Stepping through instructions in cell "
+                << m_current_cell_id << ".";
+        m_emit_function = &avdAvidaThreadDrvr::emitUpdatedSig;
+        return false;
+    } }
+    else {
+      m_fast_stage_function = &avdAvidaThreadDrvr::postUpdate;
+      m_step_stage_function = &avdAvidaThreadDrvr::postUpdate;
+      return true;
+  } }
   return true;
 }
-
-void
-avd_AvidaDriver::avidaGotBunkMessage(const QStringList &components){
-  GenDebug
-  << " --- bunk message: \""
-  << components.join(",") << "\".";
-  GenFatal("<avd_AvidaDriver::avidaGotBunkMessage>");
-}
-
-void
-avd_AvidaDriver::avidaSentBunkMessage(const QStringList &components){
-  GenDebug
-  << " --- bunk message: \""
-  << components.join(",") << "\".";
-  GenFatal("<avd_AvidaDriver::avidaSentBunkMessage>");
-}
-
-// Avida thread management
-void
-avd_AvidaDriver::avidaMainMessageCatcher(void){
-
-  m_avida_thread_status = avida_threadstat_waiting;
-
-  GenDebug <<
-    " --- entered; ready to begin."
-  ;
-
-  QString message;
-  QStringList components;
-
-  for (;;) {
-
-    int timeout = 1000;
-    message = m_avida_thread_q->receive(timeout);
-
-GenDebug << message;
-
-    components = QStringList::split(",", message);
-
-    if(components[0] == update_avida_message){
-      if(!parseUpdateAvidaArgs(components)){
-        malformedMessageToAvida(message);
-      } else {
-        m_avida_step_organism = -1;
-        // we're nailed into updating mode.
-        m_mission_control->lock();
-        if(ProcessUpdate()){
-          m_mission_control->unlock();
-          m_gui_thread_q->urgent(avida_exited_message);
-          avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-          QApplication::postEvent(this, me);
-
-          GenDebug <<
-            " --- avida thread finishing.\n"
-            " --- sent \""
-          << avida_exited_message << "\".";
-
-          exit();
-        }
-        m_mission_control->unlock();
-      }
-    } else
-    if(components[0] == step_organism_message){
-      if(!parseStepAvidaArgs(components, m_avida_step_organism)){
-        malformedMessageToAvida(message);
-      } else {
-        // we've just switched to stepping mode.
-        GenDebug <<
-          " --- trying to enter step mode.  m_avida_step_organism: "
-        << m_avida_step_organism << ".";
-
-        m_mission_control->lock();
-        if(ProcessUpdate()){
-          m_mission_control->unlock();
-          m_gui_thread_q->urgent(avida_exited_message);
-          avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-          QApplication::postEvent(this, me);
-
-          GenDebug <<
-            " --- avida thread finishing.\n"
-            " --- sent \""
-          << avida_exited_message << "\".";
-
-          exit();
-        }
-        m_mission_control->unlock();
-      }
-    } else
-    if(components[0] == exit_avida_message){
-      if(!parseExitAvidaArgs(components)){
-        malformedMessageToAvida(message);
-      } else {
-        //m_gui_thread_q->urgent(avida_exited_message);
-        //avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-        //QApplication::postEvent(this, me);
-
-        //GenDebug <<
-        //  "<avd_AvidaDriver::avidaMainMessageCatcher>\n"
-        //  " --- avida thread finishing.\n"
-        //  " --- sent \""
-        //<< avida_exited_message << "\".\n";
-        GenDebug << "done.";
-        exit();
-      }
-    } else
-    if(components[0] == hello_query_message){
-      if(!parseHelloAvidaArgs(components)) malformedMessageToAvida(message);
-    } else
-    if(components[0] == null_message){
-      ;
-    } else {
-      malformedMessageToAvida(message);
-    }
-  }
-}
-
-void
-avd_AvidaDriver::avidaSubupdateMessageCatcher(void){
-
-  QString message = m_avida_thread_q->receive(0);
-  QStringList components = QStringList::split(",", message);
-
-  if(components[0] == update_avida_message){
-    if(!parseUpdateAvidaArgs(components)){
-      malformedMessageToAvida(message);
-    } else {
-      m_avida_step_organism = -1;
-      return;
-    }
-  } else
-  if(components[0] == step_organism_message){
-    if(!parseStepAvidaArgs(components, m_avida_step_organism)){
-      malformedMessageToAvida(message);
-    } else {
-      return;
-    }
-  } else
-  //if(components[0] == reset_avida_message){
-  //  if(!parseResetAvidaArgs(components)) malformedMessageToAvida(message);
-  //} else
-  if(components[0] == exit_avida_message){
-    if(!parseExitAvidaArgs(components)){
-      malformedMessageToAvida(message);
-    } else {
-      //m_gui_thread_q->urgent(avida_exited_message);
-      //avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-      //QApplication::postEvent(this, me);
-
-      //GenDebug <<
-      //  "<avd_AvidaDriver::avidaSubupdateMessageCatcher>\n"
-      //  " --- avida thread finishing.\n"
-      //  " --- sent \""
-      //  << avida_exited_message
-      //  << "\".\n";
-      GenDebug << "exiting.";
-
-      exit();
-    }
-  } else
-  if(components[0] == hello_query_message){
-    if(!parseHelloAvidaArgs(components)) malformedMessageToAvida(message);
-  } else
-  if(components[0] == null_message){
-    return;
-  } else {
-    malformedMessageToAvida(message);
-  }
-}
-
-void
-avd_AvidaDriver::avidaSteppingMessageCatcher(void){
-
-  m_avida_thread_status = avida_threadstat_stepping;
-
-  GenDebug << " --- entered; ready to begin.";
-
-  QString message;
-  QStringList components;
-
-  for (;;) {
-
-    GenDebug << " --- waiting for message...";
-
-    message = m_avida_thread_q->receive();
-
-    GenDebug << " --- got message \"" << message << "\".";
-
-    components = QStringList::split(",", message);
-
-    if(components[0] == update_avida_message){
-      if(!parseUpdateAvidaArgs(components)){
-        malformedMessageToAvida(message);
-      } else {
-        m_avida_step_organism = -1;
-        // we've just switched out of stepping mode, into updating mode.
-        return;
-      }
-    } else
-    if(components[0] == step_organism_message){
-      if(!parseStepAvidaArgs(components, m_avida_step_organism)){
-        malformedMessageToAvida(message);
-      } else {
-        // we've still in stepping mode, maybe with a different stepping
-        // organism.
-        return;
-      }
-    } else
-    if(components[0] == exit_avida_message){
-      if(!parseExitAvidaArgs(components)){
-        malformedMessageToAvida(message);
-      } else {
-        //m_gui_thread_q->urgent(avida_exited_message);
-        //avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-        //QApplication::postEvent(this, me);
-
-        //GenDebug <<
-        //  "<avd_AvidaDriver::avidaSteppingMessageCatcher>\n"
-        //  " --- avida thread finishing.\n"
-        //  " --- sent \""
-        //  << avida_exited_message
-        //  << "\".\n";
-        GenDebug << "exiting.";
-
-        exit();
-      }
-    } else
-    if(components[0] == hello_query_message){
-      if(!parseHelloAvidaArgs(components)) malformedMessageToAvida(message);
-    } else
-    if(components[0] == null_message){
-      ; // do nothing
-    } else {
-      malformedMessageToAvida(message);
-    }
-  }
-}
-
-void
-avd_AvidaDriver::avidaBreakpointMessageCatcher(void){
-
-  m_avida_thread_status = avida_threadstat_breakpoint;
-
-  GenDebug << " --- entered; ready to begin."
-  ;
-
-  QString message;
-  QStringList components;
-
-  for (;;) {
-
-    GenDebug << " --- waiting for message...";
-
-    message = m_avida_thread_q->receive();
-
-    GenDebug << " --- got message \"" << message << "\".";
-
-    components = QStringList::split(",", message);
-
-    if(components[0] == update_avida_message){
-      if(!parseUpdateAvidaArgs(components)){
-        malformedMessageToAvida(message);
-      } else {
-        m_avida_step_organism = -1;
-        // we've just switched out of stepping mode, into updating mode.
-        return;
-      }
-    } else
-    if(components[0] == step_organism_message){
-      if(!parseStepAvidaArgs(components, m_avida_step_organism)){
-        malformedMessageToAvida(message);
-      } else {
-        // We're in stepping mode now even if we weren't before
-        // breakpoint.  If we were, maybe we've switched to a different
-        // stepping organism.
-        return;
-      }
-    } else
-    if(components[0] == exit_avida_message){
-      if(!parseExitAvidaArgs(components)){
-        malformedMessageToAvida(message);
-      } else {
-        //m_gui_thread_q->urgent(avida_exited_message);
-        //avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-        //QApplication::postEvent(this, me);
-
-        //GenDebug <<
-        //  "<avd_AvidaDriver::avidaBreakpointMessageCatcher>\n"
-        //  " --- avida thread finishing.\n"
-        //  " --- sent \""
-        //  << avida_exited_message
-        //  << "\".\n"; GenDebug << "<avd_AvidaDriver::avidaBreakpointMessageCatcher> exiting.\n"; exit();
-      } } else
-    if(components[0] == hello_query_message){
-      if(!parseHelloAvidaArgs(components)) malformedMessageToAvida(message);
-    } else
-    if(components[0] == null_message){
-      ; // do nothing
-    } else {
-      malformedMessageToAvida(message);
-    }
-  }
-}
-
-bool
-avd_AvidaDriver::parseUpdateAvidaArgs(const QStringList &components){
-  GenDebug << "entered.";
-
-  if (components.size() != 1){
-    GenDebug << "returning false.";
-    return false;
-  } else {
-    GenDebug << "returning true.";
-    return true;
-  }
-}
-
-bool
-avd_AvidaDriver::parseStepAvidaArgs(const QStringList &components, int &cell_id_return){
-  GenDebug << "entered.";
-
-  if (components.size() != 2){
-    return false;
-  }
-  bool ok;
-  int cell_id = components[1].toInt(&ok);
-  if (!ok){
-    return false;
-  }
-
-  /* FIXME:  sanity check cell_id:  is it in the avida world?
-     if it isn't, puke.
-  */
-
-  cell_id_return = cell_id;
-
+bool avdAvidaThreadDrvr::postUpdate() {
+  // end of update stats...
+  population->CalcUpdateStats();
+  // No viewer; print out status for this update....
+  cStats & stats = population->GetStats();
+  //cout << "UD: "  << stats.GetUpdate() << "\t"
+  //     << "Gen: " << stats.SumGeneration().Average() << "\t"
+  //     << "Fit: " << stats.GetAveFitness() << "\t"
+  //     << "Size: " << population->GetNumOrganisms()
+  //     << endl;
+  Message << "UD: "  << stats.GetUpdate() << "\t"
+          << "Gen: " << stats.SumGeneration().Average() << "\t"
+          << "Fit: " << stats.GetAveFitness() << "\t"
+          << "Size: " << population->GetNumOrganisms();
+  // Check whether to do point mutations
+  if (cConfig::GetPointMutProb() > 0 ) {
+    m_mutations_progress = 0;
+    m_fast_stage_function = &avdAvidaThreadDrvr::ptMutations;
+    m_step_stage_function = &avdAvidaThreadDrvr::ptMutations; }
+  else {
+    m_fast_stage_function = &avdAvidaThreadDrvr::postPtMutations;
+    m_step_stage_function = &avdAvidaThreadDrvr::postPtMutations; }
   return true;
 }
-
-bool
-avd_AvidaDriver::parseExitAvidaArgs(const QStringList &components){
-  GenDebug << "entered.";
-
-  if (components.size() != 1){
-    return false;
-  } else {
-    return true;
-  }
-}
-
-bool
-avd_AvidaDriver::parseHelloAvidaArgs(const QStringList &components){
-  GenDebug << "called.\n";
-
-  if (components.size() != 1){
-    return false;
-  }
-  m_gui_thread_q->send(hello_response_message + "," + m_avida_thread_status);
-  avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-  QApplication::postEvent(this, me);
-
-  GenDebug << " sent \""
-    << (hello_response_message + "," + m_avida_thread_status)
-    << "\".";
-
+bool avdAvidaThreadDrvr::ptMutations() {
+  if (m_mutations_progress < population->GetSize()) {
+    if (population->GetCell(m_mutations_progress).IsOccupied()) {
+	    population->GetCell(m_mutations_progress).GetOrganism()->
+	      GetHardware().PointMutate(cConfig::GetPointMutProb()); }
+    m_mutations_progress++; }
+  else {
+    m_fast_stage_function = &avdAvidaThreadDrvr::postPtMutations;
+    m_step_stage_function = &avdAvidaThreadDrvr::postPtMutations; }
   return true;
 }
-
-void
-avd_AvidaDriver::malformedMessageToAvida(const QStringList &components){
-  GenDebug << "entered.";
-
-  m_gui_thread_q->urgent(malformed_message_to_avida + "," + components.join(","));
-  avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-  QApplication::postEvent(this, me);
-
-  GenDebug << " sent \""
-    << (malformed_message_to_avida + "," + components.join(","))
-    << "\".";
-
-  exit();
-}
-
-
-
-void
-avd_AvidaDriver::ProcessOrganisms(void){
-  GenDebug << "called.\n";
-
-  // Process the update.
-
-  const int UD_size =
-    cConfig::GetAveTimeslice()*population->GetNumOrganisms();
-  m_mission_control->unlock();
-  const double step_size = 1.0 / (double) UD_size;
-
-  m_update_chunking_timer_isvalid = true;
-  m_update_chunking_timer->start();
-
-  int i = 0;
-  while (i < UD_size) {
-    m_mission_control->lock();
-
-    // process sufficiently small qty of organisms, determined by
-    // m_required_chunk_size_in_organisms, that processing thread can
-    // respond to gui messages fairly quickly..
-    int j = 0;
-    while (j < m_required_chunk_size_in_organisms && i < UD_size){
-      m_current_organism_id = population->ScheduleOrganism();
-      population->ProcessStep(step_size, m_current_organism_id);
-
-      // Keep the viewer informed about the organism we are stepping
-      // through, if we're stepping through an organism...
-      // m_avida_step_organism == -1 if we're not, in which case
-      // NotifyStep() will never be called.
-      if (m_current_organism_id == m_avida_step_organism){
-        m_update_chunking_timer_isvalid = false;
-        m_mission_control->unlock();
-        NotifyStep(m_current_organism_id);
-        m_mission_control->lock();
-      }
-      j++; i++;
-    }
-    m_required_chunk_size_in_organisms = j;
-
-    if ( (m_last_chunk_interval_in_milliseconds = m_update_chunking_timer->restart()) < 1){
-      // prevent divide by zero when computing running average.
-      m_last_chunk_interval_in_milliseconds = 1;
-    }
-    if(m_update_chunking_timer_isvalid){
-      m_required_chunk_size_in_organisms +=
-        ( m_required_chunk_size_in_organisms
-          * m_desired_update_chunk_time_interval_in_milliseconds)
-        / m_last_chunk_interval_in_milliseconds;
-      if ( (m_required_chunk_size_in_organisms /= 2) < 1){
-        // must always process at least one arganism!
-        m_required_chunk_size_in_organisms = 1;
-      }
-    }
-    m_update_chunking_timer_isvalid = true;
-
-    m_mission_control->unlock();
-    avidaSubupdateMessageCatcher();
-  }
-
-  // end-of-update stats...
-  m_mission_control->lock();
-  population->CalcUpdateStats();
-
-  // Setup the viewer for the new update.
-  cStats & stats = population->GetStats();
-  Message
-    << "UD: "
-    << stats.GetUpdate()
-    << "\tGen: "
-    << stats.SumGeneration().Average()
-    << "\tFit: "
-    << stats.GetAveFitness();
-  m_mission_control->unlock();
-
-  NotifyUpdate();
-
-  m_mission_control->lock();
-}
-
-
-//
-bool
-avd_AvidaDriver::avidaIsRunning(){
-  GenDebug << "entered";
-  if(m_expected_avida_state == STOPPED){
-    GenDebug << " -- false; done.";
-    return false;
-  } else {
-    GenDebug << " -- true; done.";
-    return true;
-  }
-}
-
-
-/* FIXME: complete. */
-void
-avd_AvidaDriver::NotifyUpdate(void){
-  m_gui_thread_q->send(avida_updated_message);
-  avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-  QApplication::postEvent(this, me);
-
-  GenDebug << " sent \"" << avida_updated_message << "\".";
-}
-
-/* FIXME: complete. */
-void
-avd_AvidaDriver::NotifyStep(int cell_id){
-  m_gui_thread_q->send(
-    (organism_stepped_message + ",%1")
-    .arg(cell_id)
-  );
-  avd_GuiMsgEvent *me = new avd_GuiMsgEvent();
-  QApplication::postEvent(this, me);
-
-  GenDebug << " sent \""
-    << (organism_stepped_message + ",%1").arg(cell_id) << "\".";
-
-  avidaSteppingMessageCatcher();
-}
-
-/* FIXME: complete. */
-void
-avd_AvidaDriver::SignalBreakpoint(void){
-  GenDebug << "called.";
-
-  // Process the update.
-  const int UD_size =
-    cConfig::GetAveTimeslice()*population->GetNumOrganisms();
-  m_mission_control->unlock();
-  const double step_size = 1.0 / (double) UD_size;
-
-  // Keep the viewer informed about the organism we are stepping
-  // through, if we're stepping through an organism...
-  // m_avida_step_organism == -1 if we're not, in which case
-  // NotifyStep() will never be called.
-
-  for (int i = 0; i < UD_size; i++) {
-    m_mission_control->lock();
-    m_current_organism_id = population->ScheduleOrganism();
-    population->ProcessStep(step_size, m_current_organism_id);
-    m_mission_control->unlock();
-    if (m_current_organism_id == m_avida_step_organism){
-      NotifyStep(m_current_organism_id);
-    }
-  }
-
-  // end-of-update stats...
-  m_mission_control->lock();
-  population->CalcUpdateStats();
-
-  // Setup the viewer for the new update.
-  cStats & stats = population->GetStats();
-  Message
-    << "UD: "
-    << stats.GetUpdate()
-    << "\tGen: "
-    << stats.SumGeneration().Average()
-    << "\tFit: "
-    << stats.GetAveFitness();
-  m_mission_control->unlock();
-
-  NotifyUpdate();
-
-  m_mission_control->lock();
-}
-
-
+bool avdAvidaThreadDrvr::postPtMutations() {
+#ifdef DEBUG_CHECK_OK
+  // If we're in a debug mode, make sure the population is OK.
+  if (population->OK() == false)
+  { g_debug.Warning("Population::OK() is failing."); }
+#endif
+  // Do any cleanup in the hardware factory...
+  cHardwareFactory::Update();
+  // Exit conditons...
+  if (population->GetNumOrganisms() == 0){
+    done_flag = true;
+    m_emit_function = &avdAvidaThreadDrvr::emitClosedSig;
+  } else m_emit_function = &avdAvidaThreadDrvr::emitUpdatedSig;
+  m_fast_stage_function = &avdAvidaThreadDrvr::preUpdate;
+  m_step_stage_function = &avdAvidaThreadDrvr::preUpdate;
+  return false;
+}
+
+void avdAvidaThreadDrvr::SignalBreakpoint(void){
+  m_breakpoint_cell_id = m_current_cell_id;
+  m_emit_function = &avdAvidaThreadDrvr::emitBreakpointSig;
+  QApplication::postEvent(this, new avdGuiMsgEvent);
+  m_wait_condition.wait(m_mutex);
+}
+
+void avdAvidaThreadDrvr::emitUpdatedSig(){
+  emit(avidaUpdatedSig(this));
+  if(m_run_continuously){ emit(doStartAvidaSig()); }
+}
+void avdAvidaThreadDrvr::emitSteppedSig()
+{ emit(avidaSteppedSig(this, m_step_cell_id)); }
+void avdAvidaThreadDrvr::emitBreakpointSig()
+{ emit(avidaBreakSig(this, m_breakpoint_cell_id)); }
+void avdAvidaThreadDrvr::emitClosedSig()
+{ emit(avidaClosedSig(this)); }
+void avdAvidaThreadDrvr::customEvent(QCustomEvent *custom_event){
+  if (custom_event->type() == static_cast<int>(avdGuiMsgEvent::EventType)){
+    (this->*(m_emit_function))();
+} }
Index: avida/current/source/qt-viewer/avd_avida_driver.hh
diff -u avida/current/source/qt-viewer/avd_avida_driver.hh:1.1.2.2 avida/current/source/qt-viewer/avd_avida_driver.hh:1.1.2.3
--- avida/current/source/qt-viewer/avd_avida_driver.hh:1.1.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/avd_avida_driver.hh	Mon Aug 25 18:46:26 2003
@@ -1,12 +1,6 @@
 #ifndef AVD_AVIDA_DRIVER_HH
 #define AVD_AVIDA_DRIVER_HH
 
-
-
-#ifndef AVIDA_HH
-#include "../main/avida.hh"
-#endif
- 
 #ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
 #endif  
@@ -17,180 +11,132 @@
 #include <qthread.h>
 #endif  
 
-#ifndef AVD_MESSAGE_QUEUE_HDRS_HH
-#include "avd_message_queue_hdrs.hh"
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
+
+#ifndef AVIDA_HH
+#include "avida.hh"
 #endif
 
 
-class avd_MissionControl;
-class MessagingPopulationWrapper;
 class QCustomEvent;
 class QWaitCondition;
-
-class avd_AvidaDriver :
-  public QObject,
-  public cAvidaDriver_Population,
-  public QThread
-{
-  Q_OBJECT
-private:
-  avd_MissionControl *m_mission_control;
-  //MessagingPopulationWrapper *m_pop_wrap;
-
-  // m_avida_thread_q and m_gui_thread_q should share m_mutex, but
-  // should create their own wait conditions.
-  avd_MessageQueue<QString> *m_avida_thread_q;
-  avd_MessageQueue<QString> *m_gui_thread_q;
-
-
-  static const QString
-    update_avida_message,
-    step_organism_message,
-    //reset_avida_message,
-    exit_avida_message,
-
-    avida_updated_message,
-    organism_stepped_message,
-    avida_breakpoint_message,
-    //avida_continuing_message,
-    //avida_reset_message,
-    avida_exited_message,
-
-    hello_query_message,
-    hello_response_message,
-    
-    malformed_message_to_avida,
-    null_message,
-
-    avida_threadstat_breakpoint,
-    avida_threadstat_stepping,
-    avida_threadstat_waiting;
-  /*
-  These should be set and read only by the avida thread.
-  m_avida_thread_status should be one of
-    avida_threadstat_breakpoint,
-    avida_threadstat_stepping,
-    avida_threadstat_waiting;
-  */
-  QString m_avida_thread_status;
-  int m_avida_step_organism;
-  int m_current_organism_id;
-
-  /*
-  These should be set and read only by the gui thread.
-  */
-  //bool m_should_avida_update;
-  enum ExpectedAvidaState{
-    STOPPED,
-    STEPPING,
-    RUNNING 
-  } m_expected_avida_state;
-  int m_gui_step_organism;
-    
-  //unsigned int
-  //  m_messaging_timer_delay,
-  //  m_min_update_interval,
-  //  m_retry_timer_delay;
-
-  /*
-  following variables are used to maintain responsiveness of avida's
-  processing thread.  goal is to process just enough organisms to
-  consume m_desired_update_chunk_time_interval_in_milliseconds.
-
-  the code lies in ProcessOrganisms, and maintains a running weighted
-  average in m_required_chunk_size_in_organisms.  for each chunk of
-  organisms processed, the time taken to process that chunk is
-  determined, and used to revise the estimated size of the next chunk.
-  */
-  int m_desired_update_chunk_time_interval_in_milliseconds;
-  // following variable is the elapsed time in processing last chunk of
-  // organisms.  valid exactly when m_update_chunking_timer_isvalid is
-  // true.
-  int m_last_chunk_interval_in_milliseconds;
-  // following variable is the running average mentioned above.
-  int m_required_chunk_size_in_organisms;
-  // following variable is used to measure time elapsed in processing
-  // one chunk.
-  QTime *m_update_chunking_timer;
-  // if processing is interrupted, the elapsed time for the current
-  // chunk is discarded, and the running average is NOT updated.
-  // following variable is true unless processing was interrupted (by a
-  // breakpoint, a stop-processing request in the middle of an update,
-  // etc.).
-  bool m_update_chunking_timer_isvalid;
-
+class cPopulation;
+class cEventList;
+class avdAvidaThreadDrvr :
+  public QObject
+, public QThread
+, public cAvidaDriver_Population
+, public cRetainable
+{ Q_OBJECT
+protected:
+  QMutex *m_mutex;
+  QWaitCondition m_wait_condition;
+  bool (avdAvidaThreadDrvr::*m_mode_function)();
+  bool (avdAvidaThreadDrvr::*m_fast_stage_function)();
+  bool (avdAvidaThreadDrvr::*m_step_stage_function)();
+  void (avdAvidaThreadDrvr::*m_emit_function)();
+  bool m_run_continuously;
+  bool m_step_mode;
+  int m_step_cell_id;
+  int m_breakpoint_cell_id;
+  int m_current_cell_id;
+  int m_UD_size;
+  double m_step_size;
+  int m_UD_progress;
+  int m_mutations_progress;
+public:
+  avdAvidaThreadDrvr();
+  avdAvidaThreadDrvr(cEnvironment &environment, QMutex *mutex);
+  ~avdAvidaThreadDrvr();
 public:
-  avd_AvidaDriver();
-  avd_AvidaDriver(avd_MissionControl *mission_control, cEnvironment &environment);
-  ~avd_AvidaDriver();
-  
+  cPopulation *getPopulation();
+  cEventList *getEventList();
+  /*
+  Entry point into the driver by the gui thread; all it really does is
+  start the processing thread, and then return.
+  */
   virtual void Run();
+public slots:
+  /*
+  The following six slots are called by the gui, and control the
+  processing thread.
+  */
+  void doPauseAvidaSlot();
+  void doStartAvidaSlot();
+  void doUpdateAvidaSlot();
+  void doStepAvidaSlot(int cell_id);
+  void doCloseAvidaSlot();
+protected:
+  void wakeProcessingThread(bool continuous, bool step);
+signals:
+  void avidaUpdatedSig(cAvidaDriver_Population *pop);
+  void avidaSteppedSig(cAvidaDriver_Population *pop, int cell_id);
+  void avidaBreakSig(cAvidaDriver_Population *pop, int cell_id);
+  void avidaClosedSig(cAvidaDriver_Population *pop);
+  void doStartAvidaSig();
+protected:
+  /*
+  Entry point into the driver by the processing thread, and contains the
+  main loop of the processing thread.  The loop continues until told by
+  the gui thread to exit.  The processing thread is a state machine; the
+  loop drives the transitions between states.
+  */
   virtual void run();
-
-  // Avida thread management
-  virtual void ProcessOrganisms();
-
-  //
-  bool avidaIsRunning();
 protected:
-  void customEvent(QCustomEvent *custom_event);
-
-protected slots:
-
-  void isAvidaRunningSlot(void);
-
-  void scheduleUpdateSlot(void);
-  void updateAvidaSlot(void);
-  void stepOrganismSlot(int cell_id);
-  void startAvidaSlot(void);
-  void stopAvidaSlot(void);
-  //void resetAvidaSlot(void);
-  void exitAvidaSlot(void);
-  void helloAvidaSlot(void);
-  void malformedMessageToAvidaSlot(void);
-
-protected slots:
-
-  // GUI thread management
-  void guiMessageCatcher(void);
+  /*
+  State transitions are effected by setting the pointers
+  m_mode_function, m_fast_stage_function, and m_step_stage_function to
+  point to various of the following nine functions.
+  */
+  /*
+  m_mode_function is set by the gui thread to one of following three
+  functions, which is then executed by the processing thread.
+  */
+  bool fastMode();
+  bool stepMode();
+  bool closingMode();
+  /*
+  m_fast_stage_function, and m_step_stage_function are each set to one
+  of the following functions by the processing thread.  If the
+  processing thread is in fast mode then fastMode() will execute
+  m_fast_stage_function; otherwise stepMode() will execute
+  m_step_stage_function.
 
+  If the processing thread is in closingMode() then it shuts itself down.
+  */
+  bool preUpdate();
+  bool fastUpdate();
+  bool stepUpdate();
+  bool postUpdate();
+  bool ptMutations();
+  bool postPtMutations();
 protected:
-
-  // GUI thread management
-  bool avidaUpdated(const QStringList &);
-  bool organismStepped(const QStringList &);
-  bool avidaBreakpoint(const QStringList &);
-  //bool avidaContinuing(const QStringList &);
-  //bool avidaReset(const QStringList &);
-  bool avidaExited(const QStringList &);
-  bool avidaSaysHi(const QStringList &);
-  void avidaGotBunkMessage(const QStringList &);
-  void avidaSentBunkMessage(const QStringList &);
-
-  // Avida thread management
-  void avidaMainMessageCatcher(void);
-  void avidaSubupdateMessageCatcher(void);
-  void avidaSteppingMessageCatcher(void);
-  void avidaBreakpointMessageCatcher(void);
-
-  bool parseUpdateAvidaArgs(const QStringList &);
-  bool parseStepAvidaArgs(const QStringList &, int &cell_id_return);
-  //bool parseContinueAvidaArgs(const QStringList &);
-  //bool parseResetAvidaArgs(const QStringList &);
-  bool parseExitAvidaArgs(const QStringList &);
-  bool parseHelloAvidaArgs(const QStringList &);
-
-  void malformedMessageToAvida(const QStringList &);
-
-  virtual void NotifyUpdate(void);
-  virtual void NotifyStep(int cell_id);
   virtual void SignalBreakpoint(void);
-};  
-    
-  
-#else
-#warning multiple inclusion of avd_avida_driver.hh
-#endif /* !AVD_AVIDA_DRIVER_HH */
+protected:
+  /*
+  When the processing thread is about to perform an important state
+  transition (e.g., from the end of the current update to the start of
+  the next one), it sets the pointer m_emit_function to one of the
+  following four functions; then it alerts the gui thread of the pending
+  state transition by sending an event of type "avdGuiMsgEvent" to the
+  gui thread.  The gui thread catches this event in customEvent(),
+  below.  After catching the event, the gui thread calls the function
+  pointed to by m_emit_function.  This alerts the various user interface
+  elements of the state change.
+
+  Meanwhile, the processing thread stops and waits for new instructions
+  by the gui thread.
+  */
+  void emitUpdatedSig();
+  void emitSteppedSig();
+  void emitBreakpointSig();
+  void emitClosedSig();
+protected:
+  void customEvent(QCustomEvent *custom_event);
+};
+ 
+#endif
     
 /* vim: set ts=2 ai et: */
-
Index: avida/current/source/qt-viewer/avd_driver_controller.cc
diff -u avida/current/source/qt-viewer/avd_driver_controller.cc:1.1.2.2 avida/current/source/qt-viewer/avd_driver_controller.cc:1.1.2.3
--- avida/current/source/qt-viewer/avd_driver_controller.cc:1.1.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/avd_driver_controller.cc	Mon Aug 25 18:46:26 2003
@@ -1,263 +1,152 @@
-
+#ifndef QGUARDEDPTR_H
+#include <qguardedptr.h>
+#endif  
   
-#ifndef AVD_DRIVER_CONTROLLER_HH
-#include "avd_driver_controller.hh"
-#endif
-
-#ifndef AVD_MISSION_CONTROL_HH
-#include "avd_mission_control.hh"
-#endif
-#ifndef AVD_MESSAGE_QUEUE_HDRS_HH
-#include "avd_message_queue_hdrs.hh"
-#endif
- 
 #ifndef AVIDA_HH
-#include "../main/avida.hh"
+#include "main/avida.hh"
 #endif
 #ifndef CONFIG_HH
-#include "../main/config.hh"
-#endif
-#ifndef HARDWARE_METHOD_HH
-#include "../cpu/hardware_method.hh"
+#include "main/config.hh"
 #endif
 #ifndef ENVIRONMENT_HH
-#include "../main/environment.hh"
+#include "main/environment.hh"
 #endif
 #ifndef POPULATION_HH
-#include "../main/population.hh"
+#include "main/population.hh"
 #endif
+
 #ifndef AVD_AVIDA_DRIVER_HH
 #include "avd_avida_driver.hh"
 #endif
-#ifndef SETUP_AVIDA_HH
-#include "setup_avida.hh"
-#endif
-
-#ifndef QAPPLICATION_H
-#include <qapplication.h>
+#ifndef AVD_AVIDA_THREAD_DRVR_DBG_HH
+#include "avd_avida_thread_drvr_dbg.hh"
 #endif
-#ifndef QOBJECTLIST_H
-#include <qobjectlist.h>
+#ifndef AVD_CONNECTIONS_HH
+#include "avd_connections.hh"
 #endif
-#ifndef QGUARDEDPTR_H
-#include <qguardedptr.h>
-#endif  
-#ifndef QSTRING_H
-#include <qstring.h>
+#ifndef SETUP_AVIDA_HH
+#include "setup_avida.hh"
 #endif
-
-#ifndef STRING_HH
-#include "../tools/string.hh"
+#ifndef AVD_MISSION_CONTROL_HH
+#include "avd_mission_control.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+ 
+#ifndef AVD_DRIVER_CONTROLLER_HH
+#include "avd_driver_controller.hh"
 #endif
 
-
 using namespace std;
 
+avdMessageType  Info_THRD_DRVR_avdMsg("ThreadHdlr", avdMCInfo);
+avdMessageType Debug_THRD_DRVR_avdMsg("ThreadHdlr", avdMCDebug);
+avdMessageType Error_THRD_DRVR_avdMsg("ThreadHdlr", avdMCError);
+avdMessageType Fatal_THRD_DRVR_avdMsg("ThreadHdlr", avdMCFatal);
 
-class avd_DriverControllerData {
-private:
-  // m_mission_control owns avd_DriverController, not the other way
-  // around, so don't delete it.
-  avd_MissionControl *m_mission_control;
-
-  // everything else is owned by avd_DriverController, so they should be
-  // deleted.
-  QGuardedPtr<avd_AvidaDriver> m_avida_driver;
-  cEnvironment *m_environment;
-  cPopulationInterface *m_test_interface;
-
-public:
-  avd_DriverControllerData(avd_MissionControl *mission_control);
-  ~avd_DriverControllerData();
-
-  void closeAvida();
-  void openAvida(int argc, char **argv);
-
-  avd_MissionControl *getMissionControl();
-  QGuardedPtr<avd_AvidaDriver>      getAvidaDriver();
-  cEnvironment                     *getEnvironment();
-  cPopulationInterface             *getPopulationInterface();
-
-  bool avidaIsRunning();
-};
-
-avd_DriverControllerData::avd_DriverControllerData(avd_MissionControl *mission_control)
-:m_mission_control(mission_control),
- m_environment(0),
- m_test_interface(0)
-{
-  GenDebug("entered.");
-  GenDebug("done.");
-}
-
-avd_DriverControllerData::~avd_DriverControllerData(){
-  GenDebug("entered.");
-  closeAvida();
-  GenDebug("done.");
-}
-
-void
-avd_DriverControllerData::closeAvida(){
-  GenDebug("entered.");
-  if(m_avida_driver){
-    m_mission_control->emitExitAvidaSig();
-    delete m_avida_driver;
-    m_avida_driver = 0;
-  }
-  if(m_environment){
-    delete m_environment;
-    m_environment = 0;
-  }
-  if(m_test_interface){
-    delete m_test_interface;
-    m_test_interface = 0;
-  }
-  GenDebug("done.");
-}
-
-void
-avd_DriverControllerData::openAvida(int argc, char **argv){
-  GenDebug("entered.");
-
-  closeAvida();
 
+void avdAvidaThreadCtrl::openAvidaSlot(){
+  Debug << "got open sig.";
+  closeAvidaSlot();
   m_environment = new cEnvironment();
   m_test_interface = new cPopulationInterface();
-
-  //SetupAvida(
-  //  argc,
-  //  argv,
-  //  *m_environment,
-  //  *m_test_interface
-  //);
-  SetupAvidaQtMultithreading(
-    argc,
-    argv,
-    *m_environment,
-    *m_test_interface
-  );
-  m_avida_driver = new avd_AvidaDriver(
-    m_mission_control,
-    *m_environment 
-  );
-  cAvidaDriver_Base::main_driver = m_avida_driver;
-  m_avida_driver->Run();
-  m_mission_control->emitAvidaOpenedSig();
-
-  GenDebug("done.");
-}
-
-avd_MissionControl *
-avd_DriverControllerData::getMissionControl(){
-  GenDebug("entered.");
-  GenDebug("done.");
-  return m_mission_control;
-}
-
-QGuardedPtr<avd_AvidaDriver>
-avd_DriverControllerData::getAvidaDriver(){
-  GenDebug("entered.");
-  GenDebug("done.");
-  return m_avida_driver;
-}
-
-cEnvironment *
-avd_DriverControllerData::getEnvironment(){
-  GenDebug("entered.");
-  GenDebug("done.");
-  return m_environment;
-}
-
-cPopulationInterface *
-avd_DriverControllerData::getPopulationInterface(){
-  GenDebug("entered.");
-  GenDebug("done.");
-  return m_test_interface;
-}
-
-bool
-avd_DriverControllerData::avidaIsRunning(){
-  GenDebug("entered.");
-
-  bool yesno;
-  
-  if(m_avida_driver.isNull()){
-    GenDebug("no driver; returning false.");
-    yesno = false;
-  } else {
-    yesno = m_avida_driver->avidaIsRunning();
-    if(yesno){
-      GenDebug("returning true.");
-    } else {
-      GenDebug("returning false.");
-    }
+  // XXX obtaiin cmd ln args here
+  setArgcArgv(getMissionControl()->argc(), getMissionControl()->argv());
+  SetupAvidaQtMultithreading(m_argc, m_argv, *m_environment, *m_test_interface);
+  setThreadDriver(new avdAvidaThreadDrvr(*m_environment, getMissionControl()->getMutex()));
+  if(!getThreadDriver()){
+    Fatal << "couldn't create new avida thread driver.";
   }
-  GenDebug("done.");
-  return yesno;
-}
-
+  getThreadDriver()->release();
+  
+  cAvidaDriver_Base::main_driver = getThreadDriver();
+  getMissionControl()->setPopulation(getThreadDriver()->getPopulation());
+  getMissionControl()->setEventList(getThreadDriver()->getEventList());
+
+  avdConnections cnct2(this, getThreadDriver());
+  cnct2.add(SIGNAL(doPauseAvidaSig()), SLOT(doPauseAvidaSlot()));
+  cnct2.add(SIGNAL(doStartAvidaSig()), SLOT(doStartAvidaSlot()));
+  cnct2.add(SIGNAL(doUpdateAvidaSig()), SLOT(doUpdateAvidaSlot()));
+  cnct2.add(SIGNAL(doStepAvidaSig(int)), SLOT(doStepAvidaSlot(int)));
+  cnct2.add(SIGNAL(doCloseAvidaSig()), SLOT(doCloseAvidaSlot()));
+
+  avdConnections cnct3(getThreadDriver(), this);
+  cnct3.add(SIGNAL(avidaUpdatedSig(cAvidaDriver_Population *)),
+    SIGNAL(avidaUpdatedSig(cAvidaDriver_Population*)));
+  cnct3.add(SIGNAL(avidaSteppedSig(cAvidaDriver_Population *, int)),
+    SIGNAL(avidaSteppedSig(cAvidaDriver_Population *, int)));
+  cnct3.add(SIGNAL(avidaBreakSig(cAvidaDriver_Population *, int)),
+    SIGNAL(avidaBreakSig(cAvidaDriver_Population *, int)));
+  cnct3.add(SIGNAL(avidaClosedSig(cAvidaDriver_Population *)),
+    SIGNAL(avidaClosedSig(cAvidaDriver_Population *)));
+  cnct3.add(SIGNAL(doStartAvidaSig()), SIGNAL(doStartAvidaSig()));
+
+  Debug << "telling driver to start avida processing thread.";
+  getThreadDriver()->Run();
+  Debug << "emitting 'avida opened' sig.";
+  emit(avidaOpenedSig(getThreadDriver()));
+  Debug << "open slot is done.";
+}
+
+void avdAvidaThreadCtrl::closeAvidaSlot(){
+  Debug << "got close sig.";
+  emit(doCloseAvidaSig());
+  setThreadDriver(0);
+  if(m_environment){ delete m_environment; m_environment = 0; }
+  if(m_test_interface){ delete m_test_interface; m_test_interface = 0; }
+  Debug << "close slot is done.";
+}
+
+void avdAvidaThreadCtrl::setMissionControl(avd_MissionControl *mc)
+{ SETretainable(m_mission_control, mc); }
+void avdAvidaThreadCtrl::setThreadDriver(avdAvidaThreadDrvr *driver)
+{ SETretainable(m_driver, driver); }
+void avdAvidaThreadCtrl::setArgcArgv(int argc, char **argv)
+{ m_argc = argc; m_argv = argv; }
+
+cEnvironment *avdAvidaThreadCtrl::getEnvironment()
+{ return m_environment; }
+cPopulationInterface * avdAvidaThreadCtrl::getPopulationInterface()
+{ return m_test_interface; }
 
-    
-avd_DriverController::avd_DriverController(
+avdAvidaThreadCtrl::avdAvidaThreadCtrl(
   avd_MissionControl *mission_control,
   QObject *parent,
   const char *name
-):QObject(parent, name)
-{ 
-  GenDebug("entered.");
-  d = new avd_DriverControllerData(mission_control);
-  connect(
-    mission_control, SIGNAL(openAvidaSig(void)),
-    this, SLOT(openAvidaSlot(void))
-  );
-  connect(
-    mission_control, SIGNAL(closeAvidaSig(void)),
-    this, SLOT(closeAvidaSlot(void))
-  );
-  GenDebug("done.");
-} 
-  
-avd_DriverController::~avd_DriverController(){
-  GenDebug("entered.");
-  delete d;
-  GenDebug("done.");
-}
-
-void
-avd_DriverController::wrapupInit(void){
-  GenDebug("entered.");
-  GenDebug("done.");
-}
-
-
-void
-avd_DriverController::openAvidaSlot(void){
-  GenDebug("entered.");
-  d->openAvida(d->getMissionControl()->argc(), d->getMissionControl()->argv());
-  GenDebug("done.");
-} 
+)
+: QObject(parent, name),
+  m_environment(0),
+  m_test_interface(0),
+  m_driver(0)
+{
+  Debug << "avdAvidaThreadCtrl ctor...";
+  nameWatched("(<avdAvidaThreadCtrl>)");
+  setMissionControl(mission_control);
+
+  avdConnections cnct0(getMissionControl(), this);
+  cnct0.add(SIGNAL(openAvidaSig(void)), SLOT(openAvidaSlot(void)));
+  cnct0.add(SIGNAL(closeAvidaSig(void)), SLOT(closeAvidaSlot(void)));
+
+  cnct0.add(SIGNAL(stopAvidaSig(void)), SIGNAL(doPauseAvidaSig(void)));
+  cnct0.add(SIGNAL(startAvidaSig(void)), SIGNAL(doStartAvidaSig(void)));
+  cnct0.add(SIGNAL(updateAvidaSig(void)), SIGNAL(doUpdateAvidaSig(void)));
+  cnct0.add(SIGNAL(stepAvidaSig(int)), SIGNAL(doStepAvidaSig(int)));
+  cnct0.add(SIGNAL(closeAvidaSig(void)), SIGNAL(closeAvidaSlot(void)));
+
+  avdConnections cnct1(this, getMissionControl());
+  cnct1.add(SIGNAL(avidaUpdatedSig(cAvidaDriver_Population *)), SIGNAL(avidaUpdatedSig()));
+  //cnct1.add(SIGNAL(avidaSteppedSig(cAvidaDriver_Population *, int)), //SIGNAL(avidaSteppedSig()));
+  //cnct1.add(SIGNAL(avidaBreakSig(cAvidaDriver_Population *, int)), //SIGNAL(avidaBreakpointSig()));
+  cnct1.add(SIGNAL(avidaOpenedSig(cAvidaDriver_Population *)), SIGNAL(avidaOpenedSig()));
+  // really use avidaExitedSig?  instead of a close sig? I think avidaExitedSig makes avida quit.
+  cnct1.add(SIGNAL(avidaClosedSig(cAvidaDriver_Population *)), SIGNAL(avidaClosedSig()));
 
-void
-avd_DriverController::closeAvidaSlot(void){
-  GenDebug("entered.");
-  d->closeAvida();
-  GenDebug("done.");
+  Debug << "avdAvidaThreadCtrl ctor done.";
 } 
-
-bool
-avd_DriverController::avidaIsRunning(){
-  GenDebug("entered.");
-  bool yesno = d->avidaIsRunning();
-  if(yesno){
-    GenDebug("returning true.");
-  } else {
-    GenDebug("returning false.");
-  }
-  GenDebug("done.");
-  return yesno;
+avdAvidaThreadCtrl::~avdAvidaThreadCtrl(){
+  Debug << "avdAvidaThreadCtrl dtor...";
+  closeAvidaSlot();
+  setMissionControl(0);
+  Debug << "avdAvidaThreadCtrl dtor done.";
 }
+
 
 /* vim: set ts=2 ai et: */
Index: avida/current/source/qt-viewer/avd_driver_controller.hh
diff -u avida/current/source/qt-viewer/avd_driver_controller.hh:1.1 avida/current/source/qt-viewer/avd_driver_controller.hh:1.1.2.1
--- avida/current/source/qt-viewer/avd_driver_controller.hh:1.1	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/avd_driver_controller.hh	Mon Aug 25 18:46:26 2003
@@ -1,48 +1,68 @@
-#ifndef AVD_DRIVER_CONTROLLER_HH
-#define AVD_DRIVER_CONTROLLER_HH
+#ifndef AVD_ORIG_DRIVER_CONTROLLER_HH
+#define AVD_ORIG_DRIVER_CONTROLLER_HH
   
 #ifndef QOBJECT_H
 #include <qobject.h>
 #endif
+#ifndef QGUARDEDPTR_H
+#include <qguardedptr.h>
+#endif  
 
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
-/*
-note: I started doing some memory management stuff here, then stopped
-deciding that the function below should be called exactly once.
-
-keep it in mind, considering proper handling if you decide to copy,
-delete, create, etc. dynamically sometime in the future.
-
--- kgn
-*/
-
+class avdAvidaThreadDrvr;
+class cAvidaDriver_Population;
+class cEnvironment;
+class cPopulationInterface;
 class avd_MissionControl;
-class avd_DriverControllerData;
-
-class avd_DriverController : public QObject
+class avdAvidaThreadCtrl
+: public QObject
+, public cRetainable
 {
   Q_OBJECT
-private:
-  avd_DriverControllerData *d;
-
+protected:
+  cEnvironment *m_environment;
+  cPopulationInterface *m_test_interface;
+  //QGuardedPtr<avdAvidaThreadDrvr> m_driver;
+  QGuardedPtr<avd_MissionControl> m_mission_control;
+  avdAvidaThreadDrvr *m_driver;
+protected:
+  void setThreadDriver(avdAvidaThreadDrvr *driver);
+  void setMissionControl(avd_MissionControl *mc);
+  avdAvidaThreadDrvr *getThreadDriver(){ return m_driver; }
+  avd_MissionControl *getMissionControl(){ return m_mission_control; }
+public:
+  int m_argc; char **m_argv;
+  void setArgcArgv(int argc, char **argv);
 public:
-  avd_DriverController(
+  avdAvidaThreadCtrl(
     avd_MissionControl *mission_control,
     QObject *parent = 0,
-    const char *name = 0
-  );
-  ~avd_DriverController();
-  void wrapupInit(void);
-
+    const char *name = 0);
+  ~avdAvidaThreadCtrl();
+  void wrapupInit(){}
+  cEnvironment *getEnvironment();
+  cPopulationInterface *getPopulationInterface();
+  //bool avidaIsRunning();
 public slots:
   void openAvidaSlot(void);
   void closeAvidaSlot(void);
-  bool avidaIsRunning();
+signals:
+  void doPauseAvidaSig();
+  void doStartAvidaSig();
+  void doUpdateAvidaSig();
+  void doStepAvidaSig(int cell_id);
+  void doCloseAvidaSig();
+
+  void avidaUpdatedSig(cAvidaDriver_Population *pop);
+  void avidaSteppedSig(cAvidaDriver_Population *pop, int cell_id);
+  void avidaBreakSig(cAvidaDriver_Population *pop, int cell_id);
+  void avidaOpenedSig(cAvidaDriver_Population *pop);
+  void avidaClosedSig(cAvidaDriver_Population *pop);
 };
 
-
-#else
-#warning multiple inclusion of avd_driver_controller.hh
-#endif /* !AVD_DRIVER_CONTROLLER_HH */
+#endif /* !AVD_ORIG_DRIVER_CONTROLLER_HH */
   
 /* vim: set ts=2 ai et: */
Index: avida/current/source/qt-viewer/avd_gui_msg_event.hh
diff -u avida/current/source/qt-viewer/avd_gui_msg_event.hh:1.1 avida/current/source/qt-viewer/avd_gui_msg_event.hh:1.1.2.1
--- avida/current/source/qt-viewer/avd_gui_msg_event.hh:1.1	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/avd_gui_msg_event.hh	Mon Aug 25 18:46:26 2003
@@ -6,10 +6,10 @@
 #endif
 
 
-class avd_GuiMsgEvent : public QCustomEvent {
+class avdGuiMsgEvent : public QCustomEvent {
 public:
   enum { EventType = 1001 };
-  avd_GuiMsgEvent(void): QCustomEvent(EventType){}
+  avdGuiMsgEvent(void): QCustomEvent(EventType){}
 };
 
 
Index: avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc
diff -u avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc:1.1.2.2 avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc:1.1.2.3
--- avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc:1.1.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc	Mon Aug 25 18:46:26 2003
@@ -38,6 +38,7 @@
   m_mission_control(mission_control)
 {
   GenDebug("entered.");
+  nameWatched("(<avd_InstructionViewerController>)");
   connect(
     &m_mission_control, SIGNAL(newInstructionViewerSig(void)),
     this, SLOT(newInstructionViewerSlot(void))
Index: avida/current/source/qt-viewer/avd_instruction_viewer_controller.hh
diff -u avida/current/source/qt-viewer/avd_instruction_viewer_controller.hh:1.1 avida/current/source/qt-viewer/avd_instruction_viewer_controller.hh:1.1.2.1
--- avida/current/source/qt-viewer/avd_instruction_viewer_controller.hh:1.1	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/avd_instruction_viewer_controller.hh	Mon Aug 25 18:46:26 2003
@@ -7,12 +7,13 @@
 #ifndef QOBJECT_H
 #include <qobject.h>
 #endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 class avd_MissionControl;
 class N_Instruction_Viewer;
-
-
-class avd_InstructionViewerController : public QObject
+class avd_InstructionViewerController : public QObject, public cRetainable
 {
   Q_OBJECT
 private:
@@ -25,12 +26,9 @@
     const char *name = 0
   );
   ~avd_InstructionViewerController();
-
   void wrapupInit(void);
 public slots:
   void newInstructionViewerSlot(void);
 };
 
-
-
-#endif /* !AVD_INSTRUCTIONS_VIEW_CONTROLLER_HH */
+#endif
Index: avida/current/source/qt-viewer/avd_mission_control.cc
diff -u avida/current/source/qt-viewer/avd_mission_control.cc:1.1.2.2 avida/current/source/qt-viewer/avd_mission_control.cc:1.1.2.3
--- avida/current/source/qt-viewer/avd_mission_control.cc:1.1.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/avd_mission_control.cc	Mon Aug 25 18:46:26 2003
@@ -56,12 +56,13 @@
 using namespace std;
 
 
-struct avd_MissionControlData {
+class avd_MissionControlData : public cRetainable {
+public:
   //QGuardedPtr<avd_HelpController> m_help_controller;
   //QGuardedPtr<avd_MainWidgetController> m_main_widget_controller;
   //QGuardedPtr<avd_SettingsController> m_settings_controller;
 
-  QGuardedPtr<avd_DriverController> m_driver_controller;
+  QGuardedPtr<avdAvidaThreadCtrl> m_driver_controller;
   QGuardedPtr<avd_MainWindowController> m_main_window_controller;
   QGuardedPtr<avd_InstructionViewerController> m_instruction_viewer_controller;
   QGuardedPtr<avd_EventViewerController> m_event_viewer_controller;
@@ -89,7 +90,7 @@
 ):QObject(parent, name)
 { 
   GenDebug("entered.");
-  
+  nameWatched("(<avd_MissionControl>)");
   d = new avd_MissionControlData;
 
   d->m_argc = argc;
@@ -116,7 +117,7 @@
   //  "<avd_MissionControl::m_main_widget_controller>"
   //);
 
-  d->m_driver_controller = new avd_DriverController(
+  d->m_driver_controller = new avdAvidaThreadCtrl(
     this,
     0, 
     "<avd_MissionControl::m_driver_controller>"
@@ -245,10 +246,10 @@
 
 /*
 */
-bool
-avd_MissionControl::avidaIsRunning(){
-  return d->m_driver_controller->avidaIsRunning();
-}
+//bool
+//avd_MissionControl::avidaIsRunning(){
+//  return d->m_driver_controller->avidaIsRunning();
+//}
 
 /*
 */
Index: avida/current/source/qt-viewer/avd_mission_control.hh
diff -u avida/current/source/qt-viewer/avd_mission_control.hh:1.1 avida/current/source/qt-viewer/avd_mission_control.hh:1.1.2.1
--- avida/current/source/qt-viewer/avd_mission_control.hh:1.1	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/avd_mission_control.hh	Mon Aug 25 18:46:26 2003
@@ -5,6 +5,9 @@
 #include <qobject.h>
 #endif
 
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 /*
 avd_MissionControlData contains private member variables
@@ -27,7 +30,7 @@
 class QMutex;
 
 
-class avd_MissionControl : public QObject
+class avd_MissionControl : public QObject, public cRetainable
 { 
   Q_OBJECT
 
@@ -68,7 +71,7 @@
 
   /*
   */
-  bool avidaIsRunning();
+  //bool avidaIsRunning();
 public slots:
   void setPopulation(cPopulation *population);
   void setEventList(cEventList *event_list);
Index: avida/current/source/qt-viewer/main.cc
diff -u avida/current/source/qt-viewer/main.cc:1.1.2.1 avida/current/source/qt-viewer/main.cc:1.1.2.2
--- avida/current/source/qt-viewer/main.cc:1.1.2.1	Mon May 12 10:22:48 2003
+++ avida/current/source/qt-viewer/main.cc	Mon Aug 25 18:46:26 2003
@@ -8,25 +8,33 @@
 #include "avd_mission_control.hh"
 #endif
 
+#ifndef WATCH_RETAINS_HH
+#include "watch_retains.hh"
+#endif
+
+class cRetainableTest : public cRetainable {};
 
 int main( int argc, char **argv ){
   qDebug("<main>");
   
+  cWatchRetains retain_watch;
+  cRetainableTest *retainable_test = new cRetainableTest;
+  retainable_test->nameWatched
+  ("(cRetainableTest) testing retainwatcher.  should be no other leaks.");
+  retain_watch.nameWatched("<main(retain_watch)>");
+
   int result;
   QApplication a( argc, argv );
-  
   avd_MissionControl *mc = new avd_MissionControl(
     argc,
     argv,
     0,
     "<main(mc)>"
   );
-  
   a.connect(
     &a, SIGNAL(lastWindowClosed()),
     &a, SLOT(quit())
   );
-  
   result = a.exec();
   
   qDebug("<main> done.");
Index: avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc:1.6.2.2 avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc:1.6.2.3
--- avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc:1.6.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc	Mon Aug 25 18:46:26 2003
@@ -42,6 +42,7 @@
 : QWidget(parent, name, f)
 {
   GenDebug("constructor.");
+  nameWatched("(<N_Instruction_ButtonsWidget>)");
 
   m_vboxlayout = new QVBoxLayout(this);
 
Index: avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.hh:1.3 avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.hh:1.3.2.1
--- avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.hh:1.3	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.hh	Mon Aug 25 18:46:26 2003
@@ -8,9 +8,15 @@
 #ifndef N_ORIG_INSTRUCTION_BUTTONS_WIDGET_HH
 #define N_ORIG_INSTRUCTION_BUTTONS_WIDGET_HH
 
+#ifndef QWIDGET_H
 #include <qwidget.h>
+#endif
+#ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
-
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 class avd_MissionControl;
 class QHBoxLayout;
@@ -19,9 +25,8 @@
 class QRadioButton;
 class QVBoxLayout;
 class QWidgetStack;
-
-class
-N_Instruction_ButtonsWidget : public QWidget {
+class N_Instruction_ButtonsWidget : public QWidget, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -64,5 +69,5 @@
   void localStepSig(int);
 };
 
-#endif /* !N_ORIG_INSTRUCTION_BUTTONS_WIDGET_HH */
+#endif
 
Index: avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.13.2.2 avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.13.2.3
--- avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.13.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc	Mon Aug 25 18:46:26 2003
@@ -55,6 +55,7 @@
 : QWidget(parent, name, f)
 {
   GenDebug("entered.");
+  nameWatched("(<cLabeledField>)");
 
   m_hboxlayout = new QHBoxLayout(this);
 
@@ -144,6 +145,7 @@
 : QGroupBox(parent, name)
 {
   GenDebug("entered.");
+  nameWatched("(<cSummaryWidget>)");
 
   setTitle("Summary");
   setColumns(1);
@@ -300,6 +302,7 @@
 : QGroupBox(parent, name)
 {
   GenDebug("entered.");
+  nameWatched("(<cRegistersWidget>)");
 
   setTitle("Registers");
   setColumns(1);
@@ -398,6 +401,7 @@
 : QGroupBox(parent, name)
 {
   GenDebug("entered.");
+  nameWatched("(<cInputsWidget>)");
 
   setTitle("Inputs");
   setColumns(1);
@@ -492,6 +496,7 @@
 : cLabeledField(parent, name, f)
 {
   GenDebug("entered.");
+  nameWatched("(<cStackField>)");
 
 
   m_popup_pbutton = new QPushButton("...", this);
@@ -637,6 +642,7 @@
 : QWidget(parent, name, WType_Popup)
 {
   GenDebug("entered.");
+  nameWatched("(<cStackPopup>)");
 
   m_vboxlayout = new QVBoxLayout(this);
 
@@ -759,6 +765,7 @@
 : QGroupBox(parent, name)
 {
   GenDebug("entered.");
+  nameWatched("(<cStacksWidget>)");
 
   setTitle("Stack");
   setColumns(1);
@@ -830,6 +837,7 @@
 : QWidget(parent, name, f)
 {
   GenDebug("entered.");
+  nameWatched("(<cHideShowBinary>)");
 
   //QHBoxLayout *layout = new QHBoxLayout(this);
   //
@@ -894,6 +902,7 @@
 : QWidget(parent, name, f)
 {
   GenDebug("entered.");
+  nameWatched("(<N_Instruction_CPUWidget>)");
 
   m_vboxlayout = new QVBoxLayout(this);
 
Index: avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.hh:1.7 avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.hh:1.7.2.1
--- avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.hh:1.7	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.hh	Mon Aug 25 18:46:26 2003
@@ -8,12 +8,24 @@
 #ifndef N_ORIG_INSTRUCTION_CPU_WIDGET_HH
 #define N_ORIG_INSTRUCTION_CPU_WIDGET_HH
 
+#ifndef QFRAME_H
 #include <qframe.h>
+#endif
+#ifndef QGROUPBOX_H
 #include <qgroupbox.h>
+#endif
+#ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
+#endif
+#ifndef QPTRLIST_H
 #include <qptrlist.h>
+#endif
+#ifndef QWIDGET_H
 #include <qwidget.h>
-
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 class avd_MissionControl;
 class QPushButton;
@@ -22,9 +34,8 @@
 class QScrollView;
 class QVBoxLayout;
 class QWidgetStack;
-
-class
-cLabeledField : public QWidget {
+class cLabeledField : public QWidget, public cRetainable
+{
   Q_OBJECT
 protected:
   QHBoxLayout *m_hboxlayout;
@@ -47,8 +58,8 @@
   void showData2Text(bool);
 };
 
-class
-cSummaryWidget : public QGroupBox {
+class cSummaryWidget : public QGroupBox, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -71,8 +82,8 @@
   void updateState(void);
 };
 
-class
-cRegistersWidget : public QGroupBox {
+class cRegistersWidget : public QGroupBox, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -90,8 +101,8 @@
   void showData2Text(bool);
 };
 
-class
-cInputsWidget : public QGroupBox {
+class cInputsWidget : public QGroupBox, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -109,8 +120,8 @@
   void showData2Text(bool);
 };
 
-class
-cStackPopup : public QWidget {
+class cStackPopup : public QWidget, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -135,8 +146,8 @@
   void showData2Text(bool);
 };
 
-class
-cStackField : public cLabeledField {
+class cStackField : public cLabeledField
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -162,8 +173,8 @@
   void displayPopupSlot(void);
 };
 
-class
-cStacksWidget : public QGroupBox {
+class cStacksWidget : public QGroupBox, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -184,8 +195,8 @@
   void showData2Text(bool);
 };
 
-class
-cHideShowBinary : public QWidget {
+class cHideShowBinary : public QWidget, public cRetainable
+{
   Q_OBJECT
 protected:
   QWidgetStack *m_widgetstack;
@@ -204,8 +215,8 @@
   void showBinarySig(bool);
 };
 
-class
-N_Instruction_CPUWidget : public QWidget {
+class N_Instruction_CPUWidget : public QWidget, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -230,4 +241,4 @@
   void showData2Text(bool);
 };
 
-#endif /* !N_ORIG_INSTRUCTION_CPU_WIDGET_HH */
+#endif
Index: avida/current/source/qt-viewer/n_orig_instruction_field_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_field_widget.cc:1.1.2.1 avida/current/source/qt-viewer/n_orig_instruction_field_widget.cc:1.1.2.2
--- avida/current/source/qt-viewer/n_orig_instruction_field_widget.cc:1.1.2.1	Mon May 12 10:22:48 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_field_widget.cc	Mon Aug 25 18:46:26 2003
@@ -15,6 +15,7 @@
 )
 : QLabel(parent, name, f)
 {
+  nameWatched("(<N_Instruction_FieldWidget>)");
   ;
 }
 
@@ -26,6 +27,7 @@
 )
 : QLabel(text, parent, name, f)
 {
+  nameWatched("(<N_Instruction_FieldWidget>)");
   ;
 }
 
Index: avida/current/source/qt-viewer/n_orig_instruction_field_widget.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_field_widget.hh:1.1 avida/current/source/qt-viewer/n_orig_instruction_field_widget.hh:1.1.2.1
--- avida/current/source/qt-viewer/n_orig_instruction_field_widget.hh:1.1	Tue Feb 12 04:27:46 2002
+++ avida/current/source/qt-viewer/n_orig_instruction_field_widget.hh	Mon Aug 25 18:46:26 2003
@@ -8,9 +8,15 @@
 #ifndef N_ORIG_INSTRUCTION_FIELD_WIDGET_HH
 #define N_ORIG_INSTRUCTION_FIELD_WIDGET_HH
 
+#ifndef QLABEL_H
 #include <qlabel.h>
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
-class N_Instruction_FieldWidget : public QLabel {
+class N_Instruction_FieldWidget : public QLabel, public cRetainable
+{
   Q_OBJECT
 private:
 public:
@@ -33,4 +39,4 @@
   virtual void mousePressEvent(QMouseEvent *e);
 };
 
-#endif /* !N_ORIG_INSTRUCTION_FIELD_WIDGET_HH */
+#endif
Index: avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc:1.4.2.2 avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc:1.4.2.3
--- avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc:1.4.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc	Mon Aug 25 18:46:26 2003
@@ -31,6 +31,7 @@
 )
 : QWidget(parent, name, f)
 {
+  nameWatched("(<N_Instruction_LineWidget>)");
   m_line_number = line_number;
 
   m_pixmap = new QPixmap();
Index: avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh:1.2.2.1 avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh:1.2.2.2
--- avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh:1.2.2.1	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh	Mon Aug 25 18:46:26 2003
@@ -8,10 +8,18 @@
 #ifndef N_ORIG_INSTRUCTION_LINE_WIDGET_HH
 #define N_ORIG_INSTRUCTION_LINE_WIDGET_HH
 
+#ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
+#endif
+#ifndef QWIDGET_H
 #include <qwidget.h>
-
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
+#ifndef N_ORIG_INSTRUCTION_PIXMAPSTRUCTS_HH
 #include "n_orig_instruction_pixmapstructs.hh"
+#endif
 
 #include "../main/inst.hh"
 
@@ -21,9 +29,8 @@
 class N_Instruction_FieldWidget;
 class cCPUMemory;
 class cInstSet;
-
-class
-N_Instruction_LineWidget : public QWidget {
+class N_Instruction_LineWidget : public QWidget, public cRetainable
+{
   Q_OBJECT
 public:
   int m_line_number;
Index: avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc:1.6.2.2 avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc:1.6.2.3
--- avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc:1.6.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc	Mon Aug 25 18:46:26 2003
@@ -38,6 +38,7 @@
 )
 : QScrollView(parent, name, f)
 {
+  nameWatched("(<N_Instruction_ScrollView>)");
   viewport()->setEraseColor(s_inst_field_bg);
 
   GenDebug
Index: avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh:1.3.2.1 avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh:1.3.2.2
--- avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh:1.3.2.1	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh	Mon Aug 25 18:46:26 2003
@@ -8,21 +8,37 @@
 #ifndef N_ORIG_INSTRUCTION_SCROLLVIEW_HH
 #define N_ORIG_INSTRUCTION_SCROLLVIEW_HH
 
+#ifndef QSCROLLVIEW_H
 #include <qscrollview.h>
+#endif
+#ifndef QPTRVECTOR_H
 #include <qptrvector.h>
+#endif
+#ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
+#endif
+#ifndef QMAP_H
 #include <qmap.h>
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 #include "../defs.hh"
 
+#ifndef N_INSTRUCTION_SCROLLVIEW_DYNAMICCONFIG_HH
 #include "n_orig_instruction_scrollview_config.hh"
+#endif
+#ifndef N_ORIG_INSTRUCTION_PIXMAPSTRUCTS_HH
 #include "n_orig_instruction_pixmapstructs.hh"
+#endif
 
 class N_Instruction_LineWidget;
 class QPopupMenu;
 class cInstruction;
 
-class N_Instruction_ScrollView : public QScrollView {
+class N_Instruction_ScrollView : public QScrollView, public cRetainable
+{
   Q_OBJECT
 public:
   static int
Index: avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc:1.5.2.2 avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc:1.5.2.3
--- avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc:1.5.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc	Mon Aug 25 18:46:26 2003
@@ -44,6 +44,7 @@
 )
 : QWidget(parent, name, f)
 {
+  nameWatched("(<N_Instruction_ViewWidget>)");
   #if LOCAL_DEBUG
   cout
   << "<N_Instruction_ViewWidget::N_Instruction_ViewWidget> entered.\n";
Index: avida/current/source/qt-viewer/n_orig_instruction_view_widget.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_view_widget.hh:1.3 avida/current/source/qt-viewer/n_orig_instruction_view_widget.hh:1.3.2.1
--- avida/current/source/qt-viewer/n_orig_instruction_view_widget.hh:1.3	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_view_widget.hh	Mon Aug 25 18:46:26 2003
@@ -8,11 +8,18 @@
 #ifndef N_ORIG_INSTRUCTION_VIEW_WIDGET_HH
 #define N_ORIG_INSTRUCTION_VIEW_WIDGET_HH
 
+#ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
+#endif
+#ifndef QPTRVECTOR_H
 #include <qptrvector.h>
-
+#endif
+#ifndef QWIDGET_H
 #include <qwidget.h>
-
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 class QVBoxLayout;
 class QHBoxLayout;
@@ -21,12 +28,10 @@
 class QSpacerItem;
 class QLabel;
 class QPopupMenu;
-
 class avd_MissionControl;
 class N_Instruction_LineWidget;
-
-class
-N_Instruction_ViewWidget : public QWidget {
+class N_Instruction_ViewWidget : public QWidget, public cRetainable
+{
   Q_OBJECT
 protected:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -84,4 +89,4 @@
   void instInsertMenuAboutToShow(void);
 };
 
-#endif /* !N_ORIG_INSTRUCTION_VIEW_WIDGET_HH */
+#endif
Index: avida/current/source/qt-viewer/n_orig_instruction_viewer.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_viewer.cc:1.4.2.2 avida/current/source/qt-viewer/n_orig_instruction_viewer.cc:1.4.2.3
--- avida/current/source/qt-viewer/n_orig_instruction_viewer.cc:1.4.2.2	Tue May 20 05:12:29 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_viewer.cc	Mon Aug 25 18:46:26 2003
@@ -48,6 +48,7 @@
 //: QWidget(parent, name, f)
 : QMainWindow(parent, name, f)
 {
+  nameWatched("(<N_Instruction_Viewer>)");
   QWidget *central_widget = new QWidget(
     this,
     "<N_Instruction_Viewer::N_Instruction_Viewer(central_widget)>"
@@ -113,56 +114,19 @@
   m_instruction_cpu_widget->setMissionControl(mission_control);
 
   // prepare connections from avida.
-  connect(
-    mission_control, SIGNAL(avidaUpdatedSig()),
-    this, SLOT(updateState())
-  );
-  connect(
-    mission_control, SIGNAL(avidaSteppedSig(int)),
-    this, SLOT(updateState())
-  );
-  connect(
-    mission_control, SIGNAL(avidaBreakpointSig(int)),
-    this, SLOT(setPopulationCell(int))
-  );
-
-
+  connect(mission_control, SIGNAL(avidaUpdatedSig()), this, SLOT(updateState()));
+  connect(mission_control, SIGNAL(avidaSteppedSig(int)), this, SLOT(updateState()));
+  connect(mission_control, SIGNAL(avidaBreakpointSig(int)), this, SLOT(setPopulationCell(int)));
   // disable unsafe buttons while avida is working.
-  connect(
-    mission_control, SIGNAL(startAvidaSig()),
-    this, SLOT(disableUnsafeButtonsSlot())
-  );
-  connect(
-    mission_control, SIGNAL(updateAvidaSig()),
-    this, SLOT(disableUnsafeButtonsSlot())
-  );
-  connect(
-    mission_control, SIGNAL(stepAvidaSig(int)),
-    this, SLOT(disableUnsafeButtonsSlot())
-  );
-
+  connect(mission_control, SIGNAL(startAvidaSig()), this, SLOT(disableUnsafeButtonsSlot()));
+  connect(mission_control, SIGNAL(updateAvidaSig()), this, SLOT(disableUnsafeButtonsSlot()));
+  connect(mission_control, SIGNAL(stepAvidaSig(int)), this, SLOT(disableUnsafeButtonsSlot()));
   // enable unsafe buttons when avida is done.
-  connect(
-    mission_control, SIGNAL(avidaSteppedSig(int)),
-    this, SLOT(enableUnsafeButtonsSlot())
-  );
-  connect(
-    mission_control, SIGNAL(avidaBreakpointSig(int)),
-    this, SLOT(enableUnsafeButtonsSlot())
-  );
-  connect(
-    mission_control, SIGNAL(avidaStoppedSig()),
-    this, SLOT(enableUnsafeButtonsSlot())
-  );
-
-  connect(
-    mission_control, SIGNAL(avidaStatusSig(bool)),
-    this, SLOT(avidaStatusSlot(bool))
-  );
-  connect(
-    this, SIGNAL(isAvidaRunningSig()),
-    mission_control, SIGNAL(isAvidaRunningSig())
-  );
+  connect(mission_control, SIGNAL(avidaSteppedSig(int)), this, SLOT(enableUnsafeButtonsSlot()));
+  connect(mission_control, SIGNAL(avidaBreakpointSig(int)), this, SLOT(enableUnsafeButtonsSlot()));
+  connect(mission_control, SIGNAL(avidaStoppedSig()), this, SLOT(enableUnsafeButtonsSlot()));
+  connect(mission_control, SIGNAL(avidaStatusSig(bool)), this, SLOT(avidaStatusSlot(bool)));
+  connect(this, SIGNAL(isAvidaRunningSig()), mission_control, SIGNAL(isAvidaRunningSig()));
 
   mission_control->emitIsAvidaRunningSig();
   
Index: avida/current/source/qt-viewer/n_orig_instruction_viewer.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_viewer.hh:1.4 avida/current/source/qt-viewer/n_orig_instruction_viewer.hh:1.4.2.1
--- avida/current/source/qt-viewer/n_orig_instruction_viewer.hh:1.4	Sun Mar 23 14:37:56 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_viewer.hh	Mon Aug 25 18:46:26 2003
@@ -9,8 +9,15 @@
 #define N_ORIG_INSTRUCTION_VIEWER_HH
 
 //#include <qwidget.h>
+#ifndef QMAINWINDOW_H
 #include <qmainwindow.h>
+#endif
+#ifndef QGUARDEDPTR_H
 #include <qguardedptr.h>
+#endif
+#ifndef RETAINABLE_HH
+#include "retainable.hh"
+#endif
 
 class avd_MissionControl;
 class QVBox;
@@ -22,9 +29,9 @@
 class N_Instruction_ButtonsWidget;
 class N_Instruction_CPUWidget;
 class QPushButton;
-
 //class N_Instruction_Viewer : public QWidget {
-class N_Instruction_Viewer : public QMainWindow {
+class N_Instruction_Viewer : public QMainWindow, public cRetainable
+{
   Q_OBJECT
 private:
   QGuardedPtr<avd_MissionControl> m_mission_control;
@@ -80,5 +87,5 @@
 };
 
 
-#endif /* !N_ORIG_INSTRUCTION_VIEWER_HH */
+#endif
 
Index: avida/current/source/qt-viewer/qt-viewer.pro
diff -u avida/current/source/qt-viewer/qt-viewer.pro:1.1.2.5 avida/current/source/qt-viewer/qt-viewer.pro:1.1.2.6
--- avida/current/source/qt-viewer/qt-viewer.pro:1.1.2.5	Fri May 16 21:59:25 2003
+++ avida/current/source/qt-viewer/qt-viewer.pro	Mon Aug 25 18:46:26 2003
@@ -67,7 +67,28 @@
             setup_wizard_constants.hh \
             setup_wizard_page.hh \
             setup_wizard_page2.hh \
-            testwizard.hh
+            testwizard.hh \
+            \
+            avd_message_display.hh \
+            avd_message_display_proto.hh \
+            avd_message_display_typetrack.hh \
+            avd_message_display_typetrack_proto.hh \
+            \
+            activate_watcher.hh \
+            activate_watcher_proto.hh \
+            retainable.hh  \
+            retainable_dbg.hh \
+            retainable_dbg_proto.hh \
+            retainable_proto.hh \
+            watch_retains.hh \
+            watch_retains_proto.hh \
+            \
+            tRList.hh \
+            tRList_proto.hh \
+            tRetainable_list.hh \
+            tRetainable_list_proto.hh \
+            \
+            avd_connections.hh
 
 INTERFACES += \
             event_chooser.ui \
@@ -133,4 +154,12 @@
             setup_wizard_config.cc \
             setup_wizard_constants.cc \
             setup_wizard_page.cc \
-            setup_wizard_page2.cc
+            setup_wizard_page2.cc \
+            \
+            avd_message_display.cc \
+            avd_qstr_message_display.cc \
+            \
+            retainable.cc \
+            watch_retains.cc \
+            \
+            avd_connections.cc
Index: avida/current/source/qt-viewer/setup_avida.cc
diff -u avida/current/source/qt-viewer/setup_avida.cc:1.15.2.4 avida/current/source/qt-viewer/setup_avida.cc:1.15.2.5
--- avida/current/source/qt-viewer/setup_avida.cc:1.15.2.4	Fri May 23 02:36:35 2003
+++ avida/current/source/qt-viewer/setup_avida.cc	Mon Aug 25 18:46:26 2003
@@ -105,6 +105,7 @@
   test_interface.SetFun_Recycle(&cCallbackUtil::CB_RecycleHardware);
   test_interface.SetFun_Divide(&cCallbackUtil::CB_TestDivide);
   test_interface.SetFun_GetInput(&cCallbackUtil::CB_GetInput);
+  test_interface.SetFun_GetInputAt(&cCallbackUtil::CB_GetInputAt);
   test_interface.SetFun_GetResources(&cCallbackUtil::CB_GetResources);
   test_interface.SetFun_UpdateResources(&cCallbackUtil::CB_UpdateResources);
 
Index: avida/current/source/third-party/Makefile.am
diff -u avida/current/source/third-party/Makefile.am:1.1.2.3 avida/current/source/third-party/Makefile.am:1.1.2.4
--- avida/current/source/third-party/Makefile.am:1.1.2.3	Thu May 22 14:29:02 2003
+++ avida/current/source/third-party/Makefile.am	Mon Aug 25 18:46:26 2003
@@ -1,3 +1,3 @@
 
 
-SUBDIRS = trio-1.9
+SUBDIRS = Loki trio-1.9

Index: avida/current/source/qt-viewer/activate_watcher.hh
+++ avida/current/source/qt-viewer/activate_watcher.hh

Index: avida/current/source/qt-viewer/activate_watcher_proto.hh
+++ avida/current/source/qt-viewer/activate_watcher_proto.hh

Index: avida/current/source/qt-viewer/avd_avida_thread_drvr_dbg.hh
+++ avida/current/source/qt-viewer/avd_avida_thread_drvr_dbg.hh

Index: avida/current/source/qt-viewer/avd_avida_thread_drvr_dbg_proto.hh
+++ avida/current/source/qt-viewer/avd_avida_thread_drvr_dbg_proto.hh

Index: avida/current/source/qt-viewer/avd_connections.cc
+++ avida/current/source/qt-viewer/avd_connections.cc

Index: avida/current/source/qt-viewer/avd_connections.hh
+++ avida/current/source/qt-viewer/avd_connections.hh

Index: avida/current/source/qt-viewer/avd_message_display.cc
+++ avida/current/source/qt-viewer/avd_message_display.cc

Index: avida/current/source/qt-viewer/avd_message_display.hh
+++ avida/current/source/qt-viewer/avd_message_display.hh

Index: avida/current/source/qt-viewer/avd_message_display_proto.hh
+++ avida/current/source/qt-viewer/avd_message_display_proto.hh

Index: avida/current/source/qt-viewer/avd_message_display_typetrack.hh
+++ avida/current/source/qt-viewer/avd_message_display_typetrack.hh

Index: avida/current/source/qt-viewer/avd_message_display_typetrack_proto.hh
+++ avida/current/source/qt-viewer/avd_message_display_typetrack_proto.hh

Index: avida/current/source/qt-viewer/avd_qstr_message_display.cc
+++ avida/current/source/qt-viewer/avd_qstr_message_display.cc

Index: avida/current/source/qt-viewer/retainable.cc
+++ avida/current/source/qt-viewer/retainable.cc

Index: avida/current/source/qt-viewer/retainable.hh
+++ avida/current/source/qt-viewer/retainable.hh

Index: avida/current/source/qt-viewer/retainable_dbg.hh
+++ avida/current/source/qt-viewer/retainable_dbg.hh

Index: avida/current/source/qt-viewer/retainable_dbg_proto.hh
+++ avida/current/source/qt-viewer/retainable_dbg_proto.hh

Index: avida/current/source/qt-viewer/retainable_proto.hh
+++ avida/current/source/qt-viewer/retainable_proto.hh

Index: avida/current/source/qt-viewer/tRList.hh
+++ avida/current/source/qt-viewer/tRList.hh

Index: avida/current/source/qt-viewer/tRList_proto.hh
+++ avida/current/source/qt-viewer/tRList_proto.hh

Index: avida/current/source/qt-viewer/tRetainable_list.hh
+++ avida/current/source/qt-viewer/tRetainable_list.hh

Index: avida/current/source/qt-viewer/tRetainable_list_proto.hh
+++ avida/current/source/qt-viewer/tRetainable_list_proto.hh

Index: avida/current/source/qt-viewer/watch_retains.cc
+++ avida/current/source/qt-viewer/watch_retains.cc

Index: avida/current/source/qt-viewer/watch_retains.hh
+++ avida/current/source/qt-viewer/watch_retains.hh

Index: avida/current/source/qt-viewer/watch_retains_proto.hh
+++ avida/current/source/qt-viewer/watch_retains_proto.hh


More information about the Avida-cvs mailing list