[Avida-SVN] r1831 - in branches/collect: . Avida.xcodeproj documentation source source/actions source/analyze source/bindings source/bindings/Boost.Python source/classification source/cpu source/drivers source/main source/platform source/platform/tcmalloc source/script source/targets source/targets/avida source/targets/avida-s source/targets/avida-viewer source/targets/viewer-fltk source/targets/viewer-text source/testsuites source/tools source/viewer-coreGUI support support/config tests/_testrunner tests/analyze_dumplandscape tests/analyze_truncate_lineage_fulllandscape

blwalker at myxo.css.msu.edu blwalker at myxo.css.msu.edu
Thu Jul 19 14:44:59 PDT 2007


Author: blwalker
Date: 2007-07-19 17:44:58 -0400 (Thu, 19 Jul 2007)
New Revision: 1831

Added:
   branches/collect/source/script/cASTDumpVisitor.cc
   branches/collect/source/script/cASTDumpVisitor.h
   branches/collect/source/script/cASTVisitor.h
   branches/collect/source/targets/viewer-fltk/cFLTKBox.h
   branches/collect/source/targets/viewer-fltk/cFLTKWindow.h
   branches/collect/source/targets/viewer-fltk/fltk-defs.cc
   branches/collect/source/targets/viewer-fltk/fltk-defs.h
   branches/collect/source/targets/viewer-fltk/tFLTKButton.h
   branches/collect/source/tools/tAutoRelease.h
   branches/collect/source/viewer-coreGUI/cGUIBox.h
   branches/collect/source/viewer-coreGUI/cGUIButton.h
   branches/collect/source/viewer-coreGUI/cGUICanvas.h
   branches/collect/source/viewer-coreGUI/cGUIColor.h
   branches/collect/source/viewer-coreGUI/cGUIContainer.h
   branches/collect/source/viewer-coreGUI/cGUIEvent.h
   branches/collect/source/viewer-coreGUI/cGUIScrollArea.h
   branches/collect/source/viewer-coreGUI/cGUISlider.h
   branches/collect/source/viewer-coreGUI/cGUIWidget.cc
   branches/collect/source/viewer-coreGUI/cGUIWidget.h
   branches/collect/source/viewer-coreGUI/cGUIWindow.h
   branches/collect/source/viewer-coreGUI/tGUIButton.h
   branches/collect/source/viewer-coreGUI/tGUISlider.h
Removed:
   branches/collect/BuildAvida.py
   branches/collect/CONTRIBUTORS
   branches/collect/SConstruct
   branches/collect/source/SConscript
   branches/collect/source/actions/SConscript
   branches/collect/source/analyze/SConscript
   branches/collect/source/bindings/Boost.Python/SConscript
   branches/collect/source/bindings/SConscript
   branches/collect/source/classification/SConscript
   branches/collect/source/cpu/SConscript
   branches/collect/source/drivers/SConscript
   branches/collect/source/main/SConscript
   branches/collect/source/platform/SConscript
   branches/collect/source/platform/tcmalloc/SConscript
   branches/collect/source/targets/SConscript
   branches/collect/source/targets/avida-viewer/SConscript
   branches/collect/source/targets/avida/SConscript
   branches/collect/source/testsuites/SConscript
   branches/collect/source/tools/SConscript
   branches/collect/support/config/SConscript
   branches/collect/support/linux_slave_build_options.py
   branches/collect/support/os_x_slave_build_options.py
   branches/collect/support/scons/
   branches/collect/support/vs2k3_slave_build_options.py
Modified:
   branches/collect/AUTHORS
   branches/collect/Avida.xcodeproj/project.pbxproj
   branches/collect/CMakeLists.txt
   branches/collect/README
   branches/collect/documentation/environment.html
   branches/collect/source/cpu/cHardwareCPU.cc
   branches/collect/source/cpu/cHardwareCPU.h
   branches/collect/source/cpu/cHardwareGX.cc
   branches/collect/source/main/avida.cc
   branches/collect/source/main/cAvidaConfig.h
   branches/collect/source/main/cAvidaContext.h
   branches/collect/source/main/cBirthChamber.cc
   branches/collect/source/main/cEnvReqs.h
   branches/collect/source/main/cEnvironment.cc
   branches/collect/source/main/cEnvironment.h
   branches/collect/source/main/cPhenotype.cc
   branches/collect/source/main/cPhenotype.h
   branches/collect/source/main/cPopulation.cc
   branches/collect/source/main/cPopulation.h
   branches/collect/source/main/cResource.h
   branches/collect/source/main/cSpatialCountElem.cc
   branches/collect/source/main/cSpatialResCount.h
   branches/collect/source/main/cTaskLib.cc
   branches/collect/source/script/ASTree.cc
   branches/collect/source/script/ASTree.h
   branches/collect/source/script/AvidaScript.h
   branches/collect/source/script/cLexer.l
   branches/collect/source/script/cParser.cc
   branches/collect/source/script/cParser.h
   branches/collect/source/targets/avida-s/main.cc
   branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.cc
   branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.h
   branches/collect/source/targets/viewer-text/cDriver_TextViewer.cc
   branches/collect/source/tools/cRandom.cc
   branches/collect/source/tools/cRandom.h
   branches/collect/tests/_testrunner/testrunner.py
   branches/collect/tests/analyze_dumplandscape/test_list
   branches/collect/tests/analyze_truncate_lineage_fulllandscape/test_list
Log:
Syncing collect branch to development branch.

Merged 1772:1774 to pick up changes before the last commit in this branch at 1775
Merged 1775:1830; resolved a conflict in cPhenotype.cc to take into account both internal resources and refract_factor.


Modified: branches/collect/AUTHORS
===================================================================
--- branches/collect/AUTHORS	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/AUTHORS	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,79 +1,30 @@
 The Avida Digital Life Platform
 --------------------------------------------------------------------------------
+by Charles Ofria
 
-This material was originally written and compiled by Charles Ofria from
-1993-2002 primarily at the California Institute of Technology and Michigan State
-University.
+Lead Developers: David Bryson (Avida) and Kaben Nanlohy (Avida-ED)
 
-The following presents, in alphabetical order, a listing of many authors
-responsible for Avida's development.  A best effort has been made to include
-many of the contributors, however this list should in no way be interpreted as
-comprehensive.
+Portions by Brian Baer, Jeffrey Barrick, Benjamin Beckmann, Jeffrey Clune,
+Travis Collier, Art Covert, Evan Dorn, Sherri Goings, Heather Goldsby,
+George Hagstrom, Dehua Hang, Wei Huang, David Knoester, Dusan Misevic,
+Elizabeth Ostrowski, Matthew Rupp, Jason Stredwick, Michael Vo, Bess Walker,
+Claus Wilke, and Larry Wisne
 
+With design help from Christoph Adami, C. Titus Brown, Timothy Cooper,
+Santiago Elena, Richard Lenski, Philip McKinley, Robert Pennock, Thomas
+Schmidt, Robert Schwartz, Eric Torng, Jialan Wang, Daniel Weise, and Gabriel
+Yedid
 
-Author  <email>
-  - Institution, Contributing Years
---------------------------------------------------------------------------------
-Chris Adami
-  - California Institute of Technology 
+Copyright (C) 1999-2007 Michigan State University.
+Copyright (C) 1993-2003 California Institute of Technology.
 
-Dennis Adler
-  - Microsoft
 
-Brian Baer
-  - Michigan State University
+This project has been funded by the National Science Foundation, DARPA, 
+the Templeton Foundation, and Microsoft Corp.
 
-C. Titus Brown
-  - California Institute of Technology
-
-David Michael Bryson  <brysonda at msu.edu>
-  - Michigan State University, 2004 - present
-
-Jeff Clune
-  - Michigan State University
-
-Travis Collier
-  - California Institute of Technology
-
-Arthur Covert
-  - Michigan State University, 2004 - present
-
-Joshua Gerrish
-  - Michigan State University, 2005 - present
-
-Sherri Goings				
-  - Michigan State University
-
-Wei Huang
-  - Michigan State University, - 2005
-
-Dusan Misevic
-  - Michigan State University
-  - California Institute of Technology
-
-Kaben Nanlohy
-  - Michigan State University
-
-Charles Ofria
-  - Michigan State University, 1999 - present
-  - California Institute of Technology, 1993 - 1998
-
-Matthew Rupp
-  - Michigan State University
-
-Jason Stredwick
-  - Michigan State University, - 2006
-
-Claus O. Wilke
-  - California Institute of Technology
-
-Larry Wisne
-  - Stanford University
-
-
 Portions of the design were supported by NSF grant #PHY91-15574, NSF grant
 #DEB-9981397, a Caltech divisional fellowship, the 1993 Caltech SURF program,
 and the 1993 SUNY Stony Brook URECA program.
 
 
-Revised 2006-05-18 DMB
+Revised 2007-07-10 DMB

Modified: branches/collect/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/collect/Avida.xcodeproj/project.pbxproj	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/Avida.xcodeproj/project.pbxproj	2007-07-19 21:44:58 UTC (rev 1831)
@@ -193,6 +193,7 @@
 		70B651B70BEA9AEC002472ED /* unit-tests in CopyFiles */ = {isa = PBXBuildFile; fileRef = 70B6514C0BEA6FAD002472ED /* unit-tests */; };
 		70D046610C32EA90000614E7 /* cBirthChamber.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 702D4F3908DA61E2007BA469 /* cBirthChamber.h */; };
 		70DCAC9C097AF7C0002F8733 /* primitive.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCAC9B097AF7C0002F8733 /* primitive.cc */; };
+		70F9FC100C469DD70083B788 /* cASTDumpVisitor.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70F9FC0F0C469DC10083B788 /* cASTDumpVisitor.cc */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXBuildRule section */
@@ -794,6 +795,8 @@
 		70DCF57409CFBCA500924128 /* tcmalloc-platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tcmalloc-platform.h"; sourceTree = "<group>"; };
 		70DCF57F09CFBD3D00924128 /* tcmalloc-logging.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "tcmalloc-logging.cc"; sourceTree = "<group>"; };
 		70DCF58009CFBD3D00924128 /* tcmalloc-logging.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "tcmalloc-logging.h"; sourceTree = "<group>"; };
+		70E130BF0C442B2900CE9249 /* cCoords.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cCoords.h; sourceTree = "<group>"; };
+		70E130E30C4551E900CE9249 /* cASTVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cASTVisitor.h; sourceTree = "<group>"; };
 		70F7DAEF09290468009E311D /* cClassificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cClassificationManager.h; sourceTree = "<group>"; };
 		70F7DAF009290468009E311D /* cClassificationManager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cClassificationManager.cc; sourceTree = "<group>"; };
 		70F7DC9E09293E6F009E311D /* cGenotype.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cGenotype.cc; sourceTree = "<group>"; };
@@ -806,6 +809,9 @@
 		70F7DE710929678E009E311D /* cGenotype_BirthData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGenotype_BirthData.h; sourceTree = "<group>"; };
 		70F7DE730929678E009E311D /* cGenotype_TestData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGenotype_TestData.h; sourceTree = "<group>"; };
 		70F7DE76092967A8009E311D /* cGenotypeBatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGenotypeBatch.h; sourceTree = "<group>"; };
+		70F9FC0E0C469DC10083B788 /* cASTDumpVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cASTDumpVisitor.h; sourceTree = "<group>"; };
+		70F9FC0F0C469DC10083B788 /* cASTDumpVisitor.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cASTDumpVisitor.cc; sourceTree = "<group>"; };
+		70F9FD990C4E89C40083B788 /* tAutoRelease.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tAutoRelease.h; sourceTree = "<group>"; };
 		70FB86A908BFAFEC00BDF589 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
 		DCC30FCF0762539D008F7A48 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
 		DCC3109C0762539E008F7A48 /* avida.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = avida.cc; sourceTree = "<group>"; };
@@ -825,7 +831,7 @@
 		DCC315CE076253A5008F7A48 /* environment.rotate */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = environment.rotate; sourceTree = "<group>"; };
 		DCC315D0076253A5008F7A48 /* task_event_gen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.cc; sourceTree = "<group>"; };
 		DCC315D1076253A5008F7A48 /* task_event_gen.old.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.old.cc; sourceTree = "<group>"; };
-		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
+		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1194,6 +1200,9 @@
 				702F52A80992F8F600B2B507 /* cSymbolTable.cc */,
 				702F52DE0992FD8000B2B507 /* cScriptObject.h */,
 				702F52DF0992FD8000B2B507 /* cScriptObject.cc */,
+				70E130E30C4551E900CE9249 /* cASTVisitor.h */,
+				70F9FC0E0C469DC10083B788 /* cASTDumpVisitor.h */,
+				70F9FC0F0C469DC10083B788 /* cASTDumpVisitor.cc */,
 			);
 			path = script;
 			sourceTree = "<group>";
@@ -1436,6 +1445,7 @@
 		DCC314D8076253A2008F7A48 /* tools */ = {
 			isa = PBXGroup;
 			children = (
+				70E130BF0C442B2900CE9249 /* cCoords.h */,
 				704368F50C32E6AB00A05ABA /* cFlexVar.h */,
 				7057886F0A21FE8D00E85D8E /* cFixedBlock.cc */,
 				705788700A21FE8D00E85D8E /* cFixedCoords.cc */,
@@ -1546,6 +1556,7 @@
 				70BCB21C0AB7ADA6003FF331 /* cArgContainer.cc */,
 				70BCB2470AB7B634003FF331 /* cArgSchema.h */,
 				703D4D6D0ABA374A0032C8A0 /* cArgSchema.cc */,
+				70F9FD990C4E89C40083B788 /* tAutoRelease.h */,
 			);
 			path = tools;
 			sourceTree = "<group>";
@@ -1963,6 +1974,7 @@
 				7023ECDC0C0A44CC00362B9C /* cScriptObject.cc in Sources */,
 				7023ECDD0C0A44CE00362B9C /* cSymbolTable.cc in Sources */,
 				704368D60C31991500A05ABA /* ASTree.cc in Sources */,
+				70F9FC100C469DD70083B788 /* cASTDumpVisitor.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Deleted: branches/collect/BuildAvida.py
===================================================================
--- branches/collect/BuildAvida.py	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/BuildAvida.py	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,48 +0,0 @@
-#! /usr/bin/env python
-
-##############################################################################
-## Copyright (C) 1999-2006 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-
-# Use this script to build Avida. It calls SCons, which reads
-# information from the file 'SConstruct'.
-#
-# For more information about SCons, see
-#
-#   http://www.scons.org
-#
-# or read the SCons html documentation in the included file
-#
-#   support/scons/scons-user.html
-#
-
-import os
-import sys
-
-# Unless user has asked for silence or help, print a short help message
-# offering more help if needed.
-if '-h' not in sys.argv \
-and '-H' not in sys.argv \
-and '-s' not in sys.argv \
-and '--silent' not in sys.argv \
-and '--quiet' not in sys.argv:
-  print """
-Note: if you need help, type
-%s -h
-""" % sys.argv[0]
-
-# Tell Python where to find the main SCons build script, the SCons
-# library, and our SCons customizations.
-sys.path.append(os.path.join(sys.path[0], 'support/scons'))
-os.environ["SCONS_LIB_DIR"] = os.path.join(sys.path[0], 'support/scons/scons-local-0.96.94')
-
-# Any command line arguments are passed to SCons when it is imported by
-# the next line.
-import scons
-
-# Vim modeline to tell Vim that this is a Python script.
-# vim: set ft=python:

Modified: branches/collect/CMakeLists.txt
===================================================================
--- branches/collect/CMakeLists.txt	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/CMakeLists.txt	2007-07-19 21:44:58 UTC (rev 1831)
@@ -151,6 +151,16 @@
 LIST(APPEND ALL_INC_DIRS ${COREVIEW_DIR})
 
 
+# The core GUI  directory
+SET(COREGUI_DIR ${PROJECT_SOURCE_DIR}/source/viewer-coreGUI)
+SET(COREGUI_SOURCES
+  ${COREGUI_DIR}/cGUIWidget.cc
+)
+SOURCE_GROUP(coregui FILES ${COREGUI_SOURCES})
+LIST(APPEND AVIDA_CORE_SOURCES ${COREGUI_SOURCES})
+LIST(APPEND ALL_INC_DIRS ${COREGUI_DIR})
+
+
 # The cpu directory
 SET(CPU_DIR ${PROJECT_SOURCE_DIR}/source/cpu)
 SET(CPU_SOURCES
@@ -478,8 +488,9 @@
     
     SET(AVIDA_FLTK_VIEWER_DIR source/targets/viewer-fltk)
     SET(AVIDA_FLTK_VIEWER_SOURCES
-      ${AVIDA_FLTK_VIEWER_DIR}/cDriver_FltkViewer.cc
+      ${AVIDA_FLTK_VIEWER_DIR}/cDriver_FLTKViewer.cc
       ${AVIDA_FLTK_VIEWER_DIR}/viewer-fltk.cc
+      ${AVIDA_FLTK_VIEWER_DIR}/fltk-defs.cc
     )
     SOURCE_GROUP(targets\\viewer-fltk FILES ${AVIDA_FLTK_VIEWER_SOURCES})
     ADD_EXECUTABLE(avida-fltkview ${AVIDA_FLTK_VIEWER_SOURCES})
@@ -494,6 +505,10 @@
     TARGET_LINK_LIBRARIES(avida-fltkview ${AVIDA_FLTK_VIEWER_LIBS})
     SET_TARGET_PROPERTIES(avida-fltkview PROPERTIES LINK_FLAGS ${FLTK_PLATFORM_DEPENDENT_LIBS})
 
+    IF(APPLE AND NOT FLTK_APPLE_X11)
+       SET( LINK_FLAGS_avida_fltkview ${LINK_FLAGS} "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
+    ENDIF(APPLE AND NOT FLTK_APPLE_X11)
+
     INSTALL_TARGETS(/work avida-fltkview)
 
   ENDIF(FLTK_BASE_LIBRARY AND FLTK_INCLUDE_PATH)

Deleted: branches/collect/CONTRIBUTORS
===================================================================
--- branches/collect/CONTRIBUTORS	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/CONTRIBUTORS	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,22 +0,0 @@
-Avida version  2.7.0
-
-by Charles Ofria
-
-Lead Developers: David Bryson (Avida) and Kaben Nanlohy (Avida-ED)
-
-Portions by Brian Baer, Jeffrey Barrick, Benjamin Beckmann, Jeffrey Clune,
-Travis Collier, Art Covert, Evan Dorn, Sherri Goings, Heather Goldsby,
-George Hagstrom, Dehua Hang, Wei Huang, David Knoester, Dusan Misevic,
-Elizabeth Ostrowski, Matthew Rupp, Jason Stredwick, Bess Walker, Claus Wilke,
-and Larry Wisne
-
-With design help from Christoph Adami, C. Titus Brown, Timothy Cooper,
-Santiago Elena, Richard Lenski, Philip McKinley, Robert Pennock, Thomas
-Schmidt, Robert Schwartz, Eric Torng, Jialan Wang, Daniel Weise, and Gabriel
-Yedid
-
-Copyright (C) 1999-2007 Michigan State University.
-Copyright (C) 1993-2003 California Institute of Technology.
-
-This project has been funded by the National Science Foundation, DARPA, 
-the Templeton Foundation, and Microsoft Corp.

Modified: branches/collect/README
===================================================================
--- branches/collect/README	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/README	2007-07-19 21:44:58 UTC (rev 1831)
@@ -3,22 +3,30 @@
 Digital Evolution Laboratory at Michigan State University
 
 
-REQUIREMENTS
+I.   REQUIREMENTS
+II.  GETTING STARTED
+III. CMAKE CONFIGURATION OPTIONS
+IV.  CONFIGURING THE CMAKE BUILD
+V.   RUNNING CONSISTENCY TESTS
+VI.  DOCUMENTATION
+
+
+
+I. REQUIREMENTS
 ----------------------------------------------------------------------
 
-In order to build Avida, you must have CMake 2.x installed.
-CMake 2.x is available from http://www.cmake.org
+In order to build Avida, you must have CMake 2.4.x or greater
+installed. CMake is available from http://www.cmake.org
 
 NCurses, in order to build the console viewer.
 
-OR
+Python 2.3 or greater to run consistency tests.
 
-In Mac OS X, an Xcode project has been provided for building the
-console only version of Avida, as well as the NCurses viewer.
-Xcode 2.1 or greater is required.
+On Mac OS X, a separate Xcode project is available. Xcode 2.1 or
+greater is required (2.4 or greater recommended).
 
 
-GETTING STARTED
+II. GETTING STARTED
 ----------------------------------------------------------------------
 
 To compile and install Avida, all you have to do is run:
@@ -31,34 +39,29 @@
 
 OR 
 
-In Mac OS X's Xcode, select the appropriate build style for the CPU
-type within your Mac (G4, G5, or Intel).  Click the 'Build' button on
+In Mac OS X's Xcode, select the Deployment for an optimized build
+configured for your CPU platform.  Click the 'Build' button on
 the project window.  The compiled binary and starting config files
 will be copied (by default) into:
-${PROJECT_DIR}/build/Deployment-{selected processor type}/work
+${PROJECT_DIR}/build/Deployment/work
 
 
-CMAKE CONFIGURATION OPTIONS
+III. CMAKE CONFIGURATION OPTIONS
 ----------------------------------------------------------------------
 
 Here are the main options available when configuring and building
 Avida with cmake :
 
-AVD_CONSISTENCY_TEST_PRIMITIVE
- -  This is a BOOL, either ON or OFF, to enable primitive consistency
-    test suites.
- OFF by default.
+AVD_CMDLINE
+This is a BOOL, either ON or OFF, to enable building interfaceless
+Avida (fastest version).
+ON by default.
 
 AVD_GUI_NCURSES
  -  This is a BOOL, either ON or OFF, to enable building Avida console
     interface.
  ON by default.
 
-AVD_PRIMITIVE
-This is a BOOL, either ON or OFF, to enable building interfaceless
-Avida (fastest version).
-ON by default.
-
 AVD_UNIT_TESTS
  -  This is a BOOL, either ON or OFF, to enable building primitive
     unit test suites.
@@ -72,7 +75,7 @@
 
 
 
-CONFIGURING THE CMAKE BUILD
+IV. CONFIGURING THE CMAKE BUILD
 ----------------------------------------------------------------------
 
 There are three ways by which you can set the various options.
@@ -96,13 +99,41 @@
 
 To completely specify each of the above Avida options, cd into your
 build directory and type something like :
-$ cmake -DAVD_CONSISTENCY_TEST_PRIMITIVE:BOOL=OFF \
-  -DAVD_GUI_NCURSES:BOOL=ON \
-  -DAVD_PRIMITIVE:BOOL=ON \
+$ cmake -DAVD_GUI_NCURSES:BOOL=ON \
+  -DAVD_CMDLINE:BOOL=ON \
   -DAVD_UNIT_TESTS:BOOL=OFF \
   -DCMAKE_BUILD_TYPE:STRING=Release \
   path-to-source-directory
 
 
+V. RUNNING CONSISTENCY TESTS
+----------------------------------------------------------------------
 
-Revised 2006-08-22 DMB
+With Avida built and 'installed' using CMake (the default for the
+'build_avida' script), simply execute the 'run_tests' script:
+
+$ ./run_tests
+
+
+For a list of useful options accepted by the TestRunner script, supply
+the -h option on the command line:
+
+$ ./run_tests -h
+
+
+The 'builddir' option will be particularly for Xcode users.  This
+option will allow the tests to be run on Xcode products without having
+to move the files to where the CMake outputs are placed by default.
+For example, the default Deployment build can be tested as follows:
+
+$ ./run_tests --builddir=build/Deployment/
+
+
+VI. DOCUMENTATION
+----------------------------------------------------------------------
+
+Helpful usage and code documentation can be found in the HTML files in
+the 'documentation' directory.  See index.html.
+
+
+Revised 2007-07-10 DMB

Deleted: branches/collect/SConstruct
===================================================================
--- branches/collect/SConstruct	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/SConstruct	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,117 +0,0 @@
-##############################################################################
-## Copyright (C) 1999-1999-2007 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-
-import os
-import sys
-sys.path.append('support/utils')
-import AvidaUtils
-
-environment = Environment()
-environment.Export('environment')
-
-# Parse cmd line, set compiler options, generate help text.
-#
-# Per-platform build options are defined in
-# support/utils/AvidaUtils/PlatformTool.py
-#
-# Command-line build options are defined in
-# support/utils/AvidaUtils/CmdLineOpts.py
-#
-# Options for SCons are defined in
-# support/utils/AvidaUtils/SConsOpts.py
-#
-# Static help text is defined in
-# support/utils/AvidaUtils/StaticHelp.py
-#
-
-# XXX Must not use default scons signatures database; as of SCons
-# 0.96.93, default database seems to be too-easily corrupted.
-# @kgn 06-Dec-6
-import anydbm
-SConsignFile('scons-signatures', anydbm)
-AvidaUtils.Configure(ARGUMENTS, environment)
-
-if environment.subst('$enableSerialization') in ['1', 'yes']:
-  environment.Append(CPPDEFINES = ['ENABLE_SERIALIZATION=1'])
-
-if environment.subst('$enablePyPkg') in ['1', 'yes']:
-  environment.Append(CPPPATH = ['#/source/bindings/Boost.Python'])
-
-if environment.subst('$enableMemTracking') in ['1', 'yes']:
-  #environment.SetDefault(enableSharedPtr = 1)
-  environment.Append(CPPDEFINES = ['USE_tMemTrack=1'])
-
-if environment['enableTCMalloc'] in ('True', '1', 1):
-  environment.Append(
-    CPPPATH = [ '#/source/platform/tcmalloc', ],
-    LIBPATH = [ '#$buildDir/platform/tcmalloc', ],
-  )
-
-environment.Append(
-  CPPPATH = [
-    '#/source',
-    '#/source/actions',
-    '#/source/analyze',
-    '#/source/archive',
-    '#/source/classification',
-    '#/source/cpu',
-    '#/source/drivers',
-    '#/source/event',
-    '#/source/main',
-    #'#/source/third-party/boost',
-    '#/source/tools',
-  ],
-  LIBPATH = [
-    '#$buildDir/actions',
-    '#$buildDir/analyze',
-    #'#$buildDir/archive',
-    '#$buildDir/classification',
-    '#$buildDir/cpu',
-    '#$buildDir/drivers',
-    #'#$buildDir/event',
-    '#$buildDir/main',
-    #'#$buildDir/third-party/boost/serialization',
-    '#$buildDir/tools',
-  ],
-)
-
-# Tell SCons where to find its subscripts.
-environment.SConscript('source/SConscript',
-  build_dir = '$buildDir',
-  duplicate = 0,
-)
-environment.SConscript('support/config/SConscript')
-
-# XXX beginnings of 'extras'. @kgn
-if environment.subst('$extrasDir') not in ['None', 'none', '']:
-  environment.SConscript(
-    os.path.join(environment.subst('$extrasDir'), 'SConscript'),
-    build_dir = '$extrasBuildDir',
-    duplicate = 0
-  )
-
-
-if environment['PLATFORM'] == 'win32':
-  environment.Import('avida_exe')
-  script_to_build_avida = environment.File(
-    os.path.join('#', os.path.basename(sys.argv[0]))
-  ).abspath
-  environment.MSVSProject(
-    target = 'Avida' + environment['MSVSPROJECTSUFFIX'],
-    srcs = environment['avida_msvs_project_srcs'],
-    incs = environment['avida_msvs_project_incs'],
-    misc = environment['avida_msvs_project_misc'],
-    variant = 'Release',
-    buildtarget = avida_exe,
-    #runfile = avida[0].abspath,
-    MSVSSCONS = '"%s" "%s"' % (sys.executable, script_to_build_avida),
-    MSVSSCONSFLAGS = '-C "${MSVSSCONSCRIPT.dir.abspath}" -f "${MSVSSCONSCRIPT.name}"'
-  )
-
-# Vim modeline to tell Vim that this is a Python script.
-# vim: set ft=python:

Modified: branches/collect/documentation/environment.html
===================================================================
--- branches/collect/documentation/environment.html	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/documentation/environment.html	2007-07-19 21:44:58 UTC (rev 1831)
@@ -343,8 +343,8 @@
 requisites on when they can occur.
 </p>
 
-<h3>REACTION Command</h3>
-  <pre>REACTION  reaction_name  task  [process:...]  [requisite:...]</pre>
+<h3><A NAME = "REACTION">REACTION Command</A></h3>
+  <pre>REACTION  reaction_name  task[:argument:...]  [process:...]  [requisite:...]</pre>
 <blockquote>
   <p>
   Where <code>reaction_name</code> is a unique name for a reaction.
@@ -353,18 +353,22 @@
   Where <code>task</code> is the name of the task that must be be performed to
   trigger the reaction.  A list of common tasks is listed in Table 3.
   </P>
+  <P>
+  Where <code>argument</code> is a list of specific arguments needed by the
+  particular task.
+  </P>
   Where <code>process</code> is a colon delimited list of information about how
   resources are consumed/produced.  Process settings are described in Table 4.
   </P>
   <p>
   Where <code>requisite</code> is a colon delimited list describing when 
   reactions can be triggered.  Requisite settings are described in Table 5.
-  <p>
-  Each reaction must have a task that triggers it.  Currently, eighty tasks
-  have been implemented, as summarized in the following table (in approximate
-  order of complexity):
-  </p>
 </blockquote>
+<p>
+Each reaction must have a task that triggers it.  Currently, eighty tasks
+have been implemented, as summarized in the following table (in approximate
+order of complexity):
+</p>
 
 <div align="center">
 <p>&nbsp;</p>
@@ -788,7 +792,7 @@
 <h3>SET_ACTIVE Command</h3>
 <p>
 Allows user to activate or deactivate a reaction. If this command is not 
-used all reactionsare active.
+used all reactions are active.
 </p>
 <pre>
   <a name="SET_ACTIVE">SET_ACTIVE</a> type name new_status(default=true)
@@ -806,6 +810,7 @@
   deactivate).
 </Blockquote>
 <p>
+<H3>MUTATION Command</H3>
 O.K. I don't know what the following commands does, but it is in the code:
 </P>
 <pre>

Deleted: branches/collect/source/SConscript
===================================================================
--- branches/collect/source/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,43 +0,0 @@
-
-Import('environment')
-
-#environment.SConscript( [
-#  'actions/SConscript',
-#  'analyze/SConscript',
-#  #'archive/SConscript',
-#  'classification/SConscript',
-#  'cpu/SConscript',
-#  'drivers/SConscript',
-#  'main/SConscript',
-#  'platform/SConscript',
-#  'targets/SConscript',
-#  'third-party/SConscript',
-#  'tools/SConscript',
-#  #'support/SConscript',
-#  #'utils/SConscript',
-#] )
-environment.SConscript('actions/SConscript')
-environment.SConscript('analyze/SConscript')
-environment.SConscript('classification/SConscript')
-environment.SConscript('cpu/SConscript')
-environment.SConscript('drivers/SConscript')
-environment.SConscript('main/SConscript')
-environment.SConscript('platform/SConscript')
-environment.SConscript('targets/SConscript')
-environment.SConscript('third-party/SConscript')
-environment.SConscript('tools/SConscript')
-
-#if environment['enableTestCode'] in ('True', '1', 1):
-#  environment.SConscript('testsuites/SConscript')
-
-if environment['enablePyPkg'] in ('True', '1', 1):
-  environment.SConscript('bindings/Boost.Python/SConscript')
-
-incs = ['defs.h']
-misc = ['SConscript']
-environment.AppendUnique(
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-# vim: set ft=python:

Deleted: branches/collect/source/actions/SConscript
===================================================================
--- branches/collect/source/actions/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/actions/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,35 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-  'cAction.h',
-  'cActionLibrary.h',
-  'DriverActions.h',
-  'EnvironmentActions.h',
-  'LandscapeActions.h',
-  'PopulationActions.h',
-  'PrintActions.h',
-  'SaveLoadActions.h',
-]
-
-srcs = [
-  'cActionLibrary.cc',
-  'DriverActions.cc',
-  'EnvironmentActions.cc',
-  'LandscapeActions.cc',
-  'PopulationActions.cc',
-  'PrintActions.cc',
-  'SaveLoadActions.cc',
-]
-
-tools_library = environment.Library('actions', srcs)
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-# vim: set ft=python:

Deleted: branches/collect/source/analyze/SConscript
===================================================================
--- branches/collect/source/analyze/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/analyze/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,41 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-srcs = [
-  'cAnalyze.cc',
-  'cAnalyzeGenotype.cc',
-  'cAnalyzeJobQueue.cc',
-  'cAnalyzeJobWorker.cc',
-  'cMutationalNeighborhood.cc'
-]
-
-hdrs = [
-  'cAnalyze.h',
-  'cAnalyzeCommand.h',
-  'cAnalyzeCommandAction.h',
-  'cAnalyzeCommandDef.h',
-  'cAnalyzeCommandDefBase.h',
-  'cAnalyzeFlowCommand.h',
-  'cAnalyzeFlowCommandDef.h',
-  'cAnalyzeFunction.h',
-  'cAnalyzeGenotype.h',
-  'cAnalyzeJob.h',
-  'cAnalyzeJobQueue.h',
-  'cAnalyzeJobWorker.h',
-  'cGenotypeBatch.h',
-  'cMutationalNeighborhood.h',
-  'cMutationalNeighborhoodResults.h',
-  'tAnalyzeJob.h',
-]
-
-environment.Library('analyze', srcs) 
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in hdrs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-# vim: set ft=python:

Deleted: branches/collect/source/bindings/Boost.Python/SConscript
===================================================================
--- branches/collect/source/bindings/Boost.Python/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/bindings/Boost.Python/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,137 +0,0 @@
-##############################################################################
-## Copyright (C) 1999-2005 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-    
-import os
-    
-Import('environment')
-e = environment
-
-pf = e.File('pyste_util.py')
-e.Local(pf)
-
-package_name = 'AvidaCore'
-package_modules = e.PystePackageSubmodule(
-  [
-    #  These classes must be loaded before its subclasses, so they must
-    #  be listed early in this PystePackageSubmodule command.
-    'cHelpEntry.pyste',
-    'cSchedule.pyste',
-    'cString.pyste',
-
-    #  cBlockStruct is not used in Avida. @kgn
-    #'cBlockStruct.pyste',
-
-    'cChangeList.pyste',
-    'cConstSchedule.pyste',
-    'cCountTracker.pyste',
-
-    #  No longer used. @kgn
-    #'cCycleCheck.pyste',
-
-    'cDataEntry.pyste',
-    'cDataFile.pyste',
-    'cDataFileManager.pyste',
-    'cDataManager_Base.pyste',
-    'cDefaultMessageDisplay.pyste',
-    'cDoubleSum.pyste',
-    'cFile.pyste',
-    'cFixedBlock.pyste',
-    'cFixedCoords.pyste',
-
-    #  No longer used. @kgn
-    #'cGenesis.pyste',
-
-    'cHelpAlias.pyste',
-    'cHelpFullEntry.pyste',
-    'cHelpManager.pyste',
-    'cHelpType.pyste',
-    'cHistogram.pyste',
-
-    #  No longer used. @kgn
-    #'cID.pyste',
-
-    'cIndexedBlockStruct.pyste',
-    'cInitFile.pyste',
-    'cIntSum.pyste',
-    'cIntegratedSchedule.pyste',
-    'cIntegratedScheduleNode.pyste',
-    'cMerit.pyste',
-
-    #  These rely on the third-party library "trio", which isn't
-    #  incorporated yet... @kgn
-    #'cMessageClass.pyste',
-    #'cMessageClosure.pyste',
-    #'cMessageDisplay.pyste',
-    #'cMessageDisplay_headers.pyste',
-    #'cMessageType.pyste',
-
-    'cProbSchedule.pyste',
-    'cRandom.pyste',
-    'cRefBlock.pyste',
-    'cRunningAverage.pyste',
-
-    #  cScaledBlock is not used in Avida. @kgn
-    #'cScaledBlock.pyste',
-
-    'cStringIterator.pyste',
-    'cStringList.pyste',
-    'cStringUtil.pyste',
-    'cThread.pyste',
-    'cTools.pyste',
-    'cUInt.pyste',
-    #  No longer used. @kgn
-    #'cUnitTestHelper.pyste',
-    #'cVerifierSuiteRecurser.pyste',
-
-    'cWeightedIndex.pyste',
-
-    #  Wrappers not yet complete. @kgn
-    #'functions.pyste',
-    #'lightweight_test.pyste',
-    #'nTemplateTests.pyste',
-    #'tArgDataEntry.pyste',
-    #'tArray.pyste',
-    #'tBuffer.pyste',
-    #'tDataEntry.pyste',
-    #'tDataEntryBase.pyste',
-    #'tDataEntryCommand.pyste',
-    #'tDataManager.pyste',
-    #'tDictionary.pyste',
-    #'tHashTable.pyste',
-    #'tList.pyste',
-    #'tManagedPointerArray.pyste',
-    #'tMatrix.pyste',
-    #'tMemTrack.pyste',
-    #'tObjectFactory.pyste',
-    #'tSmartArray.pyste',
-    #'tVector.pyste',
-  ],
-  pyste_package_name = package_name,
-  LIBS = ['tools'],
-)
-package_init_file = e.PystePackageInitFile(
-  package_modules,
-  pyste_package_name = package_name,
-)
-package = e.PystePackage(
-  package_modules + package_init_file,
-  pyste_package_name = package_name,
-)
-
-package_install_dir = os.path.join(e['execPrefix'], package_name)
-e.Install(
-  package_install_dir,
-  [package_modules, package_init_file]
-)
-e.Alias(
-  'install',
-  package_install_dir
-)
-
-#
-# vim: set ft=python:

Deleted: branches/collect/source/bindings/SConscript
===================================================================
--- branches/collect/source/bindings/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/bindings/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,16 +0,0 @@
-
-##############################################################################
-## Copyright (C) 1999-2005 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-    
-import os
-    
-Import('environment')
-e = environment
-
-#
-# vim: set ft=python:

Deleted: branches/collect/source/classification/SConscript
===================================================================
--- branches/collect/source/classification/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/classification/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,49 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-  'cClassificationManager.h',
-  'cGenotype.h',
-  'cGenotype_BirthData.h',
-  'cGenotype_TestData.h',
-  'cGenotypeControl.h',
-  'cInjectGenotype.h',
-  'cInjectGenotype_BirthData.h',
-  'cInjectGenotypeControl.h',
-  'cInjectGenotypeElement.h',
-  'cInjectGenotypeQueue.h',
-  'cLineage.h',
-  'cSpecies.h',
-  'cSpeciesControl.h',
-  'cSpeciesQueue.h',
-  'nGenotype.h',
-  'nInjectGenotype.h',
-  'nSpecies.h',
-]
-
-srcs = [
-  'cClassificationManager.cc',
-  'cGenotype.cc',
-  'cGenotype_BirthData.cc',
-  'cGenotypeControl.cc',
-  'cInjectGenotype.cc',
-  'cInjectGenotypeControl.cc',
-  'cInjectGenotypeQueue.cc',
-  'cLineage.cc',
-  'cSpecies.cc',
-  'cSpeciesControl.cc',
-  'cSpeciesQueue.cc',
-]
-
-environment.Library('classification', srcs)
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-
-# vim: set ft=python:

Deleted: branches/collect/source/cpu/SConscript
===================================================================
--- branches/collect/source/cpu/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/cpu/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,57 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-  'cCodeLabel.h',
-  'cCPUMemory.h',
-  'cCPUStack.h',
-  'cCPUTestInfo.h',
-  'cHardwareBase.h',
-  'cHardwareCPU.h',
-  'cHardwareExperimental.h',
-  'cHardwareGX.h',
-  'cHardwareManager.h',
-  'cHardwareSMT.h',
-  'cHardwareStatusPrinter.h',
-  'cHardwareTracer.h',
-  'cHardwareTrans.h',
-  'cHeadCPU.h',
-  'cInstLib.h',
-  'cInstSet.h',
-  'cTestCPU.h',
-  'cTestCPUInterface.h',
-  'nHardware.h',
-  'sCPUStats.h',
-  'tInstLib.h',
-]
-
-srcs = [
-  'cCodeLabel.cc',
-  'cCPUMemory.cc',
-  'cCPUStack.cc',
-  'cCPUTestInfo.cc',
-  'cHardwareBase.cc',
-  'cHardwareCPU.cc',
-  'cHardwareExperimental.cc',
-  'cHardwareGX.cc',
-  'cHardwareManager.cc',
-  'cHardwareSMT.cc',
-  'cHardwareStatusPrinter.cc',
-  'cHardwareTransSMT.cc',
-  'cHeadCPU.cc',
-  'cInstSet.cc',
-  'cTestCPU.cc',
-  'cTestCPUInterface.cc',
-]
-
-environment.Library('cpu', srcs) 
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-  
-# vim: set ft=python:

Modified: branches/collect/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/collect/source/cpu/cHardwareCPU.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/cpu/cHardwareCPU.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -224,6 +224,9 @@
     
     tInstLibEntry<tMethod>("set-cmut", &cHardwareCPU::Inst_SetCopyMut),
     tInstLibEntry<tMethod>("mod-cmut", &cHardwareCPU::Inst_ModCopyMut),
+    // @WRE additions for movement
+    tInstLibEntry<tMethod>("tumble", &cHardwareCPU::Inst_Tumble),
+    tInstLibEntry<tMethod>("move", &cHardwareCPU::Inst_Move),
 
     // Energy instruction
     tInstLibEntry<tMethod>("recover", &cHardwareCPU::Inst_ZeroEnergyUsed),
@@ -3828,6 +3831,55 @@
   return true;
 }
 
+// @WRE addition for movement
+// Tumble sets the organism and cell to a new random facing
+// 
+bool cHardwareCPU::Inst_Tumble(cAvidaContext& ctx)
+{
+  // Code taken from Inst_Inject
+  //cout << "Tumble: start" << endl;
+  const int num_neighbors = organism->GetNeighborhoodSize();
+  //cout << "Tumble: size = " << num_neighbors << endl;
+  organism->Rotate(ctx.GetRandom().GetUInt(num_neighbors));
+  return true;
+}
+
+// @WRE addition for movement
+// Move uses the cPopulation::SwapCells method to move an organism to a different cell
+// and the cPopulation::MoveOrganisms helper function to clean up after a move
+// The cell selected as a destination is the one faced
+bool cHardwareCPU::Inst_Move(cAvidaContext& ctx)
+{
+  // Declarations
+  int fromcellID, destcellID; //, actualNeighborhoodSize, fromFacing, destFacing, currentFacing;
+
+  // Get population
+  cPopulation& pop = m_world->GetPopulation();
+
+  // Get stepsize. Currently, all moves are one cell regardless of stepsize.
+  // This could be changed in the future.
+  const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
+  
+  // Code
+  if (0 < stepsize) {
+    // Current cell
+    fromcellID = organism->GetCellID();
+    // With sanity check
+    if (-1  == fromcellID) return false;
+    // Destination cell
+    destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
+    // Actually perform the move using SwapCells
+    //cout << "SwapCells: " << fromcellID << " to " << destcellID << endl;
+    pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
+    // Swap inputs and facings between cells using helper function
+    pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
+
+    return true;
+  } else {
+    return false;
+  }
+}
+
 // Energy use
 
 bool cHardwareCPU::Inst_ZeroEnergyUsed(cAvidaContext& ctx)

Modified: branches/collect/source/cpu/cHardwareCPU.h
===================================================================
--- branches/collect/source/cpu/cHardwareCPU.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/cpu/cHardwareCPU.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -456,6 +456,9 @@
   bool Inst_RotateLabel(cAvidaContext& ctx);
   bool Inst_SetCopyMut(cAvidaContext& ctx);
   bool Inst_ModCopyMut(cAvidaContext& ctx);
+  // @WRE additions for movement
+  bool Inst_Tumble(cAvidaContext& ctx);
+  bool Inst_Move(cAvidaContext& ctx);
 
   // Energy use
   

Modified: branches/collect/source/cpu/cHardwareGX.cc
===================================================================
--- branches/collect/source/cpu/cHardwareGX.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/cpu/cHardwareGX.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -3842,7 +3842,7 @@
   }
     
   // Activate the child
-  bool parent_alive = organism->ActivateDivide(ctx);
+  organism->ActivateDivide(ctx);
 
   // Mother viability checks could go here.  
   m_just_divided = true;

Deleted: branches/collect/source/drivers/SConscript
===================================================================
--- branches/collect/source/drivers/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/drivers/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,31 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-  'cAvidaDriver.h',
-  'cDefaultAnalyzeDriver.h',
-  'cDefaultRunDriver.h',
-  'cDriverManager.h',
-  'cFallbackWorldDriver.h',
-  'cWorldDriver.h',
-]
-
-srcs = [
-  'cDefaultAnalyzeDriver.cc',
-  'cDefaultRunDriver.cc',
-  'cDriverManager.cc',
-  'cFallbackWorldDriver.cc',
-]
-
-environment.Library('drivers', srcs) 
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
- 
-
-# vim: set ft=python:

Deleted: branches/collect/source/main/SConscript
===================================================================
--- branches/collect/source/main/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,97 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-  'avida.h',
-  'cAvidaConfig.h',
-  'cAvidaContext.h',
-  'cBirthChamber.h',
-  'cDeme.h',
-  'cEnvironment.h',
-  'cEventList.h',
-  'cFitnessMatrix.h',
-  'cGenome.h',
-  'cGenomeUtil.h',
-  'cInstruction.h',
-  'cLandscape.h',
-  'cLocalMutations.h',
-  'cMutation.h',
-  'cMutationLib.h',
-  'cMutationRates.h',
-  'cMxCodeArray.h',
-  'cOrganism.h',
-  'cOrgInterface.h',
-  'cOrgSeqMessage.h',
-  'cOrgSinkMessage.h',
-  'cOrgSourceMessage.h',
-  'cPhenotype.h',
-  'cPopulation.h',
-  'cPopulationCell.h',
-  'cPopulationInterface.h',
-  'cReaction.h',
-  'cReactionLib.h',
-  'cReactionProcess.h',
-  'cReactionRequisite.h',
-  'cReactionResult.h',
-  'cResource.h',
-  'cResourceCount.h',
-  'cResourceLib.h',
-  'cSpatialCountElem.h',
-  'cSpatialResCount.h',
-  'cStats.h',
-  'cTaskContext.h',
-  'cTaskEntry.h',
-  'cTaskLib.h',
-  'cTaskState.h',
-  'cWorld.h',
-  'MyCodeArrayLessThan.h',
-  'nGeometry.h',
-  'nMutation.h',
-  'nReaction.h',
-]
-
-srcs = [
-  'avida.cc',
-  'cAvidaConfig.cc',
-  'cBirthChamber.cc',
-  'cDeme.cc',
-  'cEnvironment.cc',
-  'cEventList.cc',
-  'cFitnessMatrix.cc',
-  'cGenome.cc',
-  'cGenomeUtil.cc',
-  'cInstruction.cc',
-  'cLandscape.cc',
-  'cLocalMutations.cc',
-  'cMutationLib.cc',
-  'cMutationRates.cc',
-  'cMxCodeArray.cc',
-  'cOrganism.cc',
-  'cPhenotype.cc',
-  'cPopulation.cc',
-  'cPopulationCell.cc',
-  'cPopulationInterface.cc',
-  'cReaction.cc',
-  'cReactionLib.cc',
-  'cReactionResult.cc',
-  'cResource.cc',
-  'cResourceCount.cc',
-  'cResourceLib.cc',
-  'cSpatialCountElem.cc',
-  'cSpatialResCount.cc',
-  'cStats.cc',
-  'cTaskLib.cc',
-  'cWorld.cc',
-]
-
-main = environment.Library('main', srcs) 
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-# vim: set ft=python:

Modified: branches/collect/source/main/avida.cc
===================================================================
--- branches/collect/source/main/avida.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/avida.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -95,9 +95,9 @@
        << "Benjamin Beckmann, Jeffrey Clune, Art Covert, Santiago Elena, Sherri Goings," << endl
        << "Heather Goldsby, David Knoester, Richard Lenski, Philip McKinley," << endl
        << "Dusan Misevic, Elizabeth Ostrowski, Robert Pennock, Matthew Rupp, Eric Torng," << endl
-       << "Bess Walker, and Gabriel Yedid" << endl << endl;
+       << "Michael Vo, Bess Walker, and Gabriel Yedid" << endl << endl;
 
-  cout << "For a more complete list of contributors, see the CONTRIBUTORS file." << endl;
+  cout << "For a more complete list of contributors, see the AUTHORS file." << endl;
 
   cout << endl;
 

Modified: branches/collect/source/main/cAvidaConfig.h
===================================================================
--- branches/collect/source/main/cAvidaConfig.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cAvidaConfig.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -361,12 +361,12 @@
   CONFIG_ADD_VAR(APPLY_ENERGY_METHOD, int, 0, "When should rewarded energy be applied to current energy?\n0 = on divide\n1 = on completion of task\n2 = on sleep");  
   CONFIG_ADD_VAR(ENERGY_VERBOSE, bool, 0, "Print energy and merit values. 0/1 (off/on)");
   CONFIG_ADD_VAR(LOG_SLEEP_TIMES, bool, 0, "Log sleep start and end times. 0/1 (off/on)\nWARNING: may use lots of memory.");
-//  CONFIG_ADD_VAR(FIX_METABOLIC_RATE, bool, 0, "When activated the metabolic rate of all orgiansims are equal. 0/1 (off/on)"); // TODO - check for correctness
+  //  CONFIG_ADD_VAR(FIX_METABOLIC_RATE, bool, 0, "When activated the metabolic rate of all orgiansims are equal. 0/1 (off/on)"); // TODO - check for correctness
 
   CONFIG_ADD_GROUP(SECOND_PASS_GROUP, "Tracking metrics known after the running experiment previously");
   CONFIG_ADD_VAR(TRACK_CCLADES, int, 0, "Enable tracking of coalescence clades");
   CONFIG_ADD_VAR(TRACK_CCLADES_IDS, cString, "coalescence.ids", "File storing coalescence IDs");
-  
+
   CONFIG_ADD_GROUP(GX_GROUP, "Gene Expression CPU Settings");
   CONFIG_ADD_VAR(MAX_PROGRAMIDS, int, 16, "Maximum number of programids an organism can create.");
   CONFIG_ADD_VAR(MAX_PROGRAMID_AGE, int, 2000, "Max number of CPU cycles a programid executes before it is removed.");
@@ -374,7 +374,7 @@
   CONFIG_ADD_VAR(IMPLICIT_BG_PROMOTER_RATE, double, 0.0, "Relative rate of non-promoter sites creating programids.");
   CONFIG_ADD_VAR(IMPLICIT_TURNOVER_RATE, double, 0.0, "Number of programids recycled per CPU cycle. 0 = OFF");
   CONFIG_ADD_VAR(IMPLICIT_MAX_PROGRAMID_LENGTH, int, 0, "Creation of an executable programid terminates after this many instructions. 0 = disabled");
-//  CONFIG_ADD_VAR(CLEAR_ON_OUTPUT, int, 0, "Reset input buffer every time output called?"); @JEB Not fully implemented
+  //  CONFIG_ADD_VAR(CLEAR_ON_OUTPUT, int, 0, "Reset input buffer every time output called?"); @JEB Not fully implemented
 
   CONFIG_ADD_GROUP(PROMOTER_GROUP, "Promoters");
   CONFIG_ADD_VAR(PROMOTERS_ENABLED, int, 0, "Use the promoter/terminator execution scheme.\nCertain instructions must also be included.");
@@ -397,6 +397,12 @@
   CONFIG_ADD_VAR(COLOR_MUT_NEG,    cString, "FFFF00", "Color to flag stat that has changed since parent.");
   CONFIG_ADD_VAR(COLOR_MUT_LETHAL, cString, "FF0000", "Color to flag stat that has changed since parent.");
 
+  // @WRE: Additions for approaching various features of biological organisms
+  CONFIG_ADD_GROUP(BIOMIMETIC_GROUP, "Biomimetic Features Settings");
+  CONFIG_ADD_VAR(BIOMIMETIC_REFRACTORY_PERIOD, double, 0.0, "Number of updates affected by refractory period");
+  CONFIG_ADD_VAR(BIOMIMETIC_MOVEMENT_STEP, int, 0, "Number of cells to move Avidian on move instruction");
+  CONFIG_ADD_VAR(BIOMIMETIC_K, int, 0, "Carrying capacity in number of organisms");
+  
 #endif
   
   void Load(const cString& filename, const bool& crash_if_not_found);

Modified: branches/collect/source/main/cAvidaContext.h
===================================================================
--- branches/collect/source/main/cAvidaContext.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cAvidaContext.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -17,11 +17,15 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation, 
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/*! Class to to hold a random number generator.  Used to keep random
+    number creation in a given context seperate from rest of the program
+    helps with reapeatablity???? */
+
 #ifndef cAvidaContext_h
 #define cAvidaContext_h
 

Modified: branches/collect/source/main/cBirthChamber.cc
===================================================================
--- branches/collect/source/main/cBirthChamber.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cBirthChamber.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -39,8 +39,14 @@
 
 cBirthChamber::cBirthChamber(cWorld* world) : m_world(world)
 {
-  const int num_orgs = m_world->GetConfig().WORLD_X.Get() * m_world->GetConfig().WORLD_Y.Get();
   const int num_demes = m_world->GetConfig().NUM_DEMES.Get(); 
+  int num_orgs;
+
+  num_orgs = m_world->GetConfig().BIOMIMETIC_K.Get();
+  if (0 >= num_orgs) {
+    num_orgs = m_world->GetConfig().WORLD_X.Get() * m_world->GetConfig().WORLD_Y.Get();
+  }
+
   local_wait_entry.Resize(num_orgs);
   deme_wait_entry.Resize(num_demes);
 }

Modified: branches/collect/source/main/cEnvReqs.h
===================================================================
--- branches/collect/source/main/cEnvReqs.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cEnvReqs.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -17,11 +17,12 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/*! Support for extensible input from the environment. */
 #ifndef cEnvReqs_h
 #define cEnvReqs_h
 

Modified: branches/collect/source/main/cEnvironment.cc
===================================================================
--- branches/collect/source/main/cEnvironment.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cEnvironment.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -18,11 +18,15 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/*!  *  Routines to read the environment files that contains information
+about resources and reactions (which allow rewards or punishments
+to organisms doing certain tasks).  */
+
 #include "cEnvironment.h"
 
 #include "cAvidaContext.h"
@@ -408,11 +412,17 @@
 
 bool cEnvironment::LoadCell(cString desc)
 
-/* Routine to read in spatial resources loaded in one cell at a time */
+/*****************************************************************************
+  Routine to read in spatial resources loaded in one cell at a time. Syntax:
 
+   CELL resource_name:cell_list[:options]
+
+   where options are initial, inflow and outflow
+*****************************************************************************/
+
 {
   if (desc.GetSize() == 0) {
-    cerr << "Warning: Resource line with no resources listed." << endl;
+    cerr << "Warning: CELL line with no resources listed." << endl;
     return false;
   }
   
@@ -787,6 +797,17 @@
 }
 
 
+void cEnvironment::SwapInputs(cAvidaContext& ctx, tArray<int>& src_input_array, tArray<int>& dest_input_array) const
+{
+  tArray<int>& tmp_input_array = dest_input_array;
+
+  // Just swap the pointers around.  
+  dest_input_array = src_input_array;
+  src_input_array = tmp_input_array;
+  
+}
+
+
 bool cEnvironment::TestInput(cReactionResult& result, const tBuffer<int>& inputs,
                              const tBuffer<int>& outputs, const tArray<double>& resource_count) const
 {

Modified: branches/collect/source/main/cEnvironment.h
===================================================================
--- branches/collect/source/main/cEnvironment.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cEnvironment.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -18,11 +18,15 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/*!  Classes to hold information about the environmentthat contains information
+     about resources and reactions (which allow rewards or punishments
+     to organisms doing certain tasks). */
+
 #ifndef cEnvironment_h
 #define cEnvironment_h
 
@@ -122,7 +126,9 @@
 
   // Interaction with the organisms
   void SetupInputs(cAvidaContext& ctx, tArray<int>& input_array, bool random = true) const;
+  void SwapInputs(cAvidaContext& ctx, tArray<int>& src_input_array, tArray<int>& dest_input_array) const;
 
+
   bool TestInput(cReactionResult& result, const tBuffer<int>& inputs,
                  const tBuffer<int>& outputs, const tArray<double>& resource_count) const;
 

Modified: branches/collect/source/main/cPhenotype.cc
===================================================================
--- branches/collect/source/main/cPhenotype.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cPhenotype.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -54,6 +54,7 @@
   , cur_inst_count(world->GetHardwareManager().GetInstSet().GetSize())
   , cur_sense_count(m_world->GetStats().GetSenseSize())
   , sensed_resources(m_world->GetEnvironment().GetResourceLib().GetSize())
+  , cur_task_time(m_world->GetEnvironment().GetNumTasks())   // Added for tracking time; WRE 03-18-07
   , promoter_last_inst_terminated(false) 
   , last_task_count(m_world->GetEnvironment().GetNumTasks())
   , last_internal_task_count(m_world->GetEnvironment().GetNumTasks())
@@ -154,6 +155,7 @@
   cur_reaction_add_reward.SetAll(0);
   cur_inst_count.SetAll(0);
   cur_sense_count.SetAll(0);  
+  cur_task_time.SetAll(0.0);  // Added for time tracking; WRE 03-18-07
   for (int j = 0; j < sensed_resources.GetSize(); j++)
 	      sensed_resources[j] =  parent_phenotype.sensed_resources[j];
   SetupPromoterWeights(_genome, true);
@@ -291,6 +293,7 @@
   cur_inst_count.SetAll(0);
   sensed_resources.SetAll(0);
   cur_sense_count.SetAll(0);
+  cur_task_time.SetAll(0.0);
   SetupPromoterWeights(_genome, true);
   
   // Copy last values from parent
@@ -450,6 +453,7 @@
   cur_reaction_add_reward.SetAll(0);
   cur_inst_count.SetAll(0);
   cur_sense_count.SetAll(0);
+  cur_task_time.SetAll(0.0);
 
   // Setup other miscellaneous values...
   num_divides++;
@@ -593,6 +597,7 @@
   cur_reaction_add_reward.SetAll(0);
   cur_inst_count.SetAll(0);
   cur_sense_count.SetAll(0); 
+  cur_task_time.SetAll(0.0);
   sensed_resources.SetAll(-1.0);
   SetupPromoterWeights(_genome, true);
   
@@ -707,6 +712,7 @@
   cur_reaction_add_reward.SetAll(0);
   cur_inst_count.SetAll(0);
   cur_sense_count.SetAll(0);  
+  cur_task_time.SetAll(0.0);
   for (int j = 0; j < sensed_resources.GetSize(); j++)
 	      sensed_resources[j] =  clone_phenotype.sensed_resources[j];
   //SetupPromoterWeights(_genome); Do we reset here?
@@ -820,6 +826,11 @@
   const int num_tasks = env.GetNumTasks();
   const int num_reactions = env.GetReactionLib().GetSize();
 
+  // For refractory period @WRE 03-20-07
+  const int cur_update_time = m_world->GetStats().GetUpdate();
+  const double biomimetic_refractory_period = m_world->GetConfig().BIOMIMETIC_REFRACTORY_PERIOD.Get();
+  double refract_factor;
+
   cReactionResult result(num_resources, num_tasks, num_reactions);
 			
   // Run everything through the environment.
@@ -834,19 +845,31 @@
   // Update the phenotype with the results...
   // Start with updating task and reaction counters
   for (int i = 0; i < num_tasks; i++) {
+    // Calculate refractory period factor @WRE
+    // Modify TaskQuality amount based on refractory period
+    // Logistic equation using refractory period
+    // in update units from configuration file.  @WRE 03-20-07, 04-17-07
+    if (0.0 == biomimetic_refractory_period) {
+      refract_factor = 1.0;
+    } else {
+      refract_factor = 1.0 - (1.0 / (1.0 + exp((cur_update_time - cur_task_time[i])-biomimetic_refractory_period*0.5)));
+    }
     if (result.TaskDone(i) == true) 
     {
       cur_task_count[i]++;
       eff_task_count[i]++;
       if(result.UsedEnvResource() == false) { cur_internal_task_count[i]++; }
     }
+
     if (result.TaskQuality(i) > 0) 
     {
-    	cur_task_quality[i]+= result.TaskQuality(i);
-    	if(result.UsedEnvResource() == false) { cur_internal_task_quality[i] += result.TaskQuality(i); }
+    	cur_task_quality[i] += result.TaskQuality(i) * refract_factor;
+    	if(result.UsedEnvResource() == false) { cur_internal_task_quality[i] += result.TaskQuality(i) * refract_factor; }
     }
-	cur_task_value[i] = result.TaskValue(i);
+    cur_task_value[i] = result.TaskValue(i);
+    cur_task_time[i] = cur_update_time; // Find out time from context
   }
+
   for (int i = 0; i < num_reactions; i++) {
     if (result.ReactionTriggered(i) == true) cur_reaction_count[i]++;
     cur_reaction_add_reward[i] += result.GetReactionAddBonus(i);

Modified: branches/collect/source/main/cPhenotype.h
===================================================================
--- branches/collect/source/main/cPhenotype.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cPhenotype.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -123,6 +123,7 @@
   tArray<int> cur_inst_count;                 // Instruction exection counter
   tArray<int> cur_sense_count;                // Total times resource combinations have been sensed; @JEB 
   tArray<double> sensed_resources;            // Resources which the organism has sensed; @JEB 
+  tArray<double> cur_task_time;    // Time at which each task was last performed; WRE 03-18-07
   tArray<cCodeLabel> active_transposons;      // Transposons that are active; @JEB
   tArray<double> base_promoter_weights;       // Baseline chance of starting execution from each position; @JEB 
   tArray<double> cur_promoter_weights;        // Current of starting execution from each position, adjusted for regulation; @JEB 

Modified: branches/collect/source/main/cPopulation.cc
===================================================================
--- branches/collect/source/main/cPopulation.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cPopulation.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -473,6 +473,97 @@
   
 }
 
+// @WRE 2007/07/05 Helper function to take care of side effects of Avidian 
+// movement that cannot be directly handled in cHardwareCPU.cc
+void cPopulation::MoveOrganisms(cAvidaContext& ctx, cPopulationCell& src_cell, cPopulationCell& dest_cell)
+{
+  // Declarations
+  int actualNeighborhoodSize, fromFacing, destFacing, newFacing, success;
+#ifdef DEBBUG
+  int sID, dID, xx1, yy1, xx2, yy2;
+#endif
+
+  // Swap inputs between cells to fix bus error when Avidian moves into an unoccupied cell
+  environment.SwapInputs(ctx, src_cell.input_array, dest_cell.input_array);
+  
+  // Find neighborhood size for facing 
+  if (NULL != dest_cell.GetOrganism()) {
+    actualNeighborhoodSize = dest_cell.GetOrganism()->GetNeighborhoodSize();
+  } else {
+    if (NULL != src_cell.GetOrganism()) {
+      actualNeighborhoodSize = src_cell.GetOrganism()->GetNeighborhoodSize();
+    } else {
+      // Punt
+      actualNeighborhoodSize = 8;
+    }
+  }
+ 
+  // Swap cell facings between cells, so that if movement is directed, it continues to be associated with
+  // the same organism
+  // Determine absolute facing for each cell
+  fromFacing = src_cell.GetFacing();
+  destFacing = dest_cell.GetFacing();
+
+  // Set facing in source cell
+  success = 0;
+  newFacing = destFacing;
+  for(int i = 0; i < actualNeighborhoodSize; i++) {
+    if (src_cell.GetFacing() != newFacing) {
+      src_cell.ConnectionList().CircNext();
+      //cout << "MO: src_cell facing not yet at " << newFacing << endl;
+    } else {
+      //cout << "MO: src_cell facing successfully set to " << newFacing << endl;
+      success = 1;
+      break;
+    }
+  }
+// @DMB this doesn't compile properly -- #ifdef DEBUG
+#if 0
+  if (!success) {
+    sID = src_cell.GetID();
+    dID = dest_cell.GetID();
+    src_cell.GetPosition(xx1,yy1);
+    dest_cell.GetPosition(xx2,yy2);
+    //Conditional for examining only neighbor move without swap in facing
+    //if (1 == abs(xx2-xx1)+abs(yy2-yy1)) {
+    cout << "MO: src: " << sID << "@ (" << xx1 << "," << yy1 << ") dest: " << dID << "@ (" << xx2 << "," << yy2 << "), FAILED to set src_cell facing to " << newFacing << endl;
+    for (int j=0; j < actualNeighborhoodSize; j++) {
+      src_cell.ConnectionList().CircNext();
+      src_cell.GetCellFaced().GetPosition(xx2,yy2);
+      cout << "connlist for " << sID << ": facing " << src_cell.GetFacing() << " -> (" << xx2 << "," << yy2 << ")" << endl;
+    }
+    //}
+  }
+#endif 
+
+  // Set facing in destinatiion cell
+  success = 0;
+  newFacing = fromFacing;
+  for(int i = 0; i < actualNeighborhoodSize; i++) {
+    if (dest_cell.GetFacing() != newFacing) {
+      dest_cell.ConnectionList().CircNext();
+      // cout << "MO: dest_cell facing not yet at " << newFacing << endl;
+    } else {
+      // cout << "MO: dest_cell facing successfully set to " << newFacing << endl;
+      success = 1;
+      break;
+    }
+  }
+// @DMB this doesn't compile properly -- #ifdef DEBUG
+#if 0
+  if (!success) {
+    sID = src_cell.GetID();
+    dID = dest_cell.GetID();
+    src_cell.GetPosition(xx1,yy1);
+    dest_cell.GetPosition(xx2,yy2);
+    if (1 == abs(xx2-xx1)+abs(yy2-yy1)) {
+      cout << "MO: src: " << sID << "@ (" << xx1 << "," << yy1 << ") dest: " << dID << "@ (" << xx2 << "," << yy2 << "), FAILED to set dest_cell facing to " << newFacing << endl;
+    }
+  }
+#endif
+  
+}
+
 void cPopulation::KillOrganism(cPopulationCell& in_cell)
 {
   // do we actually have something to kill?
@@ -666,24 +757,34 @@
 
 void cPopulation::SwapCells(cPopulationCell & cell1, cPopulationCell & cell2)
 {
+  // Sanity checks: Don't process if the cells are the same and 
+  // don't bother trying to move when given a cell that isn't there
+  //cout << "SwapCells: testing if cell1 and cell2 are non-null" << endl;
+  //if (!(NULL != cell1) || !(NULL != cell2)) return;
+  if ((&cell1 == NULL) || (&cell2 == NULL)) return;
+  //cout << "SwapCells: testing if cell1 and cell2 are different" << endl;  
+  if (cell1.GetID() == cell2.GetID()) return;
+  // Clear current contents of cells
+  //cout << "SwapCells: clearing cell contents" << endl;
   cOrganism * org1 = cell1.RemoveOrganism();
   cOrganism * org2 = cell2.RemoveOrganism();
+  //cout << "SwapCells: organism 2 is non-null, fix up source cell" << endl;
   if (org2 != NULL) {
     cell1.InsertOrganism(*org2);
     schedule->Adjust(cell1.GetID(), org2->GetPhenotype().GetMerit());
   } else {
     schedule->Adjust(cell1.GetID(), cMerit(0));
   }
-
+  //cout << "SwapCells: organism 1 is non-null, fix up dest cell" << endl;
   if (org1 != NULL) {
     cell2.InsertOrganism(*org1);
     schedule->Adjust(cell2.GetID(), org1->GetPhenotype().GetMerit());
   } else {
     schedule->Adjust(cell2.GetID(), cMerit(0));
   }
+  //cout << "SwapCells: Done." << endl;
 }
 
-
 // CompeteDemes  probabilistically copies demes into the next generation
 // based on their fitness. How deme fitness is estimated is specified by 
 // competition_type input argument as:
@@ -1645,6 +1746,12 @@
 
 void cPopulation::UpdateOrganismStats()
 {
+  // Carrying capacity @WRE 04-20-07
+  // Check for positive non-zero carrying capacity and apply it
+  if (0 < m_world->GetConfig().BIOMIMETIC_K.Get()) {
+    SerialTransfer(m_world->GetConfig().BIOMIMETIC_K.Get(),true);
+  }
+
   // Loop through all the cells getting stats and doing calculations
   // which must be done on a creature by creature basis.
   

Modified: branches/collect/source/main/cPopulation.h
===================================================================
--- branches/collect/source/main/cPopulation.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cPopulation.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -162,6 +162,10 @@
   
   // Deactivate an organism in the population (required for deactivations)
   void KillOrganism(cPopulationCell& in_cell);
+  
+  // @WRE 2007/07/05 Helper function to take care of side effects of Avidian 
+  // movement that cannot be directly handled in cHardwareCPU.cc
+  void MoveOrganisms(cAvidaContext& ctx, cPopulationCell& src_cell, cPopulationCell& dest_cell);
 
   // Specialized functionality
   void Kaboom(cPopulationCell& in_cell, int distance=0);

Modified: branches/collect/source/main/cResource.h
===================================================================
--- branches/collect/source/main/cResource.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cResource.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -18,11 +18,13 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/*! Classes to held global and local information about a given resource */
+
 #ifndef cResource_h
 #define cResource_h
 
@@ -34,7 +36,7 @@
 #endif
 
 
-/* class to hold resource informations for individual cells (mini-chemostats) */
+/*! class to hold resource information for individual cells (mini-chemostats) */
 
 class cCellResource
 {

Modified: branches/collect/source/main/cSpatialCountElem.cc
===================================================================
--- branches/collect/source/main/cSpatialCountElem.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cSpatialCountElem.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -18,11 +18,14 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation, 
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/* Class to store information about amount of local/spatial resource in a
+   given cell. */
+
 #include "cSpatialCountElem.h"
 
 const int MAXFLOWPTS = 8;

Modified: branches/collect/source/main/cSpatialResCount.h
===================================================================
--- branches/collect/source/main/cSpatialResCount.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cSpatialResCount.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -18,11 +18,13 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 
+/*! Class to keep track of amounts of localized resources. */
+
 #ifndef cSpatialResCount_h
 #define cSpatialResCount_h
 

Modified: branches/collect/source/main/cTaskLib.cc
===================================================================
--- branches/collect/source/main/cTaskLib.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/main/cTaskLib.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,3 +1,4 @@
+
 /*
  *  cTaskLib.cc
  *  Avida
@@ -2123,6 +2124,7 @@
   schema.AddEntry("function", 0, cArgSchema::SCHEMA_INT);
   schema.AddEntry("binary", 1, 0);
   schema.AddEntry("varlength", 2, 8);
+  schema.AddEntry("numvars", 3, 2);
   // Double Arguments
   schema.AddEntry("basepow", 0, 2.0);
   schema.AddEntry("maxFx", 1, 1.0);
@@ -2162,78 +2164,112 @@
   if (ctx.GetOutputBuffer().GetNumStored() < ctx.GetOutputBuffer().GetCapacity()) return 0;
 
   double quality = 0.0;
+  const cArgContainer& args = ctx.GetTaskEntry()->GetArguments();
 
   // which function are we currently checking?
-  const int function = ctx.GetTaskEntry()->GetArguments().GetInt(0);
+  const int function = args.GetInt(0);
 
-   // always get x&y, at least for now, turn it into a double between 0 and 1
-  double y, x, Fx = 0.0;
+   // get however many variables need, turn them into doubles between 0 and 1
+   tArray<double> vars;
+   vars.Resize(args.GetInt(3));
 
-  const cArgContainer& args = ctx.GetTaskEntry()->GetArguments();
-  if (args.GetInt(1)) {
+   double Fx = 0.0;
+   
+  if (args.GetInt(1)) 
+  {
     int len = args.GetInt(2);
     double base_pow = args.GetDouble(0);
-    double tempX = 0, tempY = 0, tot = 0;
-    for (int i = len - 1; i >= 0; i--) {
-      tempX += ctx.GetOutputBuffer()[i + len] * pow(base_pow, (len - 1) - i);
-      tempY += ctx.GetOutputBuffer()[i] * pow(base_pow, (len - 1) - i);
-      tot += pow(base_pow, double(i));
-    }
-    x = tempX / tot;
-    y = tempY / tot;
-  } else {
-    x = double(ctx.GetOutputBuffer()[0]) / 0xffffffff;
-    y = double(ctx.GetOutputBuffer()[1]) / 0xffffffff;
+
+	tArray<double> tempVars;
+	tempVars.Resize(args.GetInt(3));
+	for (int i=0; i<args.GetInt(3); i++)
+		tempVars[i] = 0;
+    
+	double tot = 0;
+	for (int i = len - 1; i >= 0; i--) 
+	{
+		for (int j=0; j<args.GetInt(3); j++)
+		{
+			tempVars[j] += ctx.GetOutputBuffer()[i + len*(args.GetInt(3)-j-1)] * pow(base_pow, (len - 1) - i);
+		}
+		tot += pow(base_pow, double(i));
+	}
+	for (int i=0; i<args.GetInt(3); i++)
+		vars[i] = tempVars[i] / tot;
+  } 
+  else 
+  {
+	  for (int j=0; j<args.GetInt(3); j++)
+		  vars[j] = double(ctx.GetOutputBuffer()[j]) / 0xffffffff;
   }
-  if (x < 0)
-    x = 0;
-  else if (x > 1)
-    x = 1;
-  if (y < 0)
-    y = 0;
-  else if (y > 1)
-    y = 1;
+  
+  for (int j=0; j<args.GetInt(3); j++)
+  {
+	  if (vars[j] < 0)
+		  vars[j] = 0;
+	  else if (vars[j] > 1)
+		  vars[j] = 1;
+  }
 
   switch(function) {
     case 1:
-	  Fx = x;		// F1
+	  Fx = vars[0];		// F1
       break;
 
     case 2:
-      Fx = (1.0 + y) * (1.0 - sqrt(x / (1.0 + y)));   // F2
+      Fx = (1.0 + vars[1]) * (1.0 - sqrt(vars[0] / (1.0 + vars[1])));   // F2
       break;
 
     case 3:
-      Fx = (1.0 + y) * (1.0 - pow(x / (1.0 + y), 2.0));  // F3
+      Fx = (1.0 + vars[1]) * (1.0 - pow(vars[0] / (1.0 + vars[1]), 2.0));  // F3
       break;
 
     case 4:
-      Fx = (1.0 + y) * (1.0 - sqrt(x / (1.0 + y)) - (x / (1.0 + y)) * sin(3.14159 * x * 10.0));
+      Fx = (1.0 + vars[1]) * (1.0 - sqrt(vars[0] / (1.0 + vars[1])) - (vars[0] / (1.0 + vars[1])) * sin(3.14159 * vars[0] * 10.0));
 	  break;
 
     case 5:
-      x = x * -2.0;
-      Fx = x*x + y*y;
+      vars[0] = vars[0] * -2.0;
+      Fx = vars[0]*vars[0] + vars[1]*vars[1];
       break;
 
     case 6:
-      x = x * -2.0;
-      Fx = (x + 2.0)*(x + 2.0) + y*y;
+      vars[0] = vars[0] * -2.0;
+      Fx = (vars[0] + 2.0)*(vars[0] + 2.0) + vars[1]*vars[1];
       break;
 
     case 7:
-      x = x * 4.0;
-      Fx = sqrt(x) + y;
+      vars[0] = vars[0] * 4.0;
+      Fx = sqrt(vars[0]) + vars[1];
       break;
 
     case 8:
-      x = x * 4.0;
-      Fx = sqrt(4.0 - x) + y;
+      vars[0] = vars[0] * 4.0;
+      Fx = sqrt(4.0 - vars[0]) + vars[1];
       break;
 
+    case 9:
+    {
+      double sum = 0;
+      for (int i=1; i<5; i++)
+	sum += vars[i]/4.0;
+      Fx = (1.0 + 9*sum) * (1.0 - sqrt(vars[0] / (1.0 + 9*sum)));
+      break;
+    }
+
+    case 10:
+    {
+      double sum = 0;
+      for (int i=1; i<5; i++)
+	sum += vars[i]/4.0;
+      Fx = (1.0 + sum) * (1.0 - pow(vars[0] / (1.0 + sum), 2.0));
+      break;
+    }
+
     default:
       quality = .001;
   }
+
   ctx.SetTaskValue(Fx);
   if (args.GetDouble(3) < 0.0)
   {
@@ -2247,21 +2283,21 @@
     {
       if (Fx <= (args.GetDouble(1) - args.GetDouble(2))*args.GetDouble(3) + args.GetDouble(2))
       {
-	quality = 1.0;
+		  quality = 1.0;
       }
       else
       {
-	quality = 0.0;
+		  quality = 0.0;
       }
     }
     else
     {
-      if ( (Fx >= (args.GetDouble(1) - args.GetDouble(2))*args.GetDouble(3) + args.GetDouble(2))
-	   && (Fx <= (args.GetDouble(1) - args.GetDouble(2))*args.GetDouble(4) + args.GetDouble(2)) )
-	quality = 1.0;
-      else
-	quality = 0.0;
-    }
+		if ( (Fx >= (args.GetDouble(1) - args.GetDouble(2))*args.GetDouble(3) + args.GetDouble(2))
+			&& (Fx <= (args.GetDouble(1) - args.GetDouble(2))*args.GetDouble(4) + args.GetDouble(2)) )
+			quality = 1.0;
+		else
+			quality = 0.0;
+	}
   }
 
   // because want org to only have 1 shot to use outputs for all functions at once, even if they

Deleted: branches/collect/source/platform/SConscript
===================================================================
--- branches/collect/source/platform/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/platform/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,26 +0,0 @@
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-	'cThread.h',
-	'PlatformExpert.h'
-]
-
-srcs = [
-	'cThread.cc',
-	'PlatformExpert.cc'
-]
-    
-if environment['enableTCMalloc'] in ('True', '1', 1):
-  environment.SConscript('tcmalloc/SConscript')
-
-environment.Library('platform', srcs) 
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-  
-# vim: set ft=python:

Deleted: branches/collect/source/platform/tcmalloc/SConscript
===================================================================
--- branches/collect/source/platform/tcmalloc/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/platform/tcmalloc/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,13 +0,0 @@
-
-Import('environment')
-
-environment.Library('tcmalloc',
-  [
-    'system-alloc.cc',
-    'tcmalloc-logging.cc',
-    'tcmalloc.cc',
-  ],
-) 
-
-  
-# vim: set ft=python:

Modified: branches/collect/source/script/ASTree.cc
===================================================================
--- branches/collect/source/script/ASTree.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/script/ASTree.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -24,24 +24,33 @@
 
 #include "ASTree.h"
 
+#include "cASTVisitor.h"
 
-void cASTExpressionUnary::Accept(cASTVisitor& visitor)
-{
-  
-}
 
-void cASTExpressionBinary::Accept(cASTVisitor& visitor)
-{
-  
-}
+void cASTAssignment::Accept(cASTVisitor& visitor) { visitor.visitAssignment(*this); }
 
-void cASTLiteral::Accept(cASTVisitor& visitor)
-{
-  
-}
+void cASTReturnStatement::Accept(cASTVisitor& visitor) { visitor.visitReturnStatement(*this); }
+void cASTStatementList::Accept(cASTVisitor& visitor) { visitor.visitStatementList(*this); }
 
-void cASTFunctionCall::Accept(cASTVisitor& visitor)
+void cASTForeachBlock::Accept(cASTVisitor& visitor) { visitor.visitForeachBlock(*this); }
+void cASTIfBlock::Accept(cASTVisitor& visitor) { visitor.visitIfBlock(*this); }
+void cASTWhileBlock::Accept(cASTVisitor& visitor) { visitor.visitWhileBlock(*this); }
+
+void cASTFunctionDefinition::Accept(cASTVisitor& visitor) { visitor.visitFunctionDefinition(*this); }
+void cASTVariableDefinition::Accept(cASTVisitor& visitor) { visitor.visitVariableDefinition(*this); }
+
+void cASTExpressionBinary::Accept(cASTVisitor& visitor) { visitor.visitExpressionBinary(*this); }
+void cASTExpressionUnary::Accept(cASTVisitor& visitor) { visitor.visitExpressionUnary(*this); }
+
+void cASTFunctionCall::Accept(cASTVisitor& visitor) { visitor.visitFunctionCall(*this); }
+void cASTLiteral::Accept(cASTVisitor& visitor) { visitor.visitLiteral(*this); }
+void cASTLiteralArray::Accept(cASTVisitor& visitor) { visitor.visitLiteralArray(*this); }
+void cASTVariableReference::Accept(cASTVisitor& visitor) { visitor.visitVariableReference(*this); }
+
+
+cASTStatementList::~cASTStatementList()
 {
-  
+  cASTNode* node = NULL;
+  tListIterator<cASTNode> it(m_nodes);
+  while ((node = it.Next())) delete node;
 }
-

Modified: branches/collect/source/script/ASTree.h
===================================================================
--- branches/collect/source/script/ASTree.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/script/ASTree.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -28,14 +28,25 @@
 #ifndef AvidaScript_h
 #include "AvidaScript.h"
 #endif
+#ifndef cString_h
+#include "cString.h"
+#endif
 #ifndef defs_h
 #include "defs.h"
 #endif
+#ifndef tList_h
+#include "tList.h"
+#endif
 
 
 class cASTVisitor;
 
 
+// -- Abstract Syntax Tree Base Class
+// ---------------------------------------------------------------------------------------------------------------------
+
+
+//! Abstract base class for all AvidaScript abstract syntax tree nodes
 class cASTNode
 {
 private:
@@ -52,20 +63,201 @@
 };
 
 
-class cASTExpressionUnary : public cASTNode
+
+// -- Concrete Abstract Syntax Tree Nodes
+// ---------------------------------------------------------------------------------------------------------------------
+
+class cASTAssignment;
+
+class cASTReturnStatement;
+class cASTStatementList;
+
+class cASTForeachBlock;
+class cASTIfBlock;
+class cASTWhileBlock;
+
+class cASTFunctionDefinition;
+class cASTVariableDefinition;
+
+class cASTExpressionBinary;
+class cASTExpressionUnary;
+
+class cASTFunctionCall;
+class cASTLiteral;
+class cASTLiteralArray;
+class cASTVariableReference;
+
+
+
+// --------  Assignment Nodes  --------
+
+class cASTAssignment : public cASTNode
 {
 private:
-  ASToken_t m_op;
+  cString m_var;
   cASTNode* m_expr;
   
 public:
-  cASTExpressionUnary(ASToken_t op) : m_op(op), m_expr(NULL) { ; }
+  cASTAssignment(const cString& var) : m_var(var), m_expr(NULL) { ; }
+  ~cASTAssignment() { delete m_expr; }
   
-  void SetExpression(cASTNode* expr) { m_expr = expr; }
+  inline const cString& GetVariable() { return m_var; }
   
+  inline void SetExpression(cASTNode* expr) { delete m_expr; m_expr = expr; }
+  inline cASTNode* GetExpression() { return m_expr; }
+  
   void Accept(cASTVisitor& visitor);
 };
 
+
+
+// --------  Block Nodes  --------
+
+class cASTReturnStatement : public cASTNode
+{
+private:
+  cASTNode* m_expr;
+  
+public:
+  cASTReturnStatement(cASTNode* expr) : m_expr(expr) { ; }
+  ~cASTReturnStatement() { delete m_expr; }
+
+  inline cASTNode* GetExpression() { return m_expr; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTStatementList : public cASTNode
+{
+private:
+  tList<cASTNode> m_nodes;
+  
+public:
+  cASTStatementList() { ; }
+  ~cASTStatementList();
+  
+  inline void AddNode(cASTNode* n) { m_nodes.PushRear(n); }
+  inline tListIterator<cASTNode> Iterator() { return tListIterator<cASTNode>(m_nodes); }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+
+
+// --------  Conditional Block Nodes  --------
+
+class cASTForeachBlock : public cASTNode
+{
+private:
+  cASTVariableDefinition* m_var;
+  cASTNode* m_expr;
+  cASTNode* m_code;
+  
+public:
+  cASTForeachBlock(cASTVariableDefinition* v, cASTNode* e, cASTNode* c) : m_var(v), m_expr(e), m_code(c) { ; }
+  
+  inline cASTVariableDefinition* GetVariable() { return m_var; }
+  inline cASTNode* GetValues() { return m_expr; }
+  inline cASTNode* GetCode() { return m_code; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTIfBlock : public cASTNode
+{
+private:
+  cASTNode* m_expr;
+  cASTNode* m_code;
+  cASTNode* m_else;
+  
+public:
+  cASTIfBlock(cASTNode* expr, cASTNode* code) : m_expr(expr), m_code(code), m_else(NULL) { ; }
+  ~cASTIfBlock() { delete m_expr; delete m_code; delete m_else; }
+  
+  inline cASTNode* GetCondition() { return m_expr; }
+  inline cASTNode* GetCode() { return m_code; }
+  inline void SetElseCode(cASTNode* code) { m_else = code; }
+  inline cASTNode* GetElseCode() { return m_else; }
+  
+  inline bool HasElse() const { return (m_else); }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTWhileBlock : public cASTNode
+{
+private:
+  cASTNode* m_expr;
+  cASTNode* m_code;
+  
+public:
+  cASTWhileBlock(cASTNode* expr, cASTNode* code) : m_expr(expr), m_code(code) { ; }
+  ~cASTWhileBlock() { delete m_expr; delete m_code; }
+  
+  inline cASTNode* GetCondition() { return m_expr; }
+  inline cASTNode* GetCode() { return m_code; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+
+
+// --------  Definition Nodes  --------
+
+class cASTFunctionDefinition : public cASTNode
+{
+private:
+  ASType_t m_type;
+  cString m_name;
+  cASTNode* m_args;
+  cASTNode* m_code;
+  
+public:
+  cASTFunctionDefinition(ASType_t type, const cString& name, cASTNode* args)
+    : m_type(type), m_name(name), m_args(args), m_code(NULL) { ; }
+  
+  inline ASType_t GetType() { return m_type; }
+  inline const cString& GetName() { return m_name; }
+  inline cASTNode* GetArguments() { return m_args; }
+  
+  inline void SetCode(cASTNode* code) { m_code = code; }
+  inline cASTNode* GetCode() { return m_code; }
+  
+  inline bool IsDefinition() { return (m_code); }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTVariableDefinition : public cASTNode
+{
+private:
+  ASType_t m_type;
+  cString m_var;
+  cASTNode* m_assign;
+  
+public:
+  cASTVariableDefinition(ASType_t type, const cString& var) : m_type(type), m_var(var), m_assign(NULL) { ; }
+  ~cASTVariableDefinition() { delete m_assign; }
+  
+  inline ASType_t GetType() { return m_type; }
+  inline const cString& GetVariable() { return m_var; }
+  inline void SetAssignmentExpression(cASTNode* assign) { delete m_assign; m_assign = assign; }
+  inline cASTNode* GetAssignmentExpression() { return m_assign; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+
+
+// --------  Expression Operation Nodes  --------
+
 class cASTExpressionBinary : public cASTNode
 {
 private:
@@ -74,27 +266,40 @@
   cASTNode* m_right;
   
 public:
-  cASTExpressionBinary(ASToken_t op) : m_op(op), m_left(NULL), m_right(NULL) { ; }
+  cASTExpressionBinary(ASToken_t op, cASTNode* l, cASTNode* r) : m_op(op), m_left(l), m_right(r) { ; }
+  ~cASTExpressionBinary() { delete m_left; delete m_right; }
   
-  void SetLeft(cASTNode* left) { m_left = left; }
-  void SetRight(cASTNode* right) { m_right = right; }
+  inline ASToken_t GetOperator() { return m_op; }
+  inline void SetLeft(cASTNode* left) { m_left = left; }
+  inline cASTNode* GetLeft() { return m_left; }
+  inline void SetRight(cASTNode* right) { m_right = right; }
+  inline cASTNode* GetRight() { return m_right; }
   
   void Accept(cASTVisitor& visitor);
 };
 
 
-class cASTLiteral : public cASTNode
+class cASTExpressionUnary : public cASTNode
 {
 private:
-  ASToken_t m_type;
+  ASToken_t m_op;
+  cASTNode* m_expr;
   
 public:
-  cASTLiteral(ASToken_t t) : m_type(t) { ; }
-    
+  cASTExpressionUnary(ASToken_t op, cASTNode* e) : m_op(op), m_expr(e) { ; }
+  ~cASTExpressionUnary() { delete m_expr; }
+
+  inline ASToken_t GetOperator() { return m_op; }
+  inline void SetExpression(cASTNode* expr) { m_expr = expr; }
+  inline cASTNode* GetExpression() { return m_expr; }
+  
   void Accept(cASTVisitor& visitor);
 };
 
 
+
+// --------  Expression Value Nodes  --------
+
 class cASTFunctionCall : public cASTNode
 {
 private:
@@ -106,4 +311,52 @@
 };
 
 
+class cASTLiteral : public cASTNode
+{
+private:
+  ASType_t m_type;
+  cString m_value;
+  
+public:
+  cASTLiteral(ASType_t t, const cString& v) : m_type(t), m_value(v) { ; }
+  
+  inline ASType_t GetType() { return m_type; }
+  inline const cString& GetValue() { return m_value; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTLiteralArray : public cASTNode
+{
+private:
+  ASType_t m_type;
+  cASTNode* m_value;
+  
+public:
+  cASTLiteralArray(ASType_t t, cASTNode* v) : m_type(t), m_value(v) { ; }
+  ~cASTLiteralArray() { delete m_value; }
+  
+  
+  inline ASType_t GetType() { return m_type; }
+  inline cASTNode* GetValue() { return m_value; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
+class cASTVariableReference : public cASTNode
+{
+private:
+  cString m_name;
+  
+public:
+  cASTVariableReference(const cString& name) : m_name(name) { ; }
+  
+  inline const cString& GetName() { return m_name; }
+  
+  void Accept(cASTVisitor& visitor);
+};
+
+
 #endif

Modified: branches/collect/source/script/AvidaScript.h
===================================================================
--- branches/collect/source/script/AvidaScript.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/script/AvidaScript.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -26,90 +26,107 @@
 #define AvidaScript_h
 
 typedef enum eASTokens {
-  SUPPRESS = 1,
-  ENDL,
-  COMMA,
+  AS_TOKEN_SUPPRESS = 1,
+  AS_TOKEN_ENDL,
+  AS_TOKEN_COMMA,
   
-  OP_BIT_NOT,
-  OP_BIT_AND,
-  OP_BIT_OR,
+  AS_TOKEN_OP_BIT_NOT, // 4
+  AS_TOKEN_OP_BIT_AND,
+  AS_TOKEN_OP_BIT_OR,
   
-  OP_LOGIC_NOT,
-  OP_LOGIC_AND,
-  OP_LOGIC_OR,
+  AS_TOKEN_OP_LOGIC_NOT, // 7
+  AS_TOKEN_OP_LOGIC_AND,
+  AS_TOKEN_OP_LOGIC_OR,
   
-  OP_ADD,
-  OP_SUB,
-  OP_MUL,
-  OP_DIV,
-  OP_MOD,
+  AS_TOKEN_OP_ADD, // 10
+  AS_TOKEN_OP_SUB,
+  AS_TOKEN_OP_MUL,
+  AS_TOKEN_OP_DIV,
+  AS_TOKEN_OP_MOD,
   
-  DOT,
-  ASSIGN,
-  REF,
+  AS_TOKEN_DOT, // 15
+  AS_TOKEN_ASSIGN,
+  AS_TOKEN_REF,
   
-  OP_EQ,
-  OP_LE,
-  OP_GE,
-  OP_LT,
-  OP_GT,
-  OP_NEQ,
+  AS_TOKEN_OP_EQ, // 18
+  AS_TOKEN_OP_LE,
+  AS_TOKEN_OP_GE,
+  AS_TOKEN_OP_LT,
+  AS_TOKEN_OP_GT,
+  AS_TOKEN_OP_NEQ,
   
-  PREC_OPEN,
-  PREC_CLOSE,
+  AS_TOKEN_PREC_OPEN, // 24
+  AS_TOKEN_PREC_CLOSE,
   
-  IDX_OPEN,
-  IDX_CLOSE,
+  AS_TOKEN_IDX_OPEN, // 26
+  AS_TOKEN_IDX_CLOSE,
   
-  ARR_OPEN,
-  ARR_CLOSE,
-  ARR_RANGE,
-  ARR_EXPAN,
-  ARR_WILD,
+  AS_TOKEN_ARR_OPEN, // 28
+  AS_TOKEN_ARR_CLOSE,
+  AS_TOKEN_ARR_RANGE,
+  AS_TOKEN_ARR_EXPAN,
+  AS_TOKEN_ARR_WILD,
   
-  MAT_MODIFY,
+  AS_TOKEN_MAT_MODIFY, // 33
   
-  TYPE_ARRAY,
-  TYPE_CHAR,
-  TYPE_FLOAT,
-  TYPE_INT,
-  TYPE_MATRIX,
-  TYPE_STRING,
-  TYPE_VOID,
+  AS_TOKEN_TYPE_ARRAY, // 34
+  AS_TOKEN_TYPE_CHAR,
+  AS_TOKEN_TYPE_FLOAT,
+  AS_TOKEN_TYPE_INT,
+  AS_TOKEN_TYPE_MATRIX,
+  AS_TOKEN_TYPE_STRING,
+  AS_TOKEN_TYPE_VOID,
   
-  CMD_IF,
-  CMD_ELSE,
-  CMD_ENDIF,
+  AS_TOKEN_CMD_IF, // 41
+  AS_TOKEN_CMD_ELSE,
+  AS_TOKEN_CMD_ENDIF,
   
-  CMD_WHILE,
-  CMD_ENDWHILE,
+  AS_TOKEN_CMD_WHILE, // 44
+  AS_TOKEN_CMD_ENDWHILE,
   
-  CMD_FOREACH,
-  CMD_ENDFOREACH,
+  AS_TOKEN_CMD_FOREACH, // 46
+  AS_TOKEN_CMD_ENDFOREACH,
   
-  CMD_FUNCTION,
-  CMD_ENDFUNCTION,
+  AS_TOKEN_CMD_FUNCTION, // 48
+  AS_TOKEN_CMD_ENDFUNCTION,
   
-  CMD_RETURN,
+  AS_TOKEN_CMD_RETURN, // 50
   
-  ID,
+  AS_TOKEN_ID, // 51
   
-  FLOAT,
-  INT,
-  STRING,
-  CHAR,
+  AS_TOKEN_FLOAT, // 52
+  AS_TOKEN_INT,
+  AS_TOKEN_STRING,
+  AS_TOKEN_CHAR,
   
-  UNKNOWN,
-  INVALID
+  AS_TOKEN_UNKNOWN, // 56
+  AS_TOKEN_INVALID
 } ASToken_t;
 
+
 typedef enum eASParseErrors {
   AS_PARSE_ERR_UNEXPECTED_TOKEN,
   AS_PARSE_ERR_UNTERMINATED_EXPR,
   AS_PARSE_ERR_NULL_EXPR,
   AS_PARSE_ERR_EOF,
+  AS_PARSE_ERR_EMPTY,
   AS_PARSE_ERR_INTERNAL,
+  
   AS_PARSE_ERR_UNKNOWN
 } ASParseError_t;
 
+
+typedef enum eASTypes {
+  AS_TYPE_ARRAY = 0,
+  AS_TYPE_CHAR,
+  AS_TYPE_FLOAT,
+  AS_TYPE_INT,
+  AS_TYPE_MATRIX,
+  AS_TYPE_STRING,
+  AS_TYPE_VOID,
+  AS_TYPE_OBJECT_REF,
+  
+  AS_TYPE_INVALID
+} ASType_t;
+
 #endif

Copied: branches/collect/source/script/cASTDumpVisitor.cc (from rev 1806, development/source/script/cASTDumpVisitor.cc)
===================================================================
--- branches/collect/source/script/cASTDumpVisitor.cc	                        (rev 0)
+++ branches/collect/source/script/cASTDumpVisitor.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,296 @@
+/*
+ *  cASTDumpVisitor.cc
+ *  Avida
+ *
+ *  Created by David on 7/12/07.
+ *  Copyright 2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include "cASTDumpVisitor.h"
+
+#include <iostream>
+
+using namespace std;
+
+
+cASTDumpVisitor::cASTDumpVisitor() : m_depth(0)
+{
+  cout << "main:" << endl;
+  m_depth++;
+}
+
+inline void cASTDumpVisitor::indent()
+{
+  for (int i = 0; i < m_depth; i++) cout << "  ";
+}
+
+void cASTDumpVisitor::printToken(ASToken_t token)
+{
+  switch (token) {
+    case AS_TOKEN_OP_BIT_NOT:   cout << '~';  break;
+    case AS_TOKEN_OP_BIT_AND:   cout << '&';  break;
+    case AS_TOKEN_OP_BIT_OR:    cout << '|';  break;
+    case AS_TOKEN_OP_LOGIC_NOT: cout << '!';  break;
+    case AS_TOKEN_OP_LOGIC_AND: cout << "&&"; break;
+    case AS_TOKEN_OP_LOGIC_OR:  cout << "||"; break;
+    case AS_TOKEN_OP_ADD:       cout << '+';  break;
+    case AS_TOKEN_OP_SUB:       cout << '-';  break;
+    case AS_TOKEN_OP_MUL:       cout << '*';  break;
+    case AS_TOKEN_OP_DIV:       cout << '/';  break;
+    case AS_TOKEN_OP_MOD:       cout << '%';  break;
+    case AS_TOKEN_OP_EQ:        cout << "=="; break;
+    case AS_TOKEN_OP_LE:        cout << "<="; break;
+    case AS_TOKEN_OP_GE:        cout << ">="; break;
+    case AS_TOKEN_OP_LT:        cout << '<';  break;
+    case AS_TOKEN_OP_GT:        cout << '>';  break;
+    case AS_TOKEN_OP_NEQ:       cout << "!="; break;
+    case AS_TOKEN_ARR_RANGE:    cout << ':';  break;
+    case AS_TOKEN_ARR_EXPAN:    cout << '^';  break;
+    default:                    cout << '?';  break;
+  }
+}
+
+const char* cASTDumpVisitor::mapType(ASType_t type)
+{
+  switch (type) {
+    case AS_TYPE_ARRAY:       return "array";
+    case AS_TYPE_CHAR:        return "char";
+    case AS_TYPE_FLOAT:       return "float";
+    case AS_TYPE_INT:         return "int";
+    case AS_TYPE_MATRIX:      return "matrix";
+    case AS_TYPE_STRING:      return "string";
+    case AS_TYPE_VOID:        return "void";
+    case AS_TYPE_OBJECT_REF:  return "object";
+    
+    case AS_TYPE_INVALID:
+    default:
+      return "*INVALID*";
+  }
+}
+
+
+void cASTDumpVisitor::visitAssignment(cASTAssignment& node)
+{
+  m_depth++;
+  indent();
+  cout << node.GetVariable() << endl;
+  m_depth--;
+  
+  indent();
+  cout << "=" << endl;
+
+  m_depth++;
+  node.GetExpression()->Accept(*this);
+  m_depth--;
+}
+
+
+void cASTDumpVisitor::visitReturnStatement(cASTReturnStatement& node)
+{
+  indent();
+  cout << "return:" << endl;
+  
+  m_depth++;
+  node.GetExpression()->Accept(*this);
+  m_depth--;  
+}
+
+
+void cASTDumpVisitor::visitStatementList(cASTStatementList& node)
+{
+  tListIterator<cASTNode> it(node.Iterator());
+  
+  cASTNode* stmt = NULL;
+  while ((stmt = it.Next())) {
+    stmt->Accept(*this);
+  }
+}
+
+
+
+void cASTDumpVisitor::visitForeachBlock(cASTForeachBlock& node)
+{
+  indent();
+  cout << "foreach:" << endl;
+  
+  m_depth++;
+  node.GetVariable()->Accept(*this);
+  
+  indent();
+  cout << "values:" << endl;
+  m_depth++;
+  node.GetValues()->Accept(*this);
+  
+  m_depth--;
+  indent();
+  cout << "code:" << endl;
+
+  m_depth++;
+  node.GetCode()->Accept(*this);
+  m_depth--;
+  
+  m_depth--;
+}
+
+
+void cASTDumpVisitor::visitIfBlock(cASTIfBlock& node)
+{
+  indent();
+  cout << "if:" << endl;
+  
+  m_depth++;
+  indent();
+  cout << "condition:" << endl;
+  
+  m_depth++;
+  node.GetCondition()->Accept(*this);
+  m_depth--;
+  
+  indent();
+  cout << "do:" << endl;
+  
+  m_depth++;
+  node.GetCode()->Accept(*this);
+  m_depth--;
+  
+  if (node.HasElse()) {
+    indent();
+    cout << "else:" << endl;
+    
+    m_depth++;
+    node.GetElseCode()->Accept(*this);
+    m_depth--;
+  }
+  
+  m_depth--;
+  
+}
+
+
+void cASTDumpVisitor::visitWhileBlock(cASTWhileBlock& node)
+{
+  indent();
+  cout << "while:" << endl;
+  
+  m_depth++;
+  indent();
+  cout << "condition:" << endl;
+  
+  m_depth++;
+  node.GetCondition()->Accept(*this);
+  m_depth--;
+  
+  indent();
+  cout << "do:" << endl;
+  
+  m_depth++;
+  node.GetCode()->Accept(*this);
+  m_depth--;
+  
+  m_depth--;
+}
+
+
+
+void cASTDumpVisitor::visitFunctionDefinition(cASTFunctionDefinition& node)
+{
+  indent();
+  cout << (node.IsDefinition() ? "":"@") << "function: " << mapType(node.GetType()) << " " << node.GetName() << "(";
+  
+  cout << ")" << endl;
+  if (node.IsDefinition()) {
+    m_depth++;
+    node.GetCode()->Accept(*this);
+    m_depth--;
+  }
+}
+
+
+void cASTDumpVisitor::visitVariableDefinition(cASTVariableDefinition& node)
+{
+  indent();
+  cout << mapType(node.GetType()) << " " << node.GetVariable() << endl;
+  
+  if (node.GetAssignmentExpression()) {
+    m_depth++;
+    indent();
+    cout << "=" << endl;
+    
+    m_depth++;
+    node.GetAssignmentExpression()->Accept(*this);
+
+    m_depth -= 2;
+  }  
+}
+
+
+
+void cASTDumpVisitor::visitExpressionBinary(cASTExpressionBinary& node)
+{
+  m_depth++;
+  node.GetLeft()->Accept(*this);
+  m_depth--;
+  
+  indent();
+  printToken(node.GetOperator());
+  cout << endl;
+  
+  m_depth++;
+  node.GetRight()->Accept(*this);
+  m_depth--;  
+}
+
+
+void cASTDumpVisitor::visitExpressionUnary(cASTExpressionUnary& node)
+{
+  indent();
+  printToken(node.GetOperator());
+  cout << endl;
+  
+  m_depth++;
+  node.GetExpression()->Accept(*this);
+  m_depth--;
+}
+
+
+
+void cASTDumpVisitor::visitFunctionCall(cASTFunctionCall& node)
+{
+  
+}
+
+
+void cASTDumpVisitor::visitLiteral(cASTLiteral& node)
+{
+  indent();
+  cout << "(" << mapType(node.GetType()) << ") " << node.GetValue() << endl;
+}
+
+
+void cASTDumpVisitor::visitLiteralArray(cASTLiteralArray& node)
+{
+
+}
+
+
+void cASTDumpVisitor::visitVariableReference(cASTVariableReference& node)
+{
+  indent();
+  cout << node.GetName() << endl;
+}

Copied: branches/collect/source/script/cASTDumpVisitor.h (from rev 1806, development/source/script/cASTDumpVisitor.h)
===================================================================
--- branches/collect/source/script/cASTDumpVisitor.h	                        (rev 0)
+++ branches/collect/source/script/cASTDumpVisitor.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,67 @@
+/*
+ *  cASTDumpVisitor.h
+ *  Avida
+ *
+ *  Created by David on 7/12/07.
+ *  Copyright 2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef cASTDumpVisitor_h
+#define cASTDumpVisitor_h
+
+#ifndef cASTVisitor_h
+#include "cASTVisitor.h"
+#endif
+
+
+class cASTDumpVisitor : public cASTVisitor
+{
+private:
+  int m_depth;
+  
+public:
+  cASTDumpVisitor();
+  
+  void visitAssignment(cASTAssignment&);
+  
+  void visitReturnStatement(cASTReturnStatement&);
+  void visitStatementList(cASTStatementList&);
+  
+  void visitForeachBlock(cASTForeachBlock&);
+  void visitIfBlock(cASTIfBlock&);
+  void visitWhileBlock(cASTWhileBlock&);
+  
+  void visitFunctionDefinition(cASTFunctionDefinition&);
+  void visitVariableDefinition(cASTVariableDefinition&);
+  
+  void visitExpressionBinary(cASTExpressionBinary&);
+  void visitExpressionUnary(cASTExpressionUnary&);
+  
+  void visitFunctionCall(cASTFunctionCall&);
+  void visitLiteral(cASTLiteral&);
+  void visitLiteralArray(cASTLiteralArray&);
+  void visitVariableReference(cASTVariableReference&);
+
+private:
+  inline void indent();
+  void printToken(ASToken_t token);
+  const char* mapType(ASType_t type);
+};
+
+#endif

Copied: branches/collect/source/script/cASTVisitor.h (from rev 1806, development/source/script/cASTVisitor.h)
===================================================================
--- branches/collect/source/script/cASTVisitor.h	                        (rev 0)
+++ branches/collect/source/script/cASTVisitor.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,61 @@
+/*
+ *  cASTVisitor.h
+ *  Avida
+ *
+ *  Created by David on 7/11/07.
+ *  Copyright 2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef cASTVisitor_h
+#define cASTVisitor_h
+
+#ifndef ASTree_h
+#include "ASTree.h"
+#endif
+
+
+class cASTVisitor
+{
+public:
+  cASTVisitor() { ; }
+  virtual ~cASTVisitor() { ; }
+
+  
+  virtual void visitAssignment(cASTAssignment&) = 0;
+  
+  virtual void visitReturnStatement(cASTReturnStatement&) = 0;
+  virtual void visitStatementList(cASTStatementList&) = 0;
+  
+  virtual void visitForeachBlock(cASTForeachBlock&) = 0;
+  virtual void visitIfBlock(cASTIfBlock&) = 0;
+  virtual void visitWhileBlock(cASTWhileBlock&) = 0;
+  
+  virtual void visitFunctionDefinition(cASTFunctionDefinition&) = 0;
+  virtual void visitVariableDefinition(cASTVariableDefinition&) = 0;
+
+  virtual void visitExpressionBinary(cASTExpressionBinary&) = 0;
+  virtual void visitExpressionUnary(cASTExpressionUnary&) = 0;
+
+  virtual void visitFunctionCall(cASTFunctionCall&) = 0;
+  virtual void visitLiteral(cASTLiteral&) = 0;
+  virtual void visitLiteralArray(cASTLiteralArray&) = 0;
+  virtual void visitVariableReference(cASTVariableReference&) = 0;
+};
+
+#endif

Modified: branches/collect/source/script/cLexer.l
===================================================================
--- branches/collect/source/script/cLexer.l	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/script/cLexer.l	2007-07-19 21:44:58 UTC (rev 1831)
@@ -33,89 +33,90 @@
 
 %option c++
 %option noyywrap
+%option yylineno
 
 %%
 
 #.*\n       /* ignore comments */
-\/\/        /* ignore comments */
+\/\/.*\n    /* ignore comments */
 [ \t]+      /* ignore whitespace */
 
 
-;           return SUPPRESS;       // End-of-line
-\n          return ENDL;
-,           return COMMA;
+;           return AS_TOKEN_SUPPRESS;       // End-of-line
+\n          return AS_TOKEN_ENDL;
+,           return AS_TOKEN_COMMA;
 
-~           return OP_BIT_NOT;    // Bitwise Operators
-&           return OP_BIT_AND;
-\|          return OP_BIT_OR;
+~           return AS_TOKEN_OP_BIT_NOT;    // Bitwise Operators
+&           return AS_TOKEN_OP_BIT_AND;
+\|          return AS_TOKEN_OP_BIT_OR;
 
-!           return OP_LOGIC_NOT;  // Logic Operators
-&&          return OP_LOGIC_AND;
-\|\|        return OP_LOGIC_OR;
+!           return AS_TOKEN_OP_LOGIC_NOT;  // Logic Operators
+&&          return AS_TOKEN_OP_LOGIC_AND;
+\|\|        return AS_TOKEN_OP_LOGIC_OR;
 
-\+          return OP_ADD;        // Arithmetic Operators
--           return OP_SUB;
-\*          return OP_MUL;
-\/          return OP_DIV;
-%           return OP_MOD;
+\+          return AS_TOKEN_OP_ADD;        // Arithmetic Operators
+-           return AS_TOKEN_OP_SUB;
+\*          return AS_TOKEN_OP_MUL;
+\/          return AS_TOKEN_OP_DIV;
+%           return AS_TOKEN_OP_MOD;
 
-\.          return DOT;
-=           return ASSIGN;        // Assignment
-@           return REF;
+\.          return AS_TOKEN_DOT;
+=           return AS_TOKEN_ASSIGN;        // Assignment
+@           return AS_TOKEN_REF;
 
-==          return OP_EQ;         // Relational Operators
-\<=         return OP_LE;
-\>=         return OP_GE;
-\<          return OP_LT;
-\>          return OP_GT;
-!=          return OP_NEQ;
+==          return AS_TOKEN_OP_EQ;         // Relational Operators
+\<=         return AS_TOKEN_OP_LE;
+\>=         return AS_TOKEN_OP_GE;
+\<          return AS_TOKEN_OP_LT;
+\>          return AS_TOKEN_OP_GT;
+!=          return AS_TOKEN_OP_NEQ;
 
-\(          return PREC_OPEN;     // Precedence Grouping
-\)          return PREC_CLOSE;
+\(          return AS_TOKEN_PREC_OPEN;     // Precedence Grouping
+\)          return AS_TOKEN_PREC_CLOSE;
 
-\[          return IDX_OPEN;      // Index Grouping
-\]          return IDX_CLOSE;
+\[          return AS_TOKEN_IDX_OPEN;      // Index Grouping
+\]          return AS_TOKEN_IDX_CLOSE;
 
-\{          return ARR_OPEN;      // Array Definition Grouping
-\}          return ARR_CLOSE;
-:           return ARR_RANGE;
-\^          return ARR_EXPAN;
-\.\.        return ARR_WILD;
+\{          return AS_TOKEN_ARR_OPEN;      // Array Definition Grouping
+\}          return AS_TOKEN_ARR_CLOSE;
+:           return AS_TOKEN_ARR_RANGE;
+\^          return AS_TOKEN_ARR_EXPAN;
+\.\.        return AS_TOKEN_ARR_WILD;
 
-\?          return MAT_MODIFY;    // Matrix Modifier
+\?          return AS_TOKEN_MAT_MODIFY;    // Matrix Modifier
 
-array       return TYPE_ARRAY;    // Built-in Types
-char        return TYPE_CHAR;
-float       return TYPE_FLOAT;
-int         return TYPE_INT;
-matrix      return TYPE_MATRIX;
-string      return TYPE_STRING;
-void        return TYPE_VOID;
+array       return AS_TOKEN_TYPE_ARRAY;    // Built-in Types
+char        return AS_TOKEN_TYPE_CHAR;
+float       return AS_TOKEN_TYPE_FLOAT;
+int         return AS_TOKEN_TYPE_INT;
+matrix      return AS_TOKEN_TYPE_MATRIX;
+string      return AS_TOKEN_TYPE_STRING;
+void        return AS_TOKEN_TYPE_VOID;
 
-if          return CMD_IF;        // If Blocks
-else        return CMD_ELSE;
-endif       return CMD_ENDIF;
+if          return AS_TOKEN_CMD_IF;        // If Blocks
+else        return AS_TOKEN_CMD_ELSE;
+endif       return AS_TOKEN_CMD_ENDIF;
 
-while       return CMD_WHILE;     // While Blocks
-endwhile    return CMD_ENDWHILE;
+while       return AS_TOKEN_CMD_WHILE;     // While Blocks
+endwhile    return AS_TOKEN_CMD_ENDWHILE;
 
-foreach     return CMD_FOREACH;   // Foreach Blocks
-endforeach  return CMD_ENDFOREACH;
+foreach     return AS_TOKEN_CMD_FOREACH;   // Foreach Blocks
+endforeach  return AS_TOKEN_CMD_ENDFOREACH;
 
-function    return CMD_FUNCTION;  // Function Blocks
-endfunction return CMD_ENDFUNCTION;
+function    return AS_TOKEN_CMD_FUNCTION;  // Function Blocks
+endfunction return AS_TOKEN_CMD_ENDFUNCTION;
 
-return      return CMD_RETURN;
+return      return AS_TOKEN_CMD_RETURN;
 
-([a-zA-Z]|_+[a-zA-Z])[a-zA-Z0-9_]*  return ID;      // Identifiers
+([a-zA-Z]|_+[a-zA-Z])[a-zA-Z0-9_]*  return AS_TOKEN_ID;      // Identifiers
   
-[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?    return FLOAT;   // Literal Values
-[0-9]+                              return INT;
-\"\"                                return STRING;
-\"([^"\\\n]|\\\"|\\\\|\\.)*\"       return STRING;
-\'([^'\\\n]|\\\'|\\\\)\'            return CHAR;
+[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?    return AS_TOKEN_FLOAT;   // Literal Values
+[0-9]+                              return AS_TOKEN_INT;
+\"\"                                return AS_TOKEN_STRING;
+\"([^"\\\n]|\\\"|\\\\|\\.)*\"       return AS_TOKEN_STRING;
+\'([^'\\\n]|\\\'|\\\\)\'            return AS_TOKEN_CHAR;
 
-.           return UNKNOWN;           // Unrecognized Tokens
+.           return AS_TOKEN_UNKNOWN;           // Unrecognized Tokens
 
 
 

Modified: branches/collect/source/script/cParser.cc
===================================================================
--- branches/collect/source/script/cParser.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/script/cParser.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -26,6 +26,7 @@
 
 #include "AvidaScript.h"
 #include "cFile.h"
+#include "tAutoRelease.h"
 
 /*
  The following represents the grammar for AvidaScript in BNF, adjusted so that it is compatible with recursive descent
@@ -189,67 +190,105 @@
 
  */
 
+
+#define PARSE_DEBUG(x) { std::cerr << x << std::endl; }
+#define PARSE_TRACE(x) { std::cerr << "trace: " << x << std::endl; }
+
 #define PARSE_ERROR(x) reportError(AS_PARSE_ERR_ ## x, __LINE__)
 #define PARSE_UNEXPECT() { if (currentToken()) { PARSE_ERROR(UNEXPECTED_TOKEN); } else { PARSE_ERROR(EOF); } }
 
+#define TOKEN(x) AS_TOKEN_ ## x
 
+
 cParser::cParser(cASLibrary* library)
 : m_library(library)
+, m_filename("(unknown)")
 , m_eof(false)
 , m_success(true)
-, m_cur_tok(INVALID)
-, m_next_tok(INVALID)
+, m_cur_tok(TOKEN(INVALID))
+, m_next_tok(TOKEN(INVALID))
+, m_cur_text(NULL)
 , m_err_eof(false)
 {
 }
 
 bool cParser::Parse(cFile& input)
 {
+  m_filename = input.GetFilename();
   m_lexer = new cLexer(input.GetFileStream());
-  parseStatementList();
+  
+  m_tree = parseStatementList();
+
+  if (!m_eof) PARSE_UNEXPECT();
+  if (!m_tree) PARSE_ERROR(EMPTY);
+
   delete m_lexer;
+  m_lexer = NULL;
   
   return m_success;
 }
 
-void cParser::Accept(cASTVisitor& visitor)
+cParser::~cParser()
 {
-  
+  delete m_tree;
+  delete m_lexer;
 }
 
+
+
 ASToken_t cParser::nextToken()
 {
-  if (m_next_tok != INVALID) { 
+  if (m_next_tok != TOKEN(INVALID)) { 
     m_cur_tok = m_next_tok;
-    m_next_tok = INVALID;
+    m_next_tok = TOKEN(INVALID);
   } else {
     m_cur_tok = (ASToken_t)m_lexer->yylex();
   }
+  delete m_cur_text;
+  m_cur_text = NULL;
+  PARSE_DEBUG("nextToken: " << m_cur_tok);
   return m_cur_tok;
 }
 
+ASToken_t cParser::peekToken()
+{
+  if (m_next_tok == TOKEN(INVALID)) {
+    delete m_cur_text;
+    m_cur_text = new cString(m_lexer->YYText());
+    m_next_tok = (ASToken_t)m_lexer->yylex();
+  }
+  return m_next_tok;
+}
 
+const cString& cParser::currentText()
+{
+  if (!m_cur_text) m_cur_text = new cString(m_lexer->YYText());
+  return *m_cur_text;
+}
+
+
 cASTNode* cParser::parseArrayUnpack()
 {
+  PARSE_TRACE("parseArrayUnpack");
   cASTNode* au = NULL;
   
-  if (nextToken() != ID) {
+  if (nextToken() != TOKEN(ID)) {
     PARSE_ERROR(UNEXPECTED_TOKEN);
     return au;
   }
   
   while (nextToken()) {
-    if (currentToken() == COMMA) {
+    if (currentToken() == TOKEN(COMMA)) {
       nextToken();
-      if (currentToken() == ID) {
+      if (currentToken() == TOKEN(ID)) {
         continue;
-      } else if (currentToken() == ARR_WILD) {
+      } else if (currentToken() == TOKEN(ARR_WILD)) {
         break;
       } else {
         PARSE_ERROR(UNEXPECTED_TOKEN);
         break;
       }
-    } else if (currentToken() == ARR_WILD) {
+    } else if (currentToken() == TOKEN(ARR_WILD)) {
       break;
     } else {
       PARSE_UNEXPECT();
@@ -262,10 +301,11 @@
 
 cASTNode* cParser::parseArgumentList()
 {
+  PARSE_TRACE("parseArgumentList");
   cASTNode* al = NULL;
   
   parseExpression();
-  while (currentToken() == COMMA) {
+  while (currentToken() == TOKEN(COMMA)) {
     parseExpression();
   }
   
@@ -274,51 +314,57 @@
 
 cASTNode* cParser::parseAssignment()
 {
-  cASTNode* an = NULL;
+  PARSE_TRACE("parseAssignment");
+  cASTAssignment* an = new cASTAssignment(currentText());
   
+  nextToken(); // consume '='
+
   nextToken();
-  parseExpression();
-  
+  cASTNode* expr = parseExpression();
+  an->SetExpression(expr);
+
   return an;
 }
 
 cASTNode* cParser::parseCallExpression()
 {
+  PARSE_TRACE("parseCallExpression");
   cASTNode* ce = NULL;
   
+  nextToken();
+  
   bool eoe = false;
   while (!eoe) {
     switch (currentToken()) {
-      case DOT:
-        if (nextToken() != ID) {
+      case TOKEN(DOT):
+        if (nextToken() != TOKEN(ID)) {
           PARSE_UNEXPECT();
           return ce;
         }
         break;
-      case PREC_OPEN:
-        nextToken();
-        parseArgumentList();
-        if (nextToken() != PREC_CLOSE) {
+      case TOKEN(PREC_OPEN):
+        if (nextToken() != TOKEN(PREC_CLOSE)) parseArgumentList();
+        if (currentToken() != TOKEN(PREC_CLOSE)) {
           PARSE_UNEXPECT();
           return ce;   
         }
         switch (nextToken()) {
-          case IDX_OPEN:
+          case TOKEN(IDX_OPEN):
             do {
               parseIndexExpression();
-            } while (nextToken() == IDX_OPEN);
+            } while (nextToken() == TOKEN(IDX_OPEN));
             break;
-          case DOT:
+          case TOKEN(DOT):
             continue;
 
           default:
             eoe = true;
         }
         break;
-      case IDX_OPEN:
+      case TOKEN(IDX_OPEN):
         do {
           parseIndexExpression();
-        } while (nextToken() == IDX_OPEN);
+        } while (nextToken() == TOKEN(IDX_OPEN));
 
       default:
         PARSE_UNEXPECT();
@@ -331,13 +377,13 @@
 
 cASTNode* cParser::parseCodeBlock(bool& loose)
 {
+  PARSE_TRACE("parseCodeBlock");
   cASTNode* cb = NULL;
 
-  nextToken();
-  if (currentToken() == ARR_OPEN) {
+  if (currentToken() == TOKEN(ARR_OPEN)) {
     loose = true;
     cb = parseLooseBlock();
-  } else if (currentToken() == SUPPRESS || currentToken() == ENDL) {
+  } else if (currentToken() == TOKEN(SUPPRESS) || currentToken() == TOKEN(ENDL)) {
     cb = parseStatementList();
   } else {
     PARSE_UNEXPECT();
@@ -349,6 +395,7 @@
 
 cASTNode* cParser::parseExpression()
 {
+  PARSE_TRACE("parseExpression");
   cASTNode* expr = NULL;
   
   expr = parseExprP0();
@@ -364,16 +411,19 @@
 
 cASTNode* cParser::parseExprP0()
 {
+  PARSE_TRACE("parseExprP0");
   cASTNode* l = parseExprP1();
   cASTNode* r = NULL;
   
   while(true) {
     switch (currentToken()) {
-      case ARR_RANGE:
-      case ARR_EXPAN:
+      case TOKEN(ARR_RANGE):
+      case TOKEN(ARR_EXPAN):
+        ASToken_t op = currentToken();
         nextToken();
         r = parseExprP1();
-        // set l == new expr
+        if (!r) PARSE_ERROR(NULL_EXPR);
+        l = new cASTExpressionBinary(op, l, r);
         break;
         
       default:
@@ -386,16 +436,19 @@
 
 cASTNode* cParser::parseExprP1()
 {
+  PARSE_TRACE("parseExprP1");
   cASTNode* l = parseExprP2();
   cASTNode* r = NULL;
   
   while(true) {
     switch (currentToken()) {
-      case OP_LOGIC_AND:
-      case OP_LOGIC_OR:
+      case TOKEN(OP_LOGIC_AND):
+      case TOKEN(OP_LOGIC_OR):
+        ASToken_t op = currentToken();
         nextToken();
         r = parseExprP2();
-        // set l == new expr
+        if (!r) PARSE_ERROR(NULL_EXPR);
+        l = new cASTExpressionBinary(op, l, r);
         break;
         
       default:
@@ -408,16 +461,19 @@
 
 cASTNode* cParser::parseExprP2()
 {
+  PARSE_TRACE("parseExprP2");
   cASTNode* l = parseExprP3();
   cASTNode* r = NULL;
   
   while(true) {
     switch (currentToken()) {
-      case OP_BIT_AND:
-      case OP_BIT_OR:
+      case TOKEN(OP_BIT_AND):
+      case TOKEN(OP_BIT_OR):
+        ASToken_t op = currentToken();
         nextToken();
         r = parseExprP3();
-        // set l == new expr
+        if (!r) PARSE_ERROR(NULL_EXPR);
+        l = new cASTExpressionBinary(op, l, r);
         break;
         
       default:
@@ -430,20 +486,23 @@
 
 cASTNode* cParser::parseExprP3()
 {
+  PARSE_TRACE("parseExprP3");
   cASTNode* l = parseExprP4();
   cASTNode* r = NULL;
   
   while(true) {
     switch (currentToken()) {
-      case OP_EQ:
-      case OP_LE:
-      case OP_GE:
-      case OP_LT:
-      case OP_GT:
-      case OP_NEQ:
+      case TOKEN(OP_EQ):
+      case TOKEN(OP_LE):
+      case TOKEN(OP_GE):
+      case TOKEN(OP_LT):
+      case TOKEN(OP_GT):
+      case TOKEN(OP_NEQ):
+        ASToken_t op = currentToken();
         nextToken();
         r = parseExprP4();
-        // set l == new expr
+        if (!r) PARSE_ERROR(NULL_EXPR);
+        l = new cASTExpressionBinary(op, l, r);
         break;
         
       default:
@@ -456,16 +515,19 @@
 
 cASTNode* cParser::parseExprP4()
 {
+  PARSE_TRACE("parseExprP4");
   cASTNode* l = parseExprP5();
   cASTNode* r = NULL;
   
   while(true) {
     switch (currentToken()) {
-      case OP_ADD:
-      case OP_SUB:
+      case TOKEN(OP_ADD):
+      case TOKEN(OP_SUB):
+        ASToken_t op = currentToken();
         nextToken();
         r = parseExprP5();
-        // set l == new expr
+        if (!r) PARSE_ERROR(NULL_EXPR);
+        l = new cASTExpressionBinary(op, l, r);
         break;
         
       default:
@@ -478,17 +540,20 @@
 
 cASTNode* cParser::parseExprP5()
 {
+  PARSE_TRACE("parseExprP5");
   cASTNode* l = parseExprP6();
   cASTNode* r = NULL;
   
   while(true) {
     switch (currentToken()) {
-      case OP_MUL:
-      case OP_DIV:
-      case OP_MOD:
+      case TOKEN(OP_MUL):
+      case TOKEN(OP_DIV):
+      case TOKEN(OP_MOD):
+        ASToken_t op = currentToken();
         nextToken();
         r = parseExprP6();
-        // set l == new expr
+        if (!r) PARSE_ERROR(NULL_EXPR);
+        l = new cASTExpressionBinary(op, l, r);
         break;
         
       default:
@@ -501,55 +566,64 @@
 
 cASTNode* cParser::parseExprP6()
 {
+  PARSE_TRACE("parseExprP6");
   cASTNode* expr = NULL;
   
   switch (currentToken()) {
-    case FLOAT:
-    case INT:
-    case CHAR:
-    case STRING:
-      expr = new cASTLiteral(currentToken());
+    case TOKEN(FLOAT):
+      expr = new cASTLiteral(AS_TYPE_FLOAT, currentText());
       break;
-    case ID:
-      if (peekToken() == PREC_OPEN) {
+    case TOKEN(INT):
+      expr = new cASTLiteral(AS_TYPE_INT, currentText());
+      break;
+    case TOKEN(CHAR):
+      expr = new cASTLiteral(AS_TYPE_CHAR, currentText());
+      break;
+    case TOKEN(STRING):
+      expr = new cASTLiteral(AS_TYPE_STRING, currentText());
+      break;
+    case TOKEN(ID):
+      if (peekToken() == TOKEN(PREC_OPEN)) {
         nextToken();
-        nextToken();
-        parseArgumentList();
-        if (currentToken() != PREC_CLOSE) {
+        if (nextToken() != TOKEN(PREC_CLOSE)) parseArgumentList();
+        if (currentToken() != TOKEN(PREC_CLOSE)) {
           PARSE_UNEXPECT();
           return expr;
         }
-        // @todo - expr = ;
+        expr = new cASTFunctionCall(); // @todo
       } else {
-        // @todo - expr = ;
+        expr = new cASTVariableReference(currentText());
       }
       break;
-    case PREC_OPEN:
+    case TOKEN(PREC_OPEN):
       nextToken();
       expr = parseExpression();
-      if (currentToken() != PREC_CLOSE) {
+      if (!expr) PARSE_ERROR(NULL_EXPR);
+      if (currentToken() != TOKEN(PREC_CLOSE)) {
         PARSE_UNEXPECT();
         return expr;
       }
       break;
-    case MAT_MODIFY:
-      if (nextToken() != ARR_OPEN) {
+    case TOKEN(MAT_MODIFY):
+      if (nextToken() != TOKEN(ARR_OPEN)) {
         PARSE_UNEXPECT();
         return expr;
       }
-    case ARR_OPEN:
-      nextToken();
-      parseArgumentList();
-      if (currentToken() != ARR_CLOSE) {
+    case TOKEN(ARR_OPEN):
+      if (nextToken() != TOKEN(ARR_CLOSE)) parseArgumentList();
+      if (currentToken() != TOKEN(ARR_CLOSE)) {
         PARSE_UNEXPECT();
         return expr;
       }
+      // @todo - return literal array
       break;
       
-    case OP_BIT_NOT:
-    case OP_LOGIC_NOT:
-    case OP_SUB:
-      expr = parseExpression();
+    case TOKEN(OP_BIT_NOT):
+    case TOKEN(OP_LOGIC_NOT):
+    case TOKEN(OP_SUB):
+      ASToken_t op = currentToken();
+      expr = new cASTExpressionUnary(op, parseExpression());
+      if (!expr) PARSE_ERROR(NULL_EXPR);
       nextToken();
       return expr;
       
@@ -557,23 +631,24 @@
       break;
   }
 
+  nextToken();
   if (expr) expr = parseExprP6_Index(expr);
   return expr;
 }
 
 cASTNode* cParser::parseExprP6_Index(cASTNode* l)
 {
-  while (currentToken() == DOT || currentToken() == IDX_OPEN) {
-    if (currentToken() == DOT) {
-      if (nextToken() != ID) {
+  PARSE_TRACE("parseExprP6_Index");
+  while (currentToken() == TOKEN(DOT) || currentToken() == TOKEN(IDX_OPEN)) {
+    if (currentToken() == TOKEN(DOT)) {
+      if (nextToken() != TOKEN(ID)) {
         PARSE_UNEXPECT();
         return l;
       }
-      if (peekToken() == PREC_OPEN) {
+      if (peekToken() == TOKEN(PREC_OPEN)) {
         nextToken();
-        nextToken();
-        parseArgumentList();
-        if (currentToken() != PREC_CLOSE) {
+        if (nextToken() != TOKEN(PREC_CLOSE)) parseArgumentList();
+        if (currentToken() != TOKEN(PREC_CLOSE)) {
           PARSE_UNEXPECT();
           return l;
         }
@@ -584,7 +659,7 @@
     } else { // IDX_OPEN:
       nextToken();
       parseExpression();
-      if (currentToken() != IDX_CLOSE) {
+      if (currentToken() != TOKEN(IDX_CLOSE)) {
         PARSE_UNEXPECT();
         return l;
       }
@@ -598,128 +673,149 @@
 
 cASTNode* cParser::parseForeachStatement()
 {
-  cASTNode* fs = NULL;
+  PARSE_TRACE("parseForeachStatement");
   
+  ASType_t type = AS_TYPE_INVALID;
   switch (nextToken()) {
-    case TYPE_ARRAY:
-    case TYPE_CHAR:
-    case TYPE_FLOAT:
-    case TYPE_INT:
-    case TYPE_MATRIX:
-    case TYPE_STRING:
-      break;
-    case ID:
-      if (nextToken() != REF) {
+    case TOKEN(TYPE_ARRAY):  type = AS_TYPE_ARRAY;  break;
+    case TOKEN(TYPE_CHAR):   type = AS_TYPE_CHAR;   break;
+    case TOKEN(TYPE_FLOAT):  type = AS_TYPE_FLOAT;  break;
+    case TOKEN(TYPE_INT):    type = AS_TYPE_INT;    break;
+    case TOKEN(TYPE_MATRIX): type = AS_TYPE_MATRIX; break;
+    case TOKEN(TYPE_STRING): type = AS_TYPE_STRING; break;
+    case TOKEN(TYPE_VOID):   type = AS_TYPE_VOID;   break;
+    case TOKEN(ID):
+      if (peekToken() != TOKEN(REF)) {
+        nextToken();
         PARSE_UNEXPECT();
-        return fs;
+        return NULL;
       }
+      type = AS_TYPE_OBJECT_REF;
       break;
       
     default:
       PARSE_UNEXPECT();
-      return fs;
+      return NULL;
   }
   
-  if (nextToken() != PREC_OPEN) {
+  if (nextToken() != TOKEN(ID)) {
     PARSE_UNEXPECT();
-    return fs;
+    return NULL;
   }
   
-  nextToken();
-  parseExpression();
+  tAutoRelease<cASTVariableDefinition> var(new cASTVariableDefinition(type, currentText()));
   
-  if (currentToken() != PREC_CLOSE) {
+  if (nextToken() != TOKEN(PREC_OPEN)) {
     PARSE_UNEXPECT();
-    return fs;
+    return NULL;
+  }  
+  nextToken(); // consume '('
+  
+  tAutoRelease<cASTNode> expr(parseExpression());
+  
+  if (currentToken() != TOKEN(PREC_CLOSE)) {
+    PARSE_UNEXPECT();
+    return NULL;
   }
+  nextToken(); // consume ')'
   
   bool loose = false;
-  parseCodeBlock(loose);
-  if (!loose && currentToken() != CMD_ENDFOREACH) PARSE_UNEXPECT();
+  tAutoRelease<cASTNode> code(parseCodeBlock(loose));
+  if (!loose && currentToken() != TOKEN(CMD_ENDFOREACH)) PARSE_UNEXPECT();
+  if (!loose) nextToken(); // consume 'endforeach'
   
-  return fs;
+  return new cASTForeachBlock(var.Release(), expr.Release(), code.Release());
 }
 
 cASTNode* cParser::parseFunctionDefine()
 {
-  cASTNode* fd = parseFunctionHeader(false);
+  PARSE_TRACE("parseFunctionDefine");
+  cASTFunctionDefinition* fd = parseFunctionHeader(false);
   
   bool loose = false;
-  parseCodeBlock(loose);
-  if (!loose && currentToken() != CMD_ENDFUNCTION) {
+  fd->SetCode(parseCodeBlock(loose));
+  if (!loose && currentToken() != TOKEN(CMD_ENDFUNCTION)) {
     PARSE_UNEXPECT();
     return fd;
   }
-  
+  if (!loose) nextToken();
+
   return fd;
 }
 
-cASTNode* cParser::parseFunctionHeader(bool declare)
+cASTFunctionDefinition* cParser::parseFunctionHeader(bool declare)
 {
-  cASTNode* fd = NULL;
+  PARSE_TRACE("parseFunctionHeader");
   
+  ASType_t type = AS_TYPE_INVALID;
   switch (nextToken()) {
-    case TYPE_ARRAY:
-    case TYPE_CHAR:
-    case TYPE_FLOAT:
-    case TYPE_INT:
-    case TYPE_MATRIX:
-    case TYPE_STRING:
-    case TYPE_VOID:
-      break;
-    case ID:
-      if (peekToken() != REF) {
+    case TOKEN(TYPE_ARRAY):  type = AS_TYPE_ARRAY;  break;
+    case TOKEN(TYPE_CHAR):   type = AS_TYPE_CHAR;   break;
+    case TOKEN(TYPE_FLOAT):  type = AS_TYPE_FLOAT;  break;
+    case TOKEN(TYPE_INT):    type = AS_TYPE_INT;    break;
+    case TOKEN(TYPE_MATRIX): type = AS_TYPE_MATRIX; break;
+    case TOKEN(TYPE_STRING): type = AS_TYPE_STRING; break;
+    case TOKEN(TYPE_VOID):   type = AS_TYPE_VOID;   break;
+    case TOKEN(ID):
+      if (peekToken() != TOKEN(REF)) {
         nextToken();
         PARSE_UNEXPECT();
-        return fd;
+        return NULL;
       }
+      type = AS_TYPE_OBJECT_REF;
       break;
       
     default:
       PARSE_UNEXPECT();
-      return fd;
+      return NULL;
   }
   
-  if (nextToken() != ID) {
+  if (nextToken() != TOKEN(ID)) {
     PARSE_UNEXPECT();
-    return fd;
+    return NULL;
   }
+  cString name(currentText());
   
-  if (nextToken() != PREC_OPEN) {
+  if (nextToken() != TOKEN(PREC_OPEN)) {
     PARSE_UNEXPECT();
-    return fd;
+    return NULL;
   }
   
-  nextToken();
-  if (declare) {
-    parseVarDeclareList();
-  } else {
-    parseArgumentList();
+  tAutoRelease<cASTNode> args;
+  if (nextToken() != TOKEN(PREC_CLOSE)) {
+    if (declare) {
+      args = parseVarDeclareList();
+    } else {
+      args = parseArgumentList();
+    }
   }
   
-  if (nextToken() != PREC_CLOSE) {
+  if (currentToken() != TOKEN(PREC_CLOSE)) {
     PARSE_UNEXPECT();
-    return fd;    
+    return NULL;    
   }
   
-  return fd;
+  nextToken();
+  
+  return new cASTFunctionDefinition(type, name, args.Release());
 }
 
 cASTNode* cParser::parseIDStatement()
 {
+  PARSE_TRACE("parseIDStatement");
   cASTNode* is = NULL;
   
-  switch (nextToken()) {
-    case ASSIGN:
-      parseAssignment();
+  switch (peekToken()) {
+    case TOKEN(ASSIGN):
+      is = parseAssignment();
       break;
-    case DOT:
-    case IDX_OPEN:
-    case PREC_OPEN:
-      parseCallExpression();
+    case TOKEN(DOT):
+    case TOKEN(IDX_OPEN):
+    case TOKEN(PREC_OPEN):
+      is = parseCallExpression();
       break;
-    case REF:
-      parseVarDeclare();
+    case TOKEN(REF):
+      is = parseVarDeclare();
       break;
       
     default:
@@ -732,32 +828,40 @@
 
 cASTNode* cParser::parseIfStatement()
 {
-  cASTNode* is = NULL;
+  PARSE_TRACE("parseIfStatement");
   
-  if (nextToken() != PREC_OPEN) {
+  if (nextToken() != TOKEN(PREC_OPEN)) {
     PARSE_UNEXPECT();
-    return is;
+    return NULL;
   }
   
   nextToken();
-  parseExpression();
+  tAutoRelease<cASTNode> cond(parseExpression());
   
-  if (currentToken() != PREC_CLOSE) {
+  if (currentToken() != TOKEN(PREC_CLOSE)) {
     PARSE_UNEXPECT();
-    return is;
+    return NULL;
   }
+  nextToken();
   
   bool loose = false;
-  parseCodeBlock(loose);
-  if (currentToken() == CMD_ELSE) {
-    parseCodeBlock(loose);
-    if (!loose && currentToken() != CMD_ENDIF) {
+  cASTIfBlock* is = new cASTIfBlock(cond.Release(), parseCodeBlock(loose));
+
+  if (currentToken() == TOKEN(CMD_ELSE)) {
+    nextToken(); // consume 'else'
+    loose = false;
+    tAutoRelease<cASTNode> code(parseCodeBlock(loose));
+    if (!loose && currentToken() != TOKEN(CMD_ENDIF)) {
       PARSE_UNEXPECT();
       return is;
     }
-  } else if (!loose && currentToken() != CMD_ENDIF) {
+    if (!loose) nextToken();
+    is->SetElseCode(code.Release());
+  } else if (!loose && currentToken() != TOKEN(CMD_ENDIF)) {
     PARSE_UNEXPECT();
     return is;
+  } else if (!loose) {
+    nextToken(); // consume 'endif'
   }
   
   return is;
@@ -765,11 +869,12 @@
 
 cASTNode* cParser::parseIndexExpression()
 {
+  PARSE_TRACE("parseIndexExpression");
   cASTNode* ie = NULL;
   
   nextToken();
   parseExpression();
-  if (currentToken() != IDX_CLOSE) {
+  if (currentToken() != TOKEN(IDX_CLOSE)) {
     PARSE_UNEXPECT();
   }
   
@@ -778,24 +883,27 @@
 
 cASTNode* cParser::parseLooseBlock()
 {
+  PARSE_TRACE("parseLooseBlock");
   nextToken();
   cASTNode* sl = parseStatementList();
-  if (currentToken() != ARR_CLOSE) {
+  if (currentToken() != TOKEN(ARR_CLOSE)) {
     PARSE_UNEXPECT();
   }
+  nextToken();
   return sl;
 }
 
 cASTNode* cParser::parseRefStatement()
 {
+  PARSE_TRACE("parseRefStatement");
   cASTNode* rs = NULL;
 
   switch (nextToken()) {
-    case ARR_OPEN:
-      parseArrayUnpack();
+    case TOKEN(ARR_OPEN):
+      rs = parseArrayUnpack();
       break;
-    case CMD_FUNCTION:
-      parseFunctionHeader();
+    case TOKEN(CMD_FUNCTION):
+      rs = parseFunctionHeader();
       break;
     default:
       PARSE_UNEXPECT();
@@ -806,94 +914,108 @@
 
 cASTNode* cParser::parseReturnStatement()
 {
-  cASTNode* rs = NULL;
+  PARSE_TRACE("parseReturnStatement");
   
   nextToken();
-  parseExpression();
+  cASTNode* rs = new cASTReturnStatement(parseExpression());
   
   return rs;
 }
 
+
+#define CHECK_LINETERM() { if (!checkLineTerm(sl)) return sl; }
 cASTNode* cParser::parseStatementList()
 {
-  cASTNode* sl = NULL;
+  PARSE_TRACE("parseStatementList");
+  cASTStatementList* sl = new cASTStatementList();
+  
+  cASTNode* node = NULL;
 
-#define CHECK_LINETERM() { if (!checkLineTerm(sl)) return sl; }
   while (nextToken()) {
     switch (currentToken()) {
-      case ARR_OPEN:
-        parseLooseBlock();
+      case TOKEN(ARR_OPEN):
+        node = parseLooseBlock();
         CHECK_LINETERM();
         break;
-      case CMD_IF:
-        parseIfStatement();
+      case TOKEN(CMD_IF):
+        node = parseIfStatement();
         CHECK_LINETERM();
         break;
-      case CMD_FOREACH:
-        parseForeachStatement();
+      case TOKEN(CMD_FOREACH):
+        node = parseForeachStatement();
         CHECK_LINETERM();
         break;
-      case CMD_FUNCTION:
-        parseFunctionDefine();
+      case TOKEN(CMD_FUNCTION):
+        node = parseFunctionDefine();
         CHECK_LINETERM();
         break;
-      case CMD_RETURN:
-        parseReturnStatement();
+      case TOKEN(CMD_RETURN):
+        node = parseReturnStatement();
         CHECK_LINETERM();
         break;
-      case CMD_WHILE:
-        parseWhileStatement();
+      case TOKEN(CMD_WHILE):
+        node = parseWhileStatement();
         CHECK_LINETERM();
         break;
-      case ENDL:
-        break;
-      case ID:
-        parseIDStatement();
+      case TOKEN(ENDL):
+        continue;
+      case TOKEN(ID):
+        node = parseIDStatement();
         CHECK_LINETERM();
         break;
-      case REF:
-        parseRefStatement();
+      case TOKEN(REF):
+        node = parseRefStatement();
         CHECK_LINETERM();
         break;
-      case SUPPRESS:
-        break;
-      case TYPE_ARRAY:
-      case TYPE_CHAR:
-      case TYPE_FLOAT:
-      case TYPE_INT:
-      case TYPE_MATRIX:
-      case TYPE_STRING:
-        parseVarDeclare();
+      case TOKEN(SUPPRESS):
+        continue;
+      case TOKEN(TYPE_ARRAY):
+      case TOKEN(TYPE_CHAR):
+      case TOKEN(TYPE_FLOAT):
+      case TOKEN(TYPE_INT):
+      case TOKEN(TYPE_MATRIX):
+      case TOKEN(TYPE_STRING):
+        node = parseVarDeclare();
         CHECK_LINETERM();
         break;
         
       default:
         return sl;
     }
+    
+    if (node == NULL) {
+      // Some error has occured, so terminate early
+      if (m_success) PARSE_ERROR(INTERNAL); // Should not receive a null response without an error flag
+      break;
+    }
+    sl->AddNode(node);
   }
-#undef CHECK_LINETERM()
   
   if (!currentToken()) m_eof = true;
   return sl;
 }
+#undef CHECK_LINETERM()
 
+
 cASTNode* cParser::parseVarDeclare()
 {
-  cASTNode* vd = NULL;
+  PARSE_TRACE("parseVarDeclare");
+  cASTVariableDefinition* vd = NULL;
   
+  ASType_t vtype = AS_TYPE_INVALID;
   switch (currentToken()) {
-    case TYPE_ARRAY:
-    case TYPE_CHAR:
-    case TYPE_FLOAT:
-    case TYPE_INT:
-    case TYPE_MATRIX:
-    case TYPE_STRING:
-      break;
-    case ID:
-      if (nextToken() != REF) {
+    case TOKEN(TYPE_ARRAY):  vtype = AS_TYPE_ARRAY;  break;
+    case TOKEN(TYPE_CHAR):   vtype = AS_TYPE_CHAR;   break;
+    case TOKEN(TYPE_FLOAT):  vtype = AS_TYPE_FLOAT;  break;
+    case TOKEN(TYPE_INT):    vtype = AS_TYPE_INT;    break;
+    case TOKEN(TYPE_MATRIX): vtype = AS_TYPE_MATRIX; break;
+    case TOKEN(TYPE_STRING): vtype = AS_TYPE_STRING; break;
+    case TOKEN(ID):
+      if (nextToken() != TOKEN(REF)) {
         PARSE_UNEXPECT();
         return vd;
       }
+      vtype = AS_TYPE_OBJECT_REF;
       break;
       
     default:
@@ -901,20 +1023,23 @@
       return vd;
   }
   
-  if (nextToken() != ID) {
+  if (nextToken() != TOKEN(ID)) {
     PARSE_UNEXPECT();
     return vd;
   }
   
+  vd = new cASTVariableDefinition(vtype, currentText());
+  
   switch (nextToken()) {
-    case ASSIGN:
+    case TOKEN(ASSIGN):
       nextToken();
-      parseExpression();
+      cASTNode* expr = parseExpression();
+      vd->SetAssignmentExpression(expr);
       break;
-    case PREC_OPEN:
-      nextToken();
-      parseArgumentList();
-      if (currentToken() != PREC_CLOSE) {
+    case TOKEN(PREC_OPEN):
+      // @todo - array/matrix size declaration
+      if (nextToken() != TOKEN(PREC_CLOSE)) parseArgumentList();
+      if (currentToken() != TOKEN(PREC_CLOSE)) {
         PARSE_UNEXPECT();
         return vd;
       }
@@ -929,10 +1054,11 @@
 
 cASTNode* cParser::parseVarDeclareList()
 {
+  PARSE_TRACE("parseVarDeclareList");
   cASTNode* vl = NULL;
   
   parseVarDeclare();
-  while (currentToken() == COMMA) {
+  while (currentToken() == TOKEN(COMMA)) {
     parseVarDeclare();
   }
   
@@ -941,39 +1067,41 @@
 
 cASTNode* cParser::parseWhileStatement()
 {
-  cASTNode* ws = NULL;
+  PARSE_TRACE("parseWhileStatement");
   
-  if (nextToken() != PREC_OPEN) {
+  if (nextToken() != TOKEN(PREC_OPEN)) {
     PARSE_UNEXPECT();
-    return ws;
+    return NULL;
   }
   
   nextToken();
-  parseExpression();
+  tAutoRelease<cASTNode> cond(parseExpression());
   
-  if (currentToken() != PREC_CLOSE) {
+  if (currentToken() != TOKEN(PREC_CLOSE)) {
     PARSE_UNEXPECT();
-    return ws;
+    return NULL;
   }
+  nextToken();
   
   bool loose = false;
-  parseCodeBlock(loose);
-  if (!loose && currentToken() != CMD_ENDWHILE) {
+  tAutoRelease<cASTNode> code(parseCodeBlock(loose));
+  if (!loose && currentToken() != TOKEN(CMD_ENDWHILE)) {
     PARSE_UNEXPECT();
-    return ws;
+    return NULL;
   }
+  if (!loose) nextToken();
   
-  return ws;
+  return new cASTWhileBlock(cond.Release(), code.Release());
 }
 
 
 bool cParser::checkLineTerm(cASTNode* node)
 {
-  nextToken();
-  if (currentToken() == SUPPRESS) {
+  PARSE_TRACE("checkLineTerm");
+  if (currentToken() == TOKEN(SUPPRESS)) {
     // @todo - mark output as suppressed
     return true;
-  } else if (currentToken() == ENDL) {
+  } else if (currentToken() == TOKEN(ENDL)) {
     return true;
   }
   
@@ -984,29 +1112,51 @@
 
 void cParser::reportError(ASParseError_t err, const int line)
 {
+#define ERR_ENDL "  (cParser.cc:" << line << ")" << std::endl
+  
   m_success = false;
 
-  std::cerr << "error: ";
+  std::cerr << m_filename << ":";
+  
+  int lineno = m_lexer ? m_lexer->lineno() : 0;
+  if (lineno) std::cerr << lineno;
+  else std::cerr << "?";
+  
+  std::cerr << ": error: ";
 
   switch (err) {
     case AS_PARSE_ERR_UNEXPECTED_TOKEN:
-      std::cerr << "unexpected token '" << currentToken() << "'." << std::endl;
+      std::cerr << "unexpected token '" << currentText() << "'" << ERR_ENDL;
       break;
     case AS_PARSE_ERR_UNTERMINATED_EXPR:
-      std::cerr << "unterminated expression'" << currentToken() << "'." << std::endl;
+      std::cerr << "unterminated expression" << ERR_ENDL;
       break;
     case AS_PARSE_ERR_NULL_EXPR:
-      std::cerr << "expected expression, found '" << currentToken() << "'." << std::endl;
+      std::cerr << "expected expression, found '" << currentText() << "'" << ERR_ENDL;
+      break;
     case AS_PARSE_ERR_EOF:
       if (!m_err_eof) {
-        std::cerr << "unexpected end of file" << std::endl;
+        std::cerr << "unexpected end of file" << ERR_ENDL;
         m_err_eof = true;
       }
       break;
+    case AS_PARSE_ERR_EMPTY:
+      std::cerr << "empty script, no valid statements found" << ERR_ENDL;
+      break;
     case AS_PARSE_ERR_INTERNAL:
       std::cerr << "internal parser error at cParser.cc:" << line << std::endl;
     case AS_PARSE_ERR_UNKNOWN:
     default:
       std::cerr << "parse error" << std::endl;
   }
+
+#undef ERR_ENDL
 }
+
+#undef PARSE_DEBUG()
+#undef PARSE_TRACE()
+
+#undef PARSE_ERROR()
+#undef PARSE_UNEXPECT()
+
+#undef TOKEN()

Modified: branches/collect/source/script/cParser.h
===================================================================
--- branches/collect/source/script/cParser.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/script/cParser.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -53,6 +53,9 @@
 {
 private:
   cASLibrary* m_library;
+  
+  cString m_filename;
+  
   cLexer* m_lexer;
   cASTNode* m_tree;
 
@@ -61,6 +64,7 @@
   
   ASToken_t m_cur_tok;
   ASToken_t m_next_tok;
+  cString* m_cur_text;
   
   bool m_err_eof;
   
@@ -72,16 +76,19 @@
   
 public:
   cParser(cASLibrary* library);
+  ~cParser();
   
   bool Parse(cFile& input);
-  void Accept(cASTVisitor& visitor);
+  inline void Accept(cASTVisitor& visitor) { if (m_tree) m_tree->Accept(visitor); }
   
   
 private:
   inline ASToken_t currentToken() { return m_cur_tok; }
   ASToken_t nextToken();
-  inline ASToken_t peekToken();
+  ASToken_t peekToken();
   
+  const cString& currentText();
+  
   cASTNode* parseArgumentList();
   cASTNode* parseArrayUnpack();
   cASTNode* parseAssignment();
@@ -98,7 +105,7 @@
   cASTNode* parseExprP6_Index(cASTNode* l);
   cASTNode* parseForeachStatement();
   cASTNode* parseFunctionDefine();
-  cASTNode* parseFunctionHeader(bool declare = true);
+  cASTFunctionDefinition* parseFunctionHeader(bool declare = true);
   cASTNode* parseIDStatement();
   cASTNode* parseIfStatement();
   cASTNode* parseIndexExpression();
@@ -116,11 +123,4 @@
 };
 
 
-inline ASToken_t cParser::peekToken()
-{
-  if (m_next_tok == INVALID) m_next_tok = (ASToken_t)m_lexer->yylex();
-  return m_next_tok;
-}
-
-
 #endif

Deleted: branches/collect/source/targets/SConscript
===================================================================
--- branches/collect/source/targets/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,14 +0,0 @@
-Import('environment')
-
-misc = ['SConscript']
-environment.AppendUnique(
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-if environment['enablePrimitive'] in ('True', '1', 1):
-  environment.SConscript('avida/SConscript')
-if environment['enableGuiNcurses'] in ('True', '1', 1):
-  environment.SConscript('avida-viewer/SConscript')
-
-
-# vim: set ft=python:

Deleted: branches/collect/source/targets/avida/SConscript
===================================================================
--- branches/collect/source/targets/avida/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/avida/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,45 +0,0 @@
-import os
-import os.path
-import sys
-
-Import('environment')
-
-misc = ['SConscript']
-
-srcs = ['primitive.cc']
-
-libs = [
-    'main',
-    'classification',
-    'cpu',
-    'analyze',
-    'drivers',
-    'cpu',
-    'actions',
-    'tools',
-    'analyze',
-    #'archive',
-    #'boost_serialization',
-    'main',
-    'platform',
-  ]
-if environment['PLATFORM'] not in ('win32'):
-  libs = libs + ['pthread']
-if environment['enableTCMalloc'] in ('True', '1', 1):
-  libs = libs + ['tcmalloc']
-
-avida_exe = environment.Program('avida',
-  srcs,
-  LIBS = libs,
-)
-environment.Install('$execPrefix', avida_exe)
-# Make avida_exe visible to other SConscript files by the command
-# "Import('avida_exe')"
-environment.Export('avida_exe')
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-
-# vim: set ft=python:

Modified: branches/collect/source/targets/avida-s/main.cc
===================================================================
--- branches/collect/source/targets/avida-s/main.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/avida-s/main.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -24,11 +24,14 @@
 
 #include "avida.h"
 #include "cASLibrary.h"
+#include "cASTDumpVisitor.h"
 #include "cFile.h"
 #include "cParser.h"
 #include "PlatformExpert.h"
 
+#include <iostream>
 
+
 int main (int argc, char * const argv[])
 {
   PlatformExpert::Initialize();
@@ -37,9 +40,22 @@
   cParser* parser = new cParser(lib);
   
   cFile file;
-  if (file.Open("main.asl")) parser->Parse(file);
+  if (file.Open("main.asl")) {
+    if (parser->Parse(file)) {
+      std::cout << "Parse Successful\n" << std::endl;
+
+      cASTDumpVisitor visitor;
+      parser->Accept(visitor);
+      
+      std::cout << std::endl;
+      ExitAvida(0);
+    } else {
+      std::cout << "Parse Failed" << std::endl;
+      ExitAvida(1);
+    }
+  } else {
+    std::cerr << "error: unable to open script" << std::endl;
+  }
   
-  ExitAvida(0);
-  
-  return 0;
+  return -1;
 }

Deleted: branches/collect/source/targets/avida-viewer/SConscript
===================================================================
--- branches/collect/source/targets/avida-viewer/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/avida-viewer/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,55 +0,0 @@
-
-Import('environment')
-
-environment.Library('cursesviewer',
-  [
-    'cAnalyzeScreen.cc',
-    'cAnalyzeView.cc',
-    'cBarScreen.cc',
-    'cEnvironmentScreen.cc',
-    'cHistScreen.cc',
-    'cMapScreen.cc',
-    'cMenuWindow.cc',
-    'cOptionsScreen.cc',
-    'cScreen.cc',
-    'cStatsScreen.cc',
-    'cSymbolUtil.cc',
-    'cTextViewerAnalyzeDriver.cc',
-    'cTextViewerDriver.cc',
-    'cTextViewerDriver_Base.cc',
-    'cTextWindow.cc',
-    'cView.cc',
-    'cViewInfo.cc',
-    'cZoomScreen.cc',
-  ],
-) 
-
-avida_viewer_LIBS = [
-    'cursesviewer',
-    'main',
-    'classification',
-    'cpu',
-    'analyze',
-    'drivers',
-    'cpu',
-    'tools',
-    'actions',
-    'analyze',
-    'ncurses',
-    'pthread',
-    #'archive',
-    #'boost_serialization',
-    'main',
-  ]
-if environment['enableTCMalloc'] in ('True', '1', 1):
-  avida_viewer_LIBS = avida_viewer_LIBS + ['tcmalloc']
-
-avida_viewer = environment.Program(
-  'avida-viewer',
-  'viewer.cc',
-  LIBS = avida_viewer_LIBS,
-  LIBPATH = environment['LIBPATH'] + ['.'],
-)
-environment.Install('$execPrefix', avida_viewer)
-
-# vim: set ft=python:

Modified: branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.cc
===================================================================
--- branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -38,20 +38,37 @@
 #include "cWorld.h"
 
 #include "cDriverManager.h"
+#include "cFLTKWindow.h"
+#include "cFLTKBox.h"
+#include "tFLTKButton.h"
 
 #include <cstdlib>
 
 #include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Box.H>
+// #include <FL/Fl_Window.H>
+// #include <FL/Fl_Box.H>
 
 
 using namespace std;
 
+#define FLTK_MAINWIN_WIDTH  800
+#define FLTK_MAINWIN_HEIGHT 600
+#define FLTK_MENUBAR_HEIGHT 35
+#define FLTK_BODY_HEIGHT (FLTK_MAINWIN_HEIGHT - FLTK_MENUBAR_HEIGHT)
+
+#define FLTK_MENU_FONT_SIZE 20
+
 cDriver_FLTKViewer::cDriver_FLTKViewer(cWorld* world)
   : m_world(world)
-  , m_info(m_world->GetPopulation(), 12)
+  , m_info(world->GetPopulation(), 12)
   , m_done(false)
+  , m_main_window(FLTK_MAINWIN_WIDTH, FLTK_MAINWIN_HEIGHT, "Avida")
+  , m_menu_box(m_main_window, 0, 0, FLTK_MAINWIN_WIDTH, FLTK_MENUBAR_HEIGHT)
+  , m_body_box(m_main_window, 0, FLTK_MENUBAR_HEIGHT, FLTK_MAINWIN_WIDTH, FLTK_BODY_HEIGHT)
+  , m_update_box(m_main_window, 0, 0, 200, FLTK_MENUBAR_HEIGHT, "Update 0")
+  , m_title_box(m_main_window, 600, 0, 200, FLTK_MENUBAR_HEIGHT, "Avida")
+  , m_quit_button(m_main_window, 200, 0, 200, FLTK_MENUBAR_HEIGHT, "Quit")
+  , m_pause_button(m_main_window, 400, 0, 200, FLTK_MENUBAR_HEIGHT, "Pause", cGUIButton::BUTTON_LIGHT)
 {
   // Setup the initial view mode (loaded from avida.cfg)
   m_info.SetViewMode(world->GetConfig().VIEW_MODE.Get());
@@ -59,24 +76,33 @@
   cDriverManager::Register(static_cast<cAvidaDriver*>(this));
   world->SetDriver(this);
 
-  Fl_Window *window = new Fl_Window(300,180);
-  Fl_Box *box = new Fl_Box(20,40,260,100,"Avida!");
+  m_main_window.SetSizeRange(FLTK_MAINWIN_WIDTH, FLTK_MAINWIN_HEIGHT);
 
-  box->box(FL_UP_BOX);
-  box->labelsize(36);
-  box->labelfont(FL_BOLD+FL_ITALIC);
-  box->labeltype(FL_SHADOW_LABEL);
-  window->end();
+  m_menu_box.SetType(cGUIBox::BOX_RAISED_FRAME);
+  m_menu_box.Refresh();
 
-  int argc = 1;
-  char * progname = "Avida";
-  char ** argv = &progname;
+  m_update_box.SetType(cGUIBox::BOX_RAISED);
+  m_update_box.SetFontSize(FLTK_MENU_FONT_SIZE);
+  m_update_box.Refresh();
+ 
+  m_title_box.SetType(cGUIBox::BOX_RAISED);
+  m_title_box.SetFontSize(FLTK_MENU_FONT_SIZE);
+  m_title_box.Refresh();
 
-  window->show(argc, argv);
-  bool error = Fl::run();
-  (void) error;
+  m_main_window.Resizable(m_body_box);
+
+  m_quit_button.SetCallback(this, &cDriver_FLTKViewer::ButtonCallback_Quit);
+  m_quit_button.SetFontSize(FLTK_MENU_FONT_SIZE);
+  m_quit_button.Refresh();
+
+  m_pause_button.SetCallback(this, &cDriver_FLTKViewer::ButtonCallback_Pause);
+  m_pause_button.SetFontSize(FLTK_MENU_FONT_SIZE);
+  m_pause_button.Refresh();
+
+  m_main_window.Finalize();
 }
 
+
 cDriver_FLTKViewer::~cDriver_FLTKViewer()
 {
   cDriverManager::Unregister(static_cast<cAvidaDriver*>(this));
@@ -315,6 +341,14 @@
 
 void cDriver_FLTKViewer::DoUpdate()
 {
+  bool error = Fl::check();
+
+  cString update_string;
+  update_string.Set("Update: %d", m_world->GetStats().GetUpdate());
+  m_update_box.SetName(update_string);
+  m_update_box.Refresh();
+  
+
   const int pause_level = m_info.GetPauseLevel();
 
   // If we are stepping in some way, we've come to a stop, so revert to a normal pause.
@@ -327,20 +361,11 @@
     m_info.SetPauseLevel(cCoreView_Info::PAUSE_ON);
   }
 
-//   // If we are paused at all, delay doing anything else until we recieve user input.
-//   if (pause_level != cCoreView_Info::PAUSE_OFF) nodelay(stdscr, false);
-
-  // If there is any input in the buffer, process all of it.
+  // If we are paused, keep checking the interface until we are done.
   int cur_char = 0;
-  while ((cur_char = GetKeypress()) != 0 || m_info.GetPauseLevel() == cCoreView_Info::PAUSE_ON) {
-    bool found_keypress = ProcessKeypress(cur_char);
-
-    // If we couldn't manage the keypress here, check the current screen.
-//    if (found_keypress == false && cur_screen) cur_screen->DoInput(cur_char);
+  while (m_info.GetPauseLevel() == cCoreView_Info::PAUSE_ON) {
+    error = Fl::check();
   }
-
-//   nodelay(stdscr, true);
-
 }
 
 void cDriver_FLTKViewer::NotifyComment(const cString& in_string)
@@ -383,7 +408,20 @@
 }
 
 
+void cDriver_FLTKViewer::ButtonCallback_Quit(double ignore)
+{
+  (void) ignore;
+  exit(0);
+}
 
+void cDriver_FLTKViewer::ButtonCallback_Pause(double ignore)
+{
+  m_info.TogglePause();
+}
+
+
+
+
 void ExitFLTKViewer(int exit_code)
 {
   signal(SIGINT, SIG_IGN);           // Ignore all future interupts.

Modified: branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.h
===================================================================
--- branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/viewer-fltk/cDriver_FLTKViewer.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -37,21 +37,37 @@
 #include "cWorldDriver.h"
 #endif
 
+#include "cFLTKBox.h"
+#include "cFLTKWindow.h"
+#include "tFLTKButton.h"
+
 #include <sstream>
 #include <iostream>
 #include <fstream>
 
 class cWorld;
+class cGUIContainer;
 
 using namespace std;
 
 class cDriver_FLTKViewer : public cAvidaDriver, public cWorldDriver {
 private:
-  cWorld* m_world;
+  cWorld * m_world;
   cCoreView_Info m_info;
 
-  bool m_done;           // This is set to true when run should finish.
+  bool m_done;              // This is set to true when run should finish.
 
+  // Graphics components...
+  cFLTKWindow m_main_window;
+
+  cFLTKBox m_menu_box;
+  cFLTKBox m_body_box;
+  cFLTKBox m_update_box;
+  cFLTKBox m_title_box;
+
+  tFLTKButton<cDriver_FLTKViewer> m_quit_button;
+  tFLTKButton<cDriver_FLTKViewer> m_pause_button;
+
 public:
   cDriver_FLTKViewer(cWorld* world);
   ~cDriver_FLTKViewer();
@@ -85,6 +101,10 @@
 
   // Tests
   bool IsInteractive() { return true; }
+
+  // Button Callbacks...
+  void ButtonCallback_Quit(double ignore);
+  void ButtonCallback_Pause(double ignore);
 };
 
 

Copied: branches/collect/source/targets/viewer-fltk/cFLTKBox.h (from rev 1806, development/source/targets/viewer-fltk/cFLTKBox.h)
===================================================================
--- branches/collect/source/targets/viewer-fltk/cFLTKBox.h	                        (rev 0)
+++ branches/collect/source/targets/viewer-fltk/cFLTKBox.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,67 @@
+/*
+ *  cFLTKBox.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for the main GUI boxs...
+
+#ifndef cFLTKBox_h
+#define cFLTKBox_h
+
+#include "cGUIBox.h"
+
+#include <FL/Fl_Box.H>
+
+class cFLTKBox : public cGUIBox {
+protected:
+  Fl_Box * m_box;
+  
+public:
+  cFLTKBox(cGUIContainer & parent, int x, int y, int width, int height, const cString & name="")
+    : cGUIBox(parent, x, y, width, height, name)
+  {
+    m_box = new Fl_Box(x, y, width, height, name);
+  }
+  ~cFLTKBox() { delete m_box; }
+
+  void SetType(int in_type) {
+    m_type = (eBoxType) in_type;
+    if (m_type == BOX_NONE) m_box->box(FL_NO_BOX);
+    else if (m_type == BOX_FLAT) m_box->box(FL_FLAT_BOX);
+    else if (m_type == BOX_RAISED) m_box->box(FL_UP_BOX);
+    else if (m_type == BOX_LOWERED) m_box->box(FL_DOWN_BOX);
+    else if (m_type == BOX_FRAME) m_box->box(FL_BORDER_FRAME);
+    else if (m_type == BOX_RAISED_FRAME) m_box->box(FL_UP_FRAME);
+    else if (m_type == BOX_LOWERED_FRAME) m_box->box(FL_DOWN_FRAME);
+  }
+  
+
+  void Refresh() {
+    m_box->copy_label(m_name);
+    m_box->labelsize(m_font_size);
+    m_box->redraw();
+  }
+
+  Fl_Box * GetFLTKPtr() { return m_box; }
+};
+
+#endif

Copied: branches/collect/source/targets/viewer-fltk/cFLTKWindow.h (from rev 1806, development/source/targets/viewer-fltk/cFLTKWindow.h)
===================================================================
--- branches/collect/source/targets/viewer-fltk/cFLTKWindow.h	                        (rev 0)
+++ branches/collect/source/targets/viewer-fltk/cFLTKWindow.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,66 @@
+/*
+ *  cFLTKWindow.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for the main GUI windows...
+
+#ifndef cFLTKWindow_h
+#define cFLTKWindow_h
+
+#include "cGUIWindow.h"
+
+#include <FL/Fl_Window.H>
+
+#include "cFLTKBox.h"
+
+class cFLTKWindow : public cGUIWindow {
+protected:
+  Fl_Window * m_window;
+  
+public:
+  cFLTKWindow() { ; }
+  cFLTKWindow(int width, int height, const cString & name="")
+    : cGUIWindow(width, height, name)
+  {
+    m_window = new Fl_Window(width, height);
+  }
+  ~cFLTKWindow() { delete m_window; }
+
+  void SetSizeRange(int min_x, int min_y, int max_x=0, int max_y=0) {
+    m_window->size_range(min_x, min_y, max_x, max_y);
+  }
+
+  void Finalize() { 
+    m_window->end();
+    m_window->show();
+  }
+  void Update() { ; }
+
+  void Resizable(cFLTKBox & box) {
+    m_window->resizable(box.GetFLTKPtr());
+  }
+
+  Fl_Window * GetFLTKPtr() { return m_window; }
+};
+
+#endif

Copied: branches/collect/source/targets/viewer-fltk/fltk-defs.cc (from rev 1806, development/source/targets/viewer-fltk/fltk-defs.cc)
===================================================================
--- branches/collect/source/targets/viewer-fltk/fltk-defs.cc	                        (rev 0)
+++ branches/collect/source/targets/viewer-fltk/fltk-defs.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,32 @@
+/*
+ *  fltk_defs.cc
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include "fltk-defs.h"
+
+#include "cGUIButton.h"
+
+void GenericButtonCallback(void *, cGUIButton * button)
+{
+  button->Press();
+}

Copied: branches/collect/source/targets/viewer-fltk/fltk-defs.h (from rev 1806, development/source/targets/viewer-fltk/fltk-defs.h)
===================================================================
--- branches/collect/source/targets/viewer-fltk/fltk-defs.h	                        (rev 0)
+++ branches/collect/source/targets/viewer-fltk/fltk-defs.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,34 @@
+/*
+ *  fltk_defs.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for the main GUI boxs...
+
+#ifndef fltk_defs_h
+#define fltk_defs_h
+
+class cGUIButton;
+
+void GenericButtonCallback(void *, cGUIButton * button);
+
+#endif

Copied: branches/collect/source/targets/viewer-fltk/tFLTKButton.h (from rev 1806, development/source/targets/viewer-fltk/tFLTKButton.h)
===================================================================
--- branches/collect/source/targets/viewer-fltk/tFLTKButton.h	                        (rev 0)
+++ branches/collect/source/targets/viewer-fltk/tFLTKButton.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,68 @@
+/*
+ *  tFLTKButton.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a class to manage the FLTK GUI buttons...
+
+#ifndef tFLTKButton_h
+#define tFLTKButton_h
+
+#include "tGUIButton.h"
+#include "fltk-defs.h"
+
+#include "FL/Fl_Button.H"
+#include "FL/Fl_Light_Button.H"
+
+template <class T> class tFLTKButton : public tGUIButton<T> {
+protected:
+  Fl_Button * m_button;
+
+public:
+  tFLTKButton(cGUIContainer & parent, int x, int y, int width, int height, const cString & name="",
+	      cGUIButton::eButtonType type=cGUIButton::BUTTON_NORMAL)
+    : tGUIButton<T>(parent, x, y, width, height, name, type)
+  {
+    if (type == cGUIButton::BUTTON_NORMAL) {
+      m_button = new Fl_Button(x, y, width, height, name);
+    }
+    else if (type == cGUIButton::BUTTON_LIGHT) {
+      m_button = new Fl_Light_Button(x, y, width, height, name);
+    }
+    else {
+      assert(false); // Unknown button type!
+    }
+
+    m_button->callback((Fl_Callback*) GenericButtonCallback, (void*)(this));
+  }
+  ~tFLTKButton() { delete m_button; }
+
+  void BindKey(int key) { (void) key; }
+};
+
+
+#include <FL/Fl_Button.H>
+
+
+
+
+#endif

Modified: branches/collect/source/targets/viewer-text/cDriver_TextViewer.cc
===================================================================
--- branches/collect/source/targets/viewer-text/cDriver_TextViewer.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/targets/viewer-text/cDriver_TextViewer.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -415,8 +415,9 @@
   // If there is any input in the buffer, process all of it.
   int cur_char = ERR;
   while ((cur_char = GetKeypress()) != ERR || m_info.GetPauseLevel() == cCoreView_Info::PAUSE_ON) {
-    bool found_keypress = ProcessKeypress(cur_char);
+    ProcessKeypress(cur_char);
 
+    //bool found_keypress = ProcessKeypress(cur_char);
     // If we couldn't manage the keypress here, check the current screen.
 //    if (found_keypress == false && cur_screen) cur_screen->DoInput(cur_char);
     m_main_window.Refresh();

Deleted: branches/collect/source/testsuites/SConscript
===================================================================
--- branches/collect/source/testsuites/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/testsuites/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,46 +0,0 @@
-import os.path
-import string
-import tempfile
-
-
-def Test(env, name, *args, **kw):
-  """Creates unit test.
-
-  env: an SCons environment.
-  remaining parameters: are passed directly to SCons 'Program' builder,
-  and typically include first a program name, then a list of source
-  files, and then optional arguments such as library specifications.
-
-  Makes two alii: 'test-' plus the name of the test program, and
-  'test-all':
-  - first can be used to run individual unit test.
-  - second runs all test programs.
-  """
-  prg = env.Program(name, *args, **kw)
-  name = 'test-' + str(prg[0])
-  path = prg[0].path
-  env.AlwaysBuild(env.Alias(name, [prg], path))
-  env.AlwaysBuild(env.Alias('test-all', [prg], path))
-
-Import('environment')
-
-all_libs = [
-  'main',
-  'classification',
-  'cpu',
-  'event',
-  'analyze',
-  'drivers',
-  'analyze',
-  'cpu',
-  'tools',
-  'actions',
-  'main',
-  #'archive',
-  #'boost_serialization',
-]
-
-#Test(environment, 'full-unit-tests', 'full-unit-tests.cc', LIBS = all_libs)
-#Test(environment, 'cInitFile-unit-tests', 'cInitFile-unit-tests.cc', LIBS = all_libs)
-
-# vim: set ft=python:

Deleted: branches/collect/source/tools/SConscript
===================================================================
--- branches/collect/source/tools/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/tools/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,129 +0,0 @@
-
-Import('environment')
-
-misc = ['SConscript']
-
-incs = [
-  'cArgContainer.h',
-  'cArgSchema.h',
-  'cBlockStruct.h',
-  'cChangeList.h',
-  'cConstSchedule.h',
-  'cCountTracker.h',
-  'cCycleCheck.h',
-  'cDataEntry.h',
-  'cDataFile.h',
-  'cDataFileManager.h',
-  'cDataManager_Base.h',
-  'cDefaultMessageDisplay.h',
-  'cDoubleSum.h',
-  'cFile.h',
-  'cFixedBlock.h',
-  'cFixedCoords.h',
-  'cGenesis.h',
-  'cHelpAlias.h',
-  'cHelpEntry.h',
-  'cHelpFullEntry.h',
-  'cHelpManager.h',
-  'cHelpType.h',
-  'cHistogram.h',
-  'cID.h',
-  'cIndexedBlockStruct.h',
-  'cInitFile.h',
-  'cIntegratedSchedule.h',
-  'cIntegratedScheduleNode.h',
-  'cIntSum.h',
-  'cMerit.h',
-  'cMessageClass.h',
-  'cMessageClosure.h',
-  'cMessageDisplay.h',
-  'cMessageDisplay_headers.h',
-  'cMessageType.h',
-  'cProbSchedule.h',
-  'cRandom.h',
-  'cRefBlock.h',
-  'cRunningAverage.h',
-  'cScaledBlock.h',
-  'cSchedule.h',
-  'cString.h',
-  'cStringIterator.h',
-  'cStringList.h',
-  'cStringUtil.h',
-  'cTools.h',
-  'cUInt.h',
-  'cVerifierSuiteRecurser.h',
-  'cWeightedIndex.h',
-  'functions.h',
-  'recursive_tests_decl_hdrs.hh',
-  'recursive_tests_defn_hdrs.hh',
-  'recursive_tests_macros.hh',
-  'tArgDataEntry.h',
-  'tArray.h',
-  'tBuffer.h',
-  'tDataEntry.h',
-  'tDataEntryBase.h',
-  'tDataEntryCommand.h',
-  'tDataManager.h',
-  'tDictionary.h',
-  'tHashTable.h',
-  'tList.h',
-  'tManagedPointerArray.h',
-  'tMatrix.h',
-  'tMemTrack.h',
-  'tObjectFactory.h',
-  'tSmartArray.h',
-  'tUnitTestSuite.hh',
-  'tUnitTestSuiteRecurser.hh',
-  'tVector.h',
-  'tVerifierSuite.hh',
-  'tVerifierSuiteRecurser.hh',
-]
-
-srcs = [
-  #'cBlockStruct.cc',
-  'cArgContainer.cc',
-  'cArgSchema.cc',
-  'cChangeList.cc',
-  'cConstSchedule.cc',
-  'cDataEntry.cc',
-  'cDataFile.cc',
-  'cDataFileManager.cc',
-  'cDataManager_Base.cc',
-  'cDefaultMessageDisplay.cc',
-  'cDoubleSum.cc',
-  #'cFixedBlock.cc',
-  'cFixedCoords.cc',
-  'cFile.cc',
-  'cHelpAlias.cc',
-  'cHelpManager.cc',
-  'cHelpType.cc',
-  'cHistogram.cc',
-  'cIndexedBlockStruct.cc',
-  'cInitFile.cc',
-  'cIntSum.cc',
-  'cIntegratedSchedule.cc',
-  'cIntegratedScheduleNode.cc',
-  'cMessageDisplay.cc',
-  'cMerit.cc',
-  'cProbSchedule.cc',
-  'cRandom.cc',
-  'cRunningAverage.cc',
-  'cSchedule.cc',
-  'cString.cc',
-  'cStringIterator.cc',
-  'cStringList.cc',
-  'cStringUtil.cc',
-  'cTools.cc',
-  'cWeightedIndex.cc',
-  'cCycleCheck.cc',
-]
-
-environment.Library('tools', srcs) 
-
-environment.AppendUnique(
-  avida_msvs_project_srcs = [File(src).srcnode().path for src in srcs],
-  avida_msvs_project_incs = [File(src).srcnode().path for src in incs],
-  avida_msvs_project_misc = [File(src).srcnode().path for src in misc],
-)
-  
-# vim: set ft=python:

Modified: branches/collect/source/tools/cRandom.cc
===================================================================
--- branches/collect/source/tools/cRandom.cc	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/tools/cRandom.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -236,7 +236,7 @@
 
   int choice_num = 0;
   // @CAO this could be done a lot faster when choose size is close to
-  // full size.  However we need to rememebr to watch out for larger num_in
+  // full size.  However we need to remember to watch out for larger num_in
   while (choice_num < out_array.GetSize()) {
     int next = static_cast<int>(GetUInt(num_in));
 

Modified: branches/collect/source/tools/cRandom.h
===================================================================
--- branches/collect/source/tools/cRandom.h	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/source/tools/cRandom.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -37,7 +37,7 @@
   tMemTrack<cRandom> mt;
 #endif
 protected:
-  // Internal memebers
+  // Internal members
   int seed;
   int original_seed;
   int inext;

Copied: branches/collect/source/tools/tAutoRelease.h (from rev 1830, development/source/tools/tAutoRelease.h)
===================================================================
--- branches/collect/source/tools/tAutoRelease.h	                        (rev 0)
+++ branches/collect/source/tools/tAutoRelease.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,51 @@
+/*
+ *  tAutoRelease.h
+ *  Avida
+ *
+ *  Created by David on 7/18/07.
+ *  Copyright 2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef tAutoRelease_h
+#define tAutoRelease_h
+
+//! A lightweight pointer wrapper class that automatically deletes the contents on destruction.
+template <class T> class tAutoRelease
+{
+private:
+  T* m_value;
+  
+  tAutoRelease(const tAutoRelease&); // @not_implemented
+  tAutoRelease& operator=(const tAutoRelease&); // @not_implemented
+
+  
+public:
+  explicit inline tAutoRelease() : m_value(NULL) { ; }
+  explicit inline tAutoRelease(T* value) : m_value(value) { ; }
+  inline ~tAutoRelease() { delete m_value; }
+  
+  inline void Set(T* value) { delete m_value; m_value = value; }
+  inline tAutoRelease<T>& operator=(T* value) { delete m_value; m_value = value; return *this; }
+  
+  //! Take control of the contents
+  inline T* Release() { T* value = m_value; m_value = NULL; return value; }
+};
+
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIBox.h (from rev 1806, development/source/viewer-coreGUI/cGUIBox.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIBox.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIBox.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,49 @@
+/*
+ *  cGUIBox.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that act as boxs.
+
+#ifndef cGUIBox_h
+#define cGUIBox_h
+
+#include "cGUIWidget.h"
+
+class cGUIBox : public cGUIWidget {
+public:
+  enum eBoxType { BOX_NONE, BOX_FLAT, BOX_RAISED, BOX_LOWERED, BOX_FRAME, BOX_RAISED_FRAME, BOX_LOWERED_FRAME };
+
+protected:
+  eBoxType m_type;    // What type of box is this?
+
+public:
+  cGUIBox(cGUIContainer & parent, int x, int y, int width, int height, const cString & name="")
+    : cGUIWidget(parent, x, y, width, height, name)
+    , m_type(BOX_NONE) { ; }
+  virtual ~cGUIBox() { ; }
+
+  int GetType() const { return m_type; }
+  virtual void SetType(int in_type) { m_type = (eBoxType) in_type; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIButton.h (from rev 1774, development/source/viewer-coreGUI/cGUIButton.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIButton.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIButton.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,54 @@
+/*
+ *  cGUIButton.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that act as buttons.
+
+#ifndef cGUIButton_h
+#define cGUIButton_h
+
+#include "cGUIWidget.h"
+
+class cGUIButton : public cGUIWidget {
+public:
+  enum eButtonType { BUTTON_NORMAL, BUTTON_TOGGLE, BUTTON_RADIO, BUTTON_LIGHT,
+		     BUTTON_RADIO_LIGHT, BUTTON_RETURN, BUTTON_REPEAT };
+
+protected:
+  int m_type;    // What type of button is this?
+  int m_binding; // What keypress is this button bound to?
+
+public:
+  cGUIButton(cGUIContainer & parent, int x, int y, int width, int height, const cString & name="",
+	     eButtonType type=BUTTON_NORMAL)
+    : cGUIWidget(parent, x, y, width, height, name), m_type(type) { ; }
+  virtual ~cGUIButton() { ; }
+
+  virtual void Press() = 0;
+  virtual void BindKey(int key) = 0;
+
+  int GetType() const { return m_type; }
+  int GetBinding() const { return m_binding; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUICanvas.h (from rev 1774, development/source/viewer-coreGUI/cGUICanvas.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUICanvas.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUICanvas.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,46 @@
+/*
+ *  cGUICanvas.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for GUI widgets that can be drawn on.
+
+#ifndef cGUICanvas_h
+#define cGUICanvas_h
+
+#include "cGUIWidget.h"
+
+class cGUICanvas : public cGUIWidget {
+protected:
+public:
+  cGUICanvas() { ; }
+  cGUICanvas(int x, int y, width=0, height=0, name="") : cGUIWidget(x, y, width, height, name) { ; }
+  virtual ~cGUICanvas() { ; }
+
+  virtual void DrawLine(int x1, int y1, int x2, int y2) = 0;
+  virtual void DrawBox(int x1, int y1, int _w, int _h, bool fill=false) = 0;
+  virtual void DrawCircle(int _x, int _y, int _, bool fill=false) = 0;
+
+  virtual void SetColor(cColor color) = 0;
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIColor.h (from rev 1774, development/source/viewer-coreGUI/cGUIColor.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIColor.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIColor.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,49 @@
+/*
+ *  cGUIColor.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This class deals with colors in the GUI.
+
+#ifndef cGUIColor_h
+#define cGUIColor_h
+
+class cGUIColor {
+protected:
+  int m_red;    // Limited to 0-255
+  int m_green;  // Limited to 0-255
+  int m_blue;   // Limited to 0-255
+
+public:
+  cGUIColor(int _r, int _g, int _b) : m_red(_r), m_green(_g), m_blue(_b) {
+    assert(m_red >= 0 && m_red < 256);
+    assert(m_green >= 0 && m_green < 256);
+    assert(m_blue >= 0 && m_blue < 256);
+  }
+  virtual ~cGUIColor() { ; }
+
+  int GetRed() const { return m_red; }
+  int GetGreen() const { return m_green; }
+  int GetBlue() const { return m_blue; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIContainer.h (from rev 1774, development/source/viewer-coreGUI/cGUIContainer.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIContainer.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIContainer.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,67 @@
+/*
+ *  cGUIContainer.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that can be used as containers for other widgets in Avida.
+
+#ifndef cGUIContainer_h
+#define cGUIContainer_h
+
+#include "cGUIWidget.h"
+
+#include "tArray.h"
+
+class cGUIContainer : public cGUIWidget {
+protected:
+  tArray<cGUIWidget *> widget_array;
+
+  // The Create() method recursively builds everything contained here; create self is run first to set it up.
+  virtual void CreateSelf() { ; }
+
+public:
+  cGUIContainer() { ; }
+  cGUIContainer(int x, int y, int width=0, int height=0, const cString & name="")
+    : cGUIWidget(x, y, width, height, name) { ; }
+  cGUIContainer(cGUIContainer & parent, int x, int y, int width=0, int height=0, const cString & name="")
+    : cGUIWidget(parent, x, y, width, height, name) { ; }
+  virtual ~cGUIContainer() { ; }
+
+  // This method should be run when the widget is setup and its time to build it and everything it contains.
+  virtual void Create() {
+    CreateSelf();
+    for (int i = 0; i < widget_array.GetSize(); i++) {
+      widget_array[i]->Create();
+    }
+  }
+
+  void Add(cGUIWidget * in_widget) { widget_array.Push(in_widget); }
+  void Add(cGUIWidget * in_widget, int x, int y, int width, int height, const cString & name="") {
+    in_widget->m_x = x;
+    in_widget->m_y = y;
+    in_widget->m_width = width;
+    in_widget->m_height = height;
+    if (name != "") in_widget->m_name = name;
+  }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIEvent.h (from rev 1774, development/source/viewer-coreGUI/cGUIEvent.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIEvent.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIEvent.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,44 @@
+/*
+ *  cGUIEvent.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for events that can occur in the GUI, such as mouse clicks.
+
+#ifndef cGUIEvent_h
+#define cGUIEvent_h
+
+class cGUIEvent {
+public:
+  enum eGUIEventType { MOUSE_CLICK, MOUSE_MOVE, MOUSE_RELEASE, KEYPRESS };
+
+protected:
+  eGUIEventType m_type;
+
+public:
+  cGUIEvent() { ; }
+  virtual ~cGUIEvent() { ; }
+
+  eGUIEventType GetType() { return m_type; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIScrollArea.h (from rev 1774, development/source/viewer-coreGUI/cGUIScrollArea.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIScrollArea.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIScrollArea.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,39 @@
+/*
+ *  cGUIScrollArea.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that a panels containing widgets and have scollbars.
+
+#ifndef cGUIScrollArea_h
+#define cGUIScrollArea_h
+
+#include "cGUIContainer.h"
+
+class cGUIScrollArea : public cGUIContainer {
+protected:
+public:
+  cGUIScrollArea(int x, int y, width, height, name="") : cGUIContainer(x, y, width, height, name) { ; }
+  virtual ~cGUIScrollArea() { ; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUISlider.h (from rev 1774, development/source/viewer-coreGUI/cGUISlider.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUISlider.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUISlider.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,54 @@
+/*
+ *  cGUISlider.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that act as sliders.
+
+#ifndef cGUISlider_h
+#define cGUISlider_h
+
+#include "cGUIWidget.h"
+
+class cGUISlider : public cGUIWidget {
+public:
+  enum eSliderType { SLIDER_DEFAULT, SLIDER_VERT, SLIDER_HOIZ, SLIDER_DEFAULT_VALUE, SLIDER_VERT_VALUE, SLIDER_HOIZ_VALUE };
+
+protected:
+  eSliderType m_type;    // What type of slider is this?
+  double m_min;
+  double m_max;
+  double m_default;
+
+public:
+  cGUISlider(int x, int y, width, height, name="") : cGUIWidget(x, y, width, height, name) { ; }
+  virtual ~cGUISlider() { ; }
+
+  virtual void DoSlide() = 0;
+
+  int GetType() const { return m_type; }
+  int GetMin() const { return m_min; }
+  int GetMax() const { return m_max; }
+  int GetDefault() const { return m_default; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIWidget.cc (from rev 1806, development/source/viewer-coreGUI/cGUIWidget.cc)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIWidget.cc	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIWidget.cc	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,42 @@
+/*
+ *  cGUIWidget.cc
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include "cGUIWidget.h"
+#include "cGUIContainer.h"
+
+cGUIWidget::cGUIWidget()
+  : m_parent(NULL), m_x(0), m_y(0), m_width(0), m_height(0), m_font_size(20)
+{
+}
+
+cGUIWidget::cGUIWidget(int x, int y, int width, int height, const cString & name)
+    : m_parent(NULL), m_name(name), m_x(x), m_y(y), m_width(width), m_height(height), m_font_size(20)
+{
+}
+
+cGUIWidget::cGUIWidget(cGUIContainer & parent, int x, int y, int width, int height, const cString & name)
+  : m_parent(&parent), m_name(name), m_x(x), m_y(y), m_width(width), m_height(height), m_font_size(20)
+{
+  parent.Add(this);
+}

Copied: branches/collect/source/viewer-coreGUI/cGUIWidget.h (from rev 1774, development/source/viewer-coreGUI/cGUIWidget.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIWidget.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIWidget.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,71 @@
+/*
+ *  cGUIWidget.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets used in Avida.
+
+#ifndef cGUIWidget_h
+#define cGUIWidget_h
+
+#include "cString.h"
+
+class cGUIContainer;
+class cGUIEvent;
+
+class cGUIWidget {
+  friend class cGUIContainer;
+protected:
+  cGUIContainer * m_parent;
+  cString m_name;
+  int m_x;
+  int m_y;
+  int m_width;
+  int m_height;
+
+  int m_font_size;
+public:
+  cGUIWidget();
+  cGUIWidget(int x, int y, int width=0, int height=0, const cString & name="");
+  cGUIWidget(cGUIContainer & parent, int x, int y, int width=0, int height=0, const cString & name="");
+  virtual ~cGUIWidget() { ; }
+
+  // This method should be run when the widget is setup and its time to build it.
+  virtual void Create() { ; }
+
+  // This method should deal with GUI events.
+  virtual bool Handle(cGUIEvent & event) { (void) event; return false; }
+
+  cGUIContainer * GetParent() { return m_parent; }
+  const cString & GetName() { return m_name; }
+  int GetX() const { return m_x; }
+  int GetY() const { return m_y; }
+  int GetWidth() const { return m_width; }
+  int GetHeight() const { return m_height; }
+  
+  void SetName(const cString & _name) { m_name = _name; }
+  void SetFontSize(int _size) { m_font_size = _size; }
+
+  virtual void Refresh() { ; }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/cGUIWindow.h (from rev 1806, development/source/viewer-coreGUI/cGUIWindow.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/cGUIWindow.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/cGUIWindow.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,47 @@
+/*
+ *  cGUIWindow.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for the main GUI windows...
+
+#ifndef cGUIWindow_h
+#define cGUIWindow_h
+
+#include "cGUIContainer.h"
+
+class cGUIEvent;
+
+class cGUIWindow : public cGUIContainer {
+protected:
+public:
+  cGUIWindow() { ; }
+  cGUIWindow(int width, int height, const cString & name="") : cGUIContainer(0, 0, width, height, name) { ; }
+  virtual ~cGUIWindow() { ; }
+
+  virtual void SetSizeRange(int min_x, int min_y, int max_x=0, int max_y=0) = 0;
+
+  virtual void Finalize() = 0;
+  virtual void Update() = 0;
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/tGUIButton.h (from rev 1774, development/source/viewer-coreGUI/tGUIButton.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/tGUIButton.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/tGUIButton.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,61 @@
+/*
+ *  tGUIButton.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that act as buttons.
+
+#ifndef tGUIButton_h
+#define tGUIButton_h
+
+#include "cGUIButton.h"
+
+template <class T> class tGUIButton : public cGUIButton {
+protected:
+  T * m_target;
+  void (T::*m_callback)(double);
+  double m_arg;
+
+public:
+  tGUIButton(cGUIContainer & parent, int x, int y, int width, int height, const cString & name="",
+	     cGUIButton::eButtonType type=cGUIButton::BUTTON_NORMAL)
+    : cGUIButton(parent, x, y, width, height, name, type)
+    , m_target(NULL)
+    , m_callback(NULL)
+    , m_arg(0.0)
+  { ; }
+  virtual ~tGUIButton() { ; }
+
+  T & GetTarget() { return *m_target; }
+  double GetArg() { return m_arg; }
+
+  void SetCallback(T * target, void (T::*cb_fun)(double), double arg=0.0) {
+    m_target = target;
+    m_callback = cb_fun;
+    m_arg = arg;
+  }
+
+  virtual void Press() { if (m_callback != NULL) (m_target->*(m_callback))(m_arg); }
+  virtual void Press(double arg) { if (m_callback != NULL) (m_target->*(m_callback))(arg); }
+};
+
+#endif

Copied: branches/collect/source/viewer-coreGUI/tGUISlider.h (from rev 1774, development/source/viewer-coreGUI/tGUISlider.h)
===================================================================
--- branches/collect/source/viewer-coreGUI/tGUISlider.h	                        (rev 0)
+++ branches/collect/source/viewer-coreGUI/tGUISlider.h	2007-07-19 21:44:58 UTC (rev 1831)
@@ -0,0 +1,49 @@
+/*
+ *  tGUISlider.h
+ *  Avida
+ *
+ *  Created by Charles on 7-9-07
+ *  Copyright 1999-2007 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+// This is a base class for all GUI widgets that act as sliders.
+
+#ifndef tGUISlider_h
+#define tGUISlider_h
+
+#include "cGUIWidget.h"
+
+template <class T> class tGUISlider : public cGUISlider {
+protected:
+  T * m_target;
+  void (T::*m_slide_callback)(double);
+
+public:
+  tGUISlider(int x, int y, width, height, name="") : cGUISlider(x, y, width, height, name) { ; }
+  virtual ~tGUISlider() { ; }
+
+  T & GetTarget() { return *m_target; }
+
+  void SetTarget(T & _target) { m_target = _target; }
+  void SetSlideCallback(void (T::*cb_fun)(double)) { m_slide_callback = cb_fun; }
+
+  virtual void DoSlide(double value=1.0) { if (m_slide_callback != NULL) (m_target->*(m_slide_callback))(value); }
+};
+
+#endif

Deleted: branches/collect/support/config/SConscript
===================================================================
--- branches/collect/support/config/SConscript	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/support/config/SConscript	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,18 +0,0 @@
-Import('environment')
-
-environment.Install('$configPrefix', [
-  'analyze.cfg',
-  'environment.cfg',
-  'events.cfg',
-  'avida.cfg',
-  'instset-classic.cfg',
-  'instset-sex-classic.cfg',
-  'instset-smt.cfg',
-  'instset-transsmt.cfg',
-  'default-classic.org',
-  'default-sex-classic.org',
-  'default-smt.org',
-  'default-transsmt.org',
-] )
-
-# vim: set ft=python:

Deleted: branches/collect/support/linux_slave_build_options.py
===================================================================
--- branches/collect/support/linux_slave_build_options.py	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/support/linux_slave_build_options.py	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,47 +0,0 @@
-##############################################################################
-## Copyright (C) 1999-2005 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-
-# For convenience you can use this file to specify build options to the
-# Avida build system.  This file must be in the top level Avida source
-# code directory for the build system to find it. Add options one per
-# line in the form
-#
-#   Foo = 'foo'
-#   Bar = 'bar'
-#
-# Build options specified at the command line override the options in
-# this file.
-#
-# For more information about build options, type
-#
-#   ./build_avida -h
-#
-# In the top level Avida source code directory.
-#
-# Note: this file is also a Python script, so you can do some processing
-# here if you like.
-
-extrasDir = '../avida-extras'
-execPrefix = "#/work"
-
-#buildType = "Release"
-buildType = "Debug"
-
-enablePyPkg = "no"
-enableMemTracking = "yes"
-enableGuiNcurses = "no"
-enableTCMalloc = "no"
-enableSerialization = "no"
-
-boostIncludeDir = None
-boostPythonLibDir = None
-boostPythonLib = None
-GccXmlCommand = None
-
-# Vim modeline to tell Vim that this is a Python script.
-# vim: set ft=python:

Deleted: branches/collect/support/os_x_slave_build_options.py
===================================================================
--- branches/collect/support/os_x_slave_build_options.py	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/support/os_x_slave_build_options.py	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,45 +0,0 @@
-##############################################################################
-## Copyright (C) 1999-2005 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-
-# For convenience you can use this file to specify build options to the
-# Avida build system.  This file must be in the top level Avida source
-# code directory for the build system to find it. Add options one per
-# line in the form
-#
-#   Foo = 'foo'
-#   Bar = 'bar'
-#
-# Build options specified at the command line override the options in
-# this file.
-#
-# For more information about build options, type
-#
-#   ./build_avida -h
-#
-# In the top level Avida source code directory.
-#
-# Note: this file is also a Python script, so you can do some processing
-# here if you like.
-
-extrasDir = '../avida-extras'
-execPrefix = "#/work"
-
-#buildType = "Release"
-buildType = "Debug"
-
-enablePyPkg = "no"
-enableMemTracking = "yes"
-enableGuiNcurses = "no"
-
-boostIncludeDir = None
-boostPythonLibDir = None
-boostPythonLib = None
-GccXmlCommand = None
-
-# Vim modeline to tell Vim that this is a Python script.
-# vim: set ft=python:

Deleted: branches/collect/support/vs2k3_slave_build_options.py
===================================================================
--- branches/collect/support/vs2k3_slave_build_options.py	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/support/vs2k3_slave_build_options.py	2007-07-19 21:44:58 UTC (rev 1831)
@@ -1,47 +0,0 @@
-##############################################################################
-## Copyright (C) 1999-2005 Michigan State University                        ##
-## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
-##                                                                          ##
-## Read the COPYING and README files, or contact 'avida at alife.org',         ##
-## before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     ##
-##############################################################################
-
-# For convenience you can use this file to specify build options to the
-# Avida build system.  This file must be in the top level Avida source
-# code directory for the build system to find it. Add options one per
-# line in the form
-#
-#   Foo = 'foo'
-#   Bar = 'bar'
-#
-# Build options specified at the command line override the options in
-# this file.
-#
-# For more information about build options, type
-#
-#   ./build_avida -h
-#
-# In the top level Avida source code directory.
-#
-# Note: this file is also a Python script, so you can do some processing
-# here if you like.
-
-extrasDir = '../avida-extras'
-execPrefix = "#/work"
-
-#buildType = "Release"
-buildType = "Debug"
-
-enablePyPkg = "no"
-enableMemTracking = "yes"
-enableGuiNcurses = "no"
-enableTCMalloc = "no"
-enableSerialization = "no"
-
-boostIncludeDir = None
-boostPythonLibDir = None
-boostPythonLib = None
-GccXmlCommand = None
-
-# Vim modeline to tell Vim that this is a Python script.
-# vim: set ft=python:

Modified: branches/collect/tests/_testrunner/testrunner.py
===================================================================
--- branches/collect/tests/_testrunner/testrunner.py	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/tests/_testrunner/testrunner.py	2007-07-19 21:44:58 UTC (rev 1831)
@@ -52,7 +52,7 @@
 
 # Global Constants
 # ---------------------------------------------------------------------------------------------------------------------------
-TESTRUNNER_VERSION = "1.4b"
+TESTRUNNER_VERSION = "1.4c"
 TESTRUNNER_COPYRIGHT = "2007"
 
 TRUE_STRINGS = ("y","Y","yes","Yes","true","True","1")
@@ -788,7 +788,7 @@
 
     sem.acquire()
     ti += 1
-    sys.stdout.write("\rPerforming Test:  % 4d of %d" % (ti, len(tests)))
+    sys.stdout.write("\rPerforming Test:  %4d of %d -- %-45s " % (ti, len(tests), test.name[:45]))
     sys.stdout.flush()
     tthread = threading.Thread(target=runTestWrapper, args=(test, sem))
     tthread.start()

Modified: branches/collect/tests/analyze_dumplandscape/test_list
===================================================================
--- branches/collect/tests/analyze_dumplandscape/test_list	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/tests/analyze_dumplandscape/test_list	2007-07-19 21:44:58 UTC (rev 1831)
@@ -16,7 +16,7 @@
 long = no                ; Is this test a long test?
 
 [performance]
-enabled = yes            ; Is this test a performance test?
+enabled = no             ; Is this test a performance test?
 long = no                ; Is this test a long test?
 
 ; The following variables can be used in constructing setting values by calling

Modified: branches/collect/tests/analyze_truncate_lineage_fulllandscape/test_list
===================================================================
--- branches/collect/tests/analyze_truncate_lineage_fulllandscape/test_list	2007-07-19 20:25:54 UTC (rev 1830)
+++ branches/collect/tests/analyze_truncate_lineage_fulllandscape/test_list	2007-07-19 21:44:58 UTC (rev 1831)
@@ -13,7 +13,7 @@
 
 [consistency]
 enabled = yes            ; Is this test a consistency test?
-long = no                ; Is this test a long test?
+long = yes               ; Is this test a long test?
 
 [performance]
 enabled = yes            ; Is this test a performance test?




More information about the Avida-cvs mailing list