[avida-cvs] avida CVS commits: /current configure.in /current/source Makefile.am /current/source/cpu cpu.pri /current/source/event event.pri /current/source/main main_sub.pri /current/source/qt-viewer Makefile.am apocalypse_widget.cc avd_avida_driver.cc avd_avida_driver.hh avd_driver_controller.cc avd_event_viewer_controller.cc avd_godbox_controller.cc avd_help_controller.cc avd_help_viewer.cc avd_instruction_viewer_controller.cc avd_main_window.cc avd_main_window_controller.cc avd_message_display.cc avd_mission_control.cc avd_plot_viewer_controller.cc avd_rate_validator2.cc avida_data.cc avida_plot_widget.cc event_view_widget.cc godbox_widget2.cc gui_message_display.cc map_view.cc map_view_cell_entry.cc map_view_widget.cc messaging_population_wrapper.cc n_orig_instruction_buttons_widget.cc n_orig_instruction_cpu_widget.cc n_orig_instruction_line_widget.cc n_orig_instruction_line_widget.hh n_orig_instruction_scrollview.cc n_orig_instruction_scrollview.hh n_orig_instruction_view_widget.cc n_orig_instruction_viewer.cc population_cell_wrapped_accessors.cc population_cell_wrapper.cc setup_avida.cc setup_file.cc setup_genesis.cc setup_wizard.cc setup_wizard2.cc setup_wizard_config.cc setup_wizard_config.hh setup_wizard_constants.cc setup_wizard_page.cc setup_wizard_page2.cc testwizard.cc testwizard_loadgen.cc testwizard_validators.cc /current/source/third-party/trio-1.9 Makefile.am /current/source/third-party/trio-1.9/mockpp 2003.11.25..13.09.41-add AbstractExpectation.h AbstractExpectationCollection.h Expectation.h ExpectationBoundary.h ExpectationCounter.cpp ExpectationCounter.h ExpectationList.h ExpectationMap.h ExpectationSegment.h ExpectationSet.h ExpectationValue.h Makefile.am Makefile.in MockObject.cpp MockObject.h ReturnObjectList.h Throwable.cpp Throwable.h ThrowableList.cpp ThrowableList.h Verifiable.cpp Verifiable.h VerifiableList.cpp VerifiableList.h VisitableMockObject.cpp VisitableMockObject.h VisitableMockObject_macro.h VisitableMockObject_template.h doc-template.h mockpp.cpp mockpp.h mockpp_config.h /current/source/third-party/trio-1.9/mockpp/compat Assert.cpp Assert.h AssertionFailedError.cpp AssertionFailedError.h Exception.cpp Exception.h Formatter.cpp Formatter.h Makefile.am Makefile.in /current/source/third-party/trio-1.9/mockpp/docs Makefile.am /current/source/third-party/trio-1.9/mockpp/docs/api Makefile.am /current/source/third-party/trio-1.9/mockpp/docs/en Makefile.am appendix.docbook bookinfo.docbook credits.docbook customize.xsl dev_advanced.docbook dev_basic.docbook dev_helper.docbook dev_intro.docbook faq.docbook index.docbook /current/source/third-party/trio-1.9/mockpp/examples Makefile.am mock_greeter.cpp /current/source/third-party/trio-1.9/mockpp/po Makefile.am de.gmo de.po mockpp.pot /current/source/third-party/trio-1.9/mockpp/tests AssertMo_test.cpp Assert_test.cpp Exception_test.cpp ExpectationBoundary_test.cpp ExpectationCounterRange_test.cpp ExpectationCounter_test.cpp ExpectationList_test.cpp ExpectationMap_test.cpp ExpectationSegment_test.cpp ExpectationSet_test.cpp ExpectationValue_test.cpp Formatter_test.cpp Makefile.am MockObject_test.cpp ReturnObjectList_test.cpp ThrowableList_test.cpp Throwable_test.cpp Verifiable_test.cpp VisitableMockObject_1_test.cpp VisitableMockObject_1_void_test.cpp VisitableMockObject_2_test.cpp VisitableMockObject_2_void_test.cpp VisitableMockObject_3_test.cpp VisitableMockObject_3_void_test.cpp VisitableMockObject_4_test.cpp VisitableMockObject_4_void_test.cpp VisitableMockObject_5_test.cpp VisitableMockObject_5_void_test.cpp VisitableMockObject_template_test.cpp VisitableMockObject_test.cpp VisitableMockObject_void_test.cpp mock_test.cpp mock_test_qt.cpp mockpp_test.cpp /current/source/third-party/trio-1.9/mockpp/util AssertMo.cpp AssertMo.h Makefile.am NotImplementedException.cpp NotImplementedException.h /current/source/third-party/trio-1.9/trio 2003.11.25..13.08.45-add FILES.0 Makefile.am Makefile.in README.0 autogen.sh.0 compare.c config.guess.0 config.sub.0 configure.in.0 example.c maketgz.0 regression.c strio.h trio.c trio.h trio.pri triodef.h trionan.c trionan.h triop.h triostr.c triostr.h /current/source/third-party/trio-1.9/trio/doc doc.h doc_dynamic.h doc_printf.h doc_register.h doc_scanf.h doc_static.h footer.html header.html trio.cfg trio.css /current/source/third-party/trio-1.9/trio/html group___dynamic_strings.html group___printf.html group___scanf.html group___special_quantities.html group___static_strings.html group___user_defined.html index.html modules.html trio.css /current/source/third-party/trio-1.9/yaktest AUTHORS.0 COPYING.0 ChangeLog.0 INSTALL.0 Makefile.am Makefile.am.0 NEWS.0 README.0 aclocal.m4.0 configure.in.0 depcomp.0 install-sh.0 missing.0 mkinstalldirs.0 stringable.h test_case.cpp test_case.h test_problem.cpp test_problem.h test_result.cpp test_result.h text_test_interpreter.cpp text_test_interpreter.h /current/source/third-party/trio-1.9/yaktest/example Makefile.am cscope.out point.h test_case_point.cpp test_case_point.h test_point.cpp /current/source/tools tools.pri /current/source/viewers Makefile.am ansi.hh bar_screen.cc environment_screen.cc hist_screen.cc map_screen.cc menu.hh ncurses.cc options_screen.cc stats_screen.cc symbol_util.cc text_screen.cc text_screen.hh text_window.hh view.cc viewer.cc viewer.hh zoom_screen.cc

kaben avida-cvs at alife.org
Tue Nov 25 18:20:57 PST 2003


kaben		Tue Nov 25 10:20:57 2003 EDT

  Added files:                 
    /avida/current/source/third-party/trio-1.9/mockpp	
                                                     	2003.11.25..13.09.41-add 
                                                     	AbstractExpectation.h 
                                                     	AbstractExpectationCollection.h 
                                                     	Expectation.h 
                                                     	ExpectationBoundary.h 
                                                     	ExpectationCounter.cpp 
                                                     	ExpectationCounter.h 
                                                     	ExpectationList.h 
                                                     	ExpectationMap.h 
                                                     	ExpectationSegment.h 
                                                     	ExpectationSet.h 
                                                     	ExpectationValue.h 
                                                     	Makefile.am 
                                                     	Makefile.in 
                                                     	MockObject.cpp 
                                                     	MockObject.h 
                                                     	ReturnObjectList.h 
                                                     	Throwable.cpp 
                                                     	Throwable.h 
                                                     	ThrowableList.cpp 
                                                     	ThrowableList.h 
                                                     	Verifiable.cpp 
                                                     	Verifiable.h 
                                                     	VerifiableList.cpp 
                                                     	VerifiableList.h 
                                                     	VisitableMockObject.cpp 
                                                     	VisitableMockObject.h 
                                                     	VisitableMockObject_macro.h 
                                                     	VisitableMockObject_template.h 
                                                     	doc-template.h 
                                                     	mockpp.cpp 
                                                     	mockpp.h 
                                                     	mockpp_config.h 
    /avida/current/source/third-party/trio-1.9/mockpp/compat	Assert.cpp 
                                                            	Assert.h 
                                                            	AssertionFailedError.cpp 
                                                            	AssertionFailedError.h 
                                                            	Exception.cpp 
                                                            	Exception.h 
                                                            	Formatter.cpp 
                                                            	Formatter.h 
                                                            	Makefile.am 
                                                            	Makefile.in 
    /avida/current/source/third-party/trio-1.9/mockpp/docs	Makefile.am 
    /avida/current/source/third-party/trio-1.9/mockpp/docs/api	
                                                              	Makefile.am 
    /avida/current/source/third-party/trio-1.9/mockpp/docs/en	
                                                             	Makefile.am 
                                                             	appendix.docbook 
                                                             	bookinfo.docbook 
                                                             	credits.docbook 
                                                             	customize.xsl 
                                                             	dev_advanced.docbook 
                                                             	dev_basic.docbook 
                                                             	dev_helper.docbook 
                                                             	dev_intro.docbook 
                                                             	faq.docbook 
                                                             	index.docbook 
    /avida/current/source/third-party/trio-1.9/mockpp/examples	
                                                              	Makefile.am 
                                                              	mock_greeter.cpp 
    /avida/current/source/third-party/trio-1.9/mockpp/po	Makefile.am 
                                                        	de.gmo de.po 
                                                        	mockpp.pot 
    /avida/current/source/third-party/trio-1.9/mockpp/tests	
                                                           	AssertMo_test.cpp 
                                                           	Assert_test.cpp 
                                                           	Exception_test.cpp 
                                                           	ExpectationBoundary_test.cpp 
                                                           	ExpectationCounterRange_test.cpp 
                                                           	ExpectationCounter_test.cpp 
                                                           	ExpectationList_test.cpp 
                                                           	ExpectationMap_test.cpp 
                                                           	ExpectationSegment_test.cpp 
                                                           	ExpectationSet_test.cpp 
                                                           	ExpectationValue_test.cpp 
                                                           	Formatter_test.cpp 
                                                           	Makefile.am 
                                                           	MockObject_test.cpp 
                                                           	ReturnObjectList_test.cpp 
                                                           	ThrowableList_test.cpp 
                                                           	Throwable_test.cpp 
                                                           	Verifiable_test.cpp 
                                                           	VisitableMockObject_1_test.cpp 
                                                           	VisitableMockObject_1_void_test.cpp 
                                                           	VisitableMockObject_2_test.cpp 
                                                           	VisitableMockObject_2_void_test.cpp 
                                                           	VisitableMockObject_3_test.cpp 
                                                           	VisitableMockObject_3_void_test.cpp 
                                                           	VisitableMockObject_4_test.cpp 
                                                           	VisitableMockObject_4_void_test.cpp 
                                                           	VisitableMockObject_5_test.cpp 
                                                           	VisitableMockObject_5_void_test.cpp 
                                                           	VisitableMockObject_template_test.cpp 
                                                           	VisitableMockObject_test.cpp 
                                                           	VisitableMockObject_void_test.cpp 
                                                           	mock_test.cpp 
                                                           	mock_test_qt.cpp 
                                                           	mockpp_test.cpp 
    /avida/current/source/third-party/trio-1.9/mockpp/util	AssertMo.cpp 
                                                          	AssertMo.h 
                                                          	Makefile.am 
                                                          	NotImplementedException.cpp 
                                                          	NotImplementedException.h 
    /avida/current/source/third-party/trio-1.9/trio	
                                                   	2003.11.25..13.08.45-add 
                                                   	FILES.0 Makefile.am 
                                                   	Makefile.in 
                                                   	README.0 
                                                   	autogen.sh.0 
                                                   	compare.c 
                                                   	config.guess.0 
                                                   	config.sub.0 
                                                   	configure.in.0 
                                                   	example.c maketgz.0 
                                                   	regression.c 
                                                   	strio.h trio.c 
                                                   	trio.h trio.pri 
                                                   	triodef.h trionan.c 
                                                   	trionan.h triop.h 
                                                   	triostr.c triostr.h 
    /avida/current/source/third-party/trio-1.9/trio/doc	doc.h 
                                                       	doc_dynamic.h 
                                                       	doc_printf.h 
                                                       	doc_register.h 
                                                       	doc_scanf.h 
                                                       	doc_static.h 
                                                       	footer.html 
                                                       	header.html 
                                                       	trio.cfg 
                                                       	trio.css 
    /avida/current/source/third-party/trio-1.9/trio/html	
                                                        	group___dynamic_strings.html 
                                                        	group___printf.html 
                                                        	group___scanf.html 
                                                        	group___special_quantities.html 
                                                        	group___static_strings.html 
                                                        	group___user_defined.html 
                                                        	index.html 
                                                        	modules.html 
                                                        	trio.css 
    /avida/current/source/third-party/trio-1.9/yaktest	AUTHORS.0 
                                                      	COPYING.0 
                                                      	ChangeLog.0 
                                                      	INSTALL.0 
                                                      	Makefile.am 
                                                      	Makefile.am.0 
                                                      	NEWS.0 README.0 
                                                      	aclocal.m4.0 
                                                      	configure.in.0 
                                                      	depcomp.0 
                                                      	install-sh.0 
                                                      	missing.0 
                                                      	mkinstalldirs.0 
                                                      	stringable.h 
                                                      	test_case.cpp 
                                                      	test_case.h 
                                                      	test_problem.cpp 
                                                      	test_problem.h 
                                                      	test_result.cpp 
                                                      	test_result.h 
                                                      	text_test_interpreter.cpp 
                                                      	text_test_interpreter.h 
    /avida/current/source/third-party/trio-1.9/yaktest/example	
                                                              	Makefile.am 
                                                              	cscope.out 
                                                              	point.h 
                                                              	test_case_point.cpp 
                                                              	test_case_point.h 
                                                              	test_point.cpp 

  Modified files:              
    /avida/current	configure.in 
    /avida/current/source	Makefile.am 
    /avida/current/source/cpu	cpu.pri 
    /avida/current/source/event	event.pri 
    /avida/current/source/main	main_sub.pri 
    /avida/current/source/qt-viewer	Makefile.am apocalypse_widget.cc 
                                   	avd_avida_driver.cc 
                                   	avd_avida_driver.hh 
                                   	avd_driver_controller.cc 
                                   	avd_event_viewer_controller.cc 
                                   	avd_godbox_controller.cc 
                                   	avd_help_controller.cc 
                                   	avd_help_viewer.cc 
                                   	avd_instruction_viewer_controller.cc 
                                   	avd_main_window.cc 
                                   	avd_main_window_controller.cc 
                                   	avd_message_display.cc 
                                   	avd_mission_control.cc 
                                   	avd_plot_viewer_controller.cc 
                                   	avd_rate_validator2.cc 
                                   	avida_data.cc avida_plot_widget.cc 
                                   	event_view_widget.cc 
                                   	godbox_widget2.cc 
                                   	gui_message_display.cc map_view.cc 
                                   	map_view_cell_entry.cc 
                                   	map_view_widget.cc 
                                   	messaging_population_wrapper.cc 
                                   	n_orig_instruction_buttons_widget.cc 
                                   	n_orig_instruction_cpu_widget.cc 
                                   	n_orig_instruction_line_widget.cc 
                                   	n_orig_instruction_line_widget.hh 
                                   	n_orig_instruction_scrollview.cc 
                                   	n_orig_instruction_scrollview.hh 
                                   	n_orig_instruction_view_widget.cc 
                                   	n_orig_instruction_viewer.cc 
                                   	population_cell_wrapped_accessors.cc 
                                   	population_cell_wrapper.cc 
                                   	setup_avida.cc setup_file.cc 
                                   	setup_genesis.cc setup_wizard.cc 
                                   	setup_wizard2.cc 
                                   	setup_wizard_config.cc 
                                   	setup_wizard_config.hh 
                                   	setup_wizard_constants.cc 
                                   	setup_wizard_page.cc 
                                   	setup_wizard_page2.cc testwizard.cc 
                                   	testwizard_loadgen.cc 
                                   	testwizard_validators.cc 
    /avida/current/source/third-party/trio-1.9	Makefile.am 
    /avida/current/source/tools	tools.pri 
    /avida/current/source/viewers	Makefile.am ansi.hh bar_screen.cc 
                                 	environment_screen.cc hist_screen.cc 
                                 	map_screen.cc menu.hh ncurses.cc 
                                 	options_screen.cc stats_screen.cc 
                                 	symbol_util.cc text_screen.cc 
                                 	text_screen.hh text_window.hh view.cc 
                                 	viewer.cc viewer.hh zoom_screen.cc 
  Log:
  
  In process of constructing version 2.0b9.
  - updated stale Makefile.ams and configure.in.
  - updated *.cc and *.hh in qt-viewer/ and viewers/.
  - added third-party suites mockpp and yaktest, both for use in unit
    tests.
  
  
  
-------------- next part --------------
Index: avida/current/configure.in
diff -u avida/current/configure.in:1.34 avida/current/configure.in:1.35
--- avida/current/configure.in:1.34	Wed Oct 15 17:45:15 2003
+++ avida/current/configure.in	Tue Nov 25 10:20:43 2003
@@ -4,11 +4,14 @@
 dnl checks whether file defs.hh exists
 AC_INIT(source/defs.hh)
 
+AC_PREREQ(2.50)
 
 dnl ****************************************
 dnl        Package name and version
 dnl ****************************************
 AM_INIT_AUTOMAKE(avida, 2.0b7)
+AC_SUBST(all_includes)
+AC_SUBST(all_libraries)
 
 
 dnl ****************************************
@@ -27,6 +30,7 @@
 
 dnl check for c++ compiler
 AC_PROG_CXX
+AC_LANG(C++)
 
 dnl check for c preprocessor
 AC_PROG_CPP
@@ -34,6 +38,8 @@
 dnl check for library generator
 AC_PROG_RANLIB
 
+AC_PROG_MAKE_SET
+
 dnl check for perl compiler
 AC_CHECK_PROG(PERL,
 	perl,
@@ -44,6 +50,13 @@
    AC_MSG_ERROR(perl compiler not found! Must have perl in the search path to compile Avida. Please set your PATH variable accordingly.)
 fi
 
+AC_CHECK_HEADERS(limits)
+AC_CHECK_HEADERS(machine/limits.h)
+AC_CHECK_HEADERS(values.h)
+
+AH_TEMPLATE([DEBUG],
+[Define to turn debugging globally on.])
+
 dnl ****************************************
 dnl            Configure options
 dnl ****************************************
@@ -52,7 +65,7 @@
 AC_ARG_ENABLE(debug,
   [  --enable-debug: Compile with debugging symbols],
   [CPPFLAGS="-g -Wall -pedantic -DDEBUG"; qmake_debug="debug"],
-  [CPPFLAGS="-O3 -ffast-math"; qmake_debug="release"])
+  [CPPFLAGS="-O3 -ffast-math -DNDEBUG"; qmake_debug="release"])
 
 AC_ARG_ENABLE(gnu-debug,
   [  --enable-gnu-debug: Compile with special debugging symbols for the gnu debugger gdb],
@@ -89,26 +102,26 @@
 AM_CONDITIONAL(BUILD_PRIMITIVE, test x$build_primitive = xtrue)
 
 
-dnl regression testsuites
+dnl code testsuites
 
-regression_tests=false;
+code_tests=false;
 
 AC_ARG_ENABLE(all-tests,
-  [  --enable-all-tests: Comprehensive regression tests via 'make check'],
-  [all_tests=true; regression_tests=true], [all_tests=false])
+  [  --enable-all-tests: Comprehensive code tests via 'make check'],
+  [all_tests=true; code_tests=true], [all_tests=false])
 
 AC_ARG_ENABLE(default-tests,
-   [  --disable-default-tests: Disable default regression tests via 'make check'],
-   [default_tests=false], [default_tests=true; regression_tests=true])
+   [  --disable-default-tests: Disable default code tests via 'make check'],
+   [default_tests=false], [default_tests=true; code_tests=true])
 AM_CONDITIONAL(DEFAULT_TESTS, test x$default_tests = xtrue)
 
 AC_ARG_ENABLE(tedious-tests,
-  [  --enable-tedious-tests: Tedious regression tests via 'make check'],
-  [tedious_tests=true; regression_tests=true],
+  [  --enable-tedious-tests: Tedious code tests via 'make check'],
+  [tedious_tests=true; code_tests=true],
   [if test x$all_tests = xtrue; then tedious_tests=true; else tedious_tests=false; fi])
 AM_CONDITIONAL(TEDIOUS_TESTS, test x$tedious_tests = xtrue)
 
-AM_CONDITIONAL(DEJAGNU_REGRESSION_TESTS, test x$regression_tests = xtrue)
+AM_CONDITIONAL(CODE_TESTS, test x$code_tests = xtrue)
 
 dnl ****************************************
 dnl Checks for ncurses viewer
@@ -193,13 +206,29 @@
 	doc/Makefile
 	doc/glossary/Makefile
   source/Makefile
-  source/third-party/Makefile
-  source/third-party/trio-1.9/Makefile
-  source/tools/Makefile source/cpu/Makefile
-  source/event/Makefile source/viewers/Makefile
+  source/event/Makefile
   source/main/Makefile
-  source/main/functional_testsuites/Makefile
+  source/qt-viewer/Makefile
   source/support/Makefile
   source/support/preset_organisms/Makefile
-  source/qt-viewer/Makefile
+  source/testsuites/Makefile
+  source/testsuites/functional_testsuites/Makefile
+  source/testsuites/unit_testsuites/Makefile
+  source/testsuites/unit_testsuites/level_0/Makefile
+  source/testsuites/unit_testsuites/level_1/Makefile
+  source/third-party/Makefile
+  source/third-party/mockpp/Makefile \
+  source/third-party/mockpp/compat/Makefile \
+  source/third-party/mockpp/docs/Makefile \
+  source/third-party/mockpp/docs/api/Makefile \
+  source/third-party/mockpp/docs/en/Makefile \
+  source/third-party/mockpp/examples/Makefile \
+  source/third-party/mockpp/po/Makefile \
+  source/third-party/mockpp/tests/Makefile \
+  source/third-party/mockpp/util/Makefile \
+  source/third-party/trio/Makefile
+  source/third-party/yaktest/Makefile
+  source/third-party/yaktest/example/Makefile
+  source/tools/Makefile source/cpu/Makefile
+  source/viewers/Makefile
 )
Index: avida/current/source/Makefile.am
diff -u avida/current/source/Makefile.am:1.24 avida/current/source/Makefile.am:1.25
--- avida/current/source/Makefile.am:1.24	Thu May 22 11:58:51 2003
+++ avida/current/source/Makefile.am	Tue Nov 25 10:20:44 2003
@@ -2,7 +2,7 @@
 
 SUBDIRS_PRIMITIVE = support
 if BUILD_PRIMITIVE
-SUBDIRS_PRIMITIVE += third-party tools cpu event main
+SUBDIRS_PRIMITIVE += third-party tools cpu event main testsuites
 endif
 
 if VIEWER
Index: avida/current/source/cpu/cpu.pri
diff -u avida/current/source/cpu/cpu.pri:1.3 avida/current/source/cpu/cpu.pri:1.4
--- avida/current/source/cpu/cpu.pri:1.3	Mon May 19 13:35:49 2003
+++ avida/current/source/cpu/cpu.pri	Tue Nov 25 10:20:44 2003
@@ -1,29 +1,34 @@
 
 cpu {
-  HEADERS += $$CPU_HH/cpu_defs.hh \
+  HEADERS += \
+             $$CPU_HH/code_label.hh \
+             $$CPU_HH/cpu_defs.hh \
              $$CPU_HH/cpu_memory.hh \
              $$CPU_HH/cpu_stack.hh \
              $$CPU_HH/cpu_stats.hh \
+             $$CPU_HH/hardware_4stack.hh \
              $$CPU_HH/hardware_base.hh \
              $$CPU_HH/hardware_cpu.hh \
-             $$CPU_HH/hardware_4stack.hh \
              $$CPU_HH/hardware_factory.hh \
-             $$CPU_HH/hardware_method.hh \
              $$CPU_HH/hardware_util.hh \
-             $$CPU_HH/head.hh \
-             $$CPU_HH/label.hh \
              $$CPU_HH/test_cpu.hh \
              $$CPU_HH/test_util.hh
 
-  SOURCES += $$CPU_CC/cpu_memory.cc \
+  SOURCES += \
+             $$CPU_CC/4stack_head.cc \
+             $$CPU_CC/code_label.cc \
+             $$CPU_CC/cpu_head.cc \
+             $$CPU_CC/cpu_memory.cc \
              $$CPU_CC/cpu_stack.cc \
+             $$CPU_CC/cpu_test_info.cc \
+             $$CPU_CC/hardware_4stack.cc \
+             $$CPU_CC/hardware_4stack_thread.cc \
              $$CPU_CC/hardware_base.cc \
              $$CPU_CC/hardware_cpu.cc \
-             $$CPU_CC/hardware_4stack.cc \
+             $$CPU_CC/hardware_cpu_thread.cc \
              $$CPU_CC/hardware_factory.cc \
              $$CPU_CC/hardware_util.cc \
-             $$CPU_CC/head.cc \
-             $$CPU_CC/label.cc \
+             $$CPU_CC/memory_flags.cc \
              $$CPU_CC/test_cpu.cc \
              $$CPU_CC/test_util.cc
 }
Index: avida/current/source/event/event.pri
diff -u avida/current/source/event/event.pri:1.2 avida/current/source/event/event.pri:1.3
--- avida/current/source/event/event.pri:1.2	Sat May 17 02:48:08 2003
+++ avida/current/source/event/event.pri	Tue Nov 25 10:20:44 2003
@@ -10,5 +10,9 @@
              $$EVENT_CC/event_factory.cc \
              $$EVENT_CC/event_factory_manager.cc \
              $$EVENT_CC/event_list.cc \
+             $$EVENT_CC/event_list_entry.cc \
+             $$EVENT_CC/event_list_iterator.cc \
+             $$EVENT_CC/event_triggers.cc \
+             $$EVENT_CC/population_event.cc \
              $$EVENT_CC/population_event_factory.cc
 }
Index: avida/current/source/main/main_sub.pri
diff -u avida/current/source/main/main_sub.pri:1.5 avida/current/source/main/main_sub.pri:1.6
--- avida/current/source/main/main_sub.pri:1.5	Tue Aug 19 12:41:52 2003
+++ avida/current/source/main/main_sub.pri	Tue Nov 25 10:20:44 2003
@@ -1,6 +1,7 @@
 
 main {
-  HEADERS += $$MAIN_HH/analyze.hh \
+  HEADERS += \
+             $$MAIN_HH/analyze.hh \
              $$MAIN_HH/analyze_util.hh \
              $$MAIN_HH/avida.hh \
              $$MAIN_HH/birth_chamber.hh \
@@ -12,32 +13,36 @@
              $$MAIN_HH/genome.hh \
              $$MAIN_HH/genome_util.hh \
              $$MAIN_HH/genotype.hh \
-	     $$MAIN_HH/inject_genotype.hh \
-	     $$MAIN_HH/inject_genebank.hh \
-             $$MAIN_HH/inst.hh \
-             $$MAIN_HH/inst_lib.hh \
+             $$MAIN_HH/inject_genotype.hh \
+             $$MAIN_HH/inject_genebank.hh \
+             $$MAIN_HH/instruction.hh \
+             $$MAIN_HH/inst_lib_base.hh \
              $$MAIN_HH/inst_set.hh \
              $$MAIN_HH/inst_util.hh \
              $$MAIN_HH/landscape.hh \
              $$MAIN_HH/lineage.hh \
              $$MAIN_HH/lineage_control.hh \
-             $$MAIN_HH/mutations.hh \
              $$MAIN_HH/organism.hh \
              $$MAIN_HH/phenotype.hh \
-             $$MAIN_HH/pop_interface.hh \
+             $$MAIN_HH/population_interface.hh \
              $$MAIN_HH/population.hh \
              $$MAIN_HH/population_cell.hh \
              $$MAIN_HH/reaction.hh \
              $$MAIN_HH/reaction_result.hh \
              $$MAIN_HH/resource.hh \
              $$MAIN_HH/resource_count.hh \
+             $$MAIN_HH/resource_lib.hh \
              $$MAIN_HH/species.hh \
-             $$MAIN_HH/stats.hh \
-             $$MAIN_HH/tasks.hh
+             $$MAIN_HH/stats.hh
 
-  SOURCES += $$MAIN_CC/analyze.cc \
+  SOURCES += \
+             $$MAIN_CC/analyze.cc \
              $$MAIN_CC/analyze_util.cc \
+             $$MAIN_CC/analyze_genotype.cc \
              $$MAIN_CC/avida.cc \
+             $$MAIN_CC/avida_driver_analyze.cc \
+             $$MAIN_CC/avida_driver_base.cc \
+             $$MAIN_CC/avida_driver_population.cc \
              $$MAIN_CC/birth_chamber.cc \
              $$MAIN_CC/callback_util.cc \
              $$MAIN_CC/config.cc \
@@ -47,25 +52,44 @@
              $$MAIN_CC/genome.cc \
              $$MAIN_CC/genome_util.cc \
              $$MAIN_CC/genotype.cc \
-             $$MAIN_CC/inst.cc \
+             $$MAIN_CC/genotype_birth_data.cc \
+             $$MAIN_CC/genotype_control.cc \
+             $$MAIN_CC/genotype_test_data.cc \
+             $$MAIN_CC/instruction.cc \
              $$MAIN_CC/inst_set.cc \
              $$MAIN_CC/inst_util.cc \
-	     $$MAIN_CC/inject_genebank.cc \
-	     $$MAIN_CC/inject_genotype.cc \
+             $$MAIN_CC/inject_genebank.cc \
+             $$MAIN_CC/inject_genotype.cc \
+             $$MAIN_CC/inject_genotype_birth_data.cc \
+             $$MAIN_CC/inject_genotype_control.cc \
+             $$MAIN_CC/inject_genotype_queue.cc \
              $$MAIN_CC/landscape.cc \
              $$MAIN_CC/lineage.cc \
              $$MAIN_CC/lineage_control.cc \
-             $$MAIN_CC/mutations.cc \
+             $$MAIN_CC/local_mutations.cc \
+             $$MAIN_CC/mutation_lib.cc \
+             $$MAIN_CC/mutation_rates.cc \
+             $$MAIN_CC/mutation.cc \
+             $$MAIN_CC/mx_code_array.cc \
              $$MAIN_CC/organism.cc \
              $$MAIN_CC/phenotype.cc \
-             $$MAIN_CC/pop_interface.cc \
+             $$MAIN_CC/population_interface.cc \
              $$MAIN_CC/population.cc \
              $$MAIN_CC/population_cell.cc \
              $$MAIN_CC/reaction.cc \
+             $$MAIN_CC/reaction_lib.cc \
+             $$MAIN_CC/reaction_process.cc \
+             $$MAIN_CC/reaction_requisite.cc \
              $$MAIN_CC/reaction_result.cc \
              $$MAIN_CC/resource.cc \
              $$MAIN_CC/resource_count.cc \
+             $$MAIN_CC/resource_lib.cc \
+             $$MAIN_CC/spatial_count_elem.cc \
+             $$MAIN_CC/spatial_res_count.cc \
              $$MAIN_CC/species.cc \
+             $$MAIN_CC/species_control.cc \
+             $$MAIN_CC/species_queue.cc \
              $$MAIN_CC/stats.cc \
-             $$MAIN_CC/tasks.cc
+             $$MAIN_CC/task_entry.cc \
+             $$MAIN_CC/task_lib.cc
 }
Index: avida/current/source/qt-viewer/Makefile.am
diff -u avida/current/source/qt-viewer/Makefile.am:1.49 avida/current/source/qt-viewer/Makefile.am:1.50
--- avida/current/source/qt-viewer/Makefile.am:1.49	Tue Aug 26 17:15:38 2003
+++ avida/current/source/qt-viewer/Makefile.am	Tue Nov 25 10:20:44 2003
@@ -5,45 +5,51 @@
 
 QMAKE_OPTIONS=
 
-#if QMAKE_DEBUG
-#QMAKE_OPTIONS+="CONFIG*=debug"
-#endif
-#
-#if QMAKE_WARN
-#QMAKE_OPTIONS+="CONFIG*=warn-on"
-#else
-#QMAKE_OPTIONS+="CONFIG*=warn-off"
-#endif
+if QMAKE_DEBUG
+QMAKE_OPTIONS+="CONFIG*=debug"
+else
+QMAKE_OPTIONS+="DEFINES+=NDEBUG"
+endif
+
+
+if QMAKE_WARN
+QMAKE_OPTIONS+="CONFIG*=warn-on"
+else
+QMAKE_OPTIONS+="CONFIG*=warn-off"
+endif
 
 QMAKE_OPTIONS+="AT_SRCDIR=$(srcdir)"
 QMAKE_OPTIONS+="AT_BINDIR=$(bindir)"
 #QMAKE_OPTIONS+="AT_HTMLDIR=$(HTMLDIR)"
 QMAKE_OPTIONS+="AT_DATADIR=$(datadir)"
 QMAKE_OPTIONS+="AT_PWD=`pwd`"
+QMAKE_OPTIONS+="DEFINES+=DEBUG"
+
+SUFFIXES = .cc
 
-qt-viewer.qmakefile: qt-viewer.pro Makefile.am
+$(bin_PROGRAMS:%=%.qmakefile): Makefile
+.pro.qmakefile:
 	test x$(QMAKE) = x && (echo "can't continue; QMAKE unset."; exit 1) \
 	|| $(QMAKE) $(QMAKE_OPTIONS) -o $@ $<
-cPopulation_enums_auto.ci: $(srcdir)/../event/cPopulation.events
-	perl $(srcdir)/../event/make_events.pl $(<:%.events=%)
-qt-viewer: qt-viewer.qmakefile cPopulation_enums_auto.ci FORCE
-	echo "srcdir: $(srcdir)"
-	${MAKE} -f qt-viewer.qmakefile
-.PHONY: FORCE
-
-mostlyclean-local:
+mostlyclean-local: $(bin_PROGRAMS:%=%.qmakefile)
+	for file in $<; do echo $$file; done
 	make -f qt-viewer.qmakefile clean
-clean-local:
+clean-local: $(bin_PROGRAMS:%=%.qmakefile)
+	for file in $<; do echo $$file; done
 	make -f qt-viewer.qmakefile distclean
 distclean-local:
 	rm -f qt-viewer.qmakefile
-#install-exec-local:
-#	make -f qt-viewer.qmakefile install
-#uninstall-local:
-#	make -f qt-viewer.qmakefile uninstall
+.PHONY: FORCE
 
-bin_PROGRAMS = qt-viewer
-qt_viewer_SOURCES =
+cPopulation_enums_auto.ci: $(srcdir)/../event/cPopulation.events
+	perl $(srcdir)/../event/make_events.pl $(<:%.events=%)
+
+avida: avida.qmakefile cPopulation_enums_auto.ci FORCE
+	${MAKE} -f avida.qmakefile
+qt-viewer: qt-viewer.qmakefile cPopulation_enums_auto.ci FORCE
+	${MAKE} -f qt-viewer.qmakefile
+
+bin_PROGRAMS = qt-viewer avida
 
 CLEANFILES = cPopulation_enums_auto.ci 		\
 	cPopulation_name2enum_auto.ci  		\
@@ -174,3 +180,38 @@
             setup_wizard_page.cc \
             setup_wizard_page2.cc
 
+SOURCE_DIR = $(srcdir)/..
+INCLUDES = \
+	-I$(SOURCE_DIR) \
+	-I$(SOURCE_DIR)/event \
+	-I$(SOURCE_DIR)/cpu \
+	-I$(SOURCE_DIR)/tools \
+	-I$(SOURCE_DIR)/main \
+	-I$(SOURCE_DIR)/third-party \
+  -I$(QTDIR)/include
+
+BLD_DIR = ..
+UNITTEST_LIBS = \
+	$(BLD_DIR)/event/libevent.a \
+	$(BLD_DIR)/cpu/libcpu.a \
+	$(BLD_DIR)/tools/libtools.a \
+	$(BLD_DIR)/main/libmain.a \
+	$(BLD_DIR)/third-party/trio/libtrio.a \
+  $(BLD_DIR)/third-party/yaktest/libyaktest.a \
+  $(BLD_DIR)/third-party/mockpp/libmockpp.a \
+  $(BLD_DIR)/third-party/mockpp/compat/libcompat.a \
+  $(BLD_DIR)/third-party/mockpp/util/libutil.a \
+  -L$(QTDIR)/lib -lqt-mt
+
+LINK = $(CXXLINK)
+LDADD = $(UNITTEST_LIBS)
+.cc.o:
+	$(QTDIR)/bin/moc $< -o $(<:%.cc=%.moc)
+	$(CXXCOMPILE) -c $<
+template_t_SOURCES = template.t.cc
+
+check_PROGRAMS = $(TESTSUITES)
+TESTS = $(TESTSUITES)
+
+TESTSUITES = \
+  template.t
Index: avida/current/source/qt-viewer/apocalypse_widget.cc
diff -u avida/current/source/qt-viewer/apocalypse_widget.cc:1.8 avida/current/source/qt-viewer/apocalypse_widget.cc:1.9
--- avida/current/source/qt-viewer/apocalypse_widget.cc:1.8	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/apocalypse_widget.cc	Tue Nov 25 10:20:45 2003
@@ -13,10 +13,10 @@
 #include <qstring.h>
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #include "avd_rate_validator2.hh"
Index: avida/current/source/qt-viewer/avd_avida_driver.cc
diff -u avida/current/source/qt-viewer/avd_avida_driver.cc:1.3 avida/current/source/qt-viewer/avd_avida_driver.cc:1.4
--- avida/current/source/qt-viewer/avd_avida_driver.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_avida_driver.cc	Tue Nov 25 10:20:45 2003
@@ -1,10 +1,10 @@
 
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef AVD_AVIDA_DRIVER_HH
@@ -19,10 +19,10 @@
 #endif
 
 #ifndef CONFIG_HH
-#include "../main/config.hh"
+#include "config.hh"
 #endif
 #ifndef POPULATION_HH
-#include "../main/population.hh"
+#include "population.hh"
 #endif
 
 #ifndef QAPPLICATION_H
Index: avida/current/source/qt-viewer/avd_avida_driver.hh
diff -u avida/current/source/qt-viewer/avd_avida_driver.hh:1.3 avida/current/source/qt-viewer/avd_avida_driver.hh:1.4
--- avida/current/source/qt-viewer/avd_avida_driver.hh:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_avida_driver.hh	Tue Nov 25 10:20:45 2003
@@ -4,7 +4,16 @@
 
 
 #ifndef AVIDA_HH
-#include "../main/avida.hh"
+#include "avida.hh"
+#endif
+#ifndef AVIDA_DRIVER_ANALYZE_HH
+#include "avida_driver_analyze.hh"
+#endif
+#ifndef AVIDA_DRIVER_BASE_HH
+#include "avida_driver_base.hh"
+#endif
+#ifndef AVIDA_DRIVER_POPULATION_HH
+#include "avida_driver_population.hh"
 #endif
  
 #ifndef QGUARDEDPTR_H
Index: avida/current/source/qt-viewer/avd_driver_controller.cc
diff -u avida/current/source/qt-viewer/avd_driver_controller.cc:1.3 avida/current/source/qt-viewer/avd_driver_controller.cc:1.4
--- avida/current/source/qt-viewer/avd_driver_controller.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_driver_controller.cc	Tue Nov 25 10:20:45 2003
@@ -12,19 +12,16 @@
 #endif
  
 #ifndef AVIDA_HH
-#include "../main/avida.hh"
+#include "avida.hh"
 #endif
 #ifndef CONFIG_HH
-#include "../main/config.hh"
-#endif
-#ifndef HARDWARE_METHOD_HH
-#include "../cpu/hardware_method.hh"
+#include "config.hh"
 #endif
 #ifndef ENVIRONMENT_HH
-#include "../main/environment.hh"
+#include "environment.hh"
 #endif
 #ifndef POPULATION_HH
-#include "../main/population.hh"
+#include "population.hh"
 #endif
 #ifndef AVD_AVIDA_DRIVER_HH
 #include "avd_avida_driver.hh"
@@ -47,10 +44,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_event_viewer_controller.cc
diff -u avida/current/source/qt-viewer/avd_event_viewer_controller.cc:1.3 avida/current/source/qt-viewer/avd_event_viewer_controller.cc:1.4
--- avida/current/source/qt-viewer/avd_event_viewer_controller.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_event_viewer_controller.cc	Tue Nov 25 10:20:45 2003
@@ -23,10 +23,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_godbox_controller.cc
diff -u avida/current/source/qt-viewer/avd_godbox_controller.cc:1.3 avida/current/source/qt-viewer/avd_godbox_controller.cc:1.4
--- avida/current/source/qt-viewer/avd_godbox_controller.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_godbox_controller.cc	Tue Nov 25 10:20:45 2003
@@ -17,10 +17,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_help_controller.cc
diff -u avida/current/source/qt-viewer/avd_help_controller.cc:1.3 avida/current/source/qt-viewer/avd_help_controller.cc:1.4
--- avida/current/source/qt-viewer/avd_help_controller.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_help_controller.cc	Tue Nov 25 10:20:45 2003
@@ -26,13 +26,13 @@
 
 
 #ifndef DEFS_HH
-#include "../defs.hh"
+#include "defs.hh"
 #endif
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_help_viewer.cc
diff -u avida/current/source/qt-viewer/avd_help_viewer.cc:1.3 avida/current/source/qt-viewer/avd_help_viewer.cc:1.4
--- avida/current/source/qt-viewer/avd_help_viewer.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_help_viewer.cc	Tue Nov 25 10:20:45 2003
@@ -37,10 +37,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc
diff -u avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc:1.4 avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc:1.5
--- avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc:1.4	Thu Oct 16 09:15:17 2003
+++ avida/current/source/qt-viewer/avd_instruction_viewer_controller.cc	Tue Nov 25 10:20:45 2003
@@ -18,10 +18,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_main_window.cc
diff -u avida/current/source/qt-viewer/avd_main_window.cc:1.3 avida/current/source/qt-viewer/avd_main_window.cc:1.4
--- avida/current/source/qt-viewer/avd_main_window.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_main_window.cc	Tue Nov 25 10:20:45 2003
@@ -8,8 +8,8 @@
 
 //#include "main_window.hh"
 //
-//#include "../defs.hh"
-//#include "../main/config.hh"
+//#include "defs.hh"
+//#include "config.hh"
 //
 //#include "init_file_view.hh"
 #include "map_view.hh"
@@ -67,10 +67,10 @@
 #endif
   
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
@@ -565,8 +565,8 @@
 //
 //#include "main_window.hh"
 //
-//#include "../defs.hh"
-//#include "../main/config.hh"
+//#include "defs.hh"
+//#include "config.hh"
 //
 //#include "init_file_view.hh"
 //#include "map_view.hh"
Index: avida/current/source/qt-viewer/avd_main_window_controller.cc
diff -u avida/current/source/qt-viewer/avd_main_window_controller.cc:1.3 avida/current/source/qt-viewer/avd_main_window_controller.cc:1.4
--- avida/current/source/qt-viewer/avd_main_window_controller.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_main_window_controller.cc	Tue Nov 25 10:20:45 2003
@@ -20,10 +20,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_message_display.cc
diff -u avida/current/source/qt-viewer/avd_message_display.cc:1.2 avida/current/source/qt-viewer/avd_message_display.cc:1.3
--- avida/current/source/qt-viewer/avd_message_display.cc:1.2	Wed Sep 24 01:12:04 2003
+++ avida/current/source/qt-viewer/avd_message_display.cc	Tue Nov 25 10:20:45 2003
@@ -13,7 +13,7 @@
 #endif
 
 #ifndef TRIO_TRIO_H
-#include "third-party/trio-1.9/trio.h"
+#include "third-party/trio/trio.h"
 #endif
 
 #ifndef AVD_MESSAGE_DISPLAY_HH
Index: avida/current/source/qt-viewer/avd_mission_control.cc
diff -u avida/current/source/qt-viewer/avd_mission_control.cc:1.3 avida/current/source/qt-viewer/avd_mission_control.cc:1.4
--- avida/current/source/qt-viewer/avd_mission_control.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_mission_control.cc	Tue Nov 25 10:20:45 2003
@@ -46,10 +46,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_plot_viewer_controller.cc
diff -u avida/current/source/qt-viewer/avd_plot_viewer_controller.cc:1.3 avida/current/source/qt-viewer/avd_plot_viewer_controller.cc:1.4
--- avida/current/source/qt-viewer/avd_plot_viewer_controller.cc:1.3	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_plot_viewer_controller.cc	Tue Nov 25 10:20:45 2003
@@ -26,10 +26,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/avd_rate_validator2.cc
diff -u avida/current/source/qt-viewer/avd_rate_validator2.cc:1.6 avida/current/source/qt-viewer/avd_rate_validator2.cc:1.7
--- avida/current/source/qt-viewer/avd_rate_validator2.cc:1.6	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/avd_rate_validator2.cc	Tue Nov 25 10:20:45 2003
@@ -11,10 +11,10 @@
 #include <qstring.h>
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #include "avd_rate_validator2.hh"
Index: avida/current/source/qt-viewer/avida_data.cc
diff -u avida/current/source/qt-viewer/avida_data.cc:1.9 avida/current/source/qt-viewer/avida_data.cc:1.10
--- avida/current/source/qt-viewer/avida_data.cc:1.9	Sat May 17 02:48:10 2003
+++ avida/current/source/qt-viewer/avida_data.cc	Tue Nov 25 10:20:45 2003
@@ -1,9 +1,8 @@
 
 #include "avida_data.hh"
 
-#include "../cpu/hardware_method.hh"
-#include "../main/population.hh"
-#include "../main/stats.hh"
+#include "population.hh"
+#include "stats.hh"
 
 
 using namespace std;
Index: avida/current/source/qt-viewer/avida_plot_widget.cc
diff -u avida/current/source/qt-viewer/avida_plot_widget.cc:1.13 avida/current/source/qt-viewer/avida_plot_widget.cc:1.14
--- avida/current/source/qt-viewer/avida_plot_widget.cc:1.13	Sun May 18 19:07:59 2003
+++ avida/current/source/qt-viewer/avida_plot_widget.cc	Tue Nov 25 10:20:45 2003
@@ -1,10 +1,12 @@
 
 #include "avida_plot_widget.hh"
 
-#include "../tools/file.hh"
-#include "../cpu/hardware_method.hh"
-#include "../main/population.hh"
-#include "../main/stats.hh"
+#include "file.hh"
+#ifndef INIT_FILE_HH
+#include "init_file.hh"
+#endif
+#include "population.hh"
+#include "stats.hh"
 
 #include <qmenubar.h>
 #include <qpopupmenu.h>
@@ -15,10 +17,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/event_view_widget.cc
diff -u avida/current/source/qt-viewer/event_view_widget.cc:1.14 avida/current/source/qt-viewer/event_view_widget.cc:1.15
--- avida/current/source/qt-viewer/event_view_widget.cc:1.14	Sun May 18 19:08:00 2003
+++ avida/current/source/qt-viewer/event_view_widget.cc	Tue Nov 25 10:20:45 2003
@@ -17,14 +17,18 @@
 
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
 
 #ifndef INIT_FILE_HH
-#include "../tools/file.hh"
+#include "file.hh"
 #endif
 
-#include "../event/event_list.hh"
+#ifndef INIT_FILE_HH
+#include "init_file.hh"
+#endif
+
+#include "event_list.hh"
 //#include <sstream>
 #include <strstream>
 #include <qstringlist.h>
@@ -51,10 +55,10 @@
 #include "cPopulation_descr.hi"
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/godbox_widget2.cc
diff -u avida/current/source/qt-viewer/godbox_widget2.cc:1.13 avida/current/source/qt-viewer/godbox_widget2.cc:1.14
--- avida/current/source/qt-viewer/godbox_widget2.cc:1.13	Sat May 17 14:23:26 2003
+++ avida/current/source/qt-viewer/godbox_widget2.cc	Tue Nov 25 10:20:45 2003
@@ -26,15 +26,17 @@
 #include <qstatusbar.h>
 
 
-#include "../main/config.hh"
-#include "../cpu/hardware_method.hh"
-#include "../main/environment.hh"
-#include "../event/event_list.hh"
-#include "../main/genome.hh"
-#include "../main/inst_util.hh"
-#include "../main/population.hh"
-#include "../main/population_cell.hh"
-#include "../tools/string.hh"
+#include "config.hh"
+#include "environment.hh"
+#include "event_list.hh"
+#include "genome.hh"
+#include "inst_util.hh"
+#include "population.hh"
+#include "population_cell.hh"
+#include "string.hh"
+#ifndef TOOLS_HH
+#include "tools.hh"
+#endif
 
 #include "apocalypse_widget.hh"
 #include "avd_rate_slider2.hh"
@@ -51,10 +53,10 @@
 #include "godbox_widget2.hh"
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/gui_message_display.cc
diff -u avida/current/source/qt-viewer/gui_message_display.cc:1.8 avida/current/source/qt-viewer/gui_message_display.cc:1.9
--- avida/current/source/qt-viewer/gui_message_display.cc:1.8	Sat May 17 12:33:56 2003
+++ avida/current/source/qt-viewer/gui_message_display.cc	Tue Nov 25 10:20:45 2003
@@ -6,10 +6,10 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #include <qstring.h>
Index: avida/current/source/qt-viewer/map_view.cc
diff -u avida/current/source/qt-viewer/map_view.cc:1.12 avida/current/source/qt-viewer/map_view.cc:1.13
--- avida/current/source/qt-viewer/map_view.cc:1.12	Tue Jun 24 13:40:48 2003
+++ avida/current/source/qt-viewer/map_view.cc	Tue Nov 25 10:20:45 2003
@@ -1,7 +1,7 @@
 
 #include "map_view.hh"
 
-#include "../main/config.hh"
+#include "config.hh"
 #include "avd_mission_control.hh"
 
 #include "map_view_widget.hh"
Index: avida/current/source/qt-viewer/map_view_cell_entry.cc
diff -u avida/current/source/qt-viewer/map_view_cell_entry.cc:1.14 avida/current/source/qt-viewer/map_view_cell_entry.cc:1.15
--- avida/current/source/qt-viewer/map_view_cell_entry.cc:1.14	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/map_view_cell_entry.cc	Tue Nov 25 10:20:45 2003
@@ -1,14 +1,13 @@
 
 #include "map_view_cell_entry.hh"
 
-#include "../cpu/hardware_method.hh"
-#include "../main/population.hh"
-#include "../main/stats.hh"
-#include "../main/population_cell.hh"
-#include "../main/genotype.hh"
-#include "../main/genebank.hh"
-#include "../main/phenotype.hh"
-#include "../main/organism.hh"
+#include "population.hh"
+#include "stats.hh"
+#include "population_cell.hh"
+#include "genotype.hh"
+#include "genebank.hh"
+#include "phenotype.hh"
+#include "organism.hh"
 
 #include "avd_mission_control.hh"
 
Index: avida/current/source/qt-viewer/map_view_widget.cc
diff -u avida/current/source/qt-viewer/map_view_widget.cc:1.14 avida/current/source/qt-viewer/map_view_widget.cc:1.15
--- avida/current/source/qt-viewer/map_view_widget.cc:1.14	Tue Jun 24 13:40:48 2003
+++ avida/current/source/qt-viewer/map_view_widget.cc	Tue Nov 25 10:20:45 2003
@@ -1,11 +1,12 @@
 
 #include "map_view_widget.hh"
 
-#include "../main/config.hh"
-#include "../cpu/hardware_method.hh"
-#include "../main/population.hh"
+#include "config.hh"
+#include "population.hh"
 
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
+#endif
 #include "avd_mission_control.hh"
 
 #include <iostream>
Index: avida/current/source/qt-viewer/messaging_population_wrapper.cc
diff -u avida/current/source/qt-viewer/messaging_population_wrapper.cc:1.8 avida/current/source/qt-viewer/messaging_population_wrapper.cc:1.9
--- avida/current/source/qt-viewer/messaging_population_wrapper.cc:1.8	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/messaging_population_wrapper.cc	Tue Nov 25 10:20:45 2003
@@ -13,10 +13,10 @@
 #include "avd_message_queue.hh"
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 using namespace std;
Index: avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc:1.10 avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc:1.11
--- avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc:1.10	Thu Oct 16 09:15:17 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_buttons_widget.cc	Tue Nov 25 10:20:45 2003
@@ -17,13 +17,13 @@
 
 #include <fstream>
 
-#include "../main/genotype.hh"
+#include "genotype.hh"
 #include "avd_mission_control.hh"
 #include "population_cell_wrapped_accessors.hh"
-#include "../cpu/test_util.hh"
+#include "test_util.hh"
 
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef N_ORIG_INSTRUCTION_BUTTONS_WIDGET_HH
Index: avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.22 avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.23
--- avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.22	Thu Oct 16 09:15:17 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc	Tue Nov 25 10:20:45 2003
@@ -1,10 +1,57 @@
 //////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology             //
+// 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.     //
 //////////////////////////////////////////////////////////////////////////////
 
+#ifndef AVD_MISSION_CONTROL_HH
+#include "avd_mission_control.hh"
+#endif
+#ifndef N_ORIG_INSTRUCTION_CPU_WIDGET_HH
+#include "n_orig_instruction_cpu_widget.hh"
+#endif
+#ifndef POPULATION_CELL_WRAPPED_ACCESSORS_H
+#include "population_cell_wrapped_accessors.hh"
+#endif
+
+#ifndef CONFIG_HH
+#include "config.hh"
+#endif
+#ifndef ENVIRONMENT_HH
+#include "environment.hh"
+#endif
+#ifndef GENOTYPE_HH
+#include "genotype.hh"
+#endif
+#ifndef HARDWARE_CPU_HH
+#include "hardware_cpu.hh"
+#endif
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
+#endif
+#ifndef ORGANISM_HH
+#include "organism.hh"
+#endif
+#ifndef PHENOTYPE_HH
+#include "phenotype.hh"
+#endif
+#ifndef POPULATION_HH
+#include "population.hh"
+#endif
+#ifndef POPULATION_CELL_HH
+#include "population_cell.hh"
+#endif
+#ifndef TASK_ENTRY_HH
+#include "task_entry.hh"
+#endif
+#ifndef SPECIES_HH
+#include "species.hh"
+#endif
+#ifndef STRING_HH
+#include "string.hh"
+#endif
+
 #ifndef QAPPLICATION_H
 #include <qapplication.h>
 #endif
@@ -39,42 +86,9 @@
 #include <qwidgetstack.h>
 #endif
 
-#include "avd_mission_control.hh"
-
-#ifndef STRING_HH
-#include "../tools/string.hh"
-#endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
-#endif
-
-#ifndef N_ORIG_INSTRUCTION_CPU_WIDGET_HH
-#include "n_orig_instruction_cpu_widget.hh"
-#endif
-
-#ifndef POPULATION_CELL_WRAPPED_ACCESSORS_H
-#include "population_cell_wrapped_accessors.hh"
-#endif
-
 #include <fstream>
 #include <iostream>
 
-#include "../main/genotype.hh"
-#include "../cpu/hardware_method.hh"
-#include "../cpu/hardware_cpu.hh"
-#include "../main/organism.hh"
-#include "../main/phenotype.hh"
-#include "../main/population.hh"
-#include "../main/population_cell.hh"
-#ifndef TASKS_HH
-#include "../main/tasks.h"
-#endif
-#ifndef CONFIG_HH
-#include "../main/config.hh"
-#endif
-#ifndef SPECIES_HH
-#include "../main/species.hh"
-#endif
 
 using namespace std;
 
Index: avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc:1.8 avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc:1.9
--- avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc:1.8	Sat May 17 14:54:55 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_line_widget.cc	Tue Nov 25 10:20:45 2003
@@ -12,9 +12,8 @@
 #include <qlayout.h>
 #include "n_orig_instruction_field_widget.hh"
 
-#include "../cpu/hardware_method.hh"
-#include "../main/inst_set.hh"
-#include "../cpu/hardware_cpu.hh"
+#include "inst_set.hh"
+#include "hardware_cpu.hh"
 
 #include "n_orig_instruction_line_widget.hh"
 #include "n_orig_instruction_scrollview.hh"
Index: avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh:1.4 avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh:1.5
--- avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh:1.4	Sat May 17 14:23:26 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_line_widget.hh	Tue Nov 25 10:20:45 2003
@@ -13,7 +13,7 @@
 
 #include "n_orig_instruction_pixmapstructs.hh"
 
-#include "../main/inst.hh"
+#include "instruction.hh"
 
 
 class QLabel;
Index: avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc:1.10 avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc:1.11
--- avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc:1.10	Sat May 17 14:54:55 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_scrollview.cc	Tue Nov 25 10:20:45 2003
@@ -13,18 +13,17 @@
 #include <qapplication.h>
 #include <qcommonstyle.h>
 
-#include "../cpu/hardware_method.hh"
-#include "../main/inst_set.hh"
+#include "inst_set.hh"
 
 #include "n_orig_instruction_line_widget.hh"
 
 #include "n_orig_instruction_scrollview.hh"
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh
diff -u avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh:1.4 avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh:1.5
--- avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh:1.4	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_scrollview.hh	Tue Nov 25 10:20:45 2003
@@ -13,7 +13,7 @@
 #include <qguardedptr.h>
 #include <qmap.h>
 
-#include "../defs.hh"
+#include "defs.hh"
 
 #include "n_orig_instruction_scrollview_config.hh"
 #include "n_orig_instruction_pixmapstructs.hh"
Index: avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc:1.10 avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc:1.11
--- avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc:1.10	Wed Aug 27 03:22:22 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_view_widget.cc	Tue Nov 25 10:20:45 2003
@@ -15,13 +15,15 @@
 #include "avd_mission_control.hh"
 #include "n_orig_instruction_scrollview.hh"
 #include "n_orig_instruction_line_widget.hh"
-#include "../cpu/hardware_method.hh"
-#include "../main/inst_set.hh"
-#include "../cpu/hardware_cpu.hh"
+#include "inst_set.hh"
+#include "hardware_cpu.hh"
 #include "population_cell_wrapped_accessors.hh"
 
 #include "n_orig_instruction_view_widget.hh"
 
+#ifndef FUNCTIONS_HH
+#include "functions.hh"
+#endif
 
 #ifndef DEBUG
 # define LOCAL_DEBUG 0
Index: avida/current/source/qt-viewer/n_orig_instruction_viewer.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_viewer.cc:1.7 avida/current/source/qt-viewer/n_orig_instruction_viewer.cc:1.8
--- avida/current/source/qt-viewer/n_orig_instruction_viewer.cc:1.7	Wed Aug 27 03:22:22 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_viewer.cc	Tue Nov 25 10:20:45 2003
@@ -30,10 +30,10 @@
 
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 
Index: avida/current/source/qt-viewer/population_cell_wrapped_accessors.cc
diff -u avida/current/source/qt-viewer/population_cell_wrapped_accessors.cc:1.7 avida/current/source/qt-viewer/population_cell_wrapped_accessors.cc:1.8
--- avida/current/source/qt-viewer/population_cell_wrapped_accessors.cc:1.7	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/population_cell_wrapped_accessors.cc	Tue Nov 25 10:20:45 2003
@@ -14,10 +14,9 @@
 #ifndef AVD_MISSION_CONTROL_HH
 #include "avd_mission_control.hh"
 #endif
-#include "../cpu/hardware_method.hh"
-#include "../main/population_cell.hh"
-#include "../main/population.hh"
-#include "../main/organism.hh"
+#include "population_cell.hh"
+#include "population.hh"
+#include "organism.hh"
 
 
 using namespace std;
Index: avida/current/source/qt-viewer/population_cell_wrapper.cc
diff -u avida/current/source/qt-viewer/population_cell_wrapper.cc:1.5 avida/current/source/qt-viewer/population_cell_wrapper.cc:1.6
--- avida/current/source/qt-viewer/population_cell_wrapper.cc:1.5	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/population_cell_wrapper.cc	Tue Nov 25 10:20:45 2003
@@ -5,9 +5,8 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#include "../cpu/hardware_method.hh"
-#include "../main/population_cell.hh"
-#include "../main/population.hh"
+#include "population_cell.hh"
+#include "population.hh"
 #include "messaging_population_wrapper.hh"
 
 #include "population_cell_wrapper.hh"
Index: avida/current/source/qt-viewer/setup_avida.cc
diff -u avida/current/source/qt-viewer/setup_avida.cc:1.24 avida/current/source/qt-viewer/setup_avida.cc:1.25
--- avida/current/source/qt-viewer/setup_avida.cc:1.24	Tue Aug 26 17:15:38 2003
+++ avida/current/source/qt-viewer/setup_avida.cc	Tue Nov 25 10:20:45 2003
@@ -12,17 +12,16 @@
 #include <sys/stat.h>
 #include <signal.h>
 
-#include "../main/avida.hh"
-#include "../main/callback_util.hh"
-#include "../main/config.hh"
-#include "../cpu/hardware_method.hh"
-#include "../main/environment.hh"
-#include "../main/population.hh"
-#include "../cpu/test_cpu.hh"
-#include "../cpu/hardware_util.hh"
+#include "avida.hh"
+#include "callback_util.hh"
+#include "config.hh"
+#include "environment.hh"
+#include "population.hh"
+#include "test_cpu.hh"
+#include "hardware_util.hh"
 /* FIXME beware of hardwiring. -- kgn */
-#include "../cpu/hardware_cpu.hh"
-#include "../cpu/hardware_4stack.hh"
+#include "hardware_cpu.hh"
+#include "hardware_4stack.hh"
 /* XXX */
 
 #include <qapplication.h>
Index: avida/current/source/qt-viewer/setup_file.cc
diff -u avida/current/source/qt-viewer/setup_file.cc:1.5 avida/current/source/qt-viewer/setup_file.cc:1.6
--- avida/current/source/qt-viewer/setup_file.cc:1.5	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/setup_file.cc	Tue Nov 25 10:20:45 2003
@@ -6,10 +6,10 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_FILE_HH
Index: avida/current/source/qt-viewer/setup_genesis.cc
diff -u avida/current/source/qt-viewer/setup_genesis.cc:1.11 avida/current/source/qt-viewer/setup_genesis.cc:1.12
--- avida/current/source/qt-viewer/setup_genesis.cc:1.11	Tue May 20 07:42:28 2003
+++ avida/current/source/qt-viewer/setup_genesis.cc	Tue Nov 25 10:20:45 2003
@@ -8,11 +8,14 @@
 #include <qdir.h>
 #include <qfile.h>
 
+#ifndef GENESIS_HH
+#include "genesis.hh"
+#endif
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_GENESIS_HH
@@ -23,7 +26,7 @@
 #include "setup_wizard_constants.hh"
 #endif
 
-#include "../tools/file.hh"
+#include "file.hh"
 
 
 using namespace std;
Index: avida/current/source/qt-viewer/setup_wizard.cc
diff -u avida/current/source/qt-viewer/setup_wizard.cc:1.13 avida/current/source/qt-viewer/setup_wizard.cc:1.14
--- avida/current/source/qt-viewer/setup_wizard.cc:1.13	Tue May 20 07:42:29 2003
+++ avida/current/source/qt-viewer/setup_wizard.cc	Tue Nov 25 10:20:45 2003
@@ -5,38 +5,47 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.
 //////////////////////////////////////////////////////////////////////////////
 
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <qfile.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
+#ifndef SETUP_WIZARD_HH
+#include "setup_wizard.hh"
+#endif
 
-#ifndef STRING_HH
-#include "../tools/string.hh"
+#ifndef GENESIS_HH
+#include "genesis.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
-
 #ifndef SETUP_FILE_HH
 #include "setup_file.hh"
 #endif
-
-#ifndef SETUP_WIZARD_HH
-#include "setup_wizard.hh"
-#endif
-
 #ifndef SETUP_WIZARD_PAGE_HH
 #include "setup_wizard_page.hh"
 #endif
-
 #ifndef SETUP_WIZARD_CONFIG_HH
 #include "setup_wizard_config.hh"
 #endif
+#ifndef STRING_HH
+#include "string.hh"
+#endif
 
+#ifndef QFILE_H
+#include <qfile.h>
+#endif
+#ifndef QLABEL_H
+#include <qlabel.h>
+#endif
+#ifndef QLAYOUT_H
+#include <qlayout.h>
+#endif
+#ifndef QLINEEDIT_H
+#include <qlineedit.h>
+#endif
+#ifndef QPUSHBUTTON_H
+#include <qpushbutton.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
 
 using namespace std;
 
Index: avida/current/source/qt-viewer/setup_wizard2.cc
diff -u avida/current/source/qt-viewer/setup_wizard2.cc:1.8 avida/current/source/qt-viewer/setup_wizard2.cc:1.9
--- avida/current/source/qt-viewer/setup_wizard2.cc:1.8	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/setup_wizard2.cc	Tue Nov 25 10:20:45 2003
@@ -5,34 +5,33 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef STRING_HH
-#include "../tools/string.hh"
-#endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
-#endif
-
 #ifndef SETUP_GENESIS_HH
 #include "setup_genesis.hh"
 #endif
-
-#include "../tools/file.hh"
-
 #ifndef SETUP_WIZARD_PAGE2_HH
 #include "setup_wizard_page2.hh"
 #endif
-
 #ifndef SETUP_WIZARD2_HH
 #include "setup_wizard2.hh"
 #endif
-
 #ifndef SETUP_WIZARD_CONFIG_HH
 #include "setup_wizard_config.hh"
 #endif
 
+#ifndef FILE_HH
+#include "file.hh"
+#endif
+#ifndef GENESIS_HH
+#include "genesis.hh"
+#endif
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
+#endif
+#ifndef STRING_HH
+#include "string.hh"
+#endif
 
 using namespace std;
-
 
 AvidaSetupWizard2::AvidaSetupWizard2(
   int argc,
Index: avida/current/source/qt-viewer/setup_wizard_config.cc
diff -u avida/current/source/qt-viewer/setup_wizard_config.cc:1.7 avida/current/source/qt-viewer/setup_wizard_config.cc:1.8
--- avida/current/source/qt-viewer/setup_wizard_config.cc:1.7	Fri May 30 14:40:36 2003
+++ avida/current/source/qt-viewer/setup_wizard_config.cc	Tue Nov 25 10:20:45 2003
@@ -9,12 +9,18 @@
 #include "setup_wizard_config.hh"
 #endif
 
+#ifndef DEFS_HH
+#include "defs.hh"
+#endif
+#ifndef GENESIS_HH
+#include "genesis.hh"
+#endif
 #ifndef TOOLS_HH
-#include "../tools/tools.hh"
+#include "tools.hh"
 #endif
 
 #include "cPopulation_descr.hi" // declarations and definitions
-//#include "../event/cPopulation_descr.ci" // for event documentation
+//#include "cPopulation_descr.ci" // for event documentation
 
 
 using namespace std;
Index: avida/current/source/qt-viewer/setup_wizard_config.hh
diff -u avida/current/source/qt-viewer/setup_wizard_config.hh:1.4 avida/current/source/qt-viewer/setup_wizard_config.hh:1.5
--- avida/current/source/qt-viewer/setup_wizard_config.hh:1.4	Fri May 30 14:40:36 2003
+++ avida/current/source/qt-viewer/setup_wizard_config.hh	Tue Nov 25 10:20:45 2003
@@ -8,7 +8,7 @@
 #ifndef SETUP_WIZARD_CONFIG_HH
 #define SETUP_WIZARD_CONFIG_HH
 
-#include "../main/config.hh"
+#include "config.hh"
 
 class cSetupAssistantConfig : public cConfig {
 public:
Index: avida/current/source/qt-viewer/setup_wizard_constants.cc
diff -u avida/current/source/qt-viewer/setup_wizard_constants.cc:1.9 avida/current/source/qt-viewer/setup_wizard_constants.cc:1.10
--- avida/current/source/qt-viewer/setup_wizard_constants.cc:1.9	Tue May 20 05:08:08 2003
+++ avida/current/source/qt-viewer/setup_wizard_constants.cc	Tue Nov 25 10:20:45 2003
@@ -10,14 +10,18 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
-#include "../tools/file.hh"
-#include "../tools/string.hh"
+#ifndef GENESIS_HH
+#include "genesis.hh"
+#endif
+#ifndef STRING_HH
+#include "string.hh"
+#endif
 
 
 using namespace std;
Index: avida/current/source/qt-viewer/setup_wizard_page.cc
diff -u avida/current/source/qt-viewer/setup_wizard_page.cc:1.10 avida/current/source/qt-viewer/setup_wizard_page.cc:1.11
--- avida/current/source/qt-viewer/setup_wizard_page.cc:1.10	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/setup_wizard_page.cc	Tue Nov 25 10:20:45 2003
@@ -22,10 +22,11 @@
 #include <qvbox.h>
 #include <qwizard.h>
 
-#include "../tools/file.hh"
-
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef GENESIS_HH
+#include "genesis.hh"
+#endif
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_WIZARD_PAGE_HH
Index: avida/current/source/qt-viewer/setup_wizard_page2.cc
diff -u avida/current/source/qt-viewer/setup_wizard_page2.cc:1.7 avida/current/source/qt-viewer/setup_wizard_page2.cc:1.8
--- avida/current/source/qt-viewer/setup_wizard_page2.cc:1.7	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/setup_wizard_page2.cc	Tue Nov 25 10:20:46 2003
@@ -22,10 +22,12 @@
 #include <qvbox.h>
 #include <qwizard.h>
 
-#include "../tools/file.hh"
+#ifndef GENESIS_HH
+#include "genesis.hh"
+#endif
 
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_WIZARD_PAGE2_HH
Index: avida/current/source/qt-viewer/testwizard.cc
diff -u avida/current/source/qt-viewer/testwizard.cc:1.7 avida/current/source/qt-viewer/testwizard.cc:1.8
--- avida/current/source/qt-viewer/testwizard.cc:1.7	Tue May 20 07:42:29 2003
+++ avida/current/source/qt-viewer/testwizard.cc	Tue Nov 25 10:20:46 2003
@@ -4,17 +4,17 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_GENESIS_HH
 #include "setup_genesis.hh"
 #endif
 
-#include "../tools/file.hh"
+#include "file.hh"
 
 #include <qapplication.h>
 #include <qradiobutton.h>
Index: avida/current/source/qt-viewer/testwizard_loadgen.cc
diff -u avida/current/source/qt-viewer/testwizard_loadgen.cc:1.6 avida/current/source/qt-viewer/testwizard_loadgen.cc:1.7
--- avida/current/source/qt-viewer/testwizard_loadgen.cc:1.6	Sat May 17 12:33:57 2003
+++ avida/current/source/qt-viewer/testwizard_loadgen.cc	Tue Nov 25 10:20:46 2003
@@ -4,17 +4,17 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_GENESIS_HH
 #include "setup_genesis.hh"
 #endif
 
-#include "../tools/file.hh"
+#include "file.hh"
 
 #include <qradiobutton.h>
 #include <qlabel.h>
Index: avida/current/source/qt-viewer/testwizard_validators.cc
diff -u avida/current/source/qt-viewer/testwizard_validators.cc:1.8 avida/current/source/qt-viewer/testwizard_validators.cc:1.9
--- avida/current/source/qt-viewer/testwizard_validators.cc:1.8	Fri May 30 14:40:36 2003
+++ avida/current/source/qt-viewer/testwizard_validators.cc	Tue Nov 25 10:20:46 2003
@@ -4,10 +4,10 @@
 #endif
 
 #ifndef STRING_HH
-#include "../tools/string.hh"
+#include "string.hh"
 #endif
-#ifndef MESSAGE_DISPLAY_HH
-#include "../tools/message_display.hh"
+#ifndef MESSAGE_DISPLAY_HDRS_HH
+#include "message_display_hdrs.hh"
 #endif
 
 #ifndef SETUP_GENESIS_HH
@@ -18,7 +18,7 @@
 #include "setup_wizard_config.hh"
 #endif
 
-#include "../tools/file.hh"
+#include "file.hh"
 
 #include <qdir.h>
 #include <qfileinfo.h>
Index: avida/current/source/third-party/trio-1.9/Makefile.am
diff -u avida/current/source/third-party/trio-1.9/Makefile.am:1.3 avida/current/source/third-party/trio-1.9/Makefile.am:1.4
--- avida/current/source/third-party/trio-1.9/Makefile.am:1.3	Thu May 22 11:58:53 2003
+++ avida/current/source/third-party/trio-1.9/Makefile.am	Tue Nov 25 10:20:46 2003
@@ -1,9 +1 @@
-
-noinst_LIBRARIES = libtrio.a
-libtrio_a_SOURCES = \
-  trio.c trio.h \
-  triostr.c triostr.h \
-  trionan.c trionan.h \
-  triodef.h triop.h strio.h
-
-EXTRA_DIST = trio.pri
+SUBDIRS = mockpp trio yaktest
Index: avida/current/source/tools/tools.pri
diff -u avida/current/source/tools/tools.pri:1.2 avida/current/source/tools/tools.pri:1.3
--- avida/current/source/tools/tools.pri:1.2	Sat May 17 02:48:15 2003
+++ avida/current/source/tools/tools.pri	Tue Nov 25 10:20:50 2003
@@ -1,20 +1,17 @@
 
 tools {
-  HEADERS += $$TOOLS_HH/b_struct2.hh \
+  HEADERS += $$TOOLS_HH/indexed_block_struct.hh \
              $$TOOLS_HH/block_struct.hh \
              $$TOOLS_HH/data_entry.hh \
-             $$TOOLS_HH/data_manager.hh \
-             $$TOOLS_HH/datafile.hh \
+             $$TOOLS_HH/data_manager_base.hh \
+             $$TOOLS_HH/data_file.hh \
              $$TOOLS_HH/file.hh \
+             $$TOOLS_HH/fixed_block.hh \
              $$TOOLS_HH/functions.hh \
-             $$TOOLS_HH/help.hh \
-             $$TOOLS_HH/int.hh \
              $$TOOLS_HH/merit.hh \
              $$TOOLS_HH/message_display.hh \
              $$TOOLS_HH/message_display_hdrs.hh \
              $$TOOLS_HH/random.hh \
-             $$TOOLS_HH/slice.hh \
-             $$TOOLS_HH/stat.hh \
              $$TOOLS_HH/string.hh \
              $$TOOLS_HH/string_list.hh \
              $$TOOLS_HH/string_util.hh \
@@ -26,22 +23,41 @@
 #            $$TOOLS_HH/tMemTrack.hh \
              $$TOOLS_HH/tools.hh \
              $$TOOLS_HH/tVector.hh \
+             $$TOOLS_HH/uint.hh \
              $$TOOLS_HH/weighted_index.hh \
              $$TOOLS_HH/win32_mkdir_hack.hh
   
-  SOURCES += $$TOOLS_CC/b_struct2.cc \
-             $$TOOLS_CC/block_struct.cc \
+  SOURCES += $$TOOLS_CC/block_struct.cc \
+             $$TOOLS_CC/const_schedule.cc \
+             $$TOOLS_CC/count_tracker.cc \
              $$TOOLS_CC/data_entry.cc \
-             $$TOOLS_CC/data_manager.cc \
-             $$TOOLS_CC/datafile.cc \
+             $$TOOLS_CC/data_file.cc \
+             $$TOOLS_CC/data_file_manager.cc \
+             $$TOOLS_CC/data_manager_base.cc \
+             $$TOOLS_CC/default_message_display.cc \
+             $$TOOLS_CC/double_sum.cc \
              $$TOOLS_CC/file.cc \
-             $$TOOLS_CC/help.cc \
+             $$TOOLS_CC/fixed_block.cc \
+             $$TOOLS_CC/genesis.cc \
+             $$TOOLS_CC/help_alias.cc \
+             $$TOOLS_CC/help_manager.cc \
+             $$TOOLS_CC/help_type.cc \
+             $$TOOLS_CC/histogram.cc \
+             $$TOOLS_CC/indexed_block_struct.cc \
+             $$TOOLS_CC/init_file.cc \
+             $$TOOLS_CC/int_sum.cc \
+             $$TOOLS_CC/integrated_schedule.cc \
+             $$TOOLS_CC/integrated_schedule_node.cc \
              $$TOOLS_CC/merit.cc \
              $$TOOLS_CC/message_display.cc \
+             $$TOOLS_CC/prob_schedule.cc \
              $$TOOLS_CC/random.cc \
-             $$TOOLS_CC/slice.cc \
-             $$TOOLS_CC/stat.cc \
+             $$TOOLS_CC/ref_block.cc \
+             $$TOOLS_CC/running_average.cc \
+             $$TOOLS_CC/scaled_block.cc \
+             $$TOOLS_CC/schedule.cc \
              $$TOOLS_CC/string.cc \
+             $$TOOLS_CC/string_iterator.cc \
              $$TOOLS_CC/string_list.cc \
              $$TOOLS_CC/string_util.cc \
              $$TOOLS_CC/tools.cc \
Index: avida/current/source/viewers/Makefile.am
diff -u avida/current/source/viewers/Makefile.am:1.16 avida/current/source/viewers/Makefile.am:1.17
--- avida/current/source/viewers/Makefile.am:1.16	Wed Jul 16 19:36:55 2003
+++ avida/current/source/viewers/Makefile.am	Tue Nov 25 10:20:51 2003
@@ -3,6 +3,18 @@
 #LDFLAGS = -lm $(VIEW_LIBS)
 LDFLAGS = -lm -lncurses
 
+SOURCE_DIR = $(srcdir)/..
+SOURCE_INC = -I$(SOURCE_DIR)
+EVENT_DIR = $(SOURCE_DIR)/event
+EVENT_INC = -I$(EVENT_DIR)
+CPU_DIR = $(SOURCE_DIR)/cpu
+CPU_INC = -I$(CPU_DIR)
+TOOLS_DIR = $(SOURCE_DIR)/tools
+TOOLS_INC = -I$(TOOLS_DIR)
+MAIN_DIR = $(SOURCE_DIR)/main
+MAIN_INC = -I$(MAIN_DIR)
+INCLUDES = $(EVENT_INC) $(CPU_INC) $(TOOLS_INC) $(MAIN_INC) $(SOURCE_INC)
+
 viewer_SOURCES = ansi.cc		ansi.hh			\
 		bar_screen.cc		bar_screen.hh		\
 		environment_screen.cc	environment_screen.hh	\
@@ -25,7 +37,7 @@
 		../event/libevent.a          	\
 		../main/libmain.a		\
 		../tools/libtools.a \
-		../third-party/trio-1.9/libtrio.a
+		../third-party/trio/libtrio.a
 
 
 bin_PROGRAMS = viewer
Index: avida/current/source/viewers/ansi.hh
diff -u avida/current/source/viewers/ansi.hh:1.4 avida/current/source/viewers/ansi.hh:1.5
--- avida/current/source/viewers/ansi.hh:1.4	Sun Nov 11 15:21:03 2001
+++ avida/current/source/viewers/ansi.hh	Tue Nov 25 10:20:52 2003
@@ -9,7 +9,7 @@
 #ifndef VIEW_ANSI_HH
 #define VIEW_ANSI_HH
 
-#include "../defs.hh"
+#include "defs.hh"
 
 #ifdef VIEW_ANSI
 
Index: avida/current/source/viewers/bar_screen.cc
diff -u avida/current/source/viewers/bar_screen.cc:1.8 avida/current/source/viewers/bar_screen.cc:1.9
--- avida/current/source/viewers/bar_screen.cc:1.8	Wed Jul 16 19:36:55 2003
+++ avida/current/source/viewers/bar_screen.cc	Tue Nov 25 10:20:52 2003
@@ -5,9 +5,9 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#include "../main/population.hh"
-#include "../main/stats.hh"
-#include "../main/environment.hh"
+#include "population.hh"
+#include "stats.hh"
+#include "environment.hh"
 
 #include "bar_screen.hh"
 
Index: avida/current/source/viewers/environment_screen.cc
diff -u avida/current/source/viewers/environment_screen.cc:1.1 avida/current/source/viewers/environment_screen.cc:1.2
--- avida/current/source/viewers/environment_screen.cc:1.1	Thu Jul 17 11:40:20 2003
+++ avida/current/source/viewers/environment_screen.cc	Tue Nov 25 10:20:52 2003
@@ -5,16 +5,24 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#include "../main/config.hh"
-#include "../main/environment.hh"
-#include "../main/genebank.hh"
-#include "../main/genotype.hh"
-#include "../main/population.hh"
-#include "../main/species.hh"
-#include "../main/stats.hh"
-#include "../main/tasks.hh"
-#include "../main/population_cell.hh"
-#include "../main/organism.hh"
+#include "config.hh"
+#include "environment.hh"
+#include "genebank.hh"
+#include "genotype.hh"
+#include "population.hh"
+#ifndef REACTION_HH
+#include "reaction.hh"
+#endif
+#ifndef REACTION_PROCESS_HH
+#include "reaction_process.hh"
+#endif
+#ifndef RESOURCE_HH
+#include "resource.hh"
+#endif
+#include "species.hh"
+#include "stats.hh"
+#include "population_cell.hh"
+#include "organism.hh"
 
 #include "environment_screen.hh"
 
Index: avida/current/source/viewers/hist_screen.cc
diff -u avida/current/source/viewers/hist_screen.cc:1.8 avida/current/source/viewers/hist_screen.cc:1.9
--- avida/current/source/viewers/hist_screen.cc:1.8	Sat May 17 02:48:16 2003
+++ avida/current/source/viewers/hist_screen.cc	Tue Nov 25 10:20:52 2003
@@ -7,9 +7,9 @@
 
 #include <fstream>
 
-#include "../main/genebank.hh"
-#include "../main/genotype.hh"
-#include "../main/species.hh"
+#include "genebank.hh"
+#include "genotype.hh"
+#include "species.hh"
 
 #include "hist_screen.hh"
 
Index: avida/current/source/viewers/map_screen.cc
diff -u avida/current/source/viewers/map_screen.cc:1.11 avida/current/source/viewers/map_screen.cc:1.12
--- avida/current/source/viewers/map_screen.cc:1.11	Wed Jul 16 19:36:55 2003
+++ avida/current/source/viewers/map_screen.cc	Tue Nov 25 10:20:52 2003
@@ -7,9 +7,9 @@
 
 #include <fstream>
 
-#include "../main/genotype.hh"
-#include "../main/population.hh"
-#include "../main/population_cell.hh"
+#include "genotype.hh"
+#include "population.hh"
+#include "population_cell.hh"
 
 #include "map_screen.hh"
 
Index: avida/current/source/viewers/menu.hh
diff -u avida/current/source/viewers/menu.hh:1.4 avida/current/source/viewers/menu.hh:1.5
--- avida/current/source/viewers/menu.hh:1.4	Sun Nov 11 15:21:03 2001
+++ avida/current/source/viewers/menu.hh	Tue Nov 25 10:20:52 2003
@@ -8,7 +8,7 @@
 #ifndef VIEW_MENU_HH
 #define VIEW_MENU_HH
 
-#include "../tools/string.hh"
+#include "string.hh"
 
 #include "ncurses.hh"
 #include "ansi.hh"
Index: avida/current/source/viewers/ncurses.cc
diff -u avida/current/source/viewers/ncurses.cc:1.8 avida/current/source/viewers/ncurses.cc:1.9
--- avida/current/source/viewers/ncurses.cc:1.8	Sat May 17 02:48:16 2003
+++ avida/current/source/viewers/ncurses.cc	Tue Nov 25 10:20:52 2003
@@ -1,5 +1,5 @@
 //////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology             //
+// 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.     //
Index: avida/current/source/viewers/options_screen.cc
diff -u avida/current/source/viewers/options_screen.cc:1.10 avida/current/source/viewers/options_screen.cc:1.11
--- avida/current/source/viewers/options_screen.cc:1.10	Sat May 17 02:48:16 2003
+++ avida/current/source/viewers/options_screen.cc	Tue Nov 25 10:20:52 2003
@@ -5,8 +5,8 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#include "../main/config.hh"
-#include "../main/population.hh"
+#include "config.hh"
+#include "population.hh"
 
 #include "options_screen.hh"
 
Index: avida/current/source/viewers/stats_screen.cc
diff -u avida/current/source/viewers/stats_screen.cc:1.13 avida/current/source/viewers/stats_screen.cc:1.14
--- avida/current/source/viewers/stats_screen.cc:1.13	Sat May 17 02:48:16 2003
+++ avida/current/source/viewers/stats_screen.cc	Tue Nov 25 10:20:52 2003
@@ -5,14 +5,17 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#include "../main/config.hh"
-#include "../main/environment.hh"
-#include "../main/genebank.hh"
-#include "../main/genotype.hh"
-#include "../main/population.hh"
-#include "../main/species.hh"
-#include "../main/stats.hh"
-#include "../main/tasks.hh"
+#include "config.hh"
+#include "environment.hh"
+#include "genebank.hh"
+#include "genotype.hh"
+#include "population.hh"
+#include "species.hh"
+#include "stats.hh"
+
+#ifndef TASK_ENTRY_HH
+#include "task_entry.hh"
+#endif
 
 #include "stats_screen.hh"
 
Index: avida/current/source/viewers/symbol_util.cc
diff -u avida/current/source/viewers/symbol_util.cc:1.6 avida/current/source/viewers/symbol_util.cc:1.7
--- avida/current/source/viewers/symbol_util.cc:1.6	Thu Aug  7 20:24:19 2003
+++ avida/current/source/viewers/symbol_util.cc	Tue Nov 25 10:20:52 2003
@@ -9,14 +9,14 @@
 
 #include "symbol_util.hh"
 
-#include "../main/genotype.hh"
-#include "../main/organism.hh"
-#include "../main/population_cell.hh"
-#include "../main/species.hh"
-#include "../main/config.hh"
-#include "../cpu/hardware_base.hh"
-#include "../cpu/hardware_4stack.hh"
-#include "../cpu/hardware_cpu.hh"
+#include "genotype.hh"
+#include "organism.hh"
+#include "population_cell.hh"
+#include "species.hh"
+#include "config.hh"
+#include "hardware_base.hh"
+#include "hardware_4stack.hh"
+#include "hardware_cpu.hh"
 
 using namespace std;
 
Index: avida/current/source/viewers/text_screen.cc
diff -u avida/current/source/viewers/text_screen.cc:1.14 avida/current/source/viewers/text_screen.cc:1.15
--- avida/current/source/viewers/text_screen.cc:1.14	Tue Sep 23 16:01:14 2003
+++ avida/current/source/viewers/text_screen.cc	Tue Nov 25 10:20:52 2003
@@ -7,14 +7,14 @@
 
 #include <fstream>
 
-#include "../main/species.hh"
-#include "../main/genotype.hh"
-#include "../main/genebank.hh"
-#include "../main/inject_genotype.hh"
-#include "../main/inject_genebank.hh"
-#include "../main/population.hh"
-#include "../main/population_cell.hh"
-#include "../main/organism.hh"
+#include "species.hh"
+#include "genotype.hh"
+#include "genebank.hh"
+#include "inject_genotype.hh"
+#include "inject_genebank.hh"
+#include "population.hh"
+#include "population_cell.hh"
+#include "organism.hh"
 
 #include "symbol_util.hh"
 #include "text_screen.hh"
Index: avida/current/source/viewers/text_screen.hh
diff -u avida/current/source/viewers/text_screen.hh:1.13 avida/current/source/viewers/text_screen.hh:1.14
--- avida/current/source/viewers/text_screen.hh:1.13	Tue Sep 23 16:01:15 2003
+++ avida/current/source/viewers/text_screen.hh	Tue Nov 25 10:20:52 2003
@@ -9,9 +9,9 @@
 #define VIEW_TEXT_SCREEN_HH
 
 
-#include "../tools/merit.hh"
-#include "../main/inst_set.hh"
-#include "../defs.hh"
+#include "merit.hh"
+#include "inst_set.hh"
+#include "defs.hh"
 
 #include "ncurses.hh"
 #include "ansi.hh"
Index: avida/current/source/viewers/text_window.hh
diff -u avida/current/source/viewers/text_window.hh:1.5 avida/current/source/viewers/text_window.hh:1.6
--- avida/current/source/viewers/text_window.hh:1.5	Mon Apr  1 11:06:31 2002
+++ avida/current/source/viewers/text_window.hh	Tue Nov 25 10:20:52 2003
@@ -8,7 +8,8 @@
 #ifndef VIEW_TEXT_WINDOW_HH
 #define VIEW_TEXT_WINDOW_HH
 
-#include "../tools/tools.hh"
+#include <assert.h>
+#include "tools.hh"
 
 // class cTextWindow;
 
Index: avida/current/source/viewers/view.cc
diff -u avida/current/source/viewers/view.cc:1.12 avida/current/source/viewers/view.cc:1.13
--- avida/current/source/viewers/view.cc:1.12	Thu Jul 31 15:34:27 2003
+++ avida/current/source/viewers/view.cc	Tue Nov 25 10:20:52 2003
@@ -7,15 +7,18 @@
 
 #include <fstream>
 
-#include "../main/genotype.hh"
-#include "../main/organism.hh"
-#include "../main/phenotype.hh"
-#include "../main/population.hh"
-#include "../main/population_cell.hh"
-#include "../main/stats.hh"
+#ifndef ENVIRONMENT_HH
+#include "environment.hh"
+#endif
+#include "genotype.hh"
+#include "organism.hh"
+#include "phenotype.hh"
+#include "population.hh"
+#include "population_cell.hh"
+#include "stats.hh"
 
-#include "../cpu/test_util.hh"
-#include "../cpu/hardware_base.hh"
+#include "test_util.hh"
+#include "hardware_base.hh"
 
 #include "view.hh"
 #include "menu.hh"
Index: avida/current/source/viewers/viewer.cc
diff -u avida/current/source/viewers/viewer.cc:1.4 avida/current/source/viewers/viewer.cc:1.5
--- avida/current/source/viewers/viewer.cc:1.4	Sat May 17 02:48:16 2003
+++ avida/current/source/viewers/viewer.cc	Tue Nov 25 10:20:52 2003
@@ -5,13 +5,22 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
+#ifndef VIEWER_HH
 #include "viewer.hh"
+#endif
 
-#include "../main/config.hh"
-#include "../main/environment.hh"
-#include "../main/population.hh"
-
+#ifndef CONFIG_HH
+#include "config.hh"
+#endif
+#ifndef ENVIRONMENT_HH
+#include "environment.hh"
+#endif
+#ifndef POPULATION_HH
+#include "population.hh"
+#endif
+#ifndef VIEW_HH
 #include "../viewers/view.hh"          // class cView
+#endif
 
 
 using namespace std;
Index: avida/current/source/viewers/viewer.hh
diff -u avida/current/source/viewers/viewer.hh:1.2 avida/current/source/viewers/viewer.hh:1.3
--- avida/current/source/viewers/viewer.hh:1.2	Tue Nov 13 14:58:33 2001
+++ avida/current/source/viewers/viewer.hh	Tue Nov 25 10:20:52 2003
@@ -9,7 +9,17 @@
 #define VIEWERS_HH
 
 #ifndef AVIDA_HH
-#include "../main/avida.hh"
+#include "avida.hh"
+#endif
+
+#ifndef AVIDA_DRIVER_ANALYZE_HH
+#include "avida_driver_analyze.hh"
+#endif
+#ifndef AVIDA_DRIVER_BASE_HH
+#include "avida_driver_base.hh"
+#endif
+#ifndef AVIDA_DRIVER_POPULATION_HH
+#include "avida_driver_population.hh"
 #endif
 
 class cView;
Index: avida/current/source/viewers/zoom_screen.cc
diff -u avida/current/source/viewers/zoom_screen.cc:1.27 avida/current/source/viewers/zoom_screen.cc:1.28
--- avida/current/source/viewers/zoom_screen.cc:1.27	Thu Jul 31 15:34:27 2003
+++ avida/current/source/viewers/zoom_screen.cc	Tue Nov 25 10:20:52 2003
@@ -5,20 +5,27 @@
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
 //////////////////////////////////////////////////////////////////////////////
 
-#include "../tools/string_util.hh"
-#include "../tools/functions.hh"
+#ifndef ENVIRONMENT_HH
+#include "environment.hh"
+#endif
+#include "functions.hh"
 
-#include "../main/config.hh"
-#include "../main/genebank.hh"
-#include "../main/genotype.hh"
-#include "../main/organism.hh"
-#include "../main/phenotype.hh"
-#include "../main/population.hh"
-#include "../main/population_cell.hh"
-#include "../main/tasks.hh"
+#include "config.hh"
+#include "genebank.hh"
+#include "genotype.hh"
+#include "organism.hh"
+#include "phenotype.hh"
+#include "population.hh"
+#include "population_cell.hh"
+#ifndef STRING_UTIL_HH
+#include "string_util.hh"
+#endif
+#ifndef TASK_ENTRY_HH
+#include "task_entry.hh"
+#endif
 
-#include "../cpu/hardware_cpu.hh"
-#include "../cpu/hardware_4stack.hh"
+#include "hardware_cpu.hh"
+#include "hardware_4stack.hh"
 
 #include "zoom_screen.hh"
 

Index: avida/current/source/third-party/trio-1.9/mockpp/2003.11.25..13.09.41-add
+++ avida/current/source/third-party/trio-1.9/mockpp/2003.11.25..13.09.41-add
***
starting at 2003.11.25..13.09.41
command:
***

cvs add AbstractExpectation.h AbstractExpectationCollection.h Expectation.h ExpectationBoundary.h ExpectationCounter.cpp ExpectationCounter.h ExpectationList.h ExpectationMap.h ExpectationSegment.h ExpectationSet.h ExpectationValue.h Makefile.am Makefile.in MockObject.cpp MockObject.h ReturnObjectList.h Throwable.cpp Throwable.h ThrowableList.cpp ThrowableList.h Verifiable.cpp Verifiable.h VerifiableList.cpp VerifiableList.h VisitableMockObject.cpp VisitableMockObject.h VisitableMockObject_macro.h VisitableMockObject_template.h compat cscope.out doc-template.h docs examples mockpp.cpp mockpp.h mockpp_config.h po tests util

***
exported environment:
***

export BASH_ENV="/Users/kaben/.bashrc"
export CSCOPE_EDITOR="vim"
export CVSROOT=":ext:kaben at cvs.avida.sourceforge.net:/cvsroot/avida"
export CVS_RSH="ssh"
export EDITOR="vim"
export GNUTERM="aqua"
export GNUTERMAPP="/sw/Applications/AquaTerm.app"
export HOME="/Users/kaben"
export INFODIR="/opt/local/info:/Users/kaben/Projects/local/info:/opt/local/info:/Users/kaben/Projects/local/info:/sw/share/info:/sw/info:/usr/share/info"
export INFOPATH="/opt/local/info:/Users/kaben/Projects/local/info:/opt/local/info:/Users/kaben/Projects/local/info:/sw/share/info:/sw/info:/usr/share/info"
export IRCLIB="/Users/kaben/Dist/BitchX/BitchX/TARGET/lib/bx/"
export IRCNAME="K. G. Nanlohy"
export IRCNICK="kgn"
export IRCSERVER="irc.scifi.com"
export LANG="en_US"
export LD_PREBIND="1"
export LD_PREBIND_ALLOW_OVERLAP="1"
export LD_SEG_ADDR_TABLE="/sw/var/lib/fink/prebound/seg_addr_table"
export LOGNAME="kaben"
export MANPATH="/opt/local/man:/Users/kaben/Projects/local/man:/opt/local/man:/Users/kaben/Projects/local/man:/sw/share/man:/usr/share/man:/usr/X11R6/man"
export OLDPWD
export PAGER="less"
export PATH="/opt/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/Users/kaben/bin:/Users/kaben/Projects/local/bin:/Users/kaben/bin:/Users/kaben/Projects/local/bin"
export PERL5LIB="/sw/lib/perl5"
export PRCS_CONFLICT_EDITOR="vim"
export PRCS_LOGQUERY=""
export PWD="/Users/kaben/Projects/software/avida/branch.HEAD/current.refactored.postcheckin/source/third-party/mockpp"
export PYTHONDOCS="/Users/kaben/Projects/software/PythonDocs/Python-Docs-2.3.2/"
export PYTHONSTARTUP="/Users/kaben/.pystartup"
export RSYNC_RSH="ssh"
export SGML_CATALOG_FILES="/sw/etc/sgml/catalog"
export SHELL="/bin/bash"
export SHLVL="3"
export STY="22093.k"
export TERM="screen"
export TERMCAP="SC|screen|VT 100/ANSI X3.64 virtual terminal:\\\
	:DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:bs:bt=\\E[Z:\\\
	:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:ct=\\E[3g:\\\
	:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\\\
	:le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:\\\
	:li#103:co#100:am:xn:xv:LP:sr=\\EM:al=\\E[L:AL=\\E[%dL:\\\
	:cs=\\E[%i%d;%dr:dl=\\E[M:DL=\\E[%dM:dc=\\E[P:DC=\\E[%dP:\\\
	:im=\\E[4h:ei=\\E[4l:mi:IC=\\E[%d@:ks=\\E[?1h\\E=:\\\
	:ke=\\E[?1l\\E>:vi=\\E[?25l:ve=\\E[34h\\E[?25h:vs=\\E[34l:\\\
	:us=\\E[4m:ue=\\E[24m:so=\\E[3m:se=\\E[23m:md=\\E[1m:\\\
	:mr=\\E[7m:me=\\E[m:ms:\\\
	:Co#8:pa#64:AF=\\E[3%dm:AB=\\E[4%dm:op=\\E[39;49m:AX:\\\
	:as=\\E(0:ae=\\E(B:\\\
	:ac=\\140\\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\\\
	:Z0=\\E[?3h:Z1=\\E[?3l:k0=\\E[10~:k1=\\EOP:k2=\\EOQ:k3=\\EOR:\\\
	:k4=\\EOS:k5=\\E[15~:k6=\\E[17~:k7=\\E[18~:k8=\\E[19~:\\\
	:k9=\\E[20~:k;=\\E[21~:F1=\\E[23~:F2=\\E[24~:F3=\\E[25~:\\\
	:F4=\\E[26~:F5=\\E[28~:F6=\\E[29~:F7=\\E[31~:F8=\\E[32~:\\\
	:F9=\\E[33~:FA=\\E[34~:kb=^H:kh=\\E[1~:kH=\\E[4~:kN=\\E[6~:\\\
	:kP=\\E[5~:kI=\\E[2~:kD=\\E[3~:ku=\\EOA:kd=\\EOB:kr=\\EOC:\\\
	:kl=\\EOD:km:"
export TERM_PROGRAM="Apple_Terminal"
export TERM_PROGRAM_VERSION="81"
export USER="kaben"
export USERNAME=""
export WINDOW="2"
export XML_CATALOG_FILES="/sw/etc/xml/catalog"
export __CF_USER_TEXT_ENCODING="0x1F5:0:0"

***
output follows...
***

cvs add: in directory .:
cvs [add aborted]: there is no version here; do 'cvs checkout' first

***
finished at 2003.11.25..13.09.51
***

Index: avida/current/source/third-party/trio-1.9/mockpp/AbstractExpectation.h
+++ avida/current/source/third-party/trio-1.9/mockpp/AbstractExpectation.h
/**
  @file    
  @brief    Base class for expectations
                    
  @verbatim
    
    begin                : Thu Dec 19 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AbstractExpectation.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.11  2003/04/13 16:31:01  ewald-arnold
    moved name to Verifiable class

    Revision 1.10  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.9  2003/02/18 19:51:08  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/08 08:18:54  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.7  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.6  2003/01/06 13:39:59  ewald-arnold
    provide default message

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_ABSTRACTEXPECTATION_H
#define MOCKPP_ABSTRACTEXPECTATION_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/Expectation.h>
#include <mockpp/compat/Assert.h>
#include <mockpp/compat/Formatter.h>


namespace mockpp {
  

class VerifiableList;

/** Base class for all expectations.
  */
template <class T>  
class AbstractExpectation : public Expectation
{
  public:
  
  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    AbstractExpectation(const String &name, VerifiableList *parent)
     : Expectation(name, parent)
    {
      myFailureModeIsImmediate = true;
      myHasExpectations = false;
    }


  /**
    * Tests if any expectations have been set on this object.
    * @return true: there are expectations
    */
    bool hasExpectations()
    {
      return myHasExpectations;
    }


  /**
    * If an incorrect actual value is set, defer reporting this as a failure until verify()
    * is called on this object.
    */
    void setFailOnVerify()
    {
      myFailureModeIsImmediate = false;
    }


  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    virtual void clearActual() = 0;


    
  /** 
    * Verifies the contained expectation.
    * If this fails an AssertionFailedError is thrown.
    */
    virtual void verify() = 0;
    
  protected:

  /**
    * Asserts that two values are equal.
    * @param message    a human readable description about the cause
    * @param expected   the expected value
    * @param actual     the actual value
    */
    void assertEquals(
        const String &msg,
        const T &expectedValue,
        const T &actualValue)
    {
      if (!hasExpectations() )
        return;

      if (expectedValue == actualValue)
        return;

      if (msg.length() == 0)
      {  
        String fmt = ("%1 assertion failed.\nExpected: %2\nReceived: %3");
        fmt << getName() << expectedValue << actualValue;
        MOCKPP_FAIL(fmt);
      }
      else      
        MOCKPP_FAIL(msg);
    }


  /**
    * Tests if any actuals should be checked immediately when set.
    * Otherwise they are checked when verify() is called.
    * @return true: check immediately
    */
    bool shouldCheckImmediately()
    {
      return myFailureModeIsImmediate && myHasExpectations;
    }


  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    void setHasExpectations()
    {
      myHasExpectations = true;
    }

  private:

    bool     myFailureModeIsImmediate;
    bool     myHasExpectations;
};


}; // namespace mockpp


#endif // MOCKPP_ABSTRACTEXPECTATION_H

Index: avida/current/source/third-party/trio-1.9/mockpp/AbstractExpectationCollection.h
+++ avida/current/source/third-party/trio-1.9/mockpp/AbstractExpectationCollection.h
/**
  @file    
  @brief    Check collections of expectations
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AbstractExpectationCollection.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.8  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.7  2003/02/18 19:51:08  ewald-arnold
    updated copyright date

    Revision 1.6  2003/02/08 08:18:54  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.5  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.4  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:19  ewald-arnold
    - preparations for  and windoze
    - restructured due to Ex-Map

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_ABSTRACTEXPECTATIONCOLLECTION_H
#define MOCKPP_ABSTRACTEXPECTATIONCOLLECTION_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/AbstractExpectation.h>


namespace mockpp {


template <class T>
class AbstractExpectationCollection : public AbstractExpectation<T>
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    AbstractExpectationCollection(const String &name, VerifiableList *parent)
      : AbstractExpectation<T>(name, parent)
    {    
    }

    
  protected:
      
  /**
    * Clears the
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    virtual void clearExpectation() = 0;
   

  /**
    * Checks if the actual value matches the expectation.
    * Note the semantics of the containers of the underlying container of descendants
    * of this class.
    */
    virtual void checkImmediateValue(const T &actualItem) = 0;
};


}; // namespace mockpp


#endif // MOCKPP_ABSTRACTEXPECTATIONCOLLECTION_H

Index: avida/current/source/third-party/trio-1.9/mockpp/Expectation.h
+++ avida/current/source/third-party/trio-1.9/mockpp/Expectation.h
/**
  @file    
  @brief    Abstract interface for expectations
                    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Expectation.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.8  2003/04/13 16:32:06  ewald-arnold
    moved name to Verifiable class

    Revision 1.7  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.6  2003/02/18 19:51:08  ewald-arnold
    updated copyright date

    Revision 1.5  2003/02/08 08:18:54  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.4  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.3  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATION_H
#define MOCKPP_EXPECTATION_H


#include <mockpp/mockpp.h> // always first

#include <mockpp/Verifiable.h>


namespace mockpp {


class VerifiableList;

/**
  *  An Expectation is an object that we set up at the beginning of a unit test to
  * expect certain things to happen to it. If it is possible to tell, the Expectation will
  * fail as soon as an incorrect value has been set.
  *
  * Call verify() at the end of a unit test to check for missing or incomplete values.
  *
  * If no expectations have been set on the object, then no checking will be done and
  * verify() will do nothing.
  */
class Expectation : public Verifiable

{
  public:
  
  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    Expectation (const String &name, VerifiableList *parent)
     : Verifiable(name, parent)
    {}

  /**
    * Tests if any expectations have been set on this object.
    * @return true: there are expectations
    */
    virtual bool hasExpectations() = 0;

  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    virtual void setExpectNothing() = 0;

  /**
    * If an incorrect actual value is set, defer reporting this as a failure until verify()
    * is called on this object.
    */
    virtual void setFailOnVerify() = 0;
};


};  // namespace mockpp


#endif // MOCKPP_EXPECTATION_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationBoundary.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationBoundary.h
/**
  @file    
  @brief    Check for expected value boundaries
                    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationBoundary.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.2  2003/03/12 16:45:49  ewald-arnold
    setExpectedDelta() added

    Revision 1.1  2003/02/25 20:30:24  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.8  2003/02/18 19:51:09  ewald-arnold
    updated copyright date

    Revision 1.7  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.6  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:56  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONBOUNDARY_H
#define MOCKPP_EXPECTATIONBOUNDARY_H


#include <mockpp/mockpp.h> // always first

#include <mockpp/AbstractExpectation.h>
#include <mockpp/util/AssertMo.h>


namespace mockpp {


/** 
  * A class to verify that an actual value lies between two boundary values..
  * Since it uses operator<() and operator==() for verification
  * it can handle all objects that implement those operators not just numerics.
  */
template <class T>
class ExpectationBoundary : public AbstractExpectation<T>
{
  private:

    T    lower_bound;
    T    upper_bound;
    T    actualValue;
    bool haveActualValue;
    bool expectNothing;

  public:
    
  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    ExpectationBoundary(const String &name, VerifiableList *parent)
     : AbstractExpectation<T>(name, parent),
       expectNothing(false)
    {
        clearActual();
    }
    

  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    virtual void clearActual()
    {
      haveActualValue = false;
      lower_bound = 0;
      upper_bound = 0;
      actualValue = 0;
    }

    
  /** Sets the actual value.
    * @param value  the actual value
    */
    void setActual(const T &value )
    {
      actualValue = value;
      haveActualValue = true;
      if (shouldCheckImmediately())
      {
        verify();
      }
    }

    
  /** Sets the expectation value boundaries.
    * @param lower_bound  lowest value
    * @param upper_bound  highest value
    */
    void setExpected(const T &lower, const T &upper )
    {
      MOCKPP_ASSERT_TRUE(lower <= upper);
      lower_bound = lower;
      upper_bound = upper;
      setHasExpectations();
    }


#if MOCKPP_BOUNDARY_DELTA != 0
  /** Sets the expectation value boundaries.
    * Differs from the normal setExpected() method only in the parameters.
    * Since this method is not activated by default, you must add the
    * following lines to your source code before #include'ing ExpectationBoundery.h
    * to activate it. 
    * <pre>
    *  #undef  MOCKPP_BOUNDARY_DELTA  // after inclusion of mockpp.h!
    *  #define MOCKPP_BOUNDARY_DELTA 1
    * </pre>
    * Additionally operator+() and operator-() must exist for your
    * expected objects, that's the reason why it is disabled by default.
    * @param median   expected value
    * @param delta    allowed difference range
    */
    void setExpectedDelta(const T &median, const T &delta )
    {
      T lower = median - delta;
      T upper = median + delta;
      if (lower <= upper)
        setExpected(lower, upper);
      else  
        setExpected(upper, lower);
    }
#endif

    
  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    virtual void setExpectNothing()
    {
      expectNothing = true;
      clearActual();
      setHasExpectations();
    }
    

  /**
    * Verify that the expected value is within the allowed bounds.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify()
    {
      if( expectNothing )
      {
        String fmt = ("%1 expected no value.");
        fmt << getName();

        MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue );
      }
      else 
      {
        if (!hasExpectations() )
          return;

        String fmt = ("%1 expected a value.");
        fmt << getName();
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue );
            
        fmt = ("%1 received a value of %2 which is less than the expected value of %3.");
        fmt << getName() << actualValue << lower_bound;
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, lower_bound <= actualValue );
        
        fmt = ("%1 received a value of %2 which is greater than the expected value of %3.");
        fmt << getName() << actualValue << upper_bound;
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, actualValue <= upper_bound);
      }
    }
};


};  // namespace mockpp


#endif // MOCKPP_EXPECTATIONBOUNDARY_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationCounter.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationCounter.cpp
/**
  @file    
  @brief    check range of of expected calls
    
  @verbatim
    
    begin                : Mon Dec 30 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationCounter.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.11  2003/03/28 20:04:13  ewald-arnold
    extended doxygen stuff

    Revision 1.10  2003/03/16 10:01:11  ewald-arnold
    update

    Revision 1.9  2003/02/18 19:51:08  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/08 08:17:45  ewald-arnold
    refactoring for removed ExpectationCounterRange

    Revision 1.3  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.2  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <mockpp/ExpectationCounter.h>

#include <mockpp/compat/Formatter.h>

namespace mockpp {


MOCKPP_EXPORT
ExpectationCounter::ExpectationCounter(const String &name, VerifiableList *parent)
  : AbstractExpectation<unsigned>(name, parent)
{
  myExpectedMinCalls = 0;
  myExpectedMaxCalls = 0;
  myActualCalls = 0;
}


void MOCKPP_EXPORT ExpectationCounter::clearActual()
{
  myActualCalls = 0;
}


unsigned MOCKPP_EXPORT ExpectationCounter::getActual() const
{
  return myActualCalls;
}


void MOCKPP_EXPORT ExpectationCounter::inc()
{
  myActualCalls++;
  if (shouldCheckImmediately())
  {
     String fmt = ("%1 was called %2 times but should not be called more than %3 times.");

     fmt << getName() << myActualCalls << myExpectedMaxCalls;
     MOCKPP_ASSERT_TRUE_MESSAGE(fmt, myActualCalls <= myExpectedMaxCalls);
  }
}


void MOCKPP_EXPORT
ExpectationCounter::setExpected(unsigned expectedMinCalls, unsigned expectedMaxCalls)
{
  MOCKPP_ASSERT_TRUE(expectedMinCalls <= expectedMaxCalls);
  myExpectedMinCalls = expectedMinCalls;
  myExpectedMaxCalls = expectedMaxCalls;
  setHasExpectations();
}


void MOCKPP_EXPORT ExpectationCounter::setExpected(unsigned expectedCalls)

{
  myExpectedMinCalls = myExpectedMaxCalls = expectedCalls;
  setHasExpectations();
}


void MOCKPP_EXPORT ExpectationCounter::setExpectNothing()
{
  myExpectedMinCalls = 0;
  myExpectedMaxCalls = 0;
  setHasExpectations();
}


void MOCKPP_EXPORT ExpectationCounter::verify()
{
  String fmt = ("%1 was called %2 times which is less than the expected count of %3.");
  fmt << getName() << myActualCalls << myExpectedMinCalls;
  MOCKPP_ASSERT_TRUE_MESSAGE(fmt, myExpectedMinCalls <= myActualCalls);

  fmt = ("%1 was called %2 times which is more than the expected count of %3.");
  fmt << getName() << myActualCalls << myExpectedMaxCalls;
  MOCKPP_ASSERT_TRUE_MESSAGE(fmt, myExpectedMaxCalls >= myActualCalls);
}


};  // namespace mockpp

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationCounter.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationCounter.h
/**
  @file    
  @brief    Check range of of expected calls
                    
  @verbatim
    
    begin                : Thu Dec 19 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationCounter.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.9  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.8  2003/02/25 20:20:33  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.7  2003/02/18 19:51:08  ewald-arnold
    updated copyright date

    Revision 1.6  2003/02/08 08:17:45  ewald-arnold
    refactoring for removed ExpectationCounterRange

    Revision 1.3  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.2  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONCOUNTER_H
#define MOCKPP_EXPECTATIONCOUNTER_H


#include <mockpp/mockpp.h> // always first

#include <mockpp/AbstractExpectation.h>


namespace mockpp {


/** 
  * A class to verify the expected count of an event.
  */
class ExpectationCounter : public AbstractExpectation<unsigned>
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    ExpectationCounter(const String &name, VerifiableList *parent);

  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    virtual void clearActual();


  /** Increments the actual number of calls by 1.
    */
    void inc();


  /** Sets the exact number of expected calls.
    * @param  expectedCalls   number of expected calls
    */
    void setExpected(unsigned  expectedCalls);


  /** Sets the range of expected calls.
    * @param  expectedMinCalls   lower bound of expected calls
    * @param  expectedMaxCalls   upper bound of expected calls
    */
    void setExpected(unsigned expectedMinCalls, unsigned expectedMaxCalls);

  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    void setExpectNothing();

    
  /** Gets the number of actual calls.
    * @param current counter value.
    */
    unsigned getActual() const;

  /**
    * Verify that the amount of calls is within the allowed bounds.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify();

  private:

    unsigned myExpectedMinCalls;
    unsigned myExpectedMaxCalls;
    unsigned myActualCalls;
};


};  // namespace mockpp


#endif // MOCKPP_EXPECTATIONCOUNTER_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationList.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationList.h
/**
  @file    
  @brief    Check list of expectations
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationList.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.16  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.15  2003/03/07 20:51:02  ewald-arnold
    corrected a typo

    Revision 1.14  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.13  2003/02/25 20:20:34  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.12  2003/02/18 19:51:08  ewald-arnold
    updated copyright date

    Revision 1.11  2003/02/17 22:04:51  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.10  2003/02/08 08:18:54  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.9  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.8  2003/01/04 13:09:56  ewald-arnold
    fix cr-lf

    Revision 1.7  2003/01/04 12:24:52  ewald-arnold
    port to BCB5

    Revision 1.6  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.5  2002/12/31 13:31:29  ewald-arnold
    optical changes

    Revision 1.4  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:19  ewald-arnold
    - preparations for  and windoze
    - restructured due to Ex-Map

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONLIST_H
#define MOCKPP_EXPECTATIONLIST_H

#include <mockpp/mockpp.h> // always first

#include <algorithm>
#include <vector>

#include <mockpp/AbstractExpectationCollection.h>
#include <mockpp/util/AssertMo.h>


namespace mockpp {


/** 
  * A class to verify lists of expectations, one after the other as they occur.
  */
template <class T>
class ExpectationList : public AbstractExpectationCollection<T>
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    ExpectationList(const String &name, VerifiableList *parent)
      : AbstractExpectationCollection<T>(name, parent),
        expectNothing(false),
        haveActualValue(false)
    {
    }

    
  /**
    * Verify that the expected values equal the expected ones.
    * Note: in a list there can be any number of elements of a given value and the order
    * of the elements must match exactly.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify()
    {
      if( expectNothing)
      {
        String fmt = ("%1 expected no value.");
        fmt << getName();
        MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue );

      }
      else
      {
        if (!hasExpectations() )
          return;

        String fmt = ("%1 expected a value.");
        fmt << getName();

        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue);

        fmt = ("%1 did not receive the expected item list.");
        fmt << getName();

        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, actualItems == expectedItems);
      }
    }

    
  /** Adds another actual value to the list.
    * @param actualItem  new value
    */
    void addActual(const T &actualItem)
    {
      actualItems.push_back(actualItem);
      haveActualValue = true;

      if (shouldCheckImmediately())
        checkImmediateValue(actualItem);
    }


  /** Adds a sequence of actual values to the list.
    * @param items    start iterator
    * @param end      terminating iterator (note: one element "behind" as always with STL)
    */
    template <class I>
    void addActual(I items, I end)
    {
      for ( /* -- */; items != end; ++items)
        addActual(*items);
    }
   
    
  /** Adds another expectation value to the list.
    * @param actualItem  new value
    */
    void addExpected(const T &expectedItem)
    {
      expectedItems.push_back(expectedItem);
      setHasExpectations();
    }


  /** Copy one item from expectation list to actuals at same position.
    * Useful after recovering from an error at another place.
    */
    void balanceActual()
    {
      if (actualItems.size() < expectedItems.size())
      {
        haveActualValue = true;
        actualItems.push_back(expectedItems[actualItems.size()]);
      }  
    }


  /** Adds a sequence of expectation values to the list.
    * @param items    start iterator
    * @param end      terminating iterator (note: one element "behind" as always with STL)
    */
    template <class I>
    void addExpected(I items, I end)
    {
      for ( /* -- */; items != end; ++items)
        addExpected(*items);
    }


  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    virtual void clearActual()
    {
      haveActualValue = false;
      actualItems.clear();
    }

    
  /**
    * Resets the internal state to reflect that there is no value at all set.
    */
    void clear()
    {
      clearActual();
      clearExpectation();
      expectNothing = false;
    }

    
  /**
    * Returns the amount of expectation values.
    * @return number of expectation values
    */
    unsigned size() const
    {
      return expectedItems.size();
    }

    
  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    virtual void setExpectNothing()
    {
      expectNothing = true;
      clearExpectation();
      setHasExpectations();
    }


  protected:

  /**
    * Clears the expectation list.
    */
    virtual void clearExpectation()
    {
      expectedItems.clear();
    }


  /**
    * Checks if the actual value matches the expectation.
    * Note: in a list there can be any number of elements of a given value and the order
    * of the elements must match exactly.
    * If it fails, an AssertionFailedError is thrown
    */
    void checkImmediateValue(const T &actualItem)
    {
      unsigned size = actualItems.size();
      String fmt = ("%1 had different item sizes.\nExpected %2 items but received %3 when adding %4.");
      fmt << getName() << expectedItems.size() << size << actualItem;
      
      MOCKPP_ASSERT_TRUE_MESSAGE(fmt, expectedItems.size() >= size);

      fmt = ("%1 added item does not match. %2 != %3.");
      fmt << getName() << expectedItems[(size - 1)] << actualItem;
      
      assertEquals(fmt, expectedItems[(size - 1)], actualItem);
    }      

  private:
  
    std::vector<T> actualItems;
    std::vector<T> expectedItems;
    bool           haveActualValue;
    bool           expectNothing;
};


}; // namespace mockpp


#endif // MOCKPP_EXPECTATIONLIST_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationMap.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationMap.h
/**
  @file    
  @brief    Check maps of expectations
                    
  @verbatim
    
    begin                : Thu Dec 26 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationMap.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.12  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.11  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.10  2003/02/25 20:20:35  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.9  2003/02/18 19:51:09  ewald-arnold
    updated copyright date

    Revision 1.8  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.7  2003/01/04 13:09:56  ewald-arnold
    fix cr-lf

    Revision 1.6  2003/01/04 12:24:53  ewald-arnold
    port to BCB5

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:22:18  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONMAP_H
#define MOCKPP_EXPECTATIONMAP_H

#include <mockpp/mockpp.h> // always first

#include <algorithm>
#include <map>

#include <mockpp/ExpectationSet.h>


namespace mockpp {


/** 
  * A class to verify maps of expectations: each expected object must occur at 
  * least once.
  */
template <class Key, class Value>
class ExpectationMap : private ExpectationSet<Key>
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    ExpectationMap(const String &name, Verifiable *parent)
      :  ExpectationSet<Key>(name, 0)
    {
    }

    
  /** Adds another expectation value to the list.
    * @param pair   key/value pair
    */
    void addExpected(const std::pair<const Key, const Value> &pair)
    {
      ExpectationSet<Key>::addExpected(pair.first);
      myEntries.insert(pair);
    }


  /** Adds a sequence of expectation values to the map.
    * @param items    start iterator
    * @param end      terminating iterator (note: one element "behind" as always with STL)
    */
    template <class I>
    void addExpected(I items, I end)
    {
      for ( /* -- */; items != end; ++items)
        addExpected(*items);
    }

    
  /** Adds another expectation value to the list.
    * @param key    key for the item
    * @param value value of the item
    */
    void addExpected(const Key &key, const Value &value)
    {
      ExpectationSet<Key>::addExpected(key);
      myEntries.insert(std::make_pair(key, value));
    }


  /** Adds another expectation value to the list.
    * Only the key is added without a value.
    * @param key    key for the item
    */
    void addExpectedMissing(const Key &key)
    {
      ExpectationSet<Key>::addExpected(key);
    }

    
  /** Gets a value from the actual values .
    * Only the key is added without a value.
    * @param key    key for the item
    */
    Value get(const Key &key)
    {
      addActual(key);
      return (*myEntries.find(key)).second;
    }

    
    // move from private to public
    ExpectationSet<Key>::setExpectNothing;
    ExpectationSet<Key>::addActual;
    ExpectationSet<Key>::clearActual;
    ExpectationSet<Key>::hasExpectations;
    ExpectationSet<Key>::setFailOnVerify;
    ExpectationSet<Key>::verify;
    ExpectationSet<Key>::getName;

  private:

    std::map<Key, Value>   myEntries;
};


}; // namespace mockpp


#endif // MOCKPP_EXPECTATIONMAP_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationSegment.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationSegment.h
/**
  @file    
  @brief    Check expectations for substrings
                    
  @verbatim
    
    begin                : Thu Dec 18 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationSegment.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.10  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.9  2003/02/25 20:20:36  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.8  2003/02/18 19:51:09  ewald-arnold
    updated copyright date

    Revision 1.7  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.6  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONSEGMENT_H
#define MOCKPP_EXPECTATIONSEGMENT_H


#include <mockpp/mockpp.h> // always first

#include <mockpp/AbstractExpectation.h>
#include <mockpp/util/AssertMo.h>


namespace mockpp {


/** 
  * A class to verify the occurence of a substring.
  */
template <class Str>
class ExpectationSegment : public AbstractExpectation<Str>
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    ExpectationSegment(const String &name, VerifiableList *parent)
      : AbstractExpectation<Str>(name, parent),
        expectNothing(false),

        haveActualValue(false)
    {
    }

  
  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    void clearActual()
    {
      haveActualValue = false;
      myActualString = Str();
    }

    
  /** Sets the actual target string which must contain the string segment.
    * @param aString   the actual target string
    */
    void setActual(const Str &aString)
    {
      haveActualValue = true;
      myActualString = aString;
      if (shouldCheckImmediately())
      {
        verify();
      }
    }

    
  /** Sets the expected sub string.
    * @param segment substring which must occur
    */
    void setExpected(const Str &segment)
    {
      myExpectedSegment = segment;
      setHasExpectations();
    }

    
  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    void setExpectNothing()
    {
      expectNothing = true;
      myActualString = Str();
      setExpected(Str());
    }

    
  /**
    * Verify that the substring occurs in the target string.
    * If it fails, an AssertionFailedError is thrown
    */
    void verify()
    {
      if( expectNothing )
      {
        String fmt = ("%1 expected no value.");
        fmt << getName();
        MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue );

      }
      else
      {
        if (!hasExpectations() )
          return;

        String fmt = ("%1 expected a value.");
        fmt << getName();
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue );

        MOCKPP_ASSERT_INCLUDES_MESSAGE(
            ("Should include string segment."),
            myExpectedSegment,
            myActualString);
      }
    }
    
  private:

    Str   myExpectedSegment;
    Str   myActualString;
    bool  haveActualValue;
    bool  expectNothing;
};


}; // namespace mockpp


#endif // MOCKPP_EXPECTATIONSEGMENT_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationSet.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationSet.h
/**
  @file    
  @brief    Check sets of expectations
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationSet.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.12  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.11  2003/02/25 20:20:37  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.10  2003/02/18 19:51:09  ewald-arnold
    updated copyright date

    Revision 1.9  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.8  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.7  2003/01/04 13:09:56  ewald-arnold
    fix cr-lf

    Revision 1.6  2003/01/04 12:24:53  ewald-arnold
    port to BCB5

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:55  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:19  ewald-arnold
    - preparations for  and windoze
    - restructured due to Ex-Map

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONSET_H
#define MOCKPP_EXPECTATIONSET_H

#include <mockpp/mockpp.h> // always first

#include <algorithm>
#include <set>

#include <mockpp/AbstractExpectationCollection.h>
#include <mockpp/util/AssertMo.h>


namespace mockpp {


/** 
  * A class to verify sets of expectations: each expected object must occur at 
  * least once.
  */
template <class T>
class ExpectationSet : public AbstractExpectationCollection<T>
{

  public:

    ExpectationSet(const String &name, VerifiableList *parent)
      : AbstractExpectationCollection<T>(name, parent),
        expectNothing(false),
        haveActualValue(false)
    {
    }


  /** Adds another actual value to the list.
    * @param actualItem  new value
    */
    void addActual(const T &actualItem)
    {
      actualItems.insert(actualItem);
      haveActualValue = true;
      
      if (shouldCheckImmediately())
        checkImmediateValue(actualItem);
    }


  /** Adds a sequence ot actual values to the set.
    * @param items    start iterator
    * @param end      terminating iterator (note: one element "behind" as always with STL)
    */
    template <class I>
    void addActual(I items, I end)
    {
      for ( /* -- */; items != end; ++items)
        addActual(*items);
    }


  /** Adds another expectation value to the list.
    * @param expectedItem  new value
    */
    void addExpected(const T &expectedItem)
    {
      expectedItems.insert(expectedItem);
      setHasExpectations();
    }


  /** Adds a sequence of expectation values to the set.
    * @param items    start iterator
    * @param end      terminating iterator (note: one element "behind" as always with STL)
    */
    template <class I>
    void addExpected(I items, I end)
    {
      for ( /* -- */; items != end; ++items)
        addExpected(*items);
    }


  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    virtual void clearActual()
    {
      haveActualValue = false;
      actualItems.clear();
    }


  /**
    * Verify that the expected values equal the expected ones.
    * Note: in a set there is always only one element of a given value and the order
    * of the elements is not relevant.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify()
    {
      if( expectNothing)
      {
        String fmt = ("%1 expected no value.");
        fmt << getName();
        MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue );
      }
      else
      {
        if (!hasExpectations() )
          return;

        String fmt = ("%1 expected a value.");
        fmt << getName();

        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue );

        fmt = ("%1 did not receive the expected number of collection items.");
        fmt << getName();

        MOCKPP_ASSERT_TRUE_MESSAGE(fmt,actualItems.size() == expectedItems.size());

        fmt = ("%1 did not receive the expected item set.");
        fmt << getName();

        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, actualItems == expectedItems);
      }
    }

    
  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    virtual void setExpectNothing()
    {
      expectNothing = true;
      clearExpectation();
      setHasExpectations();
    }


    AbstractExpectationCollection<T>::getName;

  protected:

  /**
    * Clears the expectation list.
    */
    virtual void clearExpectation()
    {
      expectedItems.clear();
    }


  /**
    * Checks if the actual value matches the expectation.
    * Note: in a set there is always only one element of a given value and the order
    * of the elements is not relevant.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void checkImmediateValue(const T &actualItem)
    {
      String fmt = ("%1 did not receive an expected item.\nUnexpected: %2");
      fmt << getName() << actualItem;
      
      MOCKPP_ASSERT_TRUE_MESSAGE(fmt,
          std::find(expectedItems.begin(), expectedItems.end(), actualItem) != expectedItems.end());
    }      

  private:

    std::set<T> actualItems;
    std::set<T> expectedItems;
    bool        haveActualValue;
    bool        expectNothing;
};



}; // namespace mockpp


#endif // MOCKPP_EXPECTATIONSET_H


Index: avida/current/source/third-party/trio-1.9/mockpp/ExpectationValue.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ExpectationValue.h
/**
  @file    
  @brief    Check for expected values
                    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationValue.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.13  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.12  2003/03/08 14:37:04  ewald-arnold
    changes for Borland BCB

    Revision 1.11  2003/02/25 20:20:38  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.10  2003/02/25 17:57:20  ewald-arnold
    template specialisation to prevent dangerous use

    Revision 1.9  2003/02/18 19:51:09  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.7  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.6  2003/01/06 13:40:56  ewald-arnold
    output values with message

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:56  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXPECTATIONVALUE_H
#define MOCKPP_EXPECTATIONVALUE_H


#include <mockpp/mockpp.h> // always first

#include <mockpp/AbstractExpectation.h>

#include <mockpp/util/AssertMo.h>


namespace mockpp {


/** 
  * A class to verify the equality of expected and actual value.
  * Attention: This class is not intended for float types! It just does not work!
  *            Use ExpectationBoundary instead. 
  */
template <class T>              
class ExpectationValue : public AbstractExpectation<T>
{
  private:

    T    myExpectedValue;
    T    myActualValue;
    bool haveActualValue;
    bool expectNothing;

  public:
  

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    ExpectationValue(const String &name, VerifiableList *parent)
     : AbstractExpectation<T>(name, parent),
       expectNothing(false),
       haveActualValue(false)
    {
    }

    
  /**
    * Resets the internal state to reflect that there is no actual value set.
    */
    virtual void clearActual()
    {
        haveActualValue = false;
    }

    
  /** Sets the actual value.
    * @param value  the actual value
    */
    void setActual(const T &aValue)
    {
      myActualValue = aValue;
      haveActualValue = true;
      if (shouldCheckImmediately())
      {
        verify();
      }
    }


  /** Sets the expectation value.
    * @param value  target value
    */
    void setExpected(const T &aValue)
    {
        myExpectedValue = aValue;
        setHasExpectations();
    }

    
  /**
    * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
    * the handling of an error. The Expectation will fail if any actual values are set.
    *
    * Note that this is not the same as not setting any expectations, in which case verify()
    * will do nothing.
    */
    virtual void setExpectNothing()
    {
        expectNothing = true;
        myActualValue = myExpectedValue;
    }


  /**
    * Verify that the expected and actual value are equal.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify()
    {
      if( expectNothing )
      {
        String fmt = ("%1 expected no value.");
        fmt << getName();

        MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue );
      }
      else
      {
        if (!hasExpectations() )
          return;

        String fmt = ("%1 expected a value.");
        fmt << getName();

        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue );

        fmt = ("%1 did not receive the expected value. %2 != %3.");
        fmt << getName() << myExpectedValue << myActualValue;

        assertEquals(fmt, myExpectedValue, myActualValue);
      }   
    }
};


#ifndef DOXYGEN_SHOULD_SKIP_THIS

#ifndef MOCKP_NO_PREVENT_FLOAT_EXPECTATION

// Hopefully prevent people with this from using these dangerous
// template instantiations: 
//
// ==> 1/3 is not the same as 0.3333333 so the following classes won't work!

template<>
class ExpectationValue<float>
{
  public:
    ExpectationValue<float>();

  private:
    void setExpected(const float &aValue);
};

template<>
class ExpectationValue<double>
{
  public:
    ExpectationValue<double>();
    
  private:    
    void setExpected(const double &aValue);
};

//template<>
//class ExpectationValue<long double>
//{
//  public:
//    ExpectationValue<long double>();
//    
//  private:    
//    void setExpected(const long double &aValue);
//};


#endif // MOCKP__NO_PREVENT_FLOAT_EXPECTATION

#endif // DOXYGEN_SHOULD_SKIP_THIS

};  // namespace mockpp


#endif // MOCKPP_EXPECTATIONVALUE_H

Index: avida/current/source/third-party/trio-1.9/mockpp/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/Makefile.am
INCLUDES = -I$(srcdir)/..

SUBDIRS  =  compat util . docs tests po examples

#lib_LIBRARIES = libmockpp.a
noinst_LIBRARIES = libmockpp.a

# -release $(LT_RELEASE)
# libmockpp_a_LDFLAGS = -no-undefined \
#  -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 

#libmockpp_a_LIBADD  = $(LIBPTHREAD) \
#  util/libutil.a      \
#  compat/libcompat.a 

libmockpp_a_SOURCES = \
  ExpectationCounter.cpp \
  mockpp.cpp  \
  Throwable.cpp  \
  ThrowableList.cpp  \
  MockObject.cpp \
  VisitableMockObject.cpp \
  VerifiableList.cpp \
  Verifiable.cpp

pkginclude_HEADERS = \
  mockpp_config.h \
  ReturnObjectList.h \
  Expectation.h \
  AbstractExpectation.h \
  ExpectationValue.h \
  ExpectationSegment.h \
  ExpectationList.h \
  ExpectationSet.h \
  ExpectationMap.h \
  ExpectationBoundary.h \
  AbstractExpectationCollection.h \
  VisitableMockObject_macro.h \
  VisitableMockObject_template.h \
  $(libmockpp_a_SOURCES:.cpp=.h)

EXTRA_DIST = doc-template.h
  
CLEANFILES = *.~* *.~~* *~ mockpp_config.h

PHONY: metrics 

metrics:
	cxxmetric $(srcdir)/*.h $(srcdir)/*.cpp \
                  $(srcdir)/compat/*.h $(srcdir)/compat/*.cpp  \
                  $(srcdir)/util/*.h $(srcdir)/util/*.cpp 
	cxxmetric $(srcdir)/tests/*.cpp
        
doc-template.h: $(srcdir)/doc-template.raw $(pkginclude_HEADERS)
	echo #################################################
	echo ## WARNING: $(srcdir)/$@ is regenerated
	echo #################################################
	-cpp -I. -I.. -I $(top_srcdir)  $< >$@.tmp
	filelen=`wc -l $@.tmp | awk '{ print $$1 }'`; \
	splitpos=`grep -n SPLIT_START doc-template.h.tmp | sed s/:/\ /g | awk '{ print $$1 }'`; \
	tail -n `expr $$filelen - $$splitpos` $@.tmp >$(srcdir)/$@
	rm $@.tmp
	-indent -nut $(srcdir)/$@
  
# mockpp_config.h : ../config.h
# 	echo "/* Edit this file with care. It is automatically generated from config.h. */" >$@
# 	grep HAVE_VALUES ../config.h >>$@

i18n_files = *.cpp *.h compat/*.h compat/*.cpp util/*.h util/*.cpp

messages:
	cd $(srcdir) && xgettext `ls $(i18n_files)` -C -kI18N_NOOP -ki18n -o  po/$(PACKAGE).pot


Index: avida/current/source/third-party/trio-1.9/mockpp/Makefile.in
+++ avida/current/source/third-party/trio-1.9/mockpp/Makefile.in
# Makefile.in generated by automake 1.7.6 from Makefile.am.
# @configure_input@

# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../..

am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_PRIMITIVE_FALSE = @BUILD_PRIMITIVE_FALSE@
BUILD_PRIMITIVE_TRUE = @BUILD_PRIMITIVE_TRUE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CODE_TESTS_FALSE = @CODE_TESTS_FALSE@
CODE_TESTS_TRUE = @CODE_TESTS_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFAULT_TESTS_FALSE = @DEFAULT_TESTS_FALSE@
DEFAULT_TESTS_TRUE = @DEFAULT_TESTS_TRUE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HTMLDIR = @HTMLDIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
QMAKE = @QMAKE@
QMAKE_DEBUG_FALSE = @QMAKE_DEBUG_FALSE@
QMAKE_DEBUG_TRUE = @QMAKE_DEBUG_TRUE@
QMAKE_WARN_FALSE = @QMAKE_WARN_FALSE@
QMAKE_WARN_TRUE = @QMAKE_WARN_TRUE@
QT_VIEWER_FALSE = @QT_VIEWER_FALSE@
QT_VIEWER_TRUE = @QT_VIEWER_TRUE@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TEDIOUS_TESTS_FALSE = @TEDIOUS_TESTS_FALSE@
TEDIOUS_TESTS_TRUE = @TEDIOUS_TESTS_TRUE@
VERSION = @VERSION@
VIEW = @VIEW@
VIEWER_FALSE = @VIEWER_FALSE@
VIEWER_TRUE = @VIEWER_TRUE@
VIEW_LIBS = @VIEW_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I$(srcdir)/..

SUBDIRS = compat util . docs tests po examples

#lib_LIBRARIES = libmockpp.a
noinst_LIBRARIES = libmockpp.a


# -release $(LT_RELEASE)
# libmockpp_a_LDFLAGS = -no-undefined \
#  -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 

#libmockpp_a_LIBADD  = $(LIBPTHREAD) \
#  util/libutil.a      \
#  compat/libcompat.a 
libmockpp_a_SOURCES = \
  ExpectationCounter.cpp \
  mockpp.cpp  \
  Throwable.cpp  \
  ThrowableList.cpp  \
  MockObject.cpp \
  VisitableMockObject.cpp \
  VerifiableList.cpp \
  Verifiable.cpp


pkginclude_HEADERS = \
  mockpp_config.h \
  ReturnObjectList.h \
  Expectation.h \
  AbstractExpectation.h \
  ExpectationValue.h \
  ExpectationSegment.h \
  ExpectationList.h \
  ExpectationSet.h \
  ExpectationMap.h \
  ExpectationBoundary.h \
  AbstractExpectationCollection.h \
  VisitableMockObject_macro.h \
  VisitableMockObject_template.h \
  $(libmockpp_a_SOURCES:.cpp=.h)


EXTRA_DIST = doc-template.h

CLEANFILES = *.~* *.~~* *~ mockpp_config.h


# mockpp_config.h : ../config.h
# 	echo "/* Edit this file with care. It is automatically generated from config.h. */" >$@
# 	grep HAVE_VALUES ../config.h >>$@
i18n_files = *.cpp *.h compat/*.h compat/*.cpp util/*.h util/*.cpp
subdir = source/third-party/mockpp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)

libmockpp_a_AR = $(AR) cru
libmockpp_a_LIBADD =
am_libmockpp_a_OBJECTS = ExpectationCounter.$(OBJEXT) mockpp.$(OBJEXT) \
	Throwable.$(OBJEXT) ThrowableList.$(OBJEXT) \
	MockObject.$(OBJEXT) VisitableMockObject.$(OBJEXT) \
	VerifiableList.$(OBJEXT) Verifiable.$(OBJEXT)
libmockpp_a_OBJECTS = $(am_libmockpp_a_OBJECTS)

DEFAULT_INCLUDES =  -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE at DEP_FILES = ./$(DEPDIR)/ExpectationCounter.Po \
@AMDEP_TRUE@	./$(DEPDIR)/MockObject.Po ./$(DEPDIR)/Throwable.Po \
@AMDEP_TRUE@	./$(DEPDIR)/ThrowableList.Po \
@AMDEP_TRUE@	./$(DEPDIR)/Verifiable.Po \
@AMDEP_TRUE@	./$(DEPDIR)/VerifiableList.Po \
@AMDEP_TRUE@	./$(DEPDIR)/VisitableMockObject.Po \
@AMDEP_TRUE@	./$(DEPDIR)/mockpp.Po
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
	-o $@
DIST_SOURCES = $(libmockpp_a_SOURCES)
HEADERS = $(pkginclude_HEADERS)


RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
	ps-recursive install-info-recursive uninstall-info-recursive \
	all-recursive install-data-recursive install-exec-recursive \
	installdirs-recursive install-recursive uninstall-recursive \
	check-recursive installcheck-recursive
DIST_COMMON = $(pkginclude_HEADERS) Makefile.am Makefile.in
DIST_SUBDIRS = $(SUBDIRS)
SOURCES = $(libmockpp_a_SOURCES)

all: all-recursive

SUFFIXES:
SUFFIXES: .cpp .o .obj
$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  source/third-party/mockpp/Makefile
Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)

AR = ar

clean-noinstLIBRARIES:
	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libmockpp.a: $(libmockpp_a_OBJECTS) $(libmockpp_a_DEPENDENCIES) 
	-rm -f libmockpp.a
	$(libmockpp_a_AR) libmockpp.a $(libmockpp_a_OBJECTS) $(libmockpp_a_LIBADD)
	$(RANLIB) libmockpp.a

mostlyclean-compile:
	-rm -f *.$(OBJEXT) core *.core

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ExpectationCounter.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MockObject.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Throwable.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ThrowableList.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Verifiable.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/VerifiableList.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/VisitableMockObject.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mockpp.Po at am__quote@

distclean-depend:
	-rm -rf ./$(DEPDIR)

cpp.o:
@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@	fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<

cpp.obj:
@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@	fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f"; \
	  $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f; \
	done

uninstall-pkgincludeHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " rm -f $(DESTDIR)$(pkgincludedir)/$$f"; \
	  rm -f $(DESTDIR)$(pkgincludedir)/$$f; \
	done

# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
#     (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
	@set fnord $$MAKEFLAGS; amf=$$2; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    dot_seen=yes; \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	done; \
	if test "$$dot_seen" = "no"; then \
	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
	fi; test -z "$$fail"

mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
	@set fnord $$MAKEFLAGS; amf=$$2; \
	dot_seen=no; \
	case "$@" in \
	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	  *) list='$(SUBDIRS)' ;; \
	esac; \
	rev=''; for subdir in $$list; do \
	  if test "$$subdir" = "."; then :; else \
	    rev="$$subdir $$rev"; \
	  fi; \
	done; \
	rev="$$rev ."; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"
tags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
	done
ctags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
	done

ETAGS = etags
ETAGSFLAGS =

CTAGS = ctags
CTAGSFLAGS =

tags: TAGS

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique

TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	if (etags --etags-include --version) >/dev/null 2>&1; then \
	  include_option=--etags-include; \
	else \
	  include_option=--include; \
	fi; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test -f $$subdir/TAGS && \
	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
	  fi; \
	done; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(ETAGS_ARGS)$$tags$$unique" \
	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	     $$tags $$unique

ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

top_distdir = ../../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkinstalldirs) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test -d $(distdir)/$$subdir \
	    || mkdir $(distdir)/$$subdir \
	    || exit 1; \
	    (cd $$subdir && \
	      $(MAKE) $(AM_MAKEFLAGS) \
	        top_distdir="$(top_distdir)" \
	        distdir=../$(distdir)/$$subdir \
	        distdir) \
	      || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-recursive
all-am: Makefile $(LIBRARIES) $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
	$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)

install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-recursive
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:
	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive

clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am

distclean: distclean-recursive

distclean-am: clean-am distclean-compile distclean-depend \
	distclean-generic distclean-tags

dvi: dvi-recursive

dvi-am:

info: info-recursive

info-am:

install-data-am: install-pkgincludeHEADERS

install-exec-am:

install-info: install-info-recursive

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-recursive

maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-recursive

mostlyclean-am: mostlyclean-compile mostlyclean-generic

pdf: pdf-recursive

pdf-am:

ps: ps-recursive

ps-am:

uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS

uninstall-info: uninstall-info-recursive

PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
	clean-generic clean-noinstLIBRARIES clean-recursive ctags \
	ctags-recursive distclean distclean-compile distclean-depend \
	distclean-generic distclean-recursive distclean-tags distdir \
	dvi dvi-am dvi-recursive info info-am info-recursive install \
	install-am install-data install-data-am install-data-recursive \
	install-exec install-exec-am install-exec-recursive \
	install-info install-info-am install-info-recursive install-man \
	install-pkgincludeHEADERS install-recursive install-strip \
	installcheck installcheck-am installdirs installdirs-am \
	installdirs-recursive maintainer-clean maintainer-clean-generic \
	maintainer-clean-recursive mostlyclean mostlyclean-compile \
	mostlyclean-generic mostlyclean-recursive pdf pdf-am \
	pdf-recursive ps ps-am ps-recursive tags tags-recursive \
	uninstall uninstall-am uninstall-info-am \
	uninstall-info-recursive uninstall-pkgincludeHEADERS \
	uninstall-recursive


PHONY: metrics 

metrics:
	cxxmetric $(srcdir)/*.h $(srcdir)/*.cpp \
                  $(srcdir)/compat/*.h $(srcdir)/compat/*.cpp  \
                  $(srcdir)/util/*.h $(srcdir)/util/*.cpp 
	cxxmetric $(srcdir)/tests/*.cpp

doc-template.h: $(srcdir)/doc-template.raw $(pkginclude_HEADERS)
	echo #################################################
	echo ## WARNING: $(srcdir)/$@ is regenerated
	echo #################################################
	-cpp -I. -I.. -I $(top_srcdir)  $< >$@.tmp
	filelen=`wc -l $@.tmp | awk '{ print $$1 }'`; \
	splitpos=`grep -n SPLIT_START doc-template.h.tmp | sed s/:/\ /g | awk '{ print $$1 }'`; \
	tail -n `expr $$filelen - $$splitpos` $@.tmp >$(srcdir)/$@
	rm $@.tmp
	-indent -nut $(srcdir)/$@

messages:
	cd $(srcdir) && xgettext `ls $(i18n_files)` -C -kI18N_NOOP -ki18n -o  po/$(PACKAGE).pot
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
NOEXPORT:

Index: avida/current/source/third-party/trio-1.9/mockpp/MockObject.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/MockObject.cpp
/**
  @file    
  @brief    base class for mock objects
    
  @verbatim
    
    begin                : Fri Dec 18 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: MockObject.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.16  2003/04/23 20:44:25  ewald-arnold
    removed Mutex class

    Revision 1.15  2003/04/13 16:59:22  ewald-arnold
    - removed multithread stuff
    - simplified MockObject::verify()
    - moved name to Verifiable class

    Revision 1.14  2003/04/09 19:18:25  ewald-arnold
    make multithreading an option

    Revision 1.13  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.12  2003/03/28 20:04:14  ewald-arnold
    extended doxygen stuff

    Revision 1.11  2003/02/18 19:51:09  ewald-arnold
    updated copyright date

    Revision 1.10  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.9  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.8  2003/01/04 13:09:56  ewald-arnold
    fix cr-lf

    Revision 1.7  2003/01/04 12:24:53  ewald-arnold
    port to BCB5

    Revision 1.6  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.5  2002/12/31 13:32:16  ewald-arnold
    fixed endless recursion

    Revision 1.4  2002/12/31 11:18:56  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.

   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 **/

#include <mockpp/mockpp.h> // always first

#include <algorithm>

#include <mockpp/MockObject.h>

#include <mockpp/util/AssertMo.h>


namespace mockpp {


MOCKPP_EXPORT MockObject::MockObject(const String &name, VerifiableList *parent)
 : VerifiableList(name, parent)
{
}


void MOCKPP_EXPORT MockObject::notImplemented()
{
#ifdef MOCKPP_UNICODE
  MOCKPP_NOT_IMPLEMENTED(getUnicode(typeid(*this).name()));
#else
  MOCKPP_NOT_IMPLEMENTED(typeid(*this).name());
#endif
}


void MOCKPP_EXPORT MockObject::verify()
{
  verifyAnObject(this);
}


void MOCKPP_EXPORT MockObject::verifyAnObject(VerifiableList* anObject)
{
  VerifierVec myProcessingObjects;
  myProcessingObjects.push_back(anObject); // avoids endless recursion
  verifySubFields(anObject, myProcessingObjects);
}


void MOCKPP_EXPORT MockObject::verifySubFields(Verifiable  *anObject,
                                               VerifierVec &alreadyProcessed)
{
  if (anObject == 0)
    return;

  if (anObject != 0)
    verifyField(anObject, alreadyProcessed);

  for (unsigned i = 0; i < anObject->numVerifiables(); ++i)
    verifySubFields(anObject->getVerifiable(i), alreadyProcessed);

}


void MOCKPP_EXPORT MockObject::verifyField(Verifiable  *anObject,
                                           VerifierVec &alreadyProcessed)
{
  if (   isVerifiable(anObject)
      && std::find(alreadyProcessed.begin(), alreadyProcessed.end(), anObject) == alreadyProcessed.end())
  {
    alreadyProcessed.push_back(anObject);
    anObject->verify();
  }
}


bool MOCKPP_EXPORT MockObject::isVerifiable(Verifiable *anObject)
{
  return dynamic_cast<Verifiable*>(anObject) != 0;
}


}; // namespace mockpp

Index: avida/current/source/third-party/trio-1.9/mockpp/MockObject.h
+++ avida/current/source/third-party/trio-1.9/mockpp/MockObject.h
/**
  @file
  @brief    Base class for mock objects
                    
  @verbatim
    
    begin                : Fri Dec 18 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: MockObject.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.11  2003/04/13 16:59:22  ewald-arnold
    - removed multithread stuff
    - simplified MockObject::verify()
    - moved name to Verifiable class

    Revision 1.10  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.9  2003/03/08 13:26:19  ewald-arnold
    updated docs

    Revision 1.8  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.7  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.6  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.5  2003/01/04 13:09:56  ewald-arnold
    fix cr-lf

    Revision 1.4  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.3  2002/12/31 11:18:56  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_MOCKOBJECTS_H
#define MOCKPP_MOCKOBJECTS_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/VerifiableList.h>


namespace mockpp {


/** Base class for setting up mock objcts that are able to
  * emulate a real world object.
  * @important: One MockObject should never have another MockObject as child!
  *             Otherwise there might be collisons when verify()-ing the obhects.
  */
class MockObject : public VerifiableList
{
  public:

  /** Constructs the mock object.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    MockObject(const String &name, VerifiableList *parent = 0);

  /** Throws a NotImplementedException with the actual objects typeid().
    */
    void notImplemented();

  /** Verifies the object and the mock objects it contains..
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify();

  private:

    typedef std::vector<Verifiable*> VerifierVec;

  /**
    * Verifies all the fields of type Verifiable in the given object, including
    * those inherited from superclasses but excluding the object itself
    * @param anObject The object to be verified.
    */
    static void verifyAnObject(VerifiableList* anObject);

  /** Verifies all fields in an object
    * @param anObject          The object to be verified.
    * @param alreadyProcessed  contain already processed objects (check only once)
    * @param verify_self       false: don't verify the object itself
    */
    static void verifySubFields(Verifiable  *anObject,
                                VerifierVec &alreadyProcessed);

  /** Verifies a single field from an object
    * @param anObject          The object to be verified.
    * @param alreadyProcessed  contain already processed objects (check only once)
    */
    static void verifyField(Verifiable  *anObject,
                            VerifierVec &alreadyProcessed);

  /** Checks if an object is derived from <Verifiable>
    * @param anObject   The object to be verified.
    * @return true: The object is verifiable
    */
    static bool isVerifiable(Verifiable *anObject);

    String  myName;
};


}; // namespace mockpp


#endif // MOCKPP_MOCKOBJECTS_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ReturnObjectList.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ReturnObjectList.h
/**
  @file    
  @brief    Handle returned objects
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ReturnObjectList.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.12  2003/04/13 16:54:09  ewald-arnold
    moved name to Verifiable class

    Revision 1.11  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.10  2003/02/20 18:50:51  ewald-arnold
    avoid memory leak

    Revision 1.9  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/16 17:40:07  ewald-arnold
    really return value

    Revision 1.7  2003/02/08 08:19:39  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.6  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.5  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.4  2002/12/31 11:18:56  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:22:41  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_RETURNOBJECTLIST_H
#define MOCKPP_RETURNOBJECTLIST_H

#include <mockpp/mockpp.h> // always first

#include <deque>

#include <mockpp/Verifiable.h>

#include <mockpp/compat/Formatter.h>

#include <mockpp/util/AssertMo.h>


namespace mockpp {


class VerifiableList;

/**
  * This class allows a list of objects to be setup which can be used whilst.The
  * list is check to make sure that all the object in it are used and that none
  * are left over at the end of a test.</p>
  *
  * For evehasMoreObjectsr sucessive call to nextReturnObject the next object in the list will
  * returned.
  *
  * If the nextReturnObject method is called and there are no objects in the list
  * an assertion error will be thrown. If the verify method is called and there
  * are objects still in the list an assertion error will also be thrown.
  */
template <class T> 
class ReturnObjectList : public Verifiable
{
  private:

    std::deque<T> myObjects;

  public:
    
  /**
    * Construct a new empty list
    * @param aame Label used to identify list
    * @param parent  parent verifiable
    */
    ReturnObjectList(const String &name, VerifiableList *parent)
     : Verifiable (name, parent)
    {
    }


  /**
    * Add a next object to the end of the list.
    * @param anOjectToReturn object to be added to the list
    */
    void addObjectToReturn(const T &anObjectToReturn)
    {
      myObjects.push_back(anObjectToReturn);
    }
    

  /**
    * Add a sequence of next objects to the end of the list.
    * @param items    start iterator
    * @param end      terminating iterator (note: one element "behind" as always with STL)
    */
    template <class I>
    void addObjectToReturn(I items, I end)
    {
      for ( /* -- */; items != end; ++items)
        addObjectToReturn(*items);
    }


  /**
    * Returns the next object from the list. Each object it returned in the
    * order in which they where added.
    */
    T nextReturnObject()
    {
      String fmt = ("%1 has run out of objects.");
      fmt << getName() << myObjects.size();

      MOCKPP_ASSERT_TRUE_MESSAGE(fmt, myObjects.size() > 0);
      T temp = myObjects.front();

      myObjects.pop_front();
      return temp;
    }


  /**
    * Removes all the objects from the list.
    */
    void clear() 
    {
      myObjects.clear();
    }

            
  /**
    * Returns true if there are more objects to be returned.
    */
    bool hasMoreObjects() const
    {
      return myObjects.size() != 0;
    }

            
  /**
    * Verify that there are no objects left within the list.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify()
    {
      String fmt = ("%1 has %2 un-used objects.");
      fmt << getName() << myObjects.size();

      MOCKPP_ASSERT_EQUALS_MESSAGE(fmt, (size_t)0, myObjects.size());
    }
};


}; // namespace mockpp

#endif // MOCKPP_RETURNOBJECTLIST_H

Index: avida/current/source/third-party/trio-1.9/mockpp/Throwable.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/Throwable.cpp
/**
  @file    
  @brief    support throwing exceptions
    
  @verbatim
    
    begin                : Sam Feb 8 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Throwable.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.6  2003/03/28 20:04:14  ewald-arnold
    extended doxygen stuff

    Revision 1.5  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.4  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.3  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.2  2003/02/16 17:39:03  ewald-arnold
    split into two files

    Revision 1.1  2003/02/08 08:21:31  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/Assert.h>

#include <mockpp/Throwable.h>

#include <iostream>

namespace mockpp {


MOCKPP_EXPORT ThrowableItem::ThrowableItem(Throwable *it)
  : item(0)
{
  take(it);
}


MOCKPP_EXPORT ThrowableItem::~ThrowableItem() throw()
{
  take((Throwable*)0);
}


void MOCKPP_EXPORT ThrowableItem::take(Throwable *it)
{
  delete item;
  item = it;
}


Throwable *MOCKPP_EXPORT ThrowableItem::get() const
{
  return item;
}


void MOCKPP_EXPORT ThrowableItem::clear()    
{
  take((Throwable*)0);
}


};  // namespace mockpp


Index: avida/current/source/third-party/trio-1.9/mockpp/Throwable.h
+++ avida/current/source/third-party/trio-1.9/mockpp/Throwable.h
/**
  @file    
  @brief    Support throwing exceptions
                    
  @verbatim
    
    begin                : Mon Jan 20 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Throwable.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.6  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.5  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.4  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.3  2003/02/21 11:57:38  ewald-arnold
    added docs

    Revision 1.2  2003/02/16 17:39:03  ewald-arnold
    split into two files

    Revision 1.1  2003/02/08 08:21:31  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_THROWABLE_H
#define MOCKPP_THROWABLE_H

#include <mockpp/mockpp.h> // always first


namespace mockpp {


/**
  * A virtual base class to handle throwable objects
  */
class Throwable
{
  public:

  /**
    * Throws the object.
    */
    virtual void throw_me()  = 0;
    
  /**
    * Queries if the object has been thrown.
    * @return true: object has been thrown at least once
    */
    virtual bool hasThrown() const = 0;
    
  /**
    * Destruct the Throwable.
    */
    virtual ~Throwable() 
    {}
};


/**
  * A helper template to wrap a throwable object in a uniform fashion.
  */
template <class T>
class ThrowableWrapper : public Throwable
{
  public:
  
  /**
    * Throws the object.
    */
    virtual void throw_me() 
    {
       ++thrown;
       throw obj;
    }

    
  /**
    * Queries if the object has been thrown.
    * @return true: object has been thrown at least once
    */
    virtual bool hasThrown() const
    {
      return thrown > 0;
    }

        
  /**
    * Resets the counter to 0.
    */
    void clear()
    {
      thrown = 0;
    }
    
    
  /**
    * Contructs the ThrowableWrapper.
    * @param o  object to throw
    */
    ThrowableWrapper(const T &o)
     : obj(o),
       thrown(0)
    {}

  private:
  
    T        obj;
    unsigned thrown;
};


/**
  * Helper template to create a Throwable from an ordinary object.
  * @param  w   the object to throw
  * @return a pointer to the throwable object
  */
template <class T>
Throwable *make_throwable(const T &w)
{
  return new ThrowableWrapper<T> (w);
}


/**
  * A throwable object. The object is completely managed which also includes
  * the destruction of the object by the destructor of this container.
  */
class ThrowableItem
{
  public:

  /**
    * Construct the item.
    * @param  it  pointer to the throwable object
    */
    ThrowableItem(Throwable *it = 0);

  /**
    * Destruct the item.
    */
    virtual ~ThrowableItem() throw();

  /**
    * Set the throwable item.
    * Attention: In case you pass "0" to clear the object, don't forget to 
    * cast it to "Throwable", otherwise the template method will be taken!
    * @param  it  pointer to the throwable object
    */
    void take(Throwable *it);

  /**
    * Set the throwable item.
    * @param  w  the object to throw
    */
    template <class T>
    void take(const T &w)
    {
      take(make_throwable(w));
    }

  /**
    * Gets the throwable item.
    * @return pointer to the throwable
    */
    Throwable *get() const;

  /**
    * Sets the object into a clean and unused state
    */
    void clear();

  /**
    * Queries if the throwable object was taken via get().
    * There must also be an object set for this being true.
    * @return true: object was taken at least once
    */
    bool wasUsed() const;

  private:

    Throwable  *item;
};


}; // namespace mockpp


#endif // MOCKPP_THROWABLE_H

Index: avida/current/source/third-party/trio-1.9/mockpp/ThrowableList.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/ThrowableList.cpp
/**
  @file    
  @brief    support throwing lists of exceptions
    
  @verbatim
    
    begin                : We Jan 22 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ThrowableList.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.10  2003/04/13 16:54:41  ewald-arnold
    moved name to Verifiable class

    Revision 1.9  2003/04/09 19:04:48  ewald-arnold
    fix for M$VC

    Revision 1.8  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.7  2003/03/28 20:04:14  ewald-arnold
    extended doxygen stuff

    Revision 1.6  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.5  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.4  2003/02/21 11:58:14  ewald-arnold
    fixed some problems

    Revision 1.3  2003/02/20 18:50:31  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.1  2003/02/16 17:36:57  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/Assert.h>
#include <mockpp/compat/Formatter.h>

#include <mockpp/ThrowableList.h>
#include <mockpp/Throwable.h>

namespace mockpp {


MOCKPP_EXPORT ThrowableList::ThrowableList(const String &name, VerifiableList *parent)
 : Verifiable (name, parent)
{
}


MOCKPP_EXPORT ThrowableList::~ThrowableList() throw()
{
  clear();
}


void MOCKPP_EXPORT ThrowableList::push_back(Throwable *t)
{
//  MOCKPP_ASSERT_TRUE(t != 0);  Tricky: ResonseVector uses 0 to distinguish
//                               between values and throwables
  list.push_back(t);
}

    
unsigned MOCKPP_EXPORT ThrowableList::size() const
{
  return already_used.size() + list.size();
}


Throwable * MOCKPP_EXPORT ThrowableList::at(unsigned i) 
{
  MOCKPP_ASSERT_TRUE(i < already_used.size() + list.size());
  if (i < already_used.size() )
    return already_used[i];

  return list[i-already_used.size()];
/*
  if (i < already_used.size() )
    return already_used.at(i);

  return list.at(i-already_used.size());
*/
}


Throwable *MOCKPP_EXPORT ThrowableList::nextThrowableObject()
{
  String fmt = ("%1 has run out of objects.");
  fmt << getName() << list.size();

  MOCKPP_ASSERT_TRUE_MESSAGE(fmt, list.size() > 0);
  Throwable *temp = list.front();
  list.pop_front();
  already_used.push_back(temp);
  
  return temp;
}


bool MOCKPP_EXPORT ThrowableList::hasMoreObjects() const
{
   return list.size() != 0;
}


void MOCKPP_EXPORT ThrowableList::clear()
{
  for (unsigned i1 = 0; i1 < list.size(); ++i1)
    delete list[i1];
  list.clear();

  for (unsigned i2 = 0; i2 < already_used.size(); ++i2)
    delete already_used[i2];
  already_used.clear();
}


void MOCKPP_EXPORT ThrowableList::verify()
{
  String fmt = ("%1 has %2 un-used objects.");
  fmt << getName() << list.size();

  MOCKPP_ASSERT_EQUALS_MESSAGE(fmt, (size_t)0, list.size());
}

};  // namespace mockpp


Index: avida/current/source/third-party/trio-1.9/mockpp/ThrowableList.h
+++ avida/current/source/third-party/trio-1.9/mockpp/ThrowableList.h
/**
  @file    
  @brief    Support throwing lists of exceptions
                    
  @verbatim
    
    begin                : Mon Jan 20 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ThrowableList.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.6  2003/04/13 16:54:41  ewald-arnold
    moved name to Verifiable class

    Revision 1.5  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.4  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.3  2003/02/21 11:57:38  ewald-arnold
    added docs

    Revision 1.2  2003/02/20 18:50:31  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/16 17:36:57  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_THROWABLELIST_H
#define MOCKPP_THROWABLELIST_H

#include <mockpp/mockpp.h> // always first

#include <deque>

#include <mockpp/Verifiable.h>


namespace mockpp {

class Throwable;

/**
  * A lists of throwable objects. The objects are completely managed which also includes
  * the destruction of the objects by the destructor of this list.
  */
class ThrowableList : public Verifiable
{
  public:

  /**
    * Construct a new empty list
    * @param aName Label used to identify list
    * @param parent  parent verifiable
    */
    ThrowableList(const String &aName, VerifiableList *parent);

  /**
    * Destruct the list.
    */
    virtual ~ThrowableList() throw();

  /**
    * Add a next object to the end of the list.
    * The objects remains from now on in the responsibiliy of this list until
    * the list itself is destroyed! This is valid even for objects taken via
    * nextThrowableObject()!
    * Don't add the same object (the same pointer!) more than once via this method.
    * @param t pointer to object to be added to the list
    */
    void push_back(Throwable *t);

  /**
    * Add a next object to the end of the list.
    * The objects remains from now on in the responsibiliy of this list until
    * the list itself is destroyed! This is valid even for objects taken via
    * nextThrowableObject()!
    * @param T object to be added to the list
    */
    template <class T>
    void push_back(const T &w)
    {
      push_back(make_throwable(w));
    }

  /**
    * Returns the next object from the list. Each object it returned in the
    * order in which they where added.
    */
    Throwable *nextThrowableObject();

  /**
    * Returns true if there are more objects to be returned.
    */
    bool hasMoreObjects() const;

  /**
    * Returns a pointer to the specified object in the list.
    * The list is not changed!
    * @param  i   index of the object
    */
    Throwable *at(unsigned i);
    
  /**
    * Removes all the objects from the list.
    */
    void clear();
    
  /**
    * Verify that there are no objects left within the list.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify();

  /**
    * Returns the amount of response values.
    * The count covers already used and still unused obbjects!
    * @return number of response values
    */
    unsigned size() const;

  private:
    std::deque<Throwable *>  list;
    std::deque<Throwable *>  already_used;
};


}; // namespace mockpp


#endif // MOCKPP_THROWABLELIST_H

Index: avida/current/source/third-party/trio-1.9/mockpp/Verifiable.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/Verifiable.cpp
/**
  @file    
  @brief    abstract interface for verifiables
    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Verifiable.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.8  2003/04/13 17:00:00  ewald-arnold
    moved name to Verifiable class

    Revision 1.7  2003/03/28 20:04:14  ewald-arnold
    extended doxygen stuff

    Revision 1.6  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.5  2003/02/08 08:20:32  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.4  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.3  2002/12/31 11:23:09  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.1  2002/12/25 10:24:05  ewald-arnold
    new

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/


#include <mockpp/mockpp.h> // always first

#include <mockpp/Verifiable.h>
#include <mockpp/VerifiableList.h>


namespace mockpp {


MOCKPP_EXPORT Verifiable::Verifiable (const String &name, VerifiableList *parent)
{
  myParent = parent;
  myName = name;
  if (myParent != 0)
    myParent->addVerifiable(this);
}


String MOCKPP_EXPORT Verifiable::getName() const
{
  return myName;
}


MOCKPP_EXPORT Verifiable::~Verifiable ()
{
  if (myParent != 0)
    myParent->removeVerifiable(this);
  myParent = 0;
}


VerifiableList *MOCKPP_EXPORT Verifiable::getParent() const
{
  return myParent;
}


unsigned MOCKPP_EXPORT Verifiable::numVerifiables() const
{
  return 0;
}


Verifiable * MOCKPP_EXPORT Verifiable::getVerifiable(unsigned idx) const
{
  return 0;
}


};  // namespace mockpp


Index: avida/current/source/third-party/trio-1.9/mockpp/Verifiable.h
+++ avida/current/source/third-party/trio-1.9/mockpp/Verifiable.h
/**
  @file    
  @brief    Abstract interface for verifiables
                    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Verifiable.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.8  2003/04/13 17:00:00  ewald-arnold
    moved name to Verifiable class

    Revision 1.7  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.6  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.5  2003/02/08 08:20:32  ewald-arnold
    refactoring for new VerifiableList

    Revision 1.4  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.3  2002/12/31 11:23:09  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/25 10:24:32  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_VERIFIABLE_H
#define MOCKPP_VERIFIABLE_H


#include <mockpp/mockpp.h> // always first


namespace mockpp {


class VerifiableList;

/**
  * A Verifiable is an object that can confirm at the end of a unit test that
  * the correct behaviour has occurred.
  *
  * @see Verifier to check all the Verifiables in an object.
  */
class Verifiable
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    Verifiable (const String &name, VerifiableList *parent);

  /** Destructs the expectation.
    */
    virtual ~Verifiable ();

    friend class MockObject;

  /**
    * Throws an AssertionFailedException if any expectations have not been met.
    */
    virtual void verify() = 0;

  /**
    * Gets the name of the current mock object.
    * Names can be arbitrarily but should be chosen carefully to be able to
    * find the according object.
    * @return  objects name
    */
    String getName() const;

  protected:

  /** Gets a pointer to the parent of this object.
    * @return   pointer to parent
    */
    VerifiableList *getParent() const;

  /** Gets the number of verifiable sub-objects.
    * @return   number of objects
    */
    virtual unsigned numVerifiables() const;

  /** Gets a pointer to a verifiable sub-obect.
    * @param  idx   index of object in the list
    * @return   pointer to object    */
    virtual Verifiable *getVerifiable(unsigned idx) const;

  private:

    VerifiableList          *myParent;
    String                   myName;
};


};  // namespace mockpp


#endif // MOCKPP_VERIFIABLE_H

Index: avida/current/source/third-party/trio-1.9/mockpp/VerifiableList.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/VerifiableList.cpp
/**
  @file    
  @brief    a collection of verifiables
    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VerifiableList.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/04/13 17:02:56  ewald-arnold
    moved name to Verifiable class

    Revision 1.4  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.3  2003/03/28 20:04:15  ewald-arnold
    extended doxygen stuff

    Revision 1.2  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.1  2003/02/08 08:21:31  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 **/


#include <mockpp/mockpp.h> // always first

#include <algorithm>

#include <mockpp/VerifiableList.h>
#include <mockpp/compat/Assert.h>


namespace mockpp {


MOCKPP_EXPORT VerifiableList::VerifiableList (const String &name, VerifiableList *parent)
  : Verifiable(name, parent)
{
}


void MOCKPP_EXPORT VerifiableList::addVerifiable (Verifiable* vf)
{
  if (vf != 0)
    verifiables.push_back(vf);
}


void MOCKPP_EXPORT VerifiableList::removeVerifiable (Verifiable* vf)
{
  std::vector<Verifiable*>::iterator it =
     std::remove (verifiables.begin(), verifiables.end(), vf);
  verifiables.erase(it, verifiables.end());
}


unsigned MOCKPP_EXPORT VerifiableList::numVerifiables() const
{
  return verifiables.size();
}


Verifiable * MOCKPP_EXPORT VerifiableList::getVerifiable(unsigned idx) const
{
  MOCKPP_ASSERT_TRUE(idx < verifiables.size());

  return verifiables[idx];
}


};  // namespace mockpp


Index: avida/current/source/third-party/trio-1.9/mockpp/VerifiableList.h
+++ avida/current/source/third-party/trio-1.9/mockpp/VerifiableList.h
/**
  @file
  @brief     A collection of verifiables
                    
  @verbatim
    
    begin                : Thu Dec 17 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VerifiableList.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/04/13 17:02:56  ewald-arnold
    moved name to Verifiable class

    Revision 1.4  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.3  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.2  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.1  2003/02/08 08:21:31  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_VERIFIABLELIST_H
#define MOCKPP_VERIFIABLELIST_H


#include <mockpp/mockpp.h> // always first

#include <mockpp/Verifiable.h>

#include <vector>


namespace mockpp {


/**
  * A collection of verifiable objects which are verify()ed together.
  */
class VerifiableList : public Verifiable
{
  public:

  /** Constructs the expectation.
    * @param name    human readable description about the expectation
    * @param parent  parent verifiable
    */
    VerifiableList (const String &name, VerifiableList *parent);

  /**
    * Throws an AssertionFailedException if any expectations have not been met.
    */
//    virtual void verify() = 0;

  protected:

  friend class Verifier;
  friend class Verifiable;
    
  /** Adds another verifiable object to the list.
    * @param vf   pointer to the verifiable object
    */
    void addVerifiable (Verifiable* vf);

    
  /** Removes a verifiable object from the list.
    * @param vf   pointer to the verifiable object
    */
    void removeVerifiable (Verifiable* vf);

    
  /** Gets the number of verifiable sub-objects in the list.
    * @return   number of objects
    */
    virtual unsigned numVerifiables() const;


  /** Gets a pointer to a verifiable sub-object.
    * @param  idx   index of object in the list
    * @return   pointer to object or 0 when index too high
    */
    virtual Verifiable *getVerifiable(unsigned idx) const;

  private:

    std::vector<Verifiable*>  verifiables;
};


};  // namespace mockpp


#endif // MOCKPP_VERIFIABLELIST_H

Index: avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject.cpp
/**
  @file    
  @brief    MockObjects that can be visited under control
                    
  @verbatim
    
    begin                : Fri Dec 18 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.6  2003/03/28 20:04:15  ewald-arnold
    extended doxygen stuff

    Revision 1.5  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.4  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.3  2003/02/16 17:38:06  ewald-arnold
    update

    Revision 1.2  2003/02/08 08:22:40  ewald-arnold
    draft completed

    Revision 1.1  2003/01/16 17:39:21  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <mockpp/VisitableMockObject.h>


namespace mockpp {


MOCKPP_EXPORT VisitableMockObject::VisitableMockObject(const String &name, VerifiableList *parent)
 : MockObject(name, parent),
   methodList(name+("/methodList"), this)
{
  activated = false;
}


void MOCKPP_EXPORT VisitableMockObject::addExpectedMethod(const std::string &name)
{
  MOCKPP_ASSERT_EQUALS(isActivated(), false);
  methodList.addExpected(name);
}


void MOCKPP_EXPORT VisitableMockObject::addActualMethod(const std::string &name)
{
  MOCKPP_ASSERT_EQUALS(isActivated(), true);
  methodList.addActual(name);
}


void MOCKPP_EXPORT VisitableMockObject::activate()
{
  activated = true;
}


bool MOCKPP_EXPORT VisitableMockObject::isActivated() const
{
  return activated;
}


void MOCKPP_EXPORT VisitableMockObject::verify()
{
  MockObject::verify();
  for (unsigned i = 0; i < controllers.size(); ++i)
    controllers[i]->verify();
}


void MOCKPP_EXPORT VisitableMockObject::reset()
{
  activated = false;
  for (unsigned i = 0; i < controllers.size(); ++i)
    controllers[i]->reset();
}


void MOCKPP_EXPORT VisitableMockObject::addController (Controller *ctr)
{
  controllers.push_back(ctr);
}
 
    
void MOCKPP_EXPORT VisitableMockObject::removeController (Controller *ctr)
{
  std::vector<Controller*>::iterator it =
     std::remove (controllers.begin(), controllers.end(), ctr);
  controllers.erase(it, controllers.end());   
}
    

}; // namespace mockpp

Index: avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject.h
+++ avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject.h
/**
  @file  
  @brief MockObjects that can be visited under control.
 
  @verbatim
    
    begin                : Fri Dec 18 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.13  2003/04/25 12:44:54  ewald-arnold
    prevent msvc compiler warnings

    Revision 1.12  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.11  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.10  2003/03/14 16:03:22  ewald-arnold
    pass parameters by const reference

    Revision 1.9  2003/03/08 14:37:05  ewald-arnold
    changes for Borland BCB

    Revision 1.8  2003/03/08 13:26:19  ewald-arnold
    updated docs

    Revision 1.7  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.6  2003/02/21 11:57:38  ewald-arnold
    added docs

    Revision 1.5  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.4  2003/02/17 22:04:52  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.3  2003/02/16 17:38:06  ewald-arnold
    update

    Revision 1.2  2003/02/08 08:22:40  ewald-arnold
    draft completed

    Revision 1.1  2003/01/16 17:39:21  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_VISITABLEMOCKOBJECT_H
#define MOCKPP_VISITABLEMOCKOBJECT_H

#include <mockpp/mockpp.h> // always first

#include <vector>

#include <mockpp/MockObject.h>
#include <mockpp/Throwable.h>
#include <mockpp/ThrowableList.h>
#include <mockpp/ExpectationList.h>
#include <mockpp/ExpectationCounter.h>
#include <mockpp/ReturnObjectList.h>

#include <mockpp/VisitableMockObject_macro.h>
#include <mockpp/VisitableMockObject_template.h>

#if defined(__BORLANDC__) || (__GNUC__ < 3)
#define MOCKPP_MEMBER_RESTRICTOR_PRIVATE    public 
#define MOCKPP_MEMBER_RESTRICTOR_PROTECTED  public 
#else
#define MOCKPP_MEMBER_RESTRICTOR_PRIVATE    private
#define MOCKPP_MEMBER_RESTRICTOR_PROTECTED  protected
#endif

/** @def MOCKPP_MEMBER_RESTRICTOR_PRIVATE
  * Make member public for Borland BCB5.
  * @todo Remove this macro.
  */

/** @def MOCKPP_MEMBER_RESTRICTOR_PROTECTED
  * Make member public for Borland BCB5.
  * @todo Remove this macro.
  */

namespace mockpp {


/**
  * A generic object that can be used to replace a real world object for testing purposes.
  * It emulates the real world behaviour by feeding it values and exceptions.
  */
class VisitableMockObject : public MockObject
{
  public:

  /**
    * Construct the item.
    * @param name    human readable description about the object
    * @param parent  parent verifiable
    */
    VisitableMockObject(const String &name, VerifiableList *parent = 0);

  /**
    * Verify that the expected and actual values are equal.
    * If it fails, an AssertionFailedError is thrown
    */
    virtual void verify();

  /**
    * Changes from record mode to normal working mode so you can use the object
    */
    void activate();
    
  /**
    * Sets all internal objects to the state after construction.
    */
    void reset();

  /**
    * Virtual base class for helper objects to easily set up the expectations.
    *
    * Due to the virtual nature of adding functionality with macros you will find
    * here the documentation of the api generated by the macros.
    */
    class Controller
    {
      public:
      
      /** Clears all expectations and puts the object in record mode again.
        */
        virtual void reset() = 0;

      /**
        * Verify the conditions which are not in the verify() chain.
        * If it fails, an AssertionFailedError is thrown
        */
        virtual void verify() = 0;

#ifdef DOXYGEN_SHOULD_SKIP_THIS // just for documentation purposes
    
      /** Constructs a controller for the according method.
        * Basically registers the ccontroller with it's mock object.
        * @param  cls   the pointer to the parent mock object.
        * @internal
        */
        Controller (Your_VisitableMockObject *cls);

      /** Destructs a controller for the according method.
        * Basically unregisters the ccontroller with it's mock object.
        * @internal
        */
        virtual ~Controller();

      /** Adds another throwable to the method.
        * The throwables are thrown one after the other when the method is
        * called after activating until all of them are used. 
        * @param  t   a pointer to the throwable
        */
        void addThrowable (Throwable * t);

      /** Sets the default throwable.
        * Once the list of throwables is empty this one is thrown. This also
        * means that your method never processes the parameters passed to it.
        * @param  t   a pointer to the throwable
        */
        void setDefaultThrowable (Throwable * t);

      /** Adds another return value.
        * The values from this list are return one after the other unless there
        * are no other throwables or response values available.
        * @param  rv      the next return value
        * @param  count   the number of times this value shall be returned
        */
        void addReturnValue (const your_type &rv, unsigned count = 1);

      /** Sets the default return value.
        * This value is returned if there are no throwables available and if there
        * are no other possible return values in a list.
        * @param  rv      the default return value
        */
        void setDefaultReturnValue (const your_type &rv);

      /** Adds another response value.
        * Response values are determined on the parameters you pass. This way the
        * object returns a value that is totally bassed on the input.
        * @param  rv      the return value
        * @param  p1      the 1. parameter of the method
        * @param  p2      the 2. parameter of the method
        * @param  p3      the 3. parameter of the method
        * @param  p4      the 4. parameter of the method
        * @param  p5      the 5. parameter of the method
        * @param  count   the number of times this value shall be returned. Default is always.
        */
        void addResponseValue (const your_type &rv, 
                               const your_type1 &p1, const your_type2 &p2, const your_type3 &p3, 
                               const your_type4 &p4, const your_type5 &p5,
                               unsigned count = std::numeric_limits < unsigned >::max ());

      /** Adds another response throwable.
        * Response throwables are determined on the parameters you pass. This way the
        * object throws an object that is totally bassed on the input.
        * @param  t       the throwable
        * @param  p1      the 1. parameter of the method
        * @param  p2      the 2. parameter of the method
        * @param  p3      the 3. parameter of the method
        * @param  p4      the 4. parameter of the method
        * @param  p5      the 5. parameter of the method
        * @param  count   the number of times this value shall be returned. Default is always.
        */
        void addResponseThrowable (Throwable *t, 
                                   const your_type1 &p1, const your_type2 &p2, const your_type3 &p3,
                                   const your_type4 &p4, const your_type5 &p5,
                                   unsigned count = std::numeric_limits < unsigned >::max ());
    
#endif // DOXYGEN_SHOULD_SKIP_THIS 

    } ;
  friend class Controller;
  
  MOCKPP_MEMBER_RESTRICTOR_PROTECTED:

  /** Adds another expected call to a mock method.
    * @param name unique identifier for method
    */
    void addExpectedMethod(const std::string &name);

  /** Adds another actual call to a mock method.
    * @param name unique identifier for method
    */
    void addActualMethod(const std::string &name);

  /** Get information about working mode.
    * @return  true:  object is in real world working mode
    */
    bool isActivated() const;

  /** Adds another mock controller.
    * @param  pc  pointer to controller
    */
    void addController(Controller *pc);

  /** Removes a mock controller.
    * @param  pc  pointer to controller
    */
    void removeController(Controller *pc);

  private:
    ExpectationList<std::string> methodList;
    bool                         activated;
    std::vector<Controller*>     controllers;
};


}; // namespace mockpp


//////////////////////////////////////////////////////////////
//

/** Implements a controller for a method.
  * @param objname  the visitable mock object variable
  * @param methname the method for which you create the controller
  */
#define MOCKPP_CONTROLLER_FOR(objname, methname) \
    objname::ControllerFor ## methname

//////////////////////////////////////////////////////////////
//

/** Implements a void method with no parameters for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  */
#define MOCKPP_VOID_VISITABLE0(classname, name) \
  public: \
    void name() \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         return;\
      } \
      else \
      { \
         addActualMethod(func_name); \
         MOCKPP_THROWER_IMPL(name); \
         return;\
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_VOID_CONTROLLER_DECL0(classname, name)

    
/** Implements a void method with 1 parameter for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param type1      the data type of the parameter
  */
#define MOCKPP_VOID_VISITABLE1(classname, name, type1) \
  public: \
    void name(const type1 &param1) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         return; \
      }    \
      else \
      {    \
         addActualMethod(func_name);           \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           throw; \
         } \
         name ## Parameter1.addActual(param1); \
         return; \
      }  \
    }     \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseThrowableVector1<type1> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_PARAMETER_VARS1(name, type1); \
    MOCKPP_VOID_CONTROLLER_DECL1(classname, name, type1)


/** Implements a void method with 2 parameter for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  */
#define MOCKPP_VOID_VISITABLE2(classname, name, type1, type2) \
  public: \
    void name(const type1 &param1, const type2 &param2) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         return; \
      }    \
      else \
      {    \
         addActualMethod(func_name);           \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           throw; \
         } \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         return; \
      }  \
    }     \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseThrowableVector2<type1, type2> name ##  ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_PARAMETER_VARS2(name, type1, type2); \
    MOCKPP_VOID_CONTROLLER_DECL2(classname, name, type1, type2)


/** Implements a void method with 3 parameter for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  * @param type3      the data type of the 3. parameter
  */
#define MOCKPP_VOID_VISITABLE3(classname, name, type1, type2, type3) \
  public: \
    void name(const type1 &param1, const type2 &param2, const type3 &param3) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         name ## Parameter3.addExpected(param3); \
         return; \
      }    \
      else \
      {    \
         addActualMethod(func_name);           \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2, param3)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           name ## Parameter3.balanceActual(); \
           throw; \
         } \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         name ## Parameter3.addActual(param3); \
         return; \
      }  \
    }     \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseThrowableVector3<type1, type2, type3> name ##  ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_PARAMETER_VARS3(name, type1, type2, type3); \
    MOCKPP_VOID_CONTROLLER_DECL3(classname, name, type1, type2, type3)


/** Implements a void method with 4 parameter for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  * @param type3      the data type of the 3. parameter
  * @param type4      the data type of the 4. parameter
  */
#define MOCKPP_VOID_VISITABLE4(classname, name, type1, type2, type3, type4) \
  public: \
    void name(const type1 &param1, const type2 &param2, const type3 &param3, const type4 &param4) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         name ## Parameter3.addExpected(param3); \
         name ## Parameter4.addExpected(param4); \
         return; \
      }    \
      else \
      {    \
         addActualMethod(func_name);           \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2, param3, param4)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           name ## Parameter3.balanceActual(); \
           name ## Parameter4.balanceActual(); \
           throw; \
         } \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         name ## Parameter3.addActual(param3); \
         name ## Parameter4.addActual(param4); \
         return; \
      }  \
    }     \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseThrowableVector4<type1, type2, type3, type4> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_PARAMETER_VARS4(name, type1, type2, type3, type4); \
    MOCKPP_VOID_CONTROLLER_DECL4(classname, name, type1, type2, type3, type4)


/** Implements a void method with 5 parameter for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  * @param type3      the data type of the 3. parameter
  * @param type4      the data type of the 4. parameter
  * @param type5      the data type of the 5. parameter
  */
#define MOCKPP_VOID_VISITABLE5(classname, name, type1, type2, type3, type4, type5) \
  public: \
    void name(const type1 &param1, const type2 &param2, const type3 &param3, const type4 &param4, const type5 &param5) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         name ## Parameter3.addExpected(param3); \
         name ## Parameter4.addExpected(param4); \
         name ## Parameter5.addExpected(param5); \
         return; \
      }    \
      else \
      {    \
         addActualMethod(func_name);           \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2, param3, param4, param5)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           name ## Parameter3.balanceActual(); \
           name ## Parameter4.balanceActual(); \
           name ## Parameter5.balanceActual(); \
           throw; \
         } \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         name ## Parameter3.addActual(param3); \
         name ## Parameter4.addActual(param4); \
         name ## Parameter5.addActual(param5); \
         return; \
      }  \
    }     \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseThrowableVector5<type1, type2, type3, type4, type5> name ##  ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_PARAMETER_VARS5(name, type1, type2, type3, type4, type5); \
    MOCKPP_VOID_CONTROLLER_DECL5(classname, name, type1, type2, type3, type4, type5)

    
/** Implements a method with no parameters for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param ret_type   the data type of the return value
  */
#define MOCKPP_VISITABLE0(classname, ret_type, name) \
  public: \
    ret_type name() \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         ret_type ret_val = ret_type(); \
         return ret_val; \
      } \
      else \
      { \
         addActualMethod(func_name); \
         MOCKPP_THROWER_IMPL(name); \
         \
         if (name ## ReturnValues.hasMoreObjects()) \
           return name ## ReturnValues.nextReturnObject(); \
         \
         MOCKPP_ASSERT_TRUE(name ## haveDefaultReturnValue == true); \
         name ## DefaultReturnValueUsed = true; \
         return name ## DefaultReturnValue; \
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_RETURN_VARS(ret_type, name); \
    MOCKPP_CONTROLLER_DECL0(classname, ret_type, name)


/** Implements a method with 1 parameter for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param ret_type   the data type of the return value
  * @param type1      the data type of the 1. parameter
  */
#define MOCKPP_VISITABLE1(classname, ret_type, name, type1) \
  public: \
    ret_type name(const type1 &param1) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         ret_type ret_val = ret_type(); \
         return ret_val; \
      } \
      else \
      { \
         addActualMethod(func_name); \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           throw; \
         } \
         name ## Parameter1.addActual(param1); \
         \
         ret_type ret_val; \
         if (name ## ResponseValues.find(ret_val, param1)) \
            return ret_val; \
         if (name ## ReturnValues.hasMoreObjects()) \
           return name ## ReturnValues.nextReturnObject(); \
         MOCKPP_ASSERT_TRUE(name ## haveDefaultReturnValue == true); \
         name ## DefaultReturnValueUsed = true; \
         return name ## DefaultReturnValue; \
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseVector1<ret_type, type1> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_RETURN_VARS(ret_type, name); \
    MOCKPP_DECLARE_PARAMETER_VARS1(name, type1); \
    MOCKPP_CONTROLLER_DECL1(classname, ret_type, name, type1)


/** Implements a method with 2 parameters for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param ret_type   the data type of the return value
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  */
#define MOCKPP_VISITABLE2(classname, ret_type, name, type1, type2) \
  public: \
    ret_type name(const type1 &param1, const type2 &param2) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         ret_type ret_val = ret_type(); \
         return ret_val; \
      } \
      else \
      { \
         addActualMethod(func_name); \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           throw; \
         } \
         \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         ret_type ret_val; \
         if (name ## ResponseValues.find(ret_val, param1, param2)) \
            return ret_val; \
         if (name ## ReturnValues.hasMoreObjects()) \
           return name ## ReturnValues.nextReturnObject(); \
         MOCKPP_ASSERT_TRUE(name ## haveDefaultReturnValue == true); \
         name ## DefaultReturnValueUsed = true; \
         return name ## DefaultReturnValue; \
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseVector2<ret_type, type1, type2> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_RETURN_VARS(ret_type, name); \
    MOCKPP_DECLARE_PARAMETER_VARS2(name, type1, type2); \
    MOCKPP_CONTROLLER_DECL2(classname, ret_type, name, type1, type2)


/** Implements a method with 3 parameters for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param ret_type   the data type of the return value
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  * @param type3      the data type of the 3. parameter
  */
#define MOCKPP_VISITABLE3(classname, ret_type, name, type1, type2, type3) \
  public: \
    ret_type name(const type1 &param1, const type2 &param2, const type3 &param3) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         name ## Parameter3.addExpected(param3); \
         ret_type ret_val = ret_type(); \
         return ret_val; \
      } \
      else \
      { \
         addActualMethod(func_name); \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2, param3)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           name ## Parameter3.balanceActual(); \
           throw; \
         } \
         \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         name ## Parameter3.addActual(param3); \
         ret_type ret_val; \
         if (name ## ResponseValues.find(ret_val, param1, param2, param3)) \
            return ret_val; \
         if (name ## ReturnValues.hasMoreObjects()) \
           return name ## ReturnValues.nextReturnObject(); \
         MOCKPP_ASSERT_TRUE(name ## haveDefaultReturnValue == true); \
         name ## DefaultReturnValueUsed = true; \
         return name ## DefaultReturnValue; \
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseVector3<ret_type, type1, type2, type3> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_RETURN_VARS(ret_type, name); \
    MOCKPP_DECLARE_PARAMETER_VARS3(name, type1, type2, type3); \
    MOCKPP_CONTROLLER_DECL3(classname, ret_type, name, type1, type2, type3)


/** Implements a method with 4 parameters for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param ret_type   the data type of the return value
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  * @param type3      the data type of the 3. parameter
  * @param type4      the data type of the 4. parameter
  */
#define MOCKPP_VISITABLE4(classname, ret_type, name, type1, type2, type3, type4) \
  public: \
    ret_type name(const type1 &param1, const type2 &param2, const type3 &param3, const type4 &param4) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         name ## Parameter3.addExpected(param3); \
         name ## Parameter4.addExpected(param4); \
         ret_type ret_val = ret_type(); \
         return ret_val; \
      } \
      else \
      { \
         addActualMethod(func_name); \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2, param3, param4)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           name ## Parameter3.balanceActual(); \
           name ## Parameter4.balanceActual(); \
           throw; \
         } \
         \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         name ## Parameter3.addActual(param3); \
         name ## Parameter4.addActual(param4); \
         ret_type ret_val; \
         if (name ## ResponseValues.find(ret_val, param1, param2, param3, param4)) \
            return ret_val; \
         if (name ## ReturnValues.hasMoreObjects()) \
           return name ## ReturnValues.nextReturnObject(); \
         MOCKPP_ASSERT_TRUE(name ## haveDefaultReturnValue == true); \
         name ## DefaultReturnValueUsed = true; \
         return name ## DefaultReturnValue; \
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseVector4<ret_type, type1, type2, type3, type4> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_RETURN_VARS(ret_type, name); \
    MOCKPP_DECLARE_PARAMETER_VARS4(name, type1, type2, type3, type4); \
    MOCKPP_CONTROLLER_DECL4(classname, ret_type, name, type1, type2, type3, type4)


/** Implements a method with 5 parameters for a mock object.
  * @param classname  the name of the mock class to which the method belongs
  * @param name       the method name
  * @param ret_type   the data type of the return value
  * @param type1      the data type of the 1. parameter
  * @param type2      the data type of the 2. parameter
  * @param type3      the data type of the 3. parameter
  * @param type4      the data type of the 4. parameter
  * @param type5      the data type of the 5. parameter
  */
#define MOCKPP_VISITABLE5(classname, ret_type, name, type1, type2, type3, type4, type5) \
  public: \
    ret_type name(const type1 &param1, const type2 &param2, const type3 &param3, const type4 &param4, const type5 &param5) \
    { \
      std::string func_name = MOCKPP_FUNC_MACRO; \
      if (!isActivated() ) \
      { \
         addExpectedMethod(func_name); \
         name ## Parameter1.addExpected(param1); \
         name ## Parameter2.addExpected(param2); \
         name ## Parameter3.addExpected(param3); \
         name ## Parameter4.addExpected(param4); \
         name ## Parameter5.addExpected(param5); \
         ret_type ret_val = ret_type(); \
         return ret_val; \
      } \
      else \
      { \
         addActualMethod(func_name); \
         try { \
           mockpp::Throwable *t; \
           if (name ## ResponseValues.find(t, param1, param2, param3, param4, param5)) \
              t->throw_me(); \
           MOCKPP_THROWER_IMPL(name); \
         } catch(...) { \
           name ## Parameter1.balanceActual(); \
           name ## Parameter2.balanceActual(); \
           name ## Parameter3.balanceActual(); \
           name ## Parameter4.balanceActual(); \
           name ## Parameter5.balanceActual(); \
           throw; \
         } \
         \
         name ## Parameter1.addActual(param1); \
         name ## Parameter2.addActual(param2); \
         name ## Parameter3.addActual(param3); \
         name ## Parameter4.addActual(param4); \
         name ## Parameter5.addActual(param5); \
         ret_type ret_val; \
         if (name ## ResponseValues.find(ret_val, param1, param2, param3, param4, param5)) \
            return ret_val; \
         if (name ## ReturnValues.hasMoreObjects()) \
           return name ## ReturnValues.nextReturnObject(); \
         MOCKPP_ASSERT_TRUE(name ## haveDefaultReturnValue == true); \
         name ## DefaultReturnValueUsed = true; \
         return name ## DefaultReturnValue; \
      } \
    } \
  MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
    mockpp::ResponseVector5<ret_type, type1, type2, type3, type4, type5> name ## ResponseValues; \
    MOCKPP_DECLARE_DEFAULT_VARS(name); \
    MOCKPP_DECLARE_RETURN_VARS(ret_type, name); \
    MOCKPP_DECLARE_PARAMETER_VARS5(name, type1, type2, type3, type4, type5); \
    MOCKPP_CONTROLLER_DECL5(classname, ret_type, name, type1, type2, type3, type4, type5)

      
//////////////////////////////////////////////////////////////
//

/** Implements the initializers for the internal variables of a 
  * void method with no parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(name)\
    MOCKPP_CONSTRUCT_BASE_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * void method with 1 parameter.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD1(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER1_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * void method with 2 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD2(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER2_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * void method with 3 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD3(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER3_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * void method with 4 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD4(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER4_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * void method with 5 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD5(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER5_MEMBERS(name)

//////////////////////////////////////////////////////////////
//

/** Implements the initializers for the internal variables of a 
  * method with no parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(name)\
    MOCKPP_CONSTRUCT_BASE_MEMBERS(name), \
    MOCKPP_CONSTRUCT_RETURN_MEMBERS(name)
    
/** Implements the initializers for the internal variables of a 
  * method with 1 parameter.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD1(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER1_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * method with 2 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD2(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER2_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * method with 3 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD3(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER3_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * method with 4 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD4(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER4_MEMBERS(name)

/** Implements the initializers for the internal variables of a 
  * method with 5 parameters.
  * @param name       the method name
  */
#define MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD5(name) \
    MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(name), \
    MOCKPP_CONSTRUCT_PARAMETER5_MEMBERS(name)


#endif // MOCKPP_VISITABLEMOCKOBJECT_H

Index: avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject_macro.h
+++ avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject_macro.h
/**
  @file    
  @internal NOT INTENDED FOR PUBLIC INCLUSION, USE @p VisitableMockObject.h INSTEAD
  @brief    Keep ugly macros away from header files
                    
  @verbatim
    
    begin                : Fri Feb 07 2003
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_macro.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.11  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.10  2003/03/10 18:37:05  ewald-arnold
    closed memory leak

    Revision 1.9  2003/03/08 14:37:05  ewald-arnold
    changes for Borland BCB

    Revision 1.8  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.7  2003/03/01 11:47:39  ewald-arnold
    doxygen ignore part

    Revision 1.6  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.5  2003/02/21 11:57:09  ewald-arnold
    removed example methods

    Revision 1.4  2003/02/20 18:50:31  ewald-arnold
    deeper verification

    Revision 1.3  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.2  2003/02/16 17:38:06  ewald-arnold
    update

    Revision 1.1  2003/02/08 08:23:00  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/


#ifndef MOCKPP_VISITABLEMOCKOBJECT_MACRO_H
#define MOCKPP_VISITABLEMOCKOBJECT_MACRO_H


#ifndef DOXYGEN_SHOULD_SKIP_THIS

#include <memory>

////////////////////////////////////////////////////////////////////////////
//
//! @todo include number and signatures of parameters to
//!  better support overloading

/*
#define MOCKPP_METHNAME0(name, suffix) \
  name ## suffix
  
#define MOCKPP_METHNAME1(name, suffix, type1) \
  name ## suffix ## typeid(type1).name()
*/  

////////////////////////////////////////////////////////////////////////////
//

//##########################################################################
//
//    IMPORTANT: update the test files if you add members for reset
//
//##########################################################################

#define MOCKPP_IMPL_RESET_VOID_BASE(methname) \
      objptr->methname ## Throwables.clear(); \
      objptr->methname ## DefaultThrowable.clear()
      
#define MOCKPP_IMPL_RESET_BASE(methname) \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
      objptr->methname ## ReturnValues.clear();    \
      objptr->methname ## haveDefaultReturnValue = false;  \
      objptr->methname ## DefaultReturnValueUsed = false

////////////////////////////////////////////////////////////////////////////

#define MOCKPP_IMPL_RESET_P1(methname) \
      objptr->methname ## ResponseValues.clear(); \
      objptr->methname ## Parameter1.clear(); 
      
#define MOCKPP_IMPL_RESET_P2(methname) \
      MOCKPP_IMPL_RESET_P1(methname); \
      objptr->methname ## Parameter2.clear() 
      
#define MOCKPP_IMPL_RESET_P3(methname) \
      MOCKPP_IMPL_RESET_P2(methname); \
      objptr->methname ## Parameter3.clear() 
      
#define MOCKPP_IMPL_RESET_P4(methname) \
      MOCKPP_IMPL_RESET_P3(methname); \
      objptr->methname ## Parameter4.clear() 
      
#define MOCKPP_IMPL_RESET_P5(methname) \
      MOCKPP_IMPL_RESET_P4(methname); \
      objptr->methname ## Parameter5.clear() 
      
////////////////////////////////////////////////////////////////////////////

#define MOCKPP_CONTROLLER_IMPL_RESET_0(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_BASE(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESET_1(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_BASE(methname); \
      MOCKPP_IMPL_RESET_P1(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESET_2(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_BASE(methname); \
      MOCKPP_IMPL_RESET_P2(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESET_3(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_BASE(methname); \
      MOCKPP_IMPL_RESET_P3(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESET_4(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_BASE(methname); \
      MOCKPP_IMPL_RESET_P4(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESET_5(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_BASE(methname); \
      MOCKPP_IMPL_RESET_P5(methname); \
    }

////////////////////////////////////////////////////////////////////////////

#define MOCKPP_CONTROLLER_IMPL_VOID_RESET_0(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_VOID_RESET_1(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
      MOCKPP_IMPL_RESET_P1(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_VOID_RESET_2(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
      MOCKPP_IMPL_RESET_P2(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_VOID_RESET_3(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
      MOCKPP_IMPL_RESET_P3(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_VOID_RESET_4(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
      MOCKPP_IMPL_RESET_P4(methname); \
    }

#define MOCKPP_CONTROLLER_IMPL_VOID_RESET_5(methname) \
    void reset() \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      MOCKPP_IMPL_RESET_VOID_BASE(methname); \
      MOCKPP_IMPL_RESET_P5(methname); \
    }
    

////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    void addThrowable(mockpp::Throwable *t_) \
    { \
      std::auto_ptr<mockpp::Throwable> at (t_); \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## Throwables.push_back(at.release()); \
      } \
    \
    template <class T> \
    void addThrowable(const T &w, unsigned count = 1) \
    { \
      for ( ; count > 0; --count) \
        addThrowable(mockpp::make_throwable(w)); \
    } \
    \
    void setDefaultThrowable(mockpp::Throwable *t_) \
    { \
      std::auto_ptr<mockpp::Throwable> at (t_); \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## DefaultThrowable.take(at.release()); \
    }
    
////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    virtual void verify() \
    { \
      if (objptr->methname ## haveDefaultReturnValue) \
      { \
        mockpp::String fmt = ("%1 is unused."); \
        fmt << (#methname "DefaultReturnValueUsed"); \
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, objptr->methname ## DefaultReturnValueUsed); \
      } \
      \
      mockpp::Throwable *dt = objptr->methname ## DefaultThrowable.get(); \
      if (dt != 0) \
      { \
        mockpp::String fmt = ("%1 is unused."); \
        fmt << (#methname "DefaultThrowable"); \
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); \
      }  \
    }
    
    
////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    virtual void verify() \
    { \
      mockpp::Throwable *dt = objptr->methname ## DefaultThrowable.get(); \
      if (dt != 0) \
      { \
        mockpp::String fmt = ("%1 is unused."); \
        fmt << (#methname "DefaultThrowable"); \
        MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); \
      }  \
    }
    

////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    void addReturnValue(const ret_type &rv, unsigned count = 1) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      for ( ; count > 0; --count) \
        objptr->methname ## ReturnValues.addObjectToReturn(rv); \
    } \
    \
    void setDefaultReturnValue(const ret_type &rv) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## haveDefaultReturnValue = true;  \
      objptr->methname ## DefaultReturnValue = rv; \
    }


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_IMPL_RESP_VAL1(ret_type, methname, type1) \
    void addResponseValue(const ret_type &rv, const type1 &p1, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(rv, p1, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_VAL2(ret_type, methname, type1, type2) \
    void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(rv, p1, p2, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_VAL3(ret_type, methname, type1, type2, type3) \
    void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, const type3 &p3, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(rv, p1, p2, p3, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_VAL4(ret_type, methname, type1, type2, type3, type4) \
    void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(rv, p1, p2, p3, p4, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_VAL5(ret_type, methname, type1, type2, type3, type4, type5) \
    void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, const type5 &p5, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(rv, p1, p2, p3, p4, p5, count); \
    }


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_IMPL_RESP_THROW1(methname, type1) \
    void addResponseThrowable(mockpp::Throwable *t, const type1 &p1, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(t, p1, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_THROW2(methname, type1, type2) \
    void addResponseThrowable(mockpp::Throwable *t, const type1 &p1, const type2 &p2, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(t, p1, p2, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_THROW3(methname, type1, type2, type3) \
    void addResponseThrowable(mockpp::Throwable *t, const type1 &p1, const type2 &p2, const type3 &p3, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(t, p1, p2, p3, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_THROW4(methname, type1, type2, type3, type4) \
    void addResponseThrowable(mockpp::Throwable *t, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(t, p1, p2, p3, p4, count); \
    }

#define MOCKPP_CONTROLLER_IMPL_RESP_THROW5(methname, type1, type2, type3, type4, type5) \
    void addResponseThrowable(mockpp::Throwable *t, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, const type5 &p5, unsigned count = MOCKPP_UNLIMITED) \
    { \
      MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
      objptr->methname ## ResponseValues.add(t, p1, p2, p3, p4, p5, count); \
    }


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    friend class ControllerFor ## methname;  \
    public: \
      class ControllerFor ## methname : public mockpp::VisitableMockObject::Controller \
      { \
          classname *objptr; \
        public: \
          ControllerFor ## methname(classname *cls) \
            : objptr(cls) \
        { \
          objptr->addController(this); \
        } \
        \
        virtual ~ControllerFor ## methname() \
        { \
          objptr->removeController(this); \
        }


#define MOCKPP_CONTROLLER_DECL_END  }


#define MOCKPP_VOID_CONTROLLER_DECL0(classname, methname) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_RESET_0(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_VOID_CONTROLLER_DECL1(classname, methname, type1) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_RESET_1(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW1(methname, type1) \
    MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_VOID_CONTROLLER_DECL2(classname, methname, type1, type2) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_RESET_2(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW2(methname, type1, type2) \
    MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_VOID_CONTROLLER_DECL3(classname, methname, type1, type2, type3) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_RESET_3(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW3(methname, type1, type2, type3) \
    MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_VOID_CONTROLLER_DECL4(classname, methname, type1, type2, type3, type4) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_RESET_4(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW4(methname, type1, type2, type3, type4) \
    MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_VOID_CONTROLLER_DECL5(classname, methname, type1, type2, type3, type4, type5) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_VOID_RESET_5(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW5(methname, type1, type2, type3, type4, type5) \
    MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONTROLLER_DECL0(classname, ret_type, methname) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_RESET_0(methname) \
    MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_CONTROLLER_DECL1(classname, ret_type, methname, type1) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    MOCKPP_CONTROLLER_IMPL_RESET_1(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_VAL1(ret_type, methname, type1) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW1(methname, type1) \
    MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_CONTROLLER_DECL2(classname, ret_type, methname, type1, type2) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    MOCKPP_CONTROLLER_IMPL_RESET_2(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_VAL2(ret_type, methname, type1, type2) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW2(methname, type1, type2) \
    MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_CONTROLLER_DECL3(classname, ret_type, methname, type1, type2, type3) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    MOCKPP_CONTROLLER_IMPL_RESET_3(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_VAL3(ret_type, methname, type1, type2, type3) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW3(methname, type1, type2, type3) \
    MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_CONTROLLER_DECL4(classname, ret_type, methname, type1, type2, type3, type4) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    MOCKPP_CONTROLLER_IMPL_RESET_4(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_VAL4(ret_type, methname, type1, type2, type3, type4) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW4(methname, type1, type2, type3, type4) \
    MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END

#define MOCKPP_CONTROLLER_DECL5(classname, ret_type, methname, type1, type2, type3, type4, type5) \
    MOCKPP_CONTROLLER_DECL_START(classname, methname) \
    MOCKPP_CONTROLLER_IMPL_THROW(methname) \
    MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
    MOCKPP_CONTROLLER_IMPL_RESET_5(methname) \
    MOCKPP_CONTROLLER_IMPL_RESP_VAL5(ret_type, methname, type1, type2, type3, type4, type5) \
    MOCKPP_CONTROLLER_IMPL_RESP_THROW5(methname, type1, type2, type3, type4, type5) \
    MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
    MOCKPP_CONTROLLER_DECL_END


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_DECLARE_DEFAULT_VARS(name) \
    mockpp::ThrowableItem              name ## DefaultThrowable; \
    mockpp::ThrowableList              name ## Throwables 


#define MOCKPP_DECLARE_RETURN_VARS(ret_type, name) \
    ret_type                           name ## DefaultReturnValue; \
    bool                               name ## haveDefaultReturnValue; \
    bool                               name ## DefaultReturnValueUsed; \
    mockpp::ReturnObjectList<ret_type> name ## ReturnValues


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_DECLARE_PARAMETER_VARS1(name, type1) \
    mockpp::ExpectationList<type1> name ## Parameter1 

#define MOCKPP_DECLARE_PARAMETER_VARS2(name, type1, type2) \
    MOCKPP_DECLARE_PARAMETER_VARS1(name, type1); \
    mockpp::ExpectationList<type2> name ## Parameter2 

#define MOCKPP_DECLARE_PARAMETER_VARS3(name, type1, type2, type3) \
    MOCKPP_DECLARE_PARAMETER_VARS2(name, type1, type2); \
    mockpp::ExpectationList<type3> name ## Parameter3 

#define MOCKPP_DECLARE_PARAMETER_VARS4(name, type1, type2, type3, type4) \
    MOCKPP_DECLARE_PARAMETER_VARS3(name, type1, type2, type3); \
    mockpp::ExpectationList<type4> name ## Parameter4 

#define MOCKPP_DECLARE_PARAMETER_VARS5(name, type1, type2, type3, type4, type5) \
    MOCKPP_DECLARE_PARAMETER_VARS4(name, type1, type2, type3, type4); \
    mockpp::ExpectationList<type5> name ## Parameter5 

////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONSTRUCT_BASE_MEMBERS(name) \
    name ## Throwables((#name "Throwables"), this)

#define MOCKPP_CONSTRUCT_RETURN_MEMBERS(name) \
    name ## ReturnValues((#name "/ReturnValues"), this), \
    name ## haveDefaultReturnValue(false), \
    name ## DefaultReturnValueUsed(false) 

    
////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_CONSTRUCT_PARAMETER1_MEMBERS(name) \
    name ## Parameter1((#name "Parameter1"), this), \
    name ## ResponseValues((#name "ResponseThrowables"), this)
    
#define MOCKPP_CONSTRUCT_PARAMETER2_MEMBERS(name) \
    MOCKPP_CONSTRUCT_PARAMETER1_MEMBERS(name),    \
    name ## Parameter2((#name "Parameter2"), this)

#define MOCKPP_CONSTRUCT_PARAMETER3_MEMBERS(name) \
    MOCKPP_CONSTRUCT_PARAMETER2_MEMBERS(name),    \
    name ## Parameter3((#name "Parameter3"), this)

#define MOCKPP_CONSTRUCT_PARAMETER4_MEMBERS(name) \
    MOCKPP_CONSTRUCT_PARAMETER3_MEMBERS(name),    \
    name ## Parameter4((#name "Parameter4"), this)

#define MOCKPP_CONSTRUCT_PARAMETER5_MEMBERS(name) \
    MOCKPP_CONSTRUCT_PARAMETER4_MEMBERS(name),    \
    name ## Parameter5((#name "Parameter5"), this)


////////////////////////////////////////////////////////////////////////////
//

#define MOCKPP_THROWER_IMPL(name) \
   if (name ## Throwables.hasMoreObjects() != 0) \
     name ## Throwables.nextThrowableObject()->throw_me(); \
   if (name ## DefaultThrowable.get() != 0) \
     name ## DefaultThrowable.get()->throw_me()

        

#endif // DOXYGEN_SHOULD_SKIP_THIS


#endif // MOCKPP_VISITABLEMOCKOBJECT_MACRO_H

Index: avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject_template.h
+++ avida/current/source/third-party/trio-1.9/mockpp/VisitableMockObject_template.h
/**
  @file    
  @internal NOT INTENDED FOR PUBLIC INCLUSION, USE @p VisitableMockObject.h INSTEAD
  @brief    Keep ugly templates away from header
                    
  @verbatim
    
    begin                : Sat Feb 15 2003
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_template.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.10  2003/04/13 17:00:48  ewald-arnold
    moved name to Verifiable class

    Revision 1.9  2003/04/06 19:13:57  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.8  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.7  2003/03/10 18:36:08  ewald-arnold
    fix for BCB5

    Revision 1.6  2003/03/08 08:05:35  ewald-arnold
    typo

    Revision 1.5  2003/03/06 20:58:56  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.4  2003/02/26 17:50:39  ewald-arnold
    added doc comments

    Revision 1.3  2003/02/23 13:36:42  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/20 18:50:31  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/16 17:36:57  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_VISITABLEMOCKOBJECT_TEMPLATE_H
#define MOCKPP_VISITABLEMOCKOBJECT_TEMPLATE_H


namespace mockpp {


#ifndef DOXYGEN_SHOULD_SKIP_THIS


/**
  * Base class for all objects that return objects or throwables
  * depending on the parameters passed to a method.
  */
class ResponseVectorBase : public Verifiable
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseVectorBase(const String &name, VerifiableList *parent)
      : Verifiable(name, parent),
        tvec(name+("/tvec") , 0)  // <== NO PARENT
    {
    }

  /**
    * Verify that all expectations are met.
    */
    virtual void verify()
    {
//    tvec.verify();   Not this one because it NEVER runs empty, use counter[] instead
      
      unsigned unused = 0;
      std::vector<unsigned>::const_iterator start = counter.begin();
      std::vector<unsigned>::const_iterator end = counter.end();
      for ( ; start != end; ++start)
        if (*start != MOCKPP_UNLIMITED)
          unused += *start;

      String fmt = ("%1 has a total of %2 un-used response objects.");
      fmt << getName() << unused;

      MOCKPP_ASSERT_EQUALS_MESSAGE(fmt, (unsigned)0, unused);
    }
    

  /**
    * Returns the amount of response values.
    * @return number of response values
    */
    unsigned size() const
    {
      return counter.size();
    }


  protected:
    ThrowableList         tvec; 
    std::vector<unsigned> counter;
};

    
/**
  * Class returning a throwable depending on the parameters
  * passed to a method.
  */
template <class T1>
class ResponseThrowableVector1 : public ResponseVectorBase
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseThrowableVector1(const String &aName, VerifiableList *parent)
      : ResponseVectorBase(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, unsigned count)
    {
      counter.push_back(count);
      tvec.push_back(t);
      t1vec.push_back(t1);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      counter.clear();
      tvec.clear();
      t1vec.clear();
    }

  /**
    * Finds a throwable for a set of parameters.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @return true: throwable found for parameters
    */
    bool find(Throwable * &t, const T1 &t1)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (counter[i] > 0 && t1 == t1vec[i])
         {
           if (tvec.at(i) == 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           t =  tvec.at(i);
           return true;
         }
       return false;
    }

  protected:
    std::vector<T1>       t1vec;
};


/**
  * Class returning an object depending on the parameters
  * passed to a method.
  */
template <class R, class T1>
class ResponseVector1 : public ResponseThrowableVector1<T1>
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseVector1(const String &aName, VerifiableList *parent)
      : ResponseThrowableVector1<T1>(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, unsigned count)
    {
      MOCKPP_ASSERT_TRUE(t != 0);
      ResponseThrowableVector1<T1>::add (t, t1, count);
      R r;
      rvec.push_back(r);
    }

  /**
    * Adds a return valule.
    * @param t      the return value
    * @param t1     the parameter upon which to return
    * @param count  the number of times the object may be used
    */
    void add(const R &r, const T1 &t1, unsigned count)
    {
      ResponseThrowableVector1<T1>::add ((Throwable*)0, t1, count);
      rvec.push_back(r);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      ResponseThrowableVector1<T1>::clear();
      rvec.clear();
    }

#if defined(__BORLANDC__) || (__GNUC__ < 3)   // ==> BCB5.5.1 ?? F1004 Internal compiler error at 0x12548c1 with base 0x1200000
    bool find(Throwable * &t, const T1 &t1)
    {
      return ResponseThrowableVector1<T1>::find(t, t1);
    }
#else
    using ResponseThrowableVector1<T1>::find;
#endif

  /**
    * Finds a return value for a set of parameters.
    * @param r      the value
    * @param t1     the parameter upon which to return
    * @param count  the number of times the object may be used
    * @return true: return value found for parameters
    */
    bool find(R &r, const T1 &t1)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (counter[i] > 0 && t1 == t1vec[i])
         {
           if (tvec.at(i) != 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           r = rvec[i];
           return true;
         }
       return false;
    }

  protected:
    std::vector<R>        rvec;
};


/**
  * Class returning a throwable depending on the parameters
  * passed to a method.
  */
template <class T1, class T2>
class ResponseThrowableVector2  : public ResponseVectorBase
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseThrowableVector2(const String &aName, VerifiableList *parent)
      : ResponseVectorBase(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, unsigned count)
    {
      counter.push_back(count);
      tvec.push_back(t);
      t1vec.push_back(t1);
      t2vec.push_back(t2);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      counter.clear();
      tvec.clear();
      t1vec.clear();
      t2vec.clear();
    }

  /**
    * Finds a throwable for a set of parameters.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @return true: throwable found for parameters
    */
    bool find(Throwable * &t, const T1 &t1, const T2 &t2)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i])
         {
           if (tvec.at(i) == 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           t =  tvec.at(i);
           return true;
         }
       return false;
    }

  protected:
    std::vector<T1>       t1vec;
    std::vector<T2>       t2vec;
};


/**
  * Class returning an object depending on the parameters
  * passed to a method.
  */
template <class R, class T1, class T2>
class ResponseVector2 : public ResponseThrowableVector2<T1, T2>
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseVector2(const String &aName, VerifiableList *parent)
      : ResponseThrowableVector2<T1, T2>(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, unsigned count)
    {
      MOCKPP_ASSERT_TRUE(t != 0);
      ResponseThrowableVector2<T1, T2>::add (t, t1, t2, count);
      R r;
      rvec.push_back(r);
    }

  /**
    * Adds a return value.
    * @param t      the return value
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(const R &r, const T1 &t1, const T2 &t2, unsigned count)
    {
      ResponseThrowableVector2<T1, T2>::add ((Throwable*)0, t1, t2, count);
      rvec.push_back(r);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      ResponseThrowableVector2<T1, T2>::clear();
      rvec.clear();
    }

#if defined(__BORLANDC__) || (__GNUC__ < 3)   // ==> BCB5.5.1 ?? F1004 Internal compiler error at 0x12548c1 with base 0x1200000
    bool find(Throwable * &t, const T1 &t1, const T2 &t2)
    {
      return ResponseThrowableVector2<T1, T2>::find(t, t1, t2);
    }
#else
    using ResponseThrowableVector2<T1, T2>::find;
#endif

  /**
    * Finds a return value for a set of parameters.
    * @param r      the value
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param count  the number of times the object may be used
    * @return true: return value found for parameters
    */
    bool find(R &r, const T1 &t1, const T2 &t2)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i])
         {
           if (tvec.at(i) != 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           r = rvec[i];
           return true;
         }
       return false;
    }

  private:
    std::vector<R>        rvec;
};


/**
  * Class returning a throwable depending on the parameters
  * passed to a method.
  */
template <class T1, class T2, class T3>
class ResponseThrowableVector3 : public ResponseVectorBase
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseThrowableVector3(const String &aName, VerifiableList *parent)
      : ResponseVectorBase(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, const T3 &t3, unsigned count)    {
      counter.push_back(count);
      tvec.push_back(t);
      t1vec.push_back(t1);
      t2vec.push_back(t2);
      t3vec.push_back(t3);
   }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      counter.clear();
      tvec.clear();
      t1vec.clear();
      t2vec.clear();
      t3vec.clear();
    }

  /**
    * Finds a throwable for a set of parameters.
    * @param t      the throwable
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @return true: throwable found for parameters
    */
    bool find(Throwable * &t, const T1 &t1, const T2 &t2, const T3 &t3)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i]
             && t3 == t3vec[i])
         {
           if (tvec.at(i) == 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           t = tvec.at(i);
           return true;
         }
       return false;
    }

  protected:
    std::vector<T1>       t1vec;
    std::vector<T2>       t2vec;
    std::vector<T3>       t3vec;
};


/**
  * Class returning an object depending on the parameters
  * passed to a method.
  */
template <class R, class T1, class T2, class T3>
class ResponseVector3 : public ResponseThrowableVector3<T1, T2, T3>
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseVector3(const String &aName, VerifiableList *parent)
      : ResponseThrowableVector3<T1, T2, T3>(aName, parent)
    {}

  /**
    * Adds a return value.
    * @param t      the return value
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, const T3 &t3, unsigned count)
    {
      MOCKPP_ASSERT_TRUE(t != 0);
      ResponseThrowableVector3<T1, T2, T3>::add(t, t1, t2, t3, count);
      R r;
      rvec.push_back(r);
   }

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(const R &r, const T1 &t1, const T2 &t2, const T3 &t3, unsigned count)
    {
      ResponseThrowableVector3<T1, T2, T3>::add((Throwable*)0, t1, t2, t3, count);
      rvec.push_back(r);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      ResponseThrowableVector3<T1, T2, T3>::clear();
      rvec.clear();
    }

#if defined(__BORLANDC__) || (__GNUC__ < 3)   // ==> BCB5.5.1 ?? F1004 Internal compiler error at 0x12548c1 with base 0x1200000
    bool find(Throwable * &t, const T1 &t1, const T2 &t2, const T3 &t3)
    {
      return ResponseThrowableVector3<T1, T2, T3>::find(t, t1, t2, t3);
    }
#else
    using ResponseThrowableVector3<T1, T2, T3>::find;
#endif

  /**
    * Finds a return value for a set of parameters.
    * @param t      the value
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @return true: return value found for parameters
    */
    bool find(R &r, const T1 &t1, const T2 &t2, const T3 &t3)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i]
             && t3 == t3vec[i])
         {
           if (tvec.at(i) != 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           r = rvec[i];
           return true;
         }
       return false;
    }

  private:
    std::vector<R>        rvec;
};


/**
  * Class returning a throwable depending on the parameters
  * passed to a method.
  */
template <class T1, class T2, class T3, class T4>
class ResponseThrowableVector4 : public ResponseVectorBase
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseThrowableVector4(const String &aName, VerifiableList *parent)
      : ResponseVectorBase(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, unsigned count)
    {
      counter.push_back(count);
      tvec.push_back(t);
      t1vec.push_back(t1);
      t2vec.push_back(t2);
      t3vec.push_back(t3);
      t4vec.push_back(t4);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      counter.clear();
      tvec.clear();
      t1vec.clear();
      t2vec.clear();
      t3vec.clear();
      t4vec.clear();
    }

  /**
    * Finds a throwable for a set of parameters.
    * @param t      the throwable
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @return true: throwable found for parameters
    */
    bool find(Throwable * &t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i]
             && t3 == t3vec[i]
             && t4 == t4vec[i])
         {
           if (tvec.at(i) == 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           t = tvec.at(i);
           return true;
         }
       return false;
    }

  protected:
    std::vector<T1>       t1vec;
    std::vector<T2>       t2vec;
    std::vector<T3>       t3vec;
    std::vector<T4>       t4vec;
};


/**
  * Class returning an object depending on the parameters
  * passed to a method.
  */
template <class R, class T1, class T2, class T3, class T4>
class ResponseVector4 : public ResponseThrowableVector4<T1, T2, T3, T4>
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseVector4(const String &aName, VerifiableList *parent)
      : ResponseThrowableVector4<T1, T2, T3, T4>(aName, parent)
    {}

  /**
    * Adds a return value.
    * @param t      the return value
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(const R &r, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, unsigned count)
    {
      ResponseThrowableVector4<T1, T2, T3, T4>::add((Throwable*)0, t1, t2, t3, t4, count);
      rvec.push_back(r);
    }

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, unsigned count)
    {
      MOCKPP_ASSERT_TRUE(t != 0);
      ResponseThrowableVector4<T1, T2, T3, T4>::add(t, t1, t2, t3, t4, count);
      R r;
      rvec.push_back(r);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      ResponseThrowableVector4<T1, T2, T3, T4>::clear();
      rvec.clear();
    }

#if defined(__BORLANDC__) || (__GNUC__ < 3)   // ==> BCB5.5.1 ?? F1004 Internal compiler error at 0x12548c1 with base 0x1200000
    bool find(Throwable * &t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
    {
      return ResponseThrowableVector4<T1, T2, T3, T4>::find(t, t1, t2, t3, t4);
    }

#else
    using ResponseThrowableVector4<T1, T2, T3, T4>::find;
#endif

  /**
    * Finds a return value for a set of parameters.
    * @param r      the value
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @return true: throwable found for parameters
    */
    bool find(R &r, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i]
             && t3 == t3vec[i]
             && t4 == t4vec[i])
         {
           if (tvec.at(i) != 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           r = rvec[i];
           return true;
         }
       return false;
    }

  private:
    std::vector<R>        rvec;
};


/**
  * Class returning a throwable depending on the parameters
  * passed to a method.
  */
template <class T1, class T2, class T3, class T4, class T5>
class ResponseThrowableVector5 : public ResponseVectorBase
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseThrowableVector5(const String &aName, VerifiableList *parent)
      : ResponseVectorBase(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param t5     the parameter 5 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, unsigned count)
    {
      counter.push_back(count);
      tvec.push_back(t);
      t1vec.push_back(t1);
      t2vec.push_back(t2);
      t3vec.push_back(t3);
      t4vec.push_back(t4);
      t5vec.push_back(t5);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      counter.clear();
      tvec.clear();
      t1vec.clear();
      t2vec.clear();
      t3vec.clear();
      t4vec.clear();
      t5vec.clear();
    }

  /**
    * Finds a throwable for a set of parameters.
    * @param t      the throwable
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param t5     the parameter 5 upon which to return
    * @return true: throwable found for parameters
    */
    bool find(Throwable * &t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0
             && t1 == t1vec[i]
             && t2 == t2vec[i]
             && t3 == t3vec[i]
             && t4 == t4vec[i]
             && t5 == t5vec[i])
         {
           if (tvec.at(i) == 0)
             return false;

           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];

           t = tvec.at(i);
           return true;
         }
       return false;
    }

  protected:
    std::vector<T1>       t1vec;
    std::vector<T2>       t2vec;
    std::vector<T3>       t3vec;
    std::vector<T4>       t4vec;
    std::vector<T5>       t5vec;
};


template <class R, class T1, class T2, class T3, class T4, class T5>
class ResponseVector5  : public ResponseThrowableVector5<T1, T2, T3, T4, T5>
{
  public:

  /**
    * Construct a new empty vector
    * @param aName Label used to identify vector
    * @param parent  parent verifiable
    */
    ResponseVector5(const String &aName, VerifiableList *parent)
      : ResponseThrowableVector5<T1, T2, T3, T4, T5>(aName, parent)
    {}

  /**
    * Adds a throwable.
    * @param t      the throwable
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param t5     the parameter 5 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(Throwable *t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, unsigned count)    
    {
      MOCKPP_ASSERT_TRUE(t != 0);   
      ResponseThrowableVector5<T1, T2, T3, T4, T5>::add(t, t1, t2, t3, t4, t5, count);
      R r;
      rvec.push_back(r);
    }
    
  /**
    * Adds a return value.
    * @param t      the return value
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param t5     the parameter 5 upon which to return
    * @param count  the number of times the object may be used
    */
    void add(const R &r, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, unsigned count)    
    {
      ResponseThrowableVector5<T1, T2, T3, T4, T5>::add((Throwable*)0, t1, t2, t3, t4, t5, count);
      rvec.push_back(r);
    }

  /**
    * Removes all the objects from the list.
    */
    void clear()
    {
      ResponseThrowableVector5<T1, T2, T3, T4, T5>::clear();
      rvec.clear();
    }

#if defined(__BORLANDC__) || (__GNUC__ < 3)   // ==> BCB5.5.1 ?? F1004 Internal compiler error at 0x12548c1 with base 0x1200000
    bool find(Throwable * &t, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
    {
      return ResponseThrowableVector5<T1, T2, T3, T4, T5>::find(t, t1, t2, t3, t4, t5);
    }
#else
    using ResponseThrowableVector5<T1, T2, T3, T4, T5>::find;
#endif

  /**
    * Finds a return value for a set of parameters.
    * @param r      the value
    * @param t1     the parameter 1 upon which to return
    * @param t2     the parameter 2 upon which to return
    * @param t3     the parameter 3 upon which to return
    * @param t4     the parameter 4 upon which to return
    * @param t5     the parameter 5 upon which to return
    * @return true: return value found for parameters
    */
    bool find(R &r, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)     
    {
       for (unsigned i = 0; i < t1vec.size(); ++i)
         if (   counter[i] > 0 
             && t1 == t1vec[i]
             && t2 == t2vec[i]
             && t3 == t3vec[i]
             && t4 == t4vec[i] 
             && t5 == t5vec[i])
         {
           if (tvec.at(i) != 0)
             return false;
           
           if (counter[i] != MOCKPP_UNLIMITED)
             --counter[i];
           
           r = rvec[i];
           return true;
         }
       return false;
    }

  private:
    std::vector<R>        rvec;
};

#endif // DOXYGEN_SHOULD_SKIP_THIS

}; // namespace mockpp


#endif // MOCKPP_VISITABLEMOCKOBJECT_TEMPLATE_H

Index: avida/current/source/third-party/trio-1.9/mockpp/doc-template.h
+++ avida/current/source/third-party/trio-1.9/mockpp/doc-template.h

class ExampleVisitableMockObject:public
  mockpp::VisitableMockObject
{
public:

  ExampleVisitableMockObject (const mockpp::String & name):
  mockpp::VisitableMockObject (name, 0),
  visitable_5_paramThrowables (mockpp::
                               String (L"visitable_5_param" "Throwables"),
                               this),
  visitable_5_paramReturnValues (mockpp::
                                 String (L"visitable_5_param"
                                         "/ReturnValues"), this),
  visitable_5_paramhaveDefaultReturnValue (false),
  visitable_5_paramDefaultReturnValueUsed (false),
  visitable_5_paramParameter1 (mockpp::
                               String (L"visitable_5_param" "Parameter1"),
                               this),
  visitable_5_paramResponseValues (mockpp::
                                   String (L"visitable_5_param"
                                           "ResponseThrowables"), this),
  visitable_5_paramParameter2 (mockpp::
                               String (L"visitable_5_param" "Parameter2"),
                               this),
  visitable_5_paramParameter3 (mockpp::
                               String (L"visitable_5_param" "Parameter3"),
                               this),
  visitable_5_paramParameter4 (mockpp::
                               String (L"visitable_5_param" "Parameter4"),
                               this),
  visitable_5_paramParameter5 (mockpp::
                               String (L"visitable_5_param" "Parameter5"),
                               this),
  void_visitable_5_paramThrowables (mockpp::
                                    String (L"void_visitable_5_param"
                                            "Throwables"), this),
  void_visitable_5_paramParameter1 (mockpp::
                                    String (L"void_visitable_5_param"
                                            "Parameter1"), this),
  void_visitable_5_paramResponseValues (mockpp::
                                        String (L"void_visitable_5_param"
                                                "ResponseThrowables"), this),
  void_visitable_5_paramParameter2 (mockpp::
                                    String (L"void_visitable_5_param"
                                            "Parameter2"), this),
  void_visitable_5_paramParameter3 (mockpp::
                                    String (L"void_visitable_5_param"
                                            "Parameter3"), this),
  void_visitable_5_paramParameter4 (mockpp::
                                    String (L"void_visitable_5_param"
                                            "Parameter4"), this),
  void_visitable_5_paramParameter5 (mockpp::
                                    String (L"void_visitable_5_param"
                                            "Parameter5"), this)
  {
  }

public:unsigned
  visitable_5_param (const int &param1, const wchar_t & param2,
                     const float &param3, const std::string & param4,
                     const long &param5)
  {
    std::string func_name = __func__;
    if (!isActivated ())
      {
        addExpectedMethod (func_name);
        visitable_5_paramParameter1.addExpected (param1);
        visitable_5_paramParameter2.addExpected (param2);
        visitable_5_paramParameter3.addExpected (param3);
        visitable_5_paramParameter4.addExpected (param4);
        visitable_5_paramParameter5.addExpected (param5);
        unsigned
          ret_val = unsigned ();
        return ret_val;
      }
    else
      {
        addActualMethod (func_name);
        try
        {
          mockpp::Throwable * t;
          if (visitable_5_paramResponseValues.
              find (t, param1, param2, param3, param4, param5))
            t->throw_me ();
          if (visitable_5_paramThrowables.hasMoreObjects () != 0)
            visitable_5_paramThrowables.nextThrowableObject ()->throw_me ();
          if (visitable_5_paramDefaultThrowable.get () != 0)
            visitable_5_paramDefaultThrowable.get ()->throw_me ();
        }
        catch (...)
        {
          visitable_5_paramParameter1.balanceActual ();
          visitable_5_paramParameter2.balanceActual ();
          visitable_5_paramParameter3.balanceActual ();
          visitable_5_paramParameter4.balanceActual ();
          visitable_5_paramParameter5.balanceActual ();
          throw;
        }
        visitable_5_paramParameter1.addActual (param1);
        visitable_5_paramParameter2.addActual (param2);
        visitable_5_paramParameter3.addActual (param3);
        visitable_5_paramParameter4.addActual (param4);
        visitable_5_paramParameter5.addActual (param5);
        unsigned
          ret_val;
        if (visitable_5_paramResponseValues.
            find (ret_val, param1, param2, param3, param4, param5))
          return ret_val;
        if (visitable_5_paramReturnValues.hasMoreObjects ())
          return visitable_5_paramReturnValues.nextReturnObject ();
        mockpp::assertTrue (17,
                            "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                            mockpp::
                            String (L"!true: "
                                    "visitable_5_paramhaveDefaultReturnValue == true"),
                            visitable_5_paramhaveDefaultReturnValue == true);
        visitable_5_paramDefaultReturnValueUsed = true;
        return visitable_5_paramDefaultReturnValue;
      }
  }
public:mockpp::ResponseVector5 < unsigned, int,
    wchar_t, float,
  std::string, long >
    visitable_5_paramResponseValues;
  mockpp::ThrowableItem visitable_5_paramDefaultThrowable;
  mockpp::ThrowableList visitable_5_paramThrowables;
  unsigned
    visitable_5_paramDefaultReturnValue;
  bool
    visitable_5_paramhaveDefaultReturnValue;
  bool
    visitable_5_paramDefaultReturnValueUsed;
  mockpp::ReturnObjectList < unsigned >
    visitable_5_paramReturnValues;
  mockpp::ExpectationList < int >
    visitable_5_paramParameter1;
  mockpp::ExpectationList < wchar_t > visitable_5_paramParameter2;
  mockpp::ExpectationList < float >
    visitable_5_paramParameter3;
  mockpp::ExpectationList < std::string > visitable_5_paramParameter4;
  mockpp::ExpectationList < long >
    visitable_5_paramParameter5;
  friend class
    ControllerForvisitable_5_param;
public: class ControllerForvisitable_5_param:public mockpp::VisitableMockObject::
    Controller
  {
    ExampleVisitableMockObject *
      objptr;
  public: ControllerForvisitable_5_param (ExampleVisitableMockObject * cls):objptr
      (cls)
    {
      objptr->addController (this);
    } virtual ~ ControllerForvisitable_5_param ()
    {
      objptr->removeController (this);
    } void
    addThrowable (mockpp::Throwable * t_)
    {
      std::auto_ptr < mockpp::Throwable > at (t_);
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->visitable_5_paramThrowables.push_back (at.release ());
    } template < class T > void
    addThrowable (const T & w, unsigned count = 1)
    {
      for (; count > 0; --count)
        addThrowable (mockpp::make_throwable (w));
    }
    void
    setDefaultThrowable (mockpp::Throwable * t_)
    {
      std::auto_ptr < mockpp::Throwable > at (t_);
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->visitable_5_paramDefaultThrowable.take (at.release ());
    } void
    addReturnValue (const unsigned &rv, unsigned count = 1)
    {
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      for (; count > 0; --count)
        objptr->visitable_5_paramReturnValues.addObjectToReturn (rv);
    }
    void
    setDefaultReturnValue (const unsigned &rv)
    {
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->visitable_5_paramhaveDefaultReturnValue = true;
      objptr->visitable_5_paramDefaultReturnValue = rv;
    } void
    reset ()
    {
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->visitable_5_paramThrowables.clear ();
      objptr->visitable_5_paramDefaultThrowable.clear ();
      objptr->visitable_5_paramReturnValues.clear ();
      objptr->visitable_5_paramhaveDefaultReturnValue = false;
      objptr->visitable_5_paramDefaultReturnValueUsed = false;
      objptr->visitable_5_paramResponseValues.clear ();
      objptr->visitable_5_paramParameter1.clear ();;
      objptr->visitable_5_paramParameter2.clear ();
      objptr->visitable_5_paramParameter3.clear ();
      objptr->visitable_5_paramParameter4.clear ();
      objptr->visitable_5_paramParameter5.clear ();
    } void
    addResponseValue (const unsigned &rv, const int &p1, const wchar_t & p2,
                      const float &p3, const std::string & p4, const long &p5,
                      unsigned count =
                      (std::numeric_limits < unsigned >::max ()))
    {
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->visitable_5_paramResponseValues.add (rv, p1, p2, p3, p4, p5,
                                                   count);
    } void
    addResponseThrowable (mockpp::Throwable * t, const int &p1,
                          const wchar_t & p2, const float &p3,
                          const std::string & p4, const long &p5,
                          unsigned count =
                          (std::numeric_limits < unsigned >::max ()))
    {
      mockpp::assertFalse (17,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->visitable_5_paramResponseValues.add (t, p1, p2, p3, p4, p5,
                                                   count);
    } virtual void
    verify ()
    {
      if (objptr->visitable_5_paramhaveDefaultReturnValue)
        {
          mockpp::String fmt = L"%1 is unused.";
          fmt << L"visitable_5_param" "DefaultReturnValueUsed";
          mockpp::assertTrue (17,
                              "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                              fmt,
                              objptr->
                              visitable_5_paramDefaultReturnValueUsed);
        }
      mockpp::Throwable * dt =
        objptr->visitable_5_paramDefaultThrowable.get ();
      if (dt != 0)
        {
          mockpp::String fmt = L"%1 is unused.";
          fmt << L"visitable_5_param" "DefaultThrowable";
          mockpp::assertTrue (17,
                              "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                              fmt, dt->hasThrown ());
        }
    }
  };

public:void
  void_visitable_5_param (const int &param1, const wchar_t & param2,
                          const float &param3, const std::string & param4,
                          const long &param5)
  {
    std::string func_name = __func__;
    if (!isActivated ())
      {
        addExpectedMethod (func_name);
        void_visitable_5_paramParameter1.addExpected (param1);
        void_visitable_5_paramParameter2.addExpected (param2);
        void_visitable_5_paramParameter3.addExpected (param3);
        void_visitable_5_paramParameter4.addExpected (param4);
        void_visitable_5_paramParameter5.addExpected (param5);
        return;
      }
    else
      {
        addActualMethod (func_name);
        try
        {
          mockpp::Throwable * t;
          if (void_visitable_5_paramResponseValues.
              find (t, param1, param2, param3, param4, param5))
            t->throw_me ();
          if (void_visitable_5_paramThrowables.hasMoreObjects () != 0)
            void_visitable_5_paramThrowables.nextThrowableObject ()->
              throw_me ();
          if (void_visitable_5_paramDefaultThrowable.get () != 0)
            void_visitable_5_paramDefaultThrowable.get ()->throw_me ();
        }
        catch (...)
        {
          void_visitable_5_paramParameter1.balanceActual ();
          void_visitable_5_paramParameter2.balanceActual ();
          void_visitable_5_paramParameter3.balanceActual ();
          void_visitable_5_paramParameter4.balanceActual ();
          void_visitable_5_paramParameter5.balanceActual ();
          throw;
        }
        void_visitable_5_paramParameter1.addActual (param1);
        void_visitable_5_paramParameter2.addActual (param2);
        void_visitable_5_paramParameter3.addActual (param3);
        void_visitable_5_paramParameter4.addActual (param4);
        void_visitable_5_paramParameter5.addActual (param5);
        return;
      }
  }
public:mockpp::ResponseThrowableVector5 < int,
    wchar_t, float,
  std::string, long >
    void_visitable_5_paramResponseValues;
  mockpp::ThrowableItem void_visitable_5_paramDefaultThrowable;
  mockpp::ThrowableList void_visitable_5_paramThrowables;
  mockpp::ExpectationList < int >
    void_visitable_5_paramParameter1;
  mockpp::ExpectationList < wchar_t > void_visitable_5_paramParameter2;
  mockpp::ExpectationList < float >
    void_visitable_5_paramParameter3;
  mockpp::ExpectationList < std::string > void_visitable_5_paramParameter4;
  mockpp::ExpectationList < long >
    void_visitable_5_paramParameter5;
  friend class
    ControllerForvoid_visitable_5_param;
public: class ControllerForvoid_visitable_5_param:public mockpp::VisitableMockObject::
    Controller
  {
    ExampleVisitableMockObject *
      objptr;
  public: ControllerForvoid_visitable_5_param (ExampleVisitableMockObject * cls):objptr
      (cls)
    {
      objptr->addController (this);
    } virtual ~ ControllerForvoid_visitable_5_param ()
    {
      objptr->removeController (this);
    } void
    addThrowable (mockpp::Throwable * t_)
    {
      std::auto_ptr < mockpp::Throwable > at (t_);
      mockpp::assertFalse (19,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->void_visitable_5_paramThrowables.push_back (at.release ());
    } template < class T > void
    addThrowable (const T & w, unsigned count = 1)
    {
      for (; count > 0; --count)
        addThrowable (mockpp::make_throwable (w));
    }
    void
    setDefaultThrowable (mockpp::Throwable * t_)
    {
      std::auto_ptr < mockpp::Throwable > at (t_);
      mockpp::assertFalse (19,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->void_visitable_5_paramDefaultThrowable.take (at.release ());
    } void
    reset ()
    {
      mockpp::assertFalse (19,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->void_visitable_5_paramThrowables.clear ();
      objptr->void_visitable_5_paramDefaultThrowable.clear ();
      objptr->void_visitable_5_paramResponseValues.clear ();
      objptr->void_visitable_5_paramParameter1.clear ();;
      objptr->void_visitable_5_paramParameter2.clear ();
      objptr->void_visitable_5_paramParameter3.clear ();
      objptr->void_visitable_5_paramParameter4.clear ();
      objptr->void_visitable_5_paramParameter5.clear ();
    } void
    addResponseThrowable (mockpp::Throwable * t, const int &p1,
                          const wchar_t & p2, const float &p3,
                          const std::string & p4, const long &p5,
                          unsigned count =
                          (std::numeric_limits < unsigned >::max ()))
    {
      mockpp::assertFalse (19,
                           "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                           mockpp::
                           String (L"!false: " "objptr->isActivated()"),
                           objptr->isActivated ());
      objptr->void_visitable_5_paramResponseValues.add (t, p1, p2, p3, p4, p5,
                                                        count);
    } virtual void
    verify ()
    {
      mockpp::Throwable * dt =
        objptr->void_visitable_5_paramDefaultThrowable.get ();
      if (dt != 0)
        {
          mockpp::String fmt = L"%1 is unused.";
          fmt << L"void_visitable_5_param" "DefaultThrowable";
          mockpp::assertTrue (19,
                              "/home/ewald/src/mockpp/mockpp/mockpp/doc-template.raw",
                              fmt, dt->hasThrown ());
        }
    }
  };
};

Index: avida/current/source/third-party/trio-1.9/mockpp/mockpp.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/mockpp.cpp
/**
  @file    
  @brief    common stuff for mockpp project
    
  @verbatim
    
    begin                : Thu Dec 12 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: mockpp.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/03/28 20:04:15  ewald-arnold
    extended doxygen stuff

    Revision 1.6  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.5  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.4  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:24:32  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h>  // always first header


namespace mockpp {


void MOCKPP_EXPORT
getVersion (int &major, int &minor, int &patch,
            bool &debug, std::string &info)
{
  std::string s = VERSION;
  std::string num;

  unsigned pos = s.find('.');
  bool good = true;
  if (pos != std::string::npos)
  {
    num = s.substr(0, pos);
    if (num.length() == 0)
      good = false;
    major = atoi(num.c_str());
    s.erase(0, pos+1);
    unsigned pos = s.find('.');

    if (pos != std::string::npos)
    {
      num = s.substr(0, pos);
      if (num.length() == 0)
        good = false;
      minor = atoi(num.c_str());
      s.erase(0, pos+1);

      if (s.length() == 0)
        good = false;
      patch = atoi(s.c_str());
    }
    else
      good = false;
  }
  else
    good = false;

  if (!good)
  {
    major = -1;
    minor = -1;
    patch = -1;
  }

#ifdef DEBUG
  debug = true;
#else
  debug = false;
#endif
}

};  // namespace mockpp

Index: avida/current/source/third-party/trio-1.9/mockpp/mockpp.h
+++ avida/current/source/third-party/trio-1.9/mockpp/mockpp.h
/**
  @file
  @brief Common stuff for mockpp project
  
  @verbatim
    
    begin                : Thu Dec 12 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: mockpp.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.21  2003/04/25 12:44:04  ewald-arnold
    prevent stupid msvc compiler warnings

    Revision 1.20  2003/04/23 20:42:55  ewald-arnold
    port to msvc6

    Revision 1.19  2003/04/13 16:30:05  ewald-arnold
    removed multithread stuff

    Revision 1.18  2003/04/06 19:13:58  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.17  2003/03/28 20:04:15  ewald-arnold
    extended doxygen stuff

    Revision 1.16  2003/03/23 13:17:48  ewald-arnold
    improved documentation tagging

    Revision 1.15  2003/03/12 16:45:50  ewald-arnold
    setExpectedDelta() added

    Revision 1.14  2003/03/08 20:17:30  ewald-arnold
    fixed inclusion from system include directory

    Revision 1.13  2003/03/08 14:37:05  ewald-arnold
    changes for Borland BCB

    Revision 1.12  2003/03/08 13:27:08  ewald-arnold
    typo

    Revision 1.11  2003/03/07 20:51:23  ewald-arnold
    added docs

    Revision 1.10  2003/02/25 17:57:21  ewald-arnold
    template specialisation to prevent dangerous use

    Revision 1.9  2003/02/18 19:51:10  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/16 17:40:42  ewald-arnold
    additional macros

    Revision 1.7  2003/01/16 17:38:27  ewald-arnold
    added docs
    changed email adr

    Revision 1.6  2003/01/06 13:41:37  ewald-arnold
    optionally derive from standard exception

    Revision 1.5  2003/01/04 12:24:53  ewald-arnold
    port to BCB5

    Revision 1.4  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:24:32  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 **/

/** @mainpage
   mockpp is a platform independent generic unit testing framework for C++. It's goal is to facilitate
   developing unit tests in the spirit of <a href="http://www.mockobjects.com/">Mock Objects for Java</a>
   and <a href="http://www.easymock.org/">EasyMock</a>.
   
   Mock objects allow you to set up predictible
   behaviour to help you test your production code by emulating some functionality your code depends on.
   This might for example be a huge database which is too difficult and time consuming to exist just for
   testing purposes.
  */

#ifndef MOCKPP_H
#define MOCKPP_H

#include <typeinfo>

# ifdef _MSC_VER
// Compilation Warning remover, used to skip some STL compilation warnings
#  pragma warning (disable:4786)  // this warning occurs when VC6 truncate a debug symbol which is longer than 255 chars.
#  pragma warning (disable:4251)  // this warning occurs when a class member doesn't have a dll-interface.
#  pragma warning (disable:4180)  
#  pragma warning (disable:4355)  
# endif // _MSC_VER

#ifdef _MSC_VER
# include <config-msvc.h>
#elif defined(__BORLANDC__)
# include <config-bcb5.h>
#else
#ifdef HAVE_CONFIG_H
# include <config.h>
//#else
//# include <mockpp/mockpp_config.h>
#endif
#endif

# ifdef HAVE_VALUES_H
#  include <values.h>  // older
# else
#  include <machine/limits.h> // very old??
# endif

# define MOCKPP_UNLIMITED  (UINT_MAX)
/** @def MOCKPP_UNLIMITED
  * Value representing an @p unlimited number.
  */

#ifdef __BORLANDC__
# define MOCKPP_FUNC_MACRO  __FUNC__
#elif defined(_MSC_VER)
# if _MSC_VER <= 1200
#  define MOCKPP_FUNC_MACRO  ((__FILE__  "_") + mockpp::number((long unsigned)__LINE__)) // needs #include <mockpp/compat/Formatter.h>
# else
#  define MOCKPP_FUNC_MACRO  __FUNCSIG__
# endif
#else
# define MOCKPP_FUNC_MACRO  __func__
#endif
/** @def MOCKPP_FUNC_MACRO
  * Returns the name of the current function or something similar unique 
  * for a whole project. 
  */

//! mockpp::Exception is derived from std::exception
#define MOCKPP_USE_STD_EXCEPTION

#undef HAVE_MULTITHREAD  // obsolete and error prone

//! ExpectationBoundary.setExpectedDelta() is activated.
 //! This method is only ativated upon reqest as it might cause problems
 //! with user's data type if there are no operator+() and  operator-().
#define MOCKPP_BOUNDARY_DELTA 0

#if defined(__BORLANDC__) || defined (_MSC_VER)

# ifndef __WIN32__
#  define __WIN32__
# endif //__WIN32__

# ifdef __BORLANDC__
#  include <io.h>

# ifndef __MT__
#  error  MultiThreaded compilation is HIGHLY recommended, change at own risk
# endif

# ifndef _RTLDLL
#  error  Linking with dynamic RTL is HIGHLY recommended, change at own risk
# endif

# endif

# if defined (_MSC_VER)
// DLL
// EXPORT
#  if MOCKPP_MAKING_DLL || defined(MOCKPP_EXPORTS)
#   if MOCKPP_USING_DLL
#    error "Both symbols MOCKPP_MAKING_DLL & MOCKPP_USING_DLL are enabled."
#   endif /*MOCKPP_USING_DLL*/
#   define MOCKPP_API __declspec(dllexport)
#   if defined (_MSC_VER)
#    pragma message("*** MOCKPP: DllExport ***")
#   endif
//#   define MOCKPP_API_TYPE	WXSHX_API_TYPE_EXPORT
#  endif /*MOCKPP_MAKING_DLL || defined(MOCKPP_DLL_EXPORTS)*/

// IMPORT
#  if MOCKPP_USING_DLL
#   if MOCKPP_MAKING_DLL
#    error "Both symbols MOCKPP_MAKING_DLL & MOCKPP_USING_DLL are enabled."
#   endif /*MOCKPP_MAKING_DLL*/
#   define MOCKPP_API __declspec(dllimport)
#   if defined (_MSC_VER)
#    pragma message("*** MOCKPP: DllImport ***")
#   endif
//#   define MOCKPP_API_TYPE	WXSHX_API_TYPE_IMPORT
#  endif /*MOCKPP_USING_DLL*/

// STATIC
#  ifndef MOCKPP_API
#   define MOCKPP_API

#   if defined (_MSC_VER)
#    pragma message("*** MOCKPP: Static ***")
#   endif

#  endif //MOCKPP_API

# define MOCKPP_EXPORT MOCKPP_API

# else // __BORLANDC__

#  define MOCKPP_EXPORT __declspec(dllexport)

# endif

#else // __BORLANDC__ || _MSC_VER

/** @def MOCKPP_EXPORT
  * Returns a platform dependent symbol to export names to the linker.
  */

# include <unistd.h>
# define MOCKPP_EXPORT

#endif

# include <string>
//! Namespace for project  "Mock Objects for C++"
namespace mockpp {

  typedef std::string  String;
  typedef char         Char;
//! make the charactor constant of type char
//# define (x)   x
//! make the string literal a char literal
//# define (x)  x


//! transform a string literal into a mockpp::String
//#define (x) mockpp::String((x))

//! Dummy, tags a string for translation without doing anything
//#define (x) (x)

//! Dummy, prepare automatic translation within the code
//#define (x) (x)

//! add template specialisation to prevent float/double ExpectationValue's
#undef MOCKP_NO_PREVENT_FLOAT_EXPECTATION


/** Gets the various parts of the version number.
  * @param  major  major part
  * @param  minor  minor part
  * @param  patch  patch counter
  * @param  debug  true: compiled with DEBUG
  * @param  info   some human readable information
  */
  void getVersion (int &major, int &minor, int &patch,
                   bool &debug, std::string &info);


//# define (x) (x)

};  // namespace mockpp


#endif // MOCKPP_H

Index: avida/current/source/third-party/trio-1.9/mockpp/mockpp_config.h
+++ avida/current/source/third-party/trio-1.9/mockpp/mockpp_config.h
/* Edit this file with care. It is automatically generated from config.h. */
//#define MOCKPP_UNICODE 1
//#define HAVE_LIMITS 1
//#define HAVE_VALUES_H 1

Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Assert.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Assert.cpp
/**
  @file
  @brief    handle assertions
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Assert.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.14  2003/04/09 19:09:19  ewald-arnold
    added missing function for gcc 2.95

    Revision 1.13  2003/04/06 19:16:04  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.12  2003/03/28 20:04:39  ewald-arnold
    extended doxygen stuff

    Revision 1.11  2003/02/25 20:20:42  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.10  2003/02/18 19:51:11  ewald-arnold
    updated copyright date

    Revision 1.9  2003/02/08 08:28:04  ewald-arnold
    fixes for M$VC

    Revision 1.8  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.7  2003/01/04 13:09:57  ewald-arnold
    fix cr-lf

    Revision 1.6  2003/01/04 09:48:30  ewald-arnold
    api restructured

    Revision 1.5  2003/01/01 09:54:36  ewald-arnold
    check for <limits> header

    Revision 1.4  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.3  2002/12/27 08:20:59  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:20:15  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <cmath>

#include <mockpp/compat/Assert.h>


namespace mockpp {


void MOCKPP_EXPORT assertTrue(unsigned srcline, const char* srcfile,
                              const String &message, bool condition)
{
  if (!condition)
    fail(srcline, srcfile, message);
}


void MOCKPP_EXPORT assertTrue(unsigned srcline, const char* srcfile,
                              bool condition)
{
  assertTrue(srcline, srcfile, "", condition);
}


void MOCKPP_EXPORT assertFalse(unsigned srcline, const char* srcfile,
                               const String &message, bool condition)
{
  assertTrue(srcline, srcfile, message, !condition);
}


void MOCKPP_EXPORT assertFalse(unsigned srcline, const char* srcfile,
                               bool condition)
{
  assertFalse(srcline, srcfile, (""), condition);
}


void MOCKPP_EXPORT fail(unsigned srcline, const char* srcfile,
                        const String &message)
{
  throw AssertionFailedError(srcline, srcfile, message);
}


void MOCKPP_EXPORT fail(unsigned srcline, const char* srcfile)
{
  fail(srcline, srcfile, (""));
}


void MOCKPP_EXPORT assertEquals(unsigned srcline, const char* srcfile,
                                const char *expected, const char *actual)
{
  assertEquals(srcline, srcfile, (""), expected, actual);
}


void MOCKPP_EXPORT assertEquals(unsigned srcline, const char* srcfile,
                                const String &message,
                                const char *expected,
                                const char *actual)
{
#if defined(_MSC_VER)
  if (strcmp(expected, actual) != 0)
#else
  if (std::strcmp(expected, actual) != 0)
#endif
    fail(srcline, srcfile, message);
}


void MOCKPP_EXPORT assertDelta(unsigned srcline, const char* srcfile,
                               const String &message, double expected, double actual, double delta)
{
 // handle infinity specially since subtracting to infinite values gives NaN and the

 // the following test fails

#if defined(_MSC_VER)
    if (!(fabs(expected-actual) <= fabs(delta))) // Because comparison with NaN always returns false
#else    
    if (!(std::fabs(expected-actual) <= std::fabs(delta))) // Because comparison with NaN always returns false
#endif
      fail(srcline, srcfile, message);
}


void MOCKPP_EXPORT assertDelta(unsigned srcline, const char* srcfile,
                               double expected, double actual, double delta)
{
  (srcline, srcfile, (""), expected, actual, delta);
}


void MOCKPP_EXPORT assertDelta(unsigned srcline, const char* srcfile,
                               const String &message, float expected, float actual, float delta)
{
  // handle infinity specially since subtracting to infinite values gives NaN and the
  // the following test fails

#if defined(_MSC_VER)
    if (!(fabs(expected-actual) <= fabs(delta)))
#else
    if (!(std::fabs(expected-actual) <= std::fabs(delta)))
#endif
      fail(srcline, srcfile, message);
}


void MOCKPP_EXPORT assertDelta(unsigned srcline, const char* srcfile,
                               float expected, float actual, float delta)
{
  (srcline, srcfile, (""), expected, actual, delta);
}


}; // namespace mockpp

Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Assert.h
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Assert.h
/**
  @file    
  @brief    Handle assertions
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Assert.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.12  2003/04/25 12:43:06  ewald-arnold
    removed dead code

    Revision 1.11  2003/03/23 13:17:08  ewald-arnold
    improved documentation tagging

    Revision 1.10  2003/02/25 20:20:43  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.9  2003/02/18 19:51:11  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/16 17:32:45  ewald-arnold
    show error condition

    Revision 1.7  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.6  2003/01/04 13:09:57  ewald-arnold
    fix cr-lf

    Revision 1.5  2003/01/04 12:24:28  ewald-arnold
    port to BCB5

    Revision 1.4  2003/01/04 09:48:30  ewald-arnold
    api restructured

    Revision 1.3  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/25 10:20:15  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_ASSERT_H
#define MOCKPP_ASSERT_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/AssertionFailedError.h>


namespace mockpp {


/**
  * Asserts that a condition is true. If it isn't it throws
  * an AssertionFailedError with the given infomation.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param condition  if false, an AssertionFailedError is thrown
  */
void assertTrue(unsigned srcline, const char* srcfile,
                const String &message, bool condition);

/**
  * Asserts that a condition is true. If it isn't it throws
  * an AssertionFailedError.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param condition  if false, an AssertionFailedError is thrown
  */
void assertTrue(unsigned srcline, const char* srcfile,
                bool condition);

/**
  * Asserts that a condition is false. If it isn't it throws
  * an AssertionFailedError with the given message.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param condition  if true, an AssertionFailedError is thrown
  */
void assertFalse(unsigned srcline, const char* srcfile,
                 const String &message, bool condition);

/**
  * Asserts that a condition is false. If it isn't it throws
  * an AssertionFailedError.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param condition  if true, an AssertionFailedError is thrown
  */
void assertFalse(unsigned srcline, const char* srcfile,
                 bool condition);

/**
  * Fails a test with the given message (AssertionFailedError is thrown).
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  */
void fail(unsigned srcline, const char* srcfile,
                 const String &message);

/**
  * Fails a test with no message.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  */
void fail(unsigned srcline, const char* srcfile);

/**
  * Asserts that two doubles are equal concerning a delta.  If they are not
  * an AssertionFailedError is thrown with the given message.  If the expected
  * value is infinity then the delta value is ignored.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param expected   the expected value
  * @param actual     the actual value
  * @param delta      the maximal difference which is allowed for actual from expected
  */
void assertDelta(unsigned srcline, const char* srcfile,
                 const String &message,
                 double expected, double actual, double delta);

/**
  * Asserts that two doubles are equal concerning a delta. If the expected
  * value is infinity then the delta value is ignored.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param expected   the expected value
  * @param actual     the actual value
  * @param delta      the maximal difference which is allowed for actual from expected
  */
void assertDelta(unsigned srcline, const char* srcfile,
                 double expected, double actual, double delta);

/**
  * Asserts that two floats are equal concerning a delta. If they are not
  * an AssertionFailedError is thrown with the given message.  If the expected
  * value is infinity then the delta value is ignored.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param expected   the expected value
  * @param actual     the actual value
  * @param delta      the maximal difference which is allowed for actual from expected
  */
void assertDelta(unsigned srcline, const char* srcfile,
                 const String &message,
                 float expected, float actual, float delta);


/**
  * Asserts that two floats are equal concerning a delta. If the expected
  * value is infinity then the delta value is ignored.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param expected   the expected value
  * @param actual     the actual value
  * @param delta      the maximal difference which is allowed for actual from expected
  */
void assertDelta(unsigned srcline, const char* srcfile,
                 float expected, float actual, float delta);

/**
  * Asserts that two c-string are equal. If they are not
  * an AssertionFailedError is thrown with the given message.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param expected   the expected value
  * @param actual     the actual value
  */
void assertEquals(unsigned srcline, const char* srcfile,
                  const String &message,
                  const char *expected, const char *actual);

/**
  * Asserts that two c-string are equal.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param expected   the expected value
  * @param actual     the actual value
  */
void assertEquals(unsigned srcline, const char* srcfile,
                  const char *expected, const char *actual);

/**
  * Asserts that two values are equal.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param expected   the expected value
  * @param actual     the actual value
  */
template <class T>
void assertEquals(unsigned srcline, const char* srcfile,
                  const String &message, const T &expected, const T &actual)
{
  if (expected != actual)
    fail(srcline, srcfile, message);
}


/**
  * Asserts that two values are equal.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param expected   the expected value
  * @param actual     the actual value
  */
template <class T>
void assertEquals(unsigned srcline, const char* srcfile,
                  const T &expected, const T &actual)
{
  assertEquals(srcline, srcfile, (""), expected, actual);
}


/**
  * Asserts that two values are equal concerning a delta.  If they are not
  * an AssertionFailedError is thrown with the given message.  
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param message    a human readable description about the cause
  * @param expected   the expected value
  * @param actual     the actual value
  * @param delta      the maximal difference which is allowed for actual from expected
  */
template <class T>  
void assertDelta(unsigned srcline, const char* srcfile,
                 const String &message,
                 const T &expected, const T &actual, const T &delta)
{                  
  T diff = expected < actual
         ? actual   - expected
         : expected - actual; 
  if (diff > delta)
    fail(srcline, srcfile, message);
}


/**
  * Asserts that two values are equal concerning a delta.
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param expected   the expected value
  * @param actual     the actual value
  * @param delta      the maximal difference which is allowed for actual from expected
  */
template <class T>
void assertDelta(unsigned srcline, const char* srcfile,
                 const T &expected, const T &actual, const T &delta)
{
  assertDelta(srcline, srcfile, (""), expected, actual, delta);
}


/**
  * Asserts that a values lies between two boundary values..
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param msg        a human readable description about the cause
  * @param lo         lower boundaray
  * @param up         upper boundary
  * @param actual     value
  */
template <class T>  
void assertBoundary(unsigned srcline, const char* srcfile,
                    const String &message,
                    const T &lo, const T &up, const T &actual)
{                  
  if ((actual < lo) || (up < actual))
    fail(srcline, srcfile, message);
}


/**
  * Asserts that a values lies between two boundary values..
  * @param srcline    the line in the sourcefile
  * @param srcfile    the name of the sourcefile
  * @param lo         lower boundaray
  * @param up         upper boundary
  * @param actual     value
  */
template <class T>
void assertBoundary(unsigned srcline, const char* srcfile,
                    const T &lo, const T &up, const T &actual)
{
  assertBoundary(srcline, srcfile, (""), lo, up, actual);
}


}; // namespace mockpp


/**
  * Asserts that two values are equal. 
  * @param msg        a human readable description about the cause
  * @param a          first value       
  * @param b          second value    
  */
#define MOCKPP_ASSERT_EQUALS_MESSAGE(msg, a, b)  mockpp::assertEquals(__LINE__, __FILE__, msg, a, b)

/**
  * Asserts that two values are equal.
  * The condition is converted and passed as the according message.
  * @param a          first value
  * @param b          second value
  */
#define MOCKPP_ASSERT_EQUALS(a, b)  mockpp::assertEquals(__LINE__, __FILE__, ("invalid: " #a " == " #b), a, b)

/**
  * Asserts that two values are equal concerning a delta.
  * @param msg        a human readable description about the cause
  * @param a          first value
  * @param b          second value
  * @param delta      maximal difference a to b
  */
#define MOCKPP_ASSERT_DELTA_MESSAGE(msg, a, b, delta)  mockpp::assertDelta(__LINE__, __FILE__, msg, a, b, delta)

/**
  * Asserts that two values are equal concerning a delta. 
  * The condition is converted and passed as the according message.
  * @param a          first value
  * @param b          second value
  * @param delta      maximal difference a to b
  */
#define MOCKPP_ASSERT_DELTA(a, b, delta)  mockpp::assertDelta(__LINE__, __FILE__, ("invalid: " #a " +- " #delta " == " #b), a, b, delta)

/**
  * Asserts that a values lies between two boundary values..
  * @param msg        a human readable description about the cause
  * @param lo         lower boundaray
  * @param up         upper boundary
  * @param a          value
  */
#define MOCKPP_ASSERT_BOUNDARY_MESSAGE(msg, lo, up, a)  mockpp::assertBoundary(__LINE__, __FILE__, msg, lo, up, a)

/**
  * Asserts that two values are equal concerning a delta. 
  * The condition is converted and passed as the according message.
  * @param lo         lower boundaray
  * @param up         upper boundary
  * @param a          value
  */
#define MOCKPP_ASSERT_BOUNDARY(lo, up, a)  mockpp::assertBoundary(__LINE__, __FILE__, ("invalid: " #lo " < " #a " < " #up), lo, up, a)


/**
  * Asserts that a condition is true.
  * @param msg        a human readable description about the cause
  * @param cond       boolean condition       
  */
#define MOCKPP_ASSERT_TRUE_MESSAGE(msg, cond) mockpp::assertTrue(__LINE__, __FILE__, msg, cond)

/**
  * Asserts that a condition is true.
  * The condition is converted and passed as the according message.
  * @param cond       boolean condition
  */
#define MOCKPP_ASSERT_TRUE(cond) mockpp::assertTrue(__LINE__, __FILE__, ("!true: " #cond), cond)

/**
  * Asserts that a condition is false.
  * @param msg        a human readable description about the cause
  * @param cond       boolean condition
  */
#define MOCKPP_ASSERT_FALSE_MESSAGE(msg, cond) mockpp::assertFalse(__LINE__, __FILE__, msg, cond)

/**
  * Asserts that a condition is false.
  * The condition is converted and passed as the according message.
  * @param cond       boolean condition
  */
#define MOCKPP_ASSERT_FALSE(cond) mockpp::assertFalse(__LINE__, __FILE__, ("!false: " #cond), cond)

/**
  * Unconditionally throws an AssertionFailedError.
  * @param msg        a human readable description about the cause
  */
#define MOCKPP_FAIL(msg)  mockpp::fail(__LINE__, __FILE__, msg)


#endif // MOCKPP_ASSERT_H


Index: avida/current/source/third-party/trio-1.9/mockpp/compat/AssertionFailedError.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/AssertionFailedError.cpp
/**
  @file    
  @brief    signal failed assertions
                    
  @verbatim
    
    begin                : Mon Dec 23 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AssertionFailedError.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/03/28 20:04:40  ewald-arnold
    extended doxygen stuff

    Revision 1.6  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.5  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.4  2003/01/04 09:50:13  ewald-arnold
    api restructured

    Revision 1.3  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/27 08:20:59  ewald-arnold
    preparations for  and windoze

    Revision 1.1  2002/12/25 10:19:17  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first


#include <mockpp/compat/AssertionFailedError.h>


namespace mockpp {


MOCKPP_EXPORT
AssertionFailedError::AssertionFailedError (unsigned srcline, const char* srcfile,
                                            const String &msg)
  : Exception(srcline, srcfile, msg)
{
}


}; // namespace mockpp




Index: avida/current/source/third-party/trio-1.9/mockpp/compat/AssertionFailedError.h
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/AssertionFailedError.h
/**
  @file    
  @brief    Signal failed assertions
                    
  @verbatim
    
    begin                : Mon Dec 23 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AssertionFailedError.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.6  2003/03/23 13:17:08  ewald-arnold
    improved documentation tagging

    Revision 1.5  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.4  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.3  2003/01/04 09:50:13  ewald-arnold
    api restructured

    Revision 1.2  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.1  2002/12/25 10:19:17  ewald-arnold
    new

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_ASSERTIONFAILEDERROR_H
#define MOCKPP_ASSERTIONFAILEDERROR_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/Exception.h>


namespace mockpp {


/**
  * Thrown when an assertion failed.
  */
class AssertionFailedError : public Exception
{
  public:
  /** Constructs an exception.
    * @param srcline    the line in the sourcefile
    * @param srcfile    the name of the sourcefile
    * @param message    a human readable description about the cause
    */
    AssertionFailedError (unsigned srcline, const char* srcfile,
                          const String &message);
};


}; // namespace mockpp


#endif // MOCKPP_ASSERTIONFAILED_H


Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Exception.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Exception.cpp
/**
  @file    
  @brief    base class for MockObject exceptions
                    
  @verbatim
    
    begin                : Tue Dec 31 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Exception.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.8  2003/03/28 20:04:40  ewald-arnold
    extended doxygen stuff

    Revision 1.7  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.6  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.5  2003/01/06 13:29:05  ewald-arnold
    optionally derive from standard exception

    Revision 1.4  2003/01/04 13:09:57  ewald-arnold
    fix cr-lf

    Revision 1.3  2003/01/04 12:24:28  ewald-arnold
    port to BCB5

    Revision 1.2  2003/01/04 09:50:13  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/Exception.h>


namespace mockpp {


MOCKPP_EXPORT  Exception::Exception(unsigned line, const char *file, const String &msg)
  :
#ifdef MOCKPP_USE_STD_EXCEPTION
    std::exception(),
#endif
    message(msg),
    srcline(line),
    srcfile(file)
{
}


MOCKPP_EXPORT  Exception::~Exception () throw()
{
}


#ifdef MOCKPP_USE_STD_EXCEPTION

const char *MOCKPP_EXPORT Exception::what() const throw()
{
  what_helper = getMessage();
  return what_helper.c_str();
}

#endif


String MOCKPP_EXPORT  Exception::getMessage() const
{
  return message;
}


unsigned MOCKPP_EXPORT  Exception::getSrcLine() const
{
  return srcline;
}


String MOCKPP_EXPORT Exception::getSrcFile() const
{
  return srcfile;
}


}; // namespace mockpp



Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Exception.h
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Exception.h
/**
  @file    
  @brief    Base class for MockObject exceptions
                    
  @verbatim
    
    begin                : Tue Dec 31 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Exception.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.9  2003/04/13 16:58:29  ewald-arnold
    optical change

    Revision 1.8  2003/03/23 13:17:08  ewald-arnold
    improved documentation tagging

    Revision 1.7  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.6  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.5  2003/01/06 13:29:05  ewald-arnold
    optionally derive from standard exception

    Revision 1.4  2003/01/04 13:09:57  ewald-arnold
    fix cr-lf

    Revision 1.3  2003/01/04 12:24:28  ewald-arnold
    port to BCB5

    Revision 1.2  2003/01/04 09:50:13  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_EXCEPTION
#define MOCKPP_EXCEPTION

#include <mockpp/mockpp.h> // always first

#ifdef MOCKPP_USE_STD_EXCEPTION
#include <exception>
#endif


namespace mockpp {


/** Base class for all mockpp exceptions. The main purpose of such exceptions
  * is to provide information about the location and the cause of failed actions.
  */
class Exception
#ifdef MOCKPP_USE_STD_EXCEPTION
   : public std::exception
#endif
{
  public:

  /** Constructs an exception.
    * @param srcline    the line in the sourcefile
    * @param srcfile    the name of the sourcefile
    * @param message    a human readable description about the cause
    */
    Exception (unsigned srcline, const char* srcfile, const String &message);

  /** Destroys the exception.
    * Mainly here to enforce virtual destructors.
    */
    virtual ~Exception() throw();

  /** Returns the exception description.
    * @return   descriptin
    */
    String getMessage() const;

  /** Returns the source line where the exception occured.
    * @return   source line
    */
    unsigned getSrcLine() const;

  /** Returns the source file name where the exception occured.
    * @return   source file name
    */
    String getSrcFile() const;

#ifdef MOCKPP_USE_STD_EXCEPTION
  /** Returns the exception description.
    * Provided for compatibility with std::exception. If Unicode is
    * activated you might get corrupt information if you are beyond
    * latin1 characters.
    * @return   description as pointer to a latin1 string.
    */
    virtual const char *what() const throw();
#endif

  private:
    String       message;
    unsigned     srcline;
    String       srcfile;
#ifdef MOCKPP_USE_STD_EXCEPTION
    mutable std::string  what_helper;
#endif         
};


}; // namespace mockpp


#endif // MOCKPP_ASSERTIONFAILED_H


Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Formatter.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Formatter.cpp
/**
  @file    
  @brief    support formatting of strings
                    
  @verbatim
    
    begin                : Wed Dez 25 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Formatter.cpp,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.16  2003/04/23 20:42:56  ewald-arnold
    port to msvc6

    Revision 1.15  2003/04/10 21:06:56  ewald-arnold
    fixed a bug in a special case

    Revision 1.14  2003/04/09 19:10:34  ewald-arnold
    prevent compiler warning

    Revision 1.13  2003/04/06 19:16:04  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.12  2003/03/28 20:04:40  ewald-arnold
    extended doxygen stuff

    Revision 1.11  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.10  2003/02/08 08:28:05  ewald-arnold
    fixes for M$VC

    Revision 1.9  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.8  2003/01/06 13:30:06  ewald-arnold
    use mockpp exception

    Revision 1.7  2003/01/04 12:24:28  ewald-arnold
    port to BCB5

    Revision 1.6  2003/01/04 09:50:13  ewald-arnold
    api restructured

    Revision 1.5  2003/01/01 09:54:36  ewald-arnold
    check for <limits> header

    Revision 1.4  2002/12/31 13:29:13  ewald-arnold
    optical changes

    Revision 1.3  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/27 08:21:40  ewald-arnold
    real implementation

  @endverbatim

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

 
#include <mockpp/mockpp.h>  // always first header

#include <cstdio>

#include <mockpp/compat/Formatter.h>
#include <mockpp/compat/AssertionFailedError.h>


namespace mockpp {


mockpp::String MOCKPP_EXPORT number( long n, unsigned base)
{
  if ( base < 2 || base > 36 )
  {
    mockpp::String fmt = ("Conversion of ulong to String: base %1 not allowed");
    fmt << base;
    throw mockpp::AssertionFailedError(__LINE__, __FILE__, fmt);
  }

  mockpp::Char charbuf[65*sizeof(mockpp::Char)];
  mockpp::Char *buf = (mockpp::Char*)charbuf;
  mockpp::Char *p = &buf[64];
  *p = ('\0');
  int  len = 0;
  bool neg;
  if ( n < 0 )
  {
    neg = true;
    if (n == INT_MIN)
    {
      mockpp::String s1, s2;
      s1 = number(n/(long)base, base);
#if defined(_MSC_VER) && (__MSC_VER <= 1200)
      s2 = number((unsigned long)(-(n+(long)base)) % base, base);
#else
      s2 = number((-(n+(long)base)) % base, base);
#endif
      return s1+s2;
    }
    n = -n;
  }
  else
  {
    neg = false;
  }

  do
  {
    *--p = ("0123456789abcdefghijklmnopqrstuvwxyz")[((int)(n % base))];
    n /= base;
    len++;
  } while ( n );

  if ( neg )
  {
    *--p = ('-');
    len++;
  }
  return p;
}


mockpp::String MOCKPP_EXPORT number( unsigned long n, unsigned base)
{
  if ( base < 2 || base > 36 )
  {
    mockpp::String fmt = ("Conversion of ulong to String: base %1 not allowed");
    fmt << base;
    throw mockpp::AssertionFailedError(__LINE__, __FILE__, fmt);
  }

  mockpp::Char charbuf[65*sizeof(mockpp::Char)];
  mockpp::Char *buf = (mockpp::Char*)charbuf;
  mockpp::Char *p = &buf[64];
  int len = 0;
  *p = ('\0');
  do
  {
    *--p = ("0123456789abcdefghijklmnopqrstuvwxyz")[((int)(n % base))];
    n /= base;
    len++;
  } while ( n );
  
  return p;
}


mockpp::String MOCKPP_EXPORT number( double n, unsigned prec)
{
   if (prec > 99)
     prec = 99;
     
   char format[20];
   char buf[120];
   char *fs = format;
   
   *fs++ = '%';
   if (prec != 0)
   {
     *fs++ = '.';
     if ( prec >= 10 )
     {
       *fs++ = prec / 10 + '0';
       *fs++ = prec % 10 + '0';
     }
     else
       *fs++ = prec + '0';      //   "%.<prec>lg"
     *fs++ = 'l';
   }  
   *fs++ = 'g';
   *fs = '\0';
#if defined(_MSC_VER)
   sprintf( buf, format, n );
#else
   std::sprintf( buf, format, n );
#endif

#ifdef MOCKPP_UNICODE
   mockpp::String ret = mockpp::getUnicode(buf);
   return ret;
#else
   return mockpp::String(buf);
#endif   
}


} // namespace mockpp


bool findArg(mockpp::String &fmt, int& pos, int& len)
{
  char lowest=0;
  for (unsigned int i=0; i < fmt.length(); i++)
  {
    if ( fmt.at(i) == ('%') && i+1 < fmt.length() )
    {
      char dig = fmt.at(i+1);
      if ( dig >= ('0') && dig <= ('9') )
      {
        if ( !lowest || dig < lowest )
        {
          lowest = dig;
          pos = i;
          len = 2;
        }
      }
    }
  }
  return lowest != 0;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, int repdata)
{
  formatter << mockpp::number((long)repdata);
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, unsigned int repdata)
{
  formatter << mockpp::number((unsigned long) repdata);
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, long repdata)
{
  formatter << mockpp::number(repdata);
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, unsigned long repdata)
{
  formatter << mockpp::number(repdata);
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, double repdata)
{
  formatter << mockpp::number(repdata);
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, float repdata)
{
  formatter << mockpp::number(repdata);
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, char repdata)
{
  mockpp::String s;
  s += repdata;
  formatter << s;
  return formatter;
}


mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, const mockpp::String &repdata)
{
  int pos, len;

  if ( !findArg(formatter, pos, len ) )
    formatter + ("[") + repdata + ("]") ; // TODO throw exception ??
  else
    formatter.replace( pos, len, repdata);
    
  return formatter;
}



Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Formatter.h
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Formatter.h
/**
  @file    
  @brief    Support formatting of strings
                    
  @verbatim
    
    begin                : Wed Dez 25 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Formatter.h,v $
    Revision 1.1  2003/11/25 18:20:46  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/03/23 13:17:08  ewald-arnold
    improved documentation tagging

    Revision 1.6  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.5  2003/01/16 17:34:18  ewald-arnold
    added docs
    changed email adr

    Revision 1.4  2003/01/04 09:50:13  ewald-arnold
    api restructured

    Revision 1.3  2002/12/31 11:22:03  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.2  2002/12/27 08:21:40  ewald-arnold
    real implementation

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_FORMATTER_H
#define MOCKPP_FORMATTER_H

#include <mockpp/mockpp.h>  // always first header


namespace mockpp {
  

/**
  * Converts a long value into its string representation.
  * @param n          the actual value
  * @param base       the conversion base from 2 to 36
  * @return the resulting string
  */
mockpp::String number(long n, unsigned base = 10);

/**
  * Converts an unsigned long value into its string representation.
  * @param n          the actual value
  * @param base       the conversion base from 2 to 36
  * @return the resulting string
  */
mockpp::String number(unsigned long n, unsigned base = 10);

/**
  * Converts an double value into its string representation.
  * @param n          the actual value
  * @param prec       the desired precision (amout of significant digits).
  *                   0 = minimum required, no trailing zeros.
  * @return the resulting string
  */
mockpp::String number(double n, unsigned prec = 0);


} // namespace mockpp


/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 9  gives "hello 9"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, int repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 9  gives "hello 9"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, unsigned int repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 9  gives "hello 9"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, long repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 9  gives "hello 9"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, unsigned long repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << "world"  gives "hello world"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, const mockpp::String &repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 'A'  gives "hello A"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, char repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 1.234  gives "hello 1.234"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, double repdata);

/** Replace a positional %-parameter with a value.
  * Replaces the lowest %-parameter with the string representation of the data.
  * "hello %1" << 1.234  gives "hello 1.234"
  * @param formatter  target string with position parameter
  * @param repdata    value to replace
  * @return the resulting string
  */
mockpp::String & operator << (mockpp::String &formatter, float repdata);

#endif // MOCKPP_FORMATTER_H


Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Makefile.am
INCLUDES = -I$(srcdir)/../..

noinst_LIBRARIES = libcompat.a

libcompat_a_SOURCES = \
  Exception.cpp \
  Assert.cpp \
  Formatter.cpp \
  AssertionFailedError.cpp


libcompatincludedir = $(includedir)/mockpp/compat
libcompatinclude_HEADERS =  \
  $(libcompat_a_SOURCES:.cpp=.h)




Index: avida/current/source/third-party/trio-1.9/mockpp/compat/Makefile.in
+++ avida/current/source/third-party/trio-1.9/mockpp/compat/Makefile.in
# Makefile.in generated by automake 1.7.6 from Makefile.am.
# @configure_input@

# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../../..

am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_PRIMITIVE_FALSE = @BUILD_PRIMITIVE_FALSE@
BUILD_PRIMITIVE_TRUE = @BUILD_PRIMITIVE_TRUE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CODE_TESTS_FALSE = @CODE_TESTS_FALSE@
CODE_TESTS_TRUE = @CODE_TESTS_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFAULT_TESTS_FALSE = @DEFAULT_TESTS_FALSE@
DEFAULT_TESTS_TRUE = @DEFAULT_TESTS_TRUE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HTMLDIR = @HTMLDIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
QMAKE = @QMAKE@
QMAKE_DEBUG_FALSE = @QMAKE_DEBUG_FALSE@
QMAKE_DEBUG_TRUE = @QMAKE_DEBUG_TRUE@
QMAKE_WARN_FALSE = @QMAKE_WARN_FALSE@
QMAKE_WARN_TRUE = @QMAKE_WARN_TRUE@
QT_VIEWER_FALSE = @QT_VIEWER_FALSE@
QT_VIEWER_TRUE = @QT_VIEWER_TRUE@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TEDIOUS_TESTS_FALSE = @TEDIOUS_TESTS_FALSE@
TEDIOUS_TESTS_TRUE = @TEDIOUS_TESTS_TRUE@
VERSION = @VERSION@
VIEW = @VIEW@
VIEWER_FALSE = @VIEWER_FALSE@
VIEWER_TRUE = @VIEWER_TRUE@
VIEW_LIBS = @VIEW_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I$(srcdir)/../..

noinst_LIBRARIES = libcompat.a

libcompat_a_SOURCES = \
  Exception.cpp \
  Assert.cpp \
  Formatter.cpp \
  AssertionFailedError.cpp


libcompatincludedir = $(includedir)/mockpp/compat
libcompatinclude_HEADERS = \
  $(libcompat_a_SOURCES:.cpp=.h)

subdir = source/third-party/mockpp/compat
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)

libcompat_a_AR = $(AR) cru
libcompat_a_LIBADD =
am_libcompat_a_OBJECTS = Exception.$(OBJEXT) Assert.$(OBJEXT) \
	Formatter.$(OBJEXT) AssertionFailedError.$(OBJEXT)
libcompat_a_OBJECTS = $(am_libcompat_a_OBJECTS)

DEFAULT_INCLUDES =  -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE at DEP_FILES = ./$(DEPDIR)/Assert.Po \
@AMDEP_TRUE@	./$(DEPDIR)/AssertionFailedError.Po \
@AMDEP_TRUE@	./$(DEPDIR)/Exception.Po ./$(DEPDIR)/Formatter.Po
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
	-o $@
DIST_SOURCES = $(libcompat_a_SOURCES)
HEADERS = $(libcompatinclude_HEADERS)

DIST_COMMON = $(libcompatinclude_HEADERS) Makefile.am Makefile.in
SOURCES = $(libcompat_a_SOURCES)

all: all-am

SUFFIXES:
SUFFIXES: .cpp .o .obj
$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  source/third-party/mockpp/compat/Makefile
Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)

AR = ar

clean-noinstLIBRARIES:
	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libcompat.a: $(libcompat_a_OBJECTS) $(libcompat_a_DEPENDENCIES) 
	-rm -f libcompat.a
	$(libcompat_a_AR) libcompat.a $(libcompat_a_OBJECTS) $(libcompat_a_LIBADD)
	$(RANLIB) libcompat.a

mostlyclean-compile:
	-rm -f *.$(OBJEXT) core *.core

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Assert.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AssertionFailedError.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Exception.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Formatter.Po at am__quote@

distclean-depend:
	-rm -rf ./$(DEPDIR)

cpp.o:
@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@	fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<

cpp.obj:
@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@	fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
libcompatincludeHEADERS_INSTALL = $(INSTALL_HEADER)
install-libcompatincludeHEADERS: $(libcompatinclude_HEADERS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(libcompatincludedir)
	@list='$(libcompatinclude_HEADERS)'; for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " $(libcompatincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(libcompatincludedir)/$$f"; \
	  $(libcompatincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(libcompatincludedir)/$$f; \
	done

uninstall-libcompatincludeHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(libcompatinclude_HEADERS)'; for p in $$list; do \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " rm -f $(DESTDIR)$(libcompatincludedir)/$$f"; \
	  rm -f $(DESTDIR)$(libcompatincludedir)/$$f; \
	done

ETAGS = etags
ETAGSFLAGS =

CTAGS = ctags
CTAGSFLAGS =

tags: TAGS

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(ETAGS_ARGS)$$tags$$unique" \
	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	     $$tags $$unique

ctags: CTAGS
CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

top_distdir = ../../../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkinstalldirs) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(HEADERS)

installdirs:
	$(mkinstalldirs) $(DESTDIR)$(libcompatincludedir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-am

clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am

distclean: distclean-am

distclean-am: clean-am distclean-compile distclean-depend \
	distclean-generic distclean-tags

dvi: dvi-am

dvi-am:

info: info-am

info-am:

install-data-am: install-libcompatincludeHEADERS

install-exec-am:

install-info: install-info-am

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-am

maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic

pdf: pdf-am

pdf-am:

ps: ps-am

ps-am:

uninstall-am: uninstall-info-am uninstall-libcompatincludeHEADERS

PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
	clean-noinstLIBRARIES ctags distclean distclean-compile \
	distclean-depend distclean-generic distclean-tags distdir dvi \
	dvi-am info info-am install install-am install-data \
	install-data-am install-exec install-exec-am install-info \
	install-info-am install-libcompatincludeHEADERS install-man \
	install-strip installcheck installcheck-am installdirs \
	maintainer-clean maintainer-clean-generic mostlyclean \
	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
	tags uninstall uninstall-am uninstall-info-am \
	uninstall-libcompatincludeHEADERS

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
NOEXPORT:

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/Makefile.am
SUBDIRS = en api

CLEANFILES = *.~* *.~~* *~


Index: avida/current/source/third-party/trio-1.9/mockpp/docs/api/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/api/Makefile.am
all:

CLEAN_FILES = html/*

PHONY: api-index apidoc apidoc-dist remote-install

remote-install: apidoc all
	-scp html/*.html html/*.png html/*.gif html/*.css ewald-arnold at mockcpp.sourceforge.net:/home/groups/m/mo/mockpp/htdocs/api

apidoc:
	-test -d html && rm -rf html/*
	sed -e "s#TOP_SRCDIR#$(top_srcdir)#g" $(top_srcdir)/mockpp.doxygen >tmp.doxygen
	doxygen tmp.doxygen
	rm tmp.doxygen        
        
api-index:        
	cd html && doxytag -s search.idx
        
apidoc-dist: apidoc
	-test -d $(PACKAGE)-$(VERSION)-apidoc && rm -rf $(PACKAGE)-$(VERSION)-apidoc
	mkdir $(PACKAGE)-$(VERSION)-apidoc
	cp -R html/* $(PACKAGE)-$(VERSION)-apidoc
	test -f mockpp.tag && cp mockpp.tag  $(PACKAGE)-$(VERSION)-apidoc     
	tar cfj $(PACKAGE)-$(VERSION)-apidoc.tar.bz2 $(PACKAGE)-$(VERSION)-apidoc/*
	zip  -r $(PACKAGE)-$(VERSION)-apidoc.zip  $(PACKAGE)-$(VERSION)-apidoc/*
	mv $(PACKAGE)-$(VERSION)-apidoc.tar.bz2 $(top_builddir)
	mv $(PACKAGE)-$(VERSION)-apidoc.zip $(top_builddir)
	rm -rf $(PACKAGE)-$(VERSION)-apidoc



Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/Makefile.am
remote-install: html-files all
	-scp var/*.html                  ewald-arnold at mockpp.sourceforge.net:/home/groups/m/mo/mockpp/htdocs/hb
	-scp $(srcdir)/common/*          ewald-arnold at mockpp.sourceforge.net:/home/groups/m/mo/mockpp/htdocs/hb/common
	-scp $(srcdir)/images/callouts/* ewald-arnold at mockpp.sourceforge.net:/home/groups/m/mo/mockpp/htdocs/hb/images/callouts

CLEANFILES = *.~* *.~~* *~

doc-dist: html-files
	mkdir -p mockpp-$(VERSION)-doc/doc/html
	mkdir -p mockpp-$(VERSION)-doc/doc/html/common
	mkdir -p mockpp-$(VERSION)-doc/doc/html/images
	-cp var/*  mockpp-$(VERSION)-doc/doc/html
	cp -R  $(srcdir)/common mockpp-$(VERSION)-doc/doc/html
	cp -R  $(srcdir)/images mockpp-$(VERSION)-doc/doc/html
	tar cfj mockpp-$(VERSION)-doc.tar.bz2 --exclude=CVS  mockpp-$(VERSION)-doc/*
	zip  -r mockpp-$(VERSION)-doc.zip mockpp-$(VERSION)-doc/*
	mv mockpp-$(VERSION)-doc.tar.bz2 $(top_builddir)
	mv mockpp-$(VERSION)-doc.zip $(top_builddir)
	rm -r mockpp-$(VERSION)-doc


html-files:
	-test -d var || mkdir -p var        
	-test -d var/common || ln -s $(srcdir)/common var/common
	-test -d var/images || ln -s $(srcdir)/images var/images
	xsltproc -o var/  $(srcdir)/customize.xsl  $(srcdir)/index.docbook
        
pdf-files:   
	xsltproc --output var/myfile.fo /usr/share/sgml/docbook/docbook-xsl-stylesheets/fo/docbook.xsl index.docbook
	pdftex --interaction nonstopmode "&pdfxmltex" var/myfile.fo
	pdftex --interaction nonstopmode "&pdfxmltex" var/myfile.fo        

PHONY: html-files pdf-files doc-dist remote-install

EXTRA_DIST = appendix.docbook \
 bookinfo.docbook \
 credits.docbook \
 customize.xsl \
 dev_advanced.docbook \
 dev_basic.docbook \
 dev_helper.docbook \
 dev_intro.docbook \
 faq.docbook \
 index.docbook

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/appendix.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/appendix.docbook
<appendix id="installation">
<title>Installation</title>

<sect1 id="getting-mockpp">
<title>How to obtain mockpp</title>

<para>&mockpp; is located on <ulink url="http://www.sf.net">Sourceforge</ulink>.
Everything about &mockpp; can be found on it's homepage at
<ulink url="http://mockpp.sf.net">http://mockpp.sf.net</ulink></para>
</sect1>

<sect1 id="requirements">
<title>Requirements</title>

<para>
In order to fully benefit from &mockpp;, you need 
<ulink url="http://cppunit.sf.net">CppUnit</ulink>, the framework for unit tests
with C++.</para>

</sect1>

<sect1 id="compilation">
<title>Compilation and Installation</title>

<sect2>
<title>Installing on systems using autoconf and friends</title>

<para>In order to compile and install mockpp on your system, type the following in the base
directory of the &mockpp; distribution:

<screen width="40">
 <prompt>%</prompt> <userinput>./configure</userinput>
 <prompt>%</prompt> <userinput>make</userinput>
 <prompt>%</prompt> <userinput>make install</userinput>
</screen>
</para>

There are some options for <userinput>configure</userinput> you might be interested in:

<variablelist>
 <varlistentry>
   <term>--enable-unicode</term>
   <listitem>By default &mockpp; uses standard 8bit wide strings (<token>std::string</token> 
   and <token>const char*</token> to be more precise). If you need basic support for
   <ulink url="http://www.unicode.org">Unicode</ulink> and it's 16bit wide characters
   you must add this parameter when invoking <userinput>configure</userinput>. 
   </listitem>
 </varlistentry>
         
 <varlistentry>
   <term>--enable-qtrunner</term>
   <listitem>If you have <productname>Qt</productname> installed you might add
   this parameter to compile a qui application called <application>mock_test_qt</application>
   to run the unit tests instead of the simple console application.
   </listitem>
 </varlistentry>
</variablelist>
         
         
<para>Since mockpp uses autoconf and automake you should have not trouble compiling it.
Should you run into problems please report them to the 
<ulink url="http://sourceforge.net/bugs/?group_id=69135">Bug Tracker</ulink>.</para>

<para>Once you have compiled the sources you should run the built in checks
to verify the correct behaviour on your platform:

<screen width="40">
 <prompt>%</prompt> <userinput>make check</userinput>
 <prompt>%</prompt> <userinput>make run-check</userinput>
</screen>

</para>

</sect2>

<sect2>
<title>Installing on other systems</title>

<para>
If you are using a compiler on a platform not directly supported you must setup you
own project files for your compiler. All adjustments are done in 
<filename class='headerfile'>mockpp.h</filename>. To benefit from updates it is of
course better to move your own settings to a configuration file and include it. 
<para>

</para>
See <filename class='headerfile'>config-bcb5.h</filename> as an example for Borland's
CBuilder.
</para>

<note>
 <title>Once you have ported &mockpp; to a new platform:</title>
 <para>Please send me your files for inclusion in the next distribution.
 You will certain make some people happy with this.</para>
</note>

</sect2>

</sect1>

</appendix>

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/bookinfo.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/bookinfo.docbook
<bookinfo>
 <title>The Mockpp Handbook</title>

<authorgroup>
 <author>
  <firstname>Ewald</firstname>
  <surname>Arnold</surname>
  <affiliation>
    <address><email>&mockpp_email;</email></address>
  </affiliation>
 </author>
</authorgroup>

<copyright>
 <year>2002</year>
 <year>2003</year>
 <holder>Ewald Arnold</holder>
</copyright>

<legalnotice>
<para>This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.</para>

<para>This library 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
Lesser General Public License for more details.</para>

<para>You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA</para>
</legalnotice>

&release_date;
&release_info;

<abstract>
<para> 
&mockpp; is a platform independent generic unit testing framework for C++. It's goal 
is to facilitate developing unit tests in the spirit of 
<ulink url="http://www.mockobjects.com/">Mock Objects for Java</ulink>
and <ulink url="http://www.easymock.org/">EasyMock</ulink>.
</para>

<para>Mock objects allow you to set up exactly predictible
behaviour to help you test your production code by emulating some functionalitiy your code depends on.
This might for example be a huge database which is too difficult and time consuming to maintain just for 
testing purposes.</para>

</abstract>

<keywordset>
 <keyword>mock object</keyword>
 <keyword>mockpp</keyword>
 <keyword>unittest</keyword>
 <keyword>object</keyword>
 <keyword>test</keyword>
 <keyword>mock</keyword>
 <keyword>C++</keyword>
 <keyword>framework</keyword>
</keywordset>

</bookinfo>

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/credits.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/credits.docbook
<chapter id="credits">

<title>Credits and License</title>

<para>
&mockpp;
</para>
<para>
Program copyright &copyyears; Ewald Arnold <email>&mockpp_email;</email>
</para>

<para>
Documentation copyright &copyyears; Ewald Arnold<email>&mockpp_email;</email>
</para>

<para>This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.</para>

<para>This library 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
Lesser General Public License for more details.</para>

<para>You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA</para>

</chapter>

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/customize.xsl
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/customize.xsl
<?xml version='1.0'?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="1.0"> 

<xsl:import href="/usr/share/sgml/docbook/docbook-xsl-stylesheets/html/chunk.xsl"/> 

<!--
<xsl:template name="user.footer.content">
  <HR/><center><P class="copyright">&#x00A9; 2002  Megacorp, Inc.</P>
  <br />
  </center>
</xsl:template>

user.header.navigation  Called before standard navigational header.

header.navigation   The standard navigational header.

user.header.content  Called after standard navigational header but before any other content.

user.footer.content  Called after the chunk content but before the standard navigational footer.

footer.navigation  The standard navigational footer.

user.footer.navigation  Called after the standard navigational footer
-->

<xsl:param name="html.stylesheet"                        select="'common/mockpp.css'"/> 
<xsl:param name="use.extensions"                         select="1"/>
<xsl:param name="admon.graphics"                         select="1"/>
<xsl:param name="linenumbering.extension"                select="1"/>
<xsl:param name="chapter.autolabel"                      select="1"/>
<xsl:param name="appendix.autolabel"                     select="1"/>
<xsl:param name="section.autolabel"                      select="1"/>
<xsl:param name="section.label.includes.component.label" select="1"/>

</xsl:stylesheet>  


Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_advanced.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_advanced.docbook
<sect1 id="advanced-expectations" name="advanced">
<title>Advanced Expectations</title>

<!-- ############################################################### -->

<sect2 id="mock-object">
<title>Mock Object</title>

<para>To emulate the behaviour of an object in your production code
you need more than just single values that meet your expectations. Usually 
you need a collection of the different expectation types and some code
to generate a deterministic and predictible behaviour.</para>

<para>This approach requires a separation of the code under test and the
code using it. But most of the times you would split the two parts
anyway to increase maintainability.</para>

<programlisting>
  class MyInterface <co id="interface1-class-co"  linkends="interface1-class" />
  {
    public: 
      virtual void theMethod(unsigned param) = 0;
  };

  class MyProductionClass : public MyInterface <co  id="production-class-co"  linkends="production-class" />
  {
    public: 
      virtual void theMethod(unsigned param)
      {
        ...
      }
  };
    
  class MyMockObject : public MyInterface <co  id="mock-class-co"  linkends="mock-class" />
  {
      mockpp::ExpectationList&lt;unsigned> methParams; 
    public: 
      MyMockObject(mockpp::String name, Verifiable *v)
        : MockObject(name, v),
          methParams("method parameters", this)
      {
        methParams.addExpected(1);
        methParams.addExpected(2);
      }
        
      virtual void theMethod(unsigned param) 
      {
        ...
      }
  };
  
  
  MyMockObject mo (MOCKPP_PCHAR("mockObject"), 0);
  myMethodUnderTest(&amp;mo); <co id="mock-pass-co"  linkends="mock-pass" />
  mo.verify();

  
  MyProductionClass pro;
  myMethodUnderTest(&amp;pro); <co id="prod-pass-co"  linkends="prod-pass" />
  
</programlisting>

<calloutlist>
  
  <callout arearefs="interface1-class-co"  id="interface1-class" >
    <para>Define an interface class which contains all the methods that must 
    simulate some real world behaviour. This interface class is also used
    to implement the real world class.</para>
    <para> The intention is to pass a real world
    object in the running application or a mock object while executing tests.</para>
  </callout>

  <callout arearefs="production-class-co"  id="production-class" >
    <para>Derive your real world production code from the abstract base class
    to implement our interface as you need it.</para>
  </callout>

  <callout arearefs="mock-class-co"  id="mock-class" >
    <para>Derive the mock object and implement it with a minimum of the functionality
    required in an absolutely deterministic way. In the example we set up a list
    of expected parameters to the method and have it verified by the
    mock object automatically.</para>
  </callout>

  <callout arearefs="mock-pass-co"  id="mock-pass" >
    <para>Instantiate the mock object and pass it to the method you want to test
    while you are in the test routines. After completing the test code call 
    <methodname>verify()</methodname> to check all pending expectations.</para>
  </callout>

  <callout arearefs="prod-pass-co"  id="prod-pass" >
    <para>To run the production code instantiate the real object and pass it to 
    the method.</para>
  </callout>

</calloutlist>
  
</sect2>

<!-- ############################################################### -->

<sect2 id="visitable-mock-object">
<title>Visitable Mock Object</title>

<para>
Since most of tasks concerning mock objects occur frequently and in a similar
manner there is the class <classname>VisitableMockObject</classname> that can
easily be extended with a set of macros that set up methods along with their
return values and parameters. All you have to do is to add a macro for each 
method and another to implement the internal member variables.</para>

<para>
<warning>
 <title>But let me warn you:</title>
 <para>
   If you take the wrong macro or maybe just have a typo you will get loads
   of error messages all on the same line. You will have no idea where to start 
   and search the problem. I strongly recommend to take little steps when setting
   up such objects: add one single method and compile. 
   Continue only if it compiled flawlessly.
   </para>
   
   <para>If you don't take care you will quickly find out why 
   <ulink url="http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-38.4">macros 
   are evil</ulink> 
   and should be avoided where ever possible (unfortunately they are needed 
   here).</para>
   
   <para>It took me around 40 hours only to get the macro stuff working so please 
   believe me.</para>
   
   <para>If you want to have an overview what is created, look at 
   <filename>doc-template.h</filename> which is a class with two example methods. 
   One is a <token>void</token> method and one returns a value. They are preprocessed,
   automatically indented and quite readable.</para>
   
</warning>

</para>

<para>
To get such a mock object you must:
<itemizedlist>
 <listitem>Derive and define your object with the methods you need</listitem>
 <listitem>Create a controller for each method and set up the behaviour</listitem>
 <listitem>Activate and use the object</listitem>
</itemizedlist>
</para>

<para>
The following listing contains a short example and explains some of the features.

<programlisting>

  class MyInterfaceClass <co  id="interface2-class-co"  linkends="interface2-class" />  
  {
    public: 
     virtual int access(unsigned index) = 0;
  }

  class MyVisitableMockObject : public VisitableMockObject,  <co  id="visitable-class-co"  linkends="visitable-class" />
                                public MyInterfaceClass
  {
    public: 
      MyVisitableMockObject(const String &amp;name)
      : VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD1(access) <co  id="visitable-ctor-co"  linkends="visitable-ctor" />
      {}  
      
      MOCKPP_VISITABLE1(MyVisitableMockObject, int, access, unsigned); <co id="mock-method-co"  linkends="mock-method" />
  };
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, access) access_ctr (&amp;mvo); <co  id="mock-controller-co"  linkends="mock-controller" />

  access_ctr.addThrowable(std::string("throw"), 2); <co id="mock-feed1-co"  linkends="mock-feed1" /> 
  access_ctr.addResponseValue(1, 13); <co id="mock-feed2-co"  linkends="mock-feed2" />  
  access_ctr.addResponseValue(2, 37); 
  
  mvo.access(1); <co id="mock-feed3-co"  linkends="mock-feed3" />  
  mvo.access(13);
  
  mvo.activate(); <co id="mock-activate-co"  linkends="mock-activate" />  
  
  // use the object
  
  mvo.verify(); <co id="mock-verify-co"  linkends="mock-verify" /> 
  
</programlisting>

<calloutlist>
  
  <callout arearefs="visitable-class-co"  id="visitable-class" >
    <para>Derive your mock object class from <classname>VisitableMockObject</classname>
    and the interface class.</para>
  </callout>
  
  <callout arearefs="visitable-ctor-co"  id="visitable-ctor" >
    <para>According to the type of method and the number of parameters it takes
    add a macro that does the construction part for all the necessary internal 
    helper variables for that method.</para>
  </callout>

  <callout arearefs="mock-method-co"  id="mock-method" >
    <para>Similarly add another macro that implements the internal variables
    and helper methods.</para>
  </callout>

  <callout arearefs="mock-controller-co"  id="mock-controller" >
    <para>Create a  controller object for the method to set up it's 
    behaviour.</para>
  </callout>

  <callout arearefs="mock-feed1-co"  id="mock-feed1" >
    <para>Add some behaviour: tell the object to throw an exception when called 
    the first and second time.</para>
  </callout>

  <callout arearefs="mock-feed2-co"  id="mock-feed2" >
    <para>More specific behaviour: depending on the parameters passed it shall respond
    with certain return values.</para>
  </callout>

  <callout arearefs="mock-feed3-co"  id="mock-feed3" >
    <para>Describe the expected execution path and the expected parameters 
    for the method how it shall happen in your test later. This is simply 
    done by calling the methods.</para>
  </callout>

  <callout arearefs="mock-activate-co"  id="mock-activate" >
    <para>Activate the object and use it in the tests.</para>
  </callout>

  <callout arearefs="mock-verify-co"  id="mock-verify" >
    <para>After the tests are exected verify all conditions that are still pending, for 
    example unused return values or exceptions.</para>
  </callout>

</calloutlist>

</para>

<para>For a deeper documentation of the methods involed with a controller see
the api documentation of <classname>VisitableMockObject::Controller</classname>.</para>

<para>There are macros for methods with up to five parameters. I assume you will not want
to have code with more than 5 parameters. But if you really think you need more, take
the macros with 5 parameters and try to extend it. It is really straightforward and please
don't forget to extend the test files. You may of course send
<ulink url="mailto::mockpp at ewald-arnold dot de">me</ulink> 
the result for inclusion and further maintainance.</para>

<para> The expectations are evaluated in the following order which of course also depends on the
method definition itself. Parameters to the method can only be evaluated if they exist 
and void methods obviously can't return any objects.
   
<orderedlist>
    <listitem>verify that the expected method is called</listitem>
    <listitem>find and throw an exception based on the parameters passed</listitem>
    <listitem>throw the next exception from the list if available</listitem>
    <listitem>throw the default exception if defined</listitem>
    <listitem>verify the values of the parameters passed</listitem>
    <listitem>find and return an object based on the parameters passed</listitem>
    <listitem>return the next object from the list if available</listitem>
    <listitem>return the default object</listitem>
</orderedlist>

</para>

<para>If the available methods don't give you fine enough control over your mock object there is
only one soultion: code and implement the desired behaviour manually. But I assume this should 
not happen too often because mock objects should only cover a very limited aspect, only what is
currently really needed for a special test scope.</para>
 
</sect2>

</sect1>

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_basic.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_basic.docbook
<sect1 id="basic-expectations">
<title>Basic Expectations</title>

<para>
All of the expectation objects share a similar approach: setting up
a set of expectations at the beginning of a test and compare with 
actual values while the test is running.</para>

<para>For that reason each of the different expectation classes
has at least
<itemizedlist>
  <listitem>a method named similar to <methodname>setExpected()</methodname> to set
  up the expected value.</listitem>
  <listitem>and a method named <methodname>setActual()</methodname> for setting
  the actual value.</listitem>
</itemizedlist>
  
Additionally there are some methods to influence the verification 
process under certain circumstaces:

<variablelist>
  
  <varlistentry>
    <term><methodname>setFailOnVerify()</methodname></term>
    <listitem>Usually the actual value is immediately compared
    when set. Sometimes you want to defer this until all the work is done.
    After invoking this method you must call <methodname>verify()</methodname>
    manually at the end to verify all pending expectations.</listitem>
  </varlistentry>
    
  <varlistentry>
    <term><methodname>setExpectNothing()</methodname></term>
    <listitem>If you want to prevent the occurance of any actual values
    you should invoke this method at the beginning. 
    
    <note><title>Attention</title>
    <para>
    Please understand that
    this is different from not setting any expectations! Not setting an expectation
    yields in no error at all for any setting of an actual value since there is no value
    to compare with.
    </para>
    </note>
    </listitem>
  </varlistentry>
    
</variablelist>
    
</para>

<sect2 id="expectation-value">
<title>Expectation Value</title>

<para>

The most common application is the use of <classname>ExpectationValue</classname>
which does an exact comparision. Your own data types should implement a meaningful
<methodname>operator==()</methodname> to be usable with &mockpp;.
The following example creates an expectation value for <token>int</token> values.

<programlisting>

  ExpectationValue &lt;int> ev (MOCKPP_PCHAR("verifyValue"), 0);

  ev.setExpected(1234); 
  ev.setActual(4321);

</programlisting>

</para>

</sect2>

<!-- ############################################################### -->

<sect2 id="expectation-list">
<title>Expectation List</title>

<para>
Sometimes you have not only a single value but a series of values. For this
purpose you set up a list of expectations of the same type. The next example creates 
an expectation list for <token>int</token> values. The list members are compared with the
actaul values one after the other in exactly the same order they were inserted.

<programlisting>

  ExpectationList &lt;int> el (MOCKPP_PCHAR("verifyValue"), 0);

  el.addExpected(1); 
  el.addExpected(2); 
  el.addExpected(3); 
  
  el.addActual(1); 
  el.addActual(2); 
  el.addActual(3); 

</programlisting>

</para>

</sect2>

<!-- ############################################################### -->

<para>
as asdfasdf
</para>

<sect2 id="expectation-set">
<title>Expectation Set</title>

<para>
There are also cases where you have a number of values which must all occur but the
order is not relevant at all. t even does not matter if an actual value is added
more than once. For that purpose &mockpp; provides a set oriented data type.
See the next example:

<programlisting>

  ExpectationSet &lt;int> es (MOCKPP_PCHAR("verifyValue"), 0);
  es.addExpected(1); 
  es.addExpected(2); 
  es.addExpected(3); 
  
  es.addActual(3); 
  es.addActual(2); 
  es.addActual(1); 
  es.addActual(3); <co  id="expset-co"  linkends="expset" />
  es.addActual(2); 
  es.addActual(1); 

</programlisting>

<calloutlist>
  
  <callout arearefs="expset-co"  id="expset" >
    <para>Adding the same actual value more than once is ok for the set.</para>
  </callout>
  
</calloutlist>

</para>

</sect2>

<!-- ############################################################### -->

<sect2 id="expectation-map">
<title>Expectation Map</title>

<para>
In addition to <classname>ExpectationSet</classname> there is a <literal>map</literal> 
oriented class which uses key/value pairs. The comparison is done only with the key, the
value itself is ignored.

<programlisting>

  ExpectationMap &lt;int, std::string> em (MOCKPP_PCHAR("verifyMap"), 0);
  
  em.addExpected(1, "one"); 
  em.addExpected(2, "two"); 
  em.addExpected(3, "three"); 
  
  em.addActual(3); 
  em.addActual(2); 
  em.addActual(1); 

</programlisting>

</para>

</sect2>

<!-- ############################################################### -->

<sect2 id="expectation-boundary">
<title>Expectation Boundary</title>

<para>
When you need not check for an exact match but want to allow a range of values
you may use <classname>ExpectationBoundary</classname> which tests against a lower
and an upper boundary value. Since the comparison is done with
<methodname>operator&lt;()</methodname> your own data types should implement it 
meaningfully.

<programlisting>

  ExpectationBoundary &lt;int> eb (MOCKPP_PCHAR("verifyBoundary"), 0);

  eb.setExpected(111, 333); 
  eb.setActual(222);

</programlisting>

</para>

</sect2>

<!-- ############################################################### -->

<sect2 id="expectation-counter">
<title>ExpectationCounter</title>

<para>
Another task is counting events. For that reason &mockpp; provides a counter-like
class.

<programlisting>

  ExpectationCounter &lt;int> ec (MOCKPP_PCHAR("verifyCounter"), 0);

  ec.setExpected(5); 
  ec.inc();

</programlisting>

</para>

</sect2>


<!-- ############################################################### -->

<sect2 id="expectation-segment">
<title>ExpectationSegment</title>

<para>
Checking the occurence of a substring within a target string is also needed
frequently:

<programlisting>

  ExpectationSegment &lt;std::string> es (MOCKPP_PCHAR("verifySegment"), 0);

  es.setExpected("substr"); 
  es.setActual("ubs")

</programlisting>

</para>

</sect2>


<!-- ############################################################### -->

<sect2 id="return-object-list">
<title>Return Object List</title>

<para>
If you set up your own mock objects you will need to provide a list
of predefined return objects from your mock implementations. All of the objects
must be consumed.

<programlisting>

  ReturnObjectList &lt;std::string> ro (MOCKPP_PCHAR("objectList"), 0);

  ro.addObjectToReturn("str-1"); 
  ro.addObjectToReturn("str-2"); 

  std::string s = ro.nextReturnObject();

</programlisting>

</para>

</sect2>

</sect1>


Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_helper.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_helper.docbook
<sect1 id="devel-helper">
<title>Helpers</title>

<para>Some of the classes and functions from the &mockpp; library might be of general
use so they are listed in a chapter of their own.
</para>

<!-- ############################################################### -->

<sect2 id="asserter">
<title>Asserter</title>

<para>
A testing framework frequently uses assertions to check conditions of a running
application. To be able to express the intention there is a bunch of functions that do 
special assertions. 
</para>

<para>
Often you also want to provide the current filename and the source line to show the
location in some kind of output. To avoid having to add this
manually there are <token>#define</token>'s under a similar name that 
do this automatically.
</para>

<para>
Some of the macros are self explanatory but some need a closer look. Here is a list
of the most important ones:

<programlisting>
   
   MOCKPP_ASSERT_TRUE(condition);
   MOCKPP_ASSERT_FALSE(condition); 
   MOCKPP_ASSERT_EQUALS(a, b); 
   MOCKPP_ASSERT_DELTA(a, b, delta); <co  id="delta-co"  linkends="assert-delta" />
   MOCKPP_ASSERT_BOUNDARY(lo, up, a); <co  id="boundary-co"  linkends="assert-boudary" />
   MOCKPP_ASSERT_INCLUDES(substr, target); <co  id="includes-co"  linkends="assert-includes" />
   MOCKPP_ASSERT_EXCLUDES(substr, target); 
   MOCKPP_ASSERT_STARTSWITH(substr, target);
   MOCKPP_ASSERT_THROWING(action, action_descr, exception, exception_data);  <co  id="throwing-co"  linkends="assert-throwing" />

</programlisting>

<calloutlist>
  
  <callout arearefs="delta-co"  id="assert-delta" >
    <para>Sometimes you need to add some kind of tolerance to your comparison which
    is usually needed to compare two floating point numbers. 
    The following formula verifies the equality of the two values:
    <literal role="equation">abs(actual - expected) &lt; abs(delta)</literal>.</para>
  </callout>
  
  <callout arearefs="boundary-co"  id="assert-boundary" >
    <para>This one is for cases when you want to make sure that a value lies
    between a lower and an upper boundary. If you have a special data type
    you should implement a meaningful <methodname>operator&lt;()</methodname>
    for comparision.</para>
  </callout>

  <callout arearefs="includes-co"  id="assert-includes" >
    <para>If you want to know if a substring is contained in another
    string you take this one. The following line contains it's counterpart
    which asserts the non-existence of a string. And finally the line after 
    it checks if a string starts with the designated substring.</para>
  </callout>

  <callout arearefs="throwing-co"  id="assert-throwing" >
    <para>Another frequent task is to test the correct throwing of
    exceptions. This is easily done with the according macro.</para>
  </callout>

</calloutlist>

There are some more asserters which are of limited interest, see the api 
documentation for 
<filename class='headerfile'>Assert.h</filename> and
<filename class='headerfile'>AssertMo.h</filename>
for a complete list. There you find also a detailed description of
the above macros and the functions behind them.

</para>

</sect2>

<!-- ############################################################### -->

<sect2 id="formatter">
<title>Formatter</title>

<para>
Another frequent programming task is generating information for the user. 
Often you have to assemble a string from several parts. Most of the time there
is some sort of format string to determine the basic information with some 
placeholders at the desired position which are substituted with actual values.</para>

<para>A lot of people are using the <methodname>printf()</methodname> family for
outputting. Unfortunately these are not typesafe. And nor are they appropriate for 
translations when the positions of the substituted parameters are swaped for
grammatical reasons.</para>

<para>So I decided to implement a typesafe approach which also takes into account
the position of the substituted values: each inserted value is converted into
its string representation and substitutes the placeholder
with the lowest number. Since there a placeholder consists of a percent sign and
a single digit there are up to ten substitutions possible.</para>

<para>The built-in methods handle the common data types like <token>int</token>, 
<token>float</token> or <token>std::string</token>.
But it is also easily possible to extend the ouput capabilities for your own data types.
No changes inside the &mockpp; framework are needed, it needn't even be in the 
&mockpp; namespace</para>

<para>This collection of functions is inspired by the <classname>QString</classname> class 
which is part of the <productname>Qt</productname> framework by 
<ulink url="http://www.troll.no">Trolltech</ulink>.</para>


<programlisting> 

  struct Person <co  id="struct-co"  linkends="user-struct" />
  {
    friend String &amp; operator &lt;&lt; (String &amp;formatter, const Person &amp;pers);

    std::string  name;
    unsigned     age;     
  };
    
  String &amp; operator&lt;&lt; (String &amp;formatter, const Person &amp;pers)
  {
     formatter &lt;&lt; pers.name &lt;&lt; "(" &lt;&lt; pers.age &lt;&lt; ")"; <co  id="shift-op-co"  linkends="shift-op" />
     return formatter;
  }

  Person pers;
  pers.name = "Bob";
  pers.age = 6;  
  String  format = "%4 says: %3 plus %2 gives %1";
  format &lt;&lt; "three" &lt;&lt; "two" &lt;&lt; "one" &lt;&lt; pers;
  std::cout &lt;&lt; format &lt;&lt; std::endl;
  
</programlisting>

<calloutlist>
  
  <callout arearefs="struct-co"  id="user-struct" >
    <para>Create a user defined data type with some internal representation. Make 
    the output function a friend to grant access to the needed elements.</para>
  </callout>
  
  <callout arearefs="shift-op-co"  id="shift-op" >
    <para>Output the content of your data type with the help of the existing functions.</para>
    <para>The resulting output:
    <computeroutput>Bob(6) says: one plus two gives three</computeroutput></para>
  </callout>
  
</calloutlist>

</sect2>

<!-- ############################################################### -->

<sect2 id="throwables">
<title>Throwables</title>

<para>
Throwing arbitrary exceptions is a bit of a problem since the type of the exception
is determined at compile time. So if you want to store an exception and throw it
some time later at a maybe unknown position in your code you must must wrap it in an 
envelope and delegate the process of throwing to this wrapper.</para>

<para>Similar to the according Java classes they are called 
<classname>Throwables</classname>.
&mockpp; provides several classes and functions to deal with single or lists of throwables
as well as creating them from ordinary values.</para>

<programlisting>

  ThrowableItem it (make_throwable(float(1.234))); <co  id="throwitem1-co"  linkends="throwitem1" />
  it.get()->throw_me(); <co  id="throwitem2-co"  linkends="throwitem2" />
  
  ThrowableList lit; <co  id="throwlist1-co"  linkends="throwlist1" />
  lit.push_back(make_throwable(std::string("data"))); <co  id="throwlist2-co"  linkends="throwlist2" />
  lit.push_back(make_throwable(unsigned(123)));
  lit.nextThrowableObject()->throw_me(); <co  id="throwlist3-co"  linkends="throwlist3" />

</programlisting>

<calloutlist>
  <callout arearefs="throwitem1-co"  id="throwitem1" >
    <para>Create a throwable object with a float value as payload.</para>
  </callout>
  
  <callout arearefs="throwitem2-co"  id="throwitem2" >
    <para>Throw it.</para>
  </callout>
  
  <callout arearefs="throwlist1-co"  id="throwlist1" >
    <para>Create a list of throwable objects.</para>
  </callout>
  
  <callout arearefs="throwlist2-co"  id="throwlist2" >
    <para>Add some objects to our list. Note that the objects have
    completely different types.</para>
  </callout>
  
  <callout arearefs="throwlist3-co"  id="throwlist3" >
    <para>Get the first available object from the list and throw it.</para>
  </callout>
</calloutlist>

</sect2>

<!-- ###############################################################

<sect2 id="mutex">
<title>Mutex</title>

<para>
In a multithreaded environment it is important to protect the various
threads against each other so they don't modify shared resources in the
wrong moment. &mockpp; provides a platform independent approach which even
works by pure presence and without additional code. You simply create a
<classname>Mutex</classname>
and request a <classname>Locker</classname> on it which is automatically
destroyed when you leave the current code block.

<programlisting>

  Mutex global_resource_mutex;

  void modifyResource()
  {
    Mutex::Locker lock(global_resource_mutex); <co  id="mutex-ctor-co"  linkends="mutex-ctor" />

    // actually modify your resource
  } <co  id="mutex-dtor-co"  linkends="mutex-dtor" />

</programlisting>

<calloutlist>
  <callout arearefs="mutex-ctor-co"  id="mutex-ctor" >
    <para>At the beginning of its lifetime the <classname>Locker</classname>
    requests the mutex.</para>
  </callout>
  <callout arearefs="mutex-dtor-co"  id="mutex-dtor" >
    <para>When the lifetime of the <classname>Locker</classname> ends the
    mutex is automatically released.</para>
  </callout>
</calloutlist>

</para>

</sect2>
 -->
 
</sect1>

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_intro.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/dev_intro.docbook
<sect1 id="devel-intro">
<title>Introduction</title>

<para>The following developer's guide is to get you started and to 
give you a quick overview over the features of &mockpp;. For a complete
list of all functions please refer to the api documentation.</para>

<para>There are a few things that are not obvious but might become interesting:

<itemizedlist>
  <listitem><para>&mockpp; uses a data type <token>String</token> which is no data type of it's own
    but is a typdef to std::string or std::wstring depending on your choice. 
    It also provides a minumum functionality for unicode if you compile it for
    unicode environment. See
    <xref linkend="compilation" /> how to do that.</para>
  
    <para>Since &mockpp; provides both environments with the same sources it uses some 
    macros to convert string literals to the intended environment. You can check for 
    the actual setting by adding a conditional <literal>#ifdef MOCKPP_UNICODE</literal> to
    your sources.</para>
  
    <itemizedlist>
      <listitem><literal>MOCKPP_PCHAR</literal> transforms a literal string either to a
      <token>char*</token> or to a <token>wchar_t *</token> by prepending an <token>L</token>
      for unicode.
      </listitem>
    
      <listitem>In the same manner <literal>MOCKPP_STRING</literal> yields either a
      <token>std::string</token> or a <token>std::wstring</token>.
      </listitem>
    </itemizedlist>
  
  </listitem>
  
  <listitem>&mockpp; has no testing framework of it's own so it is recommended
     to use <ulink url="http://cppunit.sf.net">CppUnit</ulink> for that purpose.
     See the test and example files how to do it.
  </listitem>
  
</itemizedlist>

</para>

</sect1>

Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/faq.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/faq.docbook
<chapter id="faq">
<title>Questions and Answers</title>

<qandaset id="faqlist">
 
 <qandaentry>
  <question>
   <para>Where can I ask a question regarding &mockpp;?</para>
  </question>
  
  <answer>
   <para>Send a mail to the according  
   <ulink url="http://sourceforge.net/mail/?group_id=69135">mailing list</ulink>
   or point your browser to the 
   <ulink url="http://sourceforge.net/forum/?group_id=69135">forum</ulink>.</para>
  </answer>
 
 </qandaentry>

</qandaset>

</chapter>


Index: avida/current/source/third-party/trio-1.9/mockpp/docs/en/index.docbook
+++ avida/current/source/third-party/trio-1.9/mockpp/docs/en/index.docbook
<!DOCTYPE book PUBLIC "-//OASIS//DTD Docbook XML V4.1.2//EN"
               "/usr/share/sgml/db42xml/docbookx.dtd" [
  
  <!ENTITY mockpp       '<application>mockpp</application>'  >
  <!ENTITY copyyears    '2002,2003'                          >
  <!ENTITY mockpp_email 'mockpp at ewald-arnold dot de'   >
  <!ENTITY release_date '<date>2003-04-23</date>'            >
  <!ENTITY release_info '<releaseinfo>1.01.10</releaseinfo>' >
  
  <!ENTITY chap_bookinfo     SYSTEM 'bookinfo.docbook'     >
  <!ENTITY chap_intro        SYSTEM 'intro.docbook'        >
  <!ENTITY chap_dev_guide    SYSTEM 'dev_guide.docbook'    >
  <!ENTITY sect_dev_intro    SYSTEM 'dev_intro.docbook'    >
  <!ENTITY sect_dev_basic    SYSTEM 'dev_basic.docbook'    >
  <!ENTITY sect_dev_advanced SYSTEM 'dev_advanced.docbook' >
  <!ENTITY sect_dev_helper   SYSTEM 'dev_helper.docbook'   >
  <!ENTITY chap_faq          SYSTEM 'faq.docbook'          >
  <!ENTITY chap_credits      SYSTEM 'credits.docbook'      >
  <!ENTITY chap_appendix     SYSTEM 'appendix.docbook'     >
]>

<book lang="en">

 &chap_bookinfo;

<chapter id="dev-guide">
 <title>Developer's Guide</title>

 &sect_dev_intro;

 &sect_dev_basic;

 &sect_dev_advanced;

 &sect_dev_helper;

</chapter>
 
 
 &chap_faq;

 &chap_credits;

 &chap_appendix;

</book>









Index: avida/current/source/third-party/trio-1.9/mockpp/examples/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/examples/Makefile.am
INCLUDES      = -I$(srcdir)/../..

LDADD         = ../compat/libcompat.a ../util/libutil.a ../libmockpp.a $(LIBCPPUNIT)
AM_LDFLAGS    = $(all_libraries)

bin_PROGRAMS  = mock_greeter

all: $(bin_PROGRAMS)

mock_greeter_SOURCES    = mock_greeter.cpp

compile-test:
	g++ $(srcdir)/mock_greeter.cpp -o /tmp/mock_greeter -lmockpp -lcppunit  $(EA_EXTRA_LIB)  $(EA_EXTRA_INC)

Index: avida/current/source/third-party/trio-1.9/mockpp/examples/mock_greeter.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/examples/mock_greeter.cpp
/***************************************************************************
          mock_greeter.cpp  -  mock greeting into a stream

        heavily inspired by an example from the Ruby/Mock package
        
                             -------------------
    begin                : Wed Jan 1 2003
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: mock_greeter.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.9  2003/04/25 12:42:30  ewald-arnold
    prevent compiler warning

    Revision 1.8  2003/02/18 19:51:12  ewald-arnold
    updated copyright date

    Revision 1.7  2003/02/16 18:03:57  ewald-arnold
    update

    Revision 1.6  2003/02/08 09:21:16  ewald-arnold
    update

    Revision 1.5  2003/01/16 18:20:18  ewald-arnold
    BCB5 fix

    Revision 1.4  2003/01/16 17:36:30  ewald-arnold
    changed email adr

    Revision 1.3  2003/01/06 13:31:12  ewald-arnold
    completed example

    Revision 1.2  2003/01/04 09:48:49  ewald-arnold
    first example started

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#include <iostream>

#ifndef HAVE_CPPUNIT
# pragma warning CppUnit not available at compile time
#else
# include <cppunit/extensions/HelperMacros.h>
# include <cppunit/extensions/TestFactoryRegistry.h>
# include <cppunit/ui/text/TestRunner.h>
# include <cppunit/extensions/HelperMacros.h>
#endif

#include <mockpp/MockObject.h>
#include <mockpp/ExpectationValue.h>
#include <mockpp/ExpectationCounter.h>
#include <mockpp/ReturnObjectList.h>


class StorageInterface
{
  public:
    virtual void open() = 0;
    virtual void write(const mockpp::String &msg) = 0;
    virtual mockpp::String read() = 0;
    virtual void close() = 0;
};

// The class under test.  It writes a greeting into persistent storage.
// To test it, we will need to mock the storage object.
//
// For simplicity the code contains some conditionals to simulate common bugs.
//
class HelloWriter
{
  public:
    enum BugType 
    {
       BugNone,
       BugMissingOpen,
       BugMissingCloseOnError,
       BugMissingCloseOnEnd
    };

    
    HelloWriter(BugType bt, const mockpp::String who = ("world") )
    {
      bugType = bt;
      who_is = who;
    }


    void do_hello(StorageInterface &storage)
    {
      if (bugType != BugMissingOpen)
        storage.open();
      try
      {
        mockpp::String greet = ("hello, %1");
        greet << who_is;
        storage.write( greet );
      }
      catch(...)
      {
        if (bugType != BugMissingCloseOnError)
          storage.close();
        throw;
      }
      if (bugType != BugMissingCloseOnEnd)
        storage.close();
    }

    
    void do_listen(StorageInterface &storage)
    {
      if (bugType != BugMissingOpen)
        storage.open();
      try
      {
        mockpp::String s;
        s = storage.read();
      }
      catch(...)
      {
        if (bugType != BugMissingCloseOnError)
          storage.close();
        throw;
      }
      if (bugType != BugMissingCloseOnEnd)
        storage.close();
    }

    
  private:
    mockpp::String  who_is;
    BugType         bugType;
};


class StorageMockWriter : public mockpp::MockObject,
                          public StorageInterface
{
  public:
  
    StorageMockWriter()
      : mockpp::MockObject(("mockWriter")),
        open_cnt (("storage open() counter"), this),
        write_cnt(("storage write() counter"), this),
        close_cnt(("storage close() counter"), this),
        greet_str(("input value for write()"), this),
        o_state  (("state indicating stream-open"), this)
    {
      // expect: open, write, [write (fails)], close
      open_cnt.setExpected(1);
      write_cnt.setExpected(1, 2);
      close_cnt.setExpected(1);

      o_state.setExpected(false);
      o_state.setFailOnVerify();
      o_state.setActual(false);

      greet_str.setExpected(("hello, world"));  // expect correct greeting
    }

    
    void open()
    {
      o_state.setActual(true);
      open_cnt.inc();
    }

    
    mockpp::String read()
    {
      MOCKPP_NOT_IMPLEMENTED((MOCKPP_FUNC_MACRO));
      return ("");
    }
    

    void write(const mockpp::String &s)
    {
      write_cnt.inc();
      greet_str.setActual(s);
    }

    
    void close()
    {
      close_cnt.inc();
      o_state.setActual(false);
    }

    
  private:
  
    mockpp::ExpectationValue<bool>            o_state;
    mockpp::ExpectationValue<mockpp::String>  greet_str;

    mockpp::ExpectationCounter       open_cnt;
    mockpp::ExpectationCounter       write_cnt;
    mockpp::ExpectationCounter       close_cnt;
};


class StorageMockReader : public mockpp::MockObject,
                          public StorageInterface
{
  public:

    StorageMockReader()
      : mockpp::MockObject(("mockReader")),
        open_cnt (("storage open() counter"), this),
        read_cnt (("storage read() counter"), this),
        close_cnt(("storage close() counter"), this),
        ret_vals (("return values for read()"), this),
        o_state  (("state indicating stream-open"), this)
    {
      // expect: open, read, [read (fails)], close
      open_cnt.setExpected(1);
      read_cnt.setExpected(1, 2);
      close_cnt.setExpected(1);

      o_state.setExpected(false);
      o_state.setFailOnVerify();

      ret_vals.addObjectToReturn(("good bye, mock turtle")); // provide one return val
    }

    
    void open()
    {
      o_state.setActual(true);
      open_cnt.inc();
    }

    
    void write(const mockpp::String &)
    {
      MOCKPP_NOT_IMPLEMENTED((MOCKPP_FUNC_MACRO));
    }

    
    mockpp::String read()
    {
      read_cnt.inc();
      return ret_vals.nextReturnObject();
    }

    
    void close()
    {
      close_cnt.inc();
      o_state.setActual(false);
    }

    
  private:

    mockpp::ExpectationValue<bool>            o_state;
    mockpp::ReturnObjectList<mockpp::String>  ret_vals;

    mockpp::ExpectationCounter       open_cnt;
    mockpp::ExpectationCounter       read_cnt;
    mockpp::ExpectationCounter       close_cnt;
};


#ifdef HAVE_CPPUNIT
class Streamer_test : public CppUnit::TestFixture
#else
class Streamer_test 
#endif // HAVE_CPPUNIT
{
 public:

#ifdef HAVE_CPPUNIT

CPPUNIT_TEST_SUITE( Streamer_test );

 CPPUNIT_TEST(test_write_ok);
 CPPUNIT_TEST(test_read_ok);

 CPPUNIT_TEST_EXCEPTION(fail_wrong_name, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_missing_open, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_missing_read, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_missing_close, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_missing_close_on_error, mockpp::AssertionFailedError);
 
CPPUNIT_TEST_SUITE_END();

#endif // HAVE_CPPUNIT

  public:
    void test_write_ok();
    void test_read_ok();
    
    void fail_wrong_name();
    void fail_missing_open();
    void fail_missing_read();
    void fail_missing_close();
    void fail_missing_close_on_error();
};


#ifdef HAVE_CPPUNIT
CPPUNIT_TEST_SUITE_REGISTRATION(Streamer_test);
#endif // HAVE_CPPUNIT


void Streamer_test::test_write_ok()
{
  HelloWriter hw(HelloWriter::BugNone, ("world"));
  StorageMockWriter sm;
  hw.do_hello(sm);
  sm.verify();
}


void Streamer_test::test_read_ok()
{
  HelloWriter hw(HelloWriter::BugNone, ("world"));
  StorageMockReader sm;
  hw.do_listen(sm);
  sm.verify();
}


void Streamer_test::fail_missing_read()
{
  HelloWriter hw(HelloWriter::BugNone, ("world"));
  StorageMockReader sm;
  // no read here
  sm.verify();
}


void Streamer_test::fail_wrong_name()
{
  HelloWriter hw(HelloWriter::BugNone, ("alice")); // wrong name
  StorageMockWriter sm;
  hw.do_hello(sm);
  sm.verify();
}


void Streamer_test::fail_missing_open()
{
  HelloWriter hw(HelloWriter::BugMissingOpen, ("world"));
  StorageMockWriter sm;
  hw.do_hello(sm);
  sm.verify();
}


void Streamer_test::fail_missing_close()
{
  HelloWriter hw(HelloWriter::BugMissingCloseOnEnd, ("world"));
  StorageMockWriter sm;
  hw.do_hello(sm);
  sm.verify();
}


void Streamer_test::fail_missing_close_on_error()
{
  HelloWriter hw(HelloWriter::BugMissingCloseOnError, ("world"));
  StorageMockReader sm;
  hw.do_listen(sm);
  hw.do_listen(sm);
  sm.verify();
}


int main(int /* argc */, char ** /* argv */)
{
  int ret = 1;
#ifdef HAVE_CPPUNIT
  std::cout << "Now running cppunit tests:\n\n";
  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactory &registry = CppUnit::TestFactoryRegistry::getRegistry();
  runner.addTest(registry.makeTest());
  ret = runner.run();
#else
  std::cout << "CppUnit was not available at compile time!\n";
  std::cout << "Will use mockpp features only.\n\n";
#endif

  try
  {
    std::cout << "Now running some tests with just mockpp features:\n\n";
    Streamer_test st;

    st.test_write_ok();
    st.test_read_ok();

    bool thrown = false;
    try
    {
      st.fail_missing_close();
    }
    catch (mockpp::AssertionFailedError & /*ae*/)
    {
      thrown = true;
    }
    MOCKPP_ASSERT_TRUE_MESSAGE(("Missing close() not detected."), thrown == true);

    thrown = false;
    try
    {
      st.fail_missing_close_on_error();
    }
    catch (mockpp::AssertionFailedError & /*ae*/)
    {
      thrown = true;
    }
    MOCKPP_ASSERT_TRUE_MESSAGE(("Missing close() after error not detected."), thrown == true);

    ret = 0;  
  }
  catch(mockpp::Exception &ex)
  {
    std::cout << "file: " << ex.getSrcFile() << std::endl
              << "line: " << ex.getSrcLine() << std::endl
              << "msg : " << ex.getMessage() << std::endl;
    ret = 1;
  }
  std::cout << "Finished.\n";
  return ret;
}


Index: avida/current/source/third-party/trio-1.9/mockpp/po/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/po/Makefile.am
EXTRA_DIST = $(PACKAGE).pot $(POTEMPLATES) $(GMOFILES)

GMOFILES      = de.gmo
POTEMPLATES   = $(GMOFILES:.gmo=.po)

CLEANFILES = *.~* *.~~* *~

merge:
	@catalogs='$(POTEMPLATES)'; \
	for cat in $$catalogs; do \
	name=$(PACKAGE).pot ; \
	echo $(srcdir)/$$cat $(srcdir)/$$name; \
	msgmerge $(srcdir)/$$cat $(srcdir)/$$name > $(srcdir)/$$cat.new ; \
	if diff $(srcdir)/$$cat $(srcdir)/$$cat.new; then \
		rm $(srcdir)/$$cat.new;  \
	else  \
		mv $(srcdir)/$$cat.new $(srcdir)/$$cat ; \
	fi; \
	done

po.mo:
	$(MSGFMT) -o $@ $<

po.gmo:
	rm -f $(srcdir)/$*.gmo
	$(MSGFMT) -o $(srcdir)/$*.gmo $<

localedir = $(kde_locale)

xx-install-yes: all
	@catalogs='$(GMO_INSTALL)'; \
	for cat in $$catalogs; do \
	destdir=$(localedir); \
	lang=`echo $$cat | sed 's/\.kde[12]\.gmo//'`; \
	name=$(PACKAGE).mo \
	dir=$$destdir/$$lang/LC_MESSAGES; \
	$(mkinstalldirs) $$dir; \
	$(INSTALL_DATA) $$cat $$dir/$$name; \
	  echo "installing $$cat as $$dir/$$name"; \
	done

xx-uninstall-local:
	@catalogs='$(GMO_INSTALL)'; \
	for cat in $$catalogs; do \
	destdir=$(localedir); \
	lang=`echo $$cat | sed 's/\.gmo//'`; \
	name=$(PACKAGE).mo; \
	dir=$$destdir/$$lang/LC_MESSAGES; \
	rm -f $$cat $$dir/$$name; \
	echo "removing $$dir/$$name" ; \
	done

Index: avida/current/source/third-party/trio-1.9/mockpp/po/de.gmo
+++ avida/current/source/third-party/trio-1.9/mockpp/po/de.gmo
Þ•          Ì      |  '   ð  3     *   L  )   w  ;   ¡  0   Ý  /        >     S  N   i     ¸     Ó  C   î  =   2  I   p  2   º     í               3     J     i  2   ƒ  8   ¶  2   ï  4   "  9   W  5   ‘  7   Ç     ÿ       p   1     ¢     À  P   Û  M   ,  V   z  9   Ñ  "   	  %   .	  &   T	     {	  #   –	  #   º	                             
                                                             	      %1 added item does not match. %2 != %3. %1 did not receive an expected item.
Unexpected: %2 %1 did not receive the expected item list. %1 did not receive the expected item set. %1 did not receive the expected number of collection items. %1 did not receive the expected value. %2 != %3. %1 expected a value of %2 +- %3, but it was %4. %1 expected a value. %1 expected no value. %1 had different item sizes.
Expected %2 items but received %3 when adding %4. %1 has %2 un-used objects. %1 has run out of objects. %1 was called %2 times but should not be called more than %3 times. %1 was called %2 times which is not the expected count of %3. %1 was called %4 times which is not the expected count range of %2 to %3. Conversion of ulong to String: base %1 not allowed Could not create mutex. Could not lock mutex. Could not unlock mutex. Not Implemented in %1. Should include string segment. Should not have verified. Zu %1 hinzugefügtes Element passt nicht. %2 != %3. %1 hat kein erwartetes Element empfangen.
Unerwartet: %2 %1 hat nicht die erwartete Elementliste empfangen. %1 hat nicht die erwartete Elemente-Menge empfangen. %1 hat nicht die erwartete Anzahl an Elementen empfangen. %1 hat nicht den erwarteten Wert empfangen. %2 != %3. %1 erwartete einen Wert von %2 +- %3, jedoch war er %4. %1 erwartete einen Wert. %1 erwartet keinen Wert. % hat unterschiedliche Elementgrößen.
%2 Elemente wurden erwartet, jedoch %3 empfangen als %4 hinzugefügt wurde. %1 hat %2 unbenutzte Objekte. %1 hat keine Objekte mehr. %1 wurde %2 mal aufgerufen, sollte aber nicht mehr als %3 mal aufgerufen werden. %1 wurde %3 mal aufgerufen was nicht der erwarteten Anzahl von %2 entspricht. %1 wurde %4 mal aufgerufen, was nicht dem erwarteten Bereich von %2 bis %3 entspricht. Umwandlung von ulong nach String: Basis %1 nicht erlaubt. Mutex konnte nicht erzeugt werden. Mutex konnte nicht verriegelt werden. Mutex konnte nicht freigegeben werden. Nicht implementiert in %1. Zeichenkette sollte enthalten sein. Es sollte nicht verifiziert werden. 
Index: avida/current/source/third-party/trio-1.9/mockpp/po/de.po
+++ avida/current/source/third-party/trio-1.9/mockpp/po/de.po
# Mock Objects for C++
# Copyright (C) 2002,2003 Ewald Arnold
# Ewald Arnold <mockpp at ewald-arnold.de>, 2002, 2003
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: mockpp 1.0\n"
"POT-Creation-Date: 2003-01-06 15:57+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Ewald Arnold <mockpp at ewald-arnold.de>\n"
"Language-Team: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"

#: AbstractExpectation.h:112
#, fuzzy
msgid ""
"%1 assertion failed.\n"
"Expected: %2\n"
"Received: %3"
msgstr ""
"%1 %2\n"
"Erwartet: %3\n"
"Empfangen: %4."

#: ExpectationCounter.cpp:81 ExpectationCounterRange.cpp:72
msgid "%1 was called %2 times but should not be called more than %3 times."
msgstr ""
"%1 wurde %2 mal aufgerufen, sollte aber nicht mehr als %3 mal aufgerufen "
"werden."

#: ExpectationCounter.cpp:106
msgid "%1 was called %2 times which is not the expected count of %3."
msgstr ""
"%1 wurde %3 mal aufgerufen was nicht der erwarteten Anzahl von %2 entspricht."

#: ExpectationCounterRange.cpp:99
msgid ""
"%1 was called %4 times which is not the expected count range of %2 to %3."
msgstr ""
"%1 wurde %4 mal aufgerufen, was nicht dem erwarteten Bereich von %2 bis %3 "
"entspricht."

#: ExpectationList.h:86 ExpectationSegment.h:109 ExpectationSet.h:124
#: ExpectationValue.h:117 ExpectationValueRange.h:117
msgid "%1 expected no value."
msgstr "%1 erwartet keinen Wert."

#: ExpectationList.h:96 ExpectationSegment.h:119 ExpectationSet.h:133
#: ExpectationValue.h:128 ExpectationValueRange.h:128
msgid "%1 expected a value."
msgstr "%1 erwartete einen Wert."

#: ExpectationList.h:101
msgid "%1 did not receive the expected item list."
msgstr "%1 hat nicht die erwartete Elementliste empfangen."

#: ExpectationList.h:168
msgid ""
"%1 had different item sizes.\n"
"Expected %2 items but received %3 when adding %4."
msgstr ""
"% hat unterschiedliche Elementgrößen.\n"
"%2 Elemente wurden erwartet, jedoch %3 empfangen als %4 hinzugefügt wurde."

#: ExpectationList.h:173
msgid "%1 added item does not match. %2 != %3."
msgstr "Zu %1 hinzugefügtes Element passt nicht. %2 != %3."

#: ExpectationSegment.h:124
msgid "Should include string segment."
msgstr "Zeichenkette sollte enthalten sein."

#: ExpectationSet.h:138
msgid "%1 did not receive the expected number of collection items."
msgstr "%1 hat nicht die erwartete Anzahl an Elementen empfangen."

#: ExpectationSet.h:143
msgid "%1 did not receive the expected item set."
msgstr "%1 hat nicht die erwartete Elemente-Menge empfangen."

#: ExpectationSet.h:171
msgid ""
"%1 did not receive an expected item.\n"
"Unexpected: %2"
msgstr ""
"%1 hat kein erwartetes Element empfangen.\n"
"Unerwartet: %2"

#: ExpectationValue.h:133
msgid "%1 did not receive the expected value. %2 != %3."
msgstr "%1 hat nicht den erwarteten Wert empfangen. %2 != %3."

#: ExpectationValueRange.h:134
msgid "%1 expected a value of %2 +- %3, but it was %4."
msgstr "%1 erwartete einen Wert von %2 +- %3, jedoch war er %4."

#: ReturnObjectList.h:115
msgid "%1 has run out of objects."
msgstr "%1 hat keine Objekte mehr."

#: ReturnObjectList.h:130
msgid "%1 has %2 un-used objects."
msgstr "%1 hat %2 unbenutzte Objekte."

#: compat/Formatter.cpp:72 compat/Formatter.cpp:124
msgid "Conversion of ulong to String: base %1 not allowed"
msgstr "Umwandlung von ulong nach String: Basis %1 nicht erlaubt."

#: compat/Mutex.cpp:59
msgid "Could not create mutex."
msgstr "Mutex konnte nicht erzeugt werden."

#: compat/Mutex.cpp:80 compat/Mutex.cpp:106
msgid "Could not lock mutex."
msgstr "Mutex konnte nicht verriegelt werden."

#: compat/Mutex.cpp:91
msgid "Could not unlock mutex."
msgstr "Mutex konnte nicht freigegeben werden."

#: util/AssertMo.cpp:132
msgid "Should not have verified."
msgstr "Es sollte nicht verifiziert werden."

#: util/AssertMo.cpp:139
#, c-format
msgid "Not Implemented in %1."
msgstr "Nicht implementiert in %1."

#~ msgid ""
#~ "%1\n"
#~ "Exclude string: %2\n"
#~ "Target string: %3."
#~ msgstr ""
#~ "%1\n"
#~ "Auszuschliessender String: %2\n"
#~ "Ziel-String: %3."

#~ msgid ""
#~ "%1\n"
#~ "Include String: %2\n"
#~ "Target String: %3."
#~ msgstr ""
#~ "%1\n"
#~ "Einzuschliessender String: %2\n"
#~ "Ziel-String: %3."

#~ msgid ""
#~ "%1\n"
#~ "Start String: %2\n"
#~ "Target String: %3."
#~ msgstr ""
#~ "%1\n"
#~ "Beginnender String: %2\n"
#~ "Ziel-String: %3."

Index: avida/current/source/third-party/trio-1.9/mockpp/po/mockpp.pot
+++ avida/current/source/third-party/trio-1.9/mockpp/po/mockpp.pot
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2003-01-06 15:57+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"

#: AbstractExpectation.h:112
msgid ""
"%1 assertion failed.\n"
"Expected: %2\n"
"Received: %3"
msgstr ""

#: ExpectationCounter.cpp:81 ExpectationCounterRange.cpp:72
msgid "%1 was called %2 times but should not be called more than %3 times."
msgstr ""

#: ExpectationCounter.cpp:106
msgid "%1 was called %2 times which is not the expected count of %3."
msgstr ""

#: ExpectationCounterRange.cpp:99
msgid ""
"%1 was called %4 times which is not the expected count range of %2 to %3."
msgstr ""

#: ExpectationList.h:86 ExpectationSegment.h:109 ExpectationSet.h:124
#: ExpectationValue.h:117 ExpectationValueRange.h:117
msgid "%1 expected no value."
msgstr ""

#: ExpectationList.h:96 ExpectationSegment.h:119 ExpectationSet.h:133
#: ExpectationValue.h:128 ExpectationValueRange.h:128
msgid "%1 expected a value."
msgstr ""

#: ExpectationList.h:101
msgid "%1 did not receive the expected item list."
msgstr ""

#: ExpectationList.h:168
msgid ""
"%1 had different item sizes.\n"
"Expected %2 items but received %3 when adding %4."
msgstr ""

#: ExpectationList.h:173
msgid "%1 added item does not match. %2 != %3."
msgstr ""

#: ExpectationSegment.h:124
msgid "Should include string segment."
msgstr ""

#: ExpectationSet.h:138
msgid "%1 did not receive the expected number of collection items."
msgstr ""

#: ExpectationSet.h:143
msgid "%1 did not receive the expected item set."
msgstr ""

#: ExpectationSet.h:171
msgid ""
"%1 did not receive an expected item.\n"
"Unexpected: %2"
msgstr ""

#: ExpectationValue.h:133
msgid "%1 did not receive the expected value. %2 != %3."
msgstr ""

#: ExpectationValueRange.h:134
msgid "%1 expected a value of %2 +- %3, but it was %4."
msgstr ""

#: ReturnObjectList.h:115
msgid "%1 has run out of objects."
msgstr ""

#: ReturnObjectList.h:130
msgid "%1 has %2 un-used objects."
msgstr ""

#: compat/Formatter.cpp:72 compat/Formatter.cpp:124
msgid "Conversion of ulong to String: base %1 not allowed"
msgstr ""

#: compat/Mutex.cpp:59
msgid "Could not create mutex."
msgstr ""

#: compat/Mutex.cpp:80 compat/Mutex.cpp:106
msgid "Could not lock mutex."
msgstr ""

#: compat/Mutex.cpp:91
msgid "Could not unlock mutex."
msgstr ""

#: util/AssertMo.cpp:132
msgid "Should not have verified."
msgstr ""

#: util/AssertMo.cpp:139
#, c-format
msgid "Not Implemented in %1."
msgstr ""

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/AssertMo_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/AssertMo_test.cpp
/***************************************************************************
             AssertMo_test.cpp  -  unit tests for AssertMo class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AssertMo_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.9  2003/04/25 14:11:16  ewald-arnold
    workaround for stupid msvc6

    Revision 1.8  2003/04/13 16:49:58  ewald-arnold
    moved name to Verifiable class

    Revision 1.7  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.6  2003/02/17 22:04:55  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.5  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.4  2003/01/06 13:32:06  ewald-arnold
    test macros

    Revision 1.3  2003/01/04 12:24:39  ewald-arnold
    port to BCB5

    Revision 1.2  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/util/AssertMo.h>
#include <mockpp/Verifiable.h>
#include <mockpp/util/NotImplementedException.h>

#include <cppunit/extensions/HelperMacros.h>

class AssertMo_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( AssertMo_test );

 CPPUNIT_TEST(test_A_includes);
 CPPUNIT_TEST(test_A_excludes);
 CPPUNIT_TEST(test_A_startsWith);
 CPPUNIT_TEST(test_W_includes);
 CPPUNIT_TEST(test_W_excludes);
 CPPUNIT_TEST(test_W_startsWith);
 CPPUNIT_TEST(test_verifyFails);
 CPPUNIT_TEST(test_macros);
 
 CPPUNIT_TEST_EXCEPTION(fail_A_includes,   mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_A_excludes,   mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_A_startsWith, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_W_includes,   mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_W_excludes,   mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_W_startsWith, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_notImpl,      mockpp::NotImplementedException);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_A_includes();
   void test_A_excludes();
   void test_A_startsWith();
   void test_W_includes();
   void test_W_excludes();
   void test_W_startsWith();
   void test_verifyFails();
   void test_macros();
  
   void fail_A_includes();
   void fail_A_excludes();
   void fail_A_startsWith();
   void fail_W_includes();
   void fail_W_excludes();
   void fail_W_startsWith();
   void fail_notImpl();
};


CPPUNIT_TEST_SUITE_REGISTRATION(AssertMo_test);


void AssertMo_test::test_macros()
{
  bool thrown;

  thrown = false;
  try
  {
    MOCKPP_ASSERT_INCLUDES_MESSAGE(("includes abc xyz"), ("abc"), ("xyz") );
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("includes abc xyz") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_INCLUDES(("abc"), ("xyz") );
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
// use \042 instead of \" because m$vc is too stupid to escape correctly
    CPPUNIT_ASSERT(("(\042abc\042) <in> (\042xyz\042)") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_EXCLUDES_MESSAGE(("excludes abc abc"), ("abc"), ("abc") );
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("excludes abc abc") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_EXCLUDES(("abc"), ("abc") );
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
// use \042 instead of \" because m$vc is too stupid to escape correctly
    CPPUNIT_ASSERT(("(\042abc\042) <!in> (\042abc\042)") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_STARTSWITH_MESSAGE(("starts with abc xyz"), ("abc"), ("xyz") );
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("starts with abc xyz") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_STARTSWITH(("abc"), ("xyz") );
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
// use \042 instead of \" because m$vc is too stupid to escape correctly
    CPPUNIT_ASSERT(("(\042abc\042) <starts> (\042xyz\042)") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);
}


void AssertMo_test::test_A_includes()
{
  MOCKPP_ASSERT_INCLUDES(std::string("yLongS"), std::string("aVeryLongString"));

  MOCKPP_ASSERT_INCLUDES_MESSAGE(("assertIncludes aVeryLongString yLongS"),
                           std::string("yLongS"), std::string("aVeryLongString"));
}


void AssertMo_test::test_W_includes()
{
  MOCKPP_ASSERT_INCLUDES(std::string(L"yLongS"), std::string(L"aVeryLongString"));

  MOCKPP_ASSERT_INCLUDES_MESSAGE(("assertIncludes aVeryLongString yLongS"),
                           std::string(L"yLongS"), std::string(L"aVeryLongString"));
}


void AssertMo_test::test_A_excludes()
{
  MOCKPP_ASSERT_EXCLUDES(std::string("abcdef"), std::string("aVeryLongString"));

  MOCKPP_ASSERT_EXCLUDES_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                           std::string("abcdef"), std::string("aVeryLongString"));
}


void AssertMo_test::test_W_excludes()
{
  MOCKPP_ASSERT_EXCLUDES(std::string(L"abcdef"), std::string(L"aVeryLongString"));

  MOCKPP_ASSERT_EXCLUDES_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                           std::string(L"abcdef"), std::string(L"aVeryLongString"));
}


void AssertMo_test::test_A_startsWith()
{
  MOCKPP_ASSERT_STARTSWITH(std::string("aVeryLong"), std::string("aVeryLongString"));

  MOCKPP_ASSERT_STARTSWITH_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                             std::string("aVeryLong"), std::string("aVeryLongString"));
}


void AssertMo_test::test_W_startsWith()
{
  MOCKPP_ASSERT_STARTSWITH(std::string(L"aVeryLong"), std::string(L"aVeryLongString"));

  MOCKPP_ASSERT_STARTSWITH_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                             std::string(L"aVeryLong"), std::string(L"aVeryLongString"));
}


void AssertMo_test::fail_A_includes()
{
  MOCKPP_ASSERT_INCLUDES_MESSAGE(("assertIncludes aVeryLongString yLongS"),
                           std::string("abcdef"), std::string("aVeryLongString"));
}


void AssertMo_test::fail_W_includes()
{
  MOCKPP_ASSERT_INCLUDES_MESSAGE(("assertIncludes aVeryLongString yLongS"),
                           std::string(L"abcdef"), std::string(L"aVeryLongString"));
}


void AssertMo_test::fail_A_excludes()
{
  MOCKPP_ASSERT_EXCLUDES(std::string("aVeryLong"), std::string("aVeryLongString"));
}


void AssertMo_test::fail_W_excludes()
{
  MOCKPP_ASSERT_EXCLUDES_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                           std::string(L"aVeryLong"), std::string(L"aVeryLongString"));
}


void AssertMo_test::fail_A_startsWith()
{
  MOCKPP_ASSERT_STARTSWITH_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                             std::string("abcdef"), std::string("aVeryLongString"));
}


void AssertMo_test::fail_W_startsWith()
{
  MOCKPP_ASSERT_STARTSWITH_MESSAGE(("assertIncludes aVeryLongString abcdef"),
                             std::string(L"abcdef"), std::string(L"aVeryLongString"));
}


void AssertMo_test::fail_notImpl()
{
  MOCKPP_NOT_IMPLEMENTED(("not implemented"));
}


class MyVerifiable : public mockpp::Verifiable
{
  public:
    MyVerifiable()
      : mockpp::Verifiable(("myVer"), 				0)
    {}

    virtual void verify()
    {
      throw mockpp::AssertionFailedError(__LINE__, __FILE__,
                                          ("verify with AssertionFailedError"));
    }
};


void AssertMo_test::test_verifyFails()
{
  MyVerifiable mv;
  MOCKPP_ASSERT_VERIFYFAILS(&mv);
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/Assert_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/Assert_test.cpp
/***************************************************************************
             Assert_test.cpp  -  unit tests for Assert class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Assert_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/02/25 20:20:43  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.6  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.5  2003/02/16 17:33:59  ewald-arnold
    additional tests

    Revision 1.4  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.3  2003/01/06 13:33:00  ewald-arnold
    test macros
    check results with cppunit

    Revision 1.2  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class Assert_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( Assert_test );

 CPPUNIT_TEST(test_FalseTrue);
 CPPUNIT_TEST(test_boundary);

 CPPUNIT_TEST(test_equalsDouble);
 CPPUNIT_TEST(test_equalsFloat);
 CPPUNIT_TEST(test_equalsLong);
 CPPUNIT_TEST(test_equalsBool);
 CPPUNIT_TEST(test_equalsChar);
 CPPUNIT_TEST(test_equalsInt);
 CPPUNIT_TEST(test_equalsShort);
 CPPUNIT_TEST(test_equalsAString);
 CPPUNIT_TEST(test_equalsWString);
 CPPUNIT_TEST(test_equalsPChar);
 CPPUNIT_TEST(test_equalsPWChar);
 CPPUNIT_TEST(test_macros);
 
 CPPUNIT_TEST_EXCEPTION( fail_fail, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION( fail_failmsg, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void fail_fail();
   void fail_failmsg();

   void test_FalseTrue();
   void test_boundary();
   
   void test_equalsPWChar();
   void test_equalsPChar();
   void test_equalsAString();
   void test_equalsWString();
   void test_equalsDouble();
   void test_equalsFloat();
   void test_equalsLong();
   void test_equalsBool();
   void test_equalsChar();
   void test_equalsInt();
   void test_equalsShort();
   void test_macros();
}; 


CPPUNIT_TEST_SUITE_REGISTRATION(Assert_test);


void Assert_test::test_macros()
{
  bool thrown;

  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("equals 1==2"), 1, 2);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("equals 1==2") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS(123, 321);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("invalid: 123 == 321") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_DELTA_MESSAGE(("range 1 +- 2 == 4"), 1, 4, 2);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("range 1 +- 2 == 4") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_DELTA(123, 321, 3);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("invalid: 123 +- 3 == 321") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_BOUNDARY(123, 321, 789);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("invalid: 123 < 789 < 321") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_BOUNDARY_MESSAGE(("123 321 789"), 123, 321, 789);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("123 321 789") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_TRUE_MESSAGE(("condition true == false"), true == false);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("condition true == false") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_TRUE( true == false ); // some spaces AROUND the expression
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("!true: true == false") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_FALSE_MESSAGE(("condition true != false"), true != false);
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("condition true != false") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);
  
  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_FALSE( true != false ); // some spaces AROUND the expression
  }
  catch (mockpp::AssertionFailedError &ae)
  {
    thrown = true;
    CPPUNIT_ASSERT(("!false: true != false") == ae.getMessage());
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsAString()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"123\""),
                               std::string("123"), std::string("123"));

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), std::string("123"), std::string("123"));

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"321\""),
                                 std::string("123"), std::string("321"));
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), std::string("123"), std::string("321"));
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsWString()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"123\""),
                               std::string(L"123"), std::string(L"123"));

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), std::string(L"123"), std::string(L"123"));


  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"321\""),
                                 std::string(L"123"), std::string(L"321"));
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), std::string(L"123"), std::string(L"321"));
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsPChar()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"123\""),
                               "123", "123");

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), "123", "123");

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"321\""),
                                 "123", "321");
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), "123", "321");
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsPWChar()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"123\""),
                               L"123", L"123");

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), L"123", L"123");


  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals \"123\" == \"321\""),
                                 L"123", L"321");
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), L"123", L"321");
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsLong()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 12345678 == 12345678"),
                               (long) 12345678, (long) 12345678);

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), (long) -12345678, (long) -12345678);

  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 12345678 == 876543321"),
                                 (long) 12345678, (long) 87654321);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), (long) -12345678, (long) -87654321);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsShort()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 1234 == 1234"),
                               (short) 1234, (short) 1234);

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), (short) -1234, (short) -1234);

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), (short) -1234, (short) -4321);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);


  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 1234 != 4321"),
                                 (short) -1234, (short) -4321);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsInt()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 1234 == 1234"),
                               (int) 1234, (int) 1234);

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), (int) -1234, (int) -1234);

  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 1234 == 4321"),
                                 (int) 1234, (int) 4321);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), (int) 1234, (int) 4321);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsChar()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 'x' == 'x'"),
                               ('x'), ('x'));

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), ('x'), ('x'));

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals 'x' == 'u'"),
                                 ('x'), ('u'));
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), ('x'), ('u'));
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsBool()
{
  MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals true == true"),
                               (bool)true, (bool)true);

  MOCKPP_ASSERT_EQUALS_MESSAGE((""), (bool)true, (bool)true);

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("assertEquals true == false"),
                                 (bool)true, (bool)false);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE((""), (bool)true, (bool)false);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsDouble()
{
  // should fail when instantiated with template and long/int!
  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals 12.3 +- 0.4 == 12.6"),
                               (double)12.3, (double)12.6, (double)0.4);

  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals 12.6 +- 0.4 == 12.3"),
                               (double)12.6, (double)12.3, (double)0.4);

  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals -12.6 +- -0.4 == -12.3"),
                               (double)-12.6, (double)-12.3, (double)-0.4);

  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals -12.6 +- 0.4 == -12.3"),
                               (double)-12.6, (double)-12.3, (double)0.4);

  MOCKPP_ASSERT_DELTA((double)12.5, (double)12.7, (double)0.6);

  MOCKPP_ASSERT_DELTA((double)12.5, (double)12.1, (double)0.6);

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals 12.5 +- 0.5 == 13.1"),
                                 (double)12.5, (double)13.1, (double)0.5);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_DELTA((double)12.5, (double)13.1, (double)-0.5);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_equalsFloat()
{
  // should fail when instantiated with template and long/int!
  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals 12.3 +- 0.4 == 12.6"),
                               (float)12.3, (float)12.6, (float)0.4);

  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals 12.6 +- 0.4 == 12.3"),
                               (float)12.6, (float)12.3, (float)0.4);

  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals -12.6 +- -0.4 == -12.3"),
                               (float)-12.6, (float)-12.3, (float)-0.4);

  MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals -12.6 +- 0.4 == -12.3"),
                               (float)-12.6, (float)-12.3, (float)0.4);

  MOCKPP_ASSERT_DELTA((float)12.5, (float)12.7, (float)0.5);

  MOCKPP_ASSERT_DELTA((float)12.5, (float)12.1, (float)0.5);

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_DELTA_MESSAGE(("assertEquals 12.5 +- 0.5 == 11.9"),
                                 (float)12.5, (float)11.9, (float)0.5);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_DELTA((float)12.5, (float)11.9, (float)0.5);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::test_FalseTrue()
{
  MOCKPP_ASSERT_TRUE_MESSAGE(("assertTrue 1 == 1"), 1 == 1);

  MOCKPP_ASSERT_TRUE_MESSAGE((""), 1 == 1);

  MOCKPP_ASSERT_FALSE_MESSAGE(("assertFalse 1 != 1"), 1 != 1);

  MOCKPP_ASSERT_FALSE_MESSAGE((""), 1 != 1);

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_TRUE_MESSAGE(("assertTrue 1 != 1"), 1 != 1);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_TRUE_MESSAGE((""), 1 != 1);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_FALSE_MESSAGE(("assertTrue 1 == 1"), 1 == 1);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_FALSE_MESSAGE((""), 1 == 1);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}


void Assert_test::fail_fail()
{
  MOCKPP_FAIL((""));
}


void Assert_test::fail_failmsg()
{
  MOCKPP_FAIL(("fail with msg"));
}


void Assert_test::test_boundary()
{
  MOCKPP_ASSERT_BOUNDARY_MESSAGE(("assertBoundary 2 4 3"), 2, 4, 3);

  MOCKPP_ASSERT_BOUNDARY(2, 4, 2);
  MOCKPP_ASSERT_BOUNDARY(2, 4, 3);
  MOCKPP_ASSERT_BOUNDARY(2, 4, 4);

  
  bool thrown = false;
  try
  {
    MOCKPP_ASSERT_BOUNDARY(2, 4, 1);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);

  
  thrown = false;
  try
  {
    MOCKPP_ASSERT_BOUNDARY(2, 4, 5);
  }
  catch(mockpp::AssertionFailedError)
  {
    thrown = true;
  }
  CPPUNIT_ASSERT(thrown == true);
}
  

#endif // HAVE_CPPUNIT


Index: avida/current/source/third-party/trio-1.9/mockpp/tests/Exception_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/Exception_test.cpp
/***************************************************************************
        Exception_test.cpp  -  unit tests for Exception class
                             -------------------
    begin                : Wed Jan 1 2003
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Exception_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.2  2003/01/06 13:33:33  ewald-arnold
    fix for unicode

    Revision 1.1  2003/01/04 09:53:58  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/compat/Exception.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class Exception_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( Exception_test );

  CPPUNIT_TEST(test_file_line);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_file_line();
};


 CPPUNIT_TEST_SUITE_REGISTRATION(Exception_test);


void Exception_test::test_file_line()
{
  bool thrown = false;
  unsigned l = 0;
  const char* f = 0;
  try
  {
    // keep on the same line
    l = __LINE__; f = __FILE__; MOCKPP_FAIL(("test-assert"));
  }
  catch(mockpp::AssertionFailedError &ex)
  {
    MOCKPP_ASSERT_EQUALS_MESSAGE(("error line parameter"), (int)l, (int)ex.getSrcLine());
    MOCKPP_ASSERT_EQUALS_MESSAGE(("error file parameter"), std::string(f), mockpp::getLatin1(ex.getSrcFile()));

    MOCKPP_ASSERT_EQUALS_MESSAGE(("error message parameter <mockpp::String>"), ("test-assert"), ex.getMessage());

    MOCKPP_ASSERT_EQUALS_MESSAGE(("error message parameter <std:.string>"), std::string("test-assert"), std::string(ex.what()));
    thrown = true;
  }

  MOCKPP_ASSERT_TRUE_MESSAGE(("Should have thrown"), thrown);
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationBoundary_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationBoundary_test.cpp
/***************************************************************************
   ExpectationBoundary_test.cpp  -  unit tests for ExpectationBoundary class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationBoundary_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.2  2003/03/12 16:45:51  ewald-arnold
    setExpectedDelta() added

    Revision 1.1  2003/02/25 20:20:47  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.3  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

  
#include <mockpp/mockpp.h> // always first

#undef  MOCKPP_BOUNDARY_DELTA  // after inclusion of mockpp.h!
#define MOCKPP_BOUNDARY_DELTA 1

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationBoundary.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationBoundary_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationBoundary_test );

  CPPUNIT_TEST(test_hasExpectations);
  CPPUNIT_TEST(test_name);
  CPPUNIT_TEST(test_clearActual);
  CPPUNIT_TEST(test_ifNoExpected);
  CPPUNIT_TEST(test_innerRanges);
  CPPUNIT_TEST(test_delta);

  CPPUNIT_TEST(test_expectNothing);
  CPPUNIT_TEST(test_expectActualImmediate);
  CPPUNIT_TEST(test_expectActualVerify);

  CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_bounds, mockpp::AssertionFailedError);

  CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_negativeDelta, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_positiveDelta, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_delta1, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_delta2, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();
   void test_innerRanges();
   void test_delta();

   void fail_delta1();
   void fail_delta2();
   
   void fail_bounds();
   void fail_ifNoActual();
   void fail_negativeDelta();
   void fail_positiveDelta();
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationBoundary_test);


void ExpectationBoundary_test::test_name()
{
  mockpp::ExpectationBoundary<int> ec (("testRange"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testRange")));
}


void ExpectationBoundary_test::test_hasExpectations()
{
  mockpp::ExpectationBoundary<int> ec (("testRange"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.setExpected(2, 4);
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationBoundary_test::test_clearActual()
{
  mockpp::ExpectationBoundary<int> ec (("testRange"), 0);
  ec.setExpected(3, 5);
  ec.clearActual();
}


void ExpectationBoundary_test::fail_ifNoActual()
{
  mockpp::ExpectationBoundary<int> ec (("nothingRange"), 0);
  ec.setExpected(1, 2);
  ec.verify();  // fails because no value
}


void ExpectationBoundary_test::test_ifNoExpected()
{
  mockpp::ExpectationBoundary<int> ec (("nothingRange"), 0);
  ec.setActual(3); // no fail yet
}


void doNothing(mockpp::ExpectationBoundary<int> &ec)
{
  ec.setExpected(3, 5);
  ec.setExpectNothing();
}


void ExpectationBoundary_test::test_expectNothing()
{
  mockpp::ExpectationBoundary<int> ec (("nothingRange"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationBoundary_test::fail_expectNothing()
{
  mockpp::ExpectationBoundary<int> ec (("nothingRange"), 0);
  doNothing(ec);
  ec.setActual(3);  // fails even if equal
}


void doActualImmediate(mockpp::ExpectationBoundary<int> &ec)
{
  ec.setExpected(1233, 1235);
  ec.setActual(1234);
}


void ExpectationBoundary_test::test_expectActualImmediate()
{
  mockpp::ExpectationBoundary<int> ec (("actualRange"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationBoundary_test::fail_expectActualImmediate()
{
  mockpp::ExpectationBoundary<int> ec (("actualRange"), 0);
  doActualImmediate(ec);
  ec.setActual(4321); // fails
}


void doActualVerify(mockpp::ExpectationBoundary<int> &ec)
{
  ec.setExpected(1234, 1235);
  ec.setFailOnVerify();
  ec.setActual(4321); // should not fail
}


void ExpectationBoundary_test::test_expectActualVerify()
{
  mockpp::ExpectationBoundary<int> ec (("verifyRange"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationBoundary_test::fail_expectActualVerify()
{
  mockpp::ExpectationBoundary<int> ec (("verifyRange"), 0);
  doActualVerify(ec); // no fail
  ec.verify(); // fails
}


void ExpectationBoundary_test::test_innerRanges()
{
  mockpp::ExpectationBoundary<int> ec (("innerRange"), 0);

  ec.setExpected(100-5, 100+5);
  ec.setActual(105);
  ec.setActual(95);
}


void ExpectationBoundary_test::test_delta()
{
  mockpp::ExpectationBoundary<int> ec (("delta"), 0);

  ec.setExpectedDelta(100, 5);
  ec.setActual(105);
  ec.setActual(95);
}


void ExpectationBoundary_test::fail_delta1()
{
  mockpp::ExpectationBoundary<int> ec (("delta1"), 0);

  ec.setExpectedDelta(100, -5);
  ec.setActual(106);
}  


void ExpectationBoundary_test::fail_delta2()
{
  mockpp::ExpectationBoundary<int> ec (("delta2"), 0);

  ec.setExpectedDelta(100, -5);
  ec.setActual(94);
}  


void ExpectationBoundary_test::fail_positiveDelta()
{
  mockpp::ExpectationBoundary<int> ec (("posDelta"), 0);

  ec.setExpected(100-5, 100+5);
  ec.setActual(94);
}


void ExpectationBoundary_test::fail_negativeDelta()
{
  mockpp::ExpectationBoundary<int> ec (("negDelta"), 0);

  ec.setExpected(100-5, 100+5);
  ec.setActual(106);
}


void ExpectationBoundary_test::fail_bounds()
{
  mockpp::ExpectationBoundary<int> ec (("fail_bounds"), 0);
  ec.setExpected(101, 99);
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationCounterRange_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationCounterRange_test.cpp
/***************************************************************************
   ExpectationCounterRange_test.cpp  -  unit tests for ExpectationCounterRange class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationCounterRange_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/02/08 08:15:27  ewald-arnold
    refactoring for removed ExpectationCounterRange

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not,
 write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationCounter.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationCounterRange_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationCounterRange_test );

 CPPUNIT_TEST(test_hasExpectations);
 CPPUNIT_TEST(test_name);
 CPPUNIT_TEST(test_clearActual);

 CPPUNIT_TEST(test_expectNothing);
 CPPUNIT_TEST(test_expectActualImmediate);
 CPPUNIT_TEST(test_expectActualVerify);
 CPPUNIT_TEST(test_ifNoExpected);

 CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);

 CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void fail_ifNoActual();
   void doNothing(mockpp::ExpectationCounter &ec);
   void doActualImmediate(mockpp::ExpectationCounter &ec);
   void doActualVerify(mockpp::ExpectationCounter &ec);
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationCounterRange_test);


void ExpectationCounterRange_test::test_name()
{
  mockpp::ExpectationCounter ec (("testcounter"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testcounter")));
}


void ExpectationCounterRange_test::test_hasExpectations()
{
  mockpp::ExpectationCounter ec (("testcounter"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.setExpected(2, 4);
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationCounterRange_test::test_clearActual()
{
  mockpp::ExpectationCounter ec (("testcounter"), 0);
  ec.setExpected(1, 3);
  ec.inc();
  ec.inc();
  ec.inc();   // no fail anyway
  ec.clearActual();
  ec.inc();
  ec.inc();
  ec.inc();   // no fail even now
}


void ExpectationCounterRange_test::test_ifNoExpected()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  ec.inc(); // no fail yet
}


void ExpectationCounterRange_test::fail_ifNoActual()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  ec.setExpected(2, 4);
  ec.verify();  // fails because no calls
}


void ExpectationCounterRange_test::doNothing(mockpp::ExpectationCounter &ec)
{
  ec.setExpected(1, 3);
  ec.setExpectNothing();
}


void ExpectationCounterRange_test::test_expectNothing()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationCounterRange_test::fail_expectNothing()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  doNothing(ec);
  ec.inc();  // fails
}


void ExpectationCounterRange_test::doActualImmediate(mockpp::ExpectationCounter &ec)
{
  ec.setExpected(2, 4);
  ec.inc();
  ec.inc();
  ec.inc();
  ec.inc();
}


void ExpectationCounterRange_test::test_expectActualImmediate()
{
  mockpp::ExpectationCounter ec (("actualcounter"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationCounterRange_test::fail_expectActualImmediate()
{
  mockpp::ExpectationCounter ec (("actualcounter"), 0);
  doActualImmediate(ec);
  ec.inc();   // fails
}


void ExpectationCounterRange_test::doActualVerify(mockpp::ExpectationCounter &ec)
{
  ec.setExpected(2, 4);
  ec.setFailOnVerify();
  ec.inc();
  ec.inc();
  ec.inc();
  ec.inc();
  ec.inc();
  ec.inc();
}


void ExpectationCounterRange_test::test_expectActualVerify()
{
  mockpp::ExpectationCounter ec (("verifycounter"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationCounterRange_test::fail_expectActualVerify()
{
  mockpp::ExpectationCounter ec (("verifycounter"), 0);
  doActualVerify(ec); // no fail
  ec.verify(); // fails
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationCounter_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationCounter_test.cpp
/***************************************************************************
   ExpectationCounter_test.cpp  -  unit tests for ExpectationCounter class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationCounter_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/02/08 08:15:27  ewald-arnold
    refactoring for removed ExpectationCounterRange

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not,
 write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationCounter.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationCounter_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationCounter_test );

 CPPUNIT_TEST(test_hasExpectations);
 CPPUNIT_TEST(test_name);
 CPPUNIT_TEST(test_clearActual);

 CPPUNIT_TEST(test_expectNothing);
 CPPUNIT_TEST(test_expectActualImmediate);
 CPPUNIT_TEST(test_expectActualVerify);
 CPPUNIT_TEST(test_ifNoExpected);
 
 CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);

 CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();
   
   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void fail_ifNoActual();
   void doNothing(mockpp::ExpectationCounter &ec);
   void doActualImmediate(mockpp::ExpectationCounter &ec);
   void doActualVerify(mockpp::ExpectationCounter &ec);
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationCounter_test);


void ExpectationCounter_test::test_name()
{
  mockpp::ExpectationCounter ec (("testcounter"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testcounter")));
}


void ExpectationCounter_test::test_hasExpectations()
{
  mockpp::ExpectationCounter ec (("testcounter"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.setExpected(2);
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationCounter_test::test_clearActual()
{
  mockpp::ExpectationCounter ec (("testcounter"), 0);
  ec.setExpected(3);
  ec.inc();
  ec.inc();
  ec.inc();   // no fail anyway
  ec.clearActual();
  ec.inc();
  ec.inc();
  ec.inc();   // no fail even now
}


void ExpectationCounter_test::test_ifNoExpected()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  ec.inc(); // no fail yet
}


void ExpectationCounter_test::fail_ifNoActual()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  ec.setExpected(2);
  ec.verify();  // fails because no value
}


void ExpectationCounter_test::doNothing(mockpp::ExpectationCounter &ec)
{
  ec.setExpected(3);
  ec.setExpectNothing();
}


void ExpectationCounter_test::test_expectNothing()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationCounter_test::fail_expectNothing()
{
  mockpp::ExpectationCounter ec (("nothingcounter"), 0);
  doNothing(ec);
  ec.inc();  // fails
}


void ExpectationCounter_test::doActualImmediate(mockpp::ExpectationCounter &ec)
{
  ec.setExpected(2);
  ec.inc();
  ec.inc();
}


void ExpectationCounter_test::test_expectActualImmediate()
{
  mockpp::ExpectationCounter ec (("actualcounter"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationCounter_test::fail_expectActualImmediate()
{
  mockpp::ExpectationCounter ec (("actualcounter"), 0);
  doActualImmediate(ec);
  ec.inc();   // fails
}


void ExpectationCounter_test::doActualVerify(mockpp::ExpectationCounter &ec)
{
  ec.setExpected(2);
  ec.setFailOnVerify();
  ec.inc();
  ec.inc();
  ec.inc();
  ec.inc();
}


void ExpectationCounter_test::test_expectActualVerify()
{
  mockpp::ExpectationCounter ec (("verifycounter"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationCounter_test::fail_expectActualVerify()
{
  mockpp::ExpectationCounter ec (("verifycounter"), 0);
  doActualVerify(ec); // no fail
  ec.verify(); // fails
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationList_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationList_test.cpp
/***************************************************************************
   ExpectationList_test.cpp  -  unit tests for ExpectationList class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationList_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/02/17 22:04:56  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationList.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationList_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationList_test );

  CPPUNIT_TEST(test_hasExpectations);
  CPPUNIT_TEST(test_name);
  CPPUNIT_TEST(test_clearActual);
  CPPUNIT_TEST(test_many);
  CPPUNIT_TEST(test_balance);
  
  CPPUNIT_TEST(test_expectNothing);
  CPPUNIT_TEST(test_expectActualImmediate);
  CPPUNIT_TEST(test_expectActualVerify);
  CPPUNIT_TEST(test_ifNoExpected);

  CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_many, mockpp::AssertionFailedError);
  
  CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void fail_many();
   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void test_balance();
   void test_many();
   void fail_ifNoActual();
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationList_test);


void ExpectationList_test::test_name()
{
  mockpp::ExpectationList<int> ec (("testList"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testList")));
}


void ExpectationList_test::test_hasExpectations()
{
  mockpp::ExpectationList<int> ec (("testList"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.addExpected(2);
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationList_test::test_clearActual()
{
  mockpp::ExpectationList<int> ec (("testList"), 0);
  ec.addExpected(3);
  ec.clearActual();
}


void ExpectationList_test::test_ifNoExpected()
{
  mockpp::ExpectationList<int> ec (("nothingList"), 0);
  ec.addActual(3); // fails because no expectation value
}


void ExpectationList_test::fail_ifNoActual()
{
  mockpp::ExpectationList<int> ec (("nothingList"), 0);
  ec.addExpected(3);
  ec.verify();  // fails because no value
}


void doNothing(mockpp::ExpectationList<int> &ec)
{
  ec.addExpected(3);
  ec.setExpectNothing();
}


void ExpectationList_test::test_expectNothing()
{
  mockpp::ExpectationList<int> ec (("nothingList"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationList_test::fail_expectNothing()
{
  mockpp::ExpectationList<int> ec (("nothingList"), 0);
  doNothing(ec);
  ec.addActual(3);  // fails even if equal
}


void doActualImmediate(mockpp::ExpectationList<int> &ec)
{
  ec.addExpected(1234);
  ec.addExpected(5678);
  ec.addExpected(8765);
  ec.addExpected(4321);

  ec.addActual(1234);
  ec.addActual(5678);
  ec.addActual(8765);
  ec.addActual(4321);
}


void ExpectationList_test::test_expectActualImmediate()
{
  mockpp::ExpectationList<int> ec (("actualList"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationList_test::test_many()
{
  mockpp::ExpectationList<int> ec (("actualList"), 0);
  int prep[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

  ec.addExpected(prep+0, prep+10);
  ec.addActual(prep+0, prep+10);
}


void ExpectationList_test::fail_many()
{
  mockpp::ExpectationList<int> ec (("actualList"), 0);

  int prep[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

  ec.addExpected(prep+0, prep+10);
  ec.addActual(prep+2, prep+10);
}


void ExpectationList_test::fail_expectActualImmediate()
{
  mockpp::ExpectationList<int> ec (("actualList"), 0);
  doActualImmediate(ec);
  ec.addActual(4321); // fails
}


void doActualVerify(mockpp::ExpectationList<int> &ec)
{
  ec.addExpected(1234);
  ec.setFailOnVerify();
  ec.addActual(4321); // should not fail
}


void ExpectationList_test::test_expectActualVerify()
{
  mockpp::ExpectationList<int> ec (("verifyList"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationList_test::fail_expectActualVerify()
{
  mockpp::ExpectationList<int> ec (("verifyList"), 0);
  doActualVerify(ec); // no fail
  ec.verify();        // fails
}


void ExpectationList_test::test_balance()
{
  mockpp::ExpectationList<int> ec (("verifyList"), 0);

  ec.addExpected(1);
  ec.addExpected(2);
  ec.addExpected(3);
  ec.addExpected(4);
  ec.addExpected(5);

  ec.balanceActual();  // copy last element
  ec.balanceActual();  // copy last element
  ec.balanceActual();  // copy last element
  ec.balanceActual();  // copy last element
  ec.balanceActual();  // copy last element

  ec.verify();
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationMap_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationMap_test.cpp
/***************************************************************************
   ExpectationMap_test.cpp  -  unit tests for ExpectationMap class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationMap_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/04/06 19:13:58  ewald-arnold
    port to OpenBsd 3.1 and g++ 2.95

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.2  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationMap.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationMap_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationMap_test );

  CPPUNIT_TEST(test_hasExpectations);
  CPPUNIT_TEST(test_name);
  CPPUNIT_TEST(test_clearActual);
  CPPUNIT_TEST(test_many);
  CPPUNIT_TEST(test_get);
  CPPUNIT_TEST(test_missing);
  CPPUNIT_TEST(test_pair_get);
  CPPUNIT_TEST(test_pair_getmany);

  CPPUNIT_TEST(test_expectNothing);
  CPPUNIT_TEST(test_expectActualImmediate);
  CPPUNIT_TEST(test_expectActualVerify);
  CPPUNIT_TEST(test_ifNoExpected);

  CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_many, mockpp::AssertionFailedError);

  CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void fail_many();
   void test_name();
   void test_missing();
   void test_get();
   void test_pair_get();
   void test_pair_getmany();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void test_many();
   void fail_ifNoActual();
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationMap_test);


void ExpectationMap_test::test_name()
{
  mockpp::ExpectationMap<int, std::string>  ec (("testMap"), 0);
  CPPUNIT_ASSERT(ec.getName() == ("testMap"));
}


void ExpectationMap_test::test_hasExpectations()
{
  mockpp::ExpectationMap<int, std::string>  ec (("testMap"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.addExpected(2, "two");
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationMap_test::test_clearActual()
{
  mockpp::ExpectationMap<int, std::string>  ec (("testMap"), 0);
  ec.addExpected(3, "three");
  ec.clearActual();
}


void ExpectationMap_test::test_ifNoExpected()
{
  mockpp::ExpectationMap<int, std::string>  ec (("nothingMap"), 0);
  ec.addActual(3); // fails because no expectation value
}


void ExpectationMap_test::fail_ifNoActual()
{
  mockpp::ExpectationMap<int, std::string>  ec (("nothingMap"), 0);
  ec.addExpected(3, "three");
  ec.verify();  // fails because no value
}


void doNothing(mockpp::ExpectationMap<int, std::string>  &ec)
{
  ec.addExpected(3, "three");
  ec.setExpectNothing();
}


void ExpectationMap_test::test_expectNothing()
{
  mockpp::ExpectationMap<int, std::string>  ec (("nothingMap"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationMap_test::fail_expectNothing()
{
  mockpp::ExpectationMap<int, std::string>  ec (("nothingMap"), 0);
  doNothing(ec);
  ec.addActual(3);  // fails even if equal
}


void ExpectationMap_test::test_get()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);
  ec.addExpected(3, "three");
  ec.addExpected(4, "four");
  CPPUNIT_ASSERT("three" == ec.get(3));
}


void ExpectationMap_test::test_pair_get()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);
  ec.addExpected(std::make_pair(3, (const char*)"three")); // gcc2.95 needs this "const char*" thing
  ec.addExpected(std::make_pair(4, (const char*)"four"));
  CPPUNIT_ASSERT("three" == ec.get(3));
  CPPUNIT_ASSERT("four" == ec.get(4));
}


void ExpectationMap_test::test_pair_getmany()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);
  std::vector<std::pair<int, std::string> > vp;
  vp.push_back(std::make_pair(3, (const char*)"three")); // gcc2.95 needs this "const char*" thing
  vp.push_back(std::make_pair(4, (const char*)"four"));
  vp.push_back(std::make_pair(5, (const char*)"five"));
  vp.push_back(std::make_pair(6, (const char*)"six"));
  vp.push_back(std::make_pair(7, (const char*)"seven"));
  ec.addExpected(vp.begin(), vp.end());

  CPPUNIT_ASSERT("three" == ec.get(3));
  CPPUNIT_ASSERT("four" == ec.get(4));
}


void ExpectationMap_test::test_many()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);

  ec.addExpected(std::pair<int, std::string>(6,"zero"));
  ec.addExpected(std::pair<int, std::string>(5, "one"));
  ec.addExpected(std::pair<int, std::string>(4, "two"));
  ec.addExpected(std::pair<int, std::string>(3, "three"));
  ec.addExpected(std::pair<int, std::string>(2, "four"));
  ec.addExpected(std::pair<int, std::string>(1, "five"));

  ec.addActual(1);
  ec.addActual(2);
  ec.addActual(3);
  ec.addActual(4);
  ec.addActual(5);
  ec.addActual(6);
}


void ExpectationMap_test::fail_many()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);

  ec.addExpected(std::pair<int, std::string>(6,"zero"));
  ec.addExpected(std::pair<int, std::string>(5, "one"));
  ec.addExpected(std::pair<int, std::string>(4, "two"));
  ec.addExpected(std::pair<int, std::string>(3, "three"));
  ec.addExpected(std::pair<int, std::string>(2, "four"));
  ec.addExpected(std::pair<int, std::string>(1, "five"));

  ec.addActual(10);
}


void doActualImmediate(mockpp::ExpectationMap<int, std::string>  &ec)
{
  ec.addExpected(1234, "1234");
  ec.addExpected(5678, "5678");
  ec.addExpected(8765, "8765");
  ec.addExpected(4321, "1234");

  ec.addActual(1234);
  ec.addActual(5678);
  ec.addActual(8765);
  ec.addActual(4321);
}


void ExpectationMap_test::test_expectActualImmediate()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationMap_test::fail_expectActualImmediate()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);
  doActualImmediate(ec);
  ec.addActual(1111); // fails
}


void ExpectationMap_test::test_missing()
{
  mockpp::ExpectationMap<int, std::string>  ec (("actualMap"), 0);
  ec.addExpectedMissing(1234);
  ec.addExpectedMissing(5678);
  ec.addExpectedMissing(8765);
  ec.addExpectedMissing(4321);

  ec.addActual(1234);
  ec.addActual(5678);
  ec.addActual(8765);
  ec.addActual(4321);
  ec.verify(); // no fail
}


void doActualVerify(mockpp::ExpectationMap<int, std::string>  &ec)
{
  ec.addExpected(1234, "1234");
  ec.setFailOnVerify();
  ec.addActual(4321); // should not fail
}


void ExpectationMap_test::test_expectActualVerify()
{
  mockpp::ExpectationMap<int, std::string>  ec (("verifyMap"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationMap_test::fail_expectActualVerify()
{
  mockpp::ExpectationMap<int, std::string>  ec (("verifyMap"), 0);
  doActualVerify(ec); // no fail
  ec.verify();        // fails
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationSegment_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationSegment_test.cpp
/***************************************************************************
   ExpectationSegment_test.cpp  -  unit tests for ExpectationSegment class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationSegment_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationSegment.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationSegment_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationSegment_test );

  CPPUNIT_TEST(test_hasExpectations);
  CPPUNIT_TEST(test_name);
  CPPUNIT_TEST(test_clearActual);
  CPPUNIT_TEST(test_ifNoExpected);

  CPPUNIT_TEST(test_expectNothing);
  CPPUNIT_TEST(test_expectActualImmediate);
  CPPUNIT_TEST(test_expectActualVerify);

  CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);

  CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void fail_ifNoActual();
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationSegment_test);


void ExpectationSegment_test::test_name()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("testSegment"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testSegment")));
}


void ExpectationSegment_test::test_hasExpectations()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("testSegment"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.setExpected(("1234"));
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationSegment_test::test_clearActual()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("testSegment"), 0);
  ec.setExpected(("1234"));
  ec.clearActual();
}


void ExpectationSegment_test::fail_ifNoActual()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("nothingSegment"), 0);
  ec.setExpected(("1234"));
  ec.verify();  // fails because no value
}


void ExpectationSegment_test::test_ifNoExpected()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("nothingSegment"), 0);
  ec.setActual(("1234")); // no fail yet
}


void doNothing(mockpp::ExpectationSegment<mockpp::String> &ec)
{
  ec.setExpected(("1234"));
  ec.setExpectNothing();
}


void ExpectationSegment_test::test_expectNothing()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("nothingSegment"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationSegment_test::fail_expectNothing()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("nothingSegment"), 0);
  doNothing(ec);
  ec.setActual(("1234"));  // fails even if equal
}


void doActualImmediate(mockpp::ExpectationSegment<mockpp::String> &ec)
{
  ec.setExpected(("23"));
  ec.setActual(("1234"));
}


void ExpectationSegment_test::test_expectActualImmediate()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("actualSegment"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationSegment_test::fail_expectActualImmediate()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("actualSegment"), 0);
  doActualImmediate(ec);
  ec.setActual(("4321")); // fails
}


void doActualVerify(mockpp::ExpectationSegment<mockpp::String> &ec)
{
  ec.setExpected(("23"));
  ec.setFailOnVerify();
  ec.setActual(("4321")); // should not fail
}


void ExpectationSegment_test::test_expectActualVerify()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("verifySegment"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationSegment_test::fail_expectActualVerify()
{
  mockpp::ExpectationSegment<mockpp::String> ec (("verifySegment"), 0);
  doActualVerify(ec); // no fail
  ec.verify();        // fails
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationSet_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationSet_test.cpp
/***************************************************************************
   ExpectationSet_test.cpp  -  unit tests for ExpectationSet class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationSet_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationSet.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationSet_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationSet_test );

  CPPUNIT_TEST(test_hasExpectations);
  CPPUNIT_TEST(test_name);
  CPPUNIT_TEST(test_clearActual);
  CPPUNIT_TEST(test_many);

  CPPUNIT_TEST(test_expectNothing);
  CPPUNIT_TEST(test_expectActualImmediate);
  CPPUNIT_TEST(test_expectActualVerify);
  CPPUNIT_TEST(test_ifNoExpected);

  CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_many, mockpp::AssertionFailedError);

  CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void fail_many();
   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void test_many();
   void fail_ifNoActual();
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationSet_test);


void ExpectationSet_test::test_name()
{
  mockpp::ExpectationSet<int> ec (("testSet"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testSet")));
}


void ExpectationSet_test::test_hasExpectations()
{
  mockpp::ExpectationSet<int> ec (("testSet"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.addExpected(2);
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationSet_test::test_clearActual()
{
  mockpp::ExpectationSet<int> ec (("testSet"), 0);
  ec.addExpected(3);
  ec.clearActual();
}


void ExpectationSet_test::test_ifNoExpected()
{
  mockpp::ExpectationSet<int> ec (("nothingSet"), 0);
  ec.addActual(3); // fails because no expectation value
}


void ExpectationSet_test::fail_ifNoActual()
{
  mockpp::ExpectationSet<int> ec (("nothingSet"), 0);
  ec.addExpected(3);
  ec.verify();  // fails because no value
}


void doNothing(mockpp::ExpectationSet<int> &ec)
{
  ec.addExpected(3);
  ec.setExpectNothing();
}


void ExpectationSet_test::test_expectNothing()
{
  mockpp::ExpectationSet<int> ec (("nothingSet"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationSet_test::fail_expectNothing()
{
  mockpp::ExpectationSet<int> ec (("nothingSet"), 0);
  doNothing(ec);
  ec.addActual(3);  // fails even if equal
}


void ExpectationSet_test::test_many()
{
  mockpp::ExpectationSet<int> ec (("actualSet"), 0);
  int exp_prep[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  int act_prep[10] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };

  ec.addExpected(exp_prep+0, exp_prep+10);
  ec.addActual(act_prep+0, act_prep+10);
}


void ExpectationSet_test::fail_many()
{
  mockpp::ExpectationSet<int> ec (("actualSet"), 0);

  int exp_prep[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  int act_prep[10] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };

  ec.addExpected(exp_prep+0, exp_prep+10);
  ec.addActual(act_prep+2, act_prep+10);
}


void doActualImmediate(mockpp::ExpectationSet<int> &ec)
{
  ec.addExpected(1234);
  ec.addExpected(5678);
  ec.addExpected(8765);
  ec.addExpected(4321);

  ec.addActual(1234);
  ec.addActual(5678);
  ec.addActual(8765);
  ec.addActual(4321);
}


void ExpectationSet_test::test_expectActualImmediate()
{
  mockpp::ExpectationSet<int> ec (("actualSet"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationSet_test::fail_expectActualImmediate()
{
  mockpp::ExpectationSet<int> ec (("actualSet"), 0);
  doActualImmediate(ec);
  ec.addActual(1111); // fails
}


void doActualVerify(mockpp::ExpectationSet<int> &ec)
{
  ec.addExpected(1234);
  ec.setFailOnVerify();
  ec.addActual(4321); // should not fail
}


void ExpectationSet_test::test_expectActualVerify()
{
  mockpp::ExpectationSet<int> ec (("verifySet"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationSet_test::fail_expectActualVerify()
{
  mockpp::ExpectationSet<int> ec (("verifySet"), 0);
  doActualVerify(ec); // no fail
  ec.verify();        // fails
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationValue_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ExpectationValue_test.cpp
/***************************************************************************
   ExpectationValue_test.cpp  -  unit tests for ExpectationValue class
                             -------------------
    begin                : Sat Dez 28 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ExpectationValue_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class ExpectationValue_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ExpectationValue_test );

  CPPUNIT_TEST(test_hasExpectations);
  CPPUNIT_TEST(test_name);
  CPPUNIT_TEST(test_clearActual);

  CPPUNIT_TEST(test_expectNothing);
  CPPUNIT_TEST(test_expectActualImmediate);
  CPPUNIT_TEST(test_expectActualVerify);
  CPPUNIT_TEST(test_ifNoExpected);

  CPPUNIT_TEST_EXCEPTION(fail_expectActualImmediate, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectActualVerify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_expectNothing, mockpp::AssertionFailedError);

  CPPUNIT_TEST_EXCEPTION(fail_ifNoActual, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_expectNothing();
   void fail_expectNothing();

   void test_expectActualImmediate();
   void fail_expectActualImmediate();

   void test_expectActualVerify();
   void fail_expectActualVerify();

   void test_name();
   void test_clearActual();
   void test_hasExpectations();
   void test_ifNoExpected();

   void fail_ifNoActual();
};

CPPUNIT_TEST_SUITE_REGISTRATION(ExpectationValue_test);


void ExpectationValue_test::test_name()
{
  mockpp::ExpectationValue<int> ec (("testValue"), 0);
  CPPUNIT_ASSERT(ec.getName() == (("testValue")));
}


void ExpectationValue_test::test_hasExpectations()
{
  mockpp::ExpectationValue<int> ec (("testValue"), 0);
  CPPUNIT_ASSERT(false == ec.hasExpectations());
  ec.setExpected(2);
  CPPUNIT_ASSERT(true == ec.hasExpectations());
}


void ExpectationValue_test::test_clearActual()
{
  mockpp::ExpectationValue<int> ec (("testValue"), 0);
  ec.setExpected(3);
  ec.clearActual();
}


void ExpectationValue_test::test_ifNoExpected()
{
  mockpp::ExpectationValue<int> ec (("nothingValue"), 0);
  ec.setActual(3); // fails because no expectation value
}


void ExpectationValue_test::fail_ifNoActual()
{
  mockpp::ExpectationValue<int> ec (("nothingValue"), 0);
  ec.setExpected(3);
  ec.verify();  // fails because no value
}


void doNothing(mockpp::ExpectationValue<int> &ec)
{
  ec.setExpected(3);
  ec.setExpectNothing();
}


void ExpectationValue_test::test_expectNothing()
{
  mockpp::ExpectationValue<int> ec (("nothingValue"), 0);
  doNothing(ec);
  ec.verify();  // no fail
}


void ExpectationValue_test::fail_expectNothing()
{
  mockpp::ExpectationValue<int> ec (("nothingValue"), 0);
  doNothing(ec);
  ec.setActual(3);  // fails even if equal
}


void doActualImmediate(mockpp::ExpectationValue<int> &ec)
{
  ec.setExpected(1234);
  ec.setActual(1234);
}


void ExpectationValue_test::test_expectActualImmediate()
{
  mockpp::ExpectationValue<int> ec (("actualValue"), 0);
  doActualImmediate(ec);
  ec.verify(); // no fail
}


void ExpectationValue_test::fail_expectActualImmediate()
{
  mockpp::ExpectationValue<int> ec (("actualValue"), 0);
  doActualImmediate(ec);
  ec.setActual(4321); // fails
}


void doActualVerify(mockpp::ExpectationValue<int> &ec)
{
  ec.setExpected(1234);
  ec.setFailOnVerify();
  ec.setActual(4321); // should not fail
}


void ExpectationValue_test::test_expectActualVerify()
{
  mockpp::ExpectationValue<int> ec (("verifyValue"), 0);
  doActualVerify(ec); // no fail
}


void ExpectationValue_test::fail_expectActualVerify()
{
  mockpp::ExpectationValue<int> ec (("verifyValue"), 0);
  doActualVerify(ec); // no fail
  ec.verify(); // fails
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/Formatter_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/Formatter_test.cpp
/***************************************************************************
             Formatter_test.cpp  -  unit tests for Formatter class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Formatter_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.9  2003/04/25 12:49:07  ewald-arnold
    typo

    Revision 1.8  2003/04/13 16:51:53  ewald-arnold
    fix for g++ 2.95

    Revision 1.7  2003/04/10 21:05:57  ewald-arnold
    extended tests

    Revision 1.6  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.5  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.4  2003/01/06 13:35:22  ewald-arnold
    use mockpp exception
    changes due to new macros

    Revision 1.3  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.2  2002/12/31 13:29:41  ewald-arnold
    fix for unicode

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#include <cstdio>

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/compat/Formatter.h>
#include <mockpp/compat/Assert.h>
#include <mockpp/compat/AssertionFailedError.h>

#include <cppunit/extensions/HelperMacros.h>

class Formatter_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( Formatter_test );

 CPPUNIT_TEST(test_fmt_int);
 CPPUNIT_TEST(test_fmt_uint);
 CPPUNIT_TEST(test_fmt_long);
 CPPUNIT_TEST(test_fmt_ulong);
 CPPUNIT_TEST(test_fmt_String);
 CPPUNIT_TEST(test_fmt_Char);
 CPPUNIT_TEST(test_fmt_float);
 CPPUNIT_TEST(test_fmt_double);

 CPPUNIT_TEST(test_number_long_range);
 CPPUNIT_TEST(test_number_ulong_range);
 CPPUNIT_TEST(test_number_ulong_oct);
 CPPUNIT_TEST(test_number_ulong_hex);
 CPPUNIT_TEST(test_number_long_hex);
 CPPUNIT_TEST(test_number_min_long_hex);
 CPPUNIT_TEST(test_number_min_long_dec);
 CPPUNIT_TEST(test_number_max_ulong_dec);
 CPPUNIT_TEST(test_number_max_long_dec);
 CPPUNIT_TEST(test_number_double);

 CPPUNIT_TEST_EXCEPTION(fail_base_long_37, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_base_ulong_37, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_base_long_1, mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_base_ulong_1, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:
   void fail_base_long_37();
   void fail_base_ulong_37();
   void fail_base_long_1();
   void fail_base_ulong_1();

   void test_number_double();
   void test_number_long_hex();
   void test_number_ulong_hex();
   void test_number_max_long_dec();
   void test_number_max_ulong_dec();
   void test_number_min_long_hex();
   void test_number_min_long_dec();
   void test_number_ulong_oct();
   void test_number_long_range();
   void test_number_ulong_range();

   void test_fmt_int();
   void test_fmt_uint();
   void test_fmt_long();
   void test_fmt_ulong();
   void test_fmt_String();
   void test_fmt_Char();
   void test_fmt_float();
   void test_fmt_double();
};


CPPUNIT_TEST_SUITE_REGISTRATION(Formatter_test);


void Formatter_test::fail_base_long_37()
{
  mockpp::String hexstr = mockpp::number((long)12, 37);
}


void Formatter_test::fail_base_ulong_37()
{
  mockpp::String hexstr = mockpp::number((unsigned long)12, 37);
}


void Formatter_test::fail_base_long_1()
{
  mockpp::String hexstr = mockpp::number((long)12, 1);
}


void Formatter_test::fail_base_ulong_1()
{
  mockpp::String hexstr = mockpp::number((unsigned long)12, 1);
}


void Formatter_test::test_number_double()
{
  mockpp::String str = mockpp::number((double) 1.2345678, 3);
  MOCKPP_ASSERT_EQUALS(("1.23"), str);

  str = mockpp::number((double) 1.2345678, 6);
  MOCKPP_ASSERT_EQUALS(("1.23457"), str); // is rounded !!
}


void Formatter_test::test_number_ulong_oct()
{
  mockpp::String str = mockpp::number((long)12345678, 8);
  MOCKPP_ASSERT_EQUALS(("57060516"), str);
}

#include <iostream>

void Formatter_test::test_number_min_long_dec()
{
  long ul = INT_MIN;

  mockpp::String str = mockpp::number(ul);  // base 10
  char buff[100];
#if defined(_MSC_VER)
   sprintf( buff, "%ld", ul );
#else
   std::sprintf(buff, "%ld", ul );
#endif

#ifdef MOCKPP_UNICODE
   mockpp::String traditional = mockpp::getUnicode(buff);
#else
   mockpp::String traditional(buff);
#endif

  MOCKPP_ASSERT_EQUALS(traditional, str);
}


void Formatter_test::test_number_min_long_hex()
{
  long ul = INT_MIN;

  mockpp::String str = mockpp::number(ul, 16);
  MOCKPP_ASSERT_EQUALS(("-80000000"), str); // differs from sprintf(..)
}


void Formatter_test::test_number_max_long_dec()
{
  long ul = INT_MAX;

  mockpp::String str = mockpp::number(ul);  // base 10
  char buff[100];
#if defined(_MSC_VER)
   sprintf( buff, "%ld", ul );
#else
   std::sprintf(buff, "%ld", ul );
#endif

#ifdef MOCKPP_UNICODE
   mockpp::String traditional = mockpp::getUnicode(buff);
#else
   mockpp::String traditional(buff);
#endif

  MOCKPP_ASSERT_EQUALS(traditional, str);
}


void Formatter_test::test_number_max_ulong_dec()
{
  unsigned long ul = UINT_MAX;

  mockpp::String str = mockpp::number(ul);  // base 10
  char buff[100];
#if defined(_MSC_VER)
   sprintf( buff, "%lu", ul );
#else
   std::sprintf(buff, "%lu", ul );
#endif

#ifdef MOCKPP_UNICODE
   mockpp::String traditional = mockpp::getUnicode(buff);
#else
   mockpp::String traditional(buff);
#endif

  MOCKPP_ASSERT_EQUALS(traditional, str);
}


void Formatter_test::test_number_long_hex()
{
  mockpp::String hexstr = mockpp::number((long)-0x12345678, 16);
  MOCKPP_ASSERT_EQUALS(("-12345678"), hexstr);

  hexstr = mockpp::number((long)0x12345678, 16);
  MOCKPP_ASSERT_EQUALS(("12345678"), hexstr);

  hexstr = mockpp::number((long)-1, 16);
  MOCKPP_ASSERT_EQUALS(("-1"), hexstr);
}


void Formatter_test::test_number_ulong_hex()
{
  mockpp::String hexstr = mockpp::number((unsigned long)0x12345678, 16);
  MOCKPP_ASSERT_EQUALS(("12345678"), hexstr);

  hexstr = mockpp::number((unsigned long)0xffffffff, 16);
  MOCKPP_ASSERT_EQUALS(("ffffffff"), hexstr); // lower case
}


void Formatter_test::test_number_long_range()
{
  for (unsigned i = 2; i <= 36; ++i)
    mockpp::String hexstr = mockpp::number((long)12, i);
}


void Formatter_test::test_number_ulong_range()
{
  for (unsigned i = 2; i <= 36; ++i)
    mockpp::String hexstr = mockpp::number((unsigned long)12, i);
}


void Formatter_test::test_fmt_int()
{
  mockpp::String fmt (("%9%8%7%6%5%4%3%2%1%0"));
  fmt << (int) 0
      << (int) 1
      << (int) 2
      << (int) 3
      << (int) 4
      << (int) 5
      << (int) 6
      << (int) 7
      << (int) 8
      << (int) 9;

  MOCKPP_ASSERT_EQUALS(fmt, ("9876543210"));
}


void Formatter_test::test_fmt_uint()
{
  mockpp::String fmt (("%9%8%7%6%5%4%3%2%1%0"));
  fmt << (unsigned int) 0
      << (unsigned int) 1
      << (unsigned int) 2
      << (unsigned int) 3
      << (unsigned int) 4
      << (unsigned int) 5
      << (unsigned int) 6
      << (unsigned int) 7
      << (unsigned int) 8
      << (unsigned int) 9;

  MOCKPP_ASSERT_EQUALS(fmt, ("9876543210"));
}


void Formatter_test::test_fmt_long()
{
  mockpp::String fmt (("%9%8%7%6%5%4%3%2%1%0"));
  fmt << (long) 0
      << (long) 1
      << (long) 2
      << (long) 3
      << (long) 4
      << (long) 5
      << (long) 6
      << (long) 7
      << (long) 8
      << (long) 9;

  MOCKPP_ASSERT_EQUALS(fmt, ("9876543210"));
}


void Formatter_test::test_fmt_ulong()
{
  mockpp::String fmt (("%9%8%7%6%5%4%3%2%1%0"));
  fmt << (unsigned long) 0
      << (unsigned long) 1
      << (unsigned long) 2
      << (unsigned long) 3
      << (unsigned long) 4
      << (unsigned long) 5
      << (unsigned long) 6
      << (unsigned long) 7
      << (unsigned long) 8
      << (unsigned long) 9;

  MOCKPP_ASSERT_EQUALS(fmt, ("9876543210"));
}


void Formatter_test::test_fmt_String()
{
  mockpp::String fmt (("%9%8%7%6%5%4%3%2%1%0"));
  fmt << ("0")
      << ("1")
      << ("2")
      << ("3")
      << ("4")
      << ("5")
      << ("6")
      << ("7")
      << ("8")
      << ("9");

  MOCKPP_ASSERT_EQUALS(fmt, ("9876543210"));
}


void Formatter_test::test_fmt_Char()
{
  mockpp::String fmt (("%9%8%7%6%5%4%3%2%1%0"));
  fmt << ('0')
      << ('1')
      << ('2')
      << ('3')
      << ('4')
      << ('5')
      << ('6')
      << ('7')
      << ('8')
      << ('9');

  MOCKPP_ASSERT_EQUALS(fmt, ("9876543210"));
}


void Formatter_test::test_fmt_float()
{
  mockpp::String fmt (("==%0=="));
  fmt << (float) 1.2;
  MOCKPP_ASSERT_EQUALS(fmt, ("==1.2=="));
}


void Formatter_test::test_fmt_double()
{
  mockpp::String fmt (("==%0=="));
  fmt << (double) 1.2;
  MOCKPP_ASSERT_EQUALS(fmt, ("==1.2=="));
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/Makefile.am
mock_test_subfiles           = VisitableMockObject_test.cpp \
                               Formatter_test.cpp \
                               Throwable_test.cpp \
                               ThrowableList_test.cpp \
                               ExpectationCounter_test.cpp \
                               ExpectationCounterRange_test.cpp \
                               ExpectationMap_test.cpp \
                               ExpectationList_test.cpp \
                               ExpectationSet_test.cpp \
                               ExpectationSegment_test.cpp \
                               ExpectationValue_test.cpp \
                               ExpectationBoundary_test.cpp \
                               Verifiable_test.cpp \
                               Exception_test.cpp \
                               mockpp_test.cpp \
                               ReturnObjectList_test.cpp \
                               VisitableMockObject_template_test.cpp \
                               Assert_test.cpp \
                               AssertMo_test.cpp \
                               MockObject_test.cpp \
                               VisitableMockObject_1_test.cpp \
                               VisitableMockObject_2_test.cpp \
                               VisitableMockObject_3_test.cpp \
                               VisitableMockObject_4_test.cpp \
                               VisitableMockObject_5_test.cpp \
                               VisitableMockObject_void_test.cpp \
                               VisitableMockObject_1_void_test.cpp \
                               VisitableMockObject_2_void_test.cpp \
                               VisitableMockObject_3_void_test.cpp \
                               VisitableMockObject_4_void_test.cpp \
                               VisitableMockObject_5_void_test.cpp

EXTRA_DIST =

#if HAVE_QT
#if HAVE_QTRUNNER
#qtrunner_includes= -I$(QTDIR)/include
#endif
#endif

INCLUDES = -I.  -I$(srcdir)/../..

CLEANFILES = *.~* *.~~* *~

#if HAVE_QT
#if HAVE_QTRUNNER
#qtrunner_ldadd = -L$(QTRUNNERDIR) -L$(QTDIR)/lib -l$(QTLIB) -l$(QTRUNNER)
#endif
#endif

#mock_test_qt_LDADD  = ../libmockpp.la $(LIBCPPUNIT) $(qtrunner_ldadd) $(EA_EXTRA_LIB)
#mock_test_LDADD     = ../libmockpp.la $(LIBCPPUNIT) $(EA_EXTRA_LIB)
mock_test_LDADD     = ../libmockpp.a $(LIBCPPUNIT) $(EA_EXTRA_LIB)
#compilecheck_LDADD = ../libmockpp.la $(LIBCPPUNIT) $(EA_EXTRA_LIB)
AM_LDFLAGS          = $(all_libraries)

#if HAVE_QT
#if HAVE_QTRUNNER
#qtrunner_prog = mock_test_qt
#endif
#endif


#check_PROGRAMS = mock_test $(qtrunner_prog)
check_PROGRAMS = mock_test
#compilecheck

#all: check

#compilecheck_SOURCES         = compilecheck.cpp

#if HAVE_QT
#if HAVE_QTRUNNER
#mock_test_qt_SOURCES         = mock_test_qt.cpp $(mock_test_subfiles)
#endif
#endif

mock_test_SOURCES            = mock_test.cpp $(mock_test_subfiles)

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/MockObject_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/MockObject_test.cpp
/***************************************************************************
             MockObject_test.cpp  -  unit tests for MockObject class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: MockObject_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.12  2003/04/25 12:51:39  ewald-arnold
    workaround for msvc

    Revision 1.11  2003/04/13 16:51:12  ewald-arnold
    simplified MockObject::verify()

    Revision 1.10  2003/03/08 14:37:07  ewald-arnold
    changes for Borland BCB

    Revision 1.9  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/08 08:15:27  ewald-arnold
    refactoring for removed ExpectationCounterRange

    Revision 1.7  2003/01/16 18:20:36  ewald-arnold
    BCB5 fix

    Revision 1.6  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.5  2003/01/04 13:09:57  ewald-arnold
    fix cr-lf

    Revision 1.4  2003/01/04 12:24:39  ewald-arnold
    port to BCB5

    Revision 1.3  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.2  2002/12/31 13:30:11  ewald-arnold
    additional check

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/MockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class MockObject_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( MockObject_test );

  CPPUNIT_TEST(test_left_deep_verify);
  CPPUNIT_TEST(test_right_deep_verify);
  CPPUNIT_TEST(test_deep_verify);

  CPPUNIT_TEST_EXCEPTION(fail_left_deep_verify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_right_deep_verify, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_deep_verify_1, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_deep_verify_2, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_left_deep_verify();
   void test_right_deep_verify();

   void fail_left_deep_verify();
   void fail_right_deep_verify();

   void test_deep_verify();

   void fail_deep_verify_1();
   void fail_deep_verify_2();
};


 CPPUNIT_TEST_SUITE_REGISTRATION(MockObject_test);


class MyMockObject : public mockpp::MockObject
{
  public:
    typedef mockpp::ExpectationValue<int> evi_t;

    MyMockObject (mockpp::VerifiableList *parent = 0)
     : mockpp::MockObject(("mo"), parent),
       lev1a(("lev1a"), this),
       lev1b(("lev1b"), this)
    {
    }

  
    void execTest()
    {
      lev1a.setFailOnVerify();
      lev1a.setExpected(12345);
      lev1a.setActual(12345);
    }

    
    void execFail()
    {
      lev1a.setFailOnVerify();
      lev1a.setExpected(12345);
      lev1a.setActual(54321);
    }


    // make public for test purposes
    unsigned numVerifiables() const
    {
# ifdef _MSC_VER
      return VerifiableList::numVerifiables();
#else
      return mockpp::VerifiableList::numVerifiables();
#endif      
    }

  private:
    evi_t lev1a;
    evi_t lev1b;
};


void MockObject_test::test_left_deep_verify()
{
  MyMockObject mo_rt;
  MyMockObject mo_left(&mo_rt);
  MyMockObject mo_right(&mo_rt);

  CPPUNIT_ASSERT(4 == mo_rt.numVerifiables()); // two internal, two external children

  mo_left.execTest();
  mo_rt.verify();
}


void MockObject_test::test_right_deep_verify()
{
  MyMockObject mo_rt;
  MyMockObject mo_left(&mo_rt);
  MyMockObject mo_right(&mo_rt);

  CPPUNIT_ASSERT(4 == mo_rt.numVerifiables()); // two internal, two external children

  mo_right.execTest();
  mo_rt.verify();
}


void MockObject_test::fail_left_deep_verify()
{
  MyMockObject mo_rt;
  MyMockObject mo_left(&mo_rt);
  MyMockObject mo_right(&mo_rt);

  mo_left.execFail();
  mo_rt.verify();
}


void MockObject_test::fail_right_deep_verify()
{
  MyMockObject mo_rt;
  MyMockObject mo_left(&mo_rt);
  MyMockObject mo_right(&mo_rt);

  mo_right.execFail();
  mo_rt.verify();
}


void MockObject_test::test_deep_verify()
{
  typedef mockpp::ExpectationValue<int> evi_t;

  mockpp::MockObject root(("root"), 0);

  mockpp::MockObject lev1a(("lev1a"), &root);
  mockpp::MockObject lev1b(("lev1b"), &root);

  evi_t lev21a(("lev21a"), &lev1a);
  evi_t lev21b(("lev21b"), &lev1a);

  evi_t lev22a(("lev22a"), &lev1b);
  evi_t lev22b(("lev22b"), &lev1b);

  lev22a.setFailOnVerify();
  lev22a.setExpected(12345);
  lev22a.setActual(12345);

  lev21a.setFailOnVerify();
  lev21a.setExpected(12345);
  lev21a.setActual(12345);

  root.verify(); // follow chain without fail
}


void MockObject_test::fail_deep_verify_1()
{
  typedef mockpp::ExpectationValue<int> evi_t;

  mockpp::MockObject root(("root"), 0);

  mockpp::MockObject lev1a(("lev1a"), &root);
  mockpp::MockObject lev1b(("lev1b"), &root);

  evi_t lev21a(("lev21a"), &lev1a);
  evi_t lev21b(("lev21b"), &lev1a);

  evi_t lev22a(("lev22a"), &lev1b);
  evi_t lev22b(("lev22b"), &lev1b);

  lev21a.setFailOnVerify();
  lev21a.setExpected(12345);
  lev21a.setActual(54321);

  root.verify();  // follow chain and fail
}


void MockObject_test::fail_deep_verify_2()
{
  typedef mockpp::ExpectationValue<int> evi_t;

  mockpp::MockObject root(("root"), 0);

  mockpp::MockObject lev1a(("lev1a"), &root);
  mockpp::MockObject lev1b(("lev1b"), &root);

  evi_t lev21a(("lev21a"), &lev1a);
  evi_t lev21b(("lev21b"), &lev1a);

  evi_t lev22a(("lev22a"), &lev1b);
  evi_t lev22b(("lev22b"), &lev1b);

  lev22a.setFailOnVerify();
  lev22a.setExpected(12345);
  lev22a.setActual(54321);

  root.verify();  // follow chain and fail
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ReturnObjectList_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ReturnObjectList_test.cpp
/***************************************************************************
             ReturnObjectList_test.cpp  -  unit tests for ReturnObjectList class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ReturnObjectList_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/02/16 17:33:59  ewald-arnold
    additional tests

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ReturnObjectList.h>

#include <cppunit/extensions/HelperMacros.h>

class ReturnObjectList_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ReturnObjectList_test );

 CPPUNIT_TEST(test_get_object);

 CPPUNIT_TEST_EXCEPTION(fail_get_object,   mockpp::AssertionFailedError);
 CPPUNIT_TEST_EXCEPTION(fail_not_empty,   mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_get_object();

   void fail_get_object();
   void fail_not_empty();
};


CPPUNIT_TEST_SUITE_REGISTRATION(ReturnObjectList_test);


void ReturnObjectList_test::test_get_object()
{
  mockpp::ReturnObjectList<char> rol (("data"), 0);

  char buff[] = "abcdefg";

  rol.addObjectToReturn('1');
  rol.addObjectToReturn('2');
  rol.addObjectToReturn(buff, buff+sizeof(buff)-1); // take care of trailing '\0'!
  rol.addObjectToReturn('3');
  rol.addObjectToReturn('4');

  CPPUNIT_ASSERT(rol.hasMoreObjects());
  
  CPPUNIT_ASSERT('1' == rol.nextReturnObject());
  CPPUNIT_ASSERT('2' == rol.nextReturnObject());
  CPPUNIT_ASSERT('a' == rol.nextReturnObject());
  CPPUNIT_ASSERT('b' == rol.nextReturnObject());
  CPPUNIT_ASSERT('c' == rol.nextReturnObject());
  CPPUNIT_ASSERT('d' == rol.nextReturnObject());
  CPPUNIT_ASSERT('e' == rol.nextReturnObject());
  CPPUNIT_ASSERT('f' == rol.nextReturnObject());
  CPPUNIT_ASSERT('g' == rol.nextReturnObject());
  CPPUNIT_ASSERT('3' == rol.nextReturnObject());
  CPPUNIT_ASSERT('4' == rol.nextReturnObject());
  
  CPPUNIT_ASSERT(!rol.hasMoreObjects());
  
  rol.verify();
}


void ReturnObjectList_test::fail_get_object()
{
  mockpp::ReturnObjectList<char> rol (("data"), 0);

  char buff[] = "1234";
  rol.addObjectToReturn(buff, buff+sizeof(buff)-1);  // take care of trailing '\0'!
  rol.nextReturnObject();
  rol.nextReturnObject();
  rol.nextReturnObject();
  rol.nextReturnObject();
  rol.nextReturnObject();  // fail
}


void ReturnObjectList_test::fail_not_empty()
{
  mockpp::ReturnObjectList<char> rol (("data"), 0);

  char buff[] = "1234";
  rol.addObjectToReturn(buff, buff+sizeof(buff));
  rol.verify();
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/ThrowableList_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/ThrowableList_test.cpp
/***************************************************************************
 ThrowableList_test.cpp  -  unit tests for ThrowableList class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: ThrowableList_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/04/09 19:06:40  ewald-arnold
    update

    Revision 1.4  2003/02/21 11:58:29  ewald-arnold
    more tests

    Revision 1.3  2003/02/20 18:51:08  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.1  2003/02/16 17:35:19  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ThrowableList.h>
#include <mockpp/Throwable.h>

#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>


class ThrowableList_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( ThrowableList_test );

  CPPUNIT_TEST(test_throw);
  CPPUNIT_TEST(test_at);
  CPPUNIT_TEST(test_setter);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_throw();
   void test_at();
   void test_setter();
};


 CPPUNIT_TEST_SUITE_REGISTRATION(ThrowableList_test);
  

void ThrowableList_test::test_throw()
{
  mockpp::ThrowableList tl(("tl"), 0);
  tl.push_back(mockpp::make_throwable(std::string("my-item 1")));
  tl.push_back(std::string("my-item 2"));

  try
  {
    tl.nextThrowableObject()->throw_me();
    MOCKPP_FAIL(("Did not throw the exception"));
  }
  catch(std::string &s)
  {
    MOCKPP_ASSERT_TRUE(s == "my-item 1");
  }
  catch(...)
  {
    MOCKPP_FAIL(("Caught unexpected exception"));
  }

  try
  {
    tl.nextThrowableObject()->throw_me();
    MOCKPP_FAIL(("Did not throw the exception"));
  }
  catch(std::string &s)
  {
    MOCKPP_ASSERT_TRUE(s == "my-item 2");
  }
  catch(...)
  {
    MOCKPP_FAIL(("Caught unexpected exception"));
  }
  CPPUNIT_ASSERT(tl.hasMoreObjects() == false);
  tl.verify();
}


void ThrowableList_test::test_at()
{
  mockpp::ThrowableList tl(("tl"), 0);

  mockpp::Throwable *tt1 = mockpp::make_throwable(std::string("my-item 1"));
  mockpp::Throwable *tt2 = mockpp::make_throwable(std::string("my-item 2"));
  mockpp::Throwable *tt3 = mockpp::make_throwable(std::string("my-item 3"));
  mockpp::Throwable *tt4 = mockpp::make_throwable(std::string("my-item 4"));

  tl.push_back(tt1);
  tl.push_back(tt2);
  tl.push_back(tt3);
  tl.push_back(tt4);

  CPPUNIT_ASSERT(tl.at(0) == tt1); 
  CPPUNIT_ASSERT(tl.at(1) == tt2);
  CPPUNIT_ASSERT(tl.at(2) == tt3);
  CPPUNIT_ASSERT(tl.at(3) == tt4);

  tl.nextThrowableObject();         // shift objects internally
  tl.nextThrowableObject();

  CPPUNIT_ASSERT(tl.at(0) == tt1);  // still get the correct objects
  CPPUNIT_ASSERT(tl.at(1) == tt2);
  CPPUNIT_ASSERT(tl.at(2) == tt3);
  CPPUNIT_ASSERT(tl.at(3) == tt4);

  tl.nextThrowableObject();  
  tl.nextThrowableObject();

  CPPUNIT_ASSERT(tl.at(0) == tt1);  // still get the correct objects
  CPPUNIT_ASSERT(tl.at(1) == tt2);
  CPPUNIT_ASSERT(tl.at(2) == tt3);
  CPPUNIT_ASSERT(tl.at(3) == tt4);

  tl.verify();
}


void ThrowableList_test::test_setter()
{
  mockpp::ThrowableList tl(("tl"), 0);

  mockpp::Throwable *tt1 = mockpp::make_throwable(std::string("my-item 1"));
  tl.push_back(tt1);
  CPPUNIT_ASSERT(tl.hasMoreObjects() == true);
  tl.push_back(mockpp::make_throwable(std::string("my-item 2")));
  tl.push_back(std::string("my-item 3"));
  tl.push_back(std::string("my-item 4"));

  CPPUNIT_ASSERT(tl.hasMoreObjects() == true);

  CPPUNIT_ASSERT(tl.nextThrowableObject() == tt1);
  
  tl.clear();
  CPPUNIT_ASSERT(tl.hasMoreObjects() == false);
  tl.verify();
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/Throwable_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/Throwable_test.cpp
/***************************************************************************
         Throwable_test.cpp  -  unit tests for Throwable class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Throwable_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/03/06 20:58:09  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.3  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.1  2003/02/16 17:35:19  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/Throwable.h>
#include <mockpp/compat/Assert.h>
#include <mockpp/util/AssertMo.h>

#include <cppunit/extensions/HelperMacros.h>

class Throwable_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( Throwable_test );

  CPPUNIT_TEST(test_getter);
  CPPUNIT_TEST(test_used);
  CPPUNIT_TEST(test_throw);
  CPPUNIT_TEST(test_clear);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_getter();
   void test_used();
   void test_throw();
   void test_clear();
};


 CPPUNIT_TEST_SUITE_REGISTRATION(Throwable_test);


void Throwable_test::test_getter()
{
  CPPUNIT_ASSERT(0 == mockpp::ThrowableItem().get());
  
  mockpp::Throwable* tt1 = mockpp::make_throwable (123);
  mockpp::Throwable* tt2 = mockpp::make_throwable (123);
  
  mockpp::ThrowableItem it (tt1);
  CPPUNIT_ASSERT(tt1 == it.get());

  it.take(tt2);
  CPPUNIT_ASSERT(tt2 == it.get());
  
  it.take(0);
}


void Throwable_test::test_throw()
{
  mockpp::ThrowableItem it;
  it.take(std::string("my-item"));
  try
  {
    it.get()->throw_me();
    MOCKPP_FAIL(("Did not throw the exception"));
  }
  catch(std::string &s) 
  {
    MOCKPP_ASSERT_TRUE(s == "my-item");
  }
  catch(...)
  {
    MOCKPP_FAIL(("Caught unexpected exception"));
  }
}


void Throwable_test::test_used()
{
  mockpp::ThrowableItem it;
  it.take(std::string("my-item"));
  
  CPPUNIT_ASSERT(false == it.get()->hasThrown());

  MOCKPP_ASSERT_THROWING(it.get()->throw_me(), ("throw"),
                         std::string, "my-item");
  
  CPPUNIT_ASSERT(true == it.get()->hasThrown());
}


void Throwable_test::test_clear()
{
  mockpp::ThrowableItem it;
  it.take(std::string("my-item"));
  
  CPPUNIT_ASSERT(it.get() != 0);
  it.clear();
  CPPUNIT_ASSERT(it.get() == 0);
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/Verifiable_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/Verifiable_test.cpp
/***************************************************************************
             Verifiable_test.cpp  -  unit tests for Verifiable class
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: Verifiable_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.9  2003/04/25 12:46:29  ewald-arnold
    workaround for msvc

    Revision 1.8  2003/04/13 16:50:18  ewald-arnold
    moved name to Verifiable class

    Revision 1.7  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.6  2003/02/08 08:15:27  ewald-arnold
    refactoring for removed ExpectationCounterRange

    Revision 1.5  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.4  2003/01/04 13:09:57  ewald-arnold
    fix cr-lf

    Revision 1.3  2003/01/04 12:24:39  ewald-arnold
    port to BCB5

    Revision 1.2  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VerifiableList.h>

#include <cppunit/extensions/HelperMacros.h>

class Verifiable_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( Verifiable_test );

  CPPUNIT_TEST(test_parent);
  CPPUNIT_TEST(test_add);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_add();
   void test_parent();
};


CPPUNIT_TEST_SUITE_REGISTRATION(Verifiable_test);

template <class T>
class MyExpectationValue : public mockpp::ExpectationValue<T>
{
  public:
    MyExpectationValue(const mockpp::String &name, mockpp::VerifiableList *parent)
      : mockpp::ExpectationValue<T>(name, parent)
    {}

    // make public for test purposes
    mockpp::Verifiable* getParent()
    {
#ifdef _MSC_VER
       return Verifiable::getParent();
#else
       return mockpp::Verifiable::getParent();
#endif
    } 
};


class MyVerifiableList : public mockpp::VerifiableList
{
  public:
    MyVerifiableList()
      : mockpp::VerifiableList(("verList"), 0)
    {}

    // make public for test purposes
    virtual void verify()
    {
    }
    
    // make public for test purposes
    mockpp::VerifiableList *getParent() const
    {
#ifdef _MSC_VER
      return Verifiable::getParent();
#else
      return mockpp::Verifiable::getParent();
#endif
    }

    // make public for test purposes
    unsigned numVerifiables() const
    {
#ifdef _MSC_VER
      return VerifiableList::numVerifiables();
#else
      return mockpp::VerifiableList::numVerifiables();
#endif
    }

    // make public for test purposes
    mockpp::Verifiable *getVerifiable(unsigned idx) const
    {
#ifdef _MSC_VER
      return VerifiableList::getVerifiable(idx);
#else
      return mockpp::VerifiableList::getVerifiable(idx);
#endif
    }
};


void Verifiable_test::test_parent()
{
  typedef MyExpectationValue<int> evi_t;

  MyVerifiableList root;
  evi_t lev1a(("lev1a"), &root);

  CPPUNIT_ASSERT(&root == lev1a.getParent());
  CPPUNIT_ASSERT(0 == root.getParent());
}

  
void Verifiable_test::test_add()
{
  typedef MyExpectationValue<int> evi_t;

  MyVerifiableList root;
  CPPUNIT_ASSERT(0 == root.numVerifiables());
  {
    evi_t lev1a(("lev1a"), &root);
    CPPUNIT_ASSERT(1 == root.numVerifiables());

    evi_t lev1b(("lev1b"), &root);
    CPPUNIT_ASSERT(2 == root.numVerifiables());

    CPPUNIT_ASSERT(&lev1a == root.getVerifiable(0));
    CPPUNIT_ASSERT(&lev1b == root.getVerifiable(1));
  }  
  CPPUNIT_ASSERT(0 == root.numVerifiables());
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_1_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_1_test.cpp
/***************************************************************************
                     VisitableMockObject_1_test.cpp  
                                 -  
  unit tests for VisitableMockObject class and 1 parameter methods
                             -------------------
    begin                : Sam Feb 8 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_1_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.4  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.3  2003/02/17 22:04:57  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.2  2003/02/16 18:04:33  ewald-arnold
    updaet

    Revision 1.1  2003/02/16 17:35:19  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>
#include <mockpp/util/AssertMo.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_1_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_1_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_response);
  CPPUNIT_TEST(test_return);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_return, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_value, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_parameter();
   void test_response();
   void test_return();
   void test_clear();
   void test_default_throw();
   
   void fail_unused_value();
   void fail_unused_throwable();
   void fail_parameter();
   void fail_return();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_add_return_after_active();
   void fail_set_return_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_1_test);


class MyVisitableMockObject_1 : public mockpp::VisitableMockObject
{
  public:
  
    MyVisitableMockObject_1(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD1(visitable)
    {}

    MOCKPP_VISITABLE1(MyVisitableMockObject_1, int, visitable, unsigned);

    bool isClear()
    {
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableResponseValues.size() == 0
             && visitableParameter1.size() == 0
             
             && visitablehaveDefaultReturnValue == false
             && visitableDefaultReturnValueUsed == false
             && visitableReturnValues.hasMoreObjects() == false;
    }
};
  

void VisitableMockObject_1_test::test_controller()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  ctr.setDefaultReturnValue(123);
  ctr.addResponseValue(0, 1);
  ctr.addResponseValue(1, 0);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 1);
}


void VisitableMockObject_1_test::test_thrower()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));
  
  mvo.visitable(1);
  mvo.visitable(1);
  mvo.visitable(1);
  mvo.visitable(1);
  
  mvo.activate();
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(1), ("1"), 
                         std::string, "exceptional string 1");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(1), ("2"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(1), ("3"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(1), ("4"), 
                         std::string, "exceptional string 3");
}


void VisitableMockObject_1_test::fail_add_method_after_active()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  mvo.visitable(1);
  mvo.activate();
  mvo.visitable(1);
  mvo.visitable(1);
}


void VisitableMockObject_1_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_1_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_1_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_1_test::fail_parameter()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(111);
  mvo.activate();
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(222);
}


void VisitableMockObject_1_test::fail_add_return_after_active()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addReturnValue(1);
}


void VisitableMockObject_1_test::fail_set_return_after_active()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultReturnValue(1);
}


void VisitableMockObject_1_test::fail_return()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  
  mvo.visitable(1);
  mvo.visitable(2);
  mvo.visitable(3);
  
  mvo.activate();
  
  CPPUNIT_ASSERT(1 == mvo.visitable(1));
  CPPUNIT_ASSERT(11 == mvo.visitable(2));
  mvo.visitable(3);
}


void VisitableMockObject_1_test::test_return()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  
  ctr.setDefaultReturnValue(123);
  ctr.addReturnValue(1, 2);
  ctr.addReturnValue(11, 2);
  
  mvo.visitable(1);
  mvo.visitable(1);
  mvo.visitable(2);
  mvo.visitable(2);
  mvo.visitable(3);
  mvo.visitable(4);
  
  mvo.activate();
  
  CPPUNIT_ASSERT(1 == mvo.visitable(1));
  CPPUNIT_ASSERT(1 == mvo.visitable(1));
  CPPUNIT_ASSERT(11 == mvo.visitable(2));
  CPPUNIT_ASSERT(11 == mvo.visitable(2));
  CPPUNIT_ASSERT(123 == mvo.visitable(3));
  CPPUNIT_ASSERT(123 == mvo.visitable(4));
  mvo.verify();
}


void VisitableMockObject_1_test::test_parameter()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(111);
  mvo.activate();
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(111);
  mvo.verify();
}


void VisitableMockObject_1_test::test_default_throw()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 922);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 911);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  
  mvo.visitable(922);
  mvo.visitable(911);
  mvo.visitable(1);
  mvo.visitable(2);
  mvo.visitable(3);
  
  mvo.activate();
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(922), ("response 1"),
                         std::string, std::string("throw me 1"));
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(911), ("response 2"),
                         std::string, std::string("throw me 2"));
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(1), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2), ("default response"),
                         std::string, std::string("throw default"));
}


void VisitableMockObject_1_test::test_response()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  
  ctr.setDefaultReturnValue(111);
  ctr.addResponseValue(123, 456);
  ctr.addResponseValue(321, 654);
  
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 922);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 911);
  
  mvo.visitable(456);
  mvo.visitable(654);
  mvo.visitable(1);
  mvo.visitable(922);
  mvo.visitable(911);
  mvo.visitable(2);
  mvo.visitable(3);
  
  mvo.activate();

  CPPUNIT_ASSERT(123 == mvo.visitable(456));
  CPPUNIT_ASSERT(321 == mvo.visitable(654));
  CPPUNIT_ASSERT(111 == mvo.visitable(1));
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(922), ("response 1"),
                         std::string, std::string("throw me 1"));
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(911), ("response 2"),
                         std::string, std::string("throw me 2"));

  CPPUNIT_ASSERT(111 == mvo.visitable(2));
  CPPUNIT_ASSERT(111 == mvo.visitable(3));

  mvo.verify();
}  



void VisitableMockObject_1_test::test_clear()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addReturnValue(1);
  ctr.setDefaultReturnValue(123);
  
  ctr.addResponseValue(1, 0);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0);
  mvo.visitable(3);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_1_test::fail_unused_throwable()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


void VisitableMockObject_1_test::fail_unused_value()
{
  MyVisitableMockObject_1 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(111);
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_1_void_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_1_void_test.cpp
/***************************************************************************
                     VisitableMockObject_1_void_test.cpp  
                                 -  
  unit tests for VisitableMockObject class and 1 parameter void methods
                             -------------------
    begin                : Sam Feb 8 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_1_void_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.4  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.3  2003/02/17 22:04:57  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.2  2003/02/16 18:04:33  ewald-arnold
    updaet

    Revision 1.1  2003/02/16 17:35:19  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_1_void_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_1_void_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_clear();
   void test_default_throw();
   void test_parameter();
   
   void fail_unused_throwable();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_parameter();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_1_void_test);


class MyVisitableMockObject_1_void : public mockpp::VisitableMockObject
{
  public:
  
    MyVisitableMockObject_1_void(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD1(visitable)
    {}

    MOCKPP_VOID_VISITABLE1(MyVisitableMockObject_1_void, visitable, int);
    
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableParameter1.size() == 0;
    }
};
  

void VisitableMockObject_1_void_test::test_controller()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 1);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 0);
}


void VisitableMockObject_1_void_test::test_thrower()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  
  mvo.visitable(2);
  mvo.visitable(22);
  mvo.visitable(222);
  mvo.visitable(2222);
  mvo.visitable(22222);
  mvo.visitable(222222);
  
  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(2), ("1"), 
                         std::string, "exceptional string 1");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(22), ("2"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(222), ("3"), 
                         std::string, "exceptional string 2");
  
  mvo.visitable(2222);
  mvo.visitable(22222);
  mvo.visitable(222222);
  mvo.verify();
}


void VisitableMockObject_1_void_test::fail_add_method_after_active()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  mvo.visitable(1);
  mvo.activate();
  mvo.visitable(1);
  mvo.visitable(1);
}


void VisitableMockObject_1_void_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_1_void_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_1_void_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_1_void_test::fail_parameter()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(111);
  mvo.activate();
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(222);
}


void VisitableMockObject_1_void_test::test_parameter()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(111);
  mvo.activate();
  mvo.visitable(1);
  mvo.visitable(11);
  mvo.visitable(111);
  mvo.verify();
}


void VisitableMockObject_1_void_test::test_default_throw()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 922);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 911);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922);
  mvo.visitable(911);
  mvo.visitable(1);
  mvo.visitable(2);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922), ("response 1"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911), ("response 2"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2), ("default response"),
                         std::string, std::string("throw default"));

  mvo.verify();
}


void VisitableMockObject_1_void_test::test_clear()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0);
  mvo.visitable(3);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_1_void_test::fail_unused_throwable()
{
  MyVisitableMockObject_1_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_2_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_2_test.cpp
/***************************************************************************
                     VisitableMockObject_2_test.cpp
                                 -
  unit tests for VisitableMockObject class and 2 parameter methods
                             -------------------
    begin                : Die Feb 18 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_2_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.3  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/19 14:32:42  ewald-arnold
    typo

    Revision 1.1  2003/02/18 19:30:20  ewald-arnold
    more unit tests

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>
#include <mockpp/util/AssertMo.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_2_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_2_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_response);
  CPPUNIT_TEST(test_return);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_return, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_value, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_parameter();
   void test_response();
   void test_return();
   void test_clear();
   void test_default_throw();

   void fail_unused_value();
   void fail_unused_throwable();
   void fail_parameter();
   void fail_return();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_add_return_after_active();
   void fail_set_return_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_2_test);


class MyVisitableMockObject_2 : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_2(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD2(visitable)
    {}

    MOCKPP_VISITABLE2(MyVisitableMockObject_2, int, visitable, unsigned, unsigned);

    bool isClear()
    {
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableResponseValues.size() == 0
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             
             && visitablehaveDefaultReturnValue == false
             && visitableDefaultReturnValueUsed == false
             && visitableReturnValues.hasMoreObjects() == false;
    }
};


void VisitableMockObject_2_test::test_controller()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  ctr.setDefaultReturnValue(123);
  ctr.addResponseValue(0, 1, 2);
  ctr.addResponseValue(1, 0, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 1, 2);
}


void VisitableMockObject_2_test::test_thrower()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));

  mvo.visitable(1, 2);
  mvo.visitable(1, 2);
  mvo.visitable(1, 2);
  mvo.visitable(1, 2);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2), ("3"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2), ("4"),
                         std::string, "exceptional string 3");
}


void VisitableMockObject_2_test::fail_add_method_after_active()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  mvo.visitable(1, 2);
  mvo.activate();
  mvo.visitable(1, 2);
  mvo.visitable(1, 2);
}


void VisitableMockObject_2_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_2_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_2_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_2_test::fail_parameter()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(111, 2);
  mvo.activate();
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(222, 2);
}


void VisitableMockObject_2_test::fail_add_return_after_active()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addReturnValue(1);
}


void VisitableMockObject_2_test::fail_set_return_after_active()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultReturnValue(1);
}


void VisitableMockObject_2_test::fail_return()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);

  ctr.addReturnValue(1);
  ctr.addReturnValue(11);

  mvo.visitable(1, 2);
  mvo.visitable(2, 2);
  mvo.visitable(3, 2);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2));
  mvo.visitable(3, 2);
}


void VisitableMockObject_2_test::test_return()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(123);
  ctr.addReturnValue(1,2);
  ctr.addReturnValue(11, 2);

  mvo.visitable(1, 2);
  mvo.visitable(1, 2);
  mvo.visitable(2, 2);
  mvo.visitable(2, 2);
  mvo.visitable(3, 2);
  mvo.visitable(4, 2);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2));
  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2));
  CPPUNIT_ASSERT(123 == mvo.visitable(3, 2));
  CPPUNIT_ASSERT(123 == mvo.visitable(4, 2));
  mvo.verify();
}


void VisitableMockObject_2_test::test_parameter()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(111, 2);
  mvo.activate();
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(111, 2);
  mvo.verify();
}


void VisitableMockObject_2_test::test_default_throw()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2);
  mvo.visitable(911, 2);
  mvo.visitable(1, 2);
  mvo.visitable(2, 2);
  mvo.visitable(3, 2);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2), ("default response"),
                         std::string, std::string("throw default"));
}


void VisitableMockObject_2_test::test_response()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(111);
  ctr.addResponseValue(123, 456, 2);
  ctr.addResponseValue(321, 654, 2);

  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2);

  mvo.visitable(456, 2);
  mvo.visitable(654, 2);
  mvo.visitable(1, 2);
  mvo.visitable(922, 2);
  mvo.visitable(911, 2);
  mvo.visitable(2, 2);
  mvo.visitable(3, 2);

  mvo.activate();

  CPPUNIT_ASSERT(123 == mvo.visitable(456, 2));
  CPPUNIT_ASSERT(321 == mvo.visitable(654, 2));
  CPPUNIT_ASSERT(111 == mvo.visitable(1, 2));

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2), ("response 2"),
                         std::string, std::string("throw me 1"));

  CPPUNIT_ASSERT(111 == mvo.visitable(2, 2));
  CPPUNIT_ASSERT(111 == mvo.visitable(3, 2));

  mvo.verify();
}



void VisitableMockObject_2_test::test_clear()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addReturnValue(1);
  ctr.setDefaultReturnValue(123);
  
  ctr.addResponseValue(1, 0, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2);
  mvo.visitable(3, 2);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_2_test::fail_unused_throwable()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


void VisitableMockObject_2_test::fail_unused_value()
{
  MyVisitableMockObject_2 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(111);
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_2_void_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_2_void_test.cpp
/***************************************************************************
                     VisitableMockObject_2_void_test.cpp
                                 -
  unit tests for VisitableMockObject class and 2 parameter void methods
                             -------------------
    begin                : Die Feb 18 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_2_void_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.3  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/19 14:32:42  ewald-arnold
    typo

    Revision 1.1  2003/02/18 19:30:20  ewald-arnold
    more unit tests

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_2_void_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_2_void_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_clear();
   void test_default_throw();
   void test_parameter();

   void fail_unused_throwable();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_parameter();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_2_void_test);


class MyVisitableMockObject_2_void : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_2_void(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD2(visitable)
    {}

    MOCKPP_VOID_VISITABLE2(MyVisitableMockObject_2_void, visitable, unsigned, unsigned);
    
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0;
    }
};


void VisitableMockObject_2_void_test::test_controller()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 1, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 0, 2);
}


void VisitableMockObject_2_void_test::test_thrower()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);

  mvo.visitable(2, 2);
  mvo.visitable(22, 2);
  mvo.visitable(222, 2);
  mvo.visitable(2222, 2);
  mvo.visitable(22222, 2);
  mvo.visitable(222222, 2);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(22, 2), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(222, 2), ("3"),
                         std::string, "exceptional string 2");

  mvo.visitable(2222, 2);
  mvo.visitable(22222, 2);
  mvo.visitable(222222, 2);
  mvo.verify();
}


void VisitableMockObject_2_void_test::fail_add_method_after_active()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  mvo.visitable(1, 2);
  mvo.activate();
  mvo.visitable(1, 2);
  mvo.visitable(1, 2);
}


void VisitableMockObject_2_void_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_2_void_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_2_void_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_2_void_test::fail_parameter()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(111, 2);
  mvo.activate();
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(222, 2);
}


void VisitableMockObject_2_void_test::test_parameter()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(111, 2);
  mvo.activate();
  mvo.visitable(1, 2);
  mvo.visitable(11, 2);
  mvo.visitable(111, 2);
  mvo.verify();
}


void VisitableMockObject_2_void_test::test_default_throw()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2);
  mvo.visitable(911, 2);
  mvo.visitable(1, 2);
  mvo.visitable(2, 2);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2), ("default response"),
                         std::string, std::string("throw default"));

  mvo.verify();
}


void VisitableMockObject_2_void_test::test_clear()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2);
  mvo.visitable(3, 2);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_2_void_test::fail_unused_throwable()
{
  MyVisitableMockObject_2_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_3_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_3_test.cpp
/***************************************************************************
                     VisitableMockObject_3_test.cpp
                                 -
  unit tests for VisitableMockObject class and 3 parameter methods
                             -------------------
    begin                : Mit Feb 19 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_3_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.2  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/19 14:30:00  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>
#include <mockpp/util/AssertMo.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_3_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_3_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_response);
  CPPUNIT_TEST(test_return);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_return, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_value, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_parameter();
   void test_response();
   void test_return();
   void test_clear();
   void test_default_throw();

   void fail_unused_value();
   void fail_unused_throwable();
   void fail_parameter();
   void fail_return();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_add_return_after_active();
   void fail_set_return_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_3_test);


class MyVisitableMockObject_3 : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_3(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD3(visitable)
    {}

    MOCKPP_VISITABLE3(MyVisitableMockObject_3, int, visitable, unsigned, unsigned, unsigned);

    bool isClear()
    {
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableResponseValues.size() == 0
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             && visitableParameter3.size() == 0
             
             && visitablehaveDefaultReturnValue == false
             && visitableDefaultReturnValueUsed == false
             && visitableReturnValues.hasMoreObjects() == false;
    }
};


void VisitableMockObject_3_test::test_controller()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  ctr.setDefaultReturnValue(123);
  ctr.addResponseValue(0, 1, 2, 3);
  ctr.addResponseValue(1, 0, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 1, 2, 3);
}


void VisitableMockObject_3_test::test_thrower()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));

  mvo.visitable(1, 2, 3);
  mvo.visitable(1, 2, 3);
  mvo.visitable(1, 2, 3);
  mvo.visitable(1, 2, 3);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3), ("3"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3), ("4"),
                         std::string, "exceptional string 3");
}


void VisitableMockObject_3_test::fail_add_method_after_active()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3);
  mvo.activate();
  mvo.visitable(1, 2, 3);
  mvo.visitable(1, 2, 3);
}


void VisitableMockObject_3_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_3_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_3_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_3_test::fail_parameter()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(111, 2, 3);
  mvo.activate();
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(222, 2, 3);
}


void VisitableMockObject_3_test::fail_add_return_after_active()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addReturnValue(1);
}


void VisitableMockObject_3_test::fail_set_return_after_active()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultReturnValue(1);
}


void VisitableMockObject_3_test::fail_return()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);

  ctr.addReturnValue(1);
  ctr.addReturnValue(11);

  mvo.visitable(1, 2, 3);
  mvo.visitable(2, 2, 3);
  mvo.visitable(3, 2, 3);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3));
  mvo.visitable(3, 2, 3);
}


void VisitableMockObject_3_test::test_return()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(123);
  ctr.addReturnValue(1,2);
  ctr.addReturnValue(11, 2);

  mvo.visitable(1, 2, 3);
  mvo.visitable(1, 2, 3);
  mvo.visitable(2, 2, 3);
  mvo.visitable(2, 2, 3);
  mvo.visitable(3, 2, 3);
  mvo.visitable(4, 2, 3);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3));
  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3));
  CPPUNIT_ASSERT(123 == mvo.visitable(3, 2, 3));
  CPPUNIT_ASSERT(123 == mvo.visitable(4, 2, 3));
  mvo.verify();
}


void VisitableMockObject_3_test::test_parameter()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(111, 2, 3);
  mvo.activate();
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(111, 2, 3);
  mvo.verify();
}


void VisitableMockObject_3_test::test_default_throw()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2, 3);
  mvo.visitable(911, 2, 3);
  mvo.visitable(1, 2, 3);
  mvo.visitable(2, 2, 3);
  mvo.visitable(3, 2, 3);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3), ("default response"),
                         std::string, std::string("throw default"));
}


void VisitableMockObject_3_test::test_response()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(111);
  ctr.addResponseValue(123, 456, 2, 3);
  ctr.addResponseValue(321, 654, 2, 3);

  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3);

  mvo.visitable(456, 2, 3);
  mvo.visitable(654, 2, 3);
  mvo.visitable(1, 2, 3); 
  mvo.visitable(922, 2, 3);
  mvo.visitable(911, 2, 3);
  mvo.visitable(2, 2, 3);
  mvo.visitable(3, 2, 3);

  mvo.activate();

  CPPUNIT_ASSERT(123 == mvo.visitable(456, 2, 3));
  CPPUNIT_ASSERT(321 == mvo.visitable(654, 2, 3));
  CPPUNIT_ASSERT(111 == mvo.visitable(1, 2, 3));

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3), ("response 2"),
                         std::string, std::string("throw me 1"));

  CPPUNIT_ASSERT(111 == mvo.visitable(2, 2, 3));
  CPPUNIT_ASSERT(111 == mvo.visitable(3, 2, 3));

  mvo.verify();
}



void VisitableMockObject_3_test::test_clear()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addReturnValue(1);
  ctr.setDefaultReturnValue(123);
  
  ctr.addResponseValue(1, 0, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3);
  mvo.visitable(3, 2, 3);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_3_test::fail_unused_throwable()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


void VisitableMockObject_3_test::fail_unused_value()
{
  MyVisitableMockObject_3 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(111);
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_3_void_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_3_void_test.cpp
/***************************************************************************
                     VisitableMockObject_3_void_test.cpp
                                 -
  unit tests for VisitableMockObject class and 4 parameter void methods
                             -------------------
    begin                : Die Feb 18 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_3_void_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.2  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/19 14:30:00  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_3_void_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_3_void_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_clear();
   void test_default_throw();
   void test_parameter();

   void fail_unused_throwable();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_parameter();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_3_void_test);


class MyVisitableMockObject_3_void : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_3_void(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD3(visitable)
    {}

    MOCKPP_VOID_VISITABLE3(MyVisitableMockObject_3_void, visitable, unsigned, unsigned, unsigned);
    
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             && visitableParameter3.size() == 0;
    }
};


void VisitableMockObject_3_void_test::test_controller()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 1, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 0, 2, 3);
}


void VisitableMockObject_3_void_test::test_thrower()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);

  mvo.visitable(2, 2, 3);
  mvo.visitable(22, 2, 3);
  mvo.visitable(222, 2, 3);
  mvo.visitable(2222, 2, 3);
  mvo.visitable(22222, 2, 3);
  mvo.visitable(222222, 2, 3);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(22, 2, 3), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(222, 2, 3), ("3"),
                         std::string, "exceptional string 2");

  mvo.visitable(2222, 2, 3);
  mvo.visitable(22222, 2, 3);
  mvo.visitable(222222, 2, 3);
  mvo.verify();
}


void VisitableMockObject_3_void_test::fail_add_method_after_active()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3);
  mvo.activate();
  mvo.visitable(1, 2, 3);
  mvo.visitable(1, 2, 3);
}


void VisitableMockObject_3_void_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_3_void_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_3_void_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_3_void_test::fail_parameter()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(111, 2, 3);
  mvo.activate();
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(222, 2, 3);
}


void VisitableMockObject_3_void_test::test_parameter()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(111, 2, 3);
  mvo.activate();
  mvo.visitable(1, 2, 3);
  mvo.visitable(11, 2, 3);
  mvo.visitable(111, 2, 3);
  mvo.verify();
}


void VisitableMockObject_3_void_test::test_default_throw()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2, 3);
  mvo.visitable(911, 2, 3);
  mvo.visitable(1, 2, 3);
  mvo.visitable(2, 2, 3);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3), ("default response"),
                         std::string, std::string("throw default"));

  mvo.verify();
}


void VisitableMockObject_3_void_test::test_clear()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3);
  mvo.visitable(3, 2, 3);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_3_void_test::fail_unused_throwable()
{
  MyVisitableMockObject_3_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_4_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_4_test.cpp
/***************************************************************************
                     VisitableMockObject_4_test.cpp
                                 -
  unit tests for VisitableMockObject class and 4 parameter methods
                             -------------------
    begin                : Mit Feb 19 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_4_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:48  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.2  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/19 14:30:00  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>
#include <mockpp/util/AssertMo.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_4_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_4_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_response);
  CPPUNIT_TEST(test_return);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_return, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_value, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_parameter();
   void test_response();
   void test_return();
   void test_clear();
   void test_default_throw();

   void fail_unused_value();
   void fail_unused_throwable();
   void fail_parameter();
   void fail_return();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_add_return_after_active();
   void fail_set_return_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_4_test);


class MyVisitableMockObject_4 : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_4(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD4(visitable)
    {}

    MOCKPP_VISITABLE4(MyVisitableMockObject_4, int, visitable, unsigned, unsigned, unsigned, unsigned);
    
    bool isClear()
    {
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableResponseValues.size() == 0
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             && visitableParameter3.size() == 0
             && visitableParameter4.size() == 0
             
             && visitablehaveDefaultReturnValue == false
             && visitableDefaultReturnValueUsed == false
             && visitableReturnValues.hasMoreObjects() == false;
    }
};


void VisitableMockObject_4_test::test_controller()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  ctr.setDefaultReturnValue(123);
  ctr.addResponseValue(0, 1, 2, 3, 4);
  ctr.addResponseValue(1, 0, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 1, 2, 3, 4);
}


void VisitableMockObject_4_test::test_thrower()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));

  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4), ("3"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4), ("4"),
                         std::string, "exceptional string 3");
}


void VisitableMockObject_4_test::fail_add_method_after_active()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
}


void VisitableMockObject_4_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_4_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_4_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_4_test::fail_parameter()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(111, 2, 3, 4);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(222, 2, 3, 4);
}


void VisitableMockObject_4_test::fail_add_return_after_active()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addReturnValue(1);
}


void VisitableMockObject_4_test::fail_set_return_after_active()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultReturnValue(1);
}


void VisitableMockObject_4_test::fail_return()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);

  ctr.addReturnValue(1);
  ctr.addReturnValue(11);

  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(2, 2, 3, 4);
  mvo.visitable(3, 2, 3, 4);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3, 4));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3, 4));
  mvo.visitable(3, 2, 3, 4);
}


void VisitableMockObject_4_test::test_return()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(123);
  ctr.addReturnValue(1,2);
  ctr.addReturnValue(11, 2);

  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(2, 2, 3, 4);
  mvo.visitable(2, 2, 3, 4);
  mvo.visitable(3, 2, 3, 4);
  mvo.visitable(4, 2, 3, 4);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3, 4));
  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3, 4));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3, 4));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3, 4));
  CPPUNIT_ASSERT(123 == mvo.visitable(3, 2, 3, 4));
  CPPUNIT_ASSERT(123 == mvo.visitable(4, 2, 3, 4));
  mvo.verify();
}


void VisitableMockObject_4_test::test_parameter()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(111, 2, 3, 4);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(111, 2, 3, 4);
  mvo.verify();
}


void VisitableMockObject_4_test::test_default_throw()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3, 4);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2, 3, 4);
  mvo.visitable(911, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(2, 2, 3, 4);
  mvo.visitable(3, 2, 3, 4);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3, 4), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3, 4), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3, 4), ("default response"),
                         std::string, std::string("throw default"));
}


void VisitableMockObject_4_test::test_response()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(111);
  ctr.addResponseValue(123, 456, 2, 3, 4);
  ctr.addResponseValue(321, 654, 2, 3, 4);

  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3, 4);

  mvo.visitable(456, 2, 3, 4);
  mvo.visitable(654, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(922, 2, 3, 4);
  mvo.visitable(911, 2, 3, 4);
  mvo.visitable(2, 2, 3, 4);
  mvo.visitable(3, 2, 3, 4);

  mvo.activate();

  CPPUNIT_ASSERT(123 == mvo.visitable(456, 2, 3, 4));
  CPPUNIT_ASSERT(321 == mvo.visitable(654, 2, 3, 4));
  CPPUNIT_ASSERT(111 == mvo.visitable(1, 2, 3, 4));

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3, 4), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3, 4), ("response 2"),
                         std::string, std::string("throw me 1"));

  CPPUNIT_ASSERT(111 == mvo.visitable(2, 2, 3, 4));
  CPPUNIT_ASSERT(111 == mvo.visitable(3, 2, 3, 4));

  mvo.verify();
}



void VisitableMockObject_4_test::test_clear()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addReturnValue(1);
  ctr.setDefaultReturnValue(123);
  
  ctr.addResponseValue(1, 0, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4);
  mvo.visitable(3, 2, 3, 4);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_4_test::fail_unused_throwable()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


void VisitableMockObject_4_test::fail_unused_value()
{
  MyVisitableMockObject_4 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(111);
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_4_void_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_4_void_test.cpp
/***************************************************************************
                     VisitableMockObject_4_void_test.cpp
                                 -
  unit tests for VisitableMockObject class and 4 parameter void methods
                             -------------------
    begin                : Die Feb 18 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_4_void_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.2  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/19 14:30:00  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_4_void_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_4_void_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_clear();
   void test_default_throw();
   void test_parameter();

   void fail_unused_throwable();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_parameter();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_4_void_test);


class MyVisitableMockObject_4_void_test : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_4_void_test(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD4(visitable)
    {}

    MOCKPP_VOID_VISITABLE4(MyVisitableMockObject_4_void_test, visitable, unsigned, unsigned, unsigned, unsigned);
    
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             && visitableParameter3.size() == 0
             && visitableParameter4.size() == 0;
    }
};


void VisitableMockObject_4_void_test::test_controller()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 1, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 0, 2, 3, 4);
}


void VisitableMockObject_4_void_test::test_thrower()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);

  mvo.visitable(2, 2, 3, 4);
  mvo.visitable(22, 2, 3, 4);
  mvo.visitable(222, 2, 3, 4);
  mvo.visitable(2222, 2, 3, 4);
  mvo.visitable(22222, 2, 3, 4);
  mvo.visitable(222222, 2, 3, 4);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3, 4), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(22, 2, 3, 4), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(222, 2, 3, 4), ("3"),
                         std::string, "exceptional string 2");

  mvo.visitable(2222, 2, 3, 4);
  mvo.visitable(22222, 2, 3, 4);
  mvo.visitable(222222, 2, 3, 4);
  mvo.verify();
}


void VisitableMockObject_4_void_test::fail_add_method_after_active()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
}


void VisitableMockObject_4_void_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_4_void_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_4_void_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_4_void_test::fail_parameter()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(111, 2, 3, 4);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(222, 2, 3, 4);
}


void VisitableMockObject_4_void_test::test_parameter()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(111, 2, 3, 4);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(11, 2, 3, 4);
  mvo.visitable(111, 2, 3, 4);
  mvo.verify();
}


void VisitableMockObject_4_void_test::test_default_throw()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3, 4);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3, 4);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2, 3, 4);
  mvo.visitable(911, 2, 3, 4);
  mvo.visitable(1, 2, 3, 4);
  mvo.visitable(2, 2, 3, 4);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3, 4), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3, 4), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3, 4), ("default response"),
                         std::string, std::string("throw default"));

  mvo.verify();
}


void VisitableMockObject_4_void_test::test_clear()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4);
  mvo.visitable(3, 2, 3, 4);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_4_void_test::fail_unused_throwable()
{
  MyVisitableMockObject_4_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_5_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_5_test.cpp
/***************************************************************************
                     VisitableMockObject_5_test.cpp
                                 -
  unit tests for VisitableMockObject class and 5 parameter methods
                             -------------------
    begin                : Mit Feb 19 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_5_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/03/23 13:16:29  ewald-arnold
    extended tests

    Revision 1.3  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.2  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/19 14:30:00  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>
#include <mockpp/util/AssertMo.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_5_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_5_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_response);
  CPPUNIT_TEST(test_return);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_return, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_value, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_parameter();
   void test_response();
   void test_return();
   void test_clear();
   void test_default_throw();

   void fail_unused_value();
   void fail_unused_throwable();
   void fail_parameter();
   void fail_return();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_add_return_after_active();
   void fail_set_return_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_5_test);

class MyVisitableMockObject_5 : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_5(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD5(visitable),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD4(visitable4),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD3(visitable3),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD2(visitable2),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD1(visitable1),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(visitable0)
    {}

    MOCKPP_VISITABLE5(MyVisitableMockObject_5, int, visitable, unsigned, unsigned, unsigned, unsigned, unsigned);
    MOCKPP_VISITABLE4(MyVisitableMockObject_5, int, visitable4, unsigned, unsigned, unsigned, unsigned);
    MOCKPP_VISITABLE3(MyVisitableMockObject_5, int, visitable3, unsigned, unsigned, unsigned);
    MOCKPP_VISITABLE2(MyVisitableMockObject_5, int, visitable2, unsigned, unsigned);
    MOCKPP_VISITABLE1(MyVisitableMockObject_5, int, visitable1, unsigned);
    MOCKPP_VISITABLE0(MyVisitableMockObject_5, int, visitable0);
    
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableResponseValues.size() == 0)
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << (visitablehaveDefaultReturnValue == false)
             << (visitableDefaultReturnValueUsed == false)
             << (visitableReturnValues.hasMoreObjects() == false) << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableResponseValues.size() == 0
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             && visitableParameter3.size() == 0
             && visitableParameter4.size() == 0
             && visitableParameter5.size() == 0
             
             && visitablehaveDefaultReturnValue == false
             && visitableDefaultReturnValueUsed == false
             && visitableReturnValues.hasMoreObjects() == false;
        }
};


void VisitableMockObject_5_test::test_controller()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  ctr.setDefaultReturnValue(123);
  ctr.addResponseValue(0, 1, 2, 3, 4, 5);
  ctr.addResponseValue(1, 0, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 1, 2, 3, 4, 5);
}


void VisitableMockObject_5_test::test_thrower()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));

  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4, 5), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4, 5), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4, 5), ("3"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4, 5), ("4"),
                         std::string, "exceptional string 3");
}


void VisitableMockObject_5_test::fail_add_method_after_active()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
}


void VisitableMockObject_5_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_5_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_5_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_5_test::fail_parameter()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(111, 2, 3, 4, 5);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(222, 2, 3, 4, 5);
}


void VisitableMockObject_5_test::fail_add_return_after_active()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addReturnValue(1);
}


void VisitableMockObject_5_test::fail_set_return_after_active()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultReturnValue(1);
}


void VisitableMockObject_5_test::fail_return()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);

  ctr.addReturnValue(1);
  ctr.addReturnValue(11);

  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(2, 2, 3, 4, 5);
  mvo.visitable(3, 2, 3, 4, 5);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3, 4, 5));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3, 4, 5));
  mvo.visitable(3, 2, 3, 4, 5);
}


void VisitableMockObject_5_test::test_return()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(123);
  ctr.addReturnValue(1,2);
  ctr.addReturnValue(11, 2);

  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(2, 2, 3, 4, 5);
  mvo.visitable(2, 2, 3, 4, 5);
  mvo.visitable(3, 2, 3, 4, 5);
  mvo.visitable(4, 2, 3, 4, 5);

  mvo.activate();

  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3, 4, 5));
  CPPUNIT_ASSERT(1 == mvo.visitable(1, 2, 3, 4, 5));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3, 4, 5));
  CPPUNIT_ASSERT(11 == mvo.visitable(2, 2, 3, 4, 5));
  CPPUNIT_ASSERT(123 == mvo.visitable(3, 2, 3, 4, 5));
  CPPUNIT_ASSERT(123 == mvo.visitable(4, 2, 3, 4, 5));
  mvo.verify();
}


void VisitableMockObject_5_test::test_parameter()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(1);
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable4) ctr4 (&mvo);
  ctr4.setDefaultReturnValue(4);
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable3) ctr3 (&mvo);
  ctr3.setDefaultReturnValue(3);
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable2) ctr2 (&mvo);
  ctr2.setDefaultReturnValue(2);
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable1) ctr1 (&mvo);
  ctr1.setDefaultReturnValue(1);
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable0) ctr0 (&mvo);
  ctr0.setDefaultReturnValue(0);
  
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(111, 2, 3, 4, 5);
  mvo.visitable4(1,2,3,4);
  mvo.visitable3(2,3,4);
  mvo.visitable2(3,4);
  mvo.visitable1(4);
  mvo.visitable0();
  
  mvo.activate();
  
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(111, 2, 3, 4, 5);
  mvo.visitable4(1,2,3,4);
  mvo.visitable3(2,3,4);
  mvo.visitable2(3,4);
  mvo.visitable1(4);
  mvo.visitable0();
  mvo.verify();
}


void VisitableMockObject_5_test::test_default_throw()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3, 4, 5);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2, 3, 4, 5);
  mvo.visitable(911, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(2, 2, 3, 4, 5);
  mvo.visitable(3, 2, 3, 4, 5);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3, 4, 5), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3, 4, 5), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4, 5), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3, 4, 5), ("default response"),
                         std::string, std::string("throw default"));
}


void VisitableMockObject_5_test::test_response()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);

  ctr.setDefaultReturnValue(111);
  ctr.addResponseValue(123, 456, 2, 3, 4, 5);
  ctr.addResponseValue(321, 654, 2, 3, 4, 5);

  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3, 4, 5);

  mvo.visitable(456, 2, 3, 4, 5);
  mvo.visitable(654, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(922, 2, 3, 4, 5);
  mvo.visitable(911, 2, 3, 4, 5);
  mvo.visitable(2, 2, 3, 4, 5);
  mvo.visitable(3, 2, 3, 4, 5);

  mvo.activate();

  CPPUNIT_ASSERT(123 == mvo.visitable(456, 2, 3, 4, 5));
  CPPUNIT_ASSERT(321 == mvo.visitable(654, 2, 3, 4, 5));
  CPPUNIT_ASSERT(111 == mvo.visitable(1, 2, 3, 4, 5));

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3, 4, 5), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3, 4, 5), ("response 2"),
                         std::string, std::string("throw me 1"));

  CPPUNIT_ASSERT(111 == mvo.visitable(2, 2, 3, 4, 5));
  CPPUNIT_ASSERT(111 == mvo.visitable(3, 2, 3, 4, 5));

  mvo.verify();
}



void VisitableMockObject_5_test::test_clear()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addReturnValue(1);
  ctr.setDefaultReturnValue(123);
  
  ctr.addResponseValue(1, 0, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4, 5);
  mvo.visitable(3, 2, 3, 4, 5);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}

             
void VisitableMockObject_5_test::fail_unused_throwable()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


void VisitableMockObject_5_test::fail_unused_value()
{
  MyVisitableMockObject_5 mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(111);
  mvo.activate();
  mvo.verify(); 
}



#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_5_void_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_5_void_test.cpp
/***************************************************************************
                     VisitableMockObject_5_void_test.cpp
                                 -
  unit tests for VisitableMockObject class and 5 parameter void methods
                             -------------------
    begin                : Die Feb 18 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_5_void_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/03/23 13:16:29  ewald-arnold
    extended tests

    Revision 1.3  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.2  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.1  2003/02/19 14:30:00  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_5_void_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_5_void_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_parameter);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_clear);
  CPPUNIT_TEST(test_default_throw);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_parameter, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_clear();
   void test_default_throw();
   void test_parameter();

   void fail_unused_throwable();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_parameter();
};

CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_5_void_test);


class MyVisitableMockObject_5_void_test : public mockpp::VisitableMockObject
{
  public:

    MyVisitableMockObject_5_void_test(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD5(visitable),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD4(visitable4),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD3(visitable3),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD2(visitable2),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD1(visitable1),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(visitable0)
    {}
    
    MOCKPP_VOID_VISITABLE5(MyVisitableMockObject_5_void_test, visitable, unsigned, unsigned, unsigned, unsigned, unsigned);
    MOCKPP_VOID_VISITABLE4(MyVisitableMockObject_5_void_test, visitable4, unsigned, unsigned, unsigned, unsigned);
    MOCKPP_VOID_VISITABLE3(MyVisitableMockObject_5_void_test, visitable3, unsigned, unsigned, unsigned);
    MOCKPP_VOID_VISITABLE2(MyVisitableMockObject_5_void_test, visitable2, unsigned, unsigned);
    MOCKPP_VOID_VISITABLE1(MyVisitableMockObject_5_void_test, visitable1, unsigned);
    MOCKPP_VOID_VISITABLE0(MyVisitableMockObject_5_void_test, visitable0);
       
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitableParameter1.size() == 0
             && visitableParameter2.size() == 0
             && visitableParameter3.size() == 0
             && visitableParameter4.size() == 0
             && visitableParameter5.size() == 0;
    }
};


void VisitableMockObject_5_void_test::test_controller()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 1, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 0, 2, 3, 4, 5);
}


void VisitableMockObject_5_void_test::test_thrower()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);

  mvo.visitable(2, 2, 3, 4, 5);
  mvo.visitable(22, 2, 3, 4, 5);
  mvo.visitable(222, 2, 3, 4, 5);
  mvo.visitable(2222, 2, 3, 4, 5);
  mvo.visitable(22222, 2, 3, 4, 5);
  mvo.visitable(222222, 2, 3, 4, 5);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3, 4, 5), ("1"),
                         std::string, "exceptional string 1");

  MOCKPP_ASSERT_THROWING(mvo.visitable(22, 2, 3, 4, 5), ("2"),
                         std::string, "exceptional string 2");

  MOCKPP_ASSERT_THROWING(mvo.visitable(222, 2, 3, 4, 5), ("3"),
                         std::string, "exceptional string 2");

  mvo.visitable(2222, 2, 3, 4, 5);
  mvo.visitable(22222, 2, 3, 4, 5);
  mvo.visitable(222222, 2, 3, 4, 5);
  mvo.verify();
}


void VisitableMockObject_5_void_test::fail_add_method_after_active()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
}


void VisitableMockObject_5_void_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_5_void_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_5_void_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_5_void_test::fail_parameter()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(111, 2, 3, 4, 5);
  mvo.activate();
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(222, 2, 3, 4, 5);
}


void VisitableMockObject_5_void_test::test_parameter()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable4) ctr4 (&mvo);
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable3) ctr3 (&mvo);
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable2) ctr2 (&mvo);
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable1) ctr1 (&mvo);
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable0) ctr0 (&mvo);
  
   
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(111, 2, 3, 4, 5);
  mvo.visitable4(1,2,3,4);
  mvo.visitable3(2,3,4);
  mvo.visitable2(3,4);
  mvo.visitable1(4);
  mvo.visitable0();
  
  mvo.activate();
  
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(11, 2, 3, 4, 5);
  mvo.visitable(111, 2, 3, 4, 5);
  mvo.visitable4(1,2,3,4);
  mvo.visitable3(2,3,4);
  mvo.visitable2(3,4);
  mvo.visitable1(4);
  mvo.visitable0();
  
  mvo.verify();
}


void VisitableMockObject_5_void_test::test_default_throw()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 2")), 922, 2, 3, 4, 5);
  ctr.addResponseThrowable(mockpp::make_throwable(std::string("throw me 1")), 911, 2, 3, 4, 5);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));

  mvo.visitable(922, 2, 3, 4, 5);
  mvo.visitable(911, 2, 3, 4, 5);
  mvo.visitable(1, 2, 3, 4, 5);
  mvo.visitable(2, 2, 3, 4, 5);

  mvo.activate();

  MOCKPP_ASSERT_THROWING(mvo.visitable(922, 2, 3, 4, 5), ("response 1"),
                         std::string, std::string("throw me 2"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(911, 2, 3, 4, 5), ("response 2"),
                         std::string, std::string("throw me 1"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(1, 2, 3, 4, 5), ("default response"),
                         std::string, std::string("throw default"));

  MOCKPP_ASSERT_THROWING(mvo.visitable(2, 2, 3, 4, 5), ("default response"),
                         std::string, std::string("throw default"));

  mvo.verify();
}


void VisitableMockObject_5_void_test::test_clear()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4, 5);
  mvo.visitable(3, 2, 3, 4, 5);
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_5_void_test::fail_unused_throwable()
{
  MyVisitableMockObject_5_void_test mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_template_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_template_test.cpp
/***************************************************************************
                 VisitableMockObject_template_test.cpp  
                                 -  
              unit tests for VisitableMockObject templates
                             -------------------
    begin                : Son Feb 16 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_template_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/02/20 18:51:09  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/17 22:04:59  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.1  2003/02/16 17:35:19  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_template_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_template_test );

  CPPUNIT_TEST(test_value_1);
  CPPUNIT_TEST(test_value_2);
  CPPUNIT_TEST(test_value_3);
  CPPUNIT_TEST(test_value_4);
  CPPUNIT_TEST(test_value_5);
  CPPUNIT_TEST(test_throw_1);
  CPPUNIT_TEST(test_throw_2);
  CPPUNIT_TEST(test_throw_3);
  CPPUNIT_TEST(test_throw_4);
  CPPUNIT_TEST(test_throw_5);

CPPUNIT_TEST_SUITE_END();

 public:
   void test_value_1();
   void test_value_2();
   void test_value_3();
   void test_value_4();
   void test_value_5();
   void test_throw_1();
   void test_throw_2();
   void test_throw_3();
   void test_throw_4();
   void test_throw_5();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_template_test);


void VisitableMockObject_template_test::test_value_1()
{
  mockpp::ResponseVector1<int, int> rv(("rv"), 0);
  rv.add(10, 11, 1);
  rv.add(20, 21, 1);
  rv.add(30, 31, 1);
  
  int i;
  CPPUNIT_ASSERT(rv.find(i, 11) == true);
  CPPUNIT_ASSERT(10 == i);
  CPPUNIT_ASSERT(rv.find(i, 11) == false);

  CPPUNIT_ASSERT(rv.find(i, 21) == true);
  CPPUNIT_ASSERT(20 == i);
  CPPUNIT_ASSERT(rv.find(i, 21) == false);

  CPPUNIT_ASSERT(rv.find(i, 31) == true);
  CPPUNIT_ASSERT(30 == i);
  CPPUNIT_ASSERT(rv.find(i, 31) == false);
  
  CPPUNIT_ASSERT(rv.find(i, 0) == false);

  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  rv.add(t10, 12, 1);
  rv.add(t20, 22, 1);
  rv.add(t30, 32, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(rv.find(t, 12) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(rv.find(t, 12) == false);

  CPPUNIT_ASSERT(rv.find(t, 22) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(rv.find(t, 22) == false);

  CPPUNIT_ASSERT(rv.find(t, 32) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(rv.find(t, 32) == false);
  
  CPPUNIT_ASSERT(rv.find(t, 0) == false);

  mockpp::Throwable *t40 = mockpp::make_throwable((int)11);
  rv.add(130, 131, 1);
  rv.add(t40, 132, 1);
  CPPUNIT_ASSERT(rv.find(t, 131) == false);  // across !
  CPPUNIT_ASSERT(rv.find(i, 132) == false);
}


void VisitableMockObject_template_test::test_throw_1()
{
  mockpp::ResponseThrowableVector1<int> tv(("rv"), 0);
  
  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  tv.add(t10, 11, 1);
  tv.add(t20, 21, 1);
  tv.add(t30, 31, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(tv.find(t, 11) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(tv.find(t, 11) == false);

  CPPUNIT_ASSERT(tv.find(t, 21) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(tv.find(t, 21) == false);

  CPPUNIT_ASSERT(tv.find(t, 31) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(tv.find(t, 31) == false);
  
  CPPUNIT_ASSERT(tv.find(t, 0) == false);
}


void VisitableMockObject_template_test::test_value_2()
{
  mockpp::ResponseVector2<int, int, int> rv(("rv"), 0);
  rv.add(10, 11, 2, 1);
  rv.add(20, 21, 2, 1);
  rv.add(30, 31, 2, 1);
  
  int i;
  CPPUNIT_ASSERT(rv.find(i, 11, 2) == true);
  CPPUNIT_ASSERT(10 == i);
  CPPUNIT_ASSERT(rv.find(i, 11, 2) == false);

  CPPUNIT_ASSERT(rv.find(i, 21, 2) == true);
  CPPUNIT_ASSERT(20 == i);
  CPPUNIT_ASSERT(rv.find(i, 21, 2) == false);

  CPPUNIT_ASSERT(rv.find(i, 31, 2) == true);
  CPPUNIT_ASSERT(30 == i);
  CPPUNIT_ASSERT(rv.find(i, 31, 2) == false);
  
  CPPUNIT_ASSERT(rv.find(i, 0, 2) == false);

  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  rv.add(t10, 12, 2, 1);
  rv.add(t20, 22, 2, 1);
  rv.add(t30, 32, 2, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(rv.find(t, 12, 2) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(rv.find(t, 12, 2) == false);

  CPPUNIT_ASSERT(rv.find(t, 22, 2) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(rv.find(t, 22, 2) == false);

  CPPUNIT_ASSERT(rv.find(t, 32, 2) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(rv.find(t, 32, 2) == false);
  
  CPPUNIT_ASSERT(rv.find(t, 0, 2) == false);

  mockpp::Throwable *t40 = mockpp::make_throwable((int)11);
  rv.add(130, 131, 2, 1);
  rv.add(t40, 132, 2, 1);
  CPPUNIT_ASSERT(rv.find(t, 131, 2) == false);  // across !
  CPPUNIT_ASSERT(rv.find(i, 132, 2) == false);
}


void VisitableMockObject_template_test::test_throw_2()
{
  mockpp::ResponseThrowableVector2<int, int> tv(("rv"), 0);
  
  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  tv.add(t10, 11, 2, 1);
  tv.add(t20, 21, 2, 1);
  tv.add(t30, 31, 2, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(tv.find(t, 11, 2) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(tv.find(t, 11, 2) == false);

  CPPUNIT_ASSERT(tv.find(t, 21, 2) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(tv.find(t, 21, 2) == false);

  CPPUNIT_ASSERT(tv.find(t, 31, 2) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(tv.find(t, 31, 2) == false);
  
  CPPUNIT_ASSERT(tv.find(t, 0, 2) == false);
}


void VisitableMockObject_template_test::test_value_3()
{
  mockpp::ResponseVector3<int, int, int, int> rv(("rv"), 0);
  rv.add(10, 11, 2, 3, 1);
  rv.add(20, 21, 2, 3, 1);
  rv.add(30, 31, 2, 3, 1);
  
  int i;
  CPPUNIT_ASSERT(rv.find(i, 11, 2, 3) == true);
  CPPUNIT_ASSERT(10 == i);
  CPPUNIT_ASSERT(rv.find(i, 11, 2, 3) == false);

  CPPUNIT_ASSERT(rv.find(i, 21, 2, 3) == true);
  CPPUNIT_ASSERT(20 == i);
  CPPUNIT_ASSERT(rv.find(i, 21, 2, 3) == false);

  CPPUNIT_ASSERT(rv.find(i, 31, 2, 3) == true);
  CPPUNIT_ASSERT(30 == i);
  CPPUNIT_ASSERT(rv.find(i, 31, 2, 3) == false);
  
  CPPUNIT_ASSERT(rv.find(i, 0, 2, 3) == false);

  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  rv.add(t10, 12, 2, 3, 1);
  rv.add(t20, 22, 2, 3, 1);
  rv.add(t30, 32, 2, 3, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(rv.find(t, 12, 2, 3) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(rv.find(t, 12, 2, 3) == false);

  CPPUNIT_ASSERT(rv.find(t, 22, 2, 3) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(rv.find(t, 22, 2, 3) == false);

  CPPUNIT_ASSERT(rv.find(t, 32, 2, 3) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(rv.find(t, 32, 2, 3) == false);
  
  CPPUNIT_ASSERT(rv.find(t, 0, 2, 3) == false);

  mockpp::Throwable *t40 = mockpp::make_throwable((int)11);
  rv.add(130, 131, 2, 3, 1);
  rv.add(t40, 132, 2, 3, 1);
  CPPUNIT_ASSERT(rv.find(t, 131, 2, 3) == false);  // across !
  CPPUNIT_ASSERT(rv.find(i, 132, 2, 3) == false);
}


void VisitableMockObject_template_test::test_throw_3()
{
  mockpp::ResponseThrowableVector3<int, int, int> tv(("rv"), 0);
  
  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  tv.add(t10, 11, 2, 3, 1);
  tv.add(t20, 21, 2, 3, 1);
  tv.add(t30, 31, 2, 3, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(tv.find(t, 11, 2, 3) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(tv.find(t, 11, 2, 3) == false);

  CPPUNIT_ASSERT(tv.find(t, 21, 2, 3) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(tv.find(t, 21, 2, 3) == false);

  CPPUNIT_ASSERT(tv.find(t, 31, 2, 3) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(tv.find(t, 31, 2, 3) == false);
  
  CPPUNIT_ASSERT(tv.find(t, 0, 2, 3) == false);
}


void VisitableMockObject_template_test::test_value_4()
{
  mockpp::ResponseVector4<int, int, int, int, int> rv(("rv"), 0);
  rv.add(10, 11, 2, 3, 4, 1);
  rv.add(20, 21, 2, 3, 4, 1);
  rv.add(30, 31, 2, 3, 4, 1);
  
  int i;
  CPPUNIT_ASSERT(rv.find(i, 11, 2, 3, 4) == true);
  CPPUNIT_ASSERT(10 == i);
  CPPUNIT_ASSERT(rv.find(i, 11, 2, 3, 4) == false);

  CPPUNIT_ASSERT(rv.find(i, 21, 2, 3, 4) == true);
  CPPUNIT_ASSERT(20 == i);
  CPPUNIT_ASSERT(rv.find(i, 21, 2, 3, 4) == false);

  CPPUNIT_ASSERT(rv.find(i, 31, 2, 3, 4) == true);
  CPPUNIT_ASSERT(30 == i);
  CPPUNIT_ASSERT(rv.find(i, 31, 2, 3, 4) == false);
  
  CPPUNIT_ASSERT(rv.find(i, 0, 2, 3, 4) == false);

  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  rv.add(t10, 12, 2, 3, 4, 1);
  rv.add(t20, 22, 2, 3, 4, 1);
  rv.add(t30, 32, 2, 3, 4, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(rv.find(t, 12, 2, 3, 4) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(rv.find(t, 12, 2, 3, 4) == false);

  CPPUNIT_ASSERT(rv.find(t, 22, 2, 3, 4) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(rv.find(t, 22, 2, 3, 4) == false);

  CPPUNIT_ASSERT(rv.find(t, 32, 2, 3, 4) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(rv.find(t, 32, 2, 3, 4) == false);
  
  CPPUNIT_ASSERT(rv.find(t, 0, 2, 3, 4) == false);

  mockpp::Throwable *t40 = mockpp::make_throwable((int)11);
  rv.add(130, 131, 2, 3, 4, 1);
  rv.add(t40, 132, 2, 3, 4, 1);
  CPPUNIT_ASSERT(rv.find(t, 131, 2, 3, 4) == false);  // across !
  CPPUNIT_ASSERT(rv.find(i, 132, 2, 3, 4) == false);
}


void VisitableMockObject_template_test::test_throw_4()
{
  mockpp::ResponseThrowableVector4<int, int, int, int> tv(("rv"), 0);
  
  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  tv.add(t10, 11, 2, 3, 4, 1);
  tv.add(t20, 21, 2, 3, 4, 1);
  tv.add(t30, 31, 2, 3, 4, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(tv.find(t, 11, 2, 3, 4) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(tv.find(t, 11, 2, 3, 4) == false);

  CPPUNIT_ASSERT(tv.find(t, 21, 2, 3, 4) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(tv.find(t, 21, 2, 3, 4) == false);

  CPPUNIT_ASSERT(tv.find(t, 31, 2, 3, 4) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(tv.find(t, 31, 2, 3, 4) == false);
  
  CPPUNIT_ASSERT(tv.find(t, 0, 2, 3, 4) == false);
}


void VisitableMockObject_template_test::test_value_5()
{
  mockpp::ResponseVector5<int, int, int, int, int, int> rv(("rv"), 0);
  rv.add(10, 11, 2, 3, 4, 5, 1);
  rv.add(20, 21, 2, 3, 4, 5, 1);
  rv.add(30, 31, 2, 3, 4, 5, 1);
  
  int i;
  CPPUNIT_ASSERT(rv.find(i, 11, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(10 == i);
  CPPUNIT_ASSERT(rv.find(i, 11, 2, 3, 4, 5) == false);

  CPPUNIT_ASSERT(rv.find(i, 21, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(20 == i);
  CPPUNIT_ASSERT(rv.find(i, 21, 2, 3, 4, 5) == false);

  CPPUNIT_ASSERT(rv.find(i, 31, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(30 == i);
  CPPUNIT_ASSERT(rv.find(i, 31, 2, 3, 4, 5) == false);
  
  CPPUNIT_ASSERT(rv.find(i, 0, 2, 3, 4, 5) == false);

  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  rv.add(t10, 12, 2, 3, 4, 5, 1);
  rv.add(t20, 22, 2, 3, 4, 5, 1);
  rv.add(t30, 32, 2, 3, 4, 5, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(rv.find(t, 12, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(rv.find(t, 12, 2, 3, 4, 5) == false);

  CPPUNIT_ASSERT(rv.find(t, 22, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(rv.find(t, 22, 2, 3, 4, 5) == false);

  CPPUNIT_ASSERT(rv.find(t, 32, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(rv.find(t, 32, 2, 3, 4, 5) == false);
  
  CPPUNIT_ASSERT(rv.find(t, 0, 2, 3, 4, 5) == false);

  mockpp::Throwable *t40 = mockpp::make_throwable((int)11);
  rv.add(130, 131, 2, 3, 4, 5, 1);
  rv.add(t40, 132, 2, 3, 4, 5, 1);
  CPPUNIT_ASSERT(rv.find(t, 131, 2, 3, 4, 5) == false);  // across !
  CPPUNIT_ASSERT(rv.find(i, 132, 2, 3, 4, 5) == false);
}


void VisitableMockObject_template_test::test_throw_5()
{
  mockpp::ResponseThrowableVector5<int, int, int, int, int> tv(("rv"), 0);
  
  mockpp::Throwable *t10 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t20 = mockpp::make_throwable((int)11);
  mockpp::Throwable *t30 = mockpp::make_throwable((int)11);
  
  tv.add(t10, 11, 2, 3, 4, 5, 1);
  tv.add(t20, 21, 2, 3, 4, 5, 1);
  tv.add(t30, 31, 2, 3, 4, 5, 1);
  
  mockpp::Throwable *t;
  
  CPPUNIT_ASSERT(tv.find(t, 11, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(t10 == t);
  CPPUNIT_ASSERT(tv.find(t, 11, 2, 3, 4, 5) == false);

  CPPUNIT_ASSERT(tv.find(t, 21, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(t20 == t);
  CPPUNIT_ASSERT(tv.find(t, 21, 2, 3, 4, 5) == false);

  CPPUNIT_ASSERT(tv.find(t, 31, 2, 3, 4, 5) == true);
  CPPUNIT_ASSERT(t30 == t);
  CPPUNIT_ASSERT(tv.find(t, 31, 2, 3, 4, 5) == false);
  
  CPPUNIT_ASSERT(tv.find(t, 0, 2, 3, 4, 5) == false);
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_test.cpp
/***************************************************************************
                     VisitableMockObject_test.cpp  
                                 -  
  unit tests for VisitableMockObject class and 0 parameter methods
                             -------------------
    begin                : Sam Feb 8 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.6  2003/02/25 20:20:48  ewald-arnold
    refactored that range/numeric/boundary/delta issue

    Revision 1.5  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.4  2003/02/18 19:30:57  ewald-arnold
    added comment

    Revision 1.3  2003/02/17 22:04:59  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.2  2003/02/16 17:35:53  ewald-arnold
    update

    Revision 1.1  2003/01/16 17:36:08  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_return);
  CPPUNIT_TEST(test_clear);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_return_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_return, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_value, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_return();
   void test_clear();
   
   void fail_unused_value();
   void fail_unused_throwable();
   void fail_return();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
   void fail_add_return_after_active();
   void fail_set_return_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_test);


class MyVisitableMockObject : public mockpp::VisitableMockObject
{
  public:
  
    MyVisitableMockObject(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_METHOD0(visitable)
    {}

    MOCKPP_VISITABLE0(MyVisitableMockObject, int, visitable);
    
    bool isClear()
    {
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0
             
             && visitablehaveDefaultReturnValue == false
             && visitableDefaultReturnValueUsed == false
             && visitableReturnValues.hasMoreObjects() == false;
    }
};
  

void VisitableMockObject_test::test_controller()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  ctr.addReturnValue(11);
  ctr.setDefaultReturnValue(123);
}


void VisitableMockObject_test::test_thrower()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));
  
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  
  mvo.activate();
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("1"), 
                         std::string, "exceptional string 1");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("2"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("3"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("4"), 
                         std::string, "exceptional string 3");
  mvo.verify();
}


void VisitableMockObject_test::fail_add_method_after_active()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  mvo.visitable();
  mvo.activate();
  mvo.visitable();
  mvo.visitable();
}


void VisitableMockObject_test::fail_add_throw_after_active()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_test::fail_set_throw_after_active()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_test::fail_add_return_after_active()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addReturnValue(1);
}


void VisitableMockObject_test::fail_set_return_after_active()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultReturnValue(1);
}


void VisitableMockObject_test::fail_return()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  
  mvo.activate();
  
  CPPUNIT_ASSERT(1 == mvo.visitable());
  CPPUNIT_ASSERT(11 == mvo.visitable());
  mvo.visitable(); // no more return objects
}


void VisitableMockObject_test::test_return()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  
  ctr.setDefaultReturnValue(123);
  ctr.addReturnValue(1);
  ctr.addReturnValue(11);
  
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  
  mvo.activate();
  
  CPPUNIT_ASSERT(1 == mvo.visitable());
  CPPUNIT_ASSERT(11 == mvo.visitable());
  CPPUNIT_ASSERT(123 == mvo.visitable());
  CPPUNIT_ASSERT(123 == mvo.visitable());
  mvo.verify();
}


void VisitableMockObject_test::test_clear()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  ctr.addReturnValue(1);
  ctr.setDefaultReturnValue(123);
  
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_test::fail_unused_throwable()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


void VisitableMockObject_test::fail_unused_value()
{
  MyVisitableMockObject mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, visitable) ctr (&mvo);
  ctr.setDefaultReturnValue(111);
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT
 

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_void_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/VisitableMockObject_void_test.cpp
        /***************************************************************************
                  VisitableMockObject_void_test.cpp  
                                 -  
  unit tests for VisitableMockObject class and 0 parameter void methods
                             -------------------
    begin                : Sam Feb 8 2003
    copyright            : (C) 2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: VisitableMockObject_void_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.4  2003/03/06 20:58:10  ewald-arnold
    fixed resetting of visitable mock object

    Revision 1.3  2003/02/23 13:35:29  ewald-arnold
    deeper verification

    Revision 1.2  2003/02/17 22:05:00  ewald-arnold
    fix for lost parameter values in exceptions

    Revision 1.1  2003/02/16 17:35:19  ewald-arnold
    new

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/ExpectationValue.h>
#include <mockpp/VisitableMockObject.h>

#include <cppunit/extensions/HelperMacros.h>

class VisitableMockObject_void_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( VisitableMockObject_void_test );

  CPPUNIT_TEST(test_controller);
  CPPUNIT_TEST(test_thrower);
  CPPUNIT_TEST(test_clear);

  CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_throw_val_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_set_throw_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_add_method_after_active, mockpp::AssertionFailedError);
  CPPUNIT_TEST_EXCEPTION(fail_unused_throwable, mockpp::AssertionFailedError);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_controller();
   void test_thrower();
   void test_clear();
   
   void fail_unused_throwable();
   void fail_add_method_after_active();
   void fail_add_throw_val_after_active();
   void fail_add_throw_after_active();
   void fail_set_throw_after_active();
};


CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockObject_void_test);


class MyVisitableMockObject_void : public mockpp::VisitableMockObject
{
  public:
  
    MyVisitableMockObject_void(const mockpp::String &name)
      : mockpp::VisitableMockObject(name, 0),
        MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_METHOD0(visitable)
    {}

    MOCKPP_VOID_VISITABLE0(MyVisitableMockObject_void, visitable);
    
    bool isClear()
    {
/*    
      std::cout << "<" 
             << (visitableDefaultThrowable.get() == 0)
             << (visitableThrowables.size() == 0)
             
             << (visitableParameter1.size() == 0)
             << (visitableParameter2.size() == 0)
             << (visitableParameter3.size() == 0)
             << (visitableParameter4.size() == 0)
             << (visitableParameter5.size() == 0)
             
             << ">\n";
*/      
      return    visitableDefaultThrowable.get() == 0  // check preprocessed doc-template.h for the actual members
             && visitableThrowables.size() == 0;
    }
};
  

void VisitableMockObject_void_test::test_controller()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
}


void VisitableMockObject_void_test::test_thrower()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string 1")));
  ctr.addThrowable(std::string("exceptional string 2"), 2);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string 3")));
  
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  mvo.visitable();
  
  mvo.activate();
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("1"), 
                         std::string, "exceptional string 1");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("2"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("3"), 
                         std::string, "exceptional string 2");
  
  MOCKPP_ASSERT_THROWING(mvo.visitable(), ("4"), 
                         std::string, "exceptional string 3");
  mvo.verify();
}


void VisitableMockObject_void_test::fail_add_method_after_active()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  
  mvo.visitable();
  mvo.activate();
  mvo.visitable();
  mvo.visitable();
}


void VisitableMockObject_void_test::fail_add_throw_after_active()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_void_test::fail_add_throw_val_after_active()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.addThrowable(std::string("exceptional string"), 1);
}


void VisitableMockObject_void_test::fail_set_throw_after_active()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  mvo.activate();
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("exceptional string")));
}


void VisitableMockObject_void_test::test_clear()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  
  ctr.addThrowable(std::string("exceptional string"), 3);
  ctr.setDefaultThrowable(mockpp::make_throwable(int(123)));
  
  mvo.activate();
  
  mvo.reset();
  CPPUNIT_ASSERT(mvo.isClear() == true);
}


void VisitableMockObject_void_test::fail_unused_throwable()
{
  MyVisitableMockObject_void mvo(("mvo"));
  MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_void, visitable) ctr (&mvo);
  ctr.setDefaultThrowable(mockpp::make_throwable(std::string("throw default")));
  mvo.activate();
  mvo.verify(); 
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/mock_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/mock_test.cpp

 /***************************************************************************
    mock_test.cpp  -  run unit tests to prove correctness of mockpp lib
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: mock_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/04/09 19:11:50  ewald-arnold
    prepared listener

    Revision 1.4  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.3  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.2  2003/01/01 09:53:55  ewald-arnold
    port BCB5

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#include <iostream>

#ifdef HAVE_CPPUNIT
# include <cppunit/extensions/TestFactoryRegistry.h>
# include <cppunit/ui/text/TestRunner.h>
# include <cppunit/extensions/HelperMacros.h>
# include <cppunit/TextTestProgressListener.h>
# include <cppunit/TestResult.h>
#endif

int main(int /* argc */, char ** /* argv */)
{
  int ret = 1;
#ifdef HAVE_CPPUNIT
  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactory &registry = CppUnit::TestFactoryRegistry::getRegistry();
/*
  CppUnit::TextTestProgressListener proglisten;
  runner.eventManager().addListener( &proglisten );
*/  
  runner.addTest(registry.makeTest());
  std::cout << "starting tests..\n";
  ret = runner.run() ? 0 : 1;
  std::cout << "Result: " << ret << std::endl;
#else
  std::cout << "CppUnit was not available at compile time!\n";
  std::cout << "No unit test are performed.\n";
  ret = 1;
#endif
  return ret;
}

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/mock_test_qt.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/mock_test_qt.cpp
/***************************************************************************
    mock_test_qt.cpp  -  run unit tests to prove correctness of mockpp lib
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: mock_test_qt.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.3  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.2  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifdef HAVE_CPPUNIT
# include <cppunit/extensions/TestFactoryRegistry.h>
# include <cppunit/ui/qt/TestRunner.h>
# include <cppunit/extensions/HelperMacros.h>
#endif

#ifdef HAVE_QT
#include <qapplication.h>
#endif

int main(int argc, char **argv)
{
  QApplication qapp(argc, argv);
#ifdef HAVE_CPPUNIT
# ifdef HAVE_QT
  CppUnit::QtUi::TestRunner runner;
  CppUnit::TestFactory &registry = CppUnit::TestFactoryRegistry::getRegistry();
  runner.addTest(registry.makeTest());
  runner.run();
# endif
#else
  std::cout << "CppUnit was not available at compile time!\n";
  std::cout << "No unit test are performed.\n";
#endif
  return 0;
}

Index: avida/current/source/third-party/trio-1.9/mockpp/tests/mockpp_test.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/tests/mockpp_test.cpp
/***************************************************************************
        mockpp_test.cpp  -  unit tests for global mockpp functions
                             -------------------
    begin                : Fri Dez 27 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: mockpp_test.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.5  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.4  2003/01/16 17:35:13  ewald-arnold
    changed email adr

    Revision 1.3  2003/01/04 09:54:21  ewald-arnold
    api restructured

    Revision 1.2  2002/12/31 13:30:28  ewald-arnold
    update

    Revision 1.1  2002/12/31 11:20:32  ewald-arnold
    unit tests installed

 ***************************************************************************/

/**************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * 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 Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ***************************************************************************/

#include <mockpp/mockpp.h> // always first

#ifndef HAVE_CPPUNIT

# pragma warning CppUnit not available at compile time

#else

#include <mockpp/compat/Assert.h>

#include <cppunit/extensions/HelperMacros.h>

class mockpp_test : public CppUnit::TestFixture
{
 public:

CPPUNIT_TEST_SUITE( mockpp_test );

  CPPUNIT_TEST(test_unicode_latin1_conv);

CPPUNIT_TEST_SUITE_END();

 public:

   void test_unicode_latin1_conv();
};


 CPPUNIT_TEST_SUITE_REGISTRATION(mockpp_test);


void mockpp_test::test_unicode_latin1_conv()
{
  std::string lat1 = "123456äöü{}ß";
  std::string uni = mockpp::getUnicode(lat1);

  CPPUNIT_ASSERT(uni.length() == lat1.length());

  for (unsigned i = 0; i < lat1.length(); ++i)
    CPPUNIT_ASSERT((wchar_t)lat1[i] == uni[i]);

  CPPUNIT_ASSERT(lat1 == mockpp::getLatin1(uni));
}


#endif // HAVE_CPPUNIT

Index: avida/current/source/third-party/trio-1.9/mockpp/util/AssertMo.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/util/AssertMo.cpp
/**
  @file    
  @brief    handle assertions of mock objects
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AssertMo.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.11  2003/04/25 12:45:30  ewald-arnold
    prevent compiler warnings

    Revision 1.10  2003/03/28 20:04:16  ewald-arnold
    extended doxygen stuff

    Revision 1.9  2003/02/18 19:51:13  ewald-arnold
    updated copyright date

    Revision 1.8  2003/01/16 17:37:13  ewald-arnold
    added docs
    changed email adr

    Revision 1.7  2003/01/06 13:37:49  ewald-arnold
    api change

    Revision 1.6  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.5  2002/12/31 11:19:48  ewald-arnold
    fixes and changes (unit tests installed)

    Revision 1.4  2002/12/27 09:45:34  ewald-arnold
    fix for unicode environment

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:21:15  ewald-arnold

    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#include <mockpp/mockpp.h> // always first

#include <mockpp/Verifiable.h>

#include <mockpp/compat/Formatter.h>
#include <mockpp/compat/AssertionFailedError.h>

#include <mockpp/util/AssertMo.h>
#include <mockpp/util/NotImplementedException.h>


namespace mockpp {


void MOCKPP_EXPORT assertExcludes(unsigned srcline, const char* srcfile,
                                  const String &description,
                                  const std::string &excludeString,
                                  const std::string &targetString)
{
  assertTrue(srcline, srcfile, description, targetString.find(excludeString) == String::npos);
}


void MOCKPP_EXPORT assertIncludes(unsigned srcline, const char* srcfile,
                                  const String &description,
                                  const std::string &includeString,
                                  const std::string &targetString)
{
  assertTrue(srcline, srcfile, description, targetString.find(includeString) != String::npos);
}


void MOCKPP_EXPORT assertStartsWith(unsigned srcline, const char* srcfile,
                                    const String &description,
                                    const std::string &startString,
                                    const std::string &targetString)
{
  assertTrue(srcline, srcfile, description, targetString.find(startString) == 0);

}


void MOCKPP_EXPORT assertVerifyFails(unsigned srcline, const char* srcfile,
                                     Verifiable *aVerifiable)
{
  bool threwException = false;
  try
  {
    aVerifiable->verify();
  }
  catch (AssertionFailedError & /*ex*/)
  {
    threwException = true;
  }

  assertTrue(srcline, srcfile, ("Should not have verified."), threwException);
}


void MOCKPP_EXPORT notImplemented(unsigned srcline, const char* srcfile,
                                  const String &mockName)
{
  mockpp::String fmt = ("Not Implemented in %1.");
  fmt << mockName;
  throw NotImplementedException(srcline, srcfile, fmt);
}


}; // namespace mockpp


Index: avida/current/source/third-party/trio-1.9/mockpp/util/AssertMo.h
+++ avida/current/source/third-party/trio-1.9/mockpp/util/AssertMo.h
/**
  @file    
  @brief    Handle assertions of mock objects
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: AssertMo.h,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.10  2003/03/23 13:17:07  ewald-arnold
    improved documentation tagging

    Revision 1.9  2003/02/18 19:51:14  ewald-arnold
    updated copyright date

    Revision 1.8  2003/02/16 17:39:29  ewald-arnold
    new asserter

    Revision 1.7  2003/01/16 17:37:13  ewald-arnold
    added docs
    changed email adr

    Revision 1.6  2003/01/06 13:37:50  ewald-arnold
    api change

    Revision 1.5  2003/01/04 12:24:53  ewald-arnold
    port to BCB5

    Revision 1.4  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:21:15  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/

#ifndef MOCKPP_ASSERTMO_H
#define MOCKPP_ASSERTMO_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/Assert.h>
#include <mockpp/compat/Formatter.h>


namespace mockpp {


class Verifiable;

/**
  * Asserts that a string does not contain a substring. If it does anyway it throws
  * an AssertionFailedError with the given infomation.
  * @param srcline       the line in the sourcefile
  * @param srcfile       the name of the sourcefile
  * @param message       a human readable description about the cause
  * @param excludeString substring which should not occur
  * @param targetString  string in which is searched
  */
void assertExcludes(unsigned srcline, const char* srcfile,
                    const String &description,
                    const std::string &excludeString,
                    const std::string &targetString);

/**
  * Asserts that a string does contain a substring. If it does not it throws
  * an AssertionFailedError with the given infomation.
  * @param srcline       the line in the sourcefile
  * @param srcfile       the name of the sourcefile
  * @param message       a human readable description about the cause
  * @param includeString substring which must occur
  * @param targetString  string in which is searched
  */
void assertIncludes(unsigned srcline, const char* srcfile,
                    const String &description,
                    const std::string &includeString,
                    const std::string &targetString);

/**
  * Asserts that a string starts with a substring. If it does not it throws
  * an AssertionFailedError with the given infomation.
  * @param srcline       the line in the sourcefile
  * @param srcfile       the name of the sourcefile
  * @param message       a human readable description about the cause
  * @param startString   string which must occur at the beginning
  * @param targetString  string in which is searched
  */
void assertStartsWith(unsigned srcline, const char* srcfile,
                      const String &description,
                      const std::string &startString,
                      const std::string &targetString);

/**
  * Asserts that a verify() of an object fails. If it does not it throws
  * an AssertionFailedError.
  * @param srcline       the line in the sourcefile
  * @param srcfile       the name of the sourcefile
  * @param aVerifiable   object to be verified
  */
void assertVerifyFails(unsigned srcline, const char* srcfile,
                       Verifiable *aVerifiable);
                       
/**
  * Throws unconditionally a NotImplementedException with the given name to
  * indicate a not yet implemented method.
  * @param srcline       the line in the sourcefile
  * @param srcfile       the name of the sourcefile
  * @param mockName      name of the object
  */
void notImplemented(unsigned srcline, const char* srcfile,
                    const String &mockName);


}; // namespace mockpp


/**
  * Asserts that a string does contain a substring. If it does not it throws
  * an AssertionFailedError with the given infomation.
  * @param msg           a human readable description about the cause
  * @param a             string which must occur at the beginning
  * @param b             string in which is searched
  */
#define MOCKPP_ASSERT_INCLUDES_MESSAGE(msg, a, b)  mockpp::assertIncludes(__LINE__, __FILE__, msg, a, b)

/**
  * Asserts that a string does contain a substring. If it does not it throws
  * an AssertionFailedError with the given infomation.
  * The condition is converted and passed as the according message.
  * @param a             string which must occur at the beginning
  * @param b             string in which is searched
  */
#define MOCKPP_ASSERT_INCLUDES(a, b)  mockpp::assertIncludes(__LINE__, __FILE__, (#a " <in> " #b), a, b)

/**
  * Asserts that a string does not contain a substring. If it does it throws
  * an AssertionFailedError with the given infomation.
  * @param msg           a human readable description about the cause
  * @param a             string which must occur at the beginning
  * @param b             string in which is searched
  */
#define MOCKPP_ASSERT_EXCLUDES_MESSAGE(msg, a, b)  mockpp::assertExcludes(__LINE__, __FILE__, msg, a, b)

/**
  * Asserts that a string does not contain a substring. If it does it throws
  * an AssertionFailedError with the given infomation.
  * The condition is converted and passed as the according message.
  * @param a             string which must occur at the beginning
  * @param b             string in which is searched
  */
#define MOCKPP_ASSERT_EXCLUDES(a, b)  mockpp::assertExcludes(__LINE__, __FILE__, (#a " <!in> " #b), a, b)

/**
  * Asserts that a string starts with a substring. If it does not it throws
  * an AssertionFailedError with the given infomation.
  * @param msg           a human readable description about the cause
  * @param a             string which must occur at the beginning
  * @param b             string in which is searched
  */
#define MOCKPP_ASSERT_STARTSWITH_MESSAGE(msg, a, b)  mockpp::assertStartsWith(__LINE__, __FILE__, msg, a, b)

/**
  * Asserts that a string starts with a substring. If it does not it throws
  * an AssertionFailedError with the given infomation.
  * The condition is converted and passed as the according message.
  * @param a             string which must occur at the beginning
  * @param b             string in which is searched
  */
#define MOCKPP_ASSERT_STARTSWITH(a, b)  mockpp::assertStartsWith(__LINE__, __FILE__, (#a " <starts> " #b), a, b)

/**
  * Asserts that a verify() of an object fails. If it does not it throws
  * an AssertionFailedError.
  * @param obj   object to be verified
  */
#define MOCKPP_ASSERT_VERIFYFAILS(obj)  mockpp::assertVerifyFails(__LINE__, __FILE__, obj)

/**
  * Throws unconditionally a NotImplementedException with the given name to
  * indicate a not yet implemented method.
  * @param msg   name of the object
  */
#define MOCKPP_NOT_IMPLEMENTED(msg)  mockpp::notImplemented(__LINE__, __FILE__, msg)


/**
  * Asserts that an exception is thrown and that the data is correctly 
  * transfered to the catch clause.
  * @param action        C++-statement to execute and throw
  * @param action_name   decription for the action
  * @param except        exception type to be thrown
  * @param ex_data       the data the exception contains
  */
#define MOCKPP_ASSERT_THROWING(action, action_name, except, ex_data) \
  try \
  { \
    action; \
    MOCKPP_FAIL(("Did not throw the exception: ") + action_name); \
  } \
  catch(except &ex) \
  { \
    MOCKPP_ASSERT_TRUE(ex == ex_data); \
  } \
  catch(std::exception &ex)  \
  { \
    MOCKPP_ASSERT_TRUE_MESSAGE((ex.what()), false); \
  } \
  catch(...) \
  { \
    MOCKPP_FAIL(("Caught unknown exception: ") + action_name); \
  }

#endif // MOCKPP_ASSERTMO_H

Index: avida/current/source/third-party/trio-1.9/mockpp/util/Makefile.am
+++ avida/current/source/third-party/trio-1.9/mockpp/util/Makefile.am
INCLUDES = -I$(srcdir)/../..

noinst_LIBRARIES = libutil.a

libutil_a_SOURCES = \
  AssertMo.cpp \
  NotImplementedException.cpp

libutilincludedir = $(includedir)/mockpp/util
libutilinclude_HEADERS =  \
  $(libutil_a_SOURCES:.cpp=.h)


Index: avida/current/source/third-party/trio-1.9/mockpp/util/NotImplementedException.cpp
+++ avida/current/source/third-party/trio-1.9/mockpp/util/NotImplementedException.cpp
/**
  @file    
  @brief    exception for not implemented stuff
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: NotImplementedException.cpp,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/03/28 20:04:16  ewald-arnold
    extended doxygen stuff

    Revision 1.6  2003/02/18 19:51:15  ewald-arnold
    updated copyright date

    Revision 1.5  2003/01/16 17:37:13  ewald-arnold
    added docs
    changed email adr

    Revision 1.4  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:21:15  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/


#include <mockpp/mockpp.h> // always first

#include <mockpp/util/NotImplementedException.h>


namespace mockpp {

MOCKPP_EXPORT
NotImplementedException::NotImplementedException(unsigned srcline, const char* srcfile,
                                                 const String &message)
  : AssertionFailedError(srcline, srcfile, message)
{
}


}; // namespace mockpp


Index: avida/current/source/third-party/trio-1.9/mockpp/util/NotImplementedException.h
+++ avida/current/source/third-party/trio-1.9/mockpp/util/NotImplementedException.h
/**
  @file    
  @brief Exception for not implemented stuff   
                    
  @verbatim
    
    begin                : Sat Dec 21 2002
    copyright            : (C) 2002,2003 by Ewald Arnold
    email                : mockpp at ewald-arnold dot de

    $Log: NotImplementedException.h,v $
    Revision 1.1  2003/11/25 18:20:49  kaben

    In process of constructing version 2.0b9.
    - updated stale Makefile.ams and configure.in.
    - updated *.cc and *.hh in qt-viewer/ and viewers/.
    - added third-party suites mockpp and yaktest, both for use in unit
      tests.

    Revision 1.7  2003/03/23 13:17:07  ewald-arnold
    improved documentation tagging

    Revision 1.6  2003/02/18 19:51:15  ewald-arnold
    updated copyright date

    Revision 1.5  2003/01/16 17:37:13  ewald-arnold
    added docs
    changed email adr

    Revision 1.4  2003/01/04 09:52:03  ewald-arnold
    api restructured

    Revision 1.3  2002/12/27 08:23:52  ewald-arnold
    preparations for  and windoze

    Revision 1.2  2002/12/25 10:21:15  ewald-arnold
    basic version which compiles

    Revision 1.1.1.1  2002/12/22 09:57:53  ewald-arnold
    import

  @endverbatim
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
   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 Lesser General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
 **/
  

#ifndef MOCKPP_NOTIMPLEMENTEDEXCEPTION_H
#define MOCKPP_NOTIMPLEMENTEDEXCEPTION_H

#include <mockpp/mockpp.h> // always first

#include <mockpp/compat/AssertionFailedError.h>


namespace mockpp {


/** Signal not-yet implemented methods.
  */
class NotImplementedException : public AssertionFailedError
{
  public:
  /**
    * NotImplementedException constructor comment.
    * @param message java.lang.String
    */
    NotImplementedException(unsigned srcline, const char* srcfile, const String &message);
};


}; // namespace mockpp


#endif // MOCKPP_NOTIMPLEMENTEDEXCEPTION_H

Index: avida/current/source/third-party/trio-1.9/trio/2003.11.25..13.08.45-add
+++ avida/current/source/third-party/trio-1.9/trio/2003.11.25..13.08.45-add
***
starting at 2003.11.25..13.08.45
command:
***

cvs add

***
exported environment:
***

export BASH_ENV="/Users/kaben/.bashrc"
export CSCOPE_EDITOR="vim"
export CVSROOT=":ext:kaben at cvs.avida.sourceforge.net:/cvsroot/avida"
export CVS_RSH="ssh"
export EDITOR="vim"
export GNUTERM="aqua"
export GNUTERMAPP="/sw/Applications/AquaTerm.app"
export HOME="/Users/kaben"
export INFODIR="/opt/local/info:/Users/kaben/Projects/local/info:/opt/local/info:/Users/kaben/Projects/local/info:/sw/share/info:/sw/info:/usr/share/info"
export INFOPATH="/opt/local/info:/Users/kaben/Projects/local/info:/opt/local/info:/Users/kaben/Projects/local/info:/sw/share/info:/sw/info:/usr/share/info"
export IRCLIB="/Users/kaben/Dist/BitchX/BitchX/TARGET/lib/bx/"
export IRCNAME="K. G. Nanlohy"
export IRCNICK="kgn"
export IRCSERVER="irc.scifi.com"
export LANG="en_US"
export LD_PREBIND="1"
export LD_PREBIND_ALLOW_OVERLAP="1"
export LD_SEG_ADDR_TABLE="/sw/var/lib/fink/prebound/seg_addr_table"
export LOGNAME="kaben"
export MANPATH="/opt/local/man:/Users/kaben/Projects/local/man:/opt/local/man:/Users/kaben/Projects/local/man:/sw/share/man:/usr/share/man:/usr/X11R6/man"
export OLDPWD
export PAGER="less"
export PATH="/opt/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/Users/kaben/bin:/Users/kaben/Projects/local/bin:/Users/kaben/bin:/Users/kaben/Projects/local/bin"
export PERL5LIB="/sw/lib/perl5"
export PRCS_CONFLICT_EDITOR="vim"
export PRCS_LOGQUERY=""
export PWD="/Users/kaben/Projects/software/avida/branch.HEAD/current.refactored.postcheckin/source/third-party/trio"
export PYTHONDOCS="/Users/kaben/Projects/software/PythonDocs/Python-Docs-2.3.2/"
export PYTHONSTARTUP="/Users/kaben/.pystartup"
export RSYNC_RSH="ssh"
export SGML_CATALOG_FILES="/sw/etc/sgml/catalog"
export SHELL="/bin/bash"
export SHLVL="3"
export STY="22093.k"
export TERM="screen"
export TERMCAP="SC|screen|VT 100/ANSI X3.64 virtual terminal:\\\
	:DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:bs:bt=\\E[Z:\\\
	:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:ct=\\E[3g:\\\
	:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\\\
	:le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:\\\
	:li#103:co#100:am:xn:xv:LP:sr=\\EM:al=\\E[L:AL=\\E[%dL:\\\
	:cs=\\E[%i%d;%dr:dl=\\E[M:DL=\\E[%dM:dc=\\E[P:DC=\\E[%dP:\\\
	:im=\\E[4h:ei=\\E[4l:mi:IC=\\E[%d@:ks=\\E[?1h\\E=:\\\
	:ke=\\E[?1l\\E>:vi=\\E[?25l:ve=\\E[34h\\E[?25h:vs=\\E[34l:\\\
	:us=\\E[4m:ue=\\E[24m:so=\\E[3m:se=\\E[23m:md=\\E[1m:\\\
	:mr=\\E[7m:me=\\E[m:ms:\\\
	:Co#8:pa#64:AF=\\E[3%dm:AB=\\E[4%dm:op=\\E[39;49m:AX:\\\
	:as=\\E(0:ae=\\E(B:\\\
	:ac=\\140\\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\\\
	:Z0=\\E[?3h:Z1=\\E[?3l:k0=\\E[10~:k1=\\EOP:k2=\\EOQ:k3=\\EOR:\\\
	:k4=\\EOS:k5=\\E[15~:k6=\\E[17~:k7=\\E[18~:k8=\\E[19~:\\\
	:k9=\\E[20~:k;=\\E[21~:F1=\\E[23~:F2=\\E[24~:F3=\\E[25~:\\\
	:F4=\\E[26~:F5=\\E[28~:F6=\\E[29~:F7=\\E[31~:F8=\\E[32~:\\\
	:F9=\\E[33~:FA=\\E[34~:kb=^H:kh=\\E[1~:kH=\\E[4~:kN=\\E[6~:\\\
	:kP=\\E[5~:kI=\\E[2~:kD=\\E[3~:ku=\\EOA:kd=\\EOB:kr=\\EOC:\\\
	:kl=\\EOD:km:"
export TERM_PROGRAM="Apple_Terminal"
export TERM_PROGRAM_VERSION="81"
export USER="kaben"
export USERNAME=""
export WINDOW="2"
export XML_CATALOG_FILES="/sw/etc/xml/catalog"
export __CF_USER_TEXT_ENCODING="0x1F5:0:0"

***
output follows...
***

Usage: cvs add [-k rcs-kflag] [-m message] files...
	-k	Use "rcs-kflag" to add the file with the specified kflag.
	-m	Use "message" for the creation log.
(Specify the --help global option for a list of other help options)

Index: avida/current/source/third-party/trio-1.9/trio/FILES.0
+++ avida/current/source/third-party/trio-1.9/trio/FILES.0
FILES
README
CHANGES
Makefile.in
maketgz
strio.h
trio.c
trio.h
triodef.h
trionan.c
trionan.h
triop.h
triostr.c
triostr.h
compare.c
example.c
regression.c
configure
configure.in
config.guess
config.sub
install-sh
autogen.sh
doc/doc.h
doc/doc_dynamic.h
doc/doc_printf.h
doc/doc_register.h
doc/doc_scanf.h
doc/doc_static.h
doc/footer.html
doc/header.html
doc/trio.cfg
doc/trio.css
html/trio.css
html/*.html

Index: avida/current/source/third-party/trio-1.9/trio/Makefile.am
+++ avida/current/source/third-party/trio-1.9/trio/Makefile.am

noinst_LIBRARIES = libtrio.a
libtrio_a_SOURCES = \
  trio.c trio.h \
  triostr.c triostr.h \
  trionan.c trionan.h \
  triodef.h triop.h strio.h

EXTRA_DIST = trio.pri

Index: avida/current/source/third-party/trio-1.9/trio/Makefile.in
+++ avida/current/source/third-party/trio-1.9/trio/Makefile.in
# Makefile.in generated by automake 1.7.6 from Makefile.am.
# @configure_input@

# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../..

am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_PRIMITIVE_FALSE = @BUILD_PRIMITIVE_FALSE@
BUILD_PRIMITIVE_TRUE = @BUILD_PRIMITIVE_TRUE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CODE_TESTS_FALSE = @CODE_TESTS_FALSE@
CODE_TESTS_TRUE = @CODE_TESTS_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFAULT_TESTS_FALSE = @DEFAULT_TESTS_FALSE@
DEFAULT_TESTS_TRUE = @DEFAULT_TESTS_TRUE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HTMLDIR = @HTMLDIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
QMAKE = @QMAKE@
QMAKE_DEBUG_FALSE = @QMAKE_DEBUG_FALSE@
QMAKE_DEBUG_TRUE = @QMAKE_DEBUG_TRUE@
QMAKE_WARN_FALSE = @QMAKE_WARN_FALSE@
QMAKE_WARN_TRUE = @QMAKE_WARN_TRUE@
QT_VIEWER_FALSE = @QT_VIEWER_FALSE@
QT_VIEWER_TRUE = @QT_VIEWER_TRUE@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TEDIOUS_TESTS_FALSE = @TEDIOUS_TESTS_FALSE@
TEDIOUS_TESTS_TRUE = @TEDIOUS_TESTS_TRUE@
VERSION = @VERSION@
VIEW = @VIEW@
VIEWER_FALSE = @VIEWER_FALSE@
VIEWER_TRUE = @VIEWER_TRUE@
VIEW_LIBS = @VIEW_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@

noinst_LIBRARIES = libtrio.a
libtrio_a_SOURCES = \
  trio.c trio.h \
  triostr.c triostr.h \
  trionan.c trionan.h \
  triodef.h triop.h strio.h


EXTRA_DIST = trio.pri
subdir = source/third-party/trio
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)

libtrio_a_AR = $(AR) cru
libtrio_a_LIBADD =
am_libtrio_a_OBJECTS = trio.$(OBJEXT) triostr.$(OBJEXT) \
	trionan.$(OBJEXT)
libtrio_a_OBJECTS = $(am_libtrio_a_OBJECTS)

DEFAULT_INCLUDES =  -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE at DEP_FILES = ./$(DEPDIR)/trio.Po ./$(DEPDIR)/trionan.Po \
@AMDEP_TRUE@	./$(DEPDIR)/triostr.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libtrio_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(libtrio_a_SOURCES)

all: all-am

SUFFIXES:
SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  source/third-party/trio/Makefile
Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)

AR = ar

clean-noinstLIBRARIES:
	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libtrio.a: $(libtrio_a_OBJECTS) $(libtrio_a_DEPENDENCIES) 
	-rm -f libtrio.a
	$(libtrio_a_AR) libtrio.a $(libtrio_a_OBJECTS) $(libtrio_a_LIBADD)
	$(RANLIB) libtrio.a

mostlyclean-compile:
	-rm -f *.$(OBJEXT) core *.core

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trio.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trionan.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/triostr.Po at am__quote@

distclean-depend:
	-rm -rf ./$(DEPDIR)

c.o:
@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@	fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<

c.obj:
@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@	fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:

ETAGS = etags
ETAGSFLAGS =

CTAGS = ctags
CTAGSFLAGS =

tags: TAGS

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(ETAGS_ARGS)$$tags$$unique" \
	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	     $$tags $$unique

ctags: CTAGS
CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

top_distdir = ../../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkinstalldirs) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)

installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-am

clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am

distclean: distclean-am

distclean-am: clean-am distclean-compile distclean-depend \
	distclean-generic distclean-tags

dvi: dvi-am

dvi-am:

info: info-am

info-am:

install-data-am:

install-exec-am:

install-info: install-info-am

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-am

maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic

pdf: pdf-am

pdf-am:

ps: ps-am

ps-am:

uninstall-am: uninstall-info-am

PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
	clean-noinstLIBRARIES ctags distclean distclean-compile \
	distclean-depend distclean-generic distclean-tags distdir dvi \
	dvi-am info info-am install install-am install-data \
	install-data-am install-exec install-exec-am install-info \
	install-info-am install-man install-strip installcheck \
	installcheck-am installdirs maintainer-clean \
	maintainer-clean-generic mostlyclean mostlyclean-compile \
	mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
	uninstall-am uninstall-info-am

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
NOEXPORT:

Index: avida/current/source/third-party/trio-1.9/trio/README.0
+++ avida/current/source/third-party/trio-1.9/trio/README.0
README -- trio

Trio is a package with portable string functions. Including printf() clones
and others.

 Copyright (C) 1998-2001 by Bjorn Reese and Daniel Stenberg.

 Permission to use, copy, modify, and distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
 copyright notice and this permission notice appear in all copies.

 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.

Trio is intended to be an integral part of another application, so we
have not done anything to create a proper installation.

Compile with 'make' (edit the Makefile if you want a release build)

Test the package with 'make test'

Install by copying trio.h, triop.h, and libtrio.a (and man/man?/* if
you want documentation) to the appropriate directories.

Catch some usage examples in example.c

Send feedback and patches to the mailing list, subscription and other
information is found here:

        http://lists.sourceforge.net/lists/listinfo/ctrio-talk

Enjoy!

Trio web page

        http://daniel.haxx.se/trio/

Index: avida/current/source/third-party/trio-1.9/trio/autogen.sh.0
+++ avida/current/source/third-party/trio-1.9/trio/autogen.sh.0
#!/bin/sh
autoconf
rm -rf autom4te.cache

Index: avida/current/source/third-party/trio-1.9/trio/compare.c
+++ avida/current/source/third-party/trio-1.9/trio/compare.c
#include "trio.h"

#define compare(format, value) printf("FORMAT: %s\n", format); printf("TRIO: "); trio_printf(format,value); printf("\nLIBC: "); \
printf(format,value); printf("\n\n"); 

int main()
{
   compare("\"%e\"",2.342E+02);
   compare("\"%10.4e\"",-2.342E-02);
   compare("\"%11.4e\"",-2.342E-02);
   compare("\"%12.4e\"",-2.342E-02);
   compare("\"%13.4e\"",-2.342E-02);
   compare("\"%14.4e\"",-2.342E-02);
   compare("\"%15.4e\"",-2.342E-02);
   compare("\"%16.4e\"",-2.342E-02);
   compare("\"%16.4e\"",-2.342E-22);
   compare("\"%G\"",-2.342E-02);
   compare("\"%G\"",3.1415e-6);
   compare("%016e", 3141.5);
   compare("%16e", 3141.5);
   compare("%-16e", 3141.5);
   compare("%010.3e", 3141.5);

   compare("*%5f*", 3.3);
   compare("*%5f*", 3.0);
   compare("*%5f*", .999999E-4);
   compare("*%5f*", .99E-3);
   compare("*%5f*", 3333.0);

   compare("*%5g*", 3.3);
   compare("*%5g*", 3.0);
   compare("*%5g*", .999999E-4);
   compare("*%5g*", .99E-3);
   compare("*%5g*", 3333.0);
   compare("*%5g*", 0.01);

   compare("*%5.g*", 3.3);
   compare("*%5.g*", 3.0);
   compare("*%5.g*", .999999E-4);
   compare("*%5.g*", 1.0E-4);
   compare("*%5.g*", .99E-3);
   compare("*%5.g*", 3333.0);
   compare("*%5.g*", 0.01);

   compare("*%5.2g*", 3.3);
   compare("*%5.2g*", 3.0);
   compare("*%5.2g*", .999999E-4);
   compare("*%5.2g*", .99E-3);
   compare("*%5.2g*", 3333.0);
   compare("*%5.2g*", 0.01);

   return 0;
}

Index: avida/current/source/third-party/trio-1.9/trio/config.guess.0
+++ avida/current/source/third-party/trio-1.9/trio/config.guess.0
#! /bin/sh
# Attempt to guess a canonical system name.
#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
#
# This file 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Written by Per Bothner <bothner at cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub.  If it succeeds, it prints the system name on stdout, and
# exits with 0.  Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#

# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi at noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
	PATH=$PATH:/.attbin ; export PATH
fi

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15

# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
    alpha:OSF1:*:*)
	if test $UNAME_RELEASE = "V4.0"; then
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
	fi
	# A Vn.n version is a released version.
	# A Tn.n version is a released field test version.
	# A Xn.n version is an unreleased experimental baselevel.
	# 1.2 uses "1.2" for uname -r.
	cat <<EOF >dummy.s
	.globl main
	.ent main
main:
	.frame \$30,0,\$26,0
	.prologue 0
	.long 0x47e03d80 # implver $0
	lda \$2,259
	.long 0x47e20c21 # amask $2,$1
	srl \$1,8,\$2
	sll \$2,2,\$2
	sll \$0,3,\$0
	addl \$1,\$0,\$0
	addl \$2,\$0,\$0
	ret \$31,(\$26),1
	.end main
EOF
	${CC-cc} dummy.s -o dummy 2>/dev/null
	if test "$?" = 0 ; then
		./dummy
		case "$?" in
			7)
				UNAME_MACHINE="alpha"
				;;
			15)
				UNAME_MACHINE="alphaev5"
				;;
			14)
				UNAME_MACHINE="alphaev56"
				;;
			10)
				UNAME_MACHINE="alphapca56"
				;;
			16)
				UNAME_MACHINE="alphaev6"
				;;
		esac
	fi
	rm -f dummy.s dummy
	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
	exit 0 ;;
    21064:Windows_NT:50:3)
	echo alpha-dec-winnt3.5
	exit 0 ;;
    Amiga*:UNIX_System_V:4.0:*)
	echo m68k-cbm-sysv4
	exit 0;;
    amiga:NetBSD:*:*)
      echo m68k-cbm-netbsd${UNAME_RELEASE}
      exit 0 ;;
    amiga:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    *:[Aa]miga[Oo][Ss]:*:*)
	echo ${UNAME_MACHINE}-unknown-amigaos
	exit 0 ;;
    arc64:OpenBSD:*:*)
	echo mips64el-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    arc:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    hkmips:OpenBSD:*:*)
	echo mips-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    pmax:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sgi:OpenBSD:*:*)
	echo mips-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    wgrisc:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
	echo arm-acorn-riscix${UNAME_RELEASE}
	exit 0;;
    arm32:NetBSD:*:*)
	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
	exit 0 ;;
    SR2?01:HI-UX/MPP:*:*)
	echo hppa1.1-hitachi-hiuxmpp
	exit 0;;
    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
		echo pyramid-pyramid-sysv3
	else
		echo pyramid-pyramid-bsd
	fi
	exit 0 ;;
    NILE:*:*:dcosx)
	echo pyramid-pyramid-svr4
	exit 0 ;;
    sun4H:SunOS:5.*:*)
	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    i86pc:SunOS:5.*:*)
	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:6*:*)
	# According to config.sub, this is the proper way to canonicalize
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
	# it's likely to be more like Solaris than SunOS4.
	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:*:*)
	case "`/usr/bin/arch -k`" in
	    Series*|S4*)
		UNAME_RELEASE=`uname -v`
		;;
	esac
	# Japanese Language versions have a version number like `4.1.3-JL'.
	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
	exit 0 ;;
    sun3*:SunOS:*:*)
	echo m68k-sun-sunos${UNAME_RELEASE}
	exit 0 ;;
    sun*:*:4.2BSD:*)
	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
	case "`/bin/arch`" in
	    sun3)
		echo m68k-sun-sunos${UNAME_RELEASE}
		;;
	    sun4)
		echo sparc-sun-sunos${UNAME_RELEASE}
		;;
	esac
	exit 0 ;;
    aushp:SunOS:*:*)
	echo sparc-auspex-sunos${UNAME_RELEASE}
	exit 0 ;;
    atari*:NetBSD:*:*)
	echo m68k-atari-netbsd${UNAME_RELEASE}
	exit 0 ;;
    atari*:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sun3*:NetBSD:*:*)
	echo m68k-sun-netbsd${UNAME_RELEASE}
	exit 0 ;;
    sun3*:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mac68k:NetBSD:*:*)
	echo m68k-apple-netbsd${UNAME_RELEASE}
	exit 0 ;;
    mac68k:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvme68k:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvme88k:OpenBSD:*:*)
	echo m88k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    powerpc:machten:*:*)
	echo powerpc-apple-machten${UNAME_RELEASE}
	exit 0 ;;
    macppc:NetBSD:*:*)
        echo powerpc-apple-netbsd${UNAME_RELEASE}
        exit 0 ;;
    RISC*:Mach:*:*)
	echo mips-dec-mach_bsd4.3
	exit 0 ;;
    RISC*:ULTRIX:*:*)
	echo mips-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    VAX*:ULTRIX*:*:*)
	echo vax-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    2020:CLIX:*:*)
	echo clipper-intergraph-clix${UNAME_RELEASE}
	exit 0 ;;
    mips:*:*:UMIPS | mips:*:*:RISCos)
	sed 's/^	//' << EOF >dummy.c
	int main (argc, argv) int argc; char **argv; {
	#if defined (host_mips) && defined (MIPSEB)
	#if defined (SYSTYPE_SYSV)
	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_SVR4)
	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
	#endif
	#endif
	  exit (-1);
	}
EOF
	${CC-cc} dummy.c -o dummy \
	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
	  && rm dummy.c dummy && exit 0
	rm -f dummy.c dummy
	echo mips-mips-riscos${UNAME_RELEASE}
	exit 0 ;;
    Night_Hawk:Power_UNIX:*:*)
	echo powerpc-harris-powerunix
	exit 0 ;;
    m88k:CX/UX:7*:*)
	echo m88k-harris-cxux7
	exit 0 ;;
    m88k:*:4*:R4*)
	echo m88k-motorola-sysv4
	exit 0 ;;
    m88k:*:3*:R3*)
	echo m88k-motorola-sysv3
	exit 0 ;;
    AViiON:dgux:*:*)
        # DG/UX returns AViiON for all architectures
        UNAME_PROCESSOR=`/usr/bin/uname -p`
        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
		echo m88k-dg-dgux${UNAME_RELEASE}
	else
		echo m88k-dg-dguxbcs${UNAME_RELEASE}
	fi
        else echo i586-dg-dgux${UNAME_RELEASE}
        fi
 	exit 0 ;;
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
	echo m88k-dolphin-sysv3
	exit 0 ;;
    M88*:*:R3*:*)
	# Delta 88k system running SVR3
	echo m88k-motorola-sysv3
	exit 0 ;;
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
	echo m88k-tektronix-sysv3
	exit 0 ;;
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
	echo m68k-tektronix-bsd
	exit 0 ;;
    *:IRIX*:*:*)
	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
	exit 0 ;;
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
    i?86:AIX:*:*)
	echo i386-ibm-aix
	exit 0 ;;
    *:AIX:2:3)
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
		sed 's/^		//' << EOF >dummy.c
		#include <sys/systemcfg.h>

		main()
			{
			if (!__power_pc())
				exit(1);
			puts("powerpc-ibm-aix3.2.5");
			exit(0);
			}
EOF
		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
		rm -f dummy.c dummy
		echo rs6000-ibm-aix3.2.5
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
		echo rs6000-ibm-aix3.2.4
	else
		echo rs6000-ibm-aix3.2
	fi
	exit 0 ;;
    *:AIX:*:4)
	if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
		IBM_ARCH=rs6000
	else
		IBM_ARCH=powerpc
	fi
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
		IBM_REV=4.${UNAME_RELEASE}
	fi
	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
	exit 0 ;;
    *:AIX:*:*)
	echo rs6000-ibm-aix
	exit 0 ;;
    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
	echo romp-ibm-bsd4.4
	exit 0 ;;
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
	exit 0 ;;                           # report: romp-ibm BSD 4.3
    *:BOSX:*:*)
	echo rs6000-bull-bosx
	exit 0 ;;
    DPX/2?00:B.O.S.:*:*)
	echo m68k-bull-sysv3
	exit 0 ;;
    9000/[34]??:4.3bsd:1.*:*)
	echo m68k-hp-bsd
	exit 0 ;;
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
	echo m68k-hp-bsd4.4
	exit 0 ;;
    9000/[3478]??:HP-UX:*:*)
	case "${UNAME_MACHINE}" in
	    9000/31? )            HP_ARCH=m68000 ;;
	    9000/[34]?? )         HP_ARCH=m68k ;;
	    9000/7?? | 9000/8?[1679] ) 
              sed 's/^              //' << EOF >dummy.c
              #include <stdlib.h>
              #include <unistd.h>
              
              int main ()
              {
              #if defined(_SC_KERNEL_BITS)
                  long bits = sysconf(_SC_KERNEL_BITS);
              #endif 
                  long cpu  = sysconf (_SC_CPU_VERSION);
              
                  switch (cpu) 
              	{
              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
              	case CPU_PA_RISC2_0: 
              #if defined(_SC_KERNEL_BITS)
              	    switch (bits) 
              		{
              		case 64: puts ("hppa2.0w"); break;
              		case 32: puts ("hppa2.0n"); break;
              		default: puts ("hppa2.0"); break;
              		} break;
              #else  /* !defined(_SC_KERNEL_BITS) */
              	    puts ("hppa2.0"); break;
              #endif 
              	default: puts ("hppa1.0"); break;
              	}
                  exit (0);
              }
EOF
	${CC-cc} dummy.c -o dummy && HP_ARCH=`./dummy`
	rm -f dummy.c dummy
	esac
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
	exit 0 ;;
    3050*:HI-UX:*:*)
	sed 's/^	//' << EOF >dummy.c
	#include <unistd.h>
	int
	main ()
	{
	  long cpu = sysconf (_SC_CPU_VERSION);
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
	     results, however.  */
	  if (CPU_IS_PA_RISC (cpu))
	    {
	      switch (cpu)
		{
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
		}
	    }
	  else if (CPU_IS_HP_MC68K (cpu))
	    puts ("m68k-hitachi-hiuxwe2");
	  else puts ("unknown-hitachi-hiuxwe2");
	  exit (0);
	}
EOF
	${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
	rm -f dummy.c dummy
	echo unknown-hitachi-hiuxwe2
	exit 0 ;;
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
	echo hppa1.1-hp-bsd
	exit 0 ;;
    9000/8??:4.3bsd:*:*)
	echo hppa1.0-hp-bsd
	exit 0 ;;
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
	echo hppa1.1-hp-osf
	exit 0 ;;
    hp8??:OSF1:*:*)
	echo hppa1.0-hp-osf
	exit 0 ;;
    i?86:OSF1:*:*)
	if [ -x /usr/sbin/sysversion ] ; then
	    echo ${UNAME_MACHINE}-unknown-osf1mk
	else
	    echo ${UNAME_MACHINE}-unknown-osf1
	fi
	exit 0 ;;
    parisc*:Lites*:*:*)
	echo hppa1.1-hp-lites
	exit 0 ;;
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
	echo c1-convex-bsd
        exit 0 ;;
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
        exit 0 ;;
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
	echo c34-convex-bsd
        exit 0 ;;
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
	echo c38-convex-bsd
        exit 0 ;;
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
	echo c4-convex-bsd
        exit 0 ;;
    CRAY*X-MP:*:*:*)
	echo xmp-cray-unicos
        exit 0 ;;
    CRAY*Y-MP:*:*:*)
	echo ymp-cray-unicos${UNAME_RELEASE}
	exit 0 ;;
    CRAY*[A-Z]90:*:*:*)
	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
	exit 0 ;;
    CRAY*TS:*:*:*)
	echo t90-cray-unicos${UNAME_RELEASE}
	exit 0 ;;
    CRAY-2:*:*:*)
	echo cray2-cray-unicos
        exit 0 ;;
    F300:UNIX_System_V:*:*)
        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit 0 ;;
    F301:UNIX_System_V:*:*)
       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
       exit 0 ;;
    hp3[0-9][05]:NetBSD:*:*)
	echo m68k-hp-netbsd${UNAME_RELEASE}
	exit 0 ;;
    hp300:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    i?86:BSD/386:*:* | *:BSD/OS:*:*)
	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
	exit 0 ;;
    *:FreeBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
	exit 0 ;;
    *:NetBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
	exit 0 ;;
    *:OpenBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
	exit 0 ;;
    i*:CYGWIN*:*)
	echo ${UNAME_MACHINE}-pc-cygwin32
	exit 0 ;;
    i*:MINGW*:*)
	echo ${UNAME_MACHINE}-pc-mingw32
	exit 0 ;;
    p*:CYGWIN*:*)
	echo powerpcle-unknown-cygwin32
	exit 0 ;;
    prep*:SunOS:5.*:*)
	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    *:GNU:*:*)
	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
	exit 0 ;;
    *:Linux:*:*)
	# uname on the ARM produces all sorts of strangeness, and we need to
	# filter it out.
	case "$UNAME_MACHINE" in
	  arm* | sa110*)	      UNAME_MACHINE="arm" ;;
	esac

	# The BFD linker knows what the default object file format is, so
	# first see if it will tell us.
	ld_help_string=`ld --help 2>&1`
	ld_supported_emulations=`echo $ld_help_string \
			 | sed -ne '/supported emulations:/!d
				    s/[ 	][ 	]*/ /g
				    s/.*supported emulations: *//
				    s/ .*//
				    p'`
        case "$ld_supported_emulations" in
	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
	  elf32ppc)   echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
	esac

	if test "${UNAME_MACHINE}" = "alpha" ; then
		sed 's/^	//'  <<EOF >dummy.s
		.globl main
		.ent main
	main:
		.frame \$30,0,\$26,0
		.prologue 0
		.long 0x47e03d80 # implver $0
		lda \$2,259
		.long 0x47e20c21 # amask $2,$1
		srl \$1,8,\$2
		sll \$2,2,\$2
		sll \$0,3,\$0
		addl \$1,\$0,\$0
		addl \$2,\$0,\$0
		ret \$31,(\$26),1
		.end main
EOF
		LIBC=""
		${CC-cc} dummy.s -o dummy 2>/dev/null
		if test "$?" = 0 ; then
			./dummy
			case "$?" in
			7)
				UNAME_MACHINE="alpha"
				;;
			15)
				UNAME_MACHINE="alphaev5"
				;;
			14)
				UNAME_MACHINE="alphaev56"
				;;
			10)
				UNAME_MACHINE="alphapca56"
				;;
			16)
				UNAME_MACHINE="alphaev6"
				;;
			esac	

			objdump --private-headers dummy | \
			  grep ld.so.1 > /dev/null
			if test "$?" = 0 ; then
				LIBC="libc1"
			fi
		fi	
		rm -f dummy.s dummy
		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
	elif test "${UNAME_MACHINE}" = "mips" ; then
	  cat >dummy.c <<EOF
main(argc, argv)
     int argc;
     char *argv[];
{
#ifdef __MIPSEB__
  printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
#ifdef __MIPSEL__
  printf ("%sel-unknown-linux-gnu\n", argv[1]);
#endif
  return 0;
}
EOF
	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
	  rm -f dummy.c dummy
	else
	  # Either a pre-BFD a.out linker (linux-gnuoldld)
	  # or one that does not give us useful --help.
	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
	  # If ld does not provide *any* "supported emulations:"
	  # that means it is gnuoldld.
	  echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
	  test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0

	  case "${UNAME_MACHINE}" in
	  i?86)
	    VENDOR=pc;
	    ;;
	  *)
	    VENDOR=unknown;
	    ;;
	  esac
	  # Determine whether the default compiler is a.out or elf
	  cat >dummy.c <<EOF
#include <features.h>
main(argc, argv)
     int argc;
     char *argv[];
{
#ifdef __ELF__
# ifdef __GLIBC__
#  if __GLIBC__ >= 2
    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
#  else
    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
#  endif
# else
   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
#else
  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
#endif
  return 0;
}
EOF
	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
	  rm -f dummy.c dummy
	fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
# are messed up and put the nodename in both sysname and nodename.
    i?86:DYNIX/ptx:4*:*)
	echo i386-sequent-sysv4
	exit 0 ;;
    i?86:UNIX_SV:4.2MP:2.*)
        # Unixware is an offshoot of SVR4, but it has its own version
        # number series starting with 2...
        # I am not positive that other SVR4 systems won't match this,
	# I just have to hope.  -- rms.
        # Use sysv4.2uw... so that sysv4* matches it.
	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
	exit 0 ;;
    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
	else
		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
	fi
	exit 0 ;;
    i?86:*:3.2:*)
	if test -f /usr/options/cb.name; then
		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
	elif /bin/uname -X 2>/dev/null >/dev/null ; then
		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
			&& UNAME_MACHINE=i586
		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
	else
		echo ${UNAME_MACHINE}-pc-sysv32
	fi
	exit 0 ;;
    pc:*:*:*)
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
        # the processor, so we play safe by assuming i386.
	echo i386-pc-msdosdjgpp
        exit 0 ;;
    Intel:Mach:3*:*)
	echo i386-pc-mach3
	exit 0 ;;
    paragon:*:*:*)
	echo i860-intel-osf1
	exit 0 ;;
    i860:*:4.*:*) # i860-SVR4
	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
	else # Add other i860-SVR4 vendors below as they are discovered.
	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
	fi
	exit 0 ;;
    mini*:CTIX:SYS*5:*)
	# "miniframe"
	echo m68010-convergent-sysv
	exit 0 ;;
    M68*:*:R3V[567]*:*)
	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
	OS_REL=''
	test -r /etc/.relid \
	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
          && echo i486-ncr-sysv4 && exit 0 ;;
    m68*:LynxOS:2.*:*)
	echo m68k-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    mc68030:UNIX_System_V:4.*:*)
	echo m68k-atari-sysv4
	exit 0 ;;
    i?86:LynxOS:2.*:*)
	echo i386-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    TSUNAMI:LynxOS:2.*:*)
	echo sparc-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
	echo rs6000-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    SM[BE]S:UNIX_SV:*:*)
	echo mips-dde-sysv${UNAME_RELEASE}
	exit 0 ;;
    RM*:SINIX-*:*:*)
	echo mips-sni-sysv4
	exit 0 ;;
    *:SINIX-*:*:*)
	if uname -p 2>/dev/null >/dev/null ; then
		UNAME_MACHINE=`(uname -p) 2>/dev/null`
		echo ${UNAME_MACHINE}-sni-sysv4
	else
		echo ns32k-sni-sysv
	fi
	exit 0 ;;
    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                           # says <Richard.M.Bartel at ccMail.Census.GOV>
        echo i586-unisys-sysv4
        exit 0 ;;
    *:UNIX_System_V:4*:FTX*)
	# From Gerald Hewes <hewes at openmarket.com>.
	# How about differentiating between stratus architectures? -djm
	echo hppa1.1-stratus-sysv4
	exit 0 ;;
    *:*:*:FTX*)
	# From seanf at swdc.stratus.com.
	echo i860-stratus-sysv4
	exit 0 ;;
    mc68*:A/UX:*:*)
	echo m68k-apple-aux${UNAME_RELEASE}
	exit 0 ;;
    news*:NEWS-OS:*:6*)
	echo mips-sony-newsos6
	exit 0 ;;
    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
	if [ -d /usr/nec ]; then
	        echo mips-nec-sysv${UNAME_RELEASE}
	else
	        echo mips-unknown-sysv${UNAME_RELEASE}
	fi
        exit 0 ;;
    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
	echo powerpc-be-beos
	exit 0 ;;
    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
	echo powerpc-apple-beos
	exit 0 ;;
    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
	echo i586-pc-beos
	exit 0 ;;
esac

#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2

cat >dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
     I don't know....  */
  printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
  printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
          "4"
#else
	  ""
#endif
         ); exit (0);
#endif
#endif

#if defined (__arm) && defined (__acorn) && defined (__unix)
  printf ("arm-acorn-riscix"); exit (0);
#endif

#if defined (hp300) && !defined (hpux)
  printf ("m68k-hp-bsd\n"); exit (0);
#endif

#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
  int version;
  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  exit (0);
#endif

#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
  printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
  printf ("ns32k-encore-mach\n"); exit (0);
#else
  printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif

#if defined (__386BSD__)
  printf ("i386-pc-bsd\n"); exit (0);
#endif

#if defined (sequent)
#if defined (i386)
  printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
  printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif

#if defined (_SEQUENT_)
    struct utsname un;

    uname(&un);

    if (strncmp(un.version, "V2", 2) == 0) {
	printf ("i386-sequent-ptx2\n"); exit (0);
    }
    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
	printf ("i386-sequent-ptx1\n"); exit (0);
    }
    printf ("i386-sequent-ptx\n"); exit (0);

#endif

#if defined (vax)
#if !defined (ultrix)
  printf ("vax-dec-bsd\n"); exit (0);
#else
  printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif

#if defined (alliant) && defined (i860)
  printf ("i860-alliant-bsd\n"); exit (0);
#endif

  exit (1);
}
EOF

${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy

# Apollos put the system type in the environment.

test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }

# Convex versions that predate uname can use getsysinfo(1)

if [ -x /usr/convex/getsysinfo ]
then
    case `getsysinfo -f cpu_type` in
    c1*)
	echo c1-convex-bsd
	exit 0 ;;
    c2*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
	exit 0 ;;
    c34*)
	echo c34-convex-bsd
	exit 0 ;;
    c38*)
	echo c38-convex-bsd
	exit 0 ;;
    c4*)
	echo c4-convex-bsd
	exit 0 ;;
    esac
fi

#echo '(Unable to guess system type)' 1>&2

exit 1

Index: avida/current/source/third-party/trio-1.9/trio/config.sub.0
+++ avida/current/source/third-party/trio-1.9/trio/config.sub.0
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
#   Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine.  It does not imply ALL GNU software can.
#
# This file 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.

# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support.  The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.

# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.

if [ x$1 = x ]
then
	echo Configuration name missing. 1>&2
	echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
	echo "or     $0 ALIAS" 1>&2
	echo where ALIAS is a recognized configuration type. 1>&2
	exit 1
fi

# First pass through any local machine types.
case $1 in
	*local*)
		echo $1
		exit 0
		;;
	*)
	;;
esac

# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
  linux-gnu*)
    os=-$maybe_os
    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
    ;;
  *)
    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
    if [ $basic_machine != $1 ]
    then os=`echo $1 | sed 's/.*-/-/'`
    else os=; fi
    ;;
esac

### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work.  We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
	-sun*os*)
		# Prevent following clause from handling this invalid input.
		;;
	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
	-apple)
		os=
		basic_machine=$1
		;;
	-hiux*)
		os=-hiuxwe2
		;;
	-sco5)
		os=sco3.2v5
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco4)
		os=-sco3.2v4
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2.[4-9]*)
		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2v[4-9]*)
		# Don't forget version if it is 3.2v4 or newer.
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco*)
		os=-sco3.2v2
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-isc)
		os=-isc2.2
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-clix*)
		basic_machine=clipper-intergraph
		;;
	-isc*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-lynx*)
		os=-lynxos
		;;
	-ptx*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
		;;
	-windowsnt*)
		os=`echo $os | sed -e 's/windowsnt/winnt/'`
		;;
	-psos*)
		os=-psos
		;;
esac

# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
	# Recognize the basic CPU types without company name.
	# Some are omitted here because they have special meanings below.
	tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
		| arme[lb] | pyramid | mn10200 | mn10300 \
		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
		| alpha | alphaev5 | alphaev56 | alphapca56 | we32k | ns16k | clipper \
		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
		| mipstx39 | mipstx39el \
		| sparc | sparclet | sparclite | sparc64 | v850)
		basic_machine=$basic_machine-unknown
		;;
	# We use `pc' rather than `unknown'
	# because (1) that's what they normally are, and
	# (2) the word "unknown" tends to confuse beginning users.
	i[34567]86)
	  basic_machine=$basic_machine-pc
	  ;;
	# Object if more than one company name word.
	*-*-*)
		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
		exit 1
		;;
	# Recognize the basic CPU types with company name.
	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
	      | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
	      | alpha-* | alphaev5-* | alphaev56-* | alphapca56-* | we32k-* | cydra-* \
	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
	      | sparc64-* | mips64-* | mipsel-* \
	      | mips64el-* | mips64orion-* | mips64orionel-*  \
	      | mipstx39-* | mipstx39el-* \
	      | f301-*)
		;;
	# Recognize the various machine names and aliases which stand
	# for a CPU type and a company and sometimes even an OS.
	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
		basic_machine=m68000-att
		;;
	3b*)
		basic_machine=we32k-att
		;;
	alliant | fx80)
		basic_machine=fx80-alliant
		;;
	altos | altos3068)
		basic_machine=m68k-altos
		;;
	am29k)
		basic_machine=a29k-none
		os=-bsd
		;;
	amdahl)
		basic_machine=580-amdahl
		os=-sysv
		;;
	amiga | amiga-*)
		basic_machine=m68k-cbm
		;;
	amigaos | amigados)
		basic_machine=m68k-cbm
		os=-amigaos
		;;
	amigaunix | amix)
		basic_machine=m68k-cbm
		os=-sysv4
		;;
	apollo68)
		basic_machine=m68k-apollo
		os=-sysv
		;;
	aux)
		basic_machine=m68k-apple
		os=-aux
		;;
	balance)
		basic_machine=ns32k-sequent
		os=-dynix
		;;
	convex-c1)
		basic_machine=c1-convex
		os=-bsd
		;;
	convex-c2)
		basic_machine=c2-convex
		os=-bsd
		;;
	convex-c32)
		basic_machine=c32-convex
		os=-bsd
		;;
	convex-c34)
		basic_machine=c34-convex
		os=-bsd
		;;
	convex-c38)
		basic_machine=c38-convex
		os=-bsd
		;;
	cray | ymp)
		basic_machine=ymp-cray
		os=-unicos
		;;
	cray2)
		basic_machine=cray2-cray
		os=-unicos
		;;
	[ctj]90-cray)
		basic_machine=c90-cray
		os=-unicos
		;;
	crds | unos)
		basic_machine=m68k-crds
		;;
	da30 | da30-*)
		basic_machine=m68k-da30
		;;
	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
		basic_machine=mips-dec
		;;
	delta | 3300 | motorola-3300 | motorola-delta \
	      | 3300-motorola | delta-motorola)
		basic_machine=m68k-motorola
		;;
	delta88)
		basic_machine=m88k-motorola
		os=-sysv3
		;;
	dpx20 | dpx20-*)
		basic_machine=rs6000-bull
		os=-bosx
		;;
	dpx2* | dpx2*-bull)
		basic_machine=m68k-bull
		os=-sysv3
		;;
	ebmon29k)
		basic_machine=a29k-amd
		os=-ebmon
		;;
	elxsi)
		basic_machine=elxsi-elxsi
		os=-bsd
		;;
	encore | umax | mmax)
		basic_machine=ns32k-encore
		;;
	fx2800)
		basic_machine=i860-alliant
		;;
	genix)
		basic_machine=ns32k-ns
		;;
	gmicro)
		basic_machine=tron-gmicro
		os=-sysv
		;;
	h3050r* | hiux*)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	h8300hms)
		basic_machine=h8300-hitachi
		os=-hms
		;;
	harris)
		basic_machine=m88k-harris
		os=-sysv3
		;;
	hp300-*)
		basic_machine=m68k-hp
		;;
	hp300bsd)
		basic_machine=m68k-hp
		os=-bsd
		;;
	hp300hpux)
		basic_machine=m68k-hp
		os=-hpux
		;;
	hp9k2[0-9][0-9] | hp9k31[0-9])
		basic_machine=m68000-hp
		;;
	hp9k3[2-9][0-9])
		basic_machine=m68k-hp
		;;
	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][0-9] | hp8[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hppa-next)
		os=-nextstep3
		;;
	i370-ibm* | ibm*)
		basic_machine=i370-ibm
		os=-mvs
		;;
# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
	i[34567]86v32)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv32
		;;
	i[34567]86v4*)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv4
		;;
	i[34567]86v)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv
		;;
	i[34567]86sol2)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-solaris2
		;;
	iris | iris4d)
		basic_machine=mips-sgi
		case $os in
		    -irix*)
			;;
		    *)
			os=-irix4
			;;
		esac
		;;
	isi68 | isi)
		basic_machine=m68k-isi
		os=-sysv
		;;
	m88k-omron*)
		basic_machine=m88k-omron
		;;
	magnum | m3230)
		basic_machine=mips-mips
		os=-sysv
		;;
	merlin)
		basic_machine=ns32k-utek
		os=-sysv
		;;
	miniframe)
		basic_machine=m68000-convergent
		;;
	mipsel*-linux*)
		basic_machine=mipsel-unknown
		os=-linux-gnu
		;;
	mips*-linux*)
		basic_machine=mips-unknown
		os=-linux-gnu
		;;
	mips3*-*)
		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
		;;
	mips3*)
		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
		;;
	ncr3000)
		basic_machine=i486-ncr
		os=-sysv4
		;;
	news | news700 | news800 | news900)
		basic_machine=m68k-sony
		os=-newsos
		;;
	news1000)
		basic_machine=m68030-sony
		os=-newsos
		;;
	news-3600 | risc-news)
		basic_machine=mips-sony
		os=-newsos
		;;
	next | m*-next )
		basic_machine=m68k-next
		case $os in
		    -nextstep* )
			;;
		    -ns2*)
		      os=-nextstep2
			;;
		    *)
		      os=-nextstep3
			;;
		esac
		;;
	nh3000)
		basic_machine=m68k-harris
		os=-cxux
		;;
	nh[45]000)
		basic_machine=m88k-harris
		os=-cxux
		;;
	nindy960)
		basic_machine=i960-intel
		os=-nindy
		;;
	np1)
		basic_machine=np1-gould
		;;
	pa-hitachi)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	paragon)
		basic_machine=i860-intel
		os=-osf
		;;
	pbd)
		basic_machine=sparc-tti
		;;
	pbb)
		basic_machine=m68k-tti
		;;
        pc532 | pc532-*)
		basic_machine=ns32k-pc532
		;;
	pentium | p5 | k5 | nexen)
		basic_machine=i586-pc
		;;
	pentiumpro | p6 | k6 | 6x86)
		basic_machine=i686-pc
		;;
	pentiumii | pentium2)
		basic_machine=i786-pc
		;;
	pentium-* | p5-* | k5-* | nexen-*)
		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentiumpro-* | p6-* | k6-* | 6x86-*)
		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentiumii-* | pentium2-*)
		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pn)
		basic_machine=pn-gould
		;;
	power)	basic_machine=rs6000-ibm
		;;
	ppc)	basic_machine=powerpc-unknown
	        ;;
	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppcle | powerpclittle | ppc-le | powerpc-little)
		basic_machine=powerpcle-unknown
	        ;;
	ppcle-* | powerpclittle-*)
		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ps2)
		basic_machine=i386-ibm
		;;
	rm[46]00)
		basic_machine=mips-siemens
		;;
	rtpc | rtpc-*)
		basic_machine=romp-ibm
		;;
	sequent)
		basic_machine=i386-sequent
		;;
	sh)
		basic_machine=sh-hitachi
		os=-hms
		;;
	sps7)
		basic_machine=m68k-bull
		os=-sysv2
		;;
	spur)
		basic_machine=spur-unknown
		;;
	sun2)
		basic_machine=m68000-sun
		;;
	sun2os3)
		basic_machine=m68000-sun
		os=-sunos3
		;;
	sun2os4)
		basic_machine=m68000-sun
		os=-sunos4
		;;
	sun3os3)
		basic_machine=m68k-sun
		os=-sunos3
		;;
	sun3os4)
		basic_machine=m68k-sun
		os=-sunos4
		;;
	sun4os3)
		basic_machine=sparc-sun
		os=-sunos3
		;;
	sun4os4)
		basic_machine=sparc-sun
		os=-sunos4
		;;
	sun4sol2)
		basic_machine=sparc-sun
		os=-solaris2
		;;
	sun3 | sun3-*)
		basic_machine=m68k-sun
		;;
	sun4)
		basic_machine=sparc-sun
		;;
	sun386 | sun386i | roadrunner)
		basic_machine=i386-sun
		;;
	symmetry)
		basic_machine=i386-sequent
		os=-dynix
		;;
	tx39)
		basic_machine=mipstx39-unknown
		;;
	tx39el)
		basic_machine=mipstx39el-unknown
		;;
	tower | tower-32)
		basic_machine=m68k-ncr
		;;
	udi29k)
		basic_machine=a29k-amd
		os=-udi
		;;
	ultra3)
		basic_machine=a29k-nyu
		os=-sym1
		;;
	vaxv)
		basic_machine=vax-dec
		os=-sysv
		;;
	vms)
		basic_machine=vax-dec
		os=-vms
		;;
	vpp*|vx|vx-*)
               basic_machine=f301-fujitsu
               ;;
	vxworks960)
		basic_machine=i960-wrs
		os=-vxworks
		;;
	vxworks68)
		basic_machine=m68k-wrs
		os=-vxworks
		;;
	vxworks29k)
		basic_machine=a29k-wrs
		os=-vxworks
		;;
	xmp)
		basic_machine=xmp-cray
		os=-unicos
		;;
        xps | xps100)
		basic_machine=xps100-honeywell
		;;
	none)
		basic_machine=none-none
		os=-none
		;;

# Here we handle the default manufacturer of certain CPU types.  It is in
# some cases the only manufacturer, in others, it is the most popular.
	mips)
		if [ x$os = x-linux-gnu ]; then
			basic_machine=mips-unknown
		else
			basic_machine=mips-mips
		fi
		;;
	romp)
		basic_machine=romp-ibm
		;;
	rs6000)
		basic_machine=rs6000-ibm
		;;
	vax)
		basic_machine=vax-dec
		;;
	pdp11)
		basic_machine=pdp11-dec
		;;
	we32k)
		basic_machine=we32k-att
		;;
	sparc)
		basic_machine=sparc-sun
		;;
        cydra)
		basic_machine=cydra-cydrome
		;;
	orion)
		basic_machine=orion-highlevel
		;;
	orion105)
		basic_machine=clipper-highlevel
		;;
	*)
		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
		exit 1
		;;
esac

# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
	*-digital*)
		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
		;;
	*-commodore*)
		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
		;;
	*)
		;;
esac

# Decode manufacturer-specific aliases for certain operating systems.

if [ x"$os" != x"" ]
then
case $os in
        # First match some system type aliases
        # that might get confused with valid system types.
	# -solaris* is a basic system type, with this one exception.
	-solaris1 | -solaris1.*)
		os=`echo $os | sed -e 's|solaris1|sunos4|'`
		;;
	-solaris)
		os=-solaris2
		;;
	-svr4*)
		os=-sysv4
		;;
	-unixware*)
		os=-sysv4.2uw
		;;
	-gnu/linux*)
		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
		;;
	# First accept the basic system types.
	# The portable systems comes first.
	# Each alternative MUST END IN A *, to match a version number.
	# -sysv* is not here because it comes later, after sysvr4.
	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
	      | -aos* \
	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
	      | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
	      | -mingw32* | -linux-gnu* | -uxpv* | -beos*)
	# Remember, each alternative MUST END IN *, to match a version number.
		;;
	-linux*)
		os=`echo $os | sed -e 's|linux|linux-gnu|'`
		;;
	-sunos5*)
		os=`echo $os | sed -e 's|sunos5|solaris2|'`
		;;
	-sunos6*)
		os=`echo $os | sed -e 's|sunos6|solaris3|'`
		;;
	-osfrose*)
		os=-osfrose
		;;
	-osf*)
		os=-osf
		;;
	-utek*)
		os=-bsd
		;;
	-dynix*)
		os=-bsd
		;;
	-acis*)
		os=-aos
		;;
	-ctix* | -uts*)
		os=-sysv
		;;
	-ns2 )
	        os=-nextstep2
		;;
	# Preserve the version number of sinix5.
	-sinix5.*)
		os=`echo $os | sed -e 's|sinix|sysv|'`
		;;
	-sinix*)
		os=-sysv4
		;;
	-triton*)
		os=-sysv3
		;;
	-oss*)
		os=-sysv3
		;;
	-svr4)
		os=-sysv4
		;;
	-svr3)
		os=-sysv3
		;;
	-sysvr4)
		os=-sysv4
		;;
	# This must come after -sysvr4.
	-sysv*)
		;;
	-xenix)
		os=-xenix
		;;
	-none)
		;;
	*)
		# Get rid of the `-' at the beginning of $os.
		os=`echo $os | sed 's/[^-]*-//'`
		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
		exit 1
		;;
esac
else

# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.

# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system.  Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.

case $basic_machine in
	*-acorn)
		os=-riscix1.2
		;;
	arm*-semi)
		os=-aout
		;;
        pdp11-*)
		os=-none
		;;
	*-dec | vax-*)
		os=-ultrix4.2
		;;
	m68*-apollo)
		os=-domain
		;;
	i386-sun)
		os=-sunos4.0.2
		;;
	m68000-sun)
		os=-sunos3
		# This also exists in the configure program, but was not the
		# default.
		# os=-sunos4
		;;
	*-tti)	# must be before sparc entry or we get the wrong os.
		os=-sysv3
		;;
	sparc-* | *-sun)
		os=-sunos4.1.1
		;;
	*-be)
		os=-beos
		;;
	*-ibm)
		os=-aix
		;;
	*-hp)
		os=-hpux
		;;
	*-hitachi)
		os=-hiux
		;;
	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
		os=-sysv
		;;
	*-cbm)
		os=-amigaos
		;;
	*-dg)
		os=-dgux
		;;
	*-dolphin)
		os=-sysv3
		;;
	m68k-ccur)
		os=-rtu
		;;
	m88k-omron*)
		os=-luna
		;;
	*-next )
		os=-nextstep
		;;
	*-sequent)
		os=-ptx
		;;
	*-crds)
		os=-unos
		;;
	*-ns)
		os=-genix
		;;
	i370-*)
		os=-mvs
		;;
	*-next)
		os=-nextstep3
		;;
        *-gould)
		os=-sysv
		;;
        *-highlevel)
		os=-bsd
		;;
	*-encore)
		os=-bsd
		;;
        *-sgi)
		os=-irix
		;;
        *-siemens)
		os=-sysv4
		;;
	*-masscomp)
		os=-rtu
		;;
	f301-fujitsu)
		os=-uxpv
		;;
	*)
		os=-none
		;;
esac
fi

# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer.  We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
	*-unknown)
		case $os in
			-riscix*)
				vendor=acorn
				;;
			-sunos*)
				vendor=sun
				;;
			-aix*)
				vendor=ibm
				;;
			-hpux*)
				vendor=hp
				;;
			-hiux*)
				vendor=hitachi
				;;
			-unos*)
				vendor=crds
				;;
			-dgux*)
				vendor=dg
				;;
			-luna*)
				vendor=omron
				;;
			-genix*)
				vendor=ns
				;;
			-mvs*)
				vendor=ibm
				;;
			-ptx*)
				vendor=sequent
				;;
			-vxsim* | -vxworks*)
				vendor=wrs
				;;
			-aux*)
				vendor=apple
				;;
		esac
		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
		;;
esac

echo $basic_machine$os

Index: avida/current/source/third-party/trio-1.9/trio/configure.in.0
+++ avida/current/source/third-party/trio-1.9/trio/configure.in.0
dnl
dnl Configuration for trio
dnl

AC_INIT(triodef.h)
AC_CANONICAL_HOST

AC_PROG_CC
ifdef([AC_PROG_CC_STDC], [AC_PROG_CC_STDC])
AC_LANG_C

AC_PROG_INSTALL
AC_PROG_RANLIB

dnl
dnl Alpha floating-point compiler option
dnl

if test "${GCC}" = "yes" ; then
    case "${host}" in
        alpha*-*-linux* | alpha*-*-osf* )
            CFLAGS="${CFLAGS} -mieee"
            ;;
        *)
            ;;
    esac
else
    case "${host}" in
        *-dec-osf* )
            CFLAGS="${CFLAGS} -ieee"
            ;;
        *)
            ;;
    esac
fi

AC_OUTPUT(Makefile)

Index: avida/current/source/third-party/trio-1.9/trio/example.c
+++ avida/current/source/third-party/trio-1.9/trio/example.c
/*************************************************************************
 * For testing purposes
 */

#include <stdarg.h>
#include <limits.h>
#include <math.h>
#include <unistd.h>
#include <wchar.h>
#include "triodef.h"
#include "strio.h"
#include "trio.h"
#undef printf

#if !defined(USE_LONGLONG)
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#  define USE_LONGLONG
# elif defined(__SUNPRO_C)
#  define USE_LONGLONG
# endif
#endif

#if defined(USE_LONGLONG)
# define LONGLONG long long
#else
# define LONGLONG long
#endif

#if defined(TRIO_C99)
# define LONGEST intmax_t
#else
# define LONGEST LONGLONG
#endif

static TRIO_CONST char rcsid[] = "@(#)$Id: example.c,v 1.1 2003/11/25 18:20:49 kaben Exp $";

/*************************************************************************
 *
 */
void Dump
TRIO_ARGS2((buffer, rc),
	   char *buffer,
	   int rc)
{
  if (rc < 0)
    {
      printf("Err = %d (%s), Pos = %d\n",
	     TRIO_ERROR_CODE(rc),
	     TRIO_ERROR_NAME(rc),
	     TRIO_ERROR_POSITION(rc));
    }
  else
    printf("buffer[% 3d] = \"%s\"\n", rc, buffer);
}

/*************************************************************************
 *
 */
int main(TRIO_NOARGS)
{
  char buffer[512];
  int rc;
  LONGLONG int dummy;
  char *fool;
  int num;
  int num2;
  int count;
  double dnum;
  float fnum, fnum2;
  trio_long_double_t ldnum;
  char *end;
  char text[256];
  char ch;
  int nerrors = 0;
  void *p1;
  char *p2;

  printf("%s\n", rcsid);

/*    printf("%d %u %d %u\n", */
/*  	 INT_MAX, INT_MAX, UINT_MAX, UINT_MAX); */
/*    trio_printf("%d %u %d %u\n", */
/*  	      INT_MAX, INT_MAX, UINT_MAX, UINT_MAX); */
/*    printf("%d %u\n", INT_MIN, INT_MIN); */
/*    trio_printf("%d %u\n", INT_MIN, INT_MIN); */
  
/*    printf("%ld %lu %ld %lu\n", */
/*  	 INT_MAX, INT_MAX, UINT_MAX, UINT_MAX); */
/*    trio_printf("%ld %lu %ld %lu\n", */
/*  	      INT_MAX, INT_MAX, UINT_MAX, UINT_MAX); */
/*    printf("%ld %lu\n", INT_MIN, INT_MIN); */
/*    trio_printf("%ld %lu\n", INT_MIN, INT_MIN); */

/*    printf("%lld %llu %lld %llu\n", */
/*  	 INT_MAX, INT_MAX, UINT_MAX, UINT_MAX); */
/*    trio_printf("%lld %llu %lld %llu\n", */
/*  	      INT_MAX, INT_MAX, UINT_MAX, UINT_MAX); */
/*    printf("%lld %llu\n", INT_MIN, INT_MIN); */
/*    trio_printf("%lld %llu\n", INT_MIN, INT_MIN); */

/*    return 0; */

  
/*    dnum = StrToDouble("3.14e+44", (const char **)&end); */
/*    printf("double = %e (%s)\n", dnum, end); */
/*    dnum = StrToDouble("0xA3.14p44", (const char **)&end); */
/*    printf("double = %e (%s)\n", dnum, end); */

  /*    trio_printf("%.*stext\n", 0, "-----"); */ /* fails */
  
/*    trio_printf("%Zd\n", (size_t)sizeof(char)); */
  
/*   rc = StrFormat(buffer, "%a", 3.14e+44); */
/*   Dump(buffer, rc); */
  
  /*  rc = StrFormat(buffer, "Filled string: %-16<fill=_>s", "test"); */

/*   errno = EINTR; */
/*   rc = StrFormat(buffer, "Error: %m"); */

/*   rc = StrFormat(buffer, "Count %lln", &dummy); */
/*   printf("dummy = %lld\n", dummy); */

/*   rc = StrFormat(buffer, "Char %<quote='>c", 'X'); */

/*   rc = StrFormatMax(buffer, 20, "Here goes %-20<adjust=_>s", "test"); */

/*    rc = StrFormat(buffer, "Hex-float %a", 3.1415); */
/*    Dump(buffer, rc); */
/*    rc = StrFormat(buffer, "Hex-float %A", 3.1415e20); */
/*    Dump(buffer, rc); */
/*    rc = StrFormat(buffer, "Double %#g", 3.1415e20); */
/*    Dump(buffer, rc); */
/*    rc = StrFormat(buffer, "Double %.3f", 3.1415); */
/*    Dump(buffer, rc); */
/*    rc = StrFormat(buffer, "Double %+e", 3.1415); */
/*    Dump(buffer, rc); */

/*    printf("'%.2f'\n", 99.99999); */
/*    trio_printf("'%.2f'\n", 99.99999); */
/*    printf("'%f'\n", 0.0); */
/*    trio_printf("'%f'\n", 0.0); */
/*    printf("'%f'\n", 3141.0); */
/*    trio_printf("'%f'\n", 3141.0); */
/*    printf("'%#f'\n", 3141.0); */
/*    trio_printf("'%#f'\n", 3141.0); */
/*    printf("'%'f'\n", 31415.2); */
/*    trio_printf("'%'f'\n", 31415.2); */
/*    printf("'%-16e'\n", 3141.5); */
/*    trio_printf("'%-16e'\n", 3141.5); */
/*    printf("'%#f'\n", 3141.0); */
/*    trio_printf("'%#f'\n", 3141.0); */
/*    printf("'%f'\n", 3141.5); */
/*    trio_printf("'%f'\n", 3141.5); */
/*    printf("'%#.6g'\n", 3141.5); */
/*    trio_printf("'%#.6g'\n", 3141.5); */
  
/*    printf("'%20e'\n", 314.5); */
/*    trio_printf("'%20e'\n", 314.5); */
  
/*    printf("'%-16e'\n", 3141.5); */
/*    trio_printf("'%-16e'\n", 3141.5); */
  
/*    printf("'%#.4g'\n", 314151.5); */
/*    trio_printf("'%#.4g'\n", 314151.5); */
  
/*    printf("'%#.4g'\n", 0.0); */
/*    trio_printf("'%#.4g'\n", 0.0); */
  
/*    printf("'%#.4g'\n", 11.0); */
/*    trio_printf("'%#.4g'\n", 11.0); */

/*    printf("%f\n", HUGE_VAL); */
/*    trio_printf("%f\n", HUGE_VAL); */
/*    printf("%f\n", -HUGE_VAL); */
/*    trio_printf("%f\n", -HUGE_VAL); */
/*  #define NAN (cos(HUGE_VAL)) */
/*    printf("%f\n", NAN); */
/*    trio_printf("%f\n", NAN); */
  
/*    printf("'%+06d'\n", 1234); */
/*    trio_printf("'%+06d'\n", 1234); */
/*    printf("'%-#6.3x'\n", 12); */
/*    trio_printf("'%-#06.3x'\n", 12); */
/*    printf("'%+6d'\n", 1234); */
/*    trio_printf("'%+6d'\n", 1234); */
/*    printf("'%-08d'\n", 12); */
/*    trio_printf("'%-08d'\n", 12); */
/*    printf("'%08.6d'\n", 12); */
/*    trio_printf("'%08.6d'\n", 12); */
/*    printf("'%4d'\n", 123456); */
/*    trio_printf("'%4d'\n", 123456); */
/*    printf("'%.4d'\n", 12); */
/*    trio_printf("'%.4d'\n", 12); */

/*    trio_printf("%!#08x %04x %..10x\n", 42, 42, 42); */
/*    trio_printf("%*.*.*i\n", 8, 4, 2, 23); */
/*    trio_printf("%8.4.2i %<base=2>08i %.8.2i %..2i\n", 23, 23, 23, 23); */

/*    trio_printf("%8i\n", 42); */
/*    trio_printf("%.7i\n", 42); */
/*    trio_printf("%..2i\n", 42); */
/*    trio_printf("%8.7i\n", 42); */
/*    trio_printf("%8..2i\n", 42); */
/*    trio_printf("%8.7.2i\n", 42); */
/*    trio_printf("%*.*.*i\n", 8, 7, 2, 42); */

/*    { */
/*      LONGLONG ll = 1234567890; */
/*      rc = trio_printf("%&i %d\n", sizeof(ll), ll, 42); */
/*      Dump(buffer, rc); */
/*    } */
/*    { */
/*      char ch = 12; */
/*      rc = trio_printf("%&i %d\n", sizeof(ch), ch, 42); */
/*      Dump(buffer, rc); */
/*    } */
/*    { */
/*      pid_t pid = 99; */
/*      rc = trio_printf("%&i %d\n", sizeof(pid), pid, 42); */
/*      Dump(buffer, rc); */
/*    } */
  
/*    rc = trio_printf("%*.*.*i\n", 6, 4, 10, 12); */
/*    Dump(buffer, rc); */
/*    rc = trio_printf("%1$0*3$.*2$d\n", 3141, 6, 10); */
/*    Dump(buffer, rc); */

/*    rc = trio_asprintf(&end, "%s%n", "0123456789", &num); */
/*    printf("%d %d '%s'\n", rc, num, end); */
/*    if (end) */
/*      free(end); */
  
/*    trio_printf("%016e\n", 3141.5); */
/*    trio_printf("%'f\n", 424242.42); */
/*    trio_printf("%#.4f\n", 0.0); */
/*    trio_printf("%'d\n", 424242); */

/*    rc = trio_sprintf(buffer, "%4$d %3$*8$d %2$.*7$d %1$*6$.*5$d\n", */
/*  		    123, */
/*  		    1234, */
/*  		    12345, */
/*  		    123456, */
/*  		    5, 6, 7, 8 */
/*  		    ); */
/*    Dump(buffer, rc); */
/*    rc = trio_sprintf(buffer, "%2$s %1$#s", "111", "222"); */
/*    Dump(buffer, rc); */
  
/*    trio_printf("  %x %!#x %g %09x %x\n", 123456, 123456, 123456.0, 123456, 123456); */
/*    trio_printf("%!'i %f %i\n", 12345, 12345.0, 12345); */
/*    trio_printf("%!<base=2>i %i\n", 23, 23); */

/*    rc = trio_sprintf(buffer, "%I32d", 12345); */
/*    Dump(buffer, rc); */
/*    rc = trio_sprintf(buffer, "%I32I8d", 12345); */
/*    Dump(buffer, rc); */

/*    rc = trio_sprintf(buffer, "*%5f*", 3.3); */
/*    Dump(buffer, rc); */
  
/*    { */
/*      wchar_t *wstring = L"some data"; */
/*      wchar_t wbuffer[512]; */
    
/*      rc = trio_sprintf(buffer, "%ls", wstring); */
/*      Dump(buffer, rc); */

/*      rc = trio_sscanf(buffer, "%ls", wbuffer); */
/*      Dump(buffer, rc); */
/*      rc = trio_sprintf(buffer, "%ls", wbuffer); */
/*      Dump(buffer, rc); */
/*    } */
  
  /* rc = StrFormat(buffer, "\040-\040\040-\n"); */

/*   rc = StrFormat(buffer, "%.*s@%s", 3, "Daniel", "Fool"); */
/*   rc = StrFormatAppendMax(buffer, 512, " %s is a doh", "Simpson"); */

/*   rc = StrFormat(buffer, "hello %1$d %1$d", 31, 32); */
/*   Dump(buffer, rc); */
/*   rc = StrFormat(buffer, "%2$d %3$d", 31, 32, 33); */
/*   Dump(buffer, rc); */
  
/*    rc = trio_sprintf(buffer, "%d say %g hey %s", 42, 3.14, "text"); */
/*    Dump(buffer, rc); */
/*    trio_sscanf(buffer, "%d %*s %e hey %s", &num, &dnum, text); */
/*    printf("num = %d, dnum = %e, text = \"%s\"\n", num, dnum, text); */

/*    rc = trio_sprintf(buffer, "%g", HUGE_VAL); */
/*    Dump(buffer, rc); */
/*    trio_sscanf(buffer, "%f", &dnum); */
/*    printf("dnum = %e\n", dnum); */

/*    rc = trio_sprintf(buffer, "%g", -HUGE_VAL); */
/*    Dump(buffer, rc); */
/*    trio_sscanf(buffer, "%f", &dnum); */
/*    printf("dnum = %e\n", dnum); */

/*  #if defined(NAN) */
/*    rc = trio_sprintf(buffer, "%g", NAN); */
/*    Dump(buffer, rc); */
/*    if ((rc = trio_sscanf(buffer, "%f", &dnum)) < 0) */
/*      Dump(buffer, rc); */
/*    else */
/*      printf("dnum = %e\n", dnum); */
/*  #endif */

/*    rc = trio_sprintf(buffer, "%*d", 6, 1234); */
/*    Dump(buffer, rc); */

/*    rc = trio_sprintf(buffer, "'%!08.6d' '%!d' '%d'", 4, 6, 8); */
/*    Dump(buffer, rc); */

/*    rc = trio_sprintf(buffer, "%0g", 0.123); */
/*    Dump(buffer, rc); */
  
/*    { */
/*      void *argarray[4]; */
/*      int value = 42; */
/*      double number = 123.456; */
/*      float small_number = 123.456; */
    
/*      argarray[0] = &value; */
/*      argarray[1] = "my string"; */
/*      rc = trio_sprintfv(buffer, "%d %s", argarray); */
/*      Dump(buffer, rc); */
/*      rc = trio_snprintfv(buffer, 8, "%d %s", argarray); */
/*      Dump(buffer, rc); */

/*      argarray[0] = &num; */
/*      argarray[1] = text; */
/*      rc = trio_sscanfv(buffer, "%d %s", argarray); */
/*      Dump(buffer, rc); */
/*      printf("num = %d  text = \"%s\"\n", num, text); */
    
/*      argarray[0] = &number; */
/*      argarray[1] = &small_number; */
/*      rc = trio_sprintfv(buffer, "%f %hf", argarray); */
/*      Dump(buffer, rc); */
/*      printf("number = %f  small_number = \"%f\"\n", number, small_number); */
/*    } */
  
/*    rc = trio_sprintf(buffer, "abcba"); */
/*    Dump(buffer, rc); */
/*    trio_sscanf(buffer, "%[ab]", text); */
/*    printf("text = \"%s\"\n", text); */
/*    trio_sscanf(buffer, "%*[ab]c%[^\n]", text); */
/*    printf("text = \"%s\"\n", text); */

/*    trio_sprintf(buffer, "aabcdba aaa"); */
/*    rc = trio_sscanf(buffer, "%s", text); */
/*    Dump(buffer, rc); */
/*    printf("text = \"%s\"\n", text); */
/*    rc = trio_sscanf(buffer, "%*1[aA]%[a-c]", text); */
/*    Dump(buffer, rc); */
/*    printf("text = \"%s\"\n", text); */

/*    rc = trio_sprintf(buffer, "10021"); */
/*    rc = trio_sscanf(buffer, "%b%n%d", &num, &count, &num2); */
/*    Dump(buffer, rc); */
/*    printf("num = %d %d %d\n", num, num2, count); */

/*    rc = trio_sprintf(buffer, "%'d", 10000); */
/*    rc = trio_sscanf(buffer, "%'d", &num); */
/*    Dump(buffer, rc); */
/*    printf("num = %d\n", num); */

/*    rc = trio_dprintf(STDOUT_FILENO, "%s\n", "hello there"); */
/*    Dump(buffer, rc); */
/*    rc = trio_dscanf(STDIN_FILENO, "%s", buffer); */
/*    Dump(buffer, rc); */

/*    rc = trio_scanf("%s", buffer); */
/*    Dump(buffer, rc); */
  
/*    rc = trio_sprintf(buffer, "Ttext"); */
/*    Dump(buffer, rc); */
/*    trio_sscanf(buffer, "%*[Tt]e%c", &ch); */
/*    printf("ch = %c\n", ch); */

/*    printf("%p\n", &main); */
/*    rc = trio_sprintf(buffer, "%p %p", &main, NULL); */
/*    Dump(buffer, rc); */
/*    trio_sscanf(buffer, "%p %p", &p1, &p2); */
/*    printf("pointer = %p %p\n", p1, p2); */

/*    rc = trio_sprintf(buffer, "%@. at .@i", 8, 7, 2, 42); */
/*    Dump(buffer, rc); */
/*    trio_sprintf(buffer, "abcdefghijklmnopqrstuvwxyz"); */
/*    rc = trio_sscanf(buffer, "%100s", text); */
/*    Dump(text, rc); */
/*    rc = trio_sscanf(buffer, "%@s", 100, text); */
/*    Dump(text, rc); */
  
/*    rc = trio_sprintf(buffer, "%..2i", 42); */
/*    Dump(buffer, rc); */
/*    rc = trio_sscanf(buffer, "%..2i", &num); */
/*    printf("%d\n", num); */
/*    rc = trio_sscanf(buffer, "%.. at i", 2, &num); */
/*    printf("%d\n", num); */

/*    { */
/*      int num1, num2, num3, num4; */
    
/*      rc = trio_sprintf(buffer, "123_456 [12%%-34%%]"); */
/*      Dump(buffer, rc); */
/*      rc = trio_sscanf(buffer, "%5i%*1s%5i%*1s%5i%*2s%5i", */
/*  		     &num1, &num2, &num3, &num4); */
/*      Dump(buffer, rc); */
/*      printf("%d %d %d %d %d\n", rc, num1, num2, num3, num4); */
/*      rc = trio_sscanf(buffer, "%d_%d [%d%%-%d%%]", */
/*  		     &num1, &num2, &num3, &num4); */
/*      Dump(buffer, rc); */
/*      printf("%d %d %d %d %d\n", rc, num1, num2, num3, num4); */
/*    } */

/*    rc = trio_sprintf(buffer, "01 3456789"); */
/*    Dump(buffer, rc); */
/*    memset(&text, 0, sizeof(text)); */
/*    rc = trio_sscanf(buffer, "%4c", &text); */
/*    Dump(text, rc); */
/*    memset(&text, 0, sizeof(text)); */
/*    rc = sscanf(buffer, "%4c", &text); */
/*    Dump(text, rc); */
  
/*    rc = trio_sprintf(buffer, "12345 6"); */
/*    Dump(buffer, rc); */
/*    rc = trio_sscanf(buffer, "%2d", &num); */
/*    Dump(buffer, rc); */
/*    printf("%d\n", num); */
/*    rc = sscanf(buffer, "%2d", &num); */
/*    Dump(buffer, rc); */
/*    printf("%d\n", num); */
  
/*    rc = trio_sprintf(buffer, "aa\\x0abb"); */
/*    Dump(buffer, rc); */
/*    rc = trio_sscanf(buffer, "aa%#sbb", &text); */
/*    Dump(text, rc); */

/*    rc = trio_sscanf("0 ", "%f", &dnum, text); */
/*    printf("%d %f\n", rc, dnum); */
/*    rc = sscanf("0 ", "%f %s", &dnum, text); */
/*    printf("%d %f\n", rc, dnum); */
  
/*    rc = trio_sscanf("lære", "%[:alpha:]", text); */
/*    Dump(text, rc); */
  
/*    rc = trio_sscanf("-0.123e3", "%8e", &dnum); */
/*    printf("%d %f\n", rc, dnum); */

/*    rc = trio_sscanf("123,456.78", "%'f", &dnum); */
/*    printf("%d %f\n", rc, dnum); */

/*    trio_printf("%.24f\n%.24f\n%.24f\n", 39413.80, 1.4, (2.0/3.0)); */
/*    printf("%.24f\n%.24f\n%.24f\n", 39413.80, 1.4, (2.0/3.0)); */
  
/*    trio_printf("%f\n%f\n", (7.0/5.0), (2.0/3.0)); */
/*    printf("%f\n%f\n", (7.0/5.0), (2.0/3.0)); */

/*    trio_printf("%a\n", 42.0); */
/*    trio_printf("%.2e\n", 0.9999); */
/*    trio_printf("%e\n", 3.14e+123); */
/*    trio_printf("%010.3e\n", 3141.5); */
/*    trio_printf("%.32Rf\n", 1.4); */
/*    trio_printf("%Rf\n", 1.234567890123456789e20); */
/*    printf("%.2g\n", 0.9999); */
/*    trio_printf("%.2g\n", 0.9999); */
/*    printf("%.2g\n", 99.9999); */
/*    trio_printf("%.2g\n", 99.9999); */
/*    printf("%g\n", 0.0); */
/*    trio_printf("%g\n", 0.0); */
/*    printf("%f\n", 3141.0); */
/*    trio_printf("%f\n", 3141.0); */
/*    printf("%.0f\n", 3141.0); */
/*    trio_printf("%.0f\n", 3141.0); */
/*    trio_printf("%f\n", 2.0/3.0); */
/*    trio_printf("%f\n", 16.25); */
  
/*    trio_printf("A: %f\nB: %.20f\nC: %Rf\n", 0.1, 0.1, 0.1); */
/*    trio_printf("A: %f\nB: %.20f\nC: %Rf\n", 2.0/3.0, 2.0/3.0, 2.0/3.0); */
  
/*    trio_printf("R %.*Rhf\n", FLT_DIG + 4, (double)((float)1.4)); */
/*    trio_printf("T %.*hf\n", FLT_DIG + 4, (double)((float)(2.0/3.0))); */
/*    trio_printf("R %.*Rhf\n", FLT_DIG + 4, (double)((float)(2.0/3.0))); */
  
/*    trio_printf("T %.*f\n", DBL_DIG + 4, (2.0/3.0)); */
/*    trio_printf("R %.*Rf\n", DBL_DIG + 4, (2.0/3.0)); */
/*    printf("C %.*f\n", DBL_DIG + 4, (2.0/3.0)); */

/*    trio_printf("T %.*f\n", DBL_DIG + 4, 1.4); */
/*    trio_printf("R %.*Rf\n", DBL_DIG + 4, 1.4); */
/*    printf("C %.*f\n", DBL_DIG + 4, 1.4); */
    
/*    trio_printf("T %.*f\n", DBL_DIG + 6, 0.1); */
/*    trio_printf("R %.*Rf\n", DBL_DIG + 6, 0.1); */
/*    printf("C %.*f\n", DBL_DIG + 6, 0.1); */

/*    ldnum = 2.0L / 3.0L; */
/*    trio_printf("R %.*Lf\n", LDBL_DIG + 4, ldnum); */
/*    trio_printf("R %RLf\n", ldnum); */
  
/*    trio_printf("T %.*.2f\n", DBL_MANT_DIG, 1.4); */
/*    trio_printf("R %.*.2Rf\n", DBL_MANT_DIG, 1.4); */
  
/*    trio_printf("R %Rf\n", 1.234567890123456789e20); */
/*    trio_printf("T %10.3e\n", 3141.5); */
/*    trio_printf("T %f\n", 1.0/3.0); */

  /* 2^-1 + 2^-15 */
/*    trio_printf("T %.*g\n", DBL_DIG + 200, 0.500030517578125); */
/*    printf("C %.*g\n", DBL_DIG + 200, 0.500030517578125); */
/*    trio_printf("T %.*g\n", DBL_DIG + 200, 2.0/3.0); */
/*    printf("C %.*g\n", DBL_DIG + 200, 2.0/3.0); */
  
/*    trio_printf("T  %.*f\n", DBL_DIG + 2, 1.4); */
/*    trio_printf("TR %.*Rf\n", DBL_DIG + 2, 1.4); */
  
/*    rc = trio_sscanf("0.141882295971771490", "%Lf", &ldnum); */
/*    rc = trio_sprintf(buffer, "%.30Lf", ldnum); */
/*    Dump(buffer, rc); */

/*    ldnum = 1.0L; */
/*    ldnum /= 3.0L; */
/*    rc = trio_sprintf(buffer, "%.30Lf", ldnum); */
/*    Dump(buffer, rc); */

/*    { */
/*      float a = 5.9, b = 10.0, c = a * b; */
/*      double d = a * b; */
/*      trio_printf("%.15a %.15a\n", c, d); */
/*      trio_printf("%.15g %.15g\n", c, (float)(a * b)); */
/*      trio_printf("%.15a %.15a\n", c, (float)(a * b)); */
/*      trio_printf("%.30.2f %.30.2f\n", c, (float)(a * b)); */
/*    } */
  
/*    trio_locale_set_decimal_point(","); */
/*    trio_locale_set_thousand_separator("'"); */
/*    trio_locale_set_grouping("\1\3\2\177"); */
/*    trio_printf("%'d\n", 123456789); */
/*    trio_printf("%'f\n", 123456789.0); */
/*    trio_locale_set_grouping("\3\2\0"); */
/*    trio_printf("%'d\n", 123456789); */
/*    trio_printf("%'f\n", 123456789.0); */
  
/*    trio_printf("%.30Rf\n", 39413.80); */

  printf("% 10.5f\n", 5163723399.00000);
  trio_printf("% 10.5f\n", 5163723399.00000);
  
  printf("% 020.5f\n", 5163723399.00000);
  trio_printf("% 020.5f\n", 5163723399.00000);
  
  return 0;
}

Index: avida/current/source/third-party/trio-1.9/trio/maketgz.0
+++ avida/current/source/third-party/trio-1.9/trio/maketgz.0
#! /bin/sh
# Script to build archives with
#

echo "Version number?"
read version

# get current dir
dir=`pwd`

# Get basename
orig=`basename $dir`

# Get the left part of the dash (-)
new=`echo $orig | cut -d- -f1`

# Build new directory name
n=$new-$version;

# Tell the world what we're doing
echo "creates $n.tar.gz";

if [ -r $n ]; then
  echo "Directory already exists!"
  exit
fi

# Create the new dir
mkdir $n

# Copy all relevant files, with path and permissions!
tar -cf - `cat FILES` | (cd $n; tar -xBpf -) || exit 1

(cd $n && sh autogen.sh) || exit 1

# Make a tar archive of it all
tar -cvf $n.tar $n

# gzip the archive
gzip $n.tar

# Make it world readable
chmod a+r $n.tar.gz ;

# Delete the temp dir
rm -rf $n

Index: avida/current/source/third-party/trio-1.9/trio/regression.c
+++ avida/current/source/third-party/trio-1.9/trio/regression.c
/*************************************************************************
 * Regression test
 */

#include "triodef.h"
#if defined(TRIO_COMPILER_ANCIENT)
# include <varargs.h>
#else
# include <stdarg.h>
#endif
#include <math.h>
#include <limits.h>
#include <float.h>
#include <errno.h>

#include "trio.h"
#include "triop.h"
#include "trionan.h"
#if defined(TRIO_MINIMAL)
# define TRIO_STRING_PUBLIC static
# include "triostr.c"
#else
# include "triostr.h"
#endif
#undef printf

#if TRIO_WIDECHAR
# include <wchar.h>
#endif

#define QUOTE(x) #x

#define DOUBLE_EQUAL(x,y) (((x)>(y)-DBL_EPSILON) && ((x)<(y)+DBL_EPSILON))
#define FLOAT_EQUAL(x,y) (((x)>(y)-FLT_EPSILON) && ((x)<(y)+FLT_EPSILON))

static TRIO_CONST char rcsid[] = "@(#)$Id: regression.c,v 1.1 2003/11/25 18:20:49 kaben Exp $";


/*************************************************************************
 *
 */
static void
Dump
TRIO_ARGS2((buffer, rc),
	   char *buffer,
	   int rc)
{
  if (rc < 0)
    {
      printf("Err = %d (%s), Pos = %d\n",
	     TRIO_ERROR_CODE(rc),
	     TRIO_ERROR_NAME(rc),
	     TRIO_ERROR_POSITION(rc));
    }
  else if (buffer)
    printf("buffer[% 3d] = \"%s\"\n", rc, buffer);
}

/*************************************************************************
 *
 */
static void
Report0
TRIO_ARGS2((file, line),
          TRIO_CONST char *file,
          int line)
{
  printf("Verification failed in %s:%d.\n", file, line);
}

/*************************************************************************
 *
 */
static void
Report
TRIO_ARGS4((file, line, expected, got),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *got)
{
  Report0(file, line);
  printf("  Expected \"%s\"\n", expected);
  printf("  Got      \"%s\"\n", got);
}

/*************************************************************************
 *
 */
int
Verify
TRIO_VARGS5((file, line, result, fmt, va_alist),
	    TRIO_CONST char *file,
	    int line,
	    TRIO_CONST char *result,
	    TRIO_CONST char *fmt,
	    TRIO_VA_DECL)
{
  int rc;
  va_list args;
  char buffer[4096];

  TRIO_VA_START(args, fmt);
  rc = trio_vsnprintf(buffer, sizeof(buffer), fmt, args);
  if (rc < 0)
    Dump(buffer, rc);
  TRIO_VA_END(args);

  if (!trio_equal_case(result, buffer))
    {
      Report(file, line, result, buffer);
      return 1;
    }
  return 0;
}

/*************************************************************************
 *
 */
int
VerifyReturnValues(TRIO_NOARGS)
{
  int nerrors = 0;
  int rc;
  int count;
  char *expected;
  char buffer[4096];
  char result[4096];

  rc = trio_sprintf(buffer, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 10 0123456789";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }
  
  rc = trio_snprintf(buffer, sizeof(buffer), "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 10 0123456789";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }
  
  rc = trio_snprintf(buffer, 4, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 3 012";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }

  /* The output buffer contains the empty string */
  rc = trio_snprintf(buffer, 1, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 0 ";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }

  /* The output buffer should be left untouched when max size is 0 */
  trio_sprintf(buffer, "DO NOT TOUCH");
  rc = trio_snprintf(buffer, 0, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 0 DO NOT TOUCH";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }
  
  return nerrors;
}

/*************************************************************************
 *
 */
#define TEST_STRING "0123456789"

int
VerifyAllocate(TRIO_NOARGS)
{
  int nerrors = 0;
  int rc;
  char *string;
  int count;
  int test_size = sizeof(TEST_STRING) - 1;

  /* Allocate a string with the result */
  rc = trio_asprintf(&string, "%s%n", TEST_STRING, &count);
  if (rc < 0)
    {
      nerrors++;
      Dump(string, rc);
    }
  else if (count != test_size)
    {
      nerrors++;
      printf("Validation failed in %s:%d\n", __FILE__, __LINE__);
      printf("  Expected %%n = %d\n", test_size);
      printf("  Got      %%n = %d\n", count);
    }
  else if (!trio_equal_case(string, TEST_STRING))
    {
      nerrors++;
      Report(__FILE__, __LINE__, TEST_STRING, string);
    }
  if (string)
    free(string);

  return nerrors;
}


/*************************************************************************
 *
 */
int
VerifyFormatting(TRIO_NOARGS)
{
  int nerrors = 0;
  char buffer[256];

  /* Normal text */
  nerrors += Verify(__FILE__, __LINE__, "Hello world",
		   "Hello world");
  /* String */
  nerrors += Verify(__FILE__, __LINE__, "Hello world",
		   "%s", "Hello world");
  /* Pointer */
  if (sizeof(void *) == 4)
    {
      nerrors += Verify(__FILE__, __LINE__, "Pointer 0x01234567",
			"Pointer %p", 0x1234567);
    }
  else if (sizeof(void *) == 8)
    {
      nerrors += Verify(__FILE__, __LINE__, "Pointer 0x0123456789012345",
			"Pointer %p", 0x123456789012345);
    }
  /* Nil pointer */
  nerrors += Verify(__FILE__, __LINE__, "Pointer (nil)",
		   "Pointer %p", NULL);
  /* Integer */
  nerrors += Verify(__FILE__, __LINE__, "Number 42",
		   "Number %d", 42);
  nerrors += Verify(__FILE__, __LINE__, "Number -42",
		   "Number %d", -42);
  nerrors += Verify(__FILE__, __LINE__, "Number 42",
		   "Number %ld", 42L);
  nerrors += Verify(__FILE__, __LINE__, "Number -42",
		   "Number %ld", -42L);
  /* Integer width */
  nerrors += Verify(__FILE__, __LINE__, "  1234",
		    "%6d", 1234);
  nerrors += Verify(__FILE__, __LINE__, "  1234",
		    "%*d", 6, 1234);
  /* Integer width overrun */
  nerrors += Verify(__FILE__, __LINE__, "123456",
		    "%4d", 123456);
  /* Integer precision */
  nerrors += Verify(__FILE__, __LINE__, "0012",
		    "%.4d", 12);
  nerrors += Verify(__FILE__, __LINE__, "0012",
		    "%.*d", 4, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%6.*d", 4, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%*.*d", 6, 4, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%*.*.*d", 6, 4, 2, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%*.*.*i", 6, 4, 10, 12);
  /* Integer sign, zero-padding, and width */
  nerrors += Verify(__FILE__, __LINE__, "+01234",
		    "%+06d", 1234);
  nerrors += Verify(__FILE__, __LINE__, " 01234",
		    "% 06d", 1234);
  nerrors += Verify(__FILE__, __LINE__, "+01234",
		    "% +06d", 1234);
  /* Integer adjust, zero-padding, and width */
  nerrors += Verify(__FILE__, __LINE__, "12      ",
		    "%-08d", 12);
  /* Integer zero-padding, width, and precision */
  nerrors += Verify(__FILE__, __LINE__, "  000012",
		    "%08.6d", 12);
  /* Integer base */
  nerrors += Verify(__FILE__, __LINE__, "42",
		   "%u", 42);
  nerrors += Verify(__FILE__, __LINE__, "-1",
		   "%d", -1);
  nerrors += Verify(__FILE__, __LINE__, "52",
		   "%o", 42);
  nerrors += Verify(__FILE__, __LINE__, "052",
		   "%#o", 42);
  nerrors += Verify(__FILE__, __LINE__, "2a",
		    "%x", 42);
  nerrors += Verify(__FILE__, __LINE__, "2A",
		    "%X", 42);
  nerrors += Verify(__FILE__, __LINE__, "0x2a",
		   "%#x", 42);
  nerrors += Verify(__FILE__, __LINE__, "0X2A",
		   "%#X", 42);
  nerrors += Verify(__FILE__, __LINE__, "0x00c ",
		   "%-#6.3x", 12);
  sprintf(buffer, "%u", UINT_MAX);
  nerrors += Verify(__FILE__, __LINE__, buffer,
		   "%u", -1);
  sprintf(buffer, "%x", UINT_MAX);
  nerrors += Verify(__FILE__, __LINE__, buffer,
		    "%x", -1);
  /* Double */
  nerrors += Verify(__FILE__, __LINE__, "3141.000000",
		    "%f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.500000",
		    "%f", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3.141000e+03",
		    "%e", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "     -2.3420e-02",
		    "%16.4e", -2.342E-02);
  nerrors += Verify(__FILE__, __LINE__, "     -2.3420e-22",
		    "%16.4e", -2.342E-22);
  nerrors += Verify(__FILE__, __LINE__, "      2.3420e-02",
		    "% 16.4e", 2.342E-02);
  nerrors += Verify(__FILE__, __LINE__, " 2.3420e-02",
		    "% 1.4e", 2.342E-02);
  nerrors += Verify(__FILE__, __LINE__, "3.141000E-44",
		    "%E", 3.141e-44);
  nerrors += Verify(__FILE__, __LINE__, "0",
		    "%g", 0.0);
  nerrors += Verify(__FILE__, __LINE__, "-0",
		    "%g", trio_nzero());
  nerrors += Verify(__FILE__, __LINE__, "3141.5",
		    "%g", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3.1415E-06",
		    "%G", 3.1415e-6);
  nerrors += Verify(__FILE__, __LINE__, "+3141.000000",
		    "%+f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "-3141.000000",
		    "%+f", -3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0.333333",
		    "%f", 1.0/3.0);
  nerrors += Verify(__FILE__, __LINE__, "0.666667",
		    "%f", 2.0/3.0);
  /* Beyond accuracy */
  nerrors += Verify(__FILE__, __LINE__, "0.000000",
		    "%f", 1.234567890123456789e-20);
  nerrors += Verify(__FILE__, __LINE__, "1.3999999999999999111821580299875",
		    "%.32g", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.39999999999999991118215802998748",
		    "%.32f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.3999999999999999111821580300",
		    "%.28f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.399999999999999911182158",
		    "%.24f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.39999999999999991",
		    "%.17f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.40000000000000",
		    "%.14f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "39413.800000000002910383045673370361",
		    "%.30f", 39413.80);
  /* 2^-1 + 2^-15 */
  nerrors += Verify(__FILE__, __LINE__, "0.500030517578125",
		    "%.*g", DBL_DIG + 10, 0.500030517578125);
  /* Double decimal point */
  nerrors += Verify(__FILE__, __LINE__, "3141",
		    "%.0f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.000",
		    "%.3f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.000000",
		    "%#f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0.0000",
		    "%#.4f", 0.0);
  nerrors += Verify(__FILE__, __LINE__, "0.000",
		    "%#.4g", 0.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.0000",
		    "%#.4f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.",
		    "%#.0f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "11.0000",
		    "%#.4f", 11.0);
  nerrors += Verify(__FILE__, __LINE__, "100.00",
		    "%.2f", 99.9999);
  nerrors += Verify(__FILE__, __LINE__, "100",
		    "%.2g", 99.9999);
  nerrors += Verify(__FILE__, __LINE__, "100.",
		    "%#.2g", 99.9999);
  nerrors += Verify(__FILE__, __LINE__, "0.123",
		    "%0g", 0.123);
  nerrors += Verify(__FILE__, __LINE__, "1.00e+00",
		    "%.2e", 0.9999);
  nerrors += Verify(__FILE__, __LINE__, "1",
		    "%.2g", 0.9999);
  nerrors += Verify(__FILE__, __LINE__, "0.01",
		    "%.2g", 0.01);
  nerrors += Verify(__FILE__, __LINE__, "0.010",
		    "%#.2g", 0.01);
  /* Double width, precision, and zero padding */
  nerrors += Verify(__FILE__, __LINE__, "00003.141500e+03",
		    "%016e", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "    3.141500e+03",
		    "%16e", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3.141500e+03    ",
		    "%-16e", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "03.142e+03",
		    "%010.3e", 3141.5);
#if !defined(TRIO_COMPILER_ANCIENT)
  /* Long double */
  nerrors += Verify(__FILE__, __LINE__, "1.400000",
		    "%Lf", 1.4L);
#endif
  
  /* Special cases */
  nerrors += Verify(__FILE__, __LINE__, "1.00",
		    "%.2f", 0.999);
  nerrors += Verify(__FILE__, __LINE__, "100",
		    "%.0f", 99.9);
  nerrors += Verify(__FILE__, __LINE__, "inf",
		    "%f", trio_pinf());
  nerrors += Verify(__FILE__, __LINE__, "-inf",
		    "%f", trio_ninf());
  nerrors += Verify(__FILE__, __LINE__, "INF",
		    "%F", trio_pinf());
  nerrors += Verify(__FILE__, __LINE__, "-INF",
		    "%F", trio_ninf());
  /* May fail if NaN is unsupported */
  nerrors += Verify(__FILE__, __LINE__, "nan",
		    "%f", trio_nan());
  nerrors += Verify(__FILE__, __LINE__, "NAN",
		    "%F", trio_nan());
  
  /* Char width alignment */
  nerrors += Verify(__FILE__, __LINE__, "Char X   .",
	 "Char %-4c.", 'X');
  /* String width / precision */
  nerrors += Verify(__FILE__, __LINE__, " testing",
		    "%8s", "testing");
  nerrors += Verify(__FILE__, __LINE__, "testing ",
		    "%-8s", "testing");
  nerrors += Verify(__FILE__, __LINE__, " testing",
		    "%*s", 8, "testing");
  nerrors += Verify(__FILE__, __LINE__, "test",
		    "%.4s", "testing");
  nerrors += Verify(__FILE__, __LINE__, "test",
		    "%.*s", 4, "testing");
#if TRIO_UNIX98
  /* Positional */
  nerrors += Verify(__FILE__, __LINE__, "222 111",
		    "%2$s %1$s", "111", "222");
  nerrors += Verify(__FILE__, __LINE__, "123456    12345 0001234  00123",
		    "%4$d %3$*8$d %2$.*7$d %1$*6$.*5$d",
		    123, 1234, 12345, 123456, 5, 6, 7, 8);
#endif
  
#if TRIO_GNU
  nerrors += Verify(__FILE__, __LINE__, "256",
		    "%Zd", sizeof(buffer));
  errno = EINTR;
  nerrors += Verify(__FILE__, __LINE__, "Interrupted system call",
		    "%m");
#endif
  
#if TRIO_BSD || TRIO_GNU
  /* This may fail if the preprocessor does not recognize LL */
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%qd", 42LL);
#endif

#if TRIO_C99
  nerrors += Verify(__FILE__, __LINE__, "0x2.a00000p+1",
		    "%a", 42.0);
  nerrors += Verify(__FILE__, __LINE__, "-0x2.a00000p+1",
		    "%a", -42.0);
  nerrors += Verify(__FILE__, __LINE__, "0x1.800000p+0",
		    "%a", 1.5);
  nerrors += Verify(__FILE__, __LINE__, "0x1.666666p+0",
		    "%a", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "0xc.450000p+2",
		    "%a", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0XC.450000P+2",
		    "%A", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0xb.351c43p-25",
		    "%a", 3.141e-44);
  nerrors += Verify(__FILE__, __LINE__, "256",
		    "%zd", sizeof(buffer));
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%td", 42);
  /* Some compilers may not handle the LL suffix correctly */
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%jd", 42LL);
#endif

#if TRIO_WIDECHAR
  nerrors += Verify(__FILE__, __LINE__, "Hello World",
		    "%ls", L"Hello World");
  nerrors += Verify(__FILE__, __LINE__, "\\aHello World",
		    "%#ls", L"\aHello World");
  nerrors += Verify(__FILE__, __LINE__, "A",
		    "%lc", L'A');
  nerrors += Verify(__FILE__, __LINE__, "\\a",
		    "%#lc", L'\a');
#endif

#if TRIO_MICROSOFT
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%I8d", 42);
  nerrors += Verify(__FILE__, __LINE__, "ffffffff",
		    "%I16x", -1);
#endif
  
#if TRIO_EXTENSION
  nerrors += Verify(__FILE__, __LINE__, "  42   86",
		    "%!4d %d", 42, 86);
  nerrors += Verify(__FILE__, __LINE__, "0042 0086",
		    "%!04d %d", 42, 86);
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%&d", sizeof(long), 42L);
  /* Non-printable string */
  nerrors += Verify(__FILE__, __LINE__, "NonPrintable \\x01 \\a \\\\",
		    "NonPrintable %#s", "\01 \07 \\");
  nerrors += Verify(__FILE__, __LINE__, "\\a \\b \\t \\n \\v \\f \\r",
		    "%#s", "\007 \010 \011 \012 \013 \014 \015");
  /* Quote flag */
  nerrors += Verify(__FILE__, __LINE__, "Another \"quoted\" string",
		   "Another %'s string", "quoted");
  /* Integer base */
  nerrors += Verify(__FILE__, __LINE__, "Number 42 == 1120 (base 3)",
		    "Number %d == %..3i (base 3)", 42, 42);
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%..3d", 42);
  nerrors += Verify(__FILE__, __LINE__, "52",
		    "%..3o", 42);
  nerrors += Verify(__FILE__, __LINE__, "2a",
		    "%..3x", 42);
  /* Integer thousand separator */
  nerrors += Verify(__FILE__, __LINE__, "Number 1,000,000",
		    "Number %'d", 1000000);
  /* Float thousand separator */
  nerrors += Verify(__FILE__, __LINE__, "31,415.200000",
		    "%'f", 31415.2);
  nerrors += Verify(__FILE__, __LINE__, "1,000,000.000000",
		    "%'f", 1000000.0);
  /* Rounding modifier */
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%.32Rf", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%.17Rf", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "39413.8",
		    "%.30Rf", 39413.80);
# if !defined(TRIO_COMPILER_ANCIENT)
  /* Long double */
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%RLf", 1.4L);
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%.30RLf", 1.4L);
# endif
#endif

#if defined(TRIO_BREESE)
  /*
   * These results depends on issues beyond our control. For example,
   * the accuracy of floating-point numbers depends on the underlying
   * floating-point hardware (e.g. whether IEEE 754 double or extended-
   * double format is used).
   *
   * These tests are therefore not part of the normal regression test,
   * but we keep them here for development purposes.
   */
  nerrors += Verify(__FILE__, __LINE__, "123456789012345680868.000000",
		    "%f", 1.234567890123456789e20);
  nerrors += Verify(__FILE__, __LINE__, "1.23456789012345677901e-20",
		    "%.20e", 1.2345678901234567e-20);
  nerrors += Verify(__FILE__, __LINE__, "0.666666666666666629659233",
		    "%.*g", DBL_DIG + 10, 2.0/3.0);
  nerrors += Verify(__FILE__, __LINE__, "123456789012345700000",
		    "%Rf", 1.234567890123456789e20);
# if !defined(TRIO_COMPILER_ANCIENT)
  nerrors += Verify(__FILE__, __LINE__, "0.666666666666666667",
		    "%RLf", (2.0L/3.0L));
  nerrors += Verify(__FILE__, __LINE__, "0.666666666666666667",
		    "%.30RLf", (2.0L/3.0L));
# endif
#endif
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyErrors(TRIO_NOARGS)
{
  char buffer[512];
  int rc;
  int nerrors = 0;
  
  /* Error: Invalid argument 1 */
  rc = trio_snprintf(buffer, sizeof(buffer), "%d %r", 42, "text");
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 5",
		    "%s", buffer);
#else
  nerrors += (rc != -1);
#endif
  /* Error: Invalid argument 2 */
  rc = trio_snprintf(buffer, sizeof(buffer), "%#");
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 3",
		    "%s", buffer);
#else
  nerrors += (rc != -1);
#endif
  /* Error: Invalid argument 3 */
  rc = trio_snprintf(buffer, sizeof(buffer), "%hhhd", 42);
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 4",
		    "%s", buffer);
#else
  nerrors += (rc != -1);
#endif
  /* Error: Double reference */
  rc = trio_snprintf(buffer, sizeof(buffer), "hello %1$d %1$d", 31, 32);
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
# if TRIO_UNIX98
  nerrors += Verify(__FILE__, __LINE__, "Err = 4 (Double reference), Pos = 0",
		    "%s", buffer);
# else
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 9",
		    "%s", buffer);
# endif
#else
  nerrors += (rc != -1);
#endif
  /* Error: Reference gap */
  rc = trio_snprintf(buffer, sizeof(buffer), "%3$d %1$d", 31, 32, 33);
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
# if TRIO_UNIX98
  nerrors += Verify(__FILE__, __LINE__, "Err = 5 (Reference gap), Pos = 1",
		    "%s", buffer);
# else
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 3",
		    "%s", buffer);
# endif
#else
  nerrors += (rc != -1);
#endif
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningOneInteger
TRIO_ARGS5((file, line, expected, format, original),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *format,
	   int original)
{
  int number;
  char data[512];
  
  trio_snprintf(data, sizeof(data), format, original);
  trio_sscanf(data, format, &number);
  return Verify(file, line, expected, format, number);
}

int
VerifyScanningIntegers(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "42",
				      "%i", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "42",
				      "%d", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "-42",
				      "%d", -42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "2147483647",
				      "%d", 2147483647);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "42",
				      "%u", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "2a",
				      "%x", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "52",
				      "%o", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "101010",
				      "%..2i", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "0x2a",
				      "%#x", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "052",
				      "%#o", 42);

  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningOneFloat
TRIO_ARGS5((file, line, expected, format, original),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *format,
	   double original)
{
  double number;
  char data[512];
  
  trio_snprintf(data, sizeof(data), format, original);
  trio_sscanf(data, format, &number);
  return Verify(file, line, expected, format, number);
}

int
VerifyScanningFloats(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "42.000000",
				      "%f", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "-42.000000",
				      "%f", -42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "4.200000e+01",
				      "%e", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "4.200000E+01",
				      "%E", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "42",
				      "%g", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457e+06",
				      "%g", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457e-06",
				      "%g", 1.234567e-6);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457E+06",
				      "%G", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.234567e+06",
				      "%12e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.234500e+00",
				      "%6e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.234567e+06",
				      "%.6e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.2345670000e+06",
				      "%.10e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457e+06",
				      "%.6g", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1234567",
				      "%.10g", 1234567.0);
#if TRIO_C99
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "0x2.a00000p+1",
				      "%a", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "0x1.2d6870p+5",
				      "%a", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "0X1.2D6870P+5",
				      "%A", 1234567.0);
#endif
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.79769e+308",
				      "%g", 1.79769e+308);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "nan",
				      "%f", trio_nan());
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "NAN",
				      "%F", trio_nan());
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "-inf",
				      "%f", trio_ninf());
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningOneString
TRIO_ARGS5((file, line, expected, format, original),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *format,
	   char *original)
{
  char string[512];
  char data[512];
  
  trio_snprintf(data, sizeof(data), "%s", original);
  trio_sscanf(data, format, string);
  return Verify(file, line, expected, "%s", string);
}

int
VerifyScanningStrings(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello",
				     "%s", "hello");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello",
				     "%s", "hello world");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello world",
				     "%[^\n]", "hello world");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "(nil)",
				     "%s", NULL);
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello",
				     "%20s", "hello");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "he",
				     "%2s", "hello");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "ab",
				     "%[ab]", "abcba");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "abcba",
				     "%[abc]", "abcba");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "abcba",
				     "%[a-c]", "abcba");
#if TRIO_EXTENSION
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "abcba",
				     "%[[:alpha:]]", "abcba");
#endif
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "ba",
				     "%*[ab]c%[^\n]", "abcba");

  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningRegression(TRIO_NOARGS)
{
  int nerrors = 0;
  int rc;
  int index;
  double dnumber;
  trio_long_double_t ldnumber;
  long lnumber;
  int number;
  char ch;

  rc = trio_sscanf("1.5", "%lf%n", &dnumber, &index);
  nerrors += Verify(__FILE__, __LINE__, "1 3 1.500000",
		    "%d %d %f", rc, index, dnumber);
  rc = trio_sscanf("q 123", "%c%ld", &ch, &lnumber);
  nerrors += Verify(__FILE__, __LINE__, "q 123",
		    "%c %ld", ch, lnumber);
  rc = trio_sscanf("abc", "%*s%n", &number);
  nerrors += Verify(__FILE__, __LINE__, "0 3",
		    "%d %d", rc, number);
  rc = trio_sscanf("abc def", "%*s%n", &number);
  nerrors += Verify(__FILE__, __LINE__, "0 3",
		    "%d %d", rc, number);
  rc = trio_sscanf("0.141882295971771490", "%lf", &dnumber);
  number = 33;
  rc = trio_sscanf("total 1", "total %d", &number);
  nerrors += Verify(__FILE__, __LINE__, "1 1",
		    "%d %d", rc, number);
#if defined(TRIO_BREESE)
  nerrors += Verify(__FILE__, __LINE__, "1 0.141882295971771488",
		    "%d %.18f", rc, dnumber);
  rc = trio_sscanf("0.141882295971771490", "%Lf", &ldnumber);
  nerrors += Verify(__FILE__, __LINE__, "1 0.141882295971771490",
		    "%d %.18Lf", rc, ldnumber);
#endif
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanning(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningIntegers();
  nerrors += VerifyScanningFloats();
  nerrors += VerifyScanningStrings();
  nerrors += VerifyScanningRegression();
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyStrings(TRIO_NOARGS)
{
  int nerrors = 0;
#if !defined(TRIO_MINIMAL)
  char buffer[512];
  double dnumber;
  float fnumber;
  char *end;

  /* Comparison */
  trio_copy(buffer, "Find me now");
  if (trio_length(buffer) != sizeof("Find me now") - 1) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal(buffer, "Find me now")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal_case(buffer, "Find me now")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_equal_case(buffer, "FIND ME NOW")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal_max(buffer, sizeof("Find me") - 1, "Find ME")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_contains(buffer, "me")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_contains(buffer, "and me")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_substring(buffer, "me") == NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_substring_max(buffer, 4, "me") != NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_match(buffer, "* me *")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_match_case(buffer, "* ME *")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_index(buffer, 'n') == NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_index(buffer, '_') != NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_index_last(buffer, 'n') == NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }

  /* Append */
  trio_copy(buffer, "Find me now");
  if (!trio_append(buffer, " and again")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal(buffer, "Find me now and again")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_append_max(buffer, 0, "should not appear")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal(buffer, "Find me now and again")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  
  /* To upper/lower */
  trio_copy(buffer, "Find me now");
  trio_upper(buffer);
  if (!trio_equal_case(buffer, "FIND ME NOW")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  trio_lower(buffer);
  if (!trio_equal_case(buffer, "find me now")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }

  /* Double conversion */
  trio_copy(buffer, "3.1415");
  dnumber = trio_to_double(buffer, NULL);
  if (!DOUBLE_EQUAL(dnumber, 3.1415)) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  fnumber = trio_to_float(buffer, NULL);
  if (!FLOAT_EQUAL(fnumber, 3.1415)) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }

  /* Long conversion */
  trio_copy(buffer, "3.1415");
  if (trio_to_long(buffer, NULL, 10) != 3L) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_to_long(buffer, NULL, 4) != 3L) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  trio_to_long(buffer, &end, 2);
  if (end != buffer) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  
#endif /* !defined(TRIO_MINIMAL) */
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyDynamicStrings(TRIO_NOARGS)
{
  int nerrors = 0;
#if !defined(TRIO_MINIMAL)
  trio_string_t *string;

  string = trio_xstring_duplicate("Find me now");
  if (string == NULL) {
    nerrors++;
    goto error;
  }
  if (!trio_xstring_equal(string, "FIND ME NOW"))
    nerrors++;
  if (!trio_xstring_append(string, " and again") ||
      !trio_xstring_equal(string, "FIND ME NOW AND AGAIN"))
    nerrors++;
  if (!trio_xstring_contains(string, "me"))
    nerrors++;
  if (trio_xstring_contains(string, "ME"))
    nerrors++;
  if (!trio_xstring_match(string, "* me *"))
    nerrors++;
  if (trio_xstring_match_case(string, "* ME *"))
    nerrors++;
  
 error:
  if (string)
    trio_string_destroy(string);
  
#endif /* !defined(TRIO_MINIMAL) */
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyNaN(TRIO_NOARGS)
{
  double ninf_number = trio_ninf();
  double pinf_number = trio_pinf();
  double nan_number = trio_nan();
  int nerrors = 0;
  
  nerrors += Verify(__FILE__, __LINE__, "-1",
		    "%d", trio_isinf(ninf_number));
  nerrors += Verify(__FILE__, __LINE__, "0",
		    "%d", trio_isinf(42.0));
  nerrors += Verify(__FILE__, __LINE__, "1",
		    "%d", trio_isinf(pinf_number));
  nerrors += Verify(__FILE__, __LINE__, "1",
		    "%d", trio_isnan(nan_number));
  nerrors += Verify(__FILE__, __LINE__, "0",
		    "%d", trio_isnan(42.0));

  return nerrors;
}

/*************************************************************************
 *
 */
int
main(TRIO_NOARGS)
{
  int nerrors = 0;

  printf("%s\n", rcsid);

  /* Override system locale settings */
  trio_locale_set_decimal_point(".");
  trio_locale_set_thousand_separator(",");
  trio_locale_set_grouping("\3");

  printf("Verifying strings\n");
  nerrors += VerifyStrings();
  
  printf("Verifying dynamic strings\n");
  nerrors += VerifyDynamicStrings();

  printf("Verifying special quantities\n");
  nerrors += VerifyNaN();
  
  printf("Verifying formatting\n");
  nerrors += VerifyFormatting();
  
  printf("Verifying scanning\n");
  nerrors += VerifyScanning();
  
  printf("Verifying return values\n");
  nerrors += VerifyErrors();
  nerrors += VerifyReturnValues();
  
  printf("Verifying allocation\n");
  nerrors += VerifyAllocate();

  if (nerrors == 0)
    printf("Regression test suceeded\n");
  else
    printf("Regression test failed in %d instance(s)\n", nerrors);
  
  return nerrors ? 1 : 0;
}

Index: avida/current/source/third-party/trio-1.9/trio/strio.h
+++ avida/current/source/third-party/trio-1.9/trio/strio.h
/*************************************************************************
 *
 * $Id: strio.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************
 *
 * This maintains backwards compatibility with the strio functions.
 *
 ************************************************************************/

#ifndef TRIO_STRIO_H
#define TRIO_STRIO_H

#if !(defined(DEBUG) || defined(NDEBUG))
# define NDEBUG
#endif
#include "triostr.h"

enum {
  STRIO_HASH_NONE = TRIO_HASH_NONE,
  STRIO_HASH_PLAIN = TRIO_HASH_PLAIN,
  STRIO_HASH_TWOSIGNED = TRIO_HASH_TWOSIGNED
};

#define StrAlloc(n) trio_create(n)
#define StrAppend(x,y) ((void)trio_append((x),(y)),(x))
#define StrAppendMax(x,n,y) ((void)trio_append_max((x),(n),(y)),(x))
#define StrContains(x,y) trio_contains((x),(y))
#define StrCopy(x,y) ((void)trio_copy((x),(y)),(x))
#define StrCopyMax(x,n,y) ((void)trio_copy_max((x),(n),(y)),(x))
#define StrDuplicate(x) trio_duplicate(x)
#define StrDuplicateMax(x,n) trio_duplicate((x),(n))
#define StrEqual(x,y) trio_equal((x),(y))
#define StrEqualCase(x,y) trio_equal_case((x),(y))
#define StrEqualCaseMax(x,n,y) trio_equal_case_max((x),(n),(y))
#define StrEqualLocale(x,y) trio_equal_locale((x),(y))
#define StrEqualMax(x,n,y) trio_equal_max((x),(n),(y))
#define StrError(n) trio_error(n)
#define StrFree(x) trio_destroy(x)
#define StrFormat trio_sprintf
#define StrFormatAlloc trio_aprintf
#define StrFormatAppendMax trio_snprintfcat
#define StrFormatDateMax(x,n,y,t) trio_format_date_max((x),(n),(y),(t))
#define StrFormatMax trio_snprintf
#define StrHash(x,n) trio_hash((x),(n))
#define StrIndex(x,y) trio_index((x),(y))
#define StrIndexLast(x,y) trio_index_last((x),(y))
#define StrLength(x) trio_length((x))
#define StrMatch(x,y) trio_match((x),(y))
#define StrMatchCase(x,y) trio_match_case((x),(y))
#define StrScan trio_sscanf
#define StrSpanFunction(x,f) trio_span_function((x),(f))
#define StrSubstring(x,y) trio_substring((x),(y))
#define StrSubstringMax(x,n,y) trio_substring_max((x),(n),(y))
#define StrToDouble(x,y) trio_to_double((x),(y))
#define StrToFloat(x,y) trio_to_float((x),(y))
#define StrTokenize(x,y) trio_tokenize((x),(y))
#define StrToLong(x,y,n) trio_to_long((x),(y),(n))
#define StrToUnsignedLong(x,y,n) trio_to_unsigned_long((x),(n),(y))
#define StrToUpper(x) trio_upper(x)

#endif /* TRIO_STRIO_H */

Index: avida/current/source/third-party/trio-1.9/trio/trio.c
+++ avida/current/source/third-party/trio-1.9/trio/trio.c
/*************************************************************************
 *
 * $Id: trio.c,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 *************************************************************************
 *
 * A note to trio contributors:
 *
 * Avoid heap allocation at all costs to ensure that the trio functions
 * are async-safe. The exceptions are the printf/fprintf functions, which
 * uses fputc, and the asprintf functions and the <alloc> modifier, which
 * by design are required to allocate form the heap.
 *
 ************************************************************************/

/*
 * TODO:
 *  - Scan is probably too permissive about its modifiers.
 *  - C escapes in %#[] ?
 *  - Multibyte characters (done for format parsing, except scan groups)
 *  - Complex numbers? (C99 _Complex)
 *  - Boolean values? (C99 _Bool)
 *  - C99 NaN(n-char-sequence) missing
 *  - Should we support the GNU %a alloc modifier? GNU has an ugly hack
 *    for %a, because C99 used %a for other purposes. If specified as
 *    %as or %a[ it is interpreted as the alloc modifier, otherwise as
 *    the C99 hex-float. This means that you cannot scan %as as a hex-float
 *    immediately followed by an 's'.
 *  - Scanning of collating symbols.
 */

/*************************************************************************
 * Trio include files
 */
#include "triodef.h"
#include "trio.h"
#include "triop.h"
#include "trionan.h"
#if !defined(TRIO_MINIMAL)
# include "triostr.h"
#endif

/**************************************************************************
 *
 * Definitions
 *
 *************************************************************************/

#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR
# define TRIO_COMPILER_SUPPORTS_MULTIBYTE
# if !defined(MB_LEN_MAX)
#  define MB_LEN_MAX 6
# endif
#endif

/*************************************************************************
 * Generic definitions
 */

#if !(defined(DEBUG) || defined(NDEBUG))
# define NDEBUG
#endif
#include <assert.h>
#include <ctype.h>
#if !defined(TRIO_COMPILER_SUPPORTS_C99)
# define isblank(x) (((x)==32) || ((x)==9))
#endif
#include <math.h>
#include <limits.h>
#include <float.h>
#if defined(TRIO_COMPILER_ANCIENT)
# include <varargs.h>
#else
# include <stdarg.h>
#endif
#include <stddef.h>
#include <errno.h>

#ifndef NULL
# define NULL 0
#endif
#define NIL ((char)0)
#ifndef FALSE
# define FALSE (1 == 0)
# define TRUE (! FALSE)
#endif
#define BOOLEAN_T int

/* mincore() can be used for debugging purposes */
// XXX changed by kgn
//#define VALID(x) (NULL != (x))
#define VALID(x) (1)
// XXX

#if TRIO_ERRORS
  /*
   * Encode the error code and the position. This is decoded
   * with TRIO_ERROR_CODE and TRIO_ERROR_POSITION.
   */
# define TRIO_ERROR_RETURN(x,y) (- ((x) + ((y) << 8)))
#else
# define TRIO_ERROR_RETURN(x,y) (-1)
#endif


/*************************************************************************
 * Platform specific definitions
 */
#if defined(TRIO_PLATFORM_UNIX)
# include <unistd.h>
# include <signal.h>
# include <locale.h>
# define USE_LOCALE
#endif /* TRIO_PLATFORM_UNIX */
#if defined(TRIO_PLATFORM_VMS)
# include <unistd.h>
#endif
#if defined(TRIO_PLATFORM_WIN32)
# include <io.h>
# define read _read
# define write _write
#endif /* TRIO_PLATFORM_WIN32 */

#define TRIO_MSVC_VERSION_5 1100

#if TRIO_WIDECHAR
# if defined(TRIO_COMPILER_SUPPORTS_ISO94)
#  include <wchar.h>
#  include <wctype.h>
typedef wchar_t trio_wchar_t;
typedef wint_t trio_wint_t;
# else
typedef char trio_wchar_t;
typedef int trio_wint_t;
#  define WCONST(x) L ## x
#  define WEOF EOF
#  define iswalnum(x) isalnum(x)
#  define iswalpha(x) isalpha(x)
#  define iswblank(x) isblank(x)
#  define iswcntrl(x) iscntrl(x)
#  define iswdigit(x) isdigit(x)
#  define iswgraph(x) isgraph(x)
#  define iswlower(x) islower(x)
#  define iswprint(x) isprint(x)
#  define iswpunct(x) ispunct(x)
#  define iswspace(x) isspace(x)
#  define iswupper(x) isupper(x)
#  define iswxdigit(x) isxdigit(x)
# endif
#endif


/*************************************************************************
 * Compiler dependent definitions
 */

/* Support for long long */
#ifndef __cplusplus
# if !defined(USE_LONGLONG)
#  if defined(TRIO_COMPILER_GCC) && !defined(__STRICT_ANSI__)
#   define USE_LONGLONG
#  elif defined(TRIO_COMPILER_SUNPRO)
#   define USE_LONGLONG
#  elif defined(_LONG_LONG) || defined(_LONGLONG)
#   define USE_LONGLONG
#  endif
# endif
#endif

/* The extra long numbers */
#if defined(USE_LONGLONG)
typedef signed long long int trio_longlong_t;
typedef unsigned long long int trio_ulonglong_t;
#elif defined(TRIO_COMPILER_MSVC)
# if (_MSC_VER >= TRIO_MSVC_VERSION_5)
typedef signed __int64 trio_longlong_t;
typedef unsigned __int64 trio_ulonglong_t;
# else
typedef signed long int trio_longlong_t;
typedef unsigned long int trio_ulonglong_t;
# endif
#else
typedef TRIO_SIGNED long int trio_longlong_t;
typedef unsigned long int trio_ulonglong_t;
#endif

/* Maximal and fixed integer types */
#if defined(TRIO_COMPILER_SUPPORTS_C99)
# include <stdint.h>
typedef intmax_t trio_intmax_t;
typedef uintmax_t trio_uintmax_t;
typedef int8_t trio_int8_t;
typedef int16_t trio_int16_t;
typedef int32_t trio_int32_t;
typedef int64_t trio_int64_t;
#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98)
# include <inttypes.h>
typedef intmax_t trio_intmax_t;
typedef uintmax_t trio_uintmax_t;
typedef int8_t trio_int8_t;
typedef int16_t trio_int16_t;
typedef int32_t trio_int32_t;
typedef int64_t trio_int64_t;
#elif defined(TRIO_COMPILER_MSVC) && (_MSC_VER >= TRIO_MSVC_VERSION_5)
typedef trio_longlong_t trio_intmax_t;
typedef trio_ulonglong_t trio_uintmax_t;
typedef __int8 trio_int8_t;
typedef __int16 trio_int16_t;
typedef __int32 trio_int32_t;
typedef __int64 trio_int64_t;
#else
typedef trio_longlong_t trio_intmax_t;
typedef trio_ulonglong_t trio_uintmax_t;
# if defined(TRIO_INT8_T)
typedef TRIO_INT8_T trio_int8_t;
# else
typedef TRIO_SIGNED char trio_int8_t;
# endif
# if defined(TRIO_INT16_T)
typedef TRIO_INT16_T trio_int16_t;
# else
typedef TRIO_SIGNED short trio_int16_t;
# endif
# if defined(TRIO_INT32_T)
typedef TRIO_INT32_T trio_int32_t;
# else
typedef TRIO_SIGNED int trio_int32_t;
# endif
# if defined(TRIO_INT64_T)
typedef TRIO_INT64_T trio_int64_t;
# else
typedef trio_longlong_t trio_int64_t;
# endif
#endif

#if !(defined(TRIO_COMPILER_SUPPORTS_C99) \
 || defined(TRIO_COMPILER_SUPPORTS_UNIX01))
# define floorl(x) floor((double)(x))
# define fmodl(x,y) fmod((double)(x),(double)(y))
# define powl(x,y) pow((double)(x),(double)(y))
#endif

#define TRIO_FABS(x) (((x) < 0.0) ? -(x) : (x))

/*************************************************************************
 * Internal Definitions
 */

#ifndef DECIMAL_DIG
# define DECIMAL_DIG DBL_DIG
#endif

/* Long double sizes */
#ifdef LDBL_DIG
# define MAX_MANTISSA_DIGITS LDBL_DIG
# define MAX_EXPONENT_DIGITS 4
# define MAX_DOUBLE_DIGITS LDBL_MAX_10_EXP
#else
# define MAX_MANTISSA_DIGITS DECIMAL_DIG
# define MAX_EXPONENT_DIGITS 3
# define MAX_DOUBLE_DIGITS DBL_MAX_10_EXP
#endif

#if defined(TRIO_COMPILER_ANCIENT) || !defined(LDBL_DIG)
# undef LDBL_DIG
# undef LDBL_MANT_DIG
# undef LDBL_EPSILON
# define LDBL_DIG DBL_DIG
# define LDBL_MANT_DIG DBL_MANT_DIG
# define LDBL_EPSILON DBL_EPSILON
#endif

/* The maximal number of digits is for base 2 */
#define MAX_CHARS_IN(x) (sizeof(x) * CHAR_BIT)
/* The width of a pointer. The number of bits in a hex digit is 4 */
#define POINTER_WIDTH ((sizeof("0x") - 1) + sizeof(trio_pointer_t) * CHAR_BIT / 4)

/* Infinite and Not-A-Number for floating-point */
#define INFINITE_LOWER "inf"
#define INFINITE_UPPER "INF"
#define LONG_INFINITE_LOWER "infinite"
#define LONG_INFINITE_UPPER "INFINITE"
#define NAN_LOWER "nan"
#define NAN_UPPER "NAN"

/* Various constants */
enum {
  TYPE_PRINT = 1,
  TYPE_SCAN  = 2,

  /* Flags. Use maximum 32 */
  FLAGS_NEW                 = 0,
  FLAGS_STICKY              = 1,
  FLAGS_SPACE               = 2 * FLAGS_STICKY,
  FLAGS_SHOWSIGN            = 2 * FLAGS_SPACE,
  FLAGS_LEFTADJUST          = 2 * FLAGS_SHOWSIGN,
  FLAGS_ALTERNATIVE         = 2 * FLAGS_LEFTADJUST,
  FLAGS_SHORT               = 2 * FLAGS_ALTERNATIVE,
  FLAGS_SHORTSHORT          = 2 * FLAGS_SHORT,
  FLAGS_LONG                = 2 * FLAGS_SHORTSHORT,
  FLAGS_QUAD                = 2 * FLAGS_LONG,
  FLAGS_LONGDOUBLE          = 2 * FLAGS_QUAD,
  FLAGS_SIZE_T              = 2 * FLAGS_LONGDOUBLE,
  FLAGS_PTRDIFF_T           = 2 * FLAGS_SIZE_T,
  FLAGS_INTMAX_T            = 2 * FLAGS_PTRDIFF_T,
  FLAGS_NILPADDING          = 2 * FLAGS_INTMAX_T,
  FLAGS_UNSIGNED            = 2 * FLAGS_NILPADDING,
  FLAGS_UPPER               = 2 * FLAGS_UNSIGNED,
  FLAGS_WIDTH               = 2 * FLAGS_UPPER,
  FLAGS_WIDTH_PARAMETER     = 2 * FLAGS_WIDTH,
  FLAGS_PRECISION           = 2 * FLAGS_WIDTH_PARAMETER,
  FLAGS_PRECISION_PARAMETER = 2 * FLAGS_PRECISION,
  FLAGS_BASE                = 2 * FLAGS_PRECISION_PARAMETER,
  FLAGS_BASE_PARAMETER      = 2 * FLAGS_BASE,
  FLAGS_FLOAT_E             = 2 * FLAGS_BASE_PARAMETER,
  FLAGS_FLOAT_G             = 2 * FLAGS_FLOAT_E,
  FLAGS_QUOTE               = 2 * FLAGS_FLOAT_G,
  FLAGS_WIDECHAR            = 2 * FLAGS_QUOTE,
  FLAGS_ALLOC               = 2 * FLAGS_WIDECHAR,
  FLAGS_IGNORE              = 2 * FLAGS_ALLOC,
  FLAGS_IGNORE_PARAMETER    = 2 * FLAGS_IGNORE,
  FLAGS_VARSIZE_PARAMETER   = 2 * FLAGS_IGNORE_PARAMETER,
  FLAGS_FIXED_SIZE          = 2 * FLAGS_VARSIZE_PARAMETER,
  /* Reused flags */
  FLAGS_EXCLUDE             = FLAGS_SHORT,
  FLAGS_USER_DEFINED        = FLAGS_IGNORE,
  FLAGS_ROUNDING            = FLAGS_INTMAX_T,
  /* Compounded flags */
  FLAGS_ALL_VARSIZES        = FLAGS_LONG | FLAGS_QUAD | FLAGS_INTMAX_T | FLAGS_PTRDIFF_T | FLAGS_SIZE_T,
  FLAGS_ALL_SIZES           = FLAGS_ALL_VARSIZES | FLAGS_SHORTSHORT | FLAGS_SHORT,

  NO_POSITION  = -1,
  NO_WIDTH     =  0,
  NO_PRECISION = -1,
  NO_SIZE      = -1,

  /* Do not change these */
  NO_BASE      = -1,
  MIN_BASE     =  2,
  MAX_BASE     = 36,
  BASE_BINARY  =  2,
  BASE_OCTAL   =  8,
  BASE_DECIMAL = 10,
  BASE_HEX     = 16,

  /* Maximal number of allowed parameters */
  MAX_PARAMETERS = 64,
  /* Maximal number of characters in class */
  MAX_CHARACTER_CLASS = UCHAR_MAX + 1,

  /* Maximal string lengths for user-defined specifiers */
  MAX_USER_NAME = 64,
  MAX_USER_DATA = 256,
  
  /* Maximal length of locale separator strings */
  MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX,
  /* Maximal number of integers in grouping */
  MAX_LOCALE_GROUPS = 64,

  /* Initial size of asprintf buffer */
  DYNAMIC_START_SIZE = 32
};

#define NO_GROUPING ((int)CHAR_MAX)

/* Fundamental formatting parameter types */
#define FORMAT_UNKNOWN   0
#define FORMAT_INT       1
#define FORMAT_DOUBLE    2
#define FORMAT_CHAR      3
#define FORMAT_STRING    4
#define FORMAT_POINTER   5
#define FORMAT_COUNT     6
#define FORMAT_PARAMETER 7
#define FORMAT_GROUP     8
#if TRIO_GNU
# define FORMAT_ERRNO    9
#endif
#if TRIO_EXTENSION
# define FORMAT_USER_DEFINED 10
#endif

/* Character constants */
#define CHAR_IDENTIFIER '%'
#define CHAR_BACKSLASH '\\'
#define CHAR_QUOTE '\"'
#define CHAR_ADJUST ' '

/* Character class expressions */
#define CLASS_ALNUM "[:alnum:]"
#define CLASS_ALPHA "[:alpha:]"
#define CLASS_BLANK "[:blank:]"
#define CLASS_CNTRL "[:cntrl:]"
#define CLASS_DIGIT "[:digit:]"
#define CLASS_GRAPH "[:graph:]"
#define CLASS_LOWER "[:lower:]"
#define CLASS_PRINT "[:print:]"
#define CLASS_PUNCT "[:punct:]"
#define CLASS_SPACE "[:space:]"
#define CLASS_UPPER "[:upper:]"
#define CLASS_XDIGIT "[:xdigit:]"

/*
 * SPECIFIERS:
 *
 *
 * a  Hex-float
 * A  Hex-float
 * c  Character
 * C  Widechar character (wint_t)
 * d  Decimal
 * e  Float
 * E  Float
 * F  Float
 * F  Float
 * g  Float
 * G  Float
 * i  Integer
 * m  Error message
 * n  Count
 * o  Octal
 * p  Pointer
 * s  String
 * S  Widechar string (wchar_t *)
 * u  Unsigned
 * x  Hex
 * X  Hex
 * [] Group
 * <> User-defined
 *
 * Reserved:
 *
 * D  Binary Coded Decimal %D(length,precision) (OS/390)
 */
#define SPECIFIER_CHAR 'c'
#define SPECIFIER_STRING 's'
#define SPECIFIER_DECIMAL 'd'
#define SPECIFIER_INTEGER 'i'
#define SPECIFIER_UNSIGNED 'u'
#define SPECIFIER_OCTAL 'o'
#define SPECIFIER_HEX 'x'
#define SPECIFIER_HEX_UPPER 'X'
#define SPECIFIER_FLOAT_E 'e'
#define SPECIFIER_FLOAT_E_UPPER 'E'
#define SPECIFIER_FLOAT_F 'f'
#define SPECIFIER_FLOAT_F_UPPER 'F'
#define SPECIFIER_FLOAT_G 'g'
#define SPECIFIER_FLOAT_G_UPPER 'G'
#define SPECIFIER_POINTER 'p'
#define SPECIFIER_GROUP '['
#define SPECIFIER_UNGROUP ']'
#define SPECIFIER_COUNT 'n'
#if TRIO_UNIX98
# define SPECIFIER_CHAR_UPPER 'C'
# define SPECIFIER_STRING_UPPER 'S'
#endif
#if TRIO_C99
# define SPECIFIER_HEXFLOAT 'a'
# define SPECIFIER_HEXFLOAT_UPPER 'A'
#endif
#if TRIO_GNU
# define SPECIFIER_ERRNO 'm'
#endif
#if TRIO_EXTENSION
# define SPECIFIER_BINARY 'b'
# define SPECIFIER_BINARY_UPPER 'B'
# define SPECIFIER_USER_DEFINED_BEGIN '<'
# define SPECIFIER_USER_DEFINED_END '>'
# define SPECIFIER_USER_DEFINED_SEPARATOR ':'
#endif

/*
 * QUALIFIERS:
 *
 *
 * Numbers = d,i,o,u,x,X
 * Float = a,A,e,E,f,F,g,G
 * String = s
 * Char = c
 *
 *
 * 9$ Position
 *      Use the 9th parameter. 9 can be any number between 1 and
 *      the maximal argument
 *
 * 9 Width
 *      Set width to 9. 9 can be any number, but must not be postfixed
 *      by '$'
 *
 * h  Short
 *    Numbers:
 *      (unsigned) short int
 *
 * hh Short short
 *    Numbers:
 *      (unsigned) char
 *
 * l  Long
 *    Numbers:
 *      (unsigned) long int
 *    String:
 *      as the S specifier
 *    Char:
 *      as the C specifier
 *
 * ll Long Long
 *    Numbers:
 *      (unsigned) long long int
 *
 * L  Long Double
 *    Float
 *      long double
 *
 * #  Alternative
 *    Float:
 *      Decimal-point is always present
 *    String:
 *      non-printable characters are handled as \number
 *
 *    Spacing
 *
 * +  Sign
 *
 * -  Alignment
 *
 * .  Precision
 *
 * *  Parameter
 *    print: use parameter
 *    scan: no parameter (ignore)
 *
 * q  Quad
 *
 * Z  size_t
 *
 * w  Widechar
 *
 * '  Thousands/quote
 *    Numbers:
 *      Integer part grouped in thousands
 *    Binary numbers:
 *      Number grouped in nibbles (4 bits)
 *    String:
 *      Quoted string
 *
 * j  intmax_t
 * t  prtdiff_t
 * z  size_t
 *
 * !  Sticky
 * @  Parameter (for both print and scan)
 *
 * I  n-bit Integer
 *    Numbers:
 *      The following options exists
 *        I8  = 8-bit integer
 *        I16 = 16-bit integer
 *        I32 = 32-bit integer
 *        I64 = 64-bit integer
 */
#define QUALIFIER_POSITION '$'
#define QUALIFIER_SHORT 'h'
#define QUALIFIER_LONG 'l'
#define QUALIFIER_LONG_UPPER 'L'
#define QUALIFIER_ALTERNATIVE '#'
#define QUALIFIER_SPACE ' '
#define QUALIFIER_PLUS '+'
#define QUALIFIER_MINUS '-'
#define QUALIFIER_DOT '.'
#define QUALIFIER_STAR '*'
#define QUALIFIER_CIRCUMFLEX '^' /* For scanlists */
#if TRIO_C99
# define QUALIFIER_SIZE_T 'z'
# define QUALIFIER_PTRDIFF_T 't'
# define QUALIFIER_INTMAX_T 'j'
#endif
#if TRIO_BSD || TRIO_GNU
# define QUALIFIER_QUAD 'q'
#endif
#if TRIO_GNU
# define QUALIFIER_SIZE_T_UPPER 'Z'
#endif
#if TRIO_MISC
# define QUALIFIER_WIDECHAR 'w'
#endif
#if TRIO_MICROSOFT
# define QUALIFIER_FIXED_SIZE 'I'
#endif
#if TRIO_EXTENSION
# define QUALIFIER_QUOTE '\''
# define QUALIFIER_STICKY '!'
# define QUALIFIER_VARSIZE '&' /* This should remain undocumented */
# define QUALIFIER_PARAM '@' /* Experimental */
# define QUALIFIER_COLON ':' /* For scanlists */
# define QUALIFIER_EQUAL '=' /* For scanlists */
# define QUALIFIER_ROUNDING_UPPER 'R'
#endif


/*************************************************************************
 *
 * Internal Structures
 *
 *************************************************************************/

/* Parameters */
typedef struct {
  /* An indication of which entry in the data union is used */
  int type;
  /* The flags */
  unsigned long flags;
  /* The width qualifier */
  int width;
  /* The precision qualifier */
  int precision;
  /* The base qualifier */
  int base;
  /* The size for the variable size qualifier */
  int varsize;
  /* The marker of the end of the specifier */
  int indexAfterSpecifier;
  /* The data from the argument list */
  union {
    char *string;
#if TRIO_WIDECHAR
    trio_wchar_t *wstring;
#endif
    trio_pointer_t pointer;
    union {
      trio_intmax_t as_signed;
      trio_uintmax_t as_unsigned;
    } number;
    double doubleNumber;
    double *doublePointer;
    trio_long_double_t longdoubleNumber;
    trio_long_double_t *longdoublePointer;
    int errorNumber;
  } data;
  /* For the user-defined specifier */
  char user_name[MAX_USER_NAME];
  char user_data[MAX_USER_DATA];
} trio_parameter_t;

/* Container for customized functions */
typedef struct {
  union {
    trio_outstream_t out;
    trio_instream_t in;
  } stream;
  trio_pointer_t closure;
} trio_custom_t;

/* General trio "class" */
typedef struct _trio_class_t {
  /*
   * The function to write characters to a stream.
   */
  void (*OutStream) TRIO_PROTO((struct _trio_class_t *, int));
  /*
   * The function to read characters from a stream.
   */
  void (*InStream) TRIO_PROTO((struct _trio_class_t *, int *));
  /*
   * The current location in the stream.
   */
  trio_pointer_t location;
  /*
   * The character currently being processed.
   */
  int current;
  /*
   * The number of characters that would have been written/read
   * if there had been sufficient space.
   */
  int processed;
  /*
   * The number of characters that are actually written/read.
   * Processed and committed will only differ for the *nprintf
   * and *nscanf functions.
   */
  int committed;
  /*
   * The upper limit of characters that may be written/read.
   */
  int max;
  /*
   * The last output error that was detected.
   */
  int error;
} trio_class_t;

/* References (for user-defined callbacks) */
typedef struct _trio_reference_t {
  trio_class_t *data;
  trio_parameter_t *parameter;
} trio_reference_t;

/* Registered entries (for user-defined callbacks) */
typedef struct _trio_userdef_t {
  struct _trio_userdef_t *next;
  trio_callback_t callback;
  char *name;
} trio_userdef_t;


/*************************************************************************
 *
 * Internal Variables
 *
 *************************************************************************/

static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.1 2003/11/25 18:20:49 kaben Exp $";

/*
 * Need this to workaround a parser bug in HP C/iX compiler that fails
 * to resolves macro definitions that includes type 'long double',
 * e.g: va_arg(arg_ptr, long double)
 */
#if defined(TRIO_PLATFORM_MPEIX)
static TRIO_CONST trio_long_double_t ___dummy_long_double = 0;
#endif

static TRIO_CONST char internalNullString[] = "(nil)";

#if defined(USE_LOCALE)
static struct lconv *internalLocaleValues = NULL;
#endif

/*
 * UNIX98 says "in a locale where the radix character is not defined,
 * the radix character defaults to a period (.)"
 */
static int internalDecimalPointLength = 1;
static int internalThousandSeparatorLength = 1;
static char internalDecimalPoint = '.';
static char internalDecimalPointString[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ".";
static char internalThousandSeparator[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ",";
static char internalGrouping[MAX_LOCALE_GROUPS] = { (char)NO_GROUPING };

static TRIO_CONST char internalDigitsLower[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static TRIO_CONST char internalDigitsUpper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static BOOLEAN_T internalDigitsUnconverted = TRUE;
static int internalDigitArray[128];
#if TRIO_EXTENSION
static BOOLEAN_T internalCollationUnconverted = TRUE;
static char internalCollationArray[MAX_CHARACTER_CLASS][MAX_CHARACTER_CLASS];
#endif

#if TRIO_EXTENSION
static TRIO_VOLATILE trio_callback_t internalEnterCriticalRegion = NULL;
static TRIO_VOLATILE trio_callback_t internalLeaveCriticalRegion = NULL;
static trio_userdef_t *internalUserDef = NULL;
#endif


/*************************************************************************
 *
 * Internal Functions
 *
 ************************************************************************/

#if defined(TRIO_MINIMAL)
# define TRIO_STRING_PUBLIC static
# include "triostr.c"
#endif /* defined(TRIO_MINIMAL) */

/*************************************************************************
 * TrioIsQualifier
 *
 * Description:
 *  Remember to add all new qualifiers to this function.
 *  QUALIFIER_POSITION must not be added.
 */
TRIO_PRIVATE BOOLEAN_T
TrioIsQualifier
TRIO_ARGS1((character),
	   TRIO_CONST char character)
{
  /* QUALIFIER_POSITION is not included */
  switch (character)
    {
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
    case QUALIFIER_PLUS:
    case QUALIFIER_MINUS:
    case QUALIFIER_SPACE:
    case QUALIFIER_DOT:
    case QUALIFIER_STAR:
    case QUALIFIER_ALTERNATIVE:
    case QUALIFIER_SHORT:
    case QUALIFIER_LONG:
    case QUALIFIER_LONG_UPPER:
    case QUALIFIER_CIRCUMFLEX:
#if defined(QUALIFIER_SIZE_T)
    case QUALIFIER_SIZE_T:
#endif
#if defined(QUALIFIER_PTRDIFF_T)
    case QUALIFIER_PTRDIFF_T:
#endif
#if defined(QUALIFIER_INTMAX_T)
    case QUALIFIER_INTMAX_T:
#endif
#if defined(QUALIFIER_QUAD)
    case QUALIFIER_QUAD:
#endif
#if defined(QUALIFIER_SIZE_T_UPPER)
    case QUALIFIER_SIZE_T_UPPER:
#endif
#if defined(QUALIFIER_WIDECHAR)
    case QUALIFIER_WIDECHAR:
#endif
#if defined(QUALIFIER_QUOTE)
    case QUALIFIER_QUOTE:
#endif
#if defined(QUALIFIER_STICKY)
    case QUALIFIER_STICKY:
#endif
#if defined(QUALIFIER_VARSIZE)
    case QUALIFIER_VARSIZE:
#endif
#if defined(QUALIFIER_PARAM)
    case QUALIFIER_PARAM:
#endif
#if defined(QUALIFIER_FIXED_SIZE)
    case QUALIFIER_FIXED_SIZE:
#endif
#if defined(QUALIFIER_ROUNDING_UPPER)
    case QUALIFIER_ROUNDING_UPPER:
#endif
      return TRUE;
    default:
      return FALSE;
    }
}

/*************************************************************************
 * TrioSetLocale
 */
#if defined(USE_LOCALE)
TRIO_PRIVATE void
TrioSetLocale(TRIO_NOARGS)
{
  internalLocaleValues = (struct lconv *)localeconv();
  if (internalLocaleValues)
    {
      if ((internalLocaleValues->decimal_point) &&
	  (internalLocaleValues->decimal_point[0] != NIL))
	{
	  internalDecimalPointLength = trio_length(internalLocaleValues->decimal_point);
	  if (internalDecimalPointLength == 1)
	    {
	      internalDecimalPoint = internalLocaleValues->decimal_point[0];
	    }
	  else
	    {
	      internalDecimalPoint = NIL;
	      trio_copy_max(internalDecimalPointString,
			    sizeof(internalDecimalPointString),
			    internalLocaleValues->decimal_point);
	    }
	}
      if ((internalLocaleValues->thousands_sep) &&
	  (internalLocaleValues->thousands_sep[0] != NIL))
	{
	  trio_copy_max(internalThousandSeparator,
			sizeof(internalThousandSeparator),
			internalLocaleValues->thousands_sep);
	  internalThousandSeparatorLength = trio_length(internalThousandSeparator);
	}
      if ((internalLocaleValues->grouping) &&
	  (internalLocaleValues->grouping[0] != NIL))
	{
	  trio_copy_max(internalGrouping,
			sizeof(internalGrouping),
			internalLocaleValues->grouping);
	}
    }
}
#endif /* defined(USE_LOCALE) */

TRIO_PRIVATE int
TrioCalcThousandSeparatorLength
TRIO_ARGS1((digits),
	   int digits)
{
#if TRIO_EXTENSION
  int count = 0;
  int step = NO_GROUPING;
  char *groupingPointer = internalGrouping;

  while (digits > 0)
    {
      if (*groupingPointer == CHAR_MAX)
	{
	  /* Disable grouping */
	  break; /* while */
	}
      else if (*groupingPointer == 0)
	{
	  /* Repeat last group */
	  if (step == NO_GROUPING)
	    {
	      /* Error in locale */
	      break; /* while */
	    }
	}
      else
	{
	  step = *groupingPointer++;
	}
      if (digits > step)
	count += internalThousandSeparatorLength;
      digits -= step;
    }
  return count;
#else
  return 0;
#endif
}

TRIO_PRIVATE BOOLEAN_T
TrioFollowedBySeparator
TRIO_ARGS1((position),
	   int position)
{
#if TRIO_EXTENSION
  int step = 0;
  char *groupingPointer = internalGrouping;

  position--;
  if (position == 0)
    return FALSE;
  while (position > 0)
    {
      if (*groupingPointer == CHAR_MAX)
	{
	  /* Disable grouping */
	  break; /* while */
	}
      else if (*groupingPointer != 0)
	{
	  step = *groupingPointer++;
	}
      if (step == 0)
	break;
      position -= step;
    }
  return (position == 0);
#else
  return FALSE;
#endif
}

/*************************************************************************
 * TrioGetPosition
 *
 * Get the %n$ position.
 */
TRIO_PRIVATE int
TrioGetPosition
TRIO_ARGS2((format, indexPointer),
	   TRIO_CONST char *format,
	   int *indexPointer)
{
#if TRIO_UNIX98
  char *tmpformat;
  int number = 0;
  int index = *indexPointer;

  number = (int)trio_to_long(&format[index], &tmpformat, BASE_DECIMAL);
  index = (int)(tmpformat - format);
  if ((number != 0) && (QUALIFIER_POSITION == format[index++]))
    {
      *indexPointer = index;
      /*
       * number is decreased by 1, because n$ starts from 1, whereas
       * the array it is indexing starts from 0.
       */
      return number - 1;
    }
#endif
  return NO_POSITION;
}

#if TRIO_EXTENSION
/*************************************************************************
 * TrioFindNamespace
 *
 * Find registered user-defined specifier.
 * The prev argument is used for optimization only.
 */
TRIO_PRIVATE trio_userdef_t *
TrioFindNamespace
TRIO_ARGS2((name, prev),
	   TRIO_CONST char *name,
	   trio_userdef_t **prev)
{
  trio_userdef_t *def;
  
  if (internalEnterCriticalRegion)
    (void)internalEnterCriticalRegion(NULL);
  
  for (def = internalUserDef; def; def = def->next)
    {
      /* Case-sensitive string comparison */
      if (trio_equal_case(def->name, name))
	break;
      
      if (prev)
	*prev = def;
    }
  
  if (internalLeaveCriticalRegion)
    (void)internalLeaveCriticalRegion(NULL);
  
  return def;
}
#endif

/*************************************************************************
 * TrioPower
 *
 * Description:
 *  Calculate pow(base, exponent), where number and exponent are integers.
 */
TRIO_PRIVATE trio_long_double_t
TrioPower
TRIO_ARGS2((number, exponent),
	   int number,
	   int exponent)
{
  trio_long_double_t result;

  if (number == 10)
    {
      switch (exponent)
	{
	  /* Speed up calculation of common cases */
	case 0:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E-1);
	  break;
	case 1:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+0);
	  break;
	case 2:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+1);
	  break;
	case 3:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+2);
	  break;
	case 4:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+3);
	  break;
	case 5:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+4);
	  break;
	case 6:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+5);
	  break;
	case 7:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+6);
	  break;
	case 8:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+7);
	  break;
	case 9:
	  result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+8);
	  break;
	default:
	  result = powl((trio_long_double_t)number,
			(trio_long_double_t)exponent);
	  break;
	}
    }
  else
    {
      return powl((trio_long_double_t)number, (trio_long_double_t)exponent);
    }
  return result;
}

/*************************************************************************
 * TrioLogarithm
 */
TRIO_PRIVATE double
TrioLogarithm
TRIO_ARGS2((number, base),
	   double number,
	   int base)
{
  double result;

  if (number <= 0.0)
    {
      /* xlC crashes on log(0) */
      result = (number == 0.0) ? trio_ninf() : trio_nan();
    }
  else
    {
      if (base == 10)
	{
	  result = log10(number);
	}
      else
	{
	  result = log10(number) / log10((double)base);
	}
    }
  return result;
}

/*************************************************************************
 * TrioLogarithmBase
 */
TRIO_PRIVATE double
TrioLogarithmBase
TRIO_ARGS1((base),
	   int base)
{
  switch (base)
    {
    case BASE_BINARY : return 1.0;
    case BASE_OCTAL  : return 3.0;
    case BASE_DECIMAL: return 3.321928094887362345;
    case BASE_HEX    : return 4.0;
    default          : return TrioLogarithm((double)base, 2);
    }
}

/*************************************************************************
 * TrioParse
 *
 * Description:
 *  Parse the format string
 */
TRIO_PRIVATE int
TrioParse
TRIO_ARGS5((type, format, parameters, arglist, argarray),
	   int type,
	   TRIO_CONST char *format,
	   trio_parameter_t *parameters,
	   va_list *arglist,
	   trio_pointer_t *argarray)
{
  /* Count the number of times a parameter is referenced */
  unsigned short usedEntries[MAX_PARAMETERS];
  /* Parameter counters */
  int parameterPosition;
  int currentParam;
  int maxParam = -1;
  /* Utility variables */
  unsigned long flags;
  int width;
  int precision;
  int varsize;
  int base;
  int index;  /* Index into formatting string */
  int dots;  /* Count number of dots in modifier part */
  BOOLEAN_T positional;  /* Does the specifier have a positional? */
  BOOLEAN_T gotSticky = FALSE;  /* Are there any sticky modifiers at all? */
  /*
   * indices specifies the order in which the parameters must be
   * read from the va_args (this is necessary to handle positionals)
   */
  int indices[MAX_PARAMETERS];
  int pos = 0;
  /* Various variables */
  char ch;
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  int charlen;
#endif
  int save_errno;
  int i = -1;
  int num;
  char *tmpformat;

  /* One and only one of arglist and argarray must be used */
  assert((arglist != NULL) ^ (argarray != NULL));
  
  /*
   * The 'parameters' array is not initialized, but we need to
   * know which entries we have used.
   */
  memset(usedEntries, 0, sizeof(usedEntries));

  save_errno = errno;
  index = 0;
  parameterPosition = 0;
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  (void)mblen(NULL, 0);
#endif
  
  while (format[index])
    {
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
      if (! isascii(format[index]))
	{
	  /*
	   * Multibyte characters cannot be legal specifiers or
	   * modifiers, so we skip over them.
	   */
	  charlen = mblen(&format[index], MB_LEN_MAX);
	  index += (charlen > 0) ? charlen : 1;
	  continue; /* while */
	}
#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
      if (CHAR_IDENTIFIER == format[index++])
	{
	  if (CHAR_IDENTIFIER == format[index])
	    {
	      index++;
	      continue; /* while */
	    }

	  flags = FLAGS_NEW;
	  dots = 0;
	  currentParam = TrioGetPosition(format, &index);
	  positional = (NO_POSITION != currentParam);
	  if (!positional)
	    {
	      /* We have no positional, get the next counter */
	      currentParam = parameterPosition;
	    }
          if(currentParam >= MAX_PARAMETERS)
	    {
	      /* Bail out completely to make the error more obvious */
	      return TRIO_ERROR_RETURN(TRIO_ETOOMANY, index);
	    }

	  if (currentParam > maxParam)
	    maxParam = currentParam;

	  /* Default values */
	  width = NO_WIDTH;
	  precision = NO_PRECISION;
	  base = NO_BASE;
	  varsize = NO_SIZE;

	  while (TrioIsQualifier(format[index]))
	    {
	      ch = format[index++];

	      switch (ch)
		{
		case QUALIFIER_SPACE:
		  flags |= FLAGS_SPACE;
		  break;

		case QUALIFIER_PLUS:
		  flags |= FLAGS_SHOWSIGN;
		  break;

		case QUALIFIER_MINUS:
		  flags |= FLAGS_LEFTADJUST;
		  flags &= ~FLAGS_NILPADDING;
		  break;

		case QUALIFIER_ALTERNATIVE:
		  flags |= FLAGS_ALTERNATIVE;
		  break;

		case QUALIFIER_DOT:
		  if (dots == 0) /* Precision */
		    {
		      dots++;

		      /* Skip if no precision */
		      if (QUALIFIER_DOT == format[index])
			break;
		      
		      /* After the first dot we have the precision */
		      flags |= FLAGS_PRECISION;
		      if ((QUALIFIER_STAR == format[index])
#if defined(QUALIFIER_PARAM)
			  || (QUALIFIER_PARAM == format[index])
#endif
			  )
			{
			  index++;
			  flags |= FLAGS_PRECISION_PARAMETER;

			  precision = TrioGetPosition(format, &index);
			  if (precision == NO_POSITION)
			    {
			      parameterPosition++;
			      if (positional)
				precision = parameterPosition;
			      else
				{
				  precision = currentParam;
				  currentParam = precision + 1;
				}
			    }
			  else
			    {
			      if (! positional)
				currentParam = precision + 1;
			      if (width > maxParam)
				maxParam = precision;
			    }
			  if (currentParam > maxParam)
			    maxParam = currentParam;
			}
		      else
			{
			  precision = trio_to_long(&format[index],
						   &tmpformat,
						   BASE_DECIMAL);
			  index = (int)(tmpformat - format);
			}
		    }
		  else if (dots == 1) /* Base */
		    {
		      dots++;
		      
		      /* After the second dot we have the base */
		      flags |= FLAGS_BASE;
		      if ((QUALIFIER_STAR == format[index])
#if defined(QUALIFIER_PARAM)
			  || (QUALIFIER_PARAM == format[index])
#endif
			  )
			{
			  index++;
			  flags |= FLAGS_BASE_PARAMETER;
			  base = TrioGetPosition(format, &index);
			  if (base == NO_POSITION)
			    {
			      parameterPosition++;
			      if (positional)
				base = parameterPosition;
			      else
				{
				  base = currentParam;
				  currentParam = base + 1;
				}
			    }
			  else
			    {
			      if (! positional)
				currentParam = base + 1;
			      if (base > maxParam)
				maxParam = base;
			    }
			  if (currentParam > maxParam)
			    maxParam = currentParam;
			}
		      else
			{
			  base = trio_to_long(&format[index],
					      &tmpformat,
					      BASE_DECIMAL);
			  if (base > MAX_BASE)
			    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
			  index = (int)(tmpformat - format);
			}
		    }
		  else
		    {
		      return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
		    }
		  break; /* QUALIFIER_DOT */

#if defined(QUALIFIER_PARAM)
		case QUALIFIER_PARAM:
		  type = TYPE_PRINT;
		  /* FALLTHROUGH */
#endif
		case QUALIFIER_STAR:
		  /* This has different meanings for print and scan */
		  if (TYPE_PRINT == type)
		    {
		      /* Read with from parameter */
		      flags |= (FLAGS_WIDTH | FLAGS_WIDTH_PARAMETER);
		      width = TrioGetPosition(format, &index);
		      if (width == NO_POSITION)
			{
			  parameterPosition++;
			  if (positional)
			    width = parameterPosition;
			  else
			    {
			      width = currentParam;
			      currentParam = width + 1;
			    }
			}
		      else
			{
			  if (! positional)
			    currentParam = width + 1;
			  if (width > maxParam)
			    maxParam = width;
			}
		      if (currentParam > maxParam)
			maxParam = currentParam;
		    }
		  else
		    {
		      /* Scan, but do not store result */
		      flags |= FLAGS_IGNORE;
		    }

		  break; /* QUALIFIER_STAR */

		case '0':
		  if (! (flags & FLAGS_LEFTADJUST))
		    flags |= FLAGS_NILPADDING;
		  /* FALLTHROUGH */
		case '1': case '2': case '3': case '4':
		case '5': case '6': case '7': case '8': case '9':
		  flags |= FLAGS_WIDTH;
		  /* &format[index - 1] is used to "rewind" the read
		   * character from format
		   */
		  width = trio_to_long(&format[index - 1],
				       &tmpformat,
				       BASE_DECIMAL);
		  index = (int)(tmpformat - format);
		  break;

		case QUALIFIER_SHORT:
		  if (flags & FLAGS_SHORTSHORT)
		    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
		  else if (flags & FLAGS_SHORT)
		    flags |= FLAGS_SHORTSHORT;
		  else
		    flags |= FLAGS_SHORT;
		  break;

		case QUALIFIER_LONG:
		  if (flags & FLAGS_QUAD)
		    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
		  else if (flags & FLAGS_LONG)
		    flags |= FLAGS_QUAD;
		  else
		    flags |= FLAGS_LONG;
		  break;

		case QUALIFIER_LONG_UPPER:
		  flags |= FLAGS_LONGDOUBLE;
		  break;

#if defined(QUALIFIER_SIZE_T)
		case QUALIFIER_SIZE_T:
		  flags |= FLAGS_SIZE_T;
		  /* Modify flags for later truncation of number */
		  if (sizeof(size_t) == sizeof(trio_ulonglong_t))
		    flags |= FLAGS_QUAD;
		  else if (sizeof(size_t) == sizeof(long))
		    flags |= FLAGS_LONG;
		  break;
#endif

#if defined(QUALIFIER_PTRDIFF_T)
		case QUALIFIER_PTRDIFF_T:
		  flags |= FLAGS_PTRDIFF_T;
		  if (sizeof(ptrdiff_t) == sizeof(trio_ulonglong_t))
		    flags |= FLAGS_QUAD;
		  else if (sizeof(ptrdiff_t) == sizeof(long))
		    flags |= FLAGS_LONG;
		  break;
#endif

#if defined(QUALIFIER_INTMAX_T)
		case QUALIFIER_INTMAX_T:
		  flags |= FLAGS_INTMAX_T;
		  if (sizeof(trio_intmax_t) == sizeof(trio_ulonglong_t))
		    flags |= FLAGS_QUAD;
		  else if (sizeof(trio_intmax_t) == sizeof(long))
		    flags |= FLAGS_LONG;
		  break;
#endif

#if defined(QUALIFIER_QUAD)
		case QUALIFIER_QUAD:
		  flags |= FLAGS_QUAD;
		  break;
#endif

#if defined(QUALIFIER_FIXED_SIZE)
		case QUALIFIER_FIXED_SIZE:
		  if (flags & FLAGS_FIXED_SIZE)
		    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);

		  if (flags & (FLAGS_ALL_SIZES | FLAGS_LONGDOUBLE |
			       FLAGS_WIDECHAR | FLAGS_VARSIZE_PARAMETER))
		    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);

		  if ((format[index] == '6') &&
		      (format[index + 1] == '4'))
		    {
		      varsize = sizeof(trio_int64_t);
		      index += 2;
		    }
		  else if ((format[index] == '3') &&
			   (format[index + 1] == '2'))
		    {
		      varsize = sizeof(trio_int32_t);
		      index += 2;
		    }
		  else if ((format[index] == '1') &&
			   (format[index + 1] == '6'))
		    {
		      varsize = sizeof(trio_int16_t);
		      index += 2;
		    }
		  else if (format[index] == '8')
		    {
		      varsize = sizeof(trio_int8_t);
		      index++;
		    }
		  else
		    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
		  
		  flags |= FLAGS_FIXED_SIZE;
		  break;
#endif

#if defined(QUALIFIER_WIDECHAR)
		case QUALIFIER_WIDECHAR:
		  flags |= FLAGS_WIDECHAR;
		  break;
#endif

#if defined(QUALIFIER_SIZE_T_UPPER)
		case QUALIFIER_SIZE_T_UPPER:
		  break;
#endif

#if defined(QUALIFIER_QUOTE)
		case QUALIFIER_QUOTE:
		  flags |= FLAGS_QUOTE;
		  break;
#endif

#if defined(QUALIFIER_STICKY)
		case QUALIFIER_STICKY:
		  flags |= FLAGS_STICKY;
		  gotSticky = TRUE;
		  break;
#endif
		  
#if defined(QUALIFIER_VARSIZE)
		case QUALIFIER_VARSIZE:
		  flags |= FLAGS_VARSIZE_PARAMETER;
		  parameterPosition++;
		  if (positional)
		    varsize = parameterPosition;
		  else
		    {
		      varsize = currentParam;
		      currentParam = varsize + 1;
		    }
		  if (currentParam > maxParam)
		    maxParam = currentParam;
		  break;
#endif

#if defined(QUALIFIER_ROUNDING_UPPER)
		case QUALIFIER_ROUNDING_UPPER:
		  flags |= FLAGS_ROUNDING;
		  break;
#endif

		default:
		  /* Bail out completely to make the error more obvious */
                  return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
		}
	    } /* while qualifier */

	  /*
	   * Parameters only need the type and value. The value is
	   * read later.
	   */
	  if (flags & FLAGS_WIDTH_PARAMETER)
	    {
	      usedEntries[width] += 1;
	      parameters[pos].type = FORMAT_PARAMETER;
	      parameters[pos].flags = 0;
	      indices[width] = pos;
	      width = pos++;
	    }
	  if (flags & FLAGS_PRECISION_PARAMETER)
	    {
	      usedEntries[precision] += 1;
	      parameters[pos].type = FORMAT_PARAMETER;
	      parameters[pos].flags = 0;
	      indices[precision] = pos;
	      precision = pos++;
	    }
	  if (flags & FLAGS_BASE_PARAMETER)
	    {
	      usedEntries[base] += 1;
	      parameters[pos].type = FORMAT_PARAMETER;
	      parameters[pos].flags = 0;
	      indices[base] = pos;
	      base = pos++;
	    }
	  if (flags & FLAGS_VARSIZE_PARAMETER)
	    {
	      usedEntries[varsize] += 1;
	      parameters[pos].type = FORMAT_PARAMETER;
	      parameters[pos].flags = 0;
	      indices[varsize] = pos;
	      varsize = pos++;
	    }
	  
	  indices[currentParam] = pos;
	  
	  switch (format[index++])
	    {
#if defined(SPECIFIER_CHAR_UPPER)
	    case SPECIFIER_CHAR_UPPER:
	      flags |= FLAGS_WIDECHAR;
	      /* FALLTHROUGH */
#endif
	    case SPECIFIER_CHAR:
	      if (flags & FLAGS_LONG)
		flags |= FLAGS_WIDECHAR;
	      else if (flags & FLAGS_SHORT)
		flags &= ~FLAGS_WIDECHAR;
	      parameters[pos].type = FORMAT_CHAR;
	      break;

#if defined(SPECIFIER_STRING_UPPER)
	    case SPECIFIER_STRING_UPPER:
	      flags |= FLAGS_WIDECHAR;
	      /* FALLTHROUGH */
#endif
	    case SPECIFIER_STRING:
	      if (flags & FLAGS_LONG)
		flags |= FLAGS_WIDECHAR;
	      else if (flags & FLAGS_SHORT)
		flags &= ~FLAGS_WIDECHAR;
	      parameters[pos].type = FORMAT_STRING;
	      break;

	    case SPECIFIER_GROUP:
	      if (TYPE_SCAN == type)
		{
		  int depth = 1;
		  parameters[pos].type = FORMAT_GROUP;
		  if (format[index] == QUALIFIER_CIRCUMFLEX)
		    index++;
		  if (format[index] == SPECIFIER_UNGROUP)
		    index++;
		  if (format[index] == QUALIFIER_MINUS)
		    index++;
		  /* Skip nested brackets */
		  while (format[index] != NIL)
		    {
		      if (format[index] == SPECIFIER_GROUP)
			{
			  depth++;
			}
		      else if (format[index] == SPECIFIER_UNGROUP)
			{
			  if (--depth <= 0)
			    {
			      index++;
			      break;
			    }
			}
		      index++;
		    }
		}
	      break;
	      
	    case SPECIFIER_INTEGER:
	      parameters[pos].type = FORMAT_INT;
	      break;
	      
	    case SPECIFIER_UNSIGNED:
	      flags |= FLAGS_UNSIGNED;
	      parameters[pos].type = FORMAT_INT;
	      break;

	    case SPECIFIER_DECIMAL:
	      /* Disable base modifier */
	      flags &= ~FLAGS_BASE_PARAMETER;
	      base = BASE_DECIMAL;
	      parameters[pos].type = FORMAT_INT;
	      break;

	    case SPECIFIER_OCTAL:
	      flags &= ~FLAGS_BASE_PARAMETER;
	      base = BASE_OCTAL;
	      parameters[pos].type = FORMAT_INT;
	      break;

#if defined(SPECIFIER_BINARY)
	    case SPECIFIER_BINARY_UPPER:
	      flags |= FLAGS_UPPER;
	      /* FALLTHROUGH */
	    case SPECIFIER_BINARY:
	      flags |= FLAGS_NILPADDING;
	      flags &= ~FLAGS_BASE_PARAMETER;
	      base = BASE_BINARY;
	      parameters[pos].type = FORMAT_INT;
	      break;
#endif

	    case SPECIFIER_HEX_UPPER:
	      flags |= FLAGS_UPPER;
	      /* FALLTHROUGH */
	    case SPECIFIER_HEX:
	      flags |= FLAGS_UNSIGNED;
	      flags &= ~FLAGS_BASE_PARAMETER;
	      base = BASE_HEX;
	      parameters[pos].type = FORMAT_INT;
	      break;

	    case SPECIFIER_FLOAT_E_UPPER:
	      flags |= FLAGS_UPPER;
	      /* FALLTHROUGH */
	    case SPECIFIER_FLOAT_E:
	      flags |= FLAGS_FLOAT_E;
	      parameters[pos].type = FORMAT_DOUBLE;
	      break;

	    case SPECIFIER_FLOAT_G_UPPER:
	      flags |= FLAGS_UPPER;
	      /* FALLTHROUGH */
	    case SPECIFIER_FLOAT_G:
	      flags |= FLAGS_FLOAT_G;
	      parameters[pos].type = FORMAT_DOUBLE;
	      break;

	    case SPECIFIER_FLOAT_F_UPPER:
	      flags |= FLAGS_UPPER;
	      /* FALLTHROUGH */
	    case SPECIFIER_FLOAT_F:
	      parameters[pos].type = FORMAT_DOUBLE;
	      break;

	    case SPECIFIER_POINTER:
	      if (sizeof(trio_pointer_t) == sizeof(trio_ulonglong_t))
		flags |= FLAGS_QUAD;
	      else if (sizeof(trio_pointer_t) == sizeof(long))
		flags |= FLAGS_LONG;
	      parameters[pos].type = FORMAT_POINTER;
	      break;

	    case SPECIFIER_COUNT:
	      parameters[pos].type = FORMAT_COUNT;
	      break;

#if defined(SPECIFIER_HEXFLOAT)
# if defined(SPECIFIER_HEXFLOAT_UPPER)
	    case SPECIFIER_HEXFLOAT_UPPER:
	      flags |= FLAGS_UPPER;
	      /* FALLTHROUGH */
# endif
	    case SPECIFIER_HEXFLOAT:
	      base = BASE_HEX;
	      parameters[pos].type = FORMAT_DOUBLE;
	      break;
#endif

#if defined(FORMAT_ERRNO)
	    case SPECIFIER_ERRNO:
	      parameters[pos].type = FORMAT_ERRNO;
	      break;
#endif

#if defined(SPECIFIER_USER_DEFINED_BEGIN)
	    case SPECIFIER_USER_DEFINED_BEGIN:
	      {
		unsigned int max;
		int without_namespace = TRUE;
		
		parameters[pos].type = FORMAT_USER_DEFINED;
		parameters[pos].user_name[0] = NIL;
		tmpformat = (char *)&format[index];
	      
		while ((ch = format[index]))
		  {
		    index++;
		    if (ch == SPECIFIER_USER_DEFINED_END)
		      {
			if (without_namespace)
			  {
			    /* We must get the handle first */
			    parameters[pos].type = FORMAT_PARAMETER;
			    parameters[pos].indexAfterSpecifier = index;
			    parameters[pos].flags = FLAGS_USER_DEFINED;
			    /* Adjust parameters for insertion of new one */
			    pos++;
			    usedEntries[currentParam] += 1;
			    parameters[pos].type = FORMAT_USER_DEFINED;
			    currentParam++;
			    indices[currentParam] = pos;
			    if (currentParam > maxParam)
			      maxParam = currentParam;
			  }
			/* Copy the user data */
			max = (unsigned int)(&format[index] - tmpformat);
			if (max > MAX_USER_DATA)
			  max = MAX_USER_DATA;
			trio_copy_max(parameters[pos].user_data,
				      max,
				      tmpformat);
			break; /* while */
		      }
		    if (ch == SPECIFIER_USER_DEFINED_SEPARATOR)
		      {
			without_namespace = FALSE;
			/* Copy the namespace for later looking-up */
			max = (int)(&format[index] - tmpformat);
			if (max > MAX_USER_NAME)
			  max = MAX_USER_NAME;
			trio_copy_max(parameters[pos].user_name,
				      max,
				      tmpformat);
			tmpformat = (char *)&format[index];
		      }
		  }
		if (ch != SPECIFIER_USER_DEFINED_END)
		  return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
	      }
	      break;
#endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */
	      
	    default:
	      /* Bail out completely to make the error more obvious */
              return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
	    }

	  /*  Count the number of times this entry has been used */
	  usedEntries[currentParam] += 1;
	  
	  /* Find last sticky parameters */
	  if (gotSticky && !(flags & FLAGS_STICKY))
	    {
	      for (i = pos - 1; i >= 0; i--)
		{
		  if (parameters[i].type == FORMAT_PARAMETER)
		    continue;
		  if ((parameters[i].flags & FLAGS_STICKY) &&
		      (parameters[i].type == parameters[pos].type))
		    {
		      /* Do not overwrite current qualifiers */
		      flags |= (parameters[i].flags & (unsigned long)~FLAGS_STICKY);
		      if (width == NO_WIDTH)
			width = parameters[i].width;
		      if (precision == NO_PRECISION)
			precision = parameters[i].precision;
		      if (base == NO_BASE)
			base = parameters[i].base;
		      break;
		    }
		}
	    }
	  
	  parameters[pos].indexAfterSpecifier = index;
	  parameters[pos].flags = flags;
	  parameters[pos].width = width;
	  parameters[pos].precision = precision;
	  parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base;
	  parameters[pos].varsize = varsize;
	  pos++;
	  
	  if (! positional)
	    parameterPosition++;
	  
	} /* if identifier */
      
    } /* while format characters left */

  for (num = 0; num <= maxParam; num++)
    {
      if (usedEntries[num] != 1)
	{
	  if (usedEntries[num] == 0) /* gap detected */
	    return TRIO_ERROR_RETURN(TRIO_EGAP, num);
	  else /* double references detected */
	    return TRIO_ERROR_RETURN(TRIO_EDBLREF, num);
	}
      
      i = indices[num];

      /*
       * FORMAT_PARAMETERS are only present if they must be read,
       * so it makes no sense to check the ignore flag (besides,
       * the flags variable is not set for that particular type)
       */
      if ((parameters[i].type != FORMAT_PARAMETER) &&
	  (parameters[i].flags & FLAGS_IGNORE))
	continue; /* for all arguments */

      /*
       * The stack arguments are read according to ANSI C89
       * default argument promotions:
       *
       *  char           = int
       *  short          = int
       *  unsigned char  = unsigned int
       *  unsigned short = unsigned int
       *  float          = double
       *
       * In addition to the ANSI C89 these types are read (the
       * default argument promotions of C99 has not been
       * considered yet)
       *
       *  long long
       *  long double
       *  size_t
       *  ptrdiff_t
       *  intmax_t
       */
      switch (parameters[i].type)
	{
	case FORMAT_GROUP:
	case FORMAT_STRING:
#if TRIO_WIDECHAR
	  if (flags & FLAGS_WIDECHAR)
	    {
	      parameters[i].data.wstring = (argarray == NULL)
		? va_arg(*arglist, trio_wchar_t *)
		: (trio_wchar_t *)(argarray[num]);
	    }
	  else
#endif
	    {
	      parameters[i].data.string = (argarray == NULL)
		? va_arg(*arglist, char *)
		: (char *)(argarray[num]);
	    }
	  break;

#if defined(FORMAT_USER_DEFINED)
	case FORMAT_USER_DEFINED:
#endif
	case FORMAT_POINTER:
	case FORMAT_COUNT:
	case FORMAT_UNKNOWN:
	  parameters[i].data.pointer = (argarray == NULL)
	    ? va_arg(*arglist, trio_pointer_t )
	    : argarray[num];
	  break;

	case FORMAT_CHAR:
	case FORMAT_INT:
	  if (TYPE_SCAN == type)
	    {
              if (argarray == NULL)
                parameters[i].data.pointer = 
                  (trio_pointer_t)va_arg(*arglist, trio_pointer_t);
              else
                {
                  if (parameters[i].type == FORMAT_CHAR)
                    parameters[i].data.pointer =
                      (trio_pointer_t)((char *)argarray[num]);
                  else if (parameters[i].flags & FLAGS_SHORT)
                    parameters[i].data.pointer =
                      (trio_pointer_t)((short *)argarray[num]);
                  else
                    parameters[i].data.pointer =
                      (trio_pointer_t)((int *)argarray[num]);
                }
	    }
	  else
	    {
#if defined(QUALIFIER_VARSIZE) || defined(QUALIFIER_FIXED_SIZE)
	      if (parameters[i].flags
		  & (FLAGS_VARSIZE_PARAMETER | FLAGS_FIXED_SIZE))
		{
		  if (parameters[i].flags & FLAGS_VARSIZE_PARAMETER)
		    {
		      /*
		       * Variable sizes are mapped onto the fixed sizes, in
		       * accordance with integer promotion.
		       *
		       * Please note that this may not be portable, as we
		       * only guess the size, not the layout of the numbers.
		       * For example, if int is little-endian, and long is
		       * big-endian, then this will fail.
		       */
		      varsize = (int)parameters[parameters[i].varsize].data.number.as_unsigned;
		    }
		  else
		    {
		      /* Used for the I<bits> modifiers */
		      varsize = parameters[i].varsize;
		    }
		  parameters[i].flags &= ~FLAGS_ALL_VARSIZES;
		  
		  if (varsize <= (int)sizeof(int))
		    ;
		  else if (varsize <= (int)sizeof(long))
		    parameters[i].flags |= FLAGS_LONG;
#if defined(QUALIFIER_INTMAX_T)
		  else if (varsize <= (int)sizeof(trio_longlong_t))
		    parameters[i].flags |= FLAGS_QUAD;
		  else
		    parameters[i].flags |= FLAGS_INTMAX_T;
#else
		  else
		    parameters[i].flags |= FLAGS_QUAD;
#endif
		}
#endif /* defined(QUALIFIER_VARSIZE) */
#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
	      if (parameters[i].flags & FLAGS_SIZE_T)
		parameters[i].data.number.as_unsigned = (argarray == NULL)
		  ? (trio_uintmax_t)va_arg(*arglist, size_t)
		  : (trio_uintmax_t)(*((size_t *)argarray[num]));
	      else
#endif
#if defined(QUALIFIER_PTRDIFF_T)
	      if (parameters[i].flags & FLAGS_PTRDIFF_T)
		parameters[i].data.number.as_unsigned = (argarray == NULL)
		  ? (trio_uintmax_t)va_arg(*arglist, ptrdiff_t)
		  : (trio_uintmax_t)(*((ptrdiff_t *)argarray[num]));
	      else
#endif
#if defined(QUALIFIER_INTMAX_T)
	      if (parameters[i].flags & FLAGS_INTMAX_T)
		parameters[i].data.number.as_unsigned = (argarray == NULL)
		  ? (trio_uintmax_t)va_arg(*arglist, trio_intmax_t)
		  : (trio_uintmax_t)(*((trio_intmax_t *)argarray[num]));
	      else
#endif
	      if (parameters[i].flags & FLAGS_QUAD)
		parameters[i].data.number.as_unsigned = (argarray == NULL)
		  ? (trio_uintmax_t)va_arg(*arglist, trio_ulonglong_t)
		  : (trio_uintmax_t)(*((trio_ulonglong_t *)argarray[num]));
	      else if (parameters[i].flags & FLAGS_LONG)
		parameters[i].data.number.as_unsigned = (argarray == NULL)
		  ? (trio_uintmax_t)va_arg(*arglist, long)
		  : (trio_uintmax_t)(*((long *)argarray[num]));
	      else
		{
		  if (argarray == NULL)
		    parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(*arglist, int);
		  else
		    {
		      if (parameters[i].type == FORMAT_CHAR)
			parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((char *)argarray[num]));
		      else if (parameters[i].flags & FLAGS_SHORT)
			parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((short *)argarray[num]));
		      else
			parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((int *)argarray[num]));
		    }
		}
	    }
	  break;

	case FORMAT_PARAMETER:
	  /*
	   * The parameter for the user-defined specifier is a pointer,
	   * whereas the rest (width, precision, base) uses an integer.
	   */
	  if (parameters[i].flags & FLAGS_USER_DEFINED)
	    parameters[i].data.pointer = (argarray == NULL)
	      ? va_arg(*arglist, trio_pointer_t )
	      : argarray[num];
	  else
	    parameters[i].data.number.as_unsigned = (argarray == NULL)
	      ? (trio_uintmax_t)va_arg(*arglist, int)
	      : (trio_uintmax_t)(*((int *)argarray[num]));
	  break;

	case FORMAT_DOUBLE:
	  if (TYPE_SCAN == type)
	    {
	      if (parameters[i].flags & FLAGS_LONGDOUBLE)
		parameters[i].data.longdoublePointer = (argarray == NULL)
		  ? va_arg(*arglist, trio_long_double_t *)
		  : (trio_long_double_t *)argarray[num];
	      else
                {
		  if (parameters[i].flags & FLAGS_LONG)
		    parameters[i].data.doublePointer = (argarray == NULL)
		      ? va_arg(*arglist, double *)
		      : (double *)argarray[num];
		  else
		    parameters[i].data.doublePointer = (argarray == NULL)
		      ? (double *)va_arg(*arglist, float *)
		      : (double *)((float *)argarray[num]);
                }
	    }
	  else
	    {
	      if (parameters[i].flags & FLAGS_LONGDOUBLE)
		parameters[i].data.longdoubleNumber = (argarray == NULL)
		  ? va_arg(*arglist, trio_long_double_t)
		  : (trio_long_double_t)(*((trio_long_double_t *)argarray[num]));
	      else
		{
		  if (argarray == NULL)
		    parameters[i].data.longdoubleNumber =
		      (trio_long_double_t)va_arg(*arglist, double);
		  else
		    {
		      if (parameters[i].flags & FLAGS_SHORT)
			parameters[i].data.longdoubleNumber =
			  (trio_long_double_t)(*((float *)argarray[num]));
		      else
			parameters[i].data.longdoubleNumber =
			  (trio_long_double_t)(*((double *)argarray[num]));
		    }
		}
	    }
	  break;

#if defined(FORMAT_ERRNO)
	case FORMAT_ERRNO:
	  parameters[i].data.errorNumber = save_errno;
	  break;
#endif

	default:
	  break;
	}
    } /* for all specifiers */
  return num;
}


/*************************************************************************
 *
 * FORMATTING
 *
 ************************************************************************/


/*************************************************************************
 * TrioWriteNumber
 *
 * Description:
 *  Output a number.
 *  The complexity of this function is a result of the complexity
 *  of the dependencies of the flags.
 */
TRIO_PRIVATE void
TrioWriteNumber
TRIO_ARGS6((self, number, flags, width, precision, base),
	   trio_class_t *self,
	   trio_uintmax_t number,
	   unsigned long flags,
	   int width,
	   int precision,
	   int base)
{
  BOOLEAN_T isNegative;
  char buffer[MAX_CHARS_IN(trio_uintmax_t) * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1];
  char *bufferend;
  char *pointer;
  TRIO_CONST char *digits;
  int i;
  int length;
  char *p;
  int count;

  assert(VALID(self));
  assert(VALID(self->OutStream));
  assert(((base >= MIN_BASE) && (base <= MAX_BASE)) || (base == NO_BASE));

  digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower;
  if (base == NO_BASE)
    base = BASE_DECIMAL;

  isNegative = (flags & FLAGS_UNSIGNED)
    ? FALSE
    : ((trio_intmax_t)number < 0);
  if (isNegative)
    number = -((trio_intmax_t)number);

  if (flags & FLAGS_QUAD)
    number &= (trio_ulonglong_t)-1;
  else if (flags & FLAGS_LONG)
    number &= (unsigned long)-1;
  else
    number &= (unsigned int)-1;
  
  /* Build number */
  pointer = bufferend = &buffer[sizeof(buffer) - 1];
  *pointer-- = NIL;
  for (i = 1; i < (int)sizeof(buffer); i++)
    {
      *pointer-- = digits[number % base];
      number /= base;
      if (number == 0)
	break;

      if ((flags & FLAGS_QUOTE) && TrioFollowedBySeparator(i + 1))
	{
	  /*
	   * We are building the number from the least significant
	   * to the most significant digit, so we have to copy the
	   * thousand separator backwards
	   */
	  length = internalThousandSeparatorLength;
	  if (((int)(pointer - buffer) - length) > 0)
	    {
	      p = &internalThousandSeparator[length - 1];
	      while (length-- > 0)
		*pointer-- = *p--;
	    }
	}
    }

  /* Adjust width */
  width -= (bufferend - pointer) - 1;

  /* Adjust precision */
  if (NO_PRECISION != precision)
    {
      precision -= (bufferend - pointer) - 1;
      if (precision < 0)
	precision = 0;
      flags |= FLAGS_NILPADDING;
    }

  /* Adjust width further */
  if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE))
    width--;
  if (flags & FLAGS_ALTERNATIVE)
    {
      switch (base)
	{
	case BASE_BINARY:
	case BASE_HEX:
	  width -= 2;
	  break;
	case BASE_OCTAL:
	  width--;
	  break;
	default:
	  break;
	}
    }

  /* Output prefixes spaces if needed */
  if (! ((flags & FLAGS_LEFTADJUST) ||
	 ((flags & FLAGS_NILPADDING) && (precision == NO_PRECISION))))
    {
      count = (precision == NO_PRECISION) ? 0 : precision;
      while (width-- > count)
	self->OutStream(self, CHAR_ADJUST);
    }

  /* width has been adjusted for signs and alternatives */
  if (isNegative)
    self->OutStream(self, '-');
  else if (flags & FLAGS_SHOWSIGN)
    self->OutStream(self, '+');
  else if (flags & FLAGS_SPACE)
    self->OutStream(self, ' ');

  if (flags & FLAGS_ALTERNATIVE)
    {
      switch (base)
	{
	case BASE_BINARY:
	  self->OutStream(self, '0');
	  self->OutStream(self, (flags & FLAGS_UPPER) ? 'B' : 'b');
	  break;

	case BASE_OCTAL:
	  self->OutStream(self, '0');
	  break;

	case BASE_HEX:
	  self->OutStream(self, '0');
	  self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
	  break;

	default:
	  break;
	} /* switch base */
    }

  /* Output prefixed zero padding if needed */
  if (flags & FLAGS_NILPADDING)
    {
      if (precision == NO_PRECISION)
	precision = width;
      while (precision-- > 0)
	{
	  self->OutStream(self, '0');
	  width--;
	}
    }

  /* Output the number itself */
  while (*(++pointer))
    {
      self->OutStream(self, *pointer);
    }

  /* Output trailing spaces if needed */
  if (flags & FLAGS_LEFTADJUST)
    {
      while (width-- > 0)
	self->OutStream(self, CHAR_ADJUST);
    }
}

/*************************************************************************
 * TrioWriteStringCharacter
 *
 * Description:
 *  Output a single character of a string
 */
TRIO_PRIVATE void
TrioWriteStringCharacter
TRIO_ARGS3((self, ch, flags),
	   trio_class_t *self,
	   int ch,
	   unsigned long flags)
{
  if (flags & FLAGS_ALTERNATIVE)
    {
      if (! isprint(ch))
	{
	  /*
	   * Non-printable characters are converted to C escapes or
	   * \number, if no C escape exists.
	   */
	  self->OutStream(self, CHAR_BACKSLASH);
	  switch (ch)
	    {
	    case '\007': self->OutStream(self, 'a'); break;
	    case '\b': self->OutStream(self, 'b'); break;
	    case '\f': self->OutStream(self, 'f'); break;
	    case '\n': self->OutStream(self, 'n'); break;
	    case '\r': self->OutStream(self, 'r'); break;
	    case '\t': self->OutStream(self, 't'); break;
	    case '\v': self->OutStream(self, 'v'); break;
	    case '\\': self->OutStream(self, '\\'); break;
	    default:
	      self->OutStream(self, 'x');
	      TrioWriteNumber(self, (trio_uintmax_t)ch,
			      FLAGS_UNSIGNED | FLAGS_NILPADDING,
			      2, 2, BASE_HEX);
	      break;
	    }
	}
      else if (ch == CHAR_BACKSLASH)
	{
	  self->OutStream(self, CHAR_BACKSLASH);
	  self->OutStream(self, CHAR_BACKSLASH);
	}
      else
	{
	  self->OutStream(self, ch);
	}
    }
  else
    {
      self->OutStream(self, ch);
    }
}

/*************************************************************************
 * TrioWriteString
 *
 * Description:
 *  Output a string
 */
TRIO_PRIVATE void
TrioWriteString
TRIO_ARGS5((self, string, flags, width, precision),
	   trio_class_t *self,
	   TRIO_CONST char *string,
	   unsigned long flags,
	   int width,
	   int precision)
{
  int length;
  int ch;

  assert(VALID(self));
  assert(VALID(self->OutStream));

  if (string == NULL)
    {
      string = internalNullString;
      length = sizeof(internalNullString) - 1;
      /* Disable quoting for the null pointer */
      flags &= (~FLAGS_QUOTE);
      width = 0;
    }
  else
    {
      length = trio_length(string);
    }
  if ((NO_PRECISION != precision) &&
      (precision < length))
    {
      length = precision;
    }
  width -= length;

  if (flags & FLAGS_QUOTE)
    self->OutStream(self, CHAR_QUOTE);

  if (! (flags & FLAGS_LEFTADJUST))
    {
      while (width-- > 0)
	self->OutStream(self, CHAR_ADJUST);
    }

  while (length-- > 0)
    {
      /* The ctype parameters must be an unsigned char (or EOF) */
      ch = (int)((unsigned char)(*string++));
      TrioWriteStringCharacter(self, ch, flags);
    }

  if (flags & FLAGS_LEFTADJUST)
    {
      while (width-- > 0)
	self->OutStream(self, CHAR_ADJUST);
    }
  if (flags & FLAGS_QUOTE)
    self->OutStream(self, CHAR_QUOTE);
}

/*************************************************************************
 * TrioWriteWideStringCharacter
 *
 * Description:
 *  Output a wide string as a multi-byte sequence
 */
#if TRIO_WIDECHAR
TRIO_PRIVATE int
TrioWriteWideStringCharacter
TRIO_ARGS4((self, wch, flags, width),
	   trio_class_t *self,
	   trio_wchar_t wch,
	   unsigned long flags,
	   int width)
{
  int size;
  int i;
  int ch;
  char *string;
  char buffer[MB_LEN_MAX + 1];

  if (width == NO_WIDTH)
    width = sizeof(buffer);
  
  size = wctomb(buffer, wch);
  if ((size <= 0) || (size > width) || (buffer[0] == NIL))
    return 0;

  string = buffer;
  i = size;
  while ((width >= i) && (width-- > 0) && (i-- > 0))
    {
      /* The ctype parameters must be an unsigned char (or EOF) */
      ch = (int)((unsigned char)(*string++));
      TrioWriteStringCharacter(self, ch, flags);
    }
  return size;
}
#endif /* TRIO_WIDECHAR */

/*************************************************************************
 * TrioWriteWideString
 *
 * Description:
 *  Output a wide character string as a multi-byte string
 */
#if TRIO_WIDECHAR
TRIO_PRIVATE void
TrioWriteWideString
TRIO_ARGS5((self, wstring, flags, width, precision),
	   trio_class_t *self,
	   TRIO_CONST trio_wchar_t *wstring,
	   unsigned long flags,
	   int width,
	   int precision)
{
  int length;
  int size;

  assert(VALID(self));
  assert(VALID(self->OutStream));

#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  (void)mblen(NULL, 0);
#endif
  
  if (wstring == NULL)
    {
      TrioWriteString(self, NULL, flags, width, precision);
      return;
    }
  
  if (NO_PRECISION == precision)
    {
      length = INT_MAX;
    }
  else
    {
      length = precision;
      width -= length;
    }

  if (flags & FLAGS_QUOTE)
    self->OutStream(self, CHAR_QUOTE);

  if (! (flags & FLAGS_LEFTADJUST))
    {
      while (width-- > 0)
	self->OutStream(self, CHAR_ADJUST);
    }

  while (length > 0)
    {
      size = TrioWriteWideStringCharacter(self, *wstring++, flags, length);
      if (size == 0)
	break; /* while */
      length -= size;
    }

  if (flags & FLAGS_LEFTADJUST)
    {
      while (width-- > 0)
	self->OutStream(self, CHAR_ADJUST);
    }
  if (flags & FLAGS_QUOTE)
    self->OutStream(self, CHAR_QUOTE);
}
#endif /* TRIO_WIDECHAR */

/*************************************************************************
 * TrioWriteDouble
 *
 * http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_211.htm
 *
 * "5.2.4.2.2 paragraph #4
 *
 *  The accuracy [...] is implementation defined, as is the accuracy
 *  of the conversion between floating-point internal representations
 *  and string representations performed by the libray routine in
 *  <stdio.h>"
 */
/* FIXME: handle all instances of constant long-double number (L)
 *   and *l() math functions.
 */
TRIO_PRIVATE void
TrioWriteDouble
TRIO_ARGS6((self, number, flags, width, precision, base),
	   trio_class_t *self,
	   trio_long_double_t number,
	   unsigned long flags,
	   int width,
	   int precision,
	   int base)
{
  trio_long_double_t integerNumber;
  trio_long_double_t fractionNumber;
  trio_long_double_t workNumber;
  int integerDigits;
  int fractionDigits;
  int exponentDigits;
  int baseDigits;
  int integerThreshold;
  int fractionThreshold;
  int expectedWidth;
  int exponent = 0;
  unsigned int uExponent = 0;
  int exponentBase;
  trio_long_double_t dblBase;
  trio_long_double_t dblIntegerBase;
  trio_long_double_t dblFractionBase;
  trio_long_double_t integerAdjust;
  trio_long_double_t fractionAdjust;
  BOOLEAN_T isNegative;
  BOOLEAN_T isExponentNegative = FALSE;
  BOOLEAN_T requireTwoDigitExponent;
  BOOLEAN_T isHex;
  TRIO_CONST char *digits;
  char *groupingPointer;
  int i;
  int index;
  BOOLEAN_T hasOnlyZeroes;
  int zeroes = 0;
  register int trailingZeroes;
  BOOLEAN_T keepTrailingZeroes;
  BOOLEAN_T keepDecimalPoint;
  trio_long_double_t epsilon;
  
  assert(VALID(self));
  assert(VALID(self->OutStream));
  assert(((base >= MIN_BASE) && (base <= MAX_BASE)) || (base == NO_BASE));

  /* Determine sign and look for special quantities */
  switch (trio_fpclassify_and_signbit(number, &isNegative))
    {
    case TRIO_FP_NAN:
      TrioWriteString(self,
		      (flags & FLAGS_UPPER)
		      ? NAN_UPPER
		      : NAN_LOWER,
		      flags, width, precision);
      return;
      
    case TRIO_FP_INFINITE:
      if (isNegative)
	{
	  /* Negative infinity */
	  TrioWriteString(self,
			  (flags & FLAGS_UPPER)
			  ? "-" INFINITE_UPPER
			  : "-" INFINITE_LOWER,
			  flags, width, precision);
	  return;
	}
      else
	{
	  /* Positive infinity */
	  TrioWriteString(self,
			  (flags & FLAGS_UPPER)
			  ? INFINITE_UPPER
			  : INFINITE_LOWER,
			  flags, width, precision);
	  return;
	}

    default:
      /* Finitude */
      break;
    }
  
  /* Normal numbers */
  if (flags & FLAGS_LONGDOUBLE)
    {
      baseDigits = (base == 10)
	? LDBL_DIG
	: (int)floor(LDBL_MANT_DIG / TrioLogarithmBase(base));
      epsilon = LDBL_EPSILON;
    }
  else if (flags & FLAGS_SHORT)
    {
      baseDigits = (base == BASE_DECIMAL)
	? FLT_DIG
	: (int)floor(FLT_MANT_DIG / TrioLogarithmBase(base));
      epsilon = FLT_EPSILON;
    }
  else
    {
      baseDigits = (base == BASE_DECIMAL)
	? DBL_DIG
	: (int)floor(DBL_MANT_DIG / TrioLogarithmBase(base));
      epsilon = DBL_EPSILON;
    }

  digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower;
  isHex = (base == BASE_HEX);
  if (base == NO_BASE)
    base = BASE_DECIMAL;
  dblBase = (trio_long_double_t)base;
  keepTrailingZeroes = !( (flags & FLAGS_ROUNDING) ||
			  ( (flags & FLAGS_FLOAT_G) &&
			    !(flags & FLAGS_ALTERNATIVE) ) );

  if (flags & FLAGS_ROUNDING)
    precision = baseDigits;
  
  if (precision == NO_PRECISION)
    precision = FLT_DIG;
  
  if (isNegative)
    number = -number;

  if (isHex)
    flags |= FLAGS_FLOAT_E;
  
  if (flags & FLAGS_FLOAT_G)
    {
      if (precision == 0)
	precision = 1;

      if ((number < 1.0E-4) || (number > powl(base,
					      (trio_long_double_t)precision)))
	{
	  /* Use scientific notation */
	  flags |= FLAGS_FLOAT_E;
	}
      else if (number < 1.0)
	{
	  /*
	   * Use normal notation. If the integer part of the number is
	   * zero, then adjust the precision to include leading fractional
	   * zeros.
	   */
	  workNumber = TrioLogarithm(number, base);
	  workNumber = TRIO_FABS(workNumber);
	  if (workNumber - floorl(workNumber) < 0.001)
	    workNumber--;
	  zeroes = (int)floorl(workNumber);
	}
    }

  if (flags & FLAGS_FLOAT_E)
    {
      /* Scale the number */
      workNumber = TrioLogarithm(number, base);
      if (trio_isinf(workNumber) == -1)
	{
	  exponent = 0;
	  /* Undo setting */
	  if (flags & FLAGS_FLOAT_G)
	    flags &= ~FLAGS_FLOAT_E;
	}
      else
	{
	  exponent = (int)floorl(workNumber);
	  number /= powl(dblBase, (trio_long_double_t)exponent);
	  isExponentNegative = (exponent < 0);
	  uExponent = (isExponentNegative) ? -exponent : exponent;
	  /* No thousand separators */
	  flags &= ~FLAGS_QUOTE;
	}
    }

  integerNumber = floorl(number);
  fractionNumber = number - integerNumber;
  
  /*
   * Truncated number.
   *
   * Precision is number of significant digits for FLOAT_G
   * and number of fractional digits for others.
   */
  integerDigits = (integerNumber > epsilon)
    ? 1 + (int)TrioLogarithm(integerNumber, base)
    : 1;
  fractionDigits = ((flags & FLAGS_FLOAT_G) && (zeroes == 0))
    ? precision - integerDigits
    : zeroes + precision;

  dblFractionBase = TrioPower(base, fractionDigits);
  
  workNumber = number + 0.5 / dblFractionBase;
  if (floorl(number) != floorl(workNumber))
    {
      if (flags & FLAGS_FLOAT_E)
	{
	  /* Adjust if number was rounded up one digit (ie. 0.99 to 1.00) */
	  exponent++;
	  isExponentNegative = (exponent < 0);
	  uExponent = (isExponentNegative) ? -exponent : exponent;
	  workNumber = (number + 0.5 / dblFractionBase) / dblBase;
	  integerNumber = floorl(workNumber);
	  fractionNumber = workNumber - integerNumber;
	}
      else
	{
	  /* Adjust if number was rounded up one digit (ie. 99 to 100) */
	  integerNumber = floorl(number + 0.5);
	  fractionNumber = 0.0;
	  integerDigits = (integerNumber > epsilon)
	    ? 1 + (int)TrioLogarithm(integerNumber, base)
	    : 1;
	}
    }

  /* Estimate accuracy */
  integerAdjust = fractionAdjust = 0.5;
  if (flags & FLAGS_ROUNDING)
    {
      if (integerDigits > baseDigits)
	{
	  integerThreshold = baseDigits;
	  fractionDigits = 0;
	  dblFractionBase = 1.0;
	  fractionThreshold = 0;
	  precision = 0; /* Disable decimal-point */
	  integerAdjust = TrioPower(base, integerDigits - integerThreshold - 1);
	  fractionAdjust = 0.0;
	}
      else
	{
	  integerThreshold = integerDigits;
	  fractionThreshold = fractionDigits - integerThreshold;
	  fractionAdjust = 1.0;
	}
    }
  else
    {
      integerThreshold = INT_MAX;
      fractionThreshold = INT_MAX;
    }
  
  /*
   * Calculate expected width.
   *  sign + integer part + thousands separators + decimal point
   *  + fraction + exponent
   */
  fractionAdjust /= dblFractionBase;
  hasOnlyZeroes = (floorl((fractionNumber + fractionAdjust) * dblFractionBase) < epsilon);
  keepDecimalPoint = ( (flags & FLAGS_ALTERNATIVE) ||
		       !((precision == 0) ||
			 (!keepTrailingZeroes && hasOnlyZeroes)) );
  if (flags & FLAGS_FLOAT_E)
    {
      exponentDigits = (uExponent == 0)
	? 1
	: (int)ceil(TrioLogarithm((double)(uExponent + 1), base));
    }
  else
    exponentDigits = 0;
  requireTwoDigitExponent = ((base == BASE_DECIMAL) && (exponentDigits == 1));

  expectedWidth = integerDigits + fractionDigits
    + (keepDecimalPoint
       ? internalDecimalPointLength
       : 0)
    + ((flags & FLAGS_QUOTE)
       ? TrioCalcThousandSeparatorLength(integerDigits)
       : 0);
  if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE))
    expectedWidth += sizeof("-") - 1;
  if (exponentDigits > 0)
    expectedWidth += exponentDigits +
      ((requireTwoDigitExponent ? sizeof("E+0") : sizeof("E+")) - 1);
  if (isHex)
    expectedWidth += sizeof("0X") - 1;
  
  /* Output prefixing */
  if (flags & FLAGS_NILPADDING)
    {
      /* Leading zeros must be after sign */
      if (isNegative)
	self->OutStream(self, '-');
      else if (flags & FLAGS_SHOWSIGN)
	self->OutStream(self, '+');
      else if (flags & FLAGS_SPACE)
	self->OutStream(self, ' ');
      if (isHex)
	{
	  self->OutStream(self, '0');
	  self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
	}
      if (!(flags & FLAGS_LEFTADJUST))
	{
	  for (i = expectedWidth; i < width; i++)
	    {
	      self->OutStream(self, '0');
	    }
	}
    }
  else
    {
      /* Leading spaces must be before sign */
      if (!(flags & FLAGS_LEFTADJUST))
	{
	  for (i = expectedWidth; i < width; i++)
	    {
	      self->OutStream(self, CHAR_ADJUST);
	    }
	}
      if (isNegative)
	self->OutStream(self, '-');
      else if (flags & FLAGS_SHOWSIGN)
	self->OutStream(self, '+');
      else if (flags & FLAGS_SPACE)
	self->OutStream(self, ' ');
      if (isHex)
	{
	  self->OutStream(self, '0');
	  self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
	}
    }
  
  /* Output the integer part and thousand separators */
  dblIntegerBase = 1.0 / TrioPower(base, integerDigits - 1);
  for (i = 0; i < integerDigits; i++)
    {
      workNumber = floorl(((integerNumber + integerAdjust) * dblIntegerBase));
      if (i > integerThreshold)
	{
	  /* Beyond accuracy */
	  self->OutStream(self, digits[0]);
	}
      else
	{
	  self->OutStream(self, digits[(int)fmodl(workNumber, dblBase)]);
	}
      dblIntegerBase *= dblBase;
      
      if (((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE)
	  && TrioFollowedBySeparator(integerDigits - i))
	{
	  for (groupingPointer = internalThousandSeparator;
	       *groupingPointer != NIL;
	       groupingPointer++)
	    {
	      self->OutStream(self, *groupingPointer);
	    }
	}
    }
  
  /* Insert decimal point and build the fraction part */
  trailingZeroes = 0;

  if (keepDecimalPoint)
    {
      if (internalDecimalPoint)
	{
	  self->OutStream(self, internalDecimalPoint);
	}
      else
	{
	  for (i = 0; i < internalDecimalPointLength; i++)
	    {
	      self->OutStream(self, internalDecimalPointString[i]);
	    }
	}
    }

  for (i = 0; i < fractionDigits; i++)
    {
      if ((integerDigits > integerThreshold) || (i > fractionThreshold))
	{
	  /* Beyond accuracy */
	  trailingZeroes++;
	}
      else
	{
	  fractionNumber *= dblBase;
	  fractionAdjust *= dblBase;
	  workNumber = floorl(fractionNumber + fractionAdjust);
	  fractionNumber -= workNumber;
	  index = (int)fmodl(workNumber, dblBase);
	  if (index == 0)
	    {
	      trailingZeroes++;
	    }
	  else
	    {
	      while (trailingZeroes > 0)
		{
		  /* Not trailing zeroes after all */
		  self->OutStream(self, digits[0]);
		  trailingZeroes--;
		}
	      self->OutStream(self, digits[index]);
	    }
	}
    }
  
  if (keepTrailingZeroes)
    {
      while (trailingZeroes > 0)
	{
	  self->OutStream(self, digits[0]);
	  trailingZeroes--;
	}
    }
  
  /* Output exponent */
  if (exponentDigits > 0)
    {
      self->OutStream(self,
		      isHex
		      ? ((flags & FLAGS_UPPER) ? 'P' : 'p')
		      : ((flags & FLAGS_UPPER) ? 'E' : 'e'));
      self->OutStream(self, (isExponentNegative) ? '-' : '+');

      /* The exponent must contain at least two digits */
      if (requireTwoDigitExponent)
        self->OutStream(self, '0');

      exponentBase = (int)TrioPower(base, exponentDigits - 1);
      for (i = 0; i < exponentDigits; i++)
	{
	  self->OutStream(self, digits[(uExponent / exponentBase) % base]);
	  exponentBase /= base;
	}
    }
  /* Output trailing spaces */
  if (flags & FLAGS_LEFTADJUST)
    {
      for (i = expectedWidth; i < width; i++)
	{
	  self->OutStream(self, CHAR_ADJUST);
	}
    }
}

/*************************************************************************
 * TrioFormatProcess
 *
 * Description:
 *  This is the main engine for formatting output
 */
TRIO_PRIVATE int
TrioFormatProcess
TRIO_ARGS3((data, format, parameters),
	   trio_class_t *data,
	   TRIO_CONST char *format,
	   trio_parameter_t *parameters)
{
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  int charlen;
#endif
  int i;
  TRIO_CONST char *string;
  trio_pointer_t pointer;
  unsigned long flags;
  int width;
  int precision;
  int base;
  int index;
  
  index = 0;
  i = 0;
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  (void)mblen(NULL, 0);
#endif
  
  while (format[index])
    {
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
      if (! isascii(format[index]))
	{
	  charlen = mblen(&format[index], MB_LEN_MAX);
	  /*
	   * Only valid multibyte characters are handled here. Invalid
	   * multibyte characters (charlen == -1) are handled as normal
	   * characters.
	   */
	  if (charlen != -1)
	    {
	      while (charlen-- > 0)
		{
		  data->OutStream(data, format[index++]);
		}
	      continue; /* while characters left in formatting string */
	    }
	}
#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
      if (CHAR_IDENTIFIER == format[index])
	{
	  if (CHAR_IDENTIFIER == format[index + 1])
	    {
	      data->OutStream(data, CHAR_IDENTIFIER);
	      index += 2;
	    }
	  else
	    {
	      /* Skip the parameter entries */
	      while (parameters[i].type == FORMAT_PARAMETER)
		i++;
	      
	      flags = parameters[i].flags;

	      /* Find width */
	      width = parameters[i].width;
	      if (flags & FLAGS_WIDTH_PARAMETER)
		{
		  /* Get width from parameter list */
		  width = (int)parameters[width].data.number.as_signed;
		}
	      
	      /* Find precision */
	      if (flags & FLAGS_PRECISION)
		{
		  precision = parameters[i].precision;
		  if (flags & FLAGS_PRECISION_PARAMETER)
		    {
		      /* Get precision from parameter list */
		      precision = (int)parameters[precision].data.number.as_signed;
		    }
		}
	      else
		{
		  precision = NO_PRECISION;
		}

	      /* Find base */
	      base = parameters[i].base;
	      if (flags & FLAGS_BASE_PARAMETER)
		{
		  /* Get base from parameter list */
		  base = (int)parameters[base].data.number.as_signed;
		}
	      
	      switch (parameters[i].type)
		{
		case FORMAT_CHAR:
		  if (flags & FLAGS_QUOTE)
		    data->OutStream(data, CHAR_QUOTE);
		  if (! (flags & FLAGS_LEFTADJUST))
		    {
		      while (--width > 0)
			data->OutStream(data, CHAR_ADJUST);
		    }
#if TRIO_WIDECHAR
		  if (flags & FLAGS_WIDECHAR)
		    {
		      TrioWriteWideStringCharacter(data,
						   (trio_wchar_t)parameters[i].data.number.as_signed,
						   flags,
						   NO_WIDTH);
		    }
		  else
#endif
		    {
		      TrioWriteStringCharacter(data,
					       (int)parameters[i].data.number.as_signed,
					       flags);
		    }

		  if (flags & FLAGS_LEFTADJUST)
		    {
		      while(--width > 0)
			data->OutStream(data, CHAR_ADJUST);
		    }
		  if (flags & FLAGS_QUOTE)
		    data->OutStream(data, CHAR_QUOTE);

		  break; /* FORMAT_CHAR */

		case FORMAT_INT:
		  TrioWriteNumber(data,
				  parameters[i].data.number.as_unsigned,
				  flags,
				  width,
				  precision,
				  base);

		  break; /* FORMAT_INT */

		case FORMAT_DOUBLE:
		  TrioWriteDouble(data,
				  parameters[i].data.longdoubleNumber,
				  flags,
				  width,
				  precision,
				  base);
		  break; /* FORMAT_DOUBLE */

		case FORMAT_STRING:
#if TRIO_WIDECHAR
		  if (flags & FLAGS_WIDECHAR)
		    {
		      TrioWriteWideString(data,
					  parameters[i].data.wstring,
					  flags,
					  width,
					  precision);
		    }
		  else
#endif
		    {
		      TrioWriteString(data,
				      parameters[i].data.string,
				      flags,
				      width,
				      precision);
		    }
		  break; /* FORMAT_STRING */

		case FORMAT_POINTER:
		  {
		    trio_reference_t reference;
		    
		    reference.data = data;
		    reference.parameter = &parameters[i];
		    trio_print_pointer(&reference, parameters[i].data.pointer);
		  }
		  break; /* FORMAT_POINTER */

		case FORMAT_COUNT:
		  pointer = parameters[i].data.pointer;
		  if (NULL != pointer)
		    {
		      /*
		       * C99 paragraph 7.19.6.1.8 says "the number of
		       * characters written to the output stream so far by
		       * this call", which is data->committed
		       */
#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
		      if (flags & FLAGS_SIZE_T)
			*(size_t *)pointer = (size_t)data->committed;
		      else
#endif
#if defined(QUALIFIER_PTRDIFF_T)
		      if (flags & FLAGS_PTRDIFF_T)
			*(ptrdiff_t *)pointer = (ptrdiff_t)data->committed;
		      else
#endif
#if defined(QUALIFIER_INTMAX_T)
		      if (flags & FLAGS_INTMAX_T)
			*(trio_intmax_t *)pointer = (trio_intmax_t)data->committed;
		      else
#endif
		      if (flags & FLAGS_QUAD)
			{
			  *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed;
			}
		      else if (flags & FLAGS_LONG)
			{
			  *(long int *)pointer = (long int)data->committed;
			}
		      else if (flags & FLAGS_SHORT)
			{
			  *(short int *)pointer = (short int)data->committed;
			}
		      else
			{
			  *(int *)pointer = (int)data->committed;
			}
		    }
		  break; /* FORMAT_COUNT */

		case FORMAT_PARAMETER:
		  break; /* FORMAT_PARAMETER */

#if defined(FORMAT_ERRNO)
		case FORMAT_ERRNO:
		  string = trio_error(parameters[i].data.errorNumber);
		  if (string)
		    {
		      TrioWriteString(data,
				      string,
				      flags,
				      width,
				      precision);
		    }
		  else
		    {
		      data->OutStream(data, '#');
		      TrioWriteNumber(data,
				      (trio_uintmax_t)parameters[i].data.errorNumber,
				      flags,
				      width,
				      precision,
				      BASE_DECIMAL);
		    }
		  break; /* FORMAT_ERRNO */
#endif /* defined(FORMAT_ERRNO) */

#if defined(FORMAT_USER_DEFINED)
		case FORMAT_USER_DEFINED:
		  {
		    trio_reference_t reference;
		    trio_userdef_t *def = NULL;

		    if (parameters[i].user_name[0] == NIL)
		      {
			/* Use handle */
			if ((i > 0) ||
			    (parameters[i - 1].type == FORMAT_PARAMETER))
			  def = (trio_userdef_t *)parameters[i - 1].data.pointer;
		      }
		    else
		      {
			/* Look up namespace */
			def = TrioFindNamespace(parameters[i].user_name, NULL);
		      }
		    if (def) {
		      reference.data = data;
		      reference.parameter = &parameters[i];
		      def->callback(&reference);
		    }
		  }
		  break;
#endif /* defined(FORMAT_USER_DEFINED) */
		  
		default:
		  break;
		} /* switch parameter type */

	      /* Prepare for next */
	      index = parameters[i].indexAfterSpecifier;
	      i++;
	    }
	}
      else /* not identifier */
	{
	  data->OutStream(data, format[index++]);
	}
    }
  return data->processed;
}

/*************************************************************************
 * TrioFormatRef
 */
TRIO_PRIVATE int
TrioFormatRef
TRIO_ARGS4((reference, format, arglist, argarray),
	   trio_reference_t *reference,
	   TRIO_CONST char *format,
	   va_list *arglist,
	   trio_pointer_t *argarray)
{
  int status;
  trio_parameter_t parameters[MAX_PARAMETERS];

  status = TrioParse(TYPE_PRINT, format, parameters, arglist, argarray);
  if (status < 0)
    return status;

  status = TrioFormatProcess(reference->data, format, parameters);
  if (reference->data->error != 0)
    {
      status = reference->data->error;
    }
  return status;
}

/*************************************************************************
 * TrioFormat
 */
TRIO_PRIVATE int
TrioFormat
TRIO_ARGS6((destination, destinationSize, OutStream, format, arglist, argarray),
	   trio_pointer_t destination,
	   size_t destinationSize,
	   void (*OutStream) TRIO_PROTO((trio_class_t *, int)),
	   TRIO_CONST char *format,
	   va_list *arglist,
	   trio_pointer_t *argarray)
{
  int status;
  trio_class_t data;
  trio_parameter_t parameters[MAX_PARAMETERS];

  assert(VALID(OutStream));
  assert(VALID(format));

  memset(&data, 0, sizeof(data));
  data.OutStream = OutStream;
  data.location = destination;
  data.max = destinationSize;
  data.error = 0;

#if defined(USE_LOCALE)
  if (NULL == internalLocaleValues)
    {
      TrioSetLocale();
    }
#endif

  status = TrioParse(TYPE_PRINT, format, parameters, arglist, argarray);
  if (status < 0)
    return status;

  status = TrioFormatProcess(&data, format, parameters);
  if (data.error != 0)
    {
      status = data.error;
    }
  return status;
}

/*************************************************************************
 * TrioOutStreamFile
 */
TRIO_PRIVATE void
TrioOutStreamFile
TRIO_ARGS2((self, output),
	   trio_class_t *self,
	   int output)
{
  FILE *file;

  assert(VALID(self));
  assert(VALID(self->location));

  file = (FILE *)self->location;
  self->processed++;
  if (fputc(output, file) == EOF)
    {
      self->error = TRIO_ERROR_RETURN(TRIO_EOF, 0);
    }
  else
    {
      self->committed++;
    }
}

/*************************************************************************
 * TrioOutStreamFileDescriptor
 */
TRIO_PRIVATE void
TrioOutStreamFileDescriptor
TRIO_ARGS2((self, output),
	   trio_class_t *self,
	   int output)
{
  int fd;
  char ch;

  assert(VALID(self));

  fd = *((int *)self->location);
  ch = (char)output;
  self->processed++;
  if (write(fd, &ch, sizeof(char)) == -1)
    {
      self->error = TRIO_ERROR_RETURN(TRIO_ERRNO, 0);
    }
  else
    {
      self->committed++;
    }
}

/*************************************************************************
 * TrioOutStreamCustom
 */
TRIO_PRIVATE void
TrioOutStreamCustom
TRIO_ARGS2((self, output),
	   trio_class_t *self,
	   int output)
{
  int status;
  trio_custom_t *data;

  assert(VALID(self));
  assert(VALID(self->location));

  data = (trio_custom_t *)self->location;
  if (data->stream.out)
    {
      status = (data->stream.out)(data->closure, output);
      if (status >= 0)
	{
	  self->committed++;
	}
      else
	{
	  if (self->error == 0)
	    {
	      self->error = TRIO_ERROR_RETURN(TRIO_ECUSTOM, -status);
	    }
	}
    }
  self->processed++;
}

/*************************************************************************
 * TrioOutStreamString
 */
TRIO_PRIVATE void
TrioOutStreamString
TRIO_ARGS2((self, output),
	   trio_class_t *self,
	   int output)
{
  char **buffer;

  assert(VALID(self));
  assert(VALID(self->location));

  buffer = (char **)self->location;
  **buffer = (char)output;
  (*buffer)++;
  self->processed++;
  self->committed++;
}

/*************************************************************************
 * TrioOutStreamStringMax
 */
TRIO_PRIVATE void
TrioOutStreamStringMax
TRIO_ARGS2((self, output),
	   trio_class_t *self,
	   int output)
{
  char **buffer;

  assert(VALID(self));
  assert(VALID(self->location));
  
  buffer = (char **)self->location;

  if (self->processed < self->max)
    {
      **buffer = (char)output;
      (*buffer)++;
      self->committed++;
    }
  self->processed++;
}

/*************************************************************************
 * TrioOutStreamStringDynamic
 */
TRIO_PRIVATE void
TrioOutStreamStringDynamic
TRIO_ARGS2((self, output),
	   trio_class_t *self,
	   int output)
{
  assert(VALID(self));
  assert(VALID(self->location));

  if (self->error == 0)
    {
      trio_xstring_append_char((trio_string_t *)self->location,
			       (char)output);
      self->committed++;
    }
  /* The processed variable must always be increased */
  self->processed++;
}

/*************************************************************************
 *
 * Formatted printing functions
 *
 ************************************************************************/

#if defined(TRIO_DOCUMENTATION)
# include "doc/doc_printf.h"
#endif
/** @addtogroup Printf
    @{
*/

/*************************************************************************
 * printf
 */

/**
   Print to standard output stream.

   @param format Formatting string.
   @param ... Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_printf
TRIO_VARGS2((format, va_alist),
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

/**
   Print to standard output stream.

   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_vprintf
TRIO_ARGS2((format, args),
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(format));

  return TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL);
}

/**
   Print to standard output stream.

   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_printfv
TRIO_ARGS2((format, args),
	   TRIO_CONST char *format,
	   trio_pointer_t * args)
{
  assert(VALID(format));

  return TrioFormat(stdout, 0, TrioOutStreamFile, format, NULL, args);
}

/*************************************************************************
 * fprintf
 */

/**
   Print to file.

   @param file File pointer.
   @param format Formatting string.
   @param ... Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_fprintf
TRIO_VARGS3((file, format, va_alist),
	    FILE *file,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(file));
  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

/**
   Print to file.

   @param file File pointer.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_vfprintf
TRIO_ARGS3((file, format, args),
	   FILE *file,
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(file));
  assert(VALID(format));
  
  return TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL);
}

/**
   Print to file.

   @param file File pointer.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_fprintfv
TRIO_ARGS3((file, format, args),
	   FILE *file,
	   TRIO_CONST char *format,
	   trio_pointer_t * args)
{
  assert(VALID(file));
  assert(VALID(format));
  
  return TrioFormat(file, 0, TrioOutStreamFile, format, NULL, args);
}

/*************************************************************************
 * dprintf
 */

/**
   Print to file descriptor.

   @param fd File descriptor.
   @param format Formatting string.
   @param ... Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_dprintf
TRIO_VARGS3((fd, format, va_alist),
	    int fd,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

/**
   Print to file descriptor.

   @param fd File descriptor.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_vdprintf
TRIO_ARGS3((fd, format, args),
	   int fd,
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(format));
  
  return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL);
}

/**
   Print to file descriptor.

   @param fd File descriptor.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_dprintfv
TRIO_ARGS3((fd, format, args),
	   int fd,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  assert(VALID(format));
  
  return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, NULL, args);
}

/*************************************************************************
 * cprintf
 */
TRIO_PUBLIC int
trio_cprintf
TRIO_VARGS4((stream, closure, format, va_alist),
	    trio_outstream_t stream,
	    trio_pointer_t closure,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;
  trio_custom_t data;

  assert(VALID(stream));
  assert(VALID(format));

  TRIO_VA_START(args, format);
  data.stream.out = stream;
  data.closure = closure;
  status = TrioFormat(&data, 0, TrioOutStreamCustom, format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

TRIO_PUBLIC int
trio_vcprintf
TRIO_ARGS4((stream, closure, format, args),
	   trio_outstream_t stream,
	   trio_pointer_t closure,
	   TRIO_CONST char *format,
	   va_list args)
{
  trio_custom_t data;

  assert(VALID(stream));
  assert(VALID(format));

  data.stream.out = stream;
  data.closure = closure;
  return TrioFormat(&data, 0, TrioOutStreamCustom, format, &args, NULL);
}

TRIO_PUBLIC int
trio_cprintfv
TRIO_ARGS4((stream, closure, format, args),
	   trio_outstream_t stream,
	   trio_pointer_t closure,
	   TRIO_CONST char *format,
	   void **args)
{
  trio_custom_t data;

  assert(VALID(stream));
  assert(VALID(format));

  data.stream.out = stream;
  data.closure = closure;
  return TrioFormat(&data, 0, TrioOutStreamCustom, format, NULL, args);
}

/*************************************************************************
 * sprintf
 */

/**
   Print to string.

   @param buffer Output string.
   @param format Formatting string.
   @param ... Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_sprintf
TRIO_VARGS3((buffer, format, va_alist),
	    char *buffer,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(buffer));
  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL);
  *buffer = NIL; /* Terminate with NIL character */
  TRIO_VA_END(args);
  return status;
}

/**
   Print to string.

   @param buffer Output string.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_vsprintf
TRIO_ARGS3((buffer, format, args),
	   char *buffer,
	   TRIO_CONST char *format,
	   va_list args)
{
  int status;

  assert(VALID(buffer));
  assert(VALID(format));

  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL);
  *buffer = NIL;
  return status;
}

/**
   Print to string.

   @param buffer Output string.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_sprintfv
TRIO_ARGS3((buffer, format, args),
	   char *buffer,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  int status;

  assert(VALID(buffer));
  assert(VALID(format));

  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, NULL, args);
  *buffer = NIL;
  return status;
}

/*************************************************************************
 * snprintf
 */

/**
   Print at most @p max characters to string.

   @param buffer Output string.
   @param max Maximum number of characters to print.
   @param format Formatting string.
   @param ... Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_snprintf
TRIO_VARGS4((buffer, max, format, va_alist),
	    char *buffer,
	    size_t max,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(buffer));
  assert(VALID(format));

  TRIO_VA_START(args, format);
  status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
		      TrioOutStreamStringMax, format, &args, NULL);
  if (max > 0)
    *buffer = NIL;
  TRIO_VA_END(args);
  return status;
}

/**
   Print at most @p max characters to string.

   @param buffer Output string.
   @param max Maximum number of characters to print.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_vsnprintf
TRIO_ARGS4((buffer, max, format, args),
	   char *buffer,
	   size_t max,
	   TRIO_CONST char *format,
	   va_list args)
{
  int status;

  assert(VALID(buffer));
  assert(VALID(format));

  status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
		      TrioOutStreamStringMax, format, &args, NULL);
  if (max > 0)
    *buffer = NIL;
  return status;
}

/**
   Print at most @p max characters to string.

   @param buffer Output string.
   @param max Maximum number of characters to print.
   @param format Formatting string.
   @param args Arguments.
   @return Number of printed characters.
 */
TRIO_PUBLIC int
trio_snprintfv
TRIO_ARGS4((buffer, max, format, args),
	   char *buffer,
	   size_t max,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  int status;

  assert(VALID(buffer));
  assert(VALID(format));

  status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
		      TrioOutStreamStringMax, format, NULL, args);
  if (max > 0)
    *buffer = NIL;
  return status;
}

/*************************************************************************
 * snprintfcat
 * Appends the new string to the buffer string overwriting the '\0'
 * character at the end of buffer.
 */
TRIO_PUBLIC int
trio_snprintfcat
TRIO_VARGS4((buffer, max, format, va_alist),
	    char *buffer,
	    size_t max,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;
  size_t buf_len;

  TRIO_VA_START(args, format);

  assert(VALID(buffer));
  assert(VALID(format));

  buf_len = trio_length(buffer);
  buffer = &buffer[buf_len];

  status = TrioFormat(&buffer, max - 1 - buf_len,
		      TrioOutStreamStringMax, format, &args, NULL);
  TRIO_VA_END(args);
  *buffer = NIL;
  return status;
}

TRIO_PUBLIC int
trio_vsnprintfcat
TRIO_ARGS4((buffer, max, format, args),
	   char *buffer,
	   size_t max,
	   TRIO_CONST char *format,
	   va_list args)
{
  int status;
  size_t buf_len;
  
  assert(VALID(buffer));
  assert(VALID(format));

  buf_len = trio_length(buffer);
  buffer = &buffer[buf_len];
  status = TrioFormat(&buffer, max - 1 - buf_len,
		      TrioOutStreamStringMax, format, &args, NULL);
  *buffer = NIL;
  return status;
}

/*************************************************************************
 * trio_aprintf
 */

/* Deprecated */
TRIO_PUBLIC char *
trio_aprintf
TRIO_VARGS2((format, va_alist),
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  va_list args;
  trio_string_t *info;
  char *result = NULL;

  assert(VALID(format));
  
  info = trio_xstring_duplicate("");
  if (info)
    {
      TRIO_VA_START(args, format);
      (void)TrioFormat(info, 0, TrioOutStreamStringDynamic,
		       format, &args, NULL);
      TRIO_VA_END(args);

      trio_string_terminate(info);
      result = trio_string_extract(info);
      trio_string_destroy(info);
    }
  return result;
}

/* Deprecated */
TRIO_PUBLIC char *
trio_vaprintf
TRIO_ARGS2((format, args),
	   TRIO_CONST char *format,
	   va_list args)
{
  trio_string_t *info;
  char *result = NULL;
  
  assert(VALID(format));
  
  info = trio_xstring_duplicate("");
  if (info)
    {
      (void)TrioFormat(info, 0, TrioOutStreamStringDynamic,
		       format, &args, NULL);
      trio_string_terminate(info);
      result = trio_string_extract(info);
      trio_string_destroy(info);
    }
  return result;
}

TRIO_PUBLIC int
trio_asprintf
TRIO_VARGS3((result, format, va_alist),
	    char **result,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  va_list args;
  int status;
  trio_string_t *info;

  assert(VALID(format));

  *result = NULL;
  
  info = trio_xstring_duplicate("");
  if (info == NULL)
    {
      status = TRIO_ERROR_RETURN(TRIO_ENOMEM, 0);
    }
  else
    {
      TRIO_VA_START(args, format);
      status = TrioFormat(info, 0, TrioOutStreamStringDynamic,
			  format, &args, NULL);
      TRIO_VA_END(args);
      if (status >= 0)
	{
	  trio_string_terminate(info);
	  *result = trio_string_extract(info);
	}
      trio_string_destroy(info);
    }
  return status;
}

TRIO_PUBLIC int
trio_vasprintf
TRIO_ARGS3((result, format, args),
	   char **result,
	   TRIO_CONST char *format,
	   va_list args)
{
  int status;
  trio_string_t *info;
  
  assert(VALID(format));

  *result = NULL;
  
  info = trio_xstring_duplicate("");
  if (info == NULL)
    {
      status = TRIO_ERROR_RETURN(TRIO_ENOMEM, 0);
    }
  else
    {
      status = TrioFormat(info, 0, TrioOutStreamStringDynamic,
			  format, &args, NULL);
      if (status >= 0)
	{
	  trio_string_terminate(info);
	  *result = trio_string_extract(info);
	}
      trio_string_destroy(info);
    }
  return status;
}

/** @} End of Printf documentation module */

/*************************************************************************
 *
 * CALLBACK
 *
 ************************************************************************/

#if defined(TRIO_DOCUMENTATION)
# include "doc/doc_register.h"
#endif
/**
   @addtogroup UserDefined
   @{
*/

#if TRIO_EXTENSION

/*************************************************************************
 * trio_register
 */

/**
   Register new user-defined specifier.

   @param callback
   @param name
   @return Handle.
 */
TRIO_PUBLIC trio_pointer_t 
trio_register
TRIO_ARGS2((callback, name),
	   trio_callback_t callback,
	   TRIO_CONST char *name)
{
  trio_userdef_t *def;
  trio_userdef_t *prev = NULL;

  if (callback == NULL)
    return NULL;

  if (name)
    {
      /* Handle built-in namespaces */
      if (name[0] == ':')
	{
	  if (trio_equal(name, ":enter"))
	    {
	      internalEnterCriticalRegion = callback;
	    }
	  else if (trio_equal(name, ":leave"))
	    {
	      internalLeaveCriticalRegion = callback;
	    }
	  return NULL;
	}
      
      /* Bail out if namespace is too long */
      if (trio_length(name) >= MAX_USER_NAME)
	return NULL;
      
      /* Bail out if namespace already is registered */
      def = TrioFindNamespace(name, &prev);
      if (def)
	return NULL;
    }
  
  def = (trio_userdef_t *)TRIO_MALLOC(sizeof(trio_userdef_t));
  if (def)
    {
      if (internalEnterCriticalRegion)
	(void)internalEnterCriticalRegion(NULL);
      
      if (name)
	{
	  /* Link into internal list */
	  if (prev == NULL)
	    internalUserDef = def;
	  else
	    prev->next = def;
	}
      /* Initialize */
      def->callback = callback;
      def->name = (name == NULL)
	? NULL
	: trio_duplicate(name);
      def->next = NULL;

      if (internalLeaveCriticalRegion)
	(void)internalLeaveCriticalRegion(NULL);
    }
  return (trio_pointer_t)def;
}

/**
   Unregister an existing user-defined specifier.

   @param handle
 */
void
trio_unregister
TRIO_ARGS1((handle),
	   trio_pointer_t handle)
{
  trio_userdef_t *self = (trio_userdef_t *)handle;
  trio_userdef_t *def;
  trio_userdef_t *prev = NULL;

  assert(VALID(self));

  if (self->name)
    {
      def = TrioFindNamespace(self->name, &prev);
      if (def)
	{
	  if (internalEnterCriticalRegion)
	    (void)internalEnterCriticalRegion(NULL);
	  
	  if (prev == NULL)
	    internalUserDef = NULL;
	  else
	    prev->next = def->next;
	  
	  if (internalLeaveCriticalRegion)
	    (void)internalLeaveCriticalRegion(NULL);
	}
      trio_destroy(self->name);
    }
  TRIO_FREE(self);
}

/*************************************************************************
 * trio_get_format [public]
 */
TRIO_CONST char *
trio_get_format
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
#if defined(FORMAT_USER_DEFINED)
  assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED);
#endif
  
  return (((trio_reference_t *)ref)->parameter->user_data);
}

/*************************************************************************
 * trio_get_argument [public]
 */
trio_pointer_t 
trio_get_argument
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
#if defined(FORMAT_USER_DEFINED)
  assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED);
#endif
  
  return ((trio_reference_t *)ref)->parameter->data.pointer;
}

/*************************************************************************
 * trio_get_width / trio_set_width [public]
 */
int
trio_get_width
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return ((trio_reference_t *)ref)->parameter->width;
}

void
trio_set_width
TRIO_ARGS2((ref, width),
	   trio_pointer_t ref,
	   int width)
{
  ((trio_reference_t *)ref)->parameter->width = width;
}

/*************************************************************************
 * trio_get_precision / trio_set_precision [public]
 */
int
trio_get_precision
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->precision);
}

void
trio_set_precision
TRIO_ARGS2((ref, precision),
	   trio_pointer_t ref,
	   int precision)
{
  ((trio_reference_t *)ref)->parameter->precision = precision;
}

/*************************************************************************
 * trio_get_base / trio_set_base [public]
 */
int
trio_get_base
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->base);
}

void
trio_set_base
TRIO_ARGS2((ref, base),
	   trio_pointer_t ref,
	   int base)
{
  ((trio_reference_t *)ref)->parameter->base = base;
}

/*************************************************************************
 * trio_get_long / trio_set_long [public]
 */
int
trio_get_long
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_LONG);
}

void
trio_set_long
TRIO_ARGS2((ref, is_long),
	   trio_pointer_t ref,
	   int is_long)
{
  if (is_long)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_LONG;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_LONG;
}

/*************************************************************************
 * trio_get_longlong / trio_set_longlong [public]
 */
int
trio_get_longlong
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_QUAD);
}

void
trio_set_longlong
TRIO_ARGS2((ref, is_longlong),
	   trio_pointer_t ref,
	   int is_longlong)
{
  if (is_longlong)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_QUAD;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_QUAD;
}

/*************************************************************************
 * trio_get_longdouble / trio_set_longdouble [public]
 */
int
trio_get_longdouble
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_LONGDOUBLE);
}

void
trio_set_longdouble
TRIO_ARGS2((ref, is_longdouble),
	   trio_pointer_t ref,
	   int is_longdouble)
{
  if (is_longdouble)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_LONGDOUBLE;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_LONGDOUBLE;
}

/*************************************************************************
 * trio_get_short / trio_set_short [public]
 */
int
trio_get_short
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SHORT);
}

void
trio_set_short
TRIO_ARGS2((ref, is_short),
	   trio_pointer_t ref,
	   int is_short)
{
  if (is_short)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SHORT;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SHORT;
}

/*************************************************************************
 * trio_get_shortshort / trio_set_shortshort [public]
 */
int
trio_get_shortshort
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SHORTSHORT);
}

void
trio_set_shortshort
TRIO_ARGS2((ref, is_shortshort),
	   trio_pointer_t ref,
	   int is_shortshort)
{
  if (is_shortshort)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SHORTSHORT;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SHORTSHORT;
}

/*************************************************************************
 * trio_get_alternative / trio_set_alternative [public]
 */
int
trio_get_alternative
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_ALTERNATIVE);
}

void
trio_set_alternative
TRIO_ARGS2((ref, is_alternative),
	   trio_pointer_t ref,
	   int is_alternative)
{
  if (is_alternative)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_ALTERNATIVE;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_ALTERNATIVE;
}

/*************************************************************************
 * trio_get_alignment / trio_set_alignment [public]
 */
int
trio_get_alignment
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_LEFTADJUST);
}

void
trio_set_alignment
TRIO_ARGS2((ref, is_leftaligned),
	   trio_pointer_t ref,
	   int is_leftaligned)
{
  if (is_leftaligned)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_LEFTADJUST;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_LEFTADJUST;
}

/*************************************************************************
 * trio_get_spacing /trio_set_spacing [public]
 */
int
trio_get_spacing
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SPACE);
}

void
trio_set_spacing
TRIO_ARGS2((ref, is_space),
	   trio_pointer_t ref,
	   int is_space)
{
  if (is_space)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SPACE;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SPACE;
}

/*************************************************************************
 * trio_get_sign / trio_set_sign [public]
 */
int
trio_get_sign
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SHOWSIGN);
}

void
trio_set_sign
TRIO_ARGS2((ref, is_sign),
	   trio_pointer_t ref,
	   int is_sign)
{
  if (is_sign)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SHOWSIGN;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SHOWSIGN;
}

/*************************************************************************
 * trio_get_padding / trio_set_padding [public]
 */
int
trio_get_padding
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_NILPADDING);
}

void
trio_set_padding
TRIO_ARGS2((ref, is_padding),
	   trio_pointer_t ref,
	   int is_padding)
{
  if (is_padding)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_NILPADDING;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_NILPADDING;
}

/*************************************************************************
 * trio_get_quote / trio_set_quote [public]
 */
int
trio_get_quote
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_QUOTE);
}

void
trio_set_quote
TRIO_ARGS2((ref, is_quote),
	   trio_pointer_t ref,
	   int is_quote)
{
  if (is_quote)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_QUOTE;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_QUOTE;
}

/*************************************************************************
 * trio_get_upper / trio_set_upper [public]
 */
int
trio_get_upper
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_UPPER);
}

void
trio_set_upper
TRIO_ARGS2((ref, is_upper),
	   trio_pointer_t ref,
	   int is_upper)
{
  if (is_upper)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_UPPER;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_UPPER;
}

/*************************************************************************
 * trio_get_largest / trio_set_largest [public]
 */
#if TRIO_C99
int
trio_get_largest
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_INTMAX_T);
}

void
trio_set_largest
TRIO_ARGS2((ref, is_largest),
	   trio_pointer_t ref,
	   int is_largest)
{
  if (is_largest)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_INTMAX_T;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_INTMAX_T;
}
#endif

/*************************************************************************
 * trio_get_ptrdiff / trio_set_ptrdiff [public]
 */
int
trio_get_ptrdiff
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_PTRDIFF_T);
}

void
trio_set_ptrdiff
TRIO_ARGS2((ref, is_ptrdiff),
	   trio_pointer_t ref,
	   int is_ptrdiff)
{
  if (is_ptrdiff)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_PTRDIFF_T;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_PTRDIFF_T;
}

/*************************************************************************
 * trio_get_size / trio_set_size [public]
 */
#if TRIO_C99
int
trio_get_size
TRIO_ARGS1((ref),
	   trio_pointer_t ref)
{
  return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SIZE_T);
}

void
trio_set_size
TRIO_ARGS2((ref, is_size),
	   trio_pointer_t ref,
	   int is_size)
{
  if (is_size)
    ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SIZE_T;
  else
    ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SIZE_T;
}
#endif

/*************************************************************************
 * trio_print_int [public]
 */
void
trio_print_int
TRIO_ARGS2((ref, number),
	   trio_pointer_t ref,
	   int number)
{
  trio_reference_t *self = (trio_reference_t *)ref;

  TrioWriteNumber(self->data,
		  (trio_uintmax_t)number,
		  self->parameter->flags,
		  self->parameter->width,
		  self->parameter->precision,
		  self->parameter->base);
}

/*************************************************************************
 * trio_print_uint [public]
 */
void
trio_print_uint
TRIO_ARGS2((ref, number),
	   trio_pointer_t ref,
	   unsigned int number)
{
  trio_reference_t *self = (trio_reference_t *)ref;

  TrioWriteNumber(self->data,
		  (trio_uintmax_t)number,
		  self->parameter->flags | FLAGS_UNSIGNED,
		  self->parameter->width,
		  self->parameter->precision,
		  self->parameter->base);
}

/*************************************************************************
 * trio_print_double [public]
 */
void
trio_print_double
TRIO_ARGS2((ref, number),
	   trio_pointer_t ref,
	   double number)
{
  trio_reference_t *self = (trio_reference_t *)ref;

  TrioWriteDouble(self->data,
		  number,
		  self->parameter->flags,
		  self->parameter->width,
		  self->parameter->precision,
		  self->parameter->base);
}

/*************************************************************************
 * trio_print_string [public]
 */
void
trio_print_string
TRIO_ARGS2((ref, string),
	   trio_pointer_t ref,
	   char *string)
{
  trio_reference_t *self = (trio_reference_t *)ref;

  TrioWriteString(self->data,
		  string,
		  self->parameter->flags,
		  self->parameter->width,
		  self->parameter->precision);
}

/*************************************************************************
 * trio_print_ref [public]
 */
int
trio_print_ref
TRIO_VARGS3((ref, format, va_alist),
	    trio_pointer_t ref,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list arglist;

  assert(VALID(format));
  
  TRIO_VA_START(arglist, format);
  status = TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL);
  TRIO_VA_END(arglist);
  return status;
}

/*************************************************************************
 * trio_vprint_ref [public]
 */
int
trio_vprint_ref
TRIO_ARGS3((ref, format, arglist),
	   trio_pointer_t ref,
	   TRIO_CONST char *format,
	   va_list arglist)
{
  assert(VALID(format));
  
  return TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL);
}

/*************************************************************************
 * trio_printv_ref [public]
 */
int
trio_printv_ref
TRIO_ARGS3((ref, format, argarray),
	   trio_pointer_t ref,
	   TRIO_CONST char *format,
	   trio_pointer_t *argarray)
{
  assert(VALID(format));
  
  return TrioFormatRef((trio_reference_t *)ref, format, NULL, argarray);
}

#endif /* TRIO_EXTENSION */

/*************************************************************************
 * trio_print_pointer [public]
 */
void
trio_print_pointer
TRIO_ARGS2((ref, pointer),
	   trio_pointer_t ref,
	   trio_pointer_t pointer)
{
  trio_reference_t *self = (trio_reference_t *)ref;
  unsigned long flags;
  trio_uintmax_t number;

  if (NULL == pointer)
    {
      TRIO_CONST char *string = internalNullString;
      while (*string)
	self->data->OutStream(self->data, *string++);
    }
  else
    {
      /*
       * The subtraction of the null pointer is a workaround
       * to avoid a compiler warning. The performance overhead
       * is negligible (and likely to be removed by an
       * optimizing compiler). The (char *) casting is done
       * to please ANSI C++.
       */
      number = (trio_uintmax_t)((char *)pointer - (char *)0);
      /* Shrink to size of pointer */
      number &= (trio_uintmax_t)-1;
      flags = self->parameter->flags;
      flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE |
	        FLAGS_NILPADDING);
      TrioWriteNumber(self->data,
		      number,
		      flags,
		      POINTER_WIDTH,
		      NO_PRECISION,
		      BASE_HEX);
    }
}

/** @} End of UserDefined documentation module */

/*************************************************************************
 *
 * LOCALES
 *
 ************************************************************************/

/*************************************************************************
 * trio_locale_set_decimal_point
 *
 * Decimal point can only be one character. The input argument is a
 * string to enable multibyte characters. At most MB_LEN_MAX characters
 * will be used.
 */
TRIO_PUBLIC void
trio_locale_set_decimal_point
TRIO_ARGS1((decimalPoint),
	   char *decimalPoint)
{
#if defined(USE_LOCALE)
  if (NULL == internalLocaleValues)
    {
      TrioSetLocale();
    }
#endif
  internalDecimalPointLength = trio_length(decimalPoint);
  if (internalDecimalPointLength == 1)
    {
      internalDecimalPoint = *decimalPoint;
    }
  else
    {
      internalDecimalPoint = NIL;
      trio_copy_max(internalDecimalPointString,
		    sizeof(internalDecimalPointString),
		    decimalPoint);
    }
}

/*************************************************************************
 * trio_locale_set_thousand_separator
 *
 * See trio_locale_set_decimal_point
 */
TRIO_PUBLIC void
trio_locale_set_thousand_separator
TRIO_ARGS1((thousandSeparator),
	   char *thousandSeparator)
{
#if defined(USE_LOCALE)
  if (NULL == internalLocaleValues)
    {
      TrioSetLocale();
    }
#endif
  trio_copy_max(internalThousandSeparator,
		sizeof(internalThousandSeparator),
		thousandSeparator);
  internalThousandSeparatorLength = trio_length(internalThousandSeparator);
}

/*************************************************************************
 * trio_locale_set_grouping
 *
 * Array of bytes. Reversed order.
 *
 *  CHAR_MAX : No further grouping
 *  0        : Repeat last group for the remaining digits (not necessary
 *             as C strings are zero-terminated)
 *  n        : Set current group to n
 *
 * Same order as the grouping attribute in LC_NUMERIC.
 */
TRIO_PUBLIC void
trio_locale_set_grouping
TRIO_ARGS1((grouping),
	   char *grouping)
{
#if defined(USE_LOCALE)
  if (NULL == internalLocaleValues)
    {
      TrioSetLocale();
    }
#endif
  trio_copy_max(internalGrouping,
		sizeof(internalGrouping),
		grouping);
}


/*************************************************************************
 *
 * SCANNING
 *
 ************************************************************************/

/*************************************************************************
 * TrioSkipWhitespaces
 */
TRIO_PRIVATE int
TrioSkipWhitespaces
TRIO_ARGS1((self),
	   trio_class_t *self)
{
  int ch;

  ch = self->current;
  while (isspace(ch))
    {
      self->InStream(self, &ch);
    }
  return ch;
}

/*************************************************************************
 * TrioGetCollation
 */
#if TRIO_EXTENSION
TRIO_PRIVATE void
TrioGetCollation(TRIO_NOARGS)
{
  int i;
  int j;
  int k;
  char first[2];
  char second[2];

  /* This is computational expensive */
  first[1] = NIL;
  second[1] = NIL;
  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
    {
      k = 0;
      first[0] = (char)i;
      for (j = 0; j < MAX_CHARACTER_CLASS; j++)
	{
	  second[0] = (char)j;
	  if (trio_equal_locale(first, second))
	    internalCollationArray[i][k++] = (char)j;
	}
      internalCollationArray[i][k] = NIL;
    }
}
#endif

/*************************************************************************
 * TrioGetCharacterClass
 *
 * FIXME:
 *  multibyte
 */
TRIO_PRIVATE int
TrioGetCharacterClass
TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
	   TRIO_CONST char *format,
	   int *indexPointer,
	   unsigned long *flagsPointer,
	   int *characterclass)
{
  int index = *indexPointer;
  int i;
  char ch;
  char range_begin;
  char range_end;

  *flagsPointer &= ~FLAGS_EXCLUDE;

  if (format[index] == QUALIFIER_CIRCUMFLEX)
    {
      *flagsPointer |= FLAGS_EXCLUDE;
      index++;
    }
  /*
   * If the ungroup character is at the beginning of the scanlist,
   * it will be part of the class, and a second ungroup character
   * must follow to end the group.
   */
  if (format[index] == SPECIFIER_UNGROUP)
    {
      characterclass[(int)SPECIFIER_UNGROUP]++;
      index++;
    }
  /*
   * Minus is used to specify ranges. To include minus in the class,
   * it must be at the beginning of the list
   */
  if (format[index] == QUALIFIER_MINUS)
    {
      characterclass[(int)QUALIFIER_MINUS]++;
      index++;
    }
  /* Collect characters */
  for (ch = format[index];
       (ch != SPECIFIER_UNGROUP) && (ch != NIL);
       ch = format[++index])
    {
      switch (ch)
	{
	case QUALIFIER_MINUS: /* Scanlist ranges */
	  
	  /*
	   * Both C99 and UNIX98 describes ranges as implementation-
	   * defined.
	   *
	   * We support the following behaviour (although this may
	   * change as we become wiser)
	   * - only increasing ranges, ie. [a-b] but not [b-a]
	   * - transitive ranges, ie. [a-b-c] == [a-c]
	   * - trailing minus, ie. [a-] is interpreted as an 'a'
	   *   and a '-'
	   * - duplicates (although we can easily convert these
	   *   into errors)
	   */
	  range_begin = format[index - 1];
	  range_end = format[++index];
	  if (range_end == SPECIFIER_UNGROUP)
	    {
	      /* Trailing minus is included */
	      characterclass[(int)ch]++;
	      ch = range_end;
	      break; /* for */
	    }
	  if (range_end == NIL)
	    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
	  if (range_begin > range_end)
	    return TRIO_ERROR_RETURN(TRIO_ERANGE, index);
	    
	  for (i = (int)range_begin; i <= (int)range_end; i++)
	    characterclass[i]++;
	    
	  ch = range_end;
	  break;
	  
#if TRIO_EXTENSION

	case SPECIFIER_GROUP:
	  
	  switch (format[index + 1])
	    {
	    case QUALIFIER_DOT: /* Collating symbol */
	      /*
	       * FIXME: This will be easier to implement when multibyte
	       * characters have been implemented. Until now, we ignore
	       * this feature.
	       */
	      for (i = index + 2; ; i++)
		{
		  if (format[i] == NIL)
		    /* Error in syntax */
		    return -1;
		  else if (format[i] == QUALIFIER_DOT)
		    break; /* for */
		}
	      if (format[++i] != SPECIFIER_UNGROUP)
		return -1;
	      
	      index = i;
	      break;
	  
	    case QUALIFIER_EQUAL: /* Equivalence class expressions */
	      {
		unsigned int j;
		unsigned int k;
	    
		if (internalCollationUnconverted)
		  {
		    /* Lazy evaluation of collation array */
		    TrioGetCollation();
		    internalCollationUnconverted = FALSE;
		  }
		for (i = index + 2; ; i++)
		  {
		    if (format[i] == NIL)
		      /* Error in syntax */
		      return -1;
		    else if (format[i] == QUALIFIER_EQUAL)
		      break; /* for */
		    else
		      {
			/* Mark any equivalent character */
			k = (unsigned int)format[i];
			for (j = 0; internalCollationArray[k][j] != NIL; j++)
			  characterclass[(int)internalCollationArray[k][j]]++;
		      }
		  }
		if (format[++i] != SPECIFIER_UNGROUP)
		  return -1;
		
		index = i;
	      }
	      break;
	  
	    case QUALIFIER_COLON: /* Character class expressions */
	  
	      if (trio_equal_max(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1,
				 &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isalnum(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_ALNUM) - 1;
		}
	      else if (trio_equal_max(CLASS_ALPHA, sizeof(CLASS_ALPHA) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isalpha(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_ALPHA) - 1;
		}
	      else if (trio_equal_max(CLASS_CNTRL, sizeof(CLASS_CNTRL) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (iscntrl(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_CNTRL) - 1;
		}
	      else if (trio_equal_max(CLASS_DIGIT, sizeof(CLASS_DIGIT) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isdigit(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_DIGIT) - 1;
		}
	      else if (trio_equal_max(CLASS_GRAPH, sizeof(CLASS_GRAPH) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isgraph(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_GRAPH) - 1;
		}
	      else if (trio_equal_max(CLASS_LOWER, sizeof(CLASS_LOWER) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (islower(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_LOWER) - 1;
		}
	      else if (trio_equal_max(CLASS_PRINT, sizeof(CLASS_PRINT) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isprint(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_PRINT) - 1;
		}
	      else if (trio_equal_max(CLASS_PUNCT, sizeof(CLASS_PUNCT) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (ispunct(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_PUNCT) - 1;
		}
	      else if (trio_equal_max(CLASS_SPACE, sizeof(CLASS_SPACE) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isspace(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_SPACE) - 1;
		}
	      else if (trio_equal_max(CLASS_UPPER, sizeof(CLASS_UPPER) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isupper(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_UPPER) - 1;
		}
	      else if (trio_equal_max(CLASS_XDIGIT, sizeof(CLASS_XDIGIT) - 1,
				      &format[index]))
		{
		  for (i = 0; i < MAX_CHARACTER_CLASS; i++)
		    if (isxdigit(i))
		      characterclass[i]++;
		  index += sizeof(CLASS_XDIGIT) - 1;
		}
	      else
		{
		  characterclass[(int)ch]++;
		}
	      break;

	    default:
	      characterclass[(int)ch]++;
	      break;
	    }
	  break;
	  
#endif /* TRIO_EXTENSION */
	  
	default:
	  characterclass[(int)ch]++;
	  break;
	}
    }
  return 0;
}

/*************************************************************************
 * TrioReadNumber
 *
 * We implement our own number conversion in preference of strtol and
 * strtoul, because we must handle 'long long' and thousand separators.
 */
TRIO_PRIVATE BOOLEAN_T
TrioReadNumber
TRIO_ARGS5((self, target, flags, width, base),
	   trio_class_t *self,
	   trio_uintmax_t *target,
	   unsigned long flags,
	   int width,
	   int base)
{
  trio_uintmax_t number = 0;
  int digit;
  int count;
  BOOLEAN_T isNegative = FALSE;
  BOOLEAN_T gotNumber = FALSE;
  int j;

  assert(VALID(self));
  assert(VALID(self->InStream));
  assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE));

  if (internalDigitsUnconverted)
    {
      /* Lazy evaluation of digits array */
      memset(internalDigitArray, -1, sizeof(internalDigitArray));
      for (j = 0; j < (int)sizeof(internalDigitsLower) - 1; j++)
	{
	  internalDigitArray[(int)internalDigitsLower[j]] = j;
	  internalDigitArray[(int)internalDigitsUpper[j]] = j;
	}
      internalDigitsUnconverted = FALSE;
    }
  
  TrioSkipWhitespaces(self);
  
  if (!(flags & FLAGS_UNSIGNED))
    {
      /* Leading sign */
      if (self->current == '+')
	{
	  self->InStream(self, NULL);
	}
      else if (self->current == '-')
	{
	  self->InStream(self, NULL);
	  isNegative = TRUE;
	}
    }
  
  count = self->processed;
  
  if (flags & FLAGS_ALTERNATIVE)
    {
      switch (base)
	{
	case NO_BASE:
	case BASE_OCTAL:
	case BASE_HEX:
	case BASE_BINARY:
	  if (self->current == '0')
	    {
	      self->InStream(self, NULL);
	      if (self->current)
		{
		  if ((base == BASE_HEX) &&
		      (toupper(self->current) == 'X'))
		    {
		      self->InStream(self, NULL);
		    }
		  else if ((base == BASE_BINARY) &&
			   (toupper(self->current) == 'B'))
		    {
		      self->InStream(self, NULL);
		    }
		}
	    }
	  else
	    return FALSE;
	  break;
	default:
	  break;
	}
    }

  while (((width == NO_WIDTH) || (self->processed - count < width)) &&
	 (! ((self->current == EOF) || isspace(self->current))))
    {
      if (isascii(self->current))
	{
	  digit = internalDigitArray[self->current];
	  /* Abort if digit is not allowed in the specified base */
	  if ((digit == -1) || (digit >= base))
	    break;
	}
      else if (flags & FLAGS_QUOTE)
	{
	  /* Compare with thousands separator */
	  for (j = 0; internalThousandSeparator[j] && self->current; j++)
	    {
	      if (internalThousandSeparator[j] != self->current)
		break;

	      self->InStream(self, NULL);
	    }
	  if (internalThousandSeparator[j])
	    break; /* Mismatch */
	  else
	    continue; /* Match */
	}
      else
	break;
            
      number *= base;
      number += digit;
      gotNumber = TRUE; /* we need at least one digit */

      self->InStream(self, NULL);
    }

  /* Was anything read at all? */
  if (!gotNumber)
    return FALSE;
  
  if (target)
    *target = (isNegative) ? -((trio_intmax_t)number) : number;
  return TRUE;
}

/*************************************************************************
 * TrioReadChar
 */
TRIO_PRIVATE int
TrioReadChar
TRIO_ARGS4((self, target, flags, width),
	   trio_class_t *self,
	   char *target,
	   unsigned long flags,
	   int width)
{
  int i;
  char ch;
  trio_uintmax_t number;
  
  assert(VALID(self));
  assert(VALID(self->InStream));

  for (i = 0;
       (self->current != EOF) && (i < width);
       i++)
    {
      ch = (char)self->current;
      self->InStream(self, NULL);
      if ((flags & FLAGS_ALTERNATIVE) && (ch == CHAR_BACKSLASH))
	{
	  switch (self->current)
	    {
	    case '\\': ch = '\\'; break;
	    case 'a': ch = '\007'; break;
	    case 'b': ch = '\b'; break;
	    case 'f': ch = '\f'; break;
	    case 'n': ch = '\n'; break;
	    case 'r': ch = '\r'; break;
	    case 't': ch = '\t'; break;
	    case 'v': ch = '\v'; break;
	    default:
	      if (isdigit(self->current))
		{
		  /* Read octal number */
		  if (!TrioReadNumber(self, &number, 0, 3, BASE_OCTAL))
		    return 0;
		  ch = (char)number;
		}
	      else if (toupper(self->current) == 'X')
		{
		  /* Read hexadecimal number */
		  self->InStream(self, NULL);
		  if (!TrioReadNumber(self, &number, 0, 2, BASE_HEX))
		    return 0;
		  ch = (char)number;
		}
	      else
		{
		  ch = (char)self->current;
		}
	      break;
	    }
	}
      
      if (target)
	target[i] = ch;
    }
  return i + 1;
}

/*************************************************************************
 * TrioReadString
 */
TRIO_PRIVATE BOOLEAN_T
TrioReadString
TRIO_ARGS4((self, target, flags, width),
	   trio_class_t *self,
	   char *target,
	   unsigned long flags,
	   int width)
{
  int i;
  
  assert(VALID(self));
  assert(VALID(self->InStream));

  TrioSkipWhitespaces(self);
    
  /*
   * Continue until end of string is reached, a whitespace is encountered,
   * or width is exceeded
   */
  for (i = 0;
       ((width == NO_WIDTH) || (i < width)) &&
       (! ((self->current == EOF) || isspace(self->current)));
       i++)
    {
      if (TrioReadChar(self, (target ? &target[i] : 0), flags, 1) == 0)
	break; /* for */
    }
  if (target)
    target[i] = NIL;
  return TRUE;
}

/*************************************************************************
 * TrioReadWideChar
 */
#if TRIO_WIDECHAR
TRIO_PRIVATE int
TrioReadWideChar
TRIO_ARGS4((self, target, flags, width),
	   trio_class_t *self,
	   trio_wchar_t *target,
	   unsigned long flags,
	   int width)
{
  int i;
  int j;
  int size;
  int amount = 0;
  trio_wchar_t wch;
  char buffer[MB_LEN_MAX + 1];
  
  assert(VALID(self));
  assert(VALID(self->InStream));

  for (i = 0;
       (self->current != EOF) && (i < width);
       i++)
    {
      if (isascii(self->current))
	{
	  if (TrioReadChar(self, buffer, flags, 1) == 0)
	    return 0;
	  buffer[1] = NIL;
	}
      else
	{
	  /*
	   * Collect a multibyte character, by enlarging buffer until
	   * it contains a fully legal multibyte character, or the
	   * buffer is full.
	   */
	  j = 0;
	  do
	    {
	      buffer[j++] = (char)self->current;
	      buffer[j] = NIL;
	      self->InStream(self, NULL);
	    }
	  while ((j < (int)sizeof(buffer)) && (mblen(buffer, (size_t)j) != j));
	}
      if (target)
	{
	  size = mbtowc(&wch, buffer, sizeof(buffer));
	  if (size > 0)
	    target[i] = wch;
	}
      amount += size;
      self->InStream(self, NULL);
    }
  return amount;
}
#endif /* TRIO_WIDECHAR */

/*************************************************************************
 * TrioReadWideString
 */
#if TRIO_WIDECHAR
TRIO_PRIVATE BOOLEAN_T
TrioReadWideString
TRIO_ARGS4((self, target, flags, width),
	   trio_class_t *self,
	   trio_wchar_t *target,
	   unsigned long flags,
	   int width)
{
  int i;
  int size;
  
  assert(VALID(self));
  assert(VALID(self->InStream));

  TrioSkipWhitespaces(self);

#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  (void)mblen(NULL, 0);
#endif
  
  /*
   * Continue until end of string is reached, a whitespace is encountered,
   * or width is exceeded
   */
  for (i = 0;
       ((width == NO_WIDTH) || (i < width)) &&
       (! ((self->current == EOF) || isspace(self->current)));
       )
    {
      size = TrioReadWideChar(self, &target[i], flags, 1);
      if (size == 0)
	break; /* for */

      i += size;
    }
  if (target)
    target[i] = WCONST('\0');
  return TRUE;
}
#endif /* TRIO_WIDECHAR */

/*************************************************************************
 * TrioReadGroup
 *
 * FIXME: characterclass does not work with multibyte characters
 */
TRIO_PRIVATE BOOLEAN_T
TrioReadGroup
TRIO_ARGS5((self, target, characterclass, flags, width),
	   trio_class_t *self,
	   char *target,
	   int *characterclass,
	   unsigned long flags,
	   int width)
{
  int ch;
  int i;
  
  assert(VALID(self));
  assert(VALID(self->InStream));

  ch = self->current;
  for (i = 0;
       ((width == NO_WIDTH) || (i < width)) &&
       (! ((ch == EOF) ||
	   (((flags & FLAGS_EXCLUDE) != 0) ^ (characterclass[ch] == 0))));
       i++)
    {
      if (target)
	target[i] = (char)ch;
      self->InStream(self, &ch);
    }
  
  if (target)
    target[i] = NIL;
  return TRUE;
}

/*************************************************************************
 * TrioReadDouble
 *
 * FIXME:
 *  add long double
 *  handle base
 */
TRIO_PRIVATE BOOLEAN_T
TrioReadDouble
TRIO_ARGS4((self, target, flags, width),
	   trio_class_t *self,
	   trio_pointer_t target,
	   unsigned long flags,
	   int width)
{
  int ch;
  char doubleString[512];
  int index = 0;
  int start;
  int j;
  BOOLEAN_T isHex = FALSE;

  doubleString[0] = 0;
  
  if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1))
    width = sizeof(doubleString) - 1;
  
  TrioSkipWhitespaces(self);
  
  /*
   * Read entire double number from stream. trio_to_double requires
   * a string as input, but InStream can be anything, so we have to
   * collect all characters.
   */
  ch = self->current;
  if ((ch == '+') || (ch == '-'))
    {
      doubleString[index++] = (char)ch;
      self->InStream(self, &ch);
      width--;
    }

  start = index;
  switch (ch)
    {
    case 'n':
    case 'N':
      /* Not-a-number */
      if (index != 0)
	break;
      /* FALLTHROUGH */
    case 'i':
    case 'I':
      /* Infinity */
      while (isalpha(ch) && (index - start < width))
	{
	  doubleString[index++] = (char)ch;
	  self->InStream(self, &ch);
	}
      doubleString[index] = NIL;

      /* Case insensitive string comparison */
      if (trio_equal(&doubleString[start], INFINITE_UPPER) ||
	  trio_equal(&doubleString[start], LONG_INFINITE_UPPER))
	{
	  if (flags & FLAGS_LONGDOUBLE)
	    {
	      if ((start == 1) && (doubleString[0] == '-'))
		{
		  *((trio_long_double_t *)target) = trio_ninf();
		}
	      else
		{
		  *((trio_long_double_t *)target) = trio_pinf();
		}
	    }
	  else
	    {
	      if ((start == 1) && (doubleString[0] == '-'))
		{
		  *((double *)target) = trio_ninf();
		}
	      else
		{
		  *((double *)target) = trio_pinf();
		}
	    }
	  return TRUE;
	}
      if (trio_equal(doubleString, NAN_UPPER))
	{
	  /* NaN must not have a preceeding + nor - */
	  if (flags & FLAGS_LONGDOUBLE)
	    {
	      *((trio_long_double_t *)target) = trio_nan();
	    }
	  else
	    {
	      *((double *)target) = trio_nan();
	    }
	  return TRUE;
	}
      return FALSE;

    case '0':
      doubleString[index++] = (char)ch;
      self->InStream(self, &ch);
      if (toupper(ch) == 'X')
	{
	  isHex = TRUE;
	  doubleString[index++] = (char)ch;
	  self->InStream(self, &ch);
	}
      break;
      
    default:
      break;
    }
  
  while ((ch != EOF) && (index - start < width))
    {
      /* Integer part */
      if (isHex ? isxdigit(ch) : isdigit(ch))
	{
	  doubleString[index++] = (char)ch;
	  self->InStream(self, &ch);
	}
      else if (flags & FLAGS_QUOTE)
	{
	  /* Compare with thousands separator */
	  for (j = 0; internalThousandSeparator[j] && self->current; j++)
	    {
	      if (internalThousandSeparator[j] != self->current)
		break;

	      self->InStream(self, &ch);
	    }
	  if (internalThousandSeparator[j])
	    break; /* Mismatch */
	  else
	    continue; /* Match */
	}
      else
	break; /* while */
    }
  if (ch == '.')
    {
      /* Decimal part */
      doubleString[index++] = (char)ch;
      self->InStream(self, &ch);
      while ((isHex ? isxdigit(ch) : isdigit(ch)) &&
	     (index - start < width))
	{
	  doubleString[index++] = (char)ch;
	  self->InStream(self, &ch);
	}
      if (isHex ? (toupper(ch) == 'P') : (toupper(ch) == 'E'))
	{
	  /* Exponent */
	  doubleString[index++] = (char)ch;
	  self->InStream(self, &ch);
	  if ((ch == '+') || (ch == '-'))
	    {
	      doubleString[index++] = (char)ch;
	      self->InStream(self, &ch);
	    }
	  while ((isHex ? isxdigit(ch) : isdigit(ch)) &&
		 (index - start < width))
	    {
	      doubleString[index++] = (char)ch;
	      self->InStream(self, &ch);
	    }
	}
    }

  if ((index == start) || (*doubleString == NIL))
    return FALSE;

  doubleString[index] = 0;
  
  if (flags & FLAGS_LONGDOUBLE)
    {
      *((trio_long_double_t *)target) = trio_to_long_double(doubleString, NULL);
    }
  else
    {
      *((double *)target) = trio_to_double(doubleString, NULL);
    }
  return TRUE;
}

/*************************************************************************
 * TrioReadPointer
 */
TRIO_PRIVATE BOOLEAN_T
TrioReadPointer
TRIO_ARGS3((self, target, flags),
	   trio_class_t *self,
	   trio_pointer_t *target,
	   unsigned long flags)
{
  trio_uintmax_t number;
  char buffer[sizeof(internalNullString)];

  flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING);
  
  if (TrioReadNumber(self,
		     &number,
		     flags,
		     POINTER_WIDTH,
		     BASE_HEX))
    {
      /*
       * The strange assignment of number is a workaround for a compiler
       * warning
       */
      if (target)
	*target = (char *)0 + number;
      return TRUE;
    }
  else if (TrioReadString(self,
			  (flags & FLAGS_IGNORE)
			  ? NULL
			  : buffer,
			  0,
			  sizeof(internalNullString) - 1))
    {  
      if (trio_equal_case(buffer, internalNullString))
	{
	  if (target)
	    *target = NULL;
	  return TRUE;
	}
    }
  return FALSE;
}

/*************************************************************************
 * TrioScanProcess
 */
TRIO_PRIVATE int
TrioScanProcess
TRIO_ARGS3((data, format, parameters),
	   trio_class_t *data,
	   TRIO_CONST char *format,
	   trio_parameter_t *parameters)
{
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  int charlen;
  int cnt;
#endif
  int assignment;
  int ch;
  int index; /* Index of format string */
  int i; /* Index of current parameter */
  unsigned long flags;
  int width;
  int base;
  trio_pointer_t pointer;

  assignment = 0;
  i = 0;
  index = 0;
  data->InStream(data, &ch);

#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
  (void)mblen(NULL, 0);
#endif

  while (format[index])
    {
#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
      if (! isascii(format[index]))
	{
	  charlen = mblen(&format[index], MB_LEN_MAX);
	  if (charlen != -1)
	    {
	      /* Compare multibyte characters in format string */
	      for (cnt = 0; cnt < charlen - 1; cnt++)
		{
		  if (ch != format[index + cnt])
		    {
		      return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
		    }
		  data->InStream(data, &ch);
		}
	      continue; /* while characters left in formatting string */
	    }
	}
#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
      
      if ((EOF == ch) && (parameters[i].type != FORMAT_COUNT))
	{
	  return (assignment > 0) ? assignment : EOF;
	}
      
      if (CHAR_IDENTIFIER == format[index])
	{
	  if (CHAR_IDENTIFIER == format[index + 1])
	    {
	      /* Two % in format matches one % in input stream */
	      if (CHAR_IDENTIFIER == ch)
		{
		  data->InStream(data, &ch);
		  index += 2;
		  continue; /* while format chars left */
		}
	      else
		return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
	    }

	  /* Skip the parameter entries */
	  while (parameters[i].type == FORMAT_PARAMETER)
	    i++;
	  
	  flags = parameters[i].flags;
	  /* Find width */
	  width = parameters[i].width;
	  if (flags & FLAGS_WIDTH_PARAMETER)
	    {
	      /* Get width from parameter list */
	      width = (int)parameters[width].data.number.as_signed;
	    }
	  /* Find base */
	  base = parameters[i].base;
	  if (flags & FLAGS_BASE_PARAMETER)
	    {
	      /* Get base from parameter list */
	      base = (int)parameters[base].data.number.as_signed;
	    }
	  
	  switch (parameters[i].type)
	    {
	    case FORMAT_INT:
	      {
		trio_uintmax_t number;

		if (0 == base)
		  base = BASE_DECIMAL;

		if (!TrioReadNumber(data,
				    &number,
				    flags,
				    width,
				    base))
		  return assignment;

		if (!(flags & FLAGS_IGNORE))
		  {
		    assignment++;

		    pointer = parameters[i].data.pointer;
#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
		    if (flags & FLAGS_SIZE_T)
		      *(size_t *)pointer = (size_t)number;
		    else
#endif
#if defined(QUALIFIER_PTRDIFF_T)
		    if (flags & FLAGS_PTRDIFF_T)
		      *(ptrdiff_t *)pointer = (ptrdiff_t)number;
		    else
#endif
#if defined(QUALIFIER_INTMAX_T)
		    if (flags & FLAGS_INTMAX_T)
		      *(trio_intmax_t *)pointer = (trio_intmax_t)number;
		    else
#endif
		    if (flags & FLAGS_QUAD)
		      *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)number;
		    else if (flags & FLAGS_LONG)
		      *(long int *)pointer = (long int)number;
		    else if (flags & FLAGS_SHORT)
		      *(short int *)pointer = (short int)number;
		    else
		      *(int *)pointer = (int)number;
		  }
	      }
	      break; /* FORMAT_INT */
	      
	    case FORMAT_STRING:
#if TRIO_WIDECHAR
	      if (flags & FLAGS_WIDECHAR)
		{
		  if (!TrioReadWideString(data,
					  (flags & FLAGS_IGNORE)
					  ? NULL
					  : parameters[i].data.wstring,
					  flags,
					  width))
		    return assignment;
		}
	      else
#endif
		{
		  if (!TrioReadString(data,
				      (flags & FLAGS_IGNORE)
				      ? NULL
				      : parameters[i].data.string,
				      flags,
				      width))
		    return assignment;
		}
	      if (!(flags & FLAGS_IGNORE))
		assignment++;
	      break; /* FORMAT_STRING */

	    case FORMAT_DOUBLE:
	      {
		trio_pointer_t pointer;

		if (flags & FLAGS_IGNORE)
		  {
		    pointer = NULL;
		  }
		else
		  {
		    pointer = (flags & FLAGS_LONGDOUBLE)
		      ? (trio_pointer_t)parameters[i].data.longdoublePointer
		      : (trio_pointer_t)parameters[i].data.doublePointer;
		  }
		if (!TrioReadDouble(data, pointer, flags, width))
		  {
		    return assignment;
		  }
		if (!(flags & FLAGS_IGNORE))
		  {
		    assignment++;
		  }
		break; /* FORMAT_DOUBLE */
	      }
	    case FORMAT_GROUP:
	      {
		int characterclass[MAX_CHARACTER_CLASS + 1];
		int rc;

		/* Skip over modifiers */
		while (format[index] != SPECIFIER_GROUP)
		  {
		    index++;
		  }
		/* Skip over group specifier */
		index++;
		
		memset(characterclass, 0, sizeof(characterclass));
		rc = TrioGetCharacterClass(format,
					   &index,
					   &flags,
					   characterclass);
		if (rc < 0)
		  return rc;

		if (!TrioReadGroup(data,
				   (flags & FLAGS_IGNORE)
				   ? NULL
				   : parameters[i].data.string,
				   characterclass,
				   flags,
				   parameters[i].width))
		  return assignment;
		if (!(flags & FLAGS_IGNORE))
		  assignment++;
	      }
	      break; /* FORMAT_GROUP */

	    case FORMAT_COUNT:
	      pointer = parameters[i].data.pointer;
	      if (NULL != pointer)
		{
		  int count = data->committed;
		  if (ch != EOF)
		    count--; /* a character is read, but is not consumed yet */
#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
		  if (flags & FLAGS_SIZE_T)
		    *(size_t *)pointer = (size_t)count;
		  else
#endif
#if defined(QUALIFIER_PTRDIFF_T)
		  if (flags & FLAGS_PTRDIFF_T)
		    *(ptrdiff_t *)pointer = (ptrdiff_t)count;
		  else
#endif
#if defined(QUALIFIER_INTMAX_T)
		  if (flags & FLAGS_INTMAX_T)
		    *(trio_intmax_t *)pointer = (trio_intmax_t)count;
		  else
#endif
		  if (flags & FLAGS_QUAD)
		    {
		      *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)count;
		    }
		  else if (flags & FLAGS_LONG)
		    {
		      *(long int *)pointer = (long int)count;
		    }
		  else if (flags & FLAGS_SHORT)
		    {
		      *(short int *)pointer = (short int)count;
		    }
		  else
		    {
		      *(int *)pointer = (int)count;
		    }
		}
	      break; /* FORMAT_COUNT */
	      
	    case FORMAT_CHAR:
#if TRIO_WIDECHAR
	      if (flags & FLAGS_WIDECHAR)
		{
		  if (TrioReadWideChar(data,
				       (flags & FLAGS_IGNORE)
				       ? NULL
				       : parameters[i].data.wstring,
				       flags,
				       (width == NO_WIDTH) ? 1 : width) == 0)
		    return assignment;
		}
	      else
#endif
		{
		  if (TrioReadChar(data,
				   (flags & FLAGS_IGNORE)
				   ? NULL
				   : parameters[i].data.string,
				   flags,
				   (width == NO_WIDTH) ? 1 : width) == 0)
		    return assignment;
		}
	      if (!(flags & FLAGS_IGNORE))
		assignment++;
	      break; /* FORMAT_CHAR */

	    case FORMAT_POINTER:
	      if (!TrioReadPointer(data,
				   (flags & FLAGS_IGNORE)
				   ? NULL
				   : (trio_pointer_t *)parameters[i].data.pointer,
				   flags))
		return assignment;
	      if (!(flags & FLAGS_IGNORE))
		assignment++;
	      break; /* FORMAT_POINTER */

	    case FORMAT_PARAMETER:
	      break; /* FORMAT_PARAMETER */

	    default:
	      return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
	    }
	  ch = data->current;
	  index = parameters[i].indexAfterSpecifier;
	  i++;
	}
      else /* Not an % identifier */
	{
	  if (isspace((int)format[index]))
	    {
	      /* Whitespaces may match any amount of whitespaces */
	      ch = TrioSkipWhitespaces(data);
	    }
	  else if (ch == format[index])
	    {
	      data->InStream(data, &ch);
	    }
	  else
	    return assignment;
	  
	  index++;
	}
    }
  return assignment;
}

/*************************************************************************
 * TrioScan
 */
TRIO_PRIVATE int
TrioScan
TRIO_ARGS6((source, sourceSize, InStream, format, arglist, argarray),
	   trio_pointer_t source,
	   size_t sourceSize,
	   void (*InStream) TRIO_PROTO((trio_class_t *, int *)),
	   TRIO_CONST char *format,
	   va_list *arglist,
	   trio_pointer_t *argarray)
{
  int status;
  trio_parameter_t parameters[MAX_PARAMETERS];
  trio_class_t data;

  assert(VALID(InStream));
  assert(VALID(format));

  memset(&data, 0, sizeof(data));
  data.InStream = InStream;
  data.location = (trio_pointer_t)source;
  data.max = sourceSize;
  data.error = 0;

#if defined(USE_LOCALE)
  if (NULL == internalLocaleValues)
    {
      TrioSetLocale();
    }
#endif
  
  status = TrioParse(TYPE_SCAN, format, parameters, arglist, argarray);
  if (status < 0)
    return status;

  status = TrioScanProcess(&data, format, parameters);
  if (data.error != 0)
    {
      status = data.error;
    }
  return status;
}

/*************************************************************************
 * TrioInStreamFile
 */
TRIO_PRIVATE void
TrioInStreamFile
TRIO_ARGS2((self, intPointer),
	   trio_class_t *self,
	   int *intPointer)
{
  FILE *file = (FILE *)self->location;

  assert(VALID(self));
  assert(VALID(file));

  self->current = fgetc(file);
  if (self->current == EOF)
    {
      self->error = (ferror(file))
	? TRIO_ERROR_RETURN(TRIO_ERRNO, 0)
	: TRIO_ERROR_RETURN(TRIO_EOF, 0);
    }
  else
    {
      self->processed++;
      self->committed++;
    }
  
  if (VALID(intPointer))
    {
      *intPointer = self->current;
    }
}

/*************************************************************************
 * TrioInStreamFileDescriptor
 */
TRIO_PRIVATE void
TrioInStreamFileDescriptor
TRIO_ARGS2((self, intPointer),
	   trio_class_t *self,
	   int *intPointer)
{
  int fd = *((int *)self->location);
  int size;
  unsigned char input;

  assert(VALID(self));

  size = read(fd, &input, sizeof(char));
  if (size == -1)
    {
      self->error = TRIO_ERROR_RETURN(TRIO_ERRNO, 0);
      self->current = EOF;
    }
  else
    {
      self->current = (size == 0) ? EOF : input;
    }
  if (self->current != EOF)
    {
      self->committed++;
      self->processed++;
    }
  
  if (VALID(intPointer))
    {
      *intPointer = self->current;
    }
}

/*************************************************************************
 * TrioInStreamCustom
 */
TRIO_PRIVATE void
TrioInStreamCustom
TRIO_ARGS2((self, intPointer),
	   trio_class_t *self,
	   int *intPointer)
{
  trio_custom_t *data;
  
  assert(VALID(self));
  assert(VALID(self->location));

  data = (trio_custom_t *)self->location;

  self->current = (data->stream.in == NULL)
    ? NIL
    : (data->stream.in)(data->closure);
  
  if (self->current == NIL)
    {
      self->current = EOF;
    }
  else
    {
      self->processed++;
      self->committed++;
    }
  
  if (VALID(intPointer))
    {
      *intPointer = self->current;
    }
}

/*************************************************************************
 * TrioInStreamString
 */
TRIO_PRIVATE void
TrioInStreamString
TRIO_ARGS2((self, intPointer),
	   trio_class_t *self,
	   int *intPointer)
{
  unsigned char **buffer;

  assert(VALID(self));
  assert(VALID(self->location));

  buffer = (unsigned char **)self->location;
  self->current = (*buffer)[0];
  if (self->current == NIL)
    {
      self->current = EOF;
    }
  else
    {
      (*buffer)++;
      self->processed++;
      self->committed++;
    }
  
  if (VALID(intPointer))
    {
      *intPointer = self->current;
    }
}

/*************************************************************************
 *
 * Formatted scanning functions
 *
 ************************************************************************/

#if defined(TRIO_DOCUMENTATION)
# include "doc/doc_scanf.h"
#endif
/** @addtogroup Scanf
    @{
*/

/*************************************************************************
 * scanf
 */

/**
   Scan characters from standard input stream.

   @param format Formatting string.
   @param ... Arguments.
   @return Number of scanned characters.
 */
TRIO_PUBLIC int
trio_scanf
TRIO_VARGS2((format, va_alist),
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioScan((trio_pointer_t)stdin, 0,
		    TrioInStreamFile,
		    format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

TRIO_PUBLIC int
trio_vscanf
TRIO_ARGS2((format, args),
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)stdin, 0,
		  TrioInStreamFile,
		  format, &args, NULL);
}

TRIO_PUBLIC int
trio_scanfv
TRIO_ARGS2((format, args),
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)stdin, 0,
		  TrioInStreamFile,
		  format, NULL, args);
}

/*************************************************************************
 * fscanf
 */
TRIO_PUBLIC int
trio_fscanf
TRIO_VARGS3((file, format, va_alist),
	    FILE *file,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(file));
  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioScan((trio_pointer_t)file, 0,
		    TrioInStreamFile,
		    format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

TRIO_PUBLIC int
trio_vfscanf
TRIO_ARGS3((file, format, args),
	   FILE *file,
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(file));
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)file, 0,
		  TrioInStreamFile,
		  format, &args, NULL);
}

TRIO_PUBLIC int
trio_fscanfv
TRIO_ARGS3((file, format, args),
	   FILE *file,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  assert(VALID(file));
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)file, 0,
		  TrioInStreamFile,
		  format, NULL, args);
}

/*************************************************************************
 * dscanf
 */
TRIO_PUBLIC int
trio_dscanf
TRIO_VARGS3((fd, format, va_alist),
	    int fd,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioScan((trio_pointer_t)&fd, 0,
		    TrioInStreamFileDescriptor,
		    format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

TRIO_PUBLIC int
trio_vdscanf
TRIO_ARGS3((fd, format, args),
	   int fd,
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)&fd, 0,
		  TrioInStreamFileDescriptor,
		  format, &args, NULL);
}

TRIO_PUBLIC int
trio_dscanfv
TRIO_ARGS3((fd, format, args),
	   int fd,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)&fd, 0,
		  TrioInStreamFileDescriptor,
		  format, NULL, args);
}

/*************************************************************************
 * cscanf
 */
TRIO_PUBLIC int
trio_cscanf
TRIO_VARGS4((stream, closure, format, va_alist),
	    trio_instream_t stream,
	    trio_pointer_t closure,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;
  trio_custom_t data;

  assert(VALID(stream));
  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  data.stream.in = stream;
  data.closure = closure;
  status = TrioScan(&data, 0, TrioInStreamCustom, format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

TRIO_PUBLIC int
trio_vcscanf
TRIO_ARGS4((stream, closure, format, args),
	   trio_instream_t stream,
	   trio_pointer_t closure,
	   TRIO_CONST char *format,
	   va_list args)
{
  trio_custom_t data;
  
  assert(VALID(stream));
  assert(VALID(format));

  data.stream.in = stream;
  data.closure = closure;
  return TrioScan(&data, 0, TrioInStreamCustom, format, &args, NULL);
}

TRIO_PUBLIC int
trio_cscanfv
TRIO_ARGS4((stream, closure, format, args),
	   trio_instream_t stream,
	   trio_pointer_t closure,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  trio_custom_t data;
  
  assert(VALID(stream));
  assert(VALID(format));

  data.stream.in = stream;
  data.closure = closure;
  return TrioScan(&data, 0, TrioInStreamCustom, format, NULL, args);
}

/*************************************************************************
 * sscanf
 */
TRIO_PUBLIC int
trio_sscanf
TRIO_VARGS3((buffer, format, va_alist),
	    TRIO_CONST char *buffer,
	    TRIO_CONST char *format,
	    TRIO_VA_DECL)
{
  int status;
  va_list args;

  assert(VALID(buffer));
  assert(VALID(format));
  
  TRIO_VA_START(args, format);
  status = TrioScan((trio_pointer_t)&buffer, 0,
		    TrioInStreamString,
		    format, &args, NULL);
  TRIO_VA_END(args);
  return status;
}

TRIO_PUBLIC int
trio_vsscanf
TRIO_ARGS3((buffer, format, args),
	   TRIO_CONST char *buffer,
	   TRIO_CONST char *format,
	   va_list args)
{
  assert(VALID(buffer));
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)&buffer, 0,
		  TrioInStreamString,
		  format, &args, NULL);
}

TRIO_PUBLIC int
trio_sscanfv
TRIO_ARGS3((buffer, format, args),
	   TRIO_CONST char *buffer,
	   TRIO_CONST char *format,
	   trio_pointer_t *args)
{
  assert(VALID(buffer));
  assert(VALID(format));
  
  return TrioScan((trio_pointer_t)&buffer, 0,
		  TrioInStreamString,
		  format, NULL, args);
}

/** @} End of Scanf documentation module */

/*************************************************************************
 * trio_strerror
 */
TRIO_PUBLIC TRIO_CONST char *
trio_strerror
TRIO_ARGS1((errorcode),
	   int errorcode)
{
  /* Textual versions of the error codes */
  switch (TRIO_ERROR_CODE(errorcode))
    {
    case TRIO_EOF:
      return "End of file";
    case TRIO_EINVAL:
      return "Invalid argument";
    case TRIO_ETOOMANY:
      return "Too many arguments";
    case TRIO_EDBLREF:
      return "Double reference";
    case TRIO_EGAP:
      return "Reference gap";
    case TRIO_ENOMEM:
      return "Out of memory";
    case TRIO_ERANGE:
      return "Invalid range";
    case TRIO_ECUSTOM:
      return "Custom error";
    default:
      return "Unknown";
    }
}

Index: avida/current/source/third-party/trio-1.9/trio/trio.h
+++ avida/current/source/third-party/trio-1.9/trio/trio.h
/*************************************************************************
 *
 * $Id: trio.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 *************************************************************************
 *
 * http://ctrio.sourceforge.net/
 *
 ************************************************************************/

#ifndef TRIO_TRIO_H
#define TRIO_TRIO_H

#include <stdio.h>
#include <stdlib.h>
#if defined(TRIO_COMPILER_ANCIENT)
# include <varargs.h>
#else
# include <stdarg.h>
#endif

#if !defined(WITHOUT_TRIO)

/*
 * Use autoconf defines if present. Packages using trio must define
 * HAVE_CONFIG_H as a compiler option themselves.
 */
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif

#include "triodef.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Error codes.
 *
 * Remember to add a textual description to trio_strerror.
 */
enum {
  TRIO_EOF      = 1,
  TRIO_EINVAL   = 2,
  TRIO_ETOOMANY = 3,
  TRIO_EDBLREF  = 4,
  TRIO_EGAP     = 5,
  TRIO_ENOMEM   = 6,
  TRIO_ERANGE   = 7,
  TRIO_ERRNO    = 8,
  TRIO_ECUSTOM  = 9
};

/* Error macros */
#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
#define TRIO_ERROR_NAME(x) trio_strerror(x)

typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));

TRIO_CONST char *trio_strerror TRIO_PROTO((int));

/*************************************************************************
 * Print Functions
 */

int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...));
int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args));

int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));

int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));

int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
			     TRIO_CONST char *format, ...));
int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
			      TRIO_CONST char *format, va_list args));
int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
			      TRIO_CONST char *format, void **args));

int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args));

int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
		   va_list args));
int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
		   void **args));

int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
                      va_list args));

char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));

int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args));

/*************************************************************************
 * Scan Functions
 */
int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args));

int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));

int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));

int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
			    TRIO_CONST char *format, ...));
int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
			     TRIO_CONST char *format, va_list args));
int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
			     TRIO_CONST char *format, void **args));

int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));

/*************************************************************************
 * Locale Functions
 */
void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
void trio_locale_set_grouping TRIO_PROTO((char *grouping));

/*************************************************************************
 * Renaming
 */
#ifdef TRIO_REPLACE_STDIO
/* Replace the <stdio.h> functions */
#ifndef HAVE_PRINTF
# define printf trio_printf
#endif
#ifndef HAVE_VPRINTF
# define vprintf trio_vprintf
#endif
#ifndef HAVE_FPRINTF
# define fprintf trio_fprintf
#endif
#ifndef HAVE_VFPRINTF
# define vfprintf trio_vfprintf
#endif
#ifndef HAVE_SPRINTF
# define sprintf trio_sprintf
#endif
#ifndef HAVE_VSPRINTF
# define vsprintf trio_vsprintf
#endif
#ifndef HAVE_SNPRINTF
# define snprintf trio_snprintf
#endif
#ifndef HAVE_VSNPRINTF
# define vsnprintf trio_vsnprintf
#endif
#ifndef HAVE_SCANF
# define scanf trio_scanf
#endif
#ifndef HAVE_VSCANF
# define vscanf trio_vscanf
#endif
#ifndef HAVE_FSCANF
# define fscanf trio_fscanf
#endif
#ifndef HAVE_VFSCANF
# define vfscanf trio_vfscanf
#endif
#ifndef HAVE_SSCANF
# define sscanf trio_sscanf
#endif
#ifndef HAVE_VSSCANF
# define vsscanf trio_vsscanf
#endif
/* These aren't stdio functions, but we make them look similar */
#define dprintf trio_dprintf
#define vdprintf trio_vdprintf
#define aprintf trio_aprintf
#define vaprintf trio_vaprintf
#define asprintf trio_asprintf
#define vasprintf trio_vasprintf
#define dscanf trio_dscanf
#define vdscanf trio_vdscanf
#endif

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* WITHOUT_TRIO */

#endif /* TRIO_TRIO_H */

Index: avida/current/source/third-party/trio-1.9/trio/trio.pri
+++ avida/current/source/third-party/trio-1.9/trio/trio.pri

trio {
  HEADERS += $$TRIO_H/strio.h \
             $$TRIO_H/trio.h \
             $$TRIO_H/triodef.h \
             $$TRIO_H/trionan.h \
             $$TRIO_H/triop.h \
             $$TRIO_H/triostr.h

  SOURCES += $$TRIO_C/trio.c \
             $$TRIO_C/trionan.c \
             $$TRIO_C/triostr.c
}

Index: avida/current/source/third-party/trio-1.9/trio/triodef.h
+++ avida/current/source/third-party/trio-1.9/trio/triodef.h
/*************************************************************************
 *
 * $Id: triodef.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese <breese at users.sourceforge.net>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

#ifndef TRIO_TRIODEF_H
#define TRIO_TRIODEF_H

/*************************************************************************
 * Platform and compiler support detection
 */
#if defined(__GNUC__)
# define TRIO_COMPILER_GCC
#elif defined(__SUNPRO_C)
# define TRIO_COMPILER_SUNPRO
#elif defined(__SUNPRO_CC)
# define TRIO_COMPILER_SUNPRO
# define __SUNPRO_C __SUNPRO_CC
#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
# define TRIO_COMPILER_XLC
#elif defined(_AIX) && !defined(__GNUC__)
# define TRIO_COMPILER_XLC /* Workaround for old xlc */
#elif defined(__DECC) || defined(__DECCXX)
# define TRIO_COMPILER_DECC
#elif defined(__osf__) && defined(__LANGUAGE_C__)
# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
#elif defined(_MSC_VER)
# define TRIO_COMPILER_MSVC
#elif defined(__BORLANDC__)
# define TRIO_COMPILER_BCB
#endif

#if defined(VMS) || defined(__VMS)
/*
 * VMS is placed first to avoid identifying the platform as Unix
 * based on the DECC compiler later on.
 */
# define TRIO_PLATFORM_VMS
#elif defined(unix) || defined(__unix) || defined(__unix__)
# define TRIO_PLATFORM_UNIX
#elif defined(TRIO_COMPILER_XLC) || defined(_AIX)
# define TRIO_PLATFORM_UNIX
#elif defined(TRIO_COMPILER_DECC) || defined(__osf___)
# define TRIO_PLATFORM_UNIX
#elif defined(__NetBSD__)
# define TRIO_PLATFORM_UNIX
#elif defined(__QNX__)
# define TRIO_PLATFORM_UNIX
# define TRIO_PLATFORM_QNX
#elif defined(__CYGWIN__)
# define TRIO_PLATFORM_UNIX
#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC)
# define TRIO_PLATFORM_UNIX
#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
# define TRIO_PLATFORM_WIN32
#elif defined(mpeix) || defined(__mpexl)
# define TRIO_PLATFORM_MPEIX
#endif

#if defined(_AIX)
# define TRIO_PLATFORM_AIX
#elif defined(__hpux)
# define TRIO_PLATFORM_HPUX
#endif

#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC)
# define TRIO_COMPILER_SUPPORTS_C89
# if defined(__STDC_VERSION__)
#  define TRIO_COMPILER_SUPPORTS_C90
#  if (__STDC_VERSION__ >= 199409L)
#   define TRIO_COMPILER_SUPPORTS_C94
#  endif
#  if (__STDC_VERSION__ >= 199901L)
#   define TRIO_COMPILER_SUPPORTS_C99
#  endif
# elif defined(TRIO_COMPILER_SUNPRO)
#  if (__SUNPRO_C >= 0x420)
#   define TRIO_COMPILER_SUPPORTS_C94
#  endif
# endif
#endif

#if defined(_XOPEN_SOURCE)
# if defined(_XOPEN_SOURCE_EXTENDED)
#  define TRIO_COMPILER_SUPPORTS_UNIX95
# endif
# if (_XOPEN_VERSION >= 500)
#  define TRIO_COMPILER_SUPPORTS_UNIX98
# endif
# if (_XOPEN_VERSION >= 600)
#  define TRIO_COMPILER_SUPPORTS_UNIX01
# endif
#endif

/*************************************************************************
 * Generic defines
 */

#if !defined(TRIO_PUBLIC)
# define TRIO_PUBLIC
#endif
#if !defined(TRIO_PRIVATE)
# define TRIO_PRIVATE static
#endif

#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus))
# define TRIO_COMPILER_ANCIENT
#endif

#if defined(TRIO_COMPILER_ANCIENT)
# define TRIO_CONST
# define TRIO_VOLATILE
# define TRIO_SIGNED
typedef double trio_long_double_t;
typedef char * trio_pointer_t;
# define TRIO_SUFFIX_LONG(x) x
# define TRIO_PROTO(x) ()
# define TRIO_NOARGS
# define TRIO_ARGS1(list,a1) list a1;
# define TRIO_ARGS2(list,a1,a2) list a1; a2;
# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
# define TRIO_VARGS2(list,a1,a2) list a1; a2
# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
# define TRIO_VA_DECL va_dcl
# define TRIO_VA_START(x,y) va_start((x))
# define TRIO_VA_END(x) va_end(x)
#else /* ANSI C */
# define TRIO_CONST const
# define TRIO_VOLATILE volatile
# define TRIO_SIGNED signed
/* XXX:  change by kaben to ensure consistency between newer and older
 * compilers many of which don't support long double.
 */
//typedef long double trio_long_double_t;
typedef double trio_long_double_t;
/* XXX - kgn */
typedef void * trio_pointer_t;
# define TRIO_SUFFIX_LONG(x) x ## L
# define TRIO_PROTO(x) x
# define TRIO_NOARGS void
# define TRIO_ARGS1(list,a1) (a1)
# define TRIO_ARGS2(list,a1,a2) (a1,a2)
# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
# define TRIO_VARGS2 TRIO_ARGS2
# define TRIO_VARGS3 TRIO_ARGS3
# define TRIO_VARGS4 TRIO_ARGS4
# define TRIO_VARGS5 TRIO_ARGS5
# define TRIO_VA_DECL ...
# define TRIO_VA_START(x,y) va_start((x),(y))
# define TRIO_VA_END(x) va_end(x)
#endif

#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
# define TRIO_INLINE inline
#elif defined(TRIO_COMPILER_GCC)
# define TRIO_INLINE __inline__
#elif defined(TRIO_COMPILER_MSVC)
# define TRIO_INLINE _inline
#elif defined(TRIO_COMPILER_BCB)
# define TRIO_INLINE __inline
#else
# define TRIO_INLINE
#endif

/*************************************************************************
 * Workarounds
 */

#if defined(TRIO_PLATFORM_VMS)
/*
 * Computations done with constants at compile time can trigger these
 * even when compiling with IEEE enabled.
 */
# pragma message disable (UNDERFLOW, FLOATOVERFL)

# if (__CRTL_VER > 80000000)
/*
 * Although the compiler supports C99 language constructs, the C
 * run-time library does not contain all C99 functions.
 *
 * This was the case for 70300022. Update the 80000000 value when
 * it has been accurately determined what version of the library
 * supports C99.
 */
#  if defined(TRIO_COMPILER_SUPPORTS_C99)
#   undef TRIO_COMPILER_SUPPORTS_C99
#  endif
# endif
#endif

#endif /* TRIO_TRIODEF_H */

Index: avida/current/source/third-party/trio-1.9/trio/trionan.c
+++ avida/current/source/third-party/trio-1.9/trio/trionan.c
/*************************************************************************
 *
 * $Id: trionan.c,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese <breese at users.sourceforge.net>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************
 *
 * Functions to handle special quantities in floating-point numbers
 * (that is, NaNs and infinity). They provide the capability to detect
 * and fabricate special quantities.
 *
 * Although written to be as portable as possible, it can never be
 * guaranteed to work on all platforms, as not all hardware supports
 * special quantities.
 *
 * The approach used here (approximately) is to:
 *
 *   1. Use C99 functionality when available.
 *   2. Use IEEE 754 bit-patterns if possible.
 *   3. Use platform-specific techniques.
 *
 ************************************************************************/

/*
 * TODO:
 *  o Put all the magic into trio_fpclassify_and_signbit(), and use this from
 *    trio_isnan() etc.
 */

/*************************************************************************
 * Include files
 */
#include "triodef.h"
#include "trionan.h"

#include <math.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#if defined(TRIO_PLATFORM_UNIX)
# include <signal.h>
#endif
#if defined(TRIO_COMPILER_DECC)
# include <fp_class.h>
#endif
#include <assert.h>

#if defined(TRIO_DOCUMENTATION)
# include "doc/doc_nan.h"
#endif
/** @addtogroup SpecialQuantities
    @{
*/

/*************************************************************************
 * Definitions
 */

#define TRIO_TRUE (1 == 1)
#define TRIO_FALSE (0 == 1)

/* We must enable IEEE floating-point on Alpha */
#if defined(__alpha) && !defined(_IEEE_FP)
# if defined(TRIO_COMPILER_DECC)
#  if defined(TRIO_PLATFORM_VMS)
#   error "Must be compiled with option /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE"
#  else
#   if !defined(_CFE)
#    error "Must be compiled with option -ieee"
#   endif
#  endif
# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__))
#  error "Must be compiled with option -mieee"
# endif
#endif /* __alpha && ! _IEEE_FP */

/*
 * In ANSI/IEEE 754-1985 64-bits double format numbers have the
 * following properties (amoungst others)
 *
 *   o FLT_RADIX == 2: binary encoding
 *   o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used
 *     to indicate special numbers (e.g. NaN and Infinity), so the
 *     maximum exponent is 10 bits wide (2^10 == 1024).
 *   o DBL_MANT_DIG == 53: The mantissa is 52 bits wide, but because
 *     numbers are normalized the initial binary 1 is represented
 *     implicitly (the so-called "hidden bit"), which leaves us with
 *     the ability to represent 53 bits wide mantissa.
 */
#if (FLT_RADIX == 2) && (DBL_MAX_EXP == 1024) && (DBL_MANT_DIG == 53)
# define USE_IEEE_754
#endif


/*************************************************************************
 * Constants
 */

static TRIO_CONST char rcsid[] = "@(#)$Id: trionan.c,v 1.1 2003/11/25 18:20:49 kaben Exp $";

#if defined(USE_IEEE_754)

/*
 * Endian-agnostic indexing macro.
 *
 * The value of internalEndianMagic, when converted into a 64-bit
 * integer, becomes 0x0706050403020100 (we could have used a 64-bit
 * integer value instead of a double, but not all platforms supports
 * that type). The value is automatically encoded with the correct
 * endianess by the compiler, which means that we can support any
 * kind of endianess. The individual bytes are then used as an index
 * for the IEEE 754 bit-patterns and masks.
 */
#define TRIO_DOUBLE_INDEX(x) (((unsigned char *)&internalEndianMagic)[7-(x)])

static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275;

/* Mask for the exponent */
static TRIO_CONST unsigned char ieee_754_exponent_mask[] = {
  0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

/* Mask for the mantissa */
static TRIO_CONST unsigned char ieee_754_mantissa_mask[] = {
  0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};

/* Mask for the sign bit */
static TRIO_CONST unsigned char ieee_754_sign_mask[] = {
  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

/* Bit-pattern for negative zero */
static TRIO_CONST unsigned char ieee_754_negzero_array[] = {
  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

/* Bit-pattern for infinity */
static TRIO_CONST unsigned char ieee_754_infinity_array[] = {
  0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

/* Bit-pattern for quiet NaN */
static TRIO_CONST unsigned char ieee_754_qnan_array[] = {
  0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};


/*************************************************************************
 * Functions
 */

/*
 * trio_make_double
 */
TRIO_PRIVATE double
trio_make_double
TRIO_ARGS1((values),
	   TRIO_CONST unsigned char *values)
{
  TRIO_VOLATILE double result;
  int i;

  for (i = 0; i < (int)sizeof(double); i++) {
    ((TRIO_VOLATILE unsigned char *)&result)[TRIO_DOUBLE_INDEX(i)] = values[i];
  }
  return result;
}

/*
 * trio_is_special_quantity
 */
TRIO_PRIVATE int
trio_is_special_quantity
TRIO_ARGS2((number, has_mantissa),
	   double number,
	   int *has_mantissa)
{
  unsigned int i;
  unsigned char current;
  int is_special_quantity = TRIO_TRUE;

  *has_mantissa = 0;

  for (i = 0; i < (unsigned int)sizeof(double); i++) {
    current = ((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)];
    is_special_quantity
      &= ((current & ieee_754_exponent_mask[i]) == ieee_754_exponent_mask[i]);
    *has_mantissa |= (current & ieee_754_mantissa_mask[i]);
  }
  return is_special_quantity;
}

/*
 * trio_is_negative
 */
TRIO_PRIVATE int
trio_is_negative
TRIO_ARGS1((number),
	   double number)
{
  unsigned int i;
  int is_negative = TRIO_FALSE;

  for (i = 0; i < (unsigned int)sizeof(double); i++) {
    is_negative |= (((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)]
		    & ieee_754_sign_mask[i]);
  }
  return is_negative;
}

#endif /* USE_IEEE_754 */


/**
   Generate negative zero.

   @return Floating-point representation of negative zero.
*/
TRIO_PUBLIC double
trio_nzero(TRIO_NOARGS)
{
#if defined(USE_IEEE_754)
  return trio_make_double(ieee_754_negzero_array);
#else
  TRIO_VOLATILE double zero = 0.0;

  return -zero;
#endif
}

/**
   Generate positive infinity.

   @return Floating-point representation of positive infinity.
*/
TRIO_PUBLIC double
trio_pinf(TRIO_NOARGS)
{
  /* Cache the result */
  static double result = 0.0;

  if (result == 0.0) {
    
#if defined(INFINITY) && defined(__STDC_IEC_559__)
    result = (double)INFINITY;

#elif defined(USE_IEEE_754)
    result = trio_make_double(ieee_754_infinity_array);

#else
    /*
     * If HUGE_VAL is different from DBL_MAX, then HUGE_VAL is used
     * as infinity. Otherwise we have to resort to an overflow
     * operation to generate infinity.
     */
# if defined(TRIO_PLATFORM_UNIX)
    void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
# endif

    result = HUGE_VAL;
    if (HUGE_VAL == DBL_MAX) {
      /* Force overflow */
      result += HUGE_VAL;
    }
    
# if defined(TRIO_PLATFORM_UNIX)
    signal(SIGFPE, signal_handler);
# endif

#endif
  }
  return result;
}

/**
   Generate negative infinity.

   @return Floating-point value of negative infinity.
*/
TRIO_PUBLIC double
trio_ninf(TRIO_NOARGS)
{
  static double result = 0.0;

  if (result == 0.0) {
    /*
     * Negative infinity is calculated by negating positive infinity,
     * which can be done because it is legal to do calculations on
     * infinity (for example,  1 / infinity == 0).
     */
    result = -trio_pinf();
  }
  return result;
}

/**
   Generate NaN.

   @return Floating-point representation of NaN.
*/
TRIO_PUBLIC double
trio_nan(TRIO_NOARGS)
{
  /* Cache the result */
  static double result = 0.0;

  if (result == 0.0) {
    
#if defined(TRIO_COMPILER_SUPPORTS_C99)
    result = nan("");

#elif defined(NAN) && defined(__STDC_IEC_559__)
    result = (double)NAN;
  
#elif defined(USE_IEEE_754)
    result = trio_make_double(ieee_754_qnan_array);

#else
    /*
     * There are several ways to generate NaN. The one used here is
     * to divide infinity by infinity. I would have preferred to add
     * negative infinity to positive infinity, but that yields wrong
     * result (infinity) on FreeBSD.
     *
     * This may fail if the hardware does not support NaN, or if
     * the Invalid Operation floating-point exception is unmasked.
     */
# if defined(TRIO_PLATFORM_UNIX)
    void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
# endif
    
    result = trio_pinf() / trio_pinf();
    
# if defined(TRIO_PLATFORM_UNIX)
    signal(SIGFPE, signal_handler);
# endif
    
#endif
  }
  return result;
}

/**
   Check for NaN.

   @param number An arbitrary floating-point number.
   @return Boolean value indicating whether or not the number is a NaN.
*/
TRIO_PUBLIC int
trio_isnan
TRIO_ARGS1((number),
	   double number)
{
#if (defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isnan)) \
 || defined(TRIO_COMPILER_SUPPORTS_UNIX95)
  /*
   * C99 defines isnan() as a macro. UNIX95 defines isnan() as a
   * function. This function was already present in XPG4, but this
   * is a bit tricky to detect with compiler defines, so we choose
   * the conservative approach and only use it for UNIX95.
   */
  return isnan(number);
  
#elif defined(TRIO_COMPILER_MSVC)
  /*
   * MSVC has an _isnan() function
   */
  return _isnan(number);

#elif defined(USE_IEEE_754)
  /*
   * Examine IEEE 754 bit-pattern. A NaN must have a special exponent
   * pattern, and a non-empty mantissa.
   */
  int has_mantissa;
  int is_special_quantity;

  is_special_quantity = trio_is_special_quantity(number, &has_mantissa);
  
  return (is_special_quantity && has_mantissa);
  
#else
  /*
   * Fallback solution
   */
  int status;
  double integral, fraction;
  
# if defined(TRIO_PLATFORM_UNIX)
  void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
# endif
  
  status = (/*
	     * NaN is the only number which does not compare to itself
	     */
	    ((TRIO_VOLATILE double)number != (TRIO_VOLATILE double)number) ||
	    /*
	     * Fallback solution if NaN compares to NaN
	     */
	    ((number != 0.0) &&
	     (fraction = modf(number, &integral),
	      integral == fraction)));
  
# if defined(TRIO_PLATFORM_UNIX)
  signal(SIGFPE, signal_handler);
# endif
  
  return status;
  
#endif
}

/**
   Check for infinity.

   @param number An arbitrary floating-point number.
   @return 1 if positive infinity, -1 if negative infinity, 0 otherwise.
*/
TRIO_PUBLIC int
trio_isinf
TRIO_ARGS1((number),
	   double number)
{
#if defined(TRIO_COMPILER_DECC)
  /*
   * DECC has an isinf() macro, but it works differently than that
   * of C99, so we use the fp_class() function instead.
   */
  return ((fp_class(number) == FP_POS_INF)
	  ? 1
	  : ((fp_class(number) == FP_NEG_INF) ? -1 : 0));

#elif defined(isinf)
  /*
   * C99 defines isinf() as a macro.
   */
  return isinf(number)
    ? ((number > 0.0) ? 1 : -1)
    : 0;
  
#elif defined(TRIO_COMPILER_MSVC)
  /*
   * MSVC has an _fpclass() function that can be used to detect infinity.
   */
  return ((_fpclass(number) == _FPCLASS_PINF)
	  ? 1
	  : ((_fpclass(number) == _FPCLASS_NINF) ? -1 : 0));

#elif defined(USE_IEEE_754)
  /*
   * Examine IEEE 754 bit-pattern. Infinity must have a special exponent
   * pattern, and an empty mantissa.
   */
  int has_mantissa;
  int is_special_quantity;

  is_special_quantity = trio_is_special_quantity(number, &has_mantissa);
  
  return (is_special_quantity && !has_mantissa)
    ? ((number < 0.0) ? -1 : 1)
    : 0;

#else
  /*
   * Fallback solution.
   */
  int status;
  
# if defined(TRIO_PLATFORM_UNIX)
  void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
# endif
  
  double infinity = trio_pinf();
  
  status = ((number == infinity)
	    ? 1
	    : ((number == -infinity) ? -1 : 0));
  
# if defined(TRIO_PLATFORM_UNIX)
  signal(SIGFPE, signal_handler);
# endif
  
  return status;
  
#endif
}


/**
   Check for finity.

   @param number An arbitrary floating-point number.
   @return Boolean value indicating whether or not the number is a finite.
*/
TRIO_PUBLIC int
trio_isfinite
TRIO_ARGS1((number),
	   double number)
{
#if defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isfinite)
  /*
   * C99 defines isfinite() as a macro.
   */
  return isfinite(number);
  
#elif defined(TRIO_COMPILER_MSVC)
  /*
   * MSVC uses _finite().
   */
  return _finite(number);

#elif defined(USE_IEEE_754)
  /*
   * Examine IEEE 754 bit-pattern. For finity we do not care about the
   * mantissa.
   */
  int dummy;

  return (! trio_is_special_quantity(number, &dummy));

#else
  /*
   * Fallback solution.
   */
  return ((trio_isinf(number) == 0) && (trio_isnan(number) == 0));
  
#endif
}

/*
 * The sign of NaN is always false
 */
TRIO_PUBLIC int
trio_fpclassify_and_signbit
TRIO_ARGS2((number, is_negative),
	   double number,
	   int *is_negative)
{
#if defined(fpclassify) && defined(signbit)
  /*
   * C99 defines fpclassify() and signbit() as a macros
   */
  *is_negative = signbit(number);
  switch (fpclassify(number)) {
  case FP_NAN:
    return TRIO_FP_NAN;
  case FP_INFINITE:
    return TRIO_FP_INFINITE;
  case FP_SUBNORMAL:
    return TRIO_FP_SUBNORMAL;
  case FP_ZERO:
    return TRIO_FP_ZERO;
  default:
    return TRIO_FP_NORMAL;
  }

#elif defined(TRIO_COMPILER_DECC)
  /*
   * DECC has an fp_class() function.
   */
  switch (fp_class(number)) {
  case FP_QNAN:
  case FP_SNAN:
    *is_negative = TRIO_FALSE; /* NaN has no sign */
    return TRIO_FP_NAN;
  case FP_POS_INF:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_INFINITE;
  case FP_NEG_INF:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_INFINITE;
  case FP_POS_DENORM:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_SUBNORMAL;
  case FP_NEG_DENORM:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_SUBNORMAL;
  case FP_POS_ZERO:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_ZERO;
  case FP_NEG_ZERO:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_ZERO;
  case FP_POS_NORM:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_NORMAL;
  case FP_NEG_NORM:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_NORMAL;
  default:
    /* Just in case... */
    *is_negative = (number < 0.0);
    return TRIO_FP_NORMAL;
  }

#elif defined(TRIO_COMPILER_MSVC)
  /*
   * MSVC has an _fpclass() function.
   */
  switch (_fpclass(number)) {
  case _FPCLASS_QNAN:
  case _FPCLASS_SNAN:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_NAN;
  case _FPCLASS_PINF:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_INFINITE;
  case _FPCLASS_NINF:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_INFINITE;
  case _FPCLASS_PD:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_SUBNORMAL;
  case _FPCLASS_ND:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_SUBNORMAL;
  case _FPCLASS_PZ:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_ZERO;
  case _FPCLASS_NZ:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_ZERO;
  case _FPCLASS_PN:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_NORMAL;
  case _FPCLASS_NN:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_NORMAL;
  default:
    /* Just in case... */
    *is_negative = (number < 0.0);
    return TRIO_FP_NORMAL;
  }

#elif defined(FP_PLUS_NORM)

  /*
   * HP-UX 9.x and 10.x have an fpclassify() function, that is different
   * from the C99 fpclassify() macro supported on HP-UX 11.x.
   *
   * AIX has class() for C, and _class() for C++, which returns the
   * same values as the HP-UX fpclassify() function.
   */
  
# if defined(TRIO_PLATFORM_AIX)
#  if defined(__cplusplus)
#   define fpclassify(x) _class(x)
#  else
#   define fpclassify(x) class(x)
#  endif
# endif
  
  switch (fpclassify(number)) {
  case FP_QNAN:
  case FP_SNAN:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_NAN;
  case FP_PLUS_INF:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_INFINITE;
  case FP_MINUS_INF:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_INFINITE;
  case FP_PLUS_DENORM:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_SUBNORMAL;
  case FP_MINUS_DENORM:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_SUBNORMAL;
  case FP_PLUS_ZERO:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_ZERO;
  case FP_MINUS_ZERO:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_ZERO;
  case FP_PLUS_NORM:
    *is_negative = TRIO_FALSE;
    return TRIO_FP_NORMAL;
  case FP_MINUS_NORM:
    *is_negative = TRIO_TRUE;
    return TRIO_FP_NORMAL;
  default:
    assert(0);
  }

#else
  /*
   * Fallback solution.
   */
  int rc;
  
  if (number == 0.0) {
    /*
     * In IEEE 754 the sign of zero is ignored in comparisons, so we
     * have to handle this as a special case by examining the sign bit
     * directly.
     */
#if defined(USE_IEEE_754)
    *is_negative = trio_is_negative(number);
#else
    *is_negative = TRIO_FALSE; /* FIXME */
#endif
    return TRIO_FP_ZERO;
  }
  if (trio_isnan(number)) {
    *is_negative = TRIO_FALSE;
    return TRIO_FP_NAN;
  }
  if ((rc = trio_isinf(number))) {
    *is_negative = (rc == -1);
    return TRIO_FP_INFINITE;
  }
  if ((number > 0.0) && (number < DBL_MIN)) {
    *is_negative = TRIO_FALSE;
    return TRIO_FP_SUBNORMAL;
  }
  if ((number < 0.0) && (number > -DBL_MIN)) {
    *is_negative = TRIO_TRUE;
    return TRIO_FP_SUBNORMAL;
  }
  *is_negative = (number < 0.0);
  return TRIO_FP_NORMAL;
  
#endif
}

/**
   Examine the sign of a number.

   @param number An arbitrary floating-point number.
   @return Boolean value indicating whether or not the number has the
   sign bit set (i.e. is negative).
*/
TRIO_PUBLIC int
trio_signbit
TRIO_ARGS1((number),
	   double number)
{
  int is_negative;
  
  (void)trio_fpclassify_and_signbit(number, &is_negative);
  return is_negative;
}

/**
   Examine the class of a number.

   @param number An arbitrary floating-point number.
   @return Enumerable value indicating the class of @p number
*/
TRIO_PUBLIC int
trio_fpclassify
TRIO_ARGS1((number),
	   double number)
{
  int dummy;
  
  return trio_fpclassify_and_signbit(number, &dummy);
}


/** @} SpecialQuantities */

/*************************************************************************
 * For test purposes.
 *
 * Add the following compiler option to include this test code.
 *
 *  Unix : -DSTANDALONE
 *  VMS  : /DEFINE=(STANDALONE)
 */
#if defined(STANDALONE)
# include <stdio.h>

static TRIO_CONST char *
getClassification
TRIO_ARGS1((type),
	   int type)
{
  switch (type) {
  case TRIO_FP_INFINITE:
    return "FP_INFINITE";
  case TRIO_FP_NAN:
    return "FP_NAN";
  case TRIO_FP_NORMAL:
    return "FP_NORMAL";
  case TRIO_FP_SUBNORMAL:
    return "FP_SUBNORMAL";
  case TRIO_FP_ZERO:
    return "FP_ZERO";
  default:
    return "FP_UNKNOWN";
  }
}

static void
print_class
TRIO_ARGS2((prefix, number),
	   TRIO_CONST char *prefix,
	   double number)
{
  printf("%-6s: %s %-15s %g\n",
	 prefix,
	 trio_signbit(number) ? "-" : "+",
	 getClassification(trio_fpclassify(number)),
	 number);
}

int main(TRIO_NOARGS)
{
  double my_nan;
  double my_pinf;
  double my_ninf;
# if defined(TRIO_PLATFORM_UNIX)
  void (*signal_handler) TRIO_PROTO((int));
# endif

  my_nan = trio_nan();
  my_pinf = trio_pinf();
  my_ninf = trio_ninf();

  print_class("Nan", my_nan);
  print_class("PInf", my_pinf);
  print_class("NInf", my_ninf);
  print_class("PZero", 0.0);
  print_class("NZero", -0.0);
  print_class("PNorm", 1.0);
  print_class("NNorm", -1.0);
  print_class("PSub", 1.01e-307 - 1.00e-307);
  print_class("NSub", 1.00e-307 - 1.01e-307);
  
  printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
	 my_nan,
	 ((unsigned char *)&my_nan)[0],
	 ((unsigned char *)&my_nan)[1],
	 ((unsigned char *)&my_nan)[2],
	 ((unsigned char *)&my_nan)[3],
	 ((unsigned char *)&my_nan)[4],
	 ((unsigned char *)&my_nan)[5],
	 ((unsigned char *)&my_nan)[6],
	 ((unsigned char *)&my_nan)[7],
	 trio_isnan(my_nan), trio_isinf(my_nan));
  printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
	 my_pinf,
	 ((unsigned char *)&my_pinf)[0],
	 ((unsigned char *)&my_pinf)[1],
	 ((unsigned char *)&my_pinf)[2],
	 ((unsigned char *)&my_pinf)[3],
	 ((unsigned char *)&my_pinf)[4],
	 ((unsigned char *)&my_pinf)[5],
	 ((unsigned char *)&my_pinf)[6],
	 ((unsigned char *)&my_pinf)[7],
	 trio_isnan(my_pinf), trio_isinf(my_pinf));
  printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
	 my_ninf,
	 ((unsigned char *)&my_ninf)[0],
	 ((unsigned char *)&my_ninf)[1],
	 ((unsigned char *)&my_ninf)[2],
	 ((unsigned char *)&my_ninf)[3],
	 ((unsigned char *)&my_ninf)[4],
	 ((unsigned char *)&my_ninf)[5],
	 ((unsigned char *)&my_ninf)[6],
	 ((unsigned char *)&my_ninf)[7],
	 trio_isnan(my_ninf), trio_isinf(my_ninf));
  
# if defined(TRIO_PLATFORM_UNIX)
  signal_handler = signal(SIGFPE, SIG_IGN);
# endif
  
  my_pinf = DBL_MAX + DBL_MAX;
  my_ninf = -my_pinf;
  my_nan = my_pinf / my_pinf;

# if defined(TRIO_PLATFORM_UNIX)
  signal(SIGFPE, signal_handler);
# endif
  
  printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
	 my_nan,
	 ((unsigned char *)&my_nan)[0],
	 ((unsigned char *)&my_nan)[1],
	 ((unsigned char *)&my_nan)[2],
	 ((unsigned char *)&my_nan)[3],
	 ((unsigned char *)&my_nan)[4],
	 ((unsigned char *)&my_nan)[5],
	 ((unsigned char *)&my_nan)[6],
	 ((unsigned char *)&my_nan)[7],
	 trio_isnan(my_nan), trio_isinf(my_nan));
  printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
	 my_pinf,
	 ((unsigned char *)&my_pinf)[0],
	 ((unsigned char *)&my_pinf)[1],
	 ((unsigned char *)&my_pinf)[2],
	 ((unsigned char *)&my_pinf)[3],
	 ((unsigned char *)&my_pinf)[4],
	 ((unsigned char *)&my_pinf)[5],
	 ((unsigned char *)&my_pinf)[6],
	 ((unsigned char *)&my_pinf)[7],
	 trio_isnan(my_pinf), trio_isinf(my_pinf));
  printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
	 my_ninf,
	 ((unsigned char *)&my_ninf)[0],
	 ((unsigned char *)&my_ninf)[1],
	 ((unsigned char *)&my_ninf)[2],
	 ((unsigned char *)&my_ninf)[3],
	 ((unsigned char *)&my_ninf)[4],
	 ((unsigned char *)&my_ninf)[5],
	 ((unsigned char *)&my_ninf)[6],
	 ((unsigned char *)&my_ninf)[7],
	 trio_isnan(my_ninf), trio_isinf(my_ninf));
	 
  return 0;
}
#endif

Index: avida/current/source/third-party/trio-1.9/trio/trionan.h
+++ avida/current/source/third-party/trio-1.9/trio/trionan.h
/*************************************************************************
 *
 * $Id: trionan.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese <breese at users.sourceforge.net>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

#ifndef TRIO_NAN_H
#define TRIO_NAN_H

#include "triodef.h"

#ifdef __cplusplus
extern "C" {
#endif

enum {
  TRIO_FP_INFINITE,
  TRIO_FP_NAN,
  TRIO_FP_NORMAL,
  TRIO_FP_SUBNORMAL,
  TRIO_FP_ZERO
};

/*
 * Return NaN (Not-a-Number).
 */
TRIO_PUBLIC double trio_nan TRIO_PROTO((void));

/*
 * Return positive infinity.
 */
TRIO_PUBLIC double trio_pinf TRIO_PROTO((void));

/*
 * Return negative infinity.
 */
TRIO_PUBLIC double trio_ninf TRIO_PROTO((void));
  
/*
 * Return negative zero.
 */
TRIO_PUBLIC double trio_nzero TRIO_PROTO((TRIO_NOARGS));

/*
 * If number is a NaN return non-zero, otherwise return zero.
 */
TRIO_PUBLIC int trio_isnan TRIO_PROTO((double number));

/*
 * If number is positive infinity return 1, if number is negative
 * infinity return -1, otherwise return 0.
 */
TRIO_PUBLIC int trio_isinf TRIO_PROTO((double number));

/*
 * If number is finite return non-zero, otherwise return zero.
 */
TRIO_PUBLIC int trio_isfinite TRIO_PROTO((double number));

TRIO_PUBLIC int trio_signbit TRIO_PROTO((double number));

TRIO_PUBLIC int trio_fpclassify TRIO_PROTO((double number));

TRIO_PUBLIC int trio_fpclassify_and_signbit TRIO_PROTO((double number, int *is_negative));

#ifdef __cplusplus
}
#endif

#endif /* TRIO_NAN_H */

Index: avida/current/source/third-party/trio-1.9/trio/triop.h
+++ avida/current/source/third-party/trio-1.9/trio/triop.h
/*************************************************************************
 *
 * $Id: triop.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************
 *
 * Private functions, types, etc. used for callback functions.
 *
 * The ref pointer is an opaque type and should remain as such.
 * Private data must only be accessible through the getter and
 * setter functions.
 *
 ************************************************************************/

#ifndef TRIO_TRIOP_H
#define TRIO_TRIOP_H

#include "triodef.h"

#include <stdlib.h>
#if defined(TRIO_COMPILER_ANCIENT)
# include <varargs.h>
#else
# include <stdarg.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifndef TRIO_C99
# define TRIO_C99 1
#endif
#ifndef TRIO_BSD
# define TRIO_BSD 1
#endif
#ifndef TRIO_GNU
# define TRIO_GNU 1
#endif
#ifndef TRIO_MISC
# define TRIO_MISC 1
#endif
#ifndef TRIO_UNIX98
# define TRIO_UNIX98 1
#endif
#ifndef TRIO_MICROSOFT
# define TRIO_MICROSOFT 1
#endif
#ifndef TRIO_EXTENSION
# define TRIO_EXTENSION 1
#endif
#ifndef TRIO_WIDECHAR /* Does not work yet. Do not enable */
# define TRIO_WIDECHAR 0
#endif
#ifndef TRIO_ERRORS
# define TRIO_ERRORS 1
#endif

#ifndef TRIO_MALLOC
# define TRIO_MALLOC(n) malloc(n)
#endif
#ifndef TRIO_REALLOC
# define TRIO_REALLOC(x,n) realloc((x),(n))
#endif
#ifndef TRIO_FREE
# define TRIO_FREE(x) free(x)
#endif


/*************************************************************************
 * User-defined specifiers
 */

typedef int (*trio_callback_t) TRIO_PROTO((trio_pointer_t));

trio_pointer_t trio_register TRIO_PROTO((trio_callback_t callback, const char *name));
void trio_unregister TRIO_PROTO((trio_pointer_t handle));

TRIO_CONST char *trio_get_format TRIO_PROTO((trio_pointer_t ref));
trio_pointer_t trio_get_argument TRIO_PROTO((trio_pointer_t ref));

/* Modifiers */
int  trio_get_width TRIO_PROTO((trio_pointer_t ref));
void trio_set_width TRIO_PROTO((trio_pointer_t ref, int width));
int  trio_get_precision TRIO_PROTO((trio_pointer_t ref));
void trio_set_precision TRIO_PROTO((trio_pointer_t ref, int precision));
int  trio_get_base TRIO_PROTO((trio_pointer_t ref));
void trio_set_base TRIO_PROTO((trio_pointer_t ref, int base));
int  trio_get_padding TRIO_PROTO((trio_pointer_t ref));
void trio_set_padding TRIO_PROTO((trio_pointer_t ref, int is_padding));
int  trio_get_short TRIO_PROTO((trio_pointer_t ref)); /* h */
void trio_set_shortshort TRIO_PROTO((trio_pointer_t ref, int is_shortshort));
int  trio_get_shortshort TRIO_PROTO((trio_pointer_t ref)); /* hh */
void trio_set_short TRIO_PROTO((trio_pointer_t ref, int is_short));
int  trio_get_long TRIO_PROTO((trio_pointer_t ref)); /* l */
void trio_set_long TRIO_PROTO((trio_pointer_t ref, int is_long));
int  trio_get_longlong TRIO_PROTO((trio_pointer_t ref)); /* ll */
void trio_set_longlong TRIO_PROTO((trio_pointer_t ref, int is_longlong));
int  trio_get_longdouble TRIO_PROTO((trio_pointer_t ref)); /* L */
void trio_set_longdouble TRIO_PROTO((trio_pointer_t ref, int is_longdouble));
int  trio_get_alternative TRIO_PROTO((trio_pointer_t ref)); /* # */
void trio_set_alternative TRIO_PROTO((trio_pointer_t ref, int is_alternative));
int  trio_get_alignment TRIO_PROTO((trio_pointer_t ref)); /* - */
void trio_set_alignment TRIO_PROTO((trio_pointer_t ref, int is_leftaligned));
int  trio_get_spacing TRIO_PROTO((trio_pointer_t ref)); /*  TRIO_PROTO((space) */
void trio_set_spacing TRIO_PROTO((trio_pointer_t ref, int is_space));
int  trio_get_sign TRIO_PROTO((trio_pointer_t ref)); /* + */
void trio_set_sign TRIO_PROTO((trio_pointer_t ref, int is_showsign));
int  trio_get_quote TRIO_PROTO((trio_pointer_t ref)); /* ' */
void trio_set_quote TRIO_PROTO((trio_pointer_t ref, int is_quote));
int  trio_get_upper TRIO_PROTO((trio_pointer_t ref));
void trio_set_upper TRIO_PROTO((trio_pointer_t ref, int is_upper));
#if TRIO_C99
int  trio_get_largest TRIO_PROTO((trio_pointer_t ref)); /* j */
void trio_set_largest TRIO_PROTO((trio_pointer_t ref, int is_largest));
int  trio_get_ptrdiff TRIO_PROTO((trio_pointer_t ref)); /* t */
void trio_set_ptrdiff TRIO_PROTO((trio_pointer_t ref, int is_ptrdiff));
int  trio_get_size TRIO_PROTO((trio_pointer_t ref)); /* z / Z */
void trio_set_size TRIO_PROTO((trio_pointer_t ref, int is_size));
#endif

/* Printing */
int trio_print_ref TRIO_PROTO((trio_pointer_t ref, const char *format, ...));
int trio_vprint_ref TRIO_PROTO((trio_pointer_t ref, const char *format, va_list args));
int trio_printv_ref TRIO_PROTO((trio_pointer_t ref, const char *format, trio_pointer_t *args));

void trio_print_int TRIO_PROTO((trio_pointer_t ref, int number));
void trio_print_uint TRIO_PROTO((trio_pointer_t ref, unsigned int number));
/*  void trio_print_long TRIO_PROTO((trio_pointer_t ref, long number)); */
/*  void trio_print_ulong TRIO_PROTO((trio_pointer_t ref, unsigned long number)); */
void trio_print_double TRIO_PROTO((trio_pointer_t ref, double number));
void trio_print_string TRIO_PROTO((trio_pointer_t ref, char *string));
void trio_print_pointer TRIO_PROTO((trio_pointer_t ref, trio_pointer_t pointer));

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* TRIO_TRIOP_H */

Index: avida/current/source/third-party/trio-1.9/trio/triostr.c
+++ avida/current/source/third-party/trio-1.9/trio/triostr.c
/*************************************************************************
 *
 * $Id: triostr.c,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/*************************************************************************
 * Include files
 */

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "triodef.h"
#include "triostr.h"

/*************************************************************************
 * Definitions
 */

#if !defined(TRIO_STRING_PUBLIC)
# define TRIO_STRING_PUBLIC TRIO_PUBLIC
#endif
#if !defined(TRIO_STRING_PRIVATE)
# define TRIO_STRING_PRIVATE TRIO_PRIVATE
#endif

#if !defined(NULL)
# define NULL 0
#endif
#if !defined(NIL)
# define NIL ((char)0)
#endif
#if !defined(FALSE)
# define FALSE (1 == 0)
# define TRUE (! FALSE)
#endif
#if !defined(BOOLEAN_T)
# define BOOLEAN_T int
#endif

#if defined(TRIO_COMPILER_SUPPORTS_C99)
# define USE_STRTOD
# define USE_STRTOF
#elif defined(TRIO_COMPILER_MSVC)
# define USE_STRTOD
#endif

#if defined(TRIO_PLATFORM_UNIX)
# define USE_STRCASECMP
# define USE_STRNCASECMP
# define USE_STRERROR
# if defined(TRIO_PLATFORM_QNX)
#  define strcasecmp(x,y) stricmp(x,y)
#  define strncasecmp(x,y,n) strnicmp(x,y,n)
# endif
#elif defined(TRIO_PLATFORM_WIN32)
# define USE_STRCASECMP
# define strcasecmp(x,y) strcmpi(x,y)
#endif

/*************************************************************************
 * Structures
 */

struct _trio_string_t
{
  char *content;
  size_t length;
  size_t allocated;
};

/*************************************************************************
 * Constants
 */

#if !defined(TRIO_MINIMAL)
static TRIO_CONST char rcsid[] = "@(#)$Id: triostr.c,v 1.1 2003/11/25 18:20:49 kaben Exp $";
#endif

/*************************************************************************
 * Static String Functions
 */

#if defined(TRIO_DOCUMENTATION)
# include "doc/doc_static.h"
#endif
/** @addtogroup StaticStrings
    @{
*/

/**
   Create new string.

   @param size Size of new string.
   @return Pointer to string, or NULL if allocation failed.
*/
TRIO_STRING_PUBLIC char *
trio_create
TRIO_ARGS1((size),
	   size_t size)
{
  return (char *)TRIO_MALLOC(size);
}


/**
   Destroy string.

   @param string String to be freed.
*/
TRIO_STRING_PUBLIC void
trio_destroy
TRIO_ARGS1((string),
	   char *string)
{
  if (string)
    {
      TRIO_FREE(string);
    }
}


/**
   Count the number of characters in a string.

   @param string String to measure.
   @return Number of characters in @string.
*/
TRIO_STRING_PUBLIC size_t
trio_length
TRIO_ARGS1((string),
	   TRIO_CONST char *string)
{
  return strlen(string);
}


#if !defined(TRIO_MINIMAL)
/**
   Append @p source at the end of @p target.
   
   @param target Target string.
   @param source Source string.
   @return Boolean value indicating success or failure.
   
   @pre @p target must point to a memory chunk with sufficient room to
   contain the @p target string and @p source string.
   @pre No boundary checking is performed, so insufficient memory will
   result in a buffer overrun.
   @post @p target will be zero terminated.
*/
TRIO_STRING_PUBLIC int
trio_append
TRIO_ARGS2((target, source),
	   char *target,
	   TRIO_CONST char *source)
{
  assert(target);
  assert(source);
  
  return (strcat(target, source) != NULL);
}
#endif /* !defined(TRIO_MINIMAL) */

#if !defined(TRIO_MINIMAL)
/**
   Append at most @p max characters from @p source to @p target.
   
   @param target Target string.
   @param max Maximum number of characters to append.
   @param source Source string.
   @return Boolean value indicating success or failure.
   
   @pre @p target must point to a memory chuck with sufficient room to
   contain the @p target string and the @p source string (at most @p max
   characters).
   @pre No boundary checking is performed, so insufficient memory will
   result in a buffer overrun.
   @post @p target will be zero terminated.
*/
TRIO_STRING_PUBLIC int
trio_append_max
TRIO_ARGS3((target, max, source),
	   char *target,
	   size_t max,
	   TRIO_CONST char *source)
{
  size_t length;
  
  assert(target);
  assert(source);

  length = trio_length(target);
  
  if (max > length)
    {
      strncat(target, source, max - length - 1);
    }
  return TRUE;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Determine if a string contains a substring.

   @param string String to be searched.
   @param substring String to be found.
   @return Boolean value indicating success or failure.
*/
TRIO_STRING_PUBLIC int
trio_contains
TRIO_ARGS2((string, substring),
	   TRIO_CONST char *string,
	   TRIO_CONST char *substring)
{
  assert(string);
  assert(substring);
  
  return (0 != strstr(string, substring));
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Copy @p source to @p target.
   
   @param target Target string.
   @param source Source string.
   @return Boolean value indicating success or failure.
   
   @pre @p target must point to a memory chunk with sufficient room to
   contain the @p source string.
   @pre No boundary checking is performed, so insufficient memory will
   result in a buffer overrun.
   @post @p target will be zero terminated.
*/
TRIO_STRING_PUBLIC int
trio_copy
TRIO_ARGS2((target, source),
	   char *target,
	   TRIO_CONST char *source)
{
  assert(target);
  assert(source);
     
  (void)strcpy(target, source);
  return TRUE;
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Copy at most @p max characters from @p source to @p target.
   
   @param target Target string.
   @param max Maximum number of characters to append.
   @param source Source string.
   @return Boolean value indicating success or failure.
   
   @pre @p target must point to a memory chunk with sufficient room to
   contain the @p source string (at most @p max characters).
   @pre No boundary checking is performed, so insufficient memory will
   result in a buffer overrun.
   @post @p target will be zero terminated.
*/
TRIO_STRING_PUBLIC int
trio_copy_max
TRIO_ARGS3((target, max, source),
	   char *target,
	   size_t max,
	   TRIO_CONST char *source)
{
  assert(target);
  assert(source);
  assert(max > 0); /* Includes != 0 */

  (void)strncpy(target, source, max - 1);
  target[max - 1] = (char)0;
  return TRUE;
}


/*
 * TrioDuplicateMax
 */
TRIO_STRING_PRIVATE char *
TrioDuplicateMax
TRIO_ARGS2((source, size),
	   TRIO_CONST char *source,
	   size_t size)
{
  char *target;

  assert(source);

  /* Make room for string plus a terminating zero */
  size++;
  target = trio_create(size);
  if (target)
    {
      trio_copy_max(target, size, source);
    }
  return target;
}


/**
   Duplicate @p source.
   
   @param source Source string.
   @return A copy of the @p source string.
   
   @post @p target will be zero terminated.
*/
TRIO_STRING_PUBLIC char *
trio_duplicate
TRIO_ARGS1((source),
	   TRIO_CONST char *source)
{
  return TrioDuplicateMax(source, trio_length(source));
}


#if !defined(TRIO_MINIMAL)
/**
   Duplicate at most @p max characters of @p source.
   
   @param source Source string.
   @param max Maximum number of characters to duplicate.
   @return A copy of the @p source string.
   
   @post @p target will be zero terminated.
*/
TRIO_STRING_PUBLIC char *
trio_duplicate_max TRIO_ARGS2((source, max),
			      TRIO_CONST char *source,
			      size_t max)
{
  size_t length;

  assert(source);
  assert(max > 0);

  length = trio_length(source);
  if (length > max)
    {
      length = max;
    }
  return TrioDuplicateMax(source, length);
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Compare if two strings are equal.
   
   @param first First string.
   @param second Second string.
   @return Boolean indicating whether the two strings are equal or not.
   
   Case-insensitive comparison.
*/
TRIO_STRING_PUBLIC int
trio_equal
TRIO_ARGS2((first, second),
	   TRIO_CONST char *first,
	   TRIO_CONST char *second)
{
  assert(first);
  assert(second);

  if ((first != NULL) && (second != NULL))
    {
#if defined(USE_STRCASECMP)
      return (0 == strcasecmp(first, second));
#else
      while ((*first != NIL) && (*second != NIL))
	{
	  if (toupper(*first) != toupper(*second))
	    {
	      break;
	    }
	  first++;
	  second++;
	}
      return ((*first == NIL) && (*second == NIL));
#endif
    }
  return FALSE;
}


/**
   Compare if two strings are equal.
   
   @param first First string.
   @param second Second string.
   @return Boolean indicating whether the two strings are equal or not.
   
   Case-sensitive comparison.
*/
TRIO_STRING_PUBLIC int
trio_equal_case
TRIO_ARGS2((first, second),
	   TRIO_CONST char *first,
	   TRIO_CONST char *second)
{
  assert(first);
  assert(second);

  if ((first != NULL) && (second != NULL))
    {
      return (0 == strcmp(first, second));
    }
  return FALSE;
}


#if !defined(TRIO_MINIMAL)
/**
   Compare if two strings up until the first @p max characters are equal.
   
   @param first First string.
   @param max Maximum number of characters to compare.
   @param second Second string.
   @return Boolean indicating whether the two strings are equal or not.
   
   Case-sensitive comparison.
*/
TRIO_STRING_PUBLIC int
trio_equal_case_max
TRIO_ARGS3((first, max, second),
	   TRIO_CONST char *first,
	   size_t max,
	   TRIO_CONST char *second)
{
  assert(first);
  assert(second);

  if ((first != NULL) && (second != NULL))
    {
      return (0 == strncmp(first, second, max));
    }
  return FALSE;
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Compare if two strings are equal.
   
   @param first First string.
   @param second Second string.
   @return Boolean indicating whether the two strings are equal or not.

   Collating characters are considered equal.
*/
TRIO_STRING_PUBLIC int
trio_equal_locale
TRIO_ARGS2((first, second),
	   TRIO_CONST char *first,
	   TRIO_CONST char *second)
{
  assert(first);
  assert(second);

#if defined(LC_COLLATE)
  return (strcoll(first, second) == 0);
#else
  return trio_equal(first, second);
#endif
}


/**
   Compare if two strings up until the first @p max characters are equal.
   
   @param first First string.
   @param max Maximum number of characters to compare.
   @param second Second string.
   @return Boolean indicating whether the two strings are equal or not.
   
   Case-insensitive comparison.
*/
TRIO_STRING_PUBLIC int
trio_equal_max
TRIO_ARGS3((first, max, second),
	   TRIO_CONST char *first,
	   size_t max,
	   TRIO_CONST char *second)
{
  assert(first);
  assert(second);

  if ((first != NULL) && (second != NULL))
    {
#if defined(USE_STRNCASECMP)
      return (0 == strncasecmp(first, second, max));
#else
      /* Not adequately tested yet */
      size_t cnt = 0;
      while ((*first != NIL) && (*second != NIL) && (cnt <= max))
	{
	  if (toupper(*first) != toupper(*second))
	    {
	      break;
	    }
	  first++;
	  second++;
	  cnt++;
	}
      return ((cnt == max) || ((*first == NIL) && (*second == NIL)));
#endif
    }
  return FALSE;
}


/**
   Provide a textual description of an error code (errno).

   @param error_number Error number.
   @return Textual description of @p error_number.
*/
TRIO_STRING_PUBLIC TRIO_CONST char *
trio_error
TRIO_ARGS1((error_number),
	   int error_number)
{
#if defined(USE_STRERROR)
  return strerror(error_number);
#else
  return "unknown";
#endif
}


#if !defined(TRIO_MINIMAL)
/**
   Format the date/time according to @p format.

   @param target Target string.
   @param max Maximum number of characters to format.
   @param format Formatting string.
   @param datetime Date/time structure.
   @return Number of formatted characters.

   The formatting string accepts the same specifiers as the standard C
   function strftime.
*/
TRIO_STRING_PUBLIC size_t
trio_format_date_max
TRIO_ARGS4((target, max, format, datetime),
	   char *target,
	   size_t max,
	   TRIO_CONST char *format,
	   TRIO_CONST struct tm *datetime)
{
  assert(target);
  assert(format);
  assert(datetime);
  assert(max > 0);
  
  return strftime(target, max, format, datetime);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Calculate a hash value for a string.

   @param string String to be calculated on.
   @param type Hash function.
   @return Calculated hash value.

   @p type can be one of the following
   @li @c TRIO_HASH_PLAIN Plain hash function.
*/
TRIO_STRING_PUBLIC unsigned long
trio_hash
TRIO_ARGS2((string, type),
	   TRIO_CONST char *string,
	   int type)
{
  unsigned long value = 0L;
  char ch;

  assert(string);
  
  switch (type)
    {
    case TRIO_HASH_PLAIN:
      while ( (ch = *string++) != NIL )
	{
	  value *= 31;
	  value += (unsigned long)ch;
	}
      break;
    default:
      assert(FALSE);
      break;
    }
  return value;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Find first occurrence of a character in a string.

   @param string String to be searched.
   @param character Character to be found.
   @param A pointer to the found character, or NULL if character was not found.
 */
TRIO_STRING_PUBLIC char *
trio_index
TRIO_ARGS2((string, character),
	   TRIO_CONST char *string,
	   int character)
{
  assert(string);

  return strchr(string, character);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Find last occurrence of a character in a string.

   @param string String to be searched.
   @param character Character to be found.
   @param A pointer to the found character, or NULL if character was not found.
 */
TRIO_STRING_PUBLIC char *
trio_index_last
TRIO_ARGS2((string, character),
	   TRIO_CONST char *string,
	   int character)
{
  assert(string);

  return strchr(string, character);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Convert the alphabetic letters in the string to lower-case.

   @param target String to be converted.
   @return Number of processed characters (converted or not).
*/
TRIO_STRING_PUBLIC int
trio_lower
TRIO_ARGS1((target),
	   char *target)
{
  assert(target);

  return trio_span_function(target, target, tolower);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Compare two strings using wildcards.

   @param string String to be searched.
   @param pattern Pattern, including wildcards, to search for.
   @return Boolean value indicating success or failure.

   Case-insensitive comparison.
   
   The following wildcards can be used
   @li @c * Match any number of characters.
   @li @c ? Match a single character.
*/
TRIO_STRING_PUBLIC int
trio_match
TRIO_ARGS2((string, pattern),
	   TRIO_CONST char *string,
	   TRIO_CONST char *pattern)
{
  assert(string);
  assert(pattern);
  
  for (; ('*' != *pattern); ++pattern, ++string)
    {
      if (NIL == *string)
	{
	  return (NIL == *pattern);
	}
      if ((toupper((int)*string) != toupper((int)*pattern))
	  && ('?' != *pattern))
	{
	  return FALSE;
	}
    }
  /* two-line patch to prevent *too* much recursiveness: */
  while ('*' == pattern[1])
    pattern++;

  do
    {
      if ( trio_match(string, &pattern[1]) )
	{
	  return TRUE;
	}
    }
  while (*string++);
  
  return FALSE;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Compare two strings using wildcards.

   @param string String to be searched.
   @param pattern Pattern, including wildcards, to search for.
   @return Boolean value indicating success or failure.

   Case-sensitive comparison.
   
   The following wildcards can be used
   @li @c * Match any number of characters.
   @li @c ? Match a single character.
*/
TRIO_STRING_PUBLIC int
trio_match_case
TRIO_ARGS2((string, pattern),
	   TRIO_CONST char *string,
	   TRIO_CONST char *pattern)
{
  assert(string);
  assert(pattern);
  
  for (; ('*' != *pattern); ++pattern, ++string)
    {
      if (NIL == *string)
	{
	  return (NIL == *pattern);
	}
      if ((*string != *pattern)
	  && ('?' != *pattern))
	{
	  return FALSE;
	}
    }
  /* two-line patch to prevent *too* much recursiveness: */
  while ('*' == pattern[1])
    pattern++;

  do
    {
      if ( trio_match_case(string, &pattern[1]) )
	{
	  return TRUE;
	}
    }
  while (*string++);
  
  return FALSE;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Execute a function on each character in string.

   @param target Target string.
   @param source Source string.
   @param Function Function to be executed.
   @return Number of processed characters.
*/
TRIO_STRING_PUBLIC size_t
trio_span_function
TRIO_ARGS3((target, source, Function),
	   char *target,
	   TRIO_CONST char *source,
	   int (*Function) TRIO_PROTO((int)))
{
  size_t count = 0;

  assert(target);
  assert(source);
  assert(Function);
  
  while (*source != NIL)
    {
      *target++ = Function(*source++);
      count++;
    }
  return count;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Search for a substring in a string.

   @param string String to be searched.
   @param substring String to be found.
   @return Pointer to first occurrence of @p substring in @p string, or NULL
   if no match was found.
*/
TRIO_STRING_PUBLIC char *
trio_substring
TRIO_ARGS2((string, substring),
	   TRIO_CONST char *string,
	   TRIO_CONST char *substring)
{
  assert(string);
  assert(substring);

  return strstr(string, substring);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Search for a substring in the first @p max characters of a string.

   @param string String to be searched.
   @param max Maximum characters to be searched.
   @param substring String to be found.
   @return Pointer to first occurrence of @p substring in @p string, or NULL
   if no match was found.
*/
TRIO_STRING_PUBLIC char *
trio_substring_max
TRIO_ARGS3((string, max, substring),
	   TRIO_CONST char *string,
	   size_t max,
	   TRIO_CONST char *substring)
{
  size_t count;
  size_t size;
  char *result = NULL;

  assert(string);
  assert(substring);
  
  size = trio_length(substring);
  if (size <= max)
    {
      for (count = 0; count <= max - size; count++)
	{
	  if (trio_equal_max(substring, size, &string[count]))
	    {
	      result = (char *)&string[count];
	      break;
	    }
	}
    }
  return result;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Tokenize string.

   @param string String to be tokenized.
   @param tokens String containing list of delimiting characters.
   @return Start of new token.

   @warning @p string will be destroyed.
*/
TRIO_STRING_PUBLIC char *
trio_tokenize
TRIO_ARGS2((string, delimiters),
	   char *string,
	   TRIO_CONST char *delimiters)
{
  assert(delimiters);
  
  return strtok(string, delimiters);
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Convert string to floating-point number.

   @param source String to be converted.
   @param endp Pointer to end of the converted string.
   @return A floating-point number.

   The following Extended Backus-Naur form is used
   @verbatim
   double        ::= [ <sign> ]
                     ( <number> |
                       <number> <decimal_point> <number> |
                       <decimal_point> <number> )
                     [ <exponential> [ <sign> ] <number> ]
   number        ::= 1*( <digit> )
   digit         ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
   exponential   ::= ( 'e' | 'E' )
   sign          ::= ( '-' | '+' )
   decimal_point ::= '.'
   @endverbatim
*/
/* FIXME: Add EBNF for hex-floats */
TRIO_STRING_PUBLIC trio_long_double_t
trio_to_long_double
TRIO_ARGS2((source, endp),
	   TRIO_CONST char *source,
	   char **endp)
{
#if defined(USE_STRTOLD)
  return strtold(source, endp);
#else
  int isNegative = FALSE;
  int isExponentNegative = FALSE;
  trio_long_double_t integer = 0.0;
  trio_long_double_t fraction = 0.0;
  unsigned long exponent = 0;
  trio_long_double_t base;
  trio_long_double_t fracdiv = 1.0;
  trio_long_double_t value = 0.0;

  /* First try hex-floats */
  if ((source[0] == '0') && ((source[1] == 'x') || (source[1] == 'X')))
    {
      base = 16.0;
      source += 2;
      while (isxdigit((int)*source))
	{
	  integer *= base;
	  integer += (isdigit((int)*source)
		      ? (*source - '0')
		      : 10 + (toupper((int)*source) - 'A'));
	  source++;
	}
      if (*source == '.')
	{
	  source++;
	  while (isxdigit((int)*source))
	    {
	      fracdiv /= base;
	      fraction += fracdiv * (isdigit((int)*source)
				     ? (*source - '0')
				     : 10 + (toupper((int)*source) - 'A'));
	      source++;
	    }
	  if ((*source == 'p') || (*source == 'P'))
	    {
	      source++;
	      if ((*source == '+') || (*source == '-'))
		{
		  isExponentNegative = (*source == '-');
		  source++;
		}
	      while (isdigit((int)*source))
		{
		  exponent *= (int)base;
		  exponent += (*source - '0');
		  source++;
		}
	    }
	}
    }
  else /* Then try normal decimal floats */
    {
      base = 10.0;
      isNegative = (*source == '-');
      /* Skip sign */
      if ((*source == '+') || (*source == '-'))
	source++;

      /* Integer part */
      while (isdigit((int)*source))
	{
	  integer *= base;
	  integer += (*source - '0');
	  source++;
	}

      if (*source == '.')
	{
	  source++; /* skip decimal point */
	  while (isdigit((int)*source))
	    {
	      fracdiv /= base;
	      fraction += (*source - '0') * fracdiv;
	      source++;
	    }
	}
      if ((*source == 'e')
	  || (*source == 'E')
#if TRIO_MICROSOFT
	  || (*source == 'd')
	  || (*source == 'D')
#endif
	  )
	{
	  source++; /* Skip exponential indicator */
	  isExponentNegative = (*source == '-');
	  if ((*source == '+') || (*source == '-'))
	    source++;
	  while (isdigit((int)*source))
	    {
	      exponent *= (int)base;
	      exponent += (*source - '0');
	      source++;
	    }
	}
    }
  
  value = integer + fraction;
  if (exponent != 0)
    {
      if (isExponentNegative)
	value /= pow(base, (double)exponent);
      else
	value *= pow(base, (double)exponent);
    }
  if (isNegative)
    value = -value;

  if (endp)
    *endp = (char *)source;
  return value;
#endif
}


/**
   Convert string to floating-point number.

   @param source String to be converted.
   @param endp Pointer to end of the converted string.
   @return A floating-point number.

   See @ref trio_to_long_double.
*/
TRIO_STRING_PUBLIC double
trio_to_double
TRIO_ARGS2((source, endp),
	   TRIO_CONST char *source,
	   char **endp)
{
#if defined(USE_STRTOD)
  return strtod(source, endp);
#else
  return (double)trio_to_long_double(source, endp);
#endif
}

#if !defined(TRIO_MINIMAL)
/**
   Convert string to floating-point number.

   @param source String to be converted.
   @param endp Pointer to end of the converted string.
   @return A floating-point number.

   See @ref trio_to_long_double.
*/
TRIO_STRING_PUBLIC float
trio_to_float
TRIO_ARGS2((source, endp),
	   TRIO_CONST char *source,
	   char **endp)
{
#if defined(USE_STRTOF)
  return strtof(source, endp);
#else
  return (float)trio_to_long_double(source, endp);
#endif
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Convert string to signed integer.

   @param string String to be converted.
   @param endp Pointer to end of converted string.
   @param base Radix number of number.
*/
TRIO_STRING_PUBLIC long
trio_to_long
TRIO_ARGS3((string, endp, base),
	   TRIO_CONST char *string,
	   char **endp,
	   int base)
{
  assert(string);
  assert((base >= 2) && (base <= 36));
  
  return strtol(string, endp, base);
}


#if !defined(TRIO_MINIMAL)
/**
   Convert string to unsigned integer.

   @param string String to be converted.
   @param endp Pointer to end of converted string.
   @param base Radix number of number.
*/
TRIO_STRING_PUBLIC unsigned long
trio_to_unsigned_long
TRIO_ARGS3((string, endp, base),
	   TRIO_CONST char *string,
	   char **endp,
	   int base)
{
  assert(string);
  assert((base >= 2) && (base <= 36));
  
  return strtoul(string, endp, base);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/**
   Convert the alphabetic letters in the string to upper-case.

   @param target The string to be converted.
   @return The number of processed characters (converted or not).
*/
TRIO_STRING_PUBLIC int
trio_upper
TRIO_ARGS1((target),
	   char *target)
{
  assert(target);

  return trio_span_function(target, target, toupper);
}
#endif /* !defined(TRIO_MINIMAL) */


/** @} End of StaticStrings */


/*************************************************************************
 * Dynamic String Functions
 */

#if defined(TRIO_DOCUMENTATION)
# include "doc/doc_dynamic.h"
#endif
/** @addtogroup DynamicStrings
    @{
*/

/*
 * TrioStringAlloc
 */
TRIO_STRING_PRIVATE trio_string_t *
TrioStringAlloc(TRIO_NOARGS)
{
  trio_string_t *self;
  
  self = (trio_string_t *)TRIO_MALLOC(sizeof(trio_string_t));
  if (self)
    {
      self->content = NULL;
      self->length = 0;
      self->allocated = 0;
    }
  return self;
}


/*
 * TrioStringGrow
 *
 * The size of the string will be increased by 'delta' characters. If
 * 'delta' is zero, the size will be doubled.
 */
TRIO_STRING_PRIVATE BOOLEAN_T
TrioStringGrow
TRIO_ARGS2((self, delta),
	   trio_string_t *self,
	   size_t delta)
{
  BOOLEAN_T status = FALSE;
  char *new_content;
  size_t new_size;

  new_size = (delta == 0)
    ? ( (self->allocated == 0) ? 1 : self->allocated * 2 )
    : self->allocated + delta;
  
  new_content = (char *)TRIO_REALLOC(self->content, new_size);
  if (new_content)
    {
      self->content = new_content;
      self->allocated = new_size;
      status = TRUE;
    }
  return status;
}


/*
 * TrioStringGrowTo
 *
 * The size of the string will be increased to 'length' plus one characters.
 * If 'length' is less than the original size, the original size will be
 * used (that is, the size of the string is never decreased).
 */
TRIO_STRING_PRIVATE BOOLEAN_T
TrioStringGrowTo
TRIO_ARGS2((self, length),
	   trio_string_t *self,
	   size_t length)
{
  length++; /* Room for terminating zero */
  return (self->allocated < length)
    ? TrioStringGrow(self, length - self->allocated)
    : TRUE;
}


#if !defined(TRIO_MINIMAL)
/**
   Create a new dynamic string.
   
   @param initial_size Initial size of the buffer.
   @return Newly allocated dynamic string, or NULL if memory allocation failed.
*/
TRIO_STRING_PUBLIC trio_string_t *
trio_string_create
TRIO_ARGS1((initial_size),
	   int initial_size)
{
  trio_string_t *self;

  self = TrioStringAlloc();
  if (self)
    {
      if (TrioStringGrow(self,
			 (size_t)((initial_size > 0) ? initial_size : 1)))
	{
	  self->content[0] = (char)0;
	  self->allocated = initial_size;
	}
      else
	{
	  trio_string_destroy(self);
	  self = NULL;
	}
    }
  return self;
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Deallocate the dynamic string and its contents.
   
   @param self Dynamic string
*/
TRIO_STRING_PUBLIC void
trio_string_destroy
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  assert(self);
  
  if (self)
    {
      trio_destroy(self->content);
      TRIO_FREE(self);
    }
}


#if !defined(TRIO_MINIMAL)
/**
   Get a pointer to the content.
   
   @param self Dynamic string.
   @param offset Offset into content.
   @return Pointer to the content.
   
   @p Offset can be zero, positive, or negative. If @p offset is zero,
   then the start of the content will be returned. If @p offset is positive,
   then a pointer to @p offset number of characters from the beginning of the
   content is returned. If @p offset is negative, then a pointer to @p offset
   number of characters from the ending of the string, starting at the
   terminating zero, is returned.
*/
TRIO_STRING_PUBLIC char *
trio_string_get
TRIO_ARGS2((self, offset),
	   trio_string_t *self,
	   int offset)
{
  char *result = NULL;
  
  assert(self);

  if (self->content != NULL)
    {
      if (self->length == 0)
	{
	  (void)trio_string_length(self);
	}
      if (offset >= 0)
	{
	  if (offset > (int)self->length)
	    {
	      offset = self->length;
	    }
	}
      else
	{
	  offset += self->length + 1;
	  if (offset < 0)
	    {
	      offset = 0;
	    }
	}
      result = &(self->content[offset]);
    }
  return result;
}
#endif /* !defined(TRIO_MINIMAL) */


/**
   Extract the content.
   
   @param self Dynamic String
   @return Content of dynamic string.
   
   The content is removed from the dynamic string. This enables destruction
   of the dynamic string without deallocation of the content.
*/
TRIO_STRING_PUBLIC char *
trio_string_extract
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  char *result;
  
  assert(self);

  result = self->content;
  /* FIXME: Allocate new empty buffer? */
  self->content = NULL;
  self->length = self->allocated = 0;
  return result;
}


#if !defined(TRIO_MINIMAL)
/**
   Set the content of the dynamic string.
   
   @param self Dynamic String
   @param buffer The new content.
   
   Sets the content of the dynamic string to a copy @p buffer.
   An existing content will be deallocated first, if necessary.
   
   @remark
   This function will make a copy of @p buffer.
   You are responsible for deallocating @p buffer yourself.
*/
TRIO_STRING_PUBLIC void
trio_xstring_set
TRIO_ARGS2((self, buffer),
	   trio_string_t *self,
	   char *buffer)
{
  assert(self);

  trio_destroy(self->content);
  self->content = trio_duplicate(buffer);
}
#endif /* !defined(TRIO_MINIMAL) */


/*
 * trio_string_size
 */
TRIO_STRING_PUBLIC int
trio_string_size
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  assert(self);

  return self->allocated;
}


/*
 * trio_string_terminate
 */
TRIO_STRING_PUBLIC void
trio_string_terminate
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  trio_xstring_append_char(self, 0);
}


#if !defined(TRIO_MINIMAL)
/**
   Append the second string to the first.
   
   @param self Dynamic string to be modified.
   @param other Dynamic string to copy from.
   @return Boolean value indicating success or failure.
*/
TRIO_STRING_PUBLIC int
trio_string_append
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  size_t length;
  
  assert(self);
  assert(other);

  length = self->length + other->length;
  if (!TrioStringGrowTo(self, length))
    goto error;
  trio_copy(&self->content[self->length], other->content);
  self->length = length;
  return TRUE;
  
 error:
  return FALSE;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_append
 */
TRIO_STRING_PUBLIC int
trio_xstring_append
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  size_t length;
  
  assert(self);
  assert(other);

  length = self->length + trio_length(other);
  if (!TrioStringGrowTo(self, length))
    goto error;
  trio_copy(&self->content[self->length], other);
  self->length = length;
  return TRUE;
  
 error:
  return FALSE;
}
#endif /* !defined(TRIO_MINIMAL) */


/*
 * trio_xstring_append_char
 */
TRIO_STRING_PUBLIC int
trio_xstring_append_char
TRIO_ARGS2((self, character),
	   trio_string_t *self,
	   char character)
{
  assert(self);

  if ((int)self->length >= trio_string_size(self))
    {
      if (!TrioStringGrow(self, 0))
	goto error;
    }
  self->content[self->length] = character;
  self->length++;
  return TRUE;
  
 error:
  return FALSE;
}


#if !defined(TRIO_MINIMAL)
/**
   Search for the first occurrence of second parameter in the first.
   
   @param self Dynamic string to be modified.
   @param other Dynamic string to copy from.
   @return Boolean value indicating success or failure.
*/
TRIO_STRING_PUBLIC int
trio_string_contains
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_contains(self->content, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_contains
 */
TRIO_STRING_PUBLIC int
trio_xstring_contains
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_contains(self->content, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_copy
 */
TRIO_STRING_PUBLIC int
trio_string_copy
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  self->length = 0;
  return trio_string_append(self, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_copy
 */
TRIO_STRING_PUBLIC int
trio_xstring_copy
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  self->length = 0;
  return trio_xstring_append(self, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_duplicate
 */
TRIO_STRING_PUBLIC trio_string_t *
trio_string_duplicate
TRIO_ARGS1((other),
	   trio_string_t *other)
{
  trio_string_t *self;
  
  assert(other);

  self = TrioStringAlloc();
  if (self)
    {
      self->content = TrioDuplicateMax(other->content, other->length);
      if (self->content)
	{
	  self->length = other->length;
	  self->allocated = self->length + 1;
	}
      else
	{
	  self->length = self->allocated = 0;
	}
    }
  return self;
}
#endif /* !defined(TRIO_MINIMAL) */


/*
 * trio_xstring_duplicate
 */
TRIO_STRING_PUBLIC trio_string_t *
trio_xstring_duplicate
TRIO_ARGS1((other),
	   TRIO_CONST char *other)
{
  trio_string_t *self;
  
  assert(other);

  self = TrioStringAlloc();
  if (self)
    {
      self->content = TrioDuplicateMax(other, trio_length(other));
      if (self->content)
	{
	  self->length = trio_length(self->content);
	  self->allocated = self->length + 1;
	}
      else
	{
	  self->length = self->allocated = 0;
	}
    }
  return self;
}


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_equal
 */
TRIO_STRING_PUBLIC int
trio_string_equal
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_equal(self->content, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_equal
 */
TRIO_STRING_PUBLIC int
trio_xstring_equal
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_equal(self->content, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_equal_max
 */
TRIO_STRING_PUBLIC int
trio_string_equal_max
TRIO_ARGS3((self, max, other),
	   trio_string_t *self,
	   size_t max,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_equal_max(self->content, max, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_equal_max
 */
TRIO_STRING_PUBLIC int
trio_xstring_equal_max
TRIO_ARGS3((self, max, other),
	   trio_string_t *self,
	   size_t max,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_equal_max(self->content, max, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_equal_case
 */
TRIO_STRING_PUBLIC int
trio_string_equal_case
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_equal_case(self->content, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_equal_case
 */
TRIO_STRING_PUBLIC int
trio_xstring_equal_case
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_equal_case(self->content, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_equal_case_max
 */
TRIO_STRING_PUBLIC int
trio_string_equal_case_max
TRIO_ARGS3((self, max, other),
	   trio_string_t *self,
	   size_t max,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_equal_case_max(self->content, max, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_equal_case_max
 */
TRIO_STRING_PUBLIC int
trio_xstring_equal_case_max
TRIO_ARGS3((self, max, other),
	   trio_string_t *self,
	   size_t max,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_equal_case_max(self->content, max, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_format_data_max
 */
TRIO_STRING_PUBLIC size_t
trio_string_format_date_max
TRIO_ARGS4((self, max, format, datetime),
	   trio_string_t *self,
	   size_t max,
	   TRIO_CONST char *format,
	   TRIO_CONST struct tm *datetime)
{
  assert(self);

  return trio_format_date_max(self->content, max, format, datetime);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_index
 */
TRIO_STRING_PUBLIC char *
trio_string_index
TRIO_ARGS2((self, character),
	   trio_string_t *self,
	   int character)
{
  assert(self);

  return trio_index(self->content, character);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_index_last
 */
TRIO_STRING_PUBLIC char *
trio_string_index_last
TRIO_ARGS2((self, character),
	   trio_string_t *self,
	   int character)
{
  assert(self);

  return trio_index_last(self->content, character);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_length
 */
TRIO_STRING_PUBLIC int
trio_string_length
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  assert(self);

  if (self->length == 0)
    {
      self->length = trio_length(self->content);
    }
  return self->length;
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_lower
 */
TRIO_STRING_PUBLIC int
trio_string_lower
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  assert(self);

  return trio_lower(self->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_match
 */
TRIO_STRING_PUBLIC int
trio_string_match
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_match(self->content, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_match
 */
TRIO_STRING_PUBLIC int
trio_xstring_match
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_match(self->content, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_match_case
 */
TRIO_STRING_PUBLIC int
trio_string_match_case
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_match_case(self->content, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_match_case
 */
TRIO_STRING_PUBLIC int
trio_xstring_match_case
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_match_case(self->content, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_substring
 */
TRIO_STRING_PUBLIC char *
trio_string_substring
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   trio_string_t *other)
{
  assert(self);
  assert(other);

  return trio_substring(self->content, other->content);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_xstring_substring
 */
TRIO_STRING_PUBLIC char *
trio_xstring_substring
TRIO_ARGS2((self, other),
	   trio_string_t *self,
	   TRIO_CONST char *other)
{
  assert(self);
  assert(other);

  return trio_substring(self->content, other);
}
#endif /* !defined(TRIO_MINIMAL) */


#if !defined(TRIO_MINIMAL)
/*
 * trio_string_upper
 */
TRIO_STRING_PUBLIC int
trio_string_upper
TRIO_ARGS1((self),
	   trio_string_t *self)
{
  assert(self);

  return trio_upper(self->content);
}
#endif /* !defined(TRIO_MINIMAL) */

/** @} End of DynamicStrings */

Index: avida/current/source/third-party/trio-1.9/trio/triostr.h
+++ avida/current/source/third-party/trio-1.9/trio/triostr.h
/*************************************************************************
 *
 * $Id: triostr.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

#ifndef TRIO_TRIOSTR_H
#define TRIO_TRIOSTR_H

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "triodef.h"
#include "triop.h"

enum {
  TRIO_HASH_NONE = 0,
  TRIO_HASH_PLAIN,
  TRIO_HASH_TWOSIGNED
};

#if !defined(TRIO_STRING_PUBLIC)
# if !defined(TRIO_PUBLIC)
#  define TRIO_PUBLIC
# endif
# define TRIO_STRING_PUBLIC TRIO_PUBLIC
#endif

/*************************************************************************
 * String functions
 */

TRIO_STRING_PUBLIC int trio_append TRIO_PROTO((char *target, const char *source));
TRIO_STRING_PUBLIC int trio_append_max TRIO_PROTO((char *target, size_t max, const char *source));
TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char *substring));
TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source));
TRIO_STRING_PUBLIC int trio_copy_max TRIO_PROTO((char *target, size_t max, const char *source));
TRIO_STRING_PUBLIC char *trio_create TRIO_PROTO((size_t size));
TRIO_STRING_PUBLIC void trio_destroy TRIO_PROTO((char *string));
TRIO_STRING_PUBLIC char *trio_duplicate TRIO_PROTO((const char *source));
TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max));
TRIO_STRING_PUBLIC int trio_equal TRIO_PROTO((const char *first, const char *second));
TRIO_STRING_PUBLIC int trio_equal_case TRIO_PROTO((const char *first, const char *second));
TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second));
TRIO_STRING_PUBLIC int trio_equal_locale TRIO_PROTO((const char *first, const char *second));
TRIO_STRING_PUBLIC int trio_equal_max TRIO_PROTO((const char *first, size_t max, const char *second));
TRIO_STRING_PUBLIC TRIO_CONST char *trio_error TRIO_PROTO((int));
TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime));
TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type));
TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character));
TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character));
TRIO_STRING_PUBLIC size_t trio_length TRIO_PROTO((const char *string));
TRIO_STRING_PUBLIC int trio_lower TRIO_PROTO((char *target));
TRIO_STRING_PUBLIC int trio_match TRIO_PROTO((const char *string, const char *pattern));
TRIO_STRING_PUBLIC int trio_match_case TRIO_PROTO((const char *string, const char *pattern));
TRIO_STRING_PUBLIC size_t trio_span_function TRIO_PROTO((char *target, const char *source, int (*Function) TRIO_PROTO((int))));
TRIO_STRING_PUBLIC char *trio_substring TRIO_PROTO((const char *string, const char *substring));
TRIO_STRING_PUBLIC char *trio_substring_max TRIO_PROTO((const char *string, size_t max, const char *substring));
TRIO_STRING_PUBLIC double trio_to_double TRIO_PROTO((const char *source, char **endp));
TRIO_STRING_PUBLIC float trio_to_float TRIO_PROTO((const char *source, char **endp));
TRIO_STRING_PUBLIC trio_long_double_t trio_to_long_double TRIO_PROTO((const char *source, char **endp));
TRIO_STRING_PUBLIC long trio_to_long TRIO_PROTO((const char *source, char **endp, int base));
TRIO_STRING_PUBLIC unsigned long trio_to_unsigned_long TRIO_PROTO((const char *source, char **endp, int base));
TRIO_STRING_PUBLIC char *trio_tokenize TRIO_PROTO((char *string, const char *delimiters));
TRIO_STRING_PUBLIC int trio_upper TRIO_PROTO((char *target));

/*************************************************************************
 * Dynamic string functions
 */

/*
 * Opaque type for dynamic strings
 */
typedef struct _trio_string_t trio_string_t;

TRIO_STRING_PUBLIC trio_string_t *trio_string_create TRIO_PROTO((int initial_size));
TRIO_STRING_PUBLIC void trio_string_destroy TRIO_PROTO((trio_string_t *self));
TRIO_STRING_PUBLIC char *trio_string_get TRIO_PROTO((trio_string_t *self, int offset));
TRIO_STRING_PUBLIC void trio_xstring_set TRIO_PROTO((trio_string_t *self, char *buffer));
TRIO_STRING_PUBLIC char *trio_string_extract TRIO_PROTO((trio_string_t *self));
TRIO_STRING_PUBLIC int trio_string_size TRIO_PROTO((trio_string_t *self));
TRIO_STRING_PUBLIC void trio_string_terminate TRIO_PROTO((trio_string_t *self));

TRIO_STRING_PUBLIC int trio_string_append TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_contains TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_copy TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC trio_string_t *trio_string_duplicate TRIO_PROTO((trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second));
TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other));
TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime));
TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character));
TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character));
TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self));
TRIO_STRING_PUBLIC int trio_string_lower TRIO_PROTO((trio_string_t *self));
TRIO_STRING_PUBLIC int trio_string_match TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_match_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC char *trio_string_substring TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_upper TRIO_PROTO((trio_string_t *self));

TRIO_STRING_PUBLIC int trio_xstring_append_char TRIO_PROTO((trio_string_t *self, char character));
TRIO_STRING_PUBLIC int trio_xstring_append TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_contains TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_copy TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC trio_string_t *trio_xstring_duplicate TRIO_PROTO((const char *other));
TRIO_STRING_PUBLIC int trio_xstring_equal TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_equal_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_equal_case TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_match TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC int trio_xstring_match_case TRIO_PROTO((trio_string_t *self, const char *other));
TRIO_STRING_PUBLIC char *trio_xstring_substring TRIO_PROTO((trio_string_t *self, const char *other));

#endif /* TRIO_TRIOSTR_H */

Index: avida/current/source/third-party/trio-1.9/trio/doc/doc.h
+++ avida/current/source/third-party/trio-1.9/trio/doc/doc.h
/*************************************************************************
 *
 * $Id: doc.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/**
@mainpage

@author Bjørn Reese
@author Daniel Stenberg

@section intro Introduction

Trio is a fully matured and stable set of printf and string functions
designed be used by applications with focus on portability or with the
need for additional features that are not supported by standard stdio
implementation.

There are several cases where you may want to consider using trio:

@li Portability across heterogeneous platforms.
@li Embedded systems without stdio support.
@li Extendability of unsupported features.
@li Your native version does not do everything you need.

When you write applications that must be portable to a wide range of
platforms you often have to deal with inadequate implementations of the
stdio library functions. Most notably is the lack of secure formatting
functions, such as snprintf, or the lack of parameter reordering commonly
used for the internationalization of applications, such as the <num>$
modifier. Sometimes the feature you need is simply not present in stdio.
So you end up spending much effort on determining which platforms supports
what, and to write your own versions of various features. This is where
trio can help you. Trio is a platform-independent implementation of the
stdio printf and scanf functions and the string library functions.

The functionality described in the stdio standards is a compromise, and
does unfortunately not include a mechanism to extend the functionality for
an individual application. Oftentimes an application has the need for an
extra feature, and the application code can become much more clear and
readable by using an extension mechanism. Trio supports a range of useful
extensions such as user-defined specifiers, passing of arguments in arrays,
localized string scanning, thousand-separators, and arbitrary integer bases.

Trio fully implements the C99 (ISO/IEC 9899:1999) and UNIX98 (the Single
Unix Specification, Version 2) standards, as well as many features from
other implemenations, e.g. the GNU libc and BSD4.

@section examples Examples

@subsection ex1 Binary Numbers
Output an integer as a binary number using a trio extension.
@verbatim
  trio_printf("%..2i\n", number);
@endverbatim

@subsection ex2 Thousand-separator
Output a number with thousand-separator using a trio extension.
@verbatim
  trio_printf("%'f\n", 12345.6);
@endverbatim
The thousand-separator described by the locale is used. 

@subsection ex3 Fixed Length Array and Sticky Modifier
Output an fixed length array of floating-point numbers.
@verbatim
  double array[] = {1.0, 2.0, 3.0};
  printf("%.2f %.2f %.2f\n", array[0], array[1], array[2]);
@endverbatim
The same with two trio extensions (arguments are passed in an array, and
the first formatting specifier sets the sticky option so we do not have
to type all the formatting modifiers for the remaining formatting specifiers)
@verbatim
  trio_printfv("%!.2f %f %f\n", array);
@endverbatim
Another, and more powerful, application of being able to pass arguments in
an array is the creation of the printf/scanf statement at run-time, where
the formatting string, and thus the argument list, is based on an external
configuration file.

@subsection ex4 Localized scanning
Parse a string consisting of one or more upper-case alphabetic characters
followed by one or more numeric characters.
@verbatim
  sscanf(buffer, "%[A-Z]%[0-9]", alphabetic, numeric);
@endverbatim
The same but with locale using a trio extension.
@verbatim
  trio_sscanf(buffer, "%[:upper:]%[:digit:]", alphabetic, numeric);
@endverbatim

@section legal Legal Issues
Trio is distributed under the following license, which allows practically
anybody to use it in almost any kind of software, including proprietary
software, without difficulty.

"Copyright (C) 1998-2001 Bjorn Reese and Daniel Stenberg.

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER."

@section contribution Contribution

@subsection contribute Contribute
We appreciate any type of contribution, from ideas over improvements to
error corrections.

The project space contains references to bug and feature tracking,
mailing-list, and the CVS repository. We prefer communication via the
mailing-list, but do not require you to be subscribed, because trio is a
small project.

The project space is located at http://sourceforge.net/projects/ctrio/

@subsection contributors Contributors
We have received contributions from the following persons (in alphabetic
order sorted by surname)

@li Craig Berry
@li Stan Boehm
@li Robert Collins
@li Danny Dulai
@li John Fotheringham
@li Markus Henke
@li Ken Gibson
@li Paul Janzen
@li Richard Jinks
@li Tero Jänkä
@li Howard Kapustein
@li Alexander Lukyanov
@li Emmanuel Mogenet
@li Jacob Navia
@li Jose Ortiz
@li Joe Orton
@li Gisli Ottarsson
@li Marc Werwerft
@li Igor Zlatkovic

Please let us know, and accept our apology, if we have omitted anybody.

*/

Index: avida/current/source/third-party/trio-1.9/trio/doc/doc_dynamic.h
+++ avida/current/source/third-party/trio-1.9/trio/doc/doc_dynamic.h
/*************************************************************************
 *
 * $Id: doc_dynamic.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/** @addtogroup DynamicStrings Dynamic String Functions.
Dynamic string functions.

@b SYNOPSIS

@verbatim
cc ... -ltrio -lm

#include <triostr.h>
@endverbatim

@b DESCRIPTION

*/

Index: avida/current/source/third-party/trio-1.9/trio/doc/doc_printf.h
+++ avida/current/source/third-party/trio-1.9/trio/doc/doc_printf.h
/*************************************************************************
 *
 * $Id: doc_printf.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/** @addtogroup Printf Formatted Printing Functions.
Variations of formatted printing functions.

@b SYNOPSIS

@verbatim
cc ... -ltrio -lm

#include <trio.h>
@endverbatim

@b DESCRIPTION

This documentation is incomplete.
The documentation of the printf family in [C99] and [UNIX98] also applies
to the trio counterparts.

All these functions outputs a string which is formatted according to the
@p format string and the consecutive arguments. The @p format string is
described in the Formatting section below.

@ref trio_printf, @ref trio_vprintf, and @ref trio_printfv writes the
output to the standard output stream (stdout).

@ref trio_fprintf, @ref trio_vfprintf, and @ref trio_fprintfv writes the
output to a given output stream.

@ref trio_dprintf, @ref trio_vdprintf, and @ref trio_dprintfv writes the
output to a file descriptor (this includes, for example, sockets).

@ref trio_sprintf, @ref trio_vsprintf, and @ref trio_sprintfv writes the
output into @p buffer.

@ref trio_snprintf, @ref trio_vsnprintf, and @ref trio_snprintfv writes @p
max - 1 characters into @p buffer followed by a terminating zero character.
If @p max is 1, then @p buffer will be an empty string. If @p max is 0,
then @p buffer is left untouched, and can consequently be NULL. The number
of characters that would have been written to @p buffer, had there been
sufficient space, is returned.

@ref trio_snprintfcat appends the formatted text at the end of @p buffer.

@ref trio_asprintf and @ref trio_vasprintf allocates and returns an
allocated string in @p buffer containing the formatted text.

@b FORMATTING

The @p format string can contain normal text and conversion indicators.
The normal text can be any character except the nil character (\000 =
'\0') and the percent character (\045 = '%'). Conversion indicators
consists of an indication character (%), followed by zero or more conversion
modifiers, and exactly one conversion specifier.

@b Modifiers

Some modifiers exhibit the same behaviour for all specifiers, other modifiers
indicate different behaviours for different specifiers, and other modifiers
are only applicable to certain specifiers. The relationship is described for
each modifier. The number 9 is used to denotes an arbitrary integer.

@em Positional ( @c 9$ ) [UNIX98]

Normally the arguments supplied to these functions are interpreted
incrementially from left to right. Arguments can be referenced specifically in
the format string. The modifier n$ selects the nth argument. The first
argument is referred as 1$. If this modifier is used, it must be the first
modifier after the indication character. n$ can also be used for argument
width, precision, and base.

The performance penalty of using positionals is almost neglible (contrary to
most other printf implementations).

@li @em Reference @em Mix.
Mixing normal and positional specifiers is allowed [TRIO]. For example,
@verbatim
  trio_printf("%d %3$d %2$d\n", 1, 2, 3);
@endverbatim
results in
@verbatim
  1 3 2
@endverbatim
Arguments for the printf family are passed on the stack. On most platforms it
is not possible to determine the size of individual stack elements, so it is
essential that the format string corresponds exactly to the passed arguments.
If this is not the case, incorrect values may be put into the result.

@li @em Reference @em Gap.
For the same reason it is also essential that the format string does not
contain any &quot;gaps&quot; in the positional arguments. For example,
@verbatim
  trio_printf("%1$d %3$d\n", 1, 2, 3);
@endverbatim
is NOT allowed. The format string parser has no knowledge about whether the
second argument is, say, an integer or a long double (which have different
sizes).
@verbatim
@endverbatim
[UNIX98] describes this as unspecified behaviour. [TRIO] will detect reference
gaps and return an error.

@li @em Double @em Reference.
It is also not allowed to reference an argument twice or more. For example,
@verbatim
  trio_printf("%1$d %1$lf\n", 1);
@endverbatim
is NOT allowed, because it references the first argument as two differently
sized objects.
@verbatim
@endverbatim
[UNIX98] describes this as unspecified behaviour. [TRIO] will detect double
references and return an error.

The following two statements are equivalent
@verbatim
  trio_printf("|%d %s\n|", 42, "meanings");
  |42 meanings|

  trio_printf("|%1$d %2$s|\n", 42, "meanings");
  |42 meanings|
@endverbatim

@em Width ( @c 9 )

Specifies the minimum width of a field. If the fields has less characters than
specified by the width, the field will be left adjusted and padded by spaces.
The adjustment and padding can be changed by the Alignment ( @c - ) and
Padding ( @c 0 ) modifiers.

The width is specified as a number. If an asterix ( @c * ) is used instead, the
width will be read from the argument list.

Prefixes, such as 0x for hexadecimal integers, are part of width.
@verbatim
  trio_printf("|%10i|\n", 42);
  |        42|
@endverbatim

@em Precision ( @c .9 )

The precision has different semantics for the various data types.
The precision specifies the maximum number of printed characters for strings,
the number of digits after the decimal-point for floating-point numbers,
the number of significant digits for the @c g (and @c G) representation of
floating-point numbers, the minimum number of printed digits for integers.
@verbatim
  trio_printf("|%10.8i|%.8i|\n", 42, 42);
  |  00000042|00000042|
@endverbatim
 
@em Base ( @c ..9 ) [TRIO]

Sets the base that the associated integer must be converted to. The base can
be between 2 and 36 (both included).
@verbatim
  trio_printf("|%10.8.2i|%10..2i|%..2i|\n", 42, 42, 42);
  |  00101010|    101010|101010|

  trio_printf("|%*.8.*i|\n", 10, 2, 42);
  |  00101010|
@endverbatim
 
@em Padding ( @c 0 )

Integer and floating point numbers are prepended by zeros. The number of
leading zeros are determined by the precision. If precision is not present,
width is used instead.

@em Short ( @c h )

Integer arguments are read as an ( @c unsigned ) @c short @c int. String
and character arguments are read as @c char @c * and @c char respectively.

@em Short @em short ( @c hh ) [C99, GNU]

The argument is read as an ( @c unsigned ) @c char.

@em Fixed @em Size ( @c I ) [MSVC]

The argument is read as a fixed sized integer. The modifier is followed by
a number, which specifies the number of bits in the integer, and can be one
of the following

@li @c I8
@li @c I16
@li @c I32
@li @c I64 (if 64-bits integers are supported)

Works only for integers (i, u, d, o, x, X)

@em Largest ( @c j ) [C99]

The argument is read as an @c intmax_t / @c uintmax_t, which is defined to
be the largest signed/unsigned integer.

@em Long ( @c l )

An integral argument is read as an ( @c unsigned ) @c long @c int. A string
argument is read as a @c wchar_t @c *, and output as a multi-byte character
sequence.

@em Long @em long ( @c ll ) [C99, UNIX98, GNU]

The argument is read as an ( @c unsigned ) @c long @c long @c int.

@em Long @em double ( @c L ) [C99, UNIX98, GNU]

The argument is read as a @c long @c double.

@em ptrdiff_t ( @c t ) [C99]

The argument is read as a @c ptrdiff_t, which is defined to be the signed
integer type of the result of subtracting two pointers.

@em Quad ( @c q ) [BSD, GNU]

Corresponds to the long long modifier ( @c ll ).

@em Wide ( @c w ) [MISC]

For a string argument this is equivalent to using the long modifier ( @c l ).

@em size_t ( @c z ) [C99]

The argument is read as a @c size_t, which is defined to be the type
returned by the @c sizeof operator.

@em size_t ( @c Z ) [GNU]

Corresponds to the size_t modifier ( @c z ).

@em Alternative ( @c # )

Prepend radix indicator for hexadecimal, octal, and binary integer numbers
and for pointers.
Always add a decimal-pointer for floating-point numbers.
Escape non-printable characters for strings.

@em Spacing ( )

Prepend leading spaces when necessary.

@em Sign ( @c + )

Always prepend a sign to numbers. Normally only the negative sign is prepended
to a number. With this modifier the positive sign may also be prepended.

@em Alignment ( @c - )

The output will be left-justified in the field specified by the width.

@em Argument ( @c * )

Width, precision, or base is read from the argument list, rather than from
the formatting string.

@em Quote / @em Grouping ( @c ' ) [MISC]

Groups integers and the integer-part of floating-point numbers according to
the locale. Quote strings and characters.

@em Sticky ( @c ! ) [TRIO]

The modifiers listed for the current specifier will be reused by subsequent
specifiers of the same group.
The following specifier groups exists
@li Integer ( @c i, @c u, @c d, @c o, @c x, @c X )
@li Floating-point ( @c f, @c F, @c e, @c E, @c g, @c G, @c a, @c A )
@li Character ( @c c )
@li String ( @c s )
@li Pointer ( @c p )
@li Count ( @c n )
@li Errno ( @c m )
@li Group ( @c [] )

The sticky modifiers are active until superseeded by other sticky modifiers,
or the end of the format string is reached.
Local modifiers overrides sticky modifiers for the given specifier only.
@verbatim
  trio_printf("|%!08#x|%04x|%x|\n", 42, 42, 42);
  |0x00002a|0x2a|0x00002a|
@endverbatim

@b Specifiers

@em Percent ( @c % )

Produce a percent ( @c % ) character. This is used to quote the indication
character. No modifiers are allowed.
The full syntax is @c %%.
@verbatim
  trio_printf("Percent is %%\n");
  Percent is %
@endverbatim

@em Hex @em floats ( @c a, @c A ) [C99]

Output a hexadecimal (base 16) representation of a floating point number. The
number is automatically preceeded by @c 0x ( or @c 0X ). The exponent is
@c p ( or @c P ).
@verbatim
  trio_printf("|%a|%A|\n", 3.1415, 3.1415e20);
  |0x3.228bc|0X3.228BCP+14|
@endverbatim

@em Binary @em numbers ( @c b, @c B ) [MISC - SCO UnixWare 7]

DEPRECATED: Use Base modifier @c %..2i instead.

@em Character ( @c c )

Output a single character.

@li Quote ( @c ' ) [TRIO].
Quote the character.

@em Decimal ( @c d )

Output a decimal (base 10) representation of a number.

@li Grouping ( @c ' ) [TRIO].
The number is separated by the locale thousand separator.
@verbatim
  trio_printf("|%'ld|\n", 1234567);
  |1,234,567|
@endverbatim

@em Floating-point ( @c e, @c E)

Output a decimal floating-point number.
The style is @c [-]9.99e[-]9, where
@li @c [-]9.99 is the mantissa (as described for the @c f, @c F specifier), and
@li @c e[-]9 is the exponent indicator (either @c e or @c E, depending on the
floating-point specifier), followed by an optional sign and the exponent

If the precision is wider than the maximum number of digits that can be
represented by the floating-point unit, then the number will be adequately
rounded. For example, assuming DBL_DIG is 15
@verbatim
  trio_printf("|%.18e|\n", (1.0 / 3.0));
  |3.333333333333333000e-01|
@endverbatim

@em Floating-point ( @c f, @c F )

Output a decimal floating-point number.
The style is @c [-]9.99, where
@li @c [-] is an optional sign (either @c + or @c -),
@li @c 9 is the integer-part (possibly interspersed with thousand-separators),
@li @c . is the decimal-point (depending on the locale), and
@li @c 99 is the fractional-part.

If more digits are needed to output the number, than can be represented with
the accuracy of the floating-point unit, then the number will be adequately
rounded. For example, assuming that DBL_DIG is 15
@verbatim
  trio_printf("|%f|\n", (2.0 / 3.0) * 1E18);
  |666666666666666700.000000|
@endverbatim

The following modifiers holds a special meaning for this specifier
@li Alternative ( @c # ) [C99].
Add decimal point.
@li Grouping ( @c ' ) [TRIO].
Group integer part of number into thousands (according to locale).

@em Floating-point ( @c g, @c G)

Output a decimal floating-point representation of a number. The format of
either the @c f, @c F specifier or the @c e, @c E specifier is used, whatever
produces the shortest result.

@em Integer ( @c i )

Output a signed integer. Default base is 10.

@em Errno ( @c m ) [GNU]

@em Count ( @c n )

Insert into the location pointed to by the argument, the number of octets
written to the output so far.

@em Octal ( @c o )

Output an octal (base 8) representation of a number.

@em Pointer ( @c p )

Ouput the address of the argument. The address is printed as a hexadecimal
number. If the argument is the NULL pointer the text @c (nil) will be used
instead.
@li Alternative ( @c # ) [TRIO].
Prepend 0x

@em String ( @c s, @c S )

Output a string. The argument must point to a zero terminated string. If the
argument is the NULL pointer the text @c (nil) will be used instead.
@c S is equivalent to @c ls.
@li Alternative ( @c # ) [TRIO].
Escape non-printable characters.

Non-printable characters are converted into C escapes, or hexadecimal numbers
where no C escapes exists for the character. The C escapes, the hexadecimal
number, and all backslashes are prepended by a backslash ( @c \ ).
The supported C escapes are
@li @c \a (\007) = alert
@li @c \b (\010) = backspace
@li @c \f (\014) = formfeed
@li @c \n (\012) = newline
@li @c \r (\015) = carriage return
@li @c \t (\011) = horizontal tab
@li @c \v (\013) = vertical tab

@verbatim
  trio_printf("|One %s Three|One %'s Three|\n", "Two", "Two");
  |One Two Three|One "Two" Three|

  trio_printf("|Argument missing %s|\n", NULL);
  |Argument missing (nil)|

  trio_printf("|%#s|\n", "\007 \a.");
  |\a \a.|
@endverbatim

@em Unsigned ( @c u )

Output an unsigned integer. Default base is 10.

@em Hex ( @c x, @c X )

Output a hexadecimal (base 16) representation of a number.

@li Alternative ( @c # ).
Preceed the number by @c 0x ( or @c 0X ). The two characters are counted
as part of the width.

@em User-defined ( @c <> )

Invoke user-defined formatting.
See @ref trio_register for further information.

@b RETURN @b VALUES

All functions returns the number of outputted characters. If an error occured
then a negative error code is returned [TRIO]. Note that this is a deviation
from the standard, which simply returns -1 (or EOF) and errno set
appropriately.
The error condition can be detected by checking whether the function returns
a negative number or not, and the number can be parsed with the following
macros. The error codes are primarily intended as debugging aide for the
developer.

@li TRIO_EINVAL: Invalid argument.
@li TRIO_ETOOMANY: Too many arguments.
@li TRIO_EDBLREF: Double argument reference.
@li TRIO_EGAP: Argument reference gap.
@li TRIO_ENOMEM: Out of memory.
@li TRIO_ERANGE: Invalid range.
@li TRIO_ERRNO: The error is specified by the errno variable.

Example:
@verbatim
  int rc;

  rc = trio_printf("%r\n", 42);
  if (rc < 0) {
    if (TRIO_ERROR_CODE(rc) != TRIO_EOF) {
      trio_printf("Error: %s at position %d\n",
                  TRIO_ERROR_NAME(rc),
                  TRIO_ERROR_POSITION(rc));
    }
  }
@endverbatim

@b SEE @b ALSO

@e trio_scanf, @e trio_register.

@b NOTES

The printfv family uses an array rather than the stack to pass arguments.
This means that @c short @c int and @c float values will not be handled by
the default argument promotion in C. Instead, these values must be explicitly
converted with the Short (h) modifier in both cases.

Example:
@verbatim
  void *array[2];
  float float_number = 42.0;
  short short_number = 42;

  array[0] = &float_number;
  array[1] = &short_number;

  trio_printfv("%hf %hd\n", array); /* CORRECT */
  trio_printfv("%f %d\n", array); /* WRONG */
@endverbatim

@b CONFORMING @b TO

Throughout this document the following abbreviations have been used to
indicate what standard a feature conforms to. If nothing else is indicated
ANSI C (C89) is assumed.

@li [C89] ANSI X3.159-1989
@li [C99] ISO/IEC 9899:1999
@li [UNIX98] The Single UNIX Specification, Version 2
@li [BSD] 4.4BSD
@li [GNU] GNU libc
@li [MSVC] Microsoft Visual C
@li [MISC] Other non-standard sources
@li [TRIO] Extensions specific for this package

*/

Index: avida/current/source/third-party/trio-1.9/trio/doc/doc_register.h
+++ avida/current/source/third-party/trio-1.9/trio/doc/doc_register.h
/*************************************************************************
 *
 * $Id: doc_register.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/** @addtogroup UserDefined User-defined Formatted Printing Functions.
Functions for using customized formatting specifiers.

@b SYNOPSIS

@verbatim
cc ... -ltrio -lm

#include <trio.h>
#include <triop.h>
@endverbatim

@b DESCRIPTION

This documentation is incomplete.

@b User-defined @b Specifier

The user-defined specifier consists of a start character (\074 = '<'), an
optional namespace string followed by a namespace separator (\072 = ':'),
a format string, and an end character (\076 = '>').

The namespace string can consist of alphanumeric characters, and is used to
define a named reference (see below). The namespace is case-sensitive. If no
namespace is specified, then we use an unnamed reference (see below).

The format can consist of any character except the end character ('>'), the
namespace separator (':'), and the nil character (\000).

Any modifier can be used together with the user-defined specifier.

@b Registering

A user-defined specifier must be registered before it can be used.
Unregistered user-defined specifiers are ignored. The @ref trio_register
function is used to register a user-defined specifier. It takes two argument,
a callback function and a namespace, and it returns a handle. The handle must
be used to unregister the specifier later. 

The following example registers a user-define specifier with the "my_namespace"
namespace:

@verbatim
  my_handle = trio_register(my_callback, "my_namespace");
@endverbatim

There can only be one user-defined specifier with a given namespace. There
can be an unlimited number (subject to maximum length of the namespace) of
different user-defined specifiers.

Passing NULL as the namespace argument results in an anonymous reference.
There can be an unlimited number of anonymous references.

@b REFERENCES

There are two ways that a registered callback can be called. Either the
user-defined specifier must contain the registered namespace in the format
string, or the handle is passed as an argument to the formatted printing
function.

If the namespace is used, then a user-defined pointer must be passed as an
argument:

@verbatim
  trio_printf("<my_namespace:format>\n", my_data);
@endverbatim

If the handle is used, then the user-defined specifier must not contain a
namespace. Instead the handle must be passed as an argument, followed by a
user-defined pointer:

@verbatim
  trio_printf("<format>\n", my_handle, my_data);
@endverbatim

The two examples above are equivalent.

There must be exactly one user-defined pointer per user-defined specifier.
This pointer can be used within the callback function with the
@ref trio_get_argument getter function (see below).

The format string is optional. It can be used within the callback function
with the @ref trio_get_format getter function.

@b Anonymous @b References
Anonymous references are specified by passing NULL as the namespace.

The handle must be passed as an argument followed by a user-defined pointer.
No namespace can be specified.

@verbatim
  anon_handle = trio_register(callback, NULL);
  trio_printf("<format>\n", anon_handle, my_data);
@endverbatim

@b Restrictions

@li The length of the namespace string cannot exceed 63 characters.
@li The length of the user-defined format string cannot exceed 255 characters.
@li User-defined formatting cannot re-define existing specifiers.
This restriction was imposed because the existing formatting specifiers have
a well-defined behaviour, and any re-definition would apply globally to an
application (imagine a third-party library changing the behaviour of a
specifier that is crusial to your application).

@b CALLBACK @b FUNCTION

The callback function will be called if a matching user-defined specifier
is found within the formatting string. The callback function takes one input
parameter, an opaque reference which is needed by the private functions. It
returns an @c int, which is currently ignored. The prototype is

@verbatim
  int (*trio_callback_t)(void *ref);
@endverbatim

See the Example section for full examples.

@b PRINTING @b FUNCTIONS

The following printing functions must only be used inside a callback function.
These functions will print to the same output medium as the printf function
which invoked the callback function. For example, if the user-defined
specifier is used in an sprintf function, then these print functions will
output their result to the same string.

@b Elementary @b Printing

There are a number of function to print elementary data types.

@li @ref trio_print_int Print a signed integer. For example:
@verbatim
  trio_print_int(42);
@endverbatim
@li @ref trio_print_uint Print an unsigned integer.
@li @ref trio_print_double Print a floating-point number.
@li @ref trio_print_string Print a string. For example:
@verbatim
  trio_print_string("Hello World");
  trio_print_string(trio_get_format());
@endverbatim
@li @ref trio_print_pointer Print a pointer.

@b Formatted @b Printing

The functions @ref trio_print_ref, @ref trio_vprint_ref, and
@ref trio_printv_ref outputs a formatted string just like its printf
equivalents.

@verbatim
  trio_print_ref(ref, "There are %d towels\n", 42);
  trio_print_ref(ref, "%<recursive>\n", recursive_writer, trio_get_argument());
@endverbatim

@b GETTER @b AND @b SETTER @b FUNCTIONS

The following getter and setter functions must only be used inside a callback
function. They can either operate on the modifiers or on special data.

@b Modifiers

The value of a modifier, or a boolean indication of its presence or absence,
can be found or set with the getter and setter functions.
The generic prototypes of the these getter and setter functions are

@verbatim
  int  trio_get_???(void *ref);
  void trio_set_???(void *ref, int);
@endverbatim

where @c ??? refers to a modifier. For example, to get the width of the
user-defined specifier use

@verbatim
  int width = trio_get_width(ref);
@endverbatim

@b Special @b Data

Consider the following user-defined specifier, in its two possible referencing
presentations.

@verbatim
  trio_printf("%<format>\n", namespace_writer, argument);
  trio_printf("%<namespace:format>\n", argument);
@endverbatim

@ref trio_get_format will get the @p format string, and
@ref trio_get_argument} will get the @p argument parameter.
There are no associated setter functions.

@b EXAMPLES

The following examples show various types of user-defined specifiers. Although
each specifier is demonstrated in isolation, they can all co-exist within the
same application.

@b Time @b Example

Print the time in the format "HOUR:MINUTE:SECOND" if "time" is specified inside
the user-defined specifier.

@verbatim
  static int time_writer(void *ref)
  {
    const char *format;
    time_t *data;
    char buffer[256];

    format = trio_get_format(ref);
    if ((format) && (strcmp(format, "time") == 0)) {
      data = trio_get_argument(ref);
      if (data == NULL)
        return -1;
      strftime(buffer, sizeof(buffer), "%H:%M:%S", localtime(data));
      trio_print_string(ref, buffer);
    }
    return 0;
  }
@endverbatim

@verbatim
  int main(void)
  {
    void *handle;
    time_t now = time(NULL);

    handle = trio_register(time_print, "my_time");

    trio_printf("%<time>\n", handle, &now);
    trio_printf("%<my_time:time>\n", &now);

    trio_unregister(handle);
    return 0;
  }
@endverbatim

@b Complex @b Numbers @b Example

Consider a complex number consisting of a real part, re, and an imaginary part,
im.

@verbatim
  struct Complex {
    double re;
    double im;
  };
@endverbatim

This example can print such a complex number in one of two formats.
The default format is "re + i im". If the alternative modifier is used, then
the format is "r exp(i theta)", where r is the length of the complex vector
(re, im) and theta is its angle.

@verbatim
  static int complex_print(void *ref)
  {
    struct Complex *data;
    const char *format;

    data = (struct Complex *)trio_get_argument(ref);
    if (data) {
      format = trio_get_format(ref);

      if (trio_get_alternative(ref)) {
        double r, theta;

        r = sqrt(pow(data->re, 2) + pow(data->im, 2));
        theta = acos(data->re / r);
        trio_print_ref(ref, "%#f exp(i %#f)", r, theta);

      } else {
        trio_print_ref(ref, "%#f + i %#f", data->re, data->im);
      }
    }
    return 0;
  }
@endverbatim

@verbatim
  int main(void)
  {
    void *handle;

    handle = trio_register(complex_print, "complex");

    /* Normal format. With handle and the with namespace */
    trio_printf("%<>\n", handle, &complex);
    trio_printf("%<complex:>\n", &complex);
    /* In exponential notation */
    trio_printf("%#<>\n", handle, &complex);
    trio_printf("%#<complex:unused data>\n", &complex);

    trio_unregister(handle);
    return 0;
  }
@endverbatim

@b RETURN @b VALUES

@ref trio_register returns a handle, or NULL if an error occured.

@b SEE @b ALSO

@ref trio_printf

@b NOTES

User-defined specifiers, @ref trio_register, and @ref trio_unregister are
not thread-safe. In multi-threaded applications they must be guarded by
mutexes. Trio provides two special callback functions, called ":enter" and
":leave", which are invoked every time a thread-unsafe operation is attempted.
As the thread model is determined by the application, these callback functions
must be implemented by the application.

The following callback functions are for demonstration-purposes only.
Replace their bodies with locking and unlocking of a mutex to achieve
thread-safety.
@verbatim
  static int enter_region(void *ref)
  {
    fprintf(stderr, "Enter Region\n");
    return 1;
  }

  static int leave_region(void *ref)
  {
    fprintf(stderr, "Leave Region\n");
    return 1;
  }
@endverbatim
These two callbacks must be registered before other callbacks are registered.
@verbatim
  trio_register(enter_region, ":enter");
  trio_register(leave_region, ":leave");

  another_handle = trio_register(another_callback, NULL);
@endverbatim

*/

Index: avida/current/source/third-party/trio-1.9/trio/doc/doc_scanf.h
+++ avida/current/source/third-party/trio-1.9/trio/doc/doc_scanf.h
/*************************************************************************
 *
 * $Id: doc_scanf.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/** @addtogroup Scanf Formatted Scanning Functions.
Variations of formatted scanning functions.

@b SYNOPSIS

@verbatim
cc ... -ltrio -lm

#include <trio.h>
@endverbatim

@b DESCRIPTION

This documentation is incomplete.
The documentation of the scanf family in [C99] and [UNIX98] also applies
to the trio counterparts.

@b SCANNING

The scanning is controlled by the format string.
The format string can contain normal text and conversion indicators.
The normal text can be any character except the nil character
(\000) and the percent character (\045 = '\%').
Conversion indicators consists of an indication character (%), followed by
zero or more conversion modifiers, and exactly one conversion specifier.

@b Modifiers

@em Positional ( @c 9$ ) [UNIX98]

See @ref trio_printf.

@b Specifiers

@em Percent ( @c % )

@em Character ( @c c )

@em Decimal ( @c d )

@em Floating-point ( @c a, @c A, @c e, @c E, @c f, @c F, @c g, @c G )

@em Integer ( @c i )

@em Count ( @c n )

@em Octal ( @c o )

@em Pointer ( @c p )

@em String ( @c s )

@em Unsigned ( @c u )

@em Hex ( @c x, @c X )

@em Scanlist ( @c [] )

Scanlist Exclusion (@c ^ )

Scanlist Range ( @c - ) [TRIO]

@li Only increasing ranges, i.e. @c [a-b], but not @c [b-a].
@li Transitive ranges, ie. @c [a-b-c] equals @c [a-c].
@li Trailing minus, ie. @c [a-] is interpreted as an @c a and a @c -.
@li Duplicates are ignored.

Scanlist Equivalence Class Expression ( @c [= @c =] ) [TRIO]

Locale dependent (LC_COLLATE).
Only one expression can appear inside the delimiters.
@li @c [=a=] All letters in the same equivalence class as the letter @c a.
@verbatim
  trio_scanf("%[[=a=]b]\n", buffer);
  trio_scanf("%[[=a=][=b=]]\n", buffer);
@endverbatim

Scanlist Character Class Expression ( @c [: @c :]) [TRIO]
Locale dependent (LC_CTYPE).
Only one expression can appear inside the delimiters.
@li @c [:alnum:] Same as @c [:alpha:] and @c [:digit:]
@li @c [:alpha:] Same as @c [:lower:] and @c [:upper:]
@li @c [:cntrl:] Control characters
@li @c [:digit:] Decimal digits
@li @c [:graph:] Printable characters except space
@li @c [:lower:] Lower case alphabetic letters
@li @c [:print:] Printable characters
@li @c [:punct:] Punctuation
@li @c [:space:] Whitespace characters
@li @c [:upper:] Upper case alphabetic letters
@li @c [:xdigit:] Hexadecimal digits
@verbatim
  trio_scanf("%[[:alnum:]]\n", buffer);
  trio_scanf("%[[:alpha:][:digit:]]\n", buffer);
@endverbatim

@b RETURN @b VALUES

@b SEE @b ALSO

@ref trio_printf

*/

Index: avida/current/source/third-party/trio-1.9/trio/doc/doc_static.h
+++ avida/current/source/third-party/trio-1.9/trio/doc/doc_static.h
/*************************************************************************
 *
 * $Id: doc_static.h,v 1.1 2003/11/25 18:20:49 kaben Exp $
 *
 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
 *
 ************************************************************************/

/** @addtogroup StaticStrings Static String Functions.
Replacements for the standard C string functions.

@b SYNOPSIS

@verbatim
cc ... -ltrio -lm

#include <triostr.h>
@endverbatim

@b DESCRIPTION

This package renames, fixes, and extends the standard C string handling
functions.

@b Naming

Renaming is done to provide more clear names, to provide a consistant naming
and argument policy, and to hide portability issues.

@li All functions starts with "trio_".
@li Target is always the first argument, if present, except where the target
is optional, such as @ref trio_to_double.
@li Functions requiring a size for target includes "_max" in its name, and
the size is always the second argument.
@li Functions performing case-sensitive operations includes "_case" in its
name.

@b Fixing

Fixing is done to avoid subtle error conditions.
For example, @c strncpy does not terminate the result with a zero if the
source string is bigger than the maximal length, so technically the result
is not a C string anymore. @ref trio_copy_max makes sure that the result
is zero terminated.

@b Extending

Extending is done to provide a richer set of fundamental functions.
This includes functionality such as wildcard matching ( @c trio_match )
and calculation of hash values ( @c trio_hash ).

*/

Index: avida/current/source/third-party/trio-1.9/trio/doc/footer.html
+++ avida/current/source/third-party/trio-1.9/trio/doc/footer.html
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/doc/header.html
+++ avida/current/source/third-party/trio-1.9/trio/doc/header.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>

Index: avida/current/source/third-party/trio-1.9/trio/doc/trio.cfg
+++ avida/current/source/third-party/trio-1.9/trio/doc/trio.cfg
# Doxyfile 1.2.12

# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
#       TAG = value [value, ...]
# For lists items can also be appended using:
#       TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ")

#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------

# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
# by quotes) that should identify the project.

PROJECT_NAME           = TRIO

# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
# This could be handy for archiving the generated documentation or 
# if some version control system is used.

PROJECT_NUMBER         = 

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
# base path where the generated documentation will be put. 
# If a relative path is entered, it will be relative to the location 
# where doxygen was started. If left blank the current directory will be used.

OUTPUT_DIRECTORY       = 

# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
# documentation generated by doxygen is written. Doxygen will use this 
# information to generate all constant output in the proper language. 
# The default language is English, other supported languages are: 
# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.

OUTPUT_LANGUAGE        = English

# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
# documentation are documented, even if no documentation was available. 
# Private class members and static file members will be hidden unless 
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES

EXTRACT_ALL            = NO

# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
# will be included in the documentation.

EXTRACT_PRIVATE        = NO

# If the EXTRACT_STATIC tag is set to YES all static members of a file 
# will be included in the documentation.

EXTRACT_STATIC         = NO

# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
# undocumented members of documented classes, files or namespaces. 
# If set to NO (the default) these members will be included in the 
# various overviews, but no documentation section is generated. 
# This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_MEMBERS     = YES

# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
# undocumented classes that are normally visible in the class hierarchy. 
# If set to NO (the default) these class will be included in the various 
# overviews. This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_CLASSES     = YES

# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
# include brief member descriptions after the members that are listed in 
# the file and class documentation (similar to JavaDoc). 
# Set to NO to disable this.

BRIEF_MEMBER_DESC      = YES

# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
# the brief description of a member or function before the detailed description. 
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
# brief descriptions will be completely suppressed.

REPEAT_BRIEF           = YES

# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
# Doxygen will generate a detailed section even if there is only a brief 
# description.

ALWAYS_DETAILED_SEC    = NO

# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
# path before files name in the file list and in the header files. If set 
# to NO the shortest path that makes the file name unique will be used.

FULL_PATH_NAMES        = NO

# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
# can be used to strip a user defined part of the path. Stripping is 
# only done if one of the specified strings matches the left-hand part of 
# the path. It is allowed to use relative paths in the argument list.

STRIP_FROM_PATH        = 

# The INTERNAL_DOCS tag determines if documentation 
# that is typed after a \internal command is included. If the tag is set 
# to NO (the default) then the documentation will be excluded. 
# Set it to YES to include the internal documentation.

INTERNAL_DOCS          = NO

# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
# doxygen to hide any special comment blocks from generated source code 
# fragments. Normal C and C++ comments will always remain visible.

STRIP_CODE_COMMENTS    = YES

# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
# file names in lower case letters. If set to YES upper case letters are also 
# allowed. This is useful if you have classes or files whose names only differ 
# in case and if your file system supports case sensitive file names. Windows 
# users are adviced to set this option to NO.

CASE_SENSE_NAMES       = NO

# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
# (but less readable) file names. This can be useful is your file systems 
# doesn't support long names like on DOS, Mac, or CD-ROM.

SHORT_NAMES            = NO

# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
# will show members with their full class and namespace scopes in the 
# documentation. If set to YES the scope will be hidden.

HIDE_SCOPE_NAMES       = NO

# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
# will generate a verbatim copy of the header file for each class for 
# which an include is specified. Set to NO to disable this.

VERBATIM_HEADERS       = NO

# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
# will put list of the files that are included by a file in the documentation 
# of that file.

SHOW_INCLUDE_FILES     = NO

# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
# will interpret the first line (until the first dot) of a JavaDoc-style 
# comment as the brief description. If set to NO, the JavaDoc 
# comments  will behave just like the Qt-style comments (thus requiring an 
# explict @brief command for a brief description.

JAVADOC_AUTOBRIEF      = YES

# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
# member inherits the documentation from any documented member that it 
# reimplements.

INHERIT_DOCS           = YES

# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
# is inserted in the documentation for inline members.

INLINE_INFO            = YES

# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
# will sort the (detailed) documentation of file and class members 
# alphabetically by member name. If set to NO the members will appear in 
# declaration order.

SORT_MEMBER_DOCS       = YES

# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
# tag is set to YES, then doxygen will reuse the documentation of the first 
# member in the group (if any) for the other members of the group. By default 
# all members of a group must be documented explicitly.

DISTRIBUTE_GROUP_DOC   = NO

# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
# Doxygen uses this value to replace tabs by spaces in code fragments.

TAB_SIZE               = 8

# The GENERATE_TODOLIST tag can be used to enable (YES) or 
# disable (NO) the todo list. This list is created by putting \todo 
# commands in the documentation.

GENERATE_TODOLIST      = YES

# The GENERATE_TESTLIST tag can be used to enable (YES) or 
# disable (NO) the test list. This list is created by putting \test 
# commands in the documentation.

GENERATE_TESTLIST      = YES

# The GENERATE_BUGLIST tag can be used to enable (YES) or 
# disable (NO) the bug list. This list is created by putting \bug 
# commands in the documentation.

GENERATE_BUGLIST       = YES

# This tag can be used to specify a number of aliases that acts 
# as commands in the documentation. An alias has the form "name=value". 
# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
# put the command \sideeffect (or @sideeffect) in the documentation, which 
# will result in a user defined paragraph with heading "Side Effects:". 
# You can put \n's in the value part of an alias to insert newlines.

ALIASES                = 

# The ENABLED_SECTIONS tag can be used to enable conditional 
# documentation sections, marked by \if sectionname ... \endif.

ENABLED_SECTIONS       = 

# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
# the initial value of a variable or define consist of for it to appear in 
# the documentation. If the initializer consists of more lines than specified 
# here it will be hidden. Use a value of 0 to hide initializers completely. 
# The appearance of the initializer of individual variables and defines in the 
# documentation can be controlled using \showinitializer or \hideinitializer 
# command in the documentation regardless of this setting.

MAX_INITIALIZER_LINES  = 30

# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
# only. Doxygen will then generate output that is more tailored for C. 
# For instance some of the names that are used will be different. The list 
# of all members will be omitted, etc.

OPTIMIZE_OUTPUT_FOR_C  = YES

# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
# at the bottom of the documentation of classes and structs. If set to YES the 
# list will mention the files that were used to generate the documentation.

SHOW_USED_FILES        = YES

#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------

# The QUIET tag can be used to turn on/off the messages that are generated 
# by doxygen. Possible values are YES and NO. If left blank NO is used.

QUIET                  = NO

# The WARNINGS tag can be used to turn on/off the warning messages that are 
# generated by doxygen. Possible values are YES and NO. If left blank 
# NO is used.

WARNINGS               = YES

# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
# automatically be disabled.

WARN_IF_UNDOCUMENTED   = YES

# The WARN_FORMAT tag determines the format of the warning messages that 
# doxygen can produce. The string should contain the $file, $line, and $text 
# tags, which will be replaced by the file and line number from which the 
# warning originated and the warning text.

WARN_FORMAT            = 

# The WARN_LOGFILE tag can be used to specify a file to which warning 
# and error messages should be written. If left blank the output is written 
# to stderr.

WARN_LOGFILE           = 

#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------

# The INPUT tag can be used to specify the files and/or directories that contain 
# documented source files. You may enter file names like "myfile.cpp" or 
# directories like "/usr/src/myproject". Separate the files or directories 
# with spaces.

INPUT                  = . doc

# If the value of the INPUT tag contains directories, you can use the 
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
# and *.h) to filter out the source-files in the directories. If left 
# blank file matching one of the following patterns are included: 
# *.c *.cc *.cxx *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
# *.h++ *.idl

FILE_PATTERNS          = *.h *.c

# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
# should be searched for input files as well. Possible values are YES and NO. 
# If left blank NO is used.

RECURSIVE              = NO

# The EXCLUDE tag can be used to specify files and/or directories that should 
# excluded from the INPUT source files. This way you can easily exclude a 
# subdirectory from a directory tree whose root is specified with the INPUT tag.

EXCLUDE                = 

# If the value of the INPUT tag contains directories, you can use the 
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
# certain files from those directories.

EXCLUDE_PATTERNS       = 

# The EXAMPLE_PATH tag can be used to specify one or more files or 
# directories that contain example code fragments that are included (see 
# the \include command).

EXAMPLE_PATH           = doc

# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
# and *.h) to filter out the source-files in the directories. If left 
# blank all files are included.

EXAMPLE_PATTERNS       = 

# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
# searched for input files to be used with the \include or \dontinclude 
# commands irrespective of the value of the RECURSIVE tag. 
# Possible values are YES and NO. If left blank NO is used.

EXAMPLE_RECURSIVE      = NO

# The IMAGE_PATH tag can be used to specify one or more files or 
# directories that contain image that are included in the documentation (see 
# the \image command).

IMAGE_PATH             = 

# The INPUT_FILTER tag can be used to specify a program that doxygen should 
# invoke to filter for each input file. Doxygen will invoke the filter program 
# by executing (via popen()) the command <filter> <input-file>, where <filter> 
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
# input file. Doxygen will then use the output that the filter program writes 
# to standard output.

INPUT_FILTER           = 

# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
# INPUT_FILTER) will be used to filter the input files when producing source 
# files to browse.

FILTER_SOURCE_FILES    = NO

#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------

# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
# be generated. Documented entities will be cross-referenced with these sources.

SOURCE_BROWSER         = NO

# Setting the INLINE_SOURCES tag to YES will include the body 
# of functions and classes directly in the documentation.

INLINE_SOURCES         = NO

# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
# then for each documented function all documented 
# functions referencing it will be listed.

REFERENCED_BY_RELATION = YES

# If the REFERENCES_RELATION tag is set to YES (the default) 
# then for each documented function all documented entities 
# called/used by that function will be listed.

REFERENCES_RELATION    = YES

#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------

# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
# of all compounds will be generated. Enable this if the project 
# contains a lot of classes, structs, unions or interfaces.

ALPHABETICAL_INDEX     = NO

# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
# in which this list will be split (can be a number in the range [1..20])

COLS_IN_ALPHA_INDEX    = 5

# In case all classes in a project start with a common prefix, all 
# classes will be put under the same header in the alphabetical index. 
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
# should be ignored while generating the index headers.

IGNORE_PREFIX          = 

#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------

# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
# generate HTML output.

GENERATE_HTML          = YES

# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
# put in front of it. If left blank `html' will be used as the default path.

HTML_OUTPUT            = 

# The HTML_HEADER tag can be used to specify a personal HTML header for 
# each generated HTML page. If it is left blank doxygen will generate a 
# standard header.

HTML_HEADER            = doc/header.html

# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
# each generated HTML page. If it is left blank doxygen will generate a 
# standard footer.

HTML_FOOTER            = doc/footer.html

# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
# style sheet that is used by each HTML page. It can be used to 
# fine-tune the look of the HTML output. If the tag is left blank doxygen 
# will generate a default style sheet

HTML_STYLESHEET        = doc/trio.css

# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
# files or namespaces will be aligned in HTML using tables. If set to 
# NO a bullet list will be used.

HTML_ALIGN_MEMBERS     = YES

# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
# will be generated that can be used as input for tools like the 
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
# of the generated HTML documentation.

GENERATE_HTMLHELP      = NO

# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
# controls if a separate .chi index file is generated (YES) or that 
# it should be included in the master .chm file (NO).

GENERATE_CHI           = NO

# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
# controls whether a binary table of contents is generated (YES) or a 
# normal table of contents (NO) in the .chm file.

BINARY_TOC             = NO

# The TOC_EXPAND flag can be set to YES to add extra items for group members 
# to the contents of the Html help documentation and to the tree view.

TOC_EXPAND             = NO

# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
# top of each HTML page. The value NO (the default) enables the index and 
# the value YES disables it.

DISABLE_INDEX          = NO

# This tag can be used to set the number of enum values (range [1..20]) 
# that doxygen will group on one line in the generated HTML documentation.

ENUM_VALUES_PER_LINE   = 4

# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
# generated containing a tree-like index structure (just like the one that 
# is generated for HTML Help). For this to work a browser that supports 
# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, 
# or Internet explorer 4.0+). Note that for large projects the tree generation 
# can take a very long time. In such cases it is better to disable this feature. 
# Windows users are probably better off using the HTML help feature.

GENERATE_TREEVIEW      = NO

# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
# used to set the initial width (in pixels) of the frame in which the tree 
# is shown.

TREEVIEW_WIDTH         = 250

#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------

# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
# generate Latex output.

GENERATE_LATEX         = NO

# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
# put in front of it. If left blank `latex' will be used as the default path.

LATEX_OUTPUT           = 

# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
# LaTeX documents. This may be useful for small projects and may help to 
# save some trees in general.

COMPACT_LATEX          = NO

# The PAPER_TYPE tag can be used to set the paper type that is used 
# by the printer. Possible values are: a4, a4wide, letter, legal and 
# executive. If left blank a4wide will be used.

PAPER_TYPE             = a4wide

# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
# packages that should be included in the LaTeX output.

EXTRA_PACKAGES         = 

# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
# the generated latex document. The header should contain everything until 
# the first chapter. If it is left blank doxygen will generate a 
# standard header. Notice: only use this tag if you know what you are doing!

LATEX_HEADER           = 

# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
# contain links (just like the HTML output) instead of page references 
# This makes the output suitable for online browsing using a pdf viewer.

PDF_HYPERLINKS         = NO

# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
# plain latex in the generated Makefile. Set this option to YES to get a 
# higher quality PDF documentation.

USE_PDFLATEX           = NO

# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
# command to the generated LaTeX files. This will instruct LaTeX to keep 
# running if errors occur, instead of asking the user for help. 
# This option is also used when generating formulas in HTML.

LATEX_BATCHMODE        = NO

#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------

# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
# The RTF output is optimised for Word 97 and may not look very pretty with 
# other RTF readers or editors.

GENERATE_RTF           = NO

# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
# put in front of it. If left blank `rtf' will be used as the default path.

RTF_OUTPUT             = 

# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
# RTF documents. This may be useful for small projects and may help to 
# save some trees in general.

COMPACT_RTF            = NO

# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
# will contain hyperlink fields. The RTF file will 
# contain links (just like the HTML output) instead of page references. 
# This makes the output suitable for online browsing using WORD or other 
# programs which support those fields. 
# Note: wordpad (write) and others do not support links.

RTF_HYPERLINKS         = NO

# Load stylesheet definitions from file. Syntax is similar to doxygen's 
# config file, i.e. a series of assigments. You only have to provide 
# replacements, missing definitions are set to their default value.

RTF_STYLESHEET_FILE    = 

# Set optional variables used in the generation of an rtf document. 
# Syntax is similar to doxygen's config file.

RTF_EXTENSIONS_FILE    = 

#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------

# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
# generate man pages

GENERATE_MAN           = NO

# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
# put in front of it. If left blank `man' will be used as the default path.

MAN_OUTPUT             = 

# The MAN_EXTENSION tag determines the extension that is added to 
# the generated man pages (default is the subroutine's section .3)

MAN_EXTENSION          = 

# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.

MAN_LINKS              = NO

#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------

# If the GENERATE_XML tag is set to YES Doxygen will 
# generate an XML file that captures the structure of 
# the code including all documentation. Note that this 
# feature is still experimental and incomplete at the 
# moment.

GENERATE_XML           = NO

#---------------------------------------------------------------------------
# Configuration options related to the preprocessor   
#---------------------------------------------------------------------------

# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
# evaluate all C-preprocessor directives found in the sources and include 
# files.

ENABLE_PREPROCESSING   = YES

# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
# names in the source code. If set to NO (the default) only conditional 
# compilation will be performed. Macro expansion can be done in a controlled 
# way by setting EXPAND_ONLY_PREDEF to YES.

MACRO_EXPANSION        = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
# then the macro expansion is limited to the macros specified with the 
# PREDEFINED and EXPAND_AS_PREDEFINED tags.

EXPAND_ONLY_PREDEF     = YES

# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
# in the INCLUDE_PATH (see below) will be search if a #include is found.

SEARCH_INCLUDES        = YES

# The INCLUDE_PATH tag can be used to specify one or more directories that 
# contain include files that are not input files but should be processed by 
# the preprocessor.

INCLUDE_PATH           = 

# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
# patterns (like *.h and *.hpp) to filter out the header-files in the 
# directories. If left blank, the patterns specified with FILE_PATTERNS will 
# be used.

INCLUDE_FILE_PATTERNS  = 

# The PREDEFINED tag can be used to specify one or more macro names that 
# are defined before the preprocessor is started (similar to the -D option of 
# gcc). The argument of the tag is a list of macros of the form: name 
# or name=definition (no spaces). If the definition and the = are 
# omitted =1 is assumed.

PREDEFINED             = __STDC__=1 TRIO_DOCUMENTATION= TRIO_PUBLIC= TRIO_PRIVATE=static TRIO_CONST=const TRIO_VOLATILE=volatile TRIO_SIGNED=signed TRIO_INLINE=inline TRIO_NOARGS=void TRIO_ARGS1(z,a)=(a) TRIO_ARGS2(z,a,b)=(a,b) TRIO_ARGS3(z,a,b,c)=(a,b,c) TRIO_ARGS4(z,a,b,c,d)=(a,b,c,d) TRIO_ARGS5(z,a,b,c,d,e)=(a,b,c,d,e) TRIO_ARGS6(z,a,b,c,d,e,f)=(a,b,c,d,e,f) TRIO_VARGS2(z,a,b)=(a,b) TRIO_VARGS3(z,a,b,c)=(a,b,c) TRIO_VARGS4(z,a,b,c,d)=(a,b,c,d) TRIO_VARGS5(z,a,b,c,d,e)=(a,b,c,d,e)

# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
# this tag can be used to specify a list of macro names that should be expanded. 
# The macro definition that is found in the sources will be used. 
# Use the PREDEFINED tag if you want to use a different macro definition.

EXPAND_AS_DEFINED      = 

# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
# doxygen's preprocessor will remove all function-like macros that are alone 
# on a line and do not end with a semicolon. Such function macros are typically 
# used for boiler-plate code, and will confuse the parser if not removed.

SKIP_FUNCTION_MACROS   = YES

#---------------------------------------------------------------------------
# Configuration::addtions related to external references   
#---------------------------------------------------------------------------

# The TAGFILES tag can be used to specify one or more tagfiles.

TAGFILES               = 

# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
# a tag file that is based on the input files it reads.

GENERATE_TAGFILE       = 

# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
# in the class index. If set to NO only the inherited external classes 
# will be listed.

ALLEXTERNALS           = NO

# The PERL_PATH should be the absolute path and name of the perl script 
# interpreter (i.e. the result of `which perl').

PERL_PATH              = 

#---------------------------------------------------------------------------
# Configuration options related to the dot tool   
#---------------------------------------------------------------------------

# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or 
# super classes. Setting the tag to NO turns the diagrams off. Note that this 
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is 
# recommended to install and use dot, since it yield more powerful graphs.

CLASS_DIAGRAMS         = YES

# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
# available from the path. This tool is part of Graphviz, a graph visualization 
# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
# have no effect if this option is set to NO (the default)

HAVE_DOT               = NO

# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
# will generate a graph for each documented class showing the direct and 
# indirect inheritance relations. Setting this tag to YES will force the 
# the CLASS_DIAGRAMS tag to NO.

CLASS_GRAPH            = YES

# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
# will generate a graph for each documented class showing the direct and 
# indirect implementation dependencies (inheritance, containment, and 
# class references variables) of the class with other documented classes.

COLLABORATION_GRAPH    = YES

# If set to YES, the inheritance and collaboration graphs will show the 
# relations between templates and their instances.

TEMPLATE_RELATIONS     = YES

# If set to YES, the inheritance and collaboration graphs will hide 
# inheritance and usage relations if the target is undocumented 
# or is not a class.

HIDE_UNDOC_RELATIONS   = YES

# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
# tags are set to YES then doxygen will generate a graph for each documented 
# file showing the direct and indirect include dependencies of the file with 
# other documented files.

INCLUDE_GRAPH          = YES

# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
# documented header file showing the documented files that directly or 
# indirectly include this file.

INCLUDED_BY_GRAPH      = YES

# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
# will graphical hierarchy of all classes instead of a textual one.

GRAPHICAL_HIERARCHY    = YES

# The tag DOT_PATH can be used to specify the path where the dot tool can be 
# found. If left blank, it is assumed the dot tool can be found on the path.

DOT_PATH               = 

# The DOTFILE_DIRS tag can be used to specify one or more directories that 
# contain dot files that are included in the documentation (see the 
# \dotfile command).

DOTFILE_DIRS           = 

# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
# this value, doxygen will try to truncate the graph, so that it fits within 
# the specified constraint. Beware that most browsers cannot cope with very 
# large images.

MAX_DOT_GRAPH_WIDTH    = 1024

# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
# this value, doxygen will try to truncate the graph, so that it fits within 
# the specified constraint. Beware that most browsers cannot cope with very 
# large images.

MAX_DOT_GRAPH_HEIGHT   = 1024

# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
# generate a legend page explaining the meaning of the various boxes and 
# arrows in the dot generated graphs.

GENERATE_LEGEND        = YES

# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
# remove the intermedate dot files that are used to generate 
# the various graphs.

DOT_CLEANUP            = YES

#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine   
#---------------------------------------------------------------------------

# The SEARCHENGINE tag specifies whether or not a search engine should be 
# used. If set to NO the values of all tags below this one will be ignored.

SEARCHENGINE           = NO

# The CGI_NAME tag should be the name of the CGI script that 
# starts the search engine (doxysearch) with the correct parameters. 
# A script with this name will be generated by doxygen.

CGI_NAME               = 

# The CGI_URL tag should be the absolute URL to the directory where the 
# cgi binaries are located. See the documentation of your http daemon for 
# details.

CGI_URL                = 

# The DOC_URL tag should be the absolute URL to the directory where the 
# documentation is located. If left blank the absolute path to the 
# documentation, with file:// prepended to it, will be used.

DOC_URL                = 

# The DOC_ABSPATH tag should be the absolute path to the directory where the 
# documentation is located. If left blank the directory on the local machine 
# will be used.

DOC_ABSPATH            = 

# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
# is installed.

BIN_ABSPATH            = 

# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
# documentation generated for other projects. This allows doxysearch to search 
# the documentation for these projects as well.

EXT_DOC_PATHS          = 

Index: avida/current/source/third-party/trio-1.9/trio/doc/trio.css
+++ avida/current/source/third-party/trio-1.9/trio/doc/trio.css
/* HTML tags */

BODY {
 background-color: white;
 color: darkblue;
}

TD { color: darkblue; }

H1 { text-align: center; }

H3 { font-style: italic; }

HR {
 width: 85%;
 align: center;
}

copyright { color: darkblue; }

/* Links */

:link { color: blue; }

:visited { color: purple; }

:active { color: red; }

el:link { font-style: italic; }

/* Examples */

DIV.fragment {
 color: maroon;
}

Index: avida/current/source/third-party/trio-1.9/trio/html/group___dynamic_strings.html
+++ avida/current/source/third-party/trio-1.9/trio/html/group___dynamic_strings.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>Dynamic String Functions.</h1>Dynamic string functions. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>trio_string_t *&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a3">trio_string_create</a> (int initial_size)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Create a new dynamic string.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a4">trio_string_destroy</a> (trio_string_t *self)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Deallocate the dynamic string and its contents.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a5">trio_string_get</a> (trio_string_t *self, int offset)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Get a pointer to the content.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a6">trio_string_extract</a> (trio_string_t *self)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Extract the content.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a7">trio_xstring_set</a> (trio_string_t *self, char *buffer)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Set the content of the dynamic string.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a10">trio_string_append</a> (trio_string_t *self, trio_string_t *other)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Append the second string to the first.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a13">trio_string_contains</a> (trio_string_t *self, trio_string_t *other)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Search for the first occurrence of second parameter in the first.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Dynamic string functions.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;triostr.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b> <hr><h2>Function Documentation</h2>
<a name="a10" doxytag="triostr.c::trio_string_append"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_string_append </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>other</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Append the second string to the first.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string to be modified. </td></tr>
<tr><td valign=top><em>other</em>&nbsp;</td><td>
Dynamic string to copy from. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure. </dl>    </td>
  </tr>
</table>
<a name="a13" doxytag="triostr.c::trio_string_contains"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_string_contains </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>other</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Search for the first occurrence of second parameter in the first.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string to be modified. </td></tr>
<tr><td valign=top><em>other</em>&nbsp;</td><td>
Dynamic string to copy from. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure. </dl>    </td>
  </tr>
</table>
<a name="a3" doxytag="triostr.c::trio_string_create"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> trio_string_t* trio_string_create </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>initial_size</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create a new dynamic string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>initial_size</em>&nbsp;</td><td>
Initial size of the buffer. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Newly allocated dynamic string, or NULL if memory allocation failed. </dl>    </td>
  </tr>
</table>
<a name="a4" doxytag="triostr.c::trio_string_destroy"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void trio_string_destroy </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>self</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Deallocate the dynamic string and its contents.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a6" doxytag="triostr.c::trio_string_extract"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_string_extract </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>self</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Extract the content.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic String </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Content of dynamic string.</dl>The content is removed from the dynamic string. This enables destruction of the dynamic string without deallocation of the content.     </td>
  </tr>
</table>
<a name="a5" doxytag="triostr.c::trio_string_get"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_string_get </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>offset</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get a pointer to the content.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string. </td></tr>
<tr><td valign=top><em>offset</em>&nbsp;</td><td>
Offset into content. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Pointer to the content.</dl><code>Offset</code> can be zero, positive, or negative. If <code>offset</code> is zero, then the start of the content will be returned. If <code>offset</code> is positive, then a pointer to <code>offset</code> number of characters from the beginning of the content is returned. If <code>offset</code> is negative, then a pointer to <code>offset</code> number of characters from the ending of the string, starting at the terminating zero, is returned.     </td>
  </tr>
</table>
<a name="a7" doxytag="triostr.c::trio_xstring_set"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void trio_xstring_set </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set the content of the dynamic string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic String </td></tr>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
The new content.</td></tr>
</table>
</dl>Sets the content of the dynamic string to a copy <code>buffer</code>. An existing content will be deallocated first, if necessary.
<p>
<dl compact><dt><b>
Remarks: </b><dd>
 This function will make a copy of <code>buffer</code>. You are responsible for deallocating <code>buffer</code> yourself. </dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/group___printf.html
+++ avida/current/source/third-party/trio-1.9/trio/html/group___printf.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>Formatted Printing Functions.</h1>Variations of formatted printing functions. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a0">trio_printf</a> (const char *format,...)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to standard output stream.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a1">trio_vprintf</a> (const char *format, va_list args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to standard output stream.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a2">trio_printfv</a> (const char *format, trio_pointer_t *args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to standard output stream.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a3">trio_fprintf</a> (FILE *file, const char *format,...)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to file.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a4">trio_vfprintf</a> (FILE *file, const char *format, va_list args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to file.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a5">trio_fprintfv</a> (FILE *file, const char *format, trio_pointer_t *args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to file.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a6">trio_dprintf</a> (int fd, const char *format,...)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to file descriptor.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a7">trio_vdprintf</a> (int fd, const char *format, va_list args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to file descriptor.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a8">trio_dprintfv</a> (int fd, const char *format, trio_pointer_t *args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to file descriptor.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a9">trio_sprintf</a> (char *buffer, const char *format,...)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to string.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a10">trio_vsprintf</a> (char *buffer, const char *format, va_list args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to string.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a11">trio_sprintfv</a> (char *buffer, const char *format, trio_pointer_t *args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print to string.</em> <a href="#a11">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a12">trio_snprintf</a> (char *buffer, size_t max, const char *format,...)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print at most <code>max</code> characters to string.</em> <a href="#a12">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a13">trio_vsnprintf</a> (char *buffer, size_t max, const char *format, va_list args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print at most <code>max</code> characters to string.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___printf.html#a14">trio_snprintfv</a> (char *buffer, size_t max, const char *format, trio_pointer_t *args)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Print at most <code>max</code> characters to string.</em> <a href="#a14">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Variations of formatted printing functions.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;trio.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b>
<p>
This documentation is incomplete. The documentation of the printf family in [C99] and [UNIX98] also applies to the trio counterparts.
<p>
All these functions outputs a string which is formatted according to the <code>format</code> string and the consecutive arguments. The <code>format</code> string is described in the Formatting section below.
<p>
<a class="el" href="group___printf.html#a0">trio_printf</a>, <a class="el" href="group___printf.html#a1">trio_vprintf</a>, and <a class="el" href="group___printf.html#a2">trio_printfv</a> writes the output to the standard output stream (stdout).
<p>
<a class="el" href="group___printf.html#a3">trio_fprintf</a>, <a class="el" href="group___printf.html#a4">trio_vfprintf</a>, and <a class="el" href="group___printf.html#a5">trio_fprintfv</a> writes the output to a given output stream.
<p>
<a class="el" href="group___printf.html#a6">trio_dprintf</a>, <a class="el" href="group___printf.html#a7">trio_vdprintf</a>, and <a class="el" href="group___printf.html#a8">trio_dprintfv</a> writes the output to a file descriptor (this includes, for example, sockets).
<p>
<a class="el" href="group___printf.html#a9">trio_sprintf</a>, <a class="el" href="group___printf.html#a10">trio_vsprintf</a>, and <a class="el" href="group___printf.html#a11">trio_sprintfv</a> writes the output into <code>buffer</code>.
<p>
<a class="el" href="group___printf.html#a12">trio_snprintf</a>, <a class="el" href="group___printf.html#a13">trio_vsnprintf</a>, and <a class="el" href="group___printf.html#a14">trio_snprintfv</a> writes <code>max</code> - 1 characters into <code>buffer</code> followed by a terminating zero character. If <code>max</code> is 1, then <code>buffer</code> will be an empty string. If <code>max</code> is 0, then <code>buffer</code> is left untouched, and can consequently be NULL. The number of characters that would have been written to <code>buffer</code>, had there been sufficient space, is returned.
<p>
trio_snprintfcat appends the formatted text at the end of <code>buffer</code>.
<p>
trio_asprintf and trio_vasprintf allocates and returns an allocated string in <code>buffer</code> containing the formatted text.
<p>
<b>FORMATTING</b>
<p>
The <code>format</code> string can contain normal text and conversion indicators. The normal text can be any character except the nil character (\000 = '\0') and the percent character (\045 = '%'). Conversion indicators consists of an indication character (%), followed by zero or more conversion modifiers, and exactly one conversion specifier.
<p>
<b>Modifiers</b>
<p>
Some modifiers exhibit the same behaviour for all specifiers, other modifiers indicate different behaviours for different specifiers, and other modifiers are only applicable to certain specifiers. The relationship is described for each modifier. The number 9 is used to denotes an arbitrary integer.
<p>
<em>Positional</em> ( <code>9$</code> ) [UNIX98]
<p>
Normally the arguments supplied to these functions are interpreted incrementially from left to right. Arguments can be referenced specifically in the format string. The modifier n$ selects the nth argument. The first argument is referred as 1$. If this modifier is used, it must be the first modifier after the indication character. n$ can also be used for argument width, precision, and base.
<p>
The performance penalty of using positionals is almost neglible (contrary to most other printf implementations).
<p>
<ul>
<li> <em>Reference</em> <em>Mix</em>. Mixing normal and positional specifiers is allowed [TRIO]. For example, <div class="fragment"><pre>
  trio_printf("%d %3$d %2$d\n", 1, 2, 3);
</pre></div> results in <div class="fragment"><pre>
  1 3 2
</pre></div> Arguments for the printf family are passed on the stack. On most platforms it is not possible to determine the size of individual stack elements, so it is essential that the format string corresponds exactly to the passed arguments. If this is not the case, incorrect values may be put into the result.</ul>
<ul>
<li> <em>Reference</em> <em>Gap</em>. For the same reason it is also essential that the format string does not contain any "gaps" in the positional arguments. For example, <div class="fragment"><pre>
  trio_printf("%1$d %3$d\n", 1, 2, 3);
</pre></div> is NOT allowed. The format string parser has no knowledge about whether the second argument is, say, an integer or a long double (which have different sizes). <div class="fragment"><pre>
</pre></div> [UNIX98] describes this as unspecified behaviour. [TRIO] will detect reference gaps and return an error.</ul>
<ul>
<li> <em>Double</em> <em>Reference</em>. It is also not allowed to reference an argument twice or more. For example, <div class="fragment"><pre>
  trio_printf("%1$d %1$lf\n", 1);
</pre></div> is NOT allowed, because it references the first argument as two differently sized objects. <div class="fragment"><pre>
</pre></div> [UNIX98] describes this as unspecified behaviour. [TRIO] will detect double references and return an error.</ul>
The following two statements are equivalent <div class="fragment"><pre>
  trio_printf("|%d %s\n|", 42, "meanings");
  |42 meanings|

  trio_printf("|%1$d %2$s|\n", 42, "meanings");
  |42 meanings|
</pre></div>
<p>
<em>Width</em> ( <code>9</code> )
<p>
Specifies the minimum width of a field. If the fields has less characters than specified by the width, the field will be left adjusted and padded by spaces. The adjustment and padding can be changed by the Alignment ( <code>-</code> ) and Padding ( <code>0</code> ) modifiers.
<p>
The width is specified as a number. If an asterix ( <code>*</code> ) is used instead, the width will be read from the argument list.
<p>
Prefixes, such as 0x for hexadecimal integers, are part of width. <div class="fragment"><pre>
  trio_printf("|%10i|\n", 42);
  |        42|
</pre></div>
<p>
<em>Precision</em> ( .<code>9</code> )
<p>
The precision has different semantics for the various data types. The precision specifies the maximum number of printed characters for strings, the number of digits after the decimal-point for floating-point numbers, the number of significant digits for the <code>g</code> (and <code>G)</code> representation of floating-point numbers, the minimum number of printed digits for integers. <div class="fragment"><pre>
  trio_printf("|%10.8i|%.8i|\n", 42, 42);
  |  00000042|00000042|
</pre></div>
<p>
<em>Base</em> ( ..<code>9</code> ) [TRIO]
<p>
Sets the base that the associated integer must be converted to. The base can be between 2 and 36 (both included). <div class="fragment"><pre>
  trio_printf("|%10.8.2i|%10..2i|%..2i|\n", 42, 42, 42);
  |  00101010|    101010|101010|

  trio_printf("|%*.8.*i|\n", 10, 2, 42);
  |  00101010|
</pre></div>
<p>
<em>Padding</em> ( <code>0</code> )
<p>
Integer and floating point numbers are prepended by zeros. The number of leading zeros are determined by the precision. If precision is not present, width is used instead.
<p>
<em>Short</em> ( <code>h</code> )
<p>
Integer arguments are read as an ( <code>unsigned</code> ) <code>short</code> <code>int</code>. String and character arguments are read as <code>char</code> <code>*</code> and <code>char</code> respectively.
<p>
<em>Short</em> <em>short</em> ( <code>hh</code> ) [C99, GNU]
<p>
The argument is read as an ( <code>unsigned</code> ) <code>char</code>.
<p>
<em>Fixed</em> <em>Size</em> ( <code>I</code> ) [MSVC]
<p>
The argument is read as a fixed sized integer. The modifier is followed by a number, which specifies the number of bits in the integer, and can be one of the following
<p>
<ul>
<li> <code>I8</code> <li> <code>I16</code> <li> <code>I32</code> <li> <code>I64</code> (if 64-bits integers are supported)</ul>
Works only for integers (i, u, d, o, x, X)
<p>
<em>Largest</em> ( <code>j</code> ) [C99]
<p>
The argument is read as an <code>intmax_t</code> / <code>uintmax_t</code>, which is defined to be the largest signed/unsigned integer.
<p>
<em>Long</em> ( <code>l</code> )
<p>
An integral argument is read as an ( <code>unsigned</code> ) <code>long</code> <code>int</code>. A string argument is read as a <code>wchar_t</code> <code>*</code>, and output as a multi-byte character sequence.
<p>
<em>Long</em> <em>long</em> ( <code>ll</code> ) [C99, UNIX98, GNU]
<p>
The argument is read as an ( <code>unsigned</code> ) <code>long</code> <code>long</code> <code>int</code>.
<p>
<em>Long</em> <em>double</em> ( <code>L</code> ) [C99, UNIX98, GNU]
<p>
The argument is read as a <code>long</code> <code>double</code>.
<p>
<em>ptrdiff_t</em> ( <code>t</code> ) [C99]
<p>
The argument is read as a <code>ptrdiff_t</code>, which is defined to be the signed integer type of the result of subtracting two pointers.
<p>
<em>Quad</em> ( <code>q</code> ) [BSD, GNU]
<p>
Corresponds to the long long modifier ( <code>ll</code> ).
<p>
<em>Wide</em> ( <code>w</code> ) [MISC]
<p>
For a string argument this is equivalent to using the long modifier ( <code>l</code> ).
<p>
<em>size_t</em> ( <code>z</code> ) [C99]
<p>
The argument is read as a <code>size_t</code>, which is defined to be the type returned by the <code>sizeof</code> operator.
<p>
<em>size_t</em> ( <code>Z</code> ) [GNU]
<p>
Corresponds to the size_t modifier ( <code>z</code> ).
<p>
<em>Alternative</em> ( <code>#</code> )
<p>
Prepend radix indicator for hexadecimal, octal, and binary integer numbers and for pointers. Always add a decimal-pointer for floating-point numbers. Escape non-printable characters for strings.
<p>
<em>Spacing</em> ( )
<p>
Prepend leading spaces when necessary.
<p>
<em>Sign</em> ( <code>+</code> )
<p>
Always prepend a sign to numbers. Normally only the negative sign is prepended to a number. With this modifier the positive sign may also be prepended.
<p>
<em>Alignment</em> ( <code>-</code> )
<p>
The output will be left-justified in the field specified by the width.
<p>
<em>Argument</em> ( <code>*</code> )
<p>
Width, precision, or base is read from the argument list, rather than from the formatting string.
<p>
<em>Quote</em> / <em>Grouping</em> ( ' <code>)</code> [MISC]
<p>
Groups integers and the integer-part of floating-point numbers according to the locale. Quote strings and characters.
<p>
<em>Sticky</em> ( <code>!</code> ) [TRIO]
<p>
The modifiers listed for the current specifier will be reused by subsequent specifiers of the same group. The following specifier groups exists <ul>
<li> Integer ( <code>i</code>, <code>u</code>, <code>d</code>, <code>o</code>, <code>x</code>, <code>X</code> ) <li> Floating-point ( <code>f</code>, <code>F</code>, <code>e</code>, <code>E</code>, <code>g</code>, <code>G</code>, <code>a</code>, <code>A</code> ) <li> Character ( <code>c</code> ) <li> String ( <code>s</code> ) <li> Pointer ( <code>p</code> ) <li> Count ( <code>n</code> ) <li> Errno ( <code>m</code> ) <li> Group ( <code>[]</code> )</ul>
The sticky modifiers are active until superseeded by other sticky modifiers, or the end of the format string is reached. Local modifiers overrides sticky modifiers for the given specifier only. <div class="fragment"><pre>
  trio_printf("|%!08#x|%04x|%x|\n", 42, 42, 42);
  |0x00002a|0x2a|0x00002a|
</pre></div>
<p>
<b>Specifiers</b>
<p>
<em>Percent</em> ( <code>%</code> )
<p>
Produce a percent ( <code>%</code> ) character. This is used to quote the indication character. No modifiers are allowed. The full syntax is <code>%%</code>. <div class="fragment"><pre>
  trio_printf("Percent is %%\n");
  Percent is %
</pre></div>
<p>
<em>Hex</em> <em>floats</em> ( <code>a</code>, <code>A</code> ) [C99]
<p>
Output a hexadecimal (base 16) representation of a floating point number. The number is automatically preceeded by <code>0x</code> ( or <code>0X</code> ). The exponent is <code>p</code> ( or <code>P</code> ). <div class="fragment"><pre>
  trio_printf("|%a|%A|\n", 3.1415, 3.1415e20);
  |0x3.228bc|0X3.228BCP+14|
</pre></div>
<p>
<em>Binary</em> <em>numbers</em> ( <code>b</code>, <code>B</code> ) [MISC - SCO UnixWare 7]
<p>
DEPRECATED: Use Base modifier <code>%..2i</code> instead.
<p>
<em>Character</em> ( <code>c</code> )
<p>
Output a single character.
<p>
<ul>
<li> Quote ( ' <code>)</code> [TRIO]. Quote the character.</ul>
<em>Decimal</em> ( <code>d</code> )
<p>
Output a decimal (base 10) representation of a number.
<p>
<ul>
<li> Grouping ( ' <code>)</code> [TRIO]. The number is separated by the locale thousand separator. <div class="fragment"><pre>
  trio_printf("|%'ld|\n", 1234567);
  |1,234,567|
</pre></div></ul>
<em>Floating-point</em> ( <code>e</code>, <code>E)</code>
<p>
Output a decimal floating-point number. The style is <code>[-]9.99e[-]9</code>, where <ul>
<li> <code>[-]9.99</code> is the mantissa (as described for the <code>f</code>, <code>F</code> specifier), and <li> <code>e[-]9</code> is the exponent indicator (either <code>e</code> or <code>E</code>, depending on the floating-point specifier), followed by an optional sign and the exponent</ul>
If the precision is wider than the maximum number of digits that can be represented by the floating-point unit, then the number will be adequately rounded. For example, assuming DBL_DIG is 15 <div class="fragment"><pre>
  trio_printf("|%.18e|\n", (1.0 / 3.0));
  |3.333333333333333000e-01|
</pre></div>
<p>
<em>Floating-point</em> ( <code>f</code>, <code>F</code> )
<p>
Output a decimal floating-point number. The style is <code>[-]9.99</code>, where <ul>
<li> <code>[-]</code> is an optional sign (either <code>+</code> or <code>-)</code>, <li> <code>9</code> is the integer-part (possibly interspersed with thousand-separators), <li> . <code>is</code> the decimal-point (depending on the locale), and <li> <code>99</code> is the fractional-part.</ul>
If more digits are needed to output the number, than can be represented with the accuracy of the floating-point unit, then the number will be adequately rounded. For example, assuming that DBL_DIG is 15 <div class="fragment"><pre>
  trio_printf("|%f|\n", (2.0 / 3.0) * 1E18);
  |666666666666666700.000000|
</pre></div>
<p>
The following modifiers holds a special meaning for this specifier <ul>
<li> Alternative ( <code>#</code> ) [C99]. Add decimal point. <li> Grouping ( ' <code>)</code> [TRIO]. Group integer part of number into thousands (according to locale).</ul>
<em>Floating-point</em> ( <code>g</code>, <code>G)</code>
<p>
Output a decimal floating-point representation of a number. The format of either the <code>f</code>, <code>F</code> specifier or the <code>e</code>, <code>E</code> specifier is used, whatever produces the shortest result.
<p>
<em>Integer</em> ( <code>i</code> )
<p>
Output a signed integer. Default base is 10.
<p>
<em>Errno</em> ( <code>m</code> ) [GNU]
<p>
<em>Count</em> ( <code>n</code> )
<p>
Insert into the location pointed to by the argument, the number of octets written to the output so far.
<p>
<em>Octal</em> ( <code>o</code> )
<p>
Output an octal (base 8) representation of a number.
<p>
<em>Pointer</em> ( <code>p</code> )
<p>
Ouput the address of the argument. The address is printed as a hexadecimal number. If the argument is the NULL pointer the text <code>(nil)</code> will be used instead. <ul>
<li> Alternative ( <code>#</code> ) [TRIO]. Prepend 0x</ul>
<em>String</em> ( <code>s</code>, <code>S</code> )
<p>
Output a string. The argument must point to a zero terminated string. If the argument is the NULL pointer the text <code>(nil)</code> will be used instead. <code>S</code> is equivalent to <code>ls</code>. <ul>
<li> Alternative ( <code>#</code> ) [TRIO]. Escape non-printable characters.</ul>
Non-printable characters are converted into C escapes, or hexadecimal numbers where no C escapes exists for the character. The C escapes, the hexadecimal number, and all backslashes are prepended by a backslash ( <code>\</code> ). The supported C escapes are <ul>
<li> <code>\a</code> (\007) = alert <li> <code>\b</code> (\010) = backspace <li> <code>\f</code> (\014) = formfeed <li> <code>\n</code> (\012) = newline <li> <code>\r</code> (\015) = carriage return <li> <code>\t</code> (\011) = horizontal tab <li> <code>\v</code> (\013) = vertical tab</ul>
<div class="fragment"><pre>
  trio_printf("|One %s Three|One %'s Three|\n", "Two", "Two");
  |One Two Three|One "Two" Three|

  trio_printf("|Argument missing %s|\n", NULL);
  |Argument missing (nil)|

  trio_printf("|%#s|\n", "\007 \a.");
  |\a \a.|
</pre></div>
<p>
<em>Unsigned</em> ( <code>u</code> )
<p>
Output an unsigned integer. Default base is 10.
<p>
<em>Hex</em> ( <code>x</code>, <code>X</code> )
<p>
Output a hexadecimal (base 16) representation of a number.
<p>
<ul>
<li> Alternative ( <code>#</code> ). Preceed the number by <code>0x</code> ( or <code>0X</code> ). The two characters are counted as part of the width.</ul>
<em>User-defined</em> ( <code>&lt;&gt;</code> )
<p>
Invoke user-defined formatting. See <a class="el" href="group___user_defined.html#a0">trio_register</a> for further information.
<p>
<b>RETURN</b> <b>VALUES</b>
<p>
All functions returns the number of outputted characters. If an error occured then a negative error code is returned [TRIO]. Note that this is a deviation from the standard, which simply returns -1 (or EOF) and errno set appropriately. The error condition can be detected by checking whether the function returns a negative number or not, and the number can be parsed with the following macros. The error codes are primarily intended as debugging aide for the developer.
<p>
<ul>
<li> TRIO_EINVAL: Invalid argument. <li> TRIO_ETOOMANY: Too many arguments. <li> TRIO_EDBLREF: Double argument reference. <li> TRIO_EGAP: Argument reference gap. <li> TRIO_ENOMEM: Out of memory. <li> TRIO_ERANGE: Invalid range. <li> TRIO_ERRNO: The error is specified by the errno variable.</ul>
Example: <div class="fragment"><pre>
  int rc;

  rc = trio_printf("%r\n", 42);
  if (rc &lt; 0) {
    if (TRIO_ERROR_CODE(rc) != TRIO_EOF) {
      trio_printf("Error: %s at position %d\n",
                  TRIO_ERROR_NAME(rc),
                  TRIO_ERROR_POSITION(rc));
    }
  }
</pre></div>
<p>
<b>SEE</b> <b>ALSO</b>
<p>
<em>trio_scanf</em>, <em>trio_register</em>.
<p>
<b>NOTES</b>
<p>
The printfv family uses an array rather than the stack to pass arguments. This means that <code>short</code> <code>int</code> and <code>float</code> values will not be handled by the default argument promotion in C. Instead, these values must be explicitly converted with the Short (h) modifier in both cases.
<p>
Example: <div class="fragment"><pre>
  void *array[2];
  float float_number = 42.0;
  short short_number = 42;

  array[0] = &amp;float_number;
  array[1] = &amp;short_number;

  trio_printfv("%hf %hd\n", array); /* CORRECT */
  trio_printfv("%f %d\n", array); /* WRONG */
</pre></div>
<p>
<b>CONFORMING</b> <b>TO</b>
<p>
Throughout this document the following abbreviations have been used to indicate what standard a feature conforms to. If nothing else is indicated ANSI C (C89) is assumed.
<p>
<ul>
<li> [C89] ANSI X3.159-1989 <li> [C99] ISO/IEC 9899:1999 <li> [UNIX98] The Single UNIX Specification, Version 2 <li> [BSD] 4.4BSD <li> [GNU] GNU libc <li> [MSVC] Microsoft Visual C <li> [MISC] Other non-standard sources <li> [TRIO] Extensions specific for this package </ul>
<hr><h2>Function Documentation</h2>
<a name="a6" doxytag="trio.c::trio_dprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_dprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>fd</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>...&nbsp;</td>
          <td class="mdname" nowrap>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to file descriptor.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>fd</em>&nbsp;</td><td>
File descriptor. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>...</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a8" doxytag="trio.c::trio_dprintfv"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_dprintfv </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>fd</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_pointer_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to file descriptor.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>fd</em>&nbsp;</td><td>
File descriptor. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a3" doxytag="trio.c::trio_fprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_fprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">FILE *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>file</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>...&nbsp;</td>
          <td class="mdname" nowrap>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to file.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>file</em>&nbsp;</td><td>
File pointer. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>...</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a5" doxytag="trio.c::trio_fprintfv"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_fprintfv </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">FILE *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>file</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_pointer_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to file.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>file</em>&nbsp;</td><td>
File pointer. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a0" doxytag="trio.c::trio_printf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_printf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>...&nbsp;</td>
          <td class="mdname" nowrap>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to standard output stream.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>...</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a2" doxytag="trio.c::trio_printfv"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_printfv </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_pointer_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to standard output stream.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a12" doxytag="trio.c::trio_snprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_snprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>...&nbsp;</td>
          <td class="mdname" nowrap>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print at most <code>max</code> characters to string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
Output string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to print. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>...</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a14" doxytag="trio.c::trio_snprintfv"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_snprintfv </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_pointer_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print at most <code>max</code> characters to string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
Output string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to print. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a9" doxytag="trio.c::trio_sprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_sprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>...&nbsp;</td>
          <td class="mdname" nowrap>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
Output string. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>...</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a11" doxytag="trio.c::trio_sprintfv"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_sprintfv </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_pointer_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
Output string. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a7" doxytag="trio.c::trio_vdprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_vdprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>fd</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>va_list&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to file descriptor.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>fd</em>&nbsp;</td><td>
File descriptor. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a4" doxytag="trio.c::trio_vfprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_vfprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">FILE *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>file</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>va_list&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to file.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>file</em>&nbsp;</td><td>
File pointer. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a1" doxytag="trio.c::trio_vprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_vprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>va_list&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to standard output stream.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a13" doxytag="trio.c::trio_vsnprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_vsnprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>va_list&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print at most <code>max</code> characters to string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
Output string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to print. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<a name="a10" doxytag="trio.c::trio_vsprintf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_vsprintf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>va_list&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>args</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print to string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
Output string. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>args</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of printed characters. </dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/group___scanf.html
+++ avida/current/source/third-party/trio-1.9/trio/html/group___scanf.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>Formatted Scanning Functions.</h1>Variations of formatted scanning functions. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___scanf.html#a0">trio_scanf</a> (const char *format,...)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Scan characters from standard input stream.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Variations of formatted scanning functions.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;trio.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b>
<p>
This documentation is incomplete. The documentation of the scanf family in [C99] and [UNIX98] also applies to the trio counterparts.
<p>
<b>SCANNING</b>
<p>
The scanning is controlled by the format string. The format string can contain normal text and conversion indicators. The normal text can be any character except the nil character (\000) and the percent character (\045 = '%'). Conversion indicators consists of an indication character (%), followed by zero or more conversion modifiers, and exactly one conversion specifier.
<p>
<b>Modifiers</b>
<p>
<em>Positional</em> ( <code>9$</code> ) [UNIX98]
<p>
See <a class="el" href="group___printf.html#a0">trio_printf</a>.
<p>
<b>Specifiers</b>
<p>
<em>Percent</em> ( <code>%</code> )
<p>
<em>Character</em> ( <code>c</code> )
<p>
<em>Decimal</em> ( <code>d</code> )
<p>
<em>Floating-point</em> ( <code>a</code>, <code>A</code>, <code>e</code>, <code>E</code>, <code>f</code>, <code>F</code>, <code>g</code>, <code>G</code> )
<p>
<em>Integer</em> ( <code>i</code> )
<p>
<em>Count</em> ( <code>n</code> )
<p>
<em>Octal</em> ( <code>o</code> )
<p>
<em>Pointer</em> ( <code>p</code> )
<p>
<em>String</em> ( <code>s</code> )
<p>
<em>Unsigned</em> ( <code>u</code> )
<p>
<em>Hex</em> ( <code>x</code>, <code>X</code> )
<p>
<em>Scanlist</em> ( <code>[]</code> )
<p>
Scanlist Exclusion (<code>^</code> )
<p>
Scanlist Range ( <code>-</code> ) [TRIO]
<p>
<ul>
<li> Only increasing ranges, i.e. <code>[a-b]</code>, but not <code>[b-a]</code>. <li> Transitive ranges, ie. <code>[a-b-c]</code> equals <code>[a-c]</code>. <li> Trailing minus, ie. <code>[a-]</code> is interpreted as an <code>a</code> and a <code>-</code>. <li> Duplicates are ignored.</ul>
Scanlist Equivalence Class Expression ( <code>[</code>= =<code>]</code> ) [TRIO]
<p>
Locale dependent (LC_COLLATE). Only one expression can appear inside the delimiters. <ul>
<li> <code>[=a=]</code> All letters in the same equivalence class as the letter <code>a</code>. <div class="fragment"><pre>
  trio_scanf("%[[=a=]b]\n", buffer);
  trio_scanf("%[[=a=][=b=]]\n", buffer);
</pre></div></ul>
Scanlist Character Class Expression ( <code>[</code>: :<code>])</code> [TRIO] Locale dependent (LC_CTYPE). Only one expression can appear inside the delimiters. <ul>
<li> <code>[:alnum:]</code> Same as <code>[:alpha:]</code> and <code>[:digit:]</code> <li> <code>[:alpha:]</code> Same as <code>[:lower:]</code> and <code>[:upper:]</code> <li> <code>[:cntrl:]</code> Control characters <li> <code>[:digit:]</code> Decimal digits <li> <code>[:graph:]</code> Printable characters except space <li> <code>[:lower:]</code> Lower case alphabetic letters <li> <code>[:print:]</code> Printable characters <li> <code>[:punct:]</code> Punctuation <li> <code>[:space:]</code> Whitespace characters <li> <code>[:upper:]</code> Upper case alphabetic letters <li> <code>[:xdigit:]</code> Hexadecimal digits <div class="fragment"><pre>
  trio_scanf("%[[:alnum:]]\n", buffer);
  trio_scanf("%[[:alpha:][:digit:]]\n", buffer);
</pre></div></ul>
<b>RETURN</b> <b>VALUES</b>
<p>
<b>SEE</b> <b>ALSO</b>
<p>
<a class="el" href="group___printf.html#a0">trio_printf</a> <hr><h2>Function Documentation</h2>
<a name="a0" doxytag="trio.c::trio_scanf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_scanf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>...&nbsp;</td>
          <td class="mdname" nowrap>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Scan characters from standard input stream.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>...</em>&nbsp;</td><td>
Arguments. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of scanned characters. </dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/group___special_quantities.html
+++ avida/current/source/third-party/trio-1.9/trio/html/group___special_quantities.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>Special Quantifies.</h1>Functions to detect and fabricate special quantities in floating-point numbers. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a1">trio_nzero</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Generate negative zero.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a2">trio_pinf</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Generate positive infinity.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a3">trio_ninf</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Generate negative infinity.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a4">trio_nan</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Generate NaN.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a5">trio_isnan</a> (volatile double number)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Check for NaN.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a6">trio_isinf</a> (volatile double number)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Check for infinity.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a7">trio_isfinite</a> (volatile double number)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Check for finity.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a9">trio_signbit</a> (volatile double number)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Examine the sign of a number.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___special_quantities.html#a10">trio_fpclassify</a> (volatile double number)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Examine the class of a number.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions to detect and fabricate special quantities in floating-point numbers.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;trionan.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b>
<p>
Certain arithmetical operations does not result in normal numbers. Instead they result in special quantities that must be handled differently by the floating-point hardware. These includes Infinity and Not-A-Number (NaN).
<p>
For example, 0/0 (zero divided by zero) yields NaN. Any operation which involves a NaN will result in NaN. Any comparison involving NaN will be unsuccessful, even if NaN is compared to NaN.
<p>
These special quantities are represented with special bit patterns by the floating-point hardware, and this bit patterns depend on the hardware. There may even be hardware that does not support special quantities, so the functions in this module are not guaranteed to work on all platforms.
<p>
The approach used in this module is to (in decreasing order of importance) <ul>
<li> Use C99 functionality when available. <li> Use IEEE 754-1985 bit patterns if possible. <li> Use platform-specific techniques.</ul>
<b>NOTES</b>
<p>
This module does not depend on the rest of trio, and can thus be reused separately. The following files are necessary: <ul>
<li> <code>triodef.h</code> <li> <code>trionan.h</code> <li> <code>trionan.c</code> </ul>
<hr><h2>Function Documentation</h2>
<a name="a10" doxytag="trionan.c::trio_fpclassify"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_fpclassify </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">volatile double&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>number</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Examine the class of a number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em>&nbsp;</td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Enumerable value indicating the class of <code>number</code> </dl>    </td>
  </tr>
</table>
<a name="a7" doxytag="trionan.c::trio_isfinite"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_isfinite </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">volatile double&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>number</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Check for finity.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em>&nbsp;</td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating whether or not the number is a finite. </dl>    </td>
  </tr>
</table>
<a name="a6" doxytag="trionan.c::trio_isinf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_isinf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">volatile double&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>number</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Check for infinity.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em>&nbsp;</td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
1 if positive infinity, -1 if negative infinity, 0 otherwise. </dl>    </td>
  </tr>
</table>
<a name="a5" doxytag="trionan.c::trio_isnan"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_isnan </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">volatile double&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>number</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Check for NaN.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em>&nbsp;</td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating whether or not the number is a NaN. </dl>    </td>
  </tr>
</table>
<a name="a4" doxytag="trionan.c::trio_nan"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> double trio_nan </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Generate NaN.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point representation of NaN. </dl>    </td>
  </tr>
</table>
<a name="a3" doxytag="trionan.c::trio_ninf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> double trio_ninf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Generate negative infinity.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point value of negative infinity. </dl>    </td>
  </tr>
</table>
<a name="a1" doxytag="trionan.c::trio_nzero"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> double trio_nzero </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Generate negative zero.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point representation of negative zero. </dl>    </td>
  </tr>
</table>
<a name="a2" doxytag="trionan.c::trio_pinf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> double trio_pinf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Generate positive infinity.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point representation of positive infinity. </dl>    </td>
  </tr>
</table>
<a name="a9" doxytag="trionan.c::trio_signbit"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_signbit </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">volatile double&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>number</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Examine the sign of a number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em>&nbsp;</td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating whether or not the number has the sign bit set (i.e. is negative). </dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/group___static_strings.html
+++ avida/current/source/third-party/trio-1.9/trio/html/group___static_strings.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>Static String Functions.</h1>Replacements for the standard C string functions. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a0">trio_create</a> (size_t size)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Create new string.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a1">trio_destroy</a> (char *string)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Destroy string.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>size_t&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a2">trio_length</a> (const char *string)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Count the number of characters in a string.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a4">trio_append</a> (char *target, const char *source)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Append <code>source</code> at the end of <code>target</code>.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a5">trio_append_max</a> (char *target, size_t max, const char *source)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Append at most <code>max</code> characters from <code>source</code> to <code>target</code>.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a6">trio_contains</a> (const char *string, const char *substring)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Determine if a string contains a substring.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a7">trio_copy</a> (char *target, const char *source)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Copy <code>source</code> to <code>target</code>.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a8">trio_copy_max</a> (char *target, size_t max, const char *source)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Copy at most <code>max</code> characters from <code>source</code> to <code>target</code>.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a9">trio_duplicate</a> (const char *source)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Duplicate <code>source</code>.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a10">trio_duplicate_max</a> (const char *source, size_t max)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Duplicate at most <code>max</code> characters of <code>source</code>.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a11">trio_equal</a> (const char *first, const char *second)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare if two strings are equal.</em> <a href="#a11">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a12">trio_equal_case</a> (const char *first, const char *second)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare if two strings are equal.</em> <a href="#a12">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a13">trio_equal_case_max</a> (const char *first, size_t max, const char *second)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare if two strings up until the first <code>max</code> characters are equal.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a14">trio_equal_locale</a> (const char *first, const char *second)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare if two strings are equal.</em> <a href="#a14">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a15">trio_equal_max</a> (const char *first, size_t max, const char *second)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare if two strings up until the first <code>max</code> characters are equal.</em> <a href="#a15">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>const char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a16">trio_error</a> (int error_number)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Provide a textual description of an error code (errno).</em> <a href="#a16">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>size_t&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a17">trio_format_date_max</a> (char *target, size_t max, const char *format, const struct tm *datetime)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Format the date/time according to <code>format</code>.</em> <a href="#a17">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>unsigned long&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a18">trio_hash</a> (const char *string, int type)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Calculate a hash value for a string.</em> <a href="#a18">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a19">trio_index</a> (const char *string, int character)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Find first occurrence of a character in a string.</em> <a href="#a19">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a20">trio_index_last</a> (const char *string, int character)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Find last occurrence of a character in a string.</em> <a href="#a20">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a21">trio_lower</a> (char *target)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Convert the alphabetic letters in the string to lower-case.</em> <a href="#a21">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a22">trio_match</a> (const char *string, const char *pattern)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare two strings using wildcards.</em> <a href="#a22">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a23">trio_match_case</a> (const char *string, const char *pattern)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Compare two strings using wildcards.</em> <a href="#a23">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>size_t&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a24">trio_span_function</a> (char *target, const char *source, int(*Function)(int))</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Execute a function on each character in string.</em> <a href="#a24">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a25">trio_substring</a> (const char *string, const char *substring)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Search for a substring in a string.</em> <a href="#a25">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a26">trio_substring_max</a> (const char *string, size_t max, const char *substring)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Search for a substring in the first <code>max</code> characters of a string.</em> <a href="#a26">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a27">trio_tokenize</a> (char *string, const char *delimiters)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Tokenize string.</em> <a href="#a27">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a28">trio_to_double</a> (const char *source, const char **endp)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Convert string to floating-point number.</em> <a href="#a28">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>float&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a29">trio_to_float</a> (const char *source, const char **endp)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Convert string to floating-point number.</em> <a href="#a29">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>long&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a30">trio_to_long</a> (const char *string, char **endp, int base)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Convert string to signed integer.</em> <a href="#a30">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>unsigned long&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a31">trio_to_unsigned_long</a> (const char *string, char **endp, int base)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Convert string to unsigned integer.</em> <a href="#a31">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="group___static_strings.html#a32">trio_upper</a> (char *target)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Convert the alphabetic letters in the string to upper-case.</em> <a href="#a32">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Replacements for the standard C string functions.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;triostr.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b>
<p>
This package renames, fixes, and extends the standard C string handling functions.
<p>
<b>Naming</b>
<p>
Renaming is done to provide more clear names, to provide a consistant naming and argument policy, and to hide portability issues.
<p>
<ul>
<li> All functions starts with "trio_". <li> Target is always the first argument, if present, except where the target is optional, such as <a class="el" href="group___static_strings.html#a28">trio_to_double</a>. <li> Functions requiring a size for target includes "_max" in its name, and the size is always the second argument. <li> Functions performing case-sensitive operations includes "_case" in its name.</ul>
<b>Fixing</b>
<p>
Fixing is done to avoid subtle error conditions. For example, <code>strncpy</code> does not terminate the result with a zero if the source string is bigger than the maximal length, so technically the result is not a C string anymore. <a class="el" href="group___static_strings.html#a8">trio_copy_max</a> makes sure that the result is zero terminated.
<p>
<b>Extending</b>
<p>
Extending is done to provide a richer set of fundamental functions. This includes functionality such as wildcard matching ( <code>trio_match</code> ) and calculation of hash values ( <code>trio_hash</code> ). <hr><h2>Function Documentation</h2>
<a name="a4" doxytag="triostr.c::trio_append"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_append </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>target</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Append <code>source</code> at the end of <code>target</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
Target string. </td></tr>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure.</dl><dl compact><dt><b>
Precondition: </b><dd>
<code>target</code> must point to a memory chunk with sufficient room to contain the <code>target</code> string and <code>source</code> string. <dd>
No boundary checking is performed, so insufficient memory will result in a buffer overrun. </dl><dl compact><dt><b>
Postcondition: </b><dd>
<code>target</code> will be zero terminated. </dl>    </td>
  </tr>
</table>
<a name="a5" doxytag="triostr.c::trio_append_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_append_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>target</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Append at most <code>max</code> characters from <code>source</code> to <code>target</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
Target string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to append. </td></tr>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure.</dl><dl compact><dt><b>
Precondition: </b><dd>
<code>target</code> must point to a memory chuck with sufficient room to contain the <code>target</code> string and the <code>source</code> string (at most <code>max</code> characters). <dd>
No boundary checking is performed, so insufficient memory will result in a buffer overrun. </dl><dl compact><dt><b>
Postcondition: </b><dd>
<code>target</code> will be zero terminated. </dl>    </td>
  </tr>
</table>
<a name="a6" doxytag="triostr.c::trio_contains"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_contains </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>substring</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Determine if a string contains a substring.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>substring</em>&nbsp;</td><td>
String to be found. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure. </dl>    </td>
  </tr>
</table>
<a name="a7" doxytag="triostr.c::trio_copy"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_copy </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>target</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Copy <code>source</code> to <code>target</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
Target string. </td></tr>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure.</dl><dl compact><dt><b>
Precondition: </b><dd>
<code>target</code> must point to a memory chunk with sufficient room to contain the <code>source</code> string. <dd>
No boundary checking is performed, so insufficient memory will result in a buffer overrun. </dl><dl compact><dt><b>
Postcondition: </b><dd>
<code>target</code> will be zero terminated. </dl>    </td>
  </tr>
</table>
<a name="a8" doxytag="triostr.c::trio_copy_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_copy_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>target</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Copy at most <code>max</code> characters from <code>source</code> to <code>target</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
Target string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to append. </td></tr>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure.</dl><dl compact><dt><b>
Precondition: </b><dd>
<code>target</code> must point to a memory chunk with sufficient room to contain the <code>source</code> string (at most <code>max</code> characters). <dd>
No boundary checking is performed, so insufficient memory will result in a buffer overrun. </dl><dl compact><dt><b>
Postcondition: </b><dd>
<code>target</code> will be zero terminated. </dl>    </td>
  </tr>
</table>
<a name="a0" doxytag="triostr.c::trio_create"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_create </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>size</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create new string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>size</em>&nbsp;</td><td>
Size of new string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Pointer to string, or NULL if allocation failed. </dl>    </td>
  </tr>
</table>
<a name="a1" doxytag="triostr.c::trio_destroy"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void trio_destroy </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>string</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Destroy string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be freed. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a9" doxytag="triostr.c::trio_duplicate"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_duplicate </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>source</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Duplicate <code>source</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
A copy of the <code>source</code> string.</dl><dl compact><dt><b>
Postcondition: </b><dd>
<code>target</code> will be zero terminated. </dl>    </td>
  </tr>
</table>
<a name="a10" doxytag="triostr.c::trio_duplicate_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_duplicate_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Duplicate at most <code>max</code> characters of <code>source</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to duplicate. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
A copy of the <code>source</code> string.</dl><dl compact><dt><b>
Postcondition: </b><dd>
<code>target</code> will be zero terminated. </dl>    </td>
  </tr>
</table>
<a name="a11" doxytag="triostr.c::trio_equal"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_equal </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>first</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>second</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare if two strings are equal.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>first</em>&nbsp;</td><td>
First string. </td></tr>
<tr><td valign=top><em>second</em>&nbsp;</td><td>
Second string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean indicating whether the two strings are equal or not.</dl>Case-insensitive comparison.     </td>
  </tr>
</table>
<a name="a12" doxytag="triostr.c::trio_equal_case"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_equal_case </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>first</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>second</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare if two strings are equal.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>first</em>&nbsp;</td><td>
First string. </td></tr>
<tr><td valign=top><em>second</em>&nbsp;</td><td>
Second string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean indicating whether the two strings are equal or not.</dl>Case-sensitive comparison.     </td>
  </tr>
</table>
<a name="a13" doxytag="triostr.c::trio_equal_case_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_equal_case_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>first</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>second</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare if two strings up until the first <code>max</code> characters are equal.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>first</em>&nbsp;</td><td>
First string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to compare. </td></tr>
<tr><td valign=top><em>second</em>&nbsp;</td><td>
Second string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean indicating whether the two strings are equal or not.</dl>Case-sensitive comparison.     </td>
  </tr>
</table>
<a name="a14" doxytag="triostr.c::trio_equal_locale"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_equal_locale </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>first</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>second</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare if two strings are equal.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>first</em>&nbsp;</td><td>
First string. </td></tr>
<tr><td valign=top><em>second</em>&nbsp;</td><td>
Second string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean indicating whether the two strings are equal or not.</dl>Collating characters are considered equal.     </td>
  </tr>
</table>
<a name="a15" doxytag="triostr.c::trio_equal_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_equal_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>first</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>second</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare if two strings up until the first <code>max</code> characters are equal.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>first</em>&nbsp;</td><td>
First string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to compare. </td></tr>
<tr><td valign=top><em>second</em>&nbsp;</td><td>
Second string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean indicating whether the two strings are equal or not.</dl>Case-insensitive comparison.     </td>
  </tr>
</table>
<a name="a16" doxytag="triostr.c::trio_error"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const char* trio_error </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>error_number</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Provide a textual description of an error code (errno).
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>error_number</em>&nbsp;</td><td>
Error number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Textual description of <code>error_number</code>. </dl>    </td>
  </tr>
</table>
<a name="a17" doxytag="triostr.c::trio_format_date_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> size_t trio_format_date_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>target</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>format</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const struct tm *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>datetime</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Format the date/time according to <code>format</code>.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
Target string. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum number of characters to format. </td></tr>
<tr><td valign=top><em>format</em>&nbsp;</td><td>
Formatting string. </td></tr>
<tr><td valign=top><em>datetime</em>&nbsp;</td><td>
Date/time structure. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of formatted characters.</dl>The formatting string accepts the same specifiers as the standard C function strftime.     </td>
  </tr>
</table>
<a name="a18" doxytag="triostr.c::trio_hash"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> unsigned long trio_hash </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>type</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Calculate a hash value for a string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be calculated on. </td></tr>
<tr><td valign=top><em>type</em>&nbsp;</td><td>
Hash function. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Calculated hash value.</dl><code>type</code> can be one of the following <ul>
<li> <code>TRIO_HASH_PLAIN</code> Plain hash function. </ul>
    </td>
  </tr>
</table>
<a name="a19" doxytag="triostr.c::trio_index"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_index </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>character</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find first occurrence of a character in a string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>character</em>&nbsp;</td><td>
Character to be found. </td></tr>
<tr><td valign=top><em>A</em>&nbsp;</td><td>
pointer to the found character, or NULL if character was not found. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a20" doxytag="triostr.c::trio_index_last"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_index_last </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>character</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find last occurrence of a character in a string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>character</em>&nbsp;</td><td>
Character to be found. </td></tr>
<tr><td valign=top><em>A</em>&nbsp;</td><td>
pointer to the found character, or NULL if character was not found. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a2" doxytag="triostr.c::trio_length"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> size_t trio_length </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>string</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Count the number of characters in a string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to measure. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of characters in @string. </dl>    </td>
  </tr>
</table>
<a name="a21" doxytag="triostr.c::trio_lower"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_lower </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>target</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert the alphabetic letters in the string to lower-case.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
String to be converted. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of processed characters (converted or not). </dl>    </td>
  </tr>
</table>
<a name="a22" doxytag="triostr.c::trio_match"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_match </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>pattern</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare two strings using wildcards.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>pattern</em>&nbsp;</td><td>
Pattern, including wildcards, to search for. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure.</dl>Case-insensitive comparison.
<p>
The following wildcards can be used <ul>
<li> <code>*</code> Match any number of characters. <li> ? <code>Match</code> a single character. </ul>
    </td>
  </tr>
</table>
<a name="a23" doxytag="triostr.c::trio_match_case"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_match_case </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>pattern</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare two strings using wildcards.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>pattern</em>&nbsp;</td><td>
Pattern, including wildcards, to search for. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure.</dl>Case-sensitive comparison.
<p>
The following wildcards can be used <ul>
<li> <code>*</code> Match any number of characters. <li> ? <code>Match</code> a single character. </ul>
    </td>
  </tr>
</table>
<a name="a24" doxytag="triostr.c::trio_span_function"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> size_t trio_span_function </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>target</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int(*&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>Function</em>)(int)</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Execute a function on each character in string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
Target string. </td></tr>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
Source string. </td></tr>
<tr><td valign=top><em>Function</em>&nbsp;</td><td>
Function to be executed. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Number of processed characters. </dl>    </td>
  </tr>
</table>
<a name="a25" doxytag="triostr.c::trio_substring"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_substring </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>substring</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Search for a substring in a string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>substring</em>&nbsp;</td><td>
String to be found. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Pointer to first occurrence of <code>substring</code> in <code>string</code>, or NULL if no match was found. </dl>    </td>
  </tr>
</table>
<a name="a26" doxytag="triostr.c::trio_substring_max"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_substring_max </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>max</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>substring</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Search for a substring in the first <code>max</code> characters of a string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be searched. </td></tr>
<tr><td valign=top><em>max</em>&nbsp;</td><td>
Maximum characters to be searched. </td></tr>
<tr><td valign=top><em>substring</em>&nbsp;</td><td>
String to be found. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Pointer to first occurrence of <code>substring</code> in <code>string</code>, or NULL if no match was found. </dl>    </td>
  </tr>
</table>
<a name="a28" doxytag="triostr.c::trio_to_double"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> double trio_to_double </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>endp</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert string to floating-point number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
String to be converted. </td></tr>
<tr><td valign=top><em>endp</em>&nbsp;</td><td>
Pointer to end of the converted string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
A floating-point number.</dl>The following Extended Backus-Naur form is used <div class="fragment"><pre>
   double        ::= [ &lt;sign&gt; ]
                     ( &lt;number&gt; |
                       &lt;number&gt; &lt;decimal_point&gt; &lt;number&gt; |
                       &lt;decimal_point&gt; &lt;number&gt; )
                     [ &lt;exponential&gt; [ &lt;sign&gt; ] &lt;number&gt; ]
   number        ::= 1*( &lt;digit&gt; )
   digit         ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
   exponential   ::= ( 'e' | 'E' )
   sign          ::= ( '-' | '+' )
   decimal_point ::= '.'
   </pre></div>     </td>
  </tr>
</table>
<a name="a29" doxytag="triostr.c::trio_to_float"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float trio_to_float </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>source</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>endp</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert string to floating-point number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>source</em>&nbsp;</td><td>
String to be converted. </td></tr>
<tr><td valign=top><em>endp</em>&nbsp;</td><td>
Pointer to end of the converted string. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
A floating-point number.</dl>See <a class="el" href="group___static_strings.html#a28">trio_to_double</a>.     </td>
  </tr>
</table>
<a name="a30" doxytag="triostr.c::trio_to_long"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> long trio_to_long </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>endp</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>base</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert string to signed integer.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be converted. </td></tr>
<tr><td valign=top><em>endp</em>&nbsp;</td><td>
Pointer to end of converted string. </td></tr>
<tr><td valign=top><em>base</em>&nbsp;</td><td>
Radix number of number. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a31" doxytag="triostr.c::trio_to_unsigned_long"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> unsigned long trio_to_unsigned_long </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>endp</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>base</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert string to unsigned integer.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be converted. </td></tr>
<tr><td valign=top><em>endp</em>&nbsp;</td><td>
Pointer to end of converted string. </td></tr>
<tr><td valign=top><em>base</em>&nbsp;</td><td>
Radix number of number. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a27" doxytag="triostr.c::trio_tokenize"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* trio_tokenize </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>string</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>delimiters</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Tokenize string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>string</em>&nbsp;</td><td>
String to be tokenized. </td></tr>
<tr><td valign=top><em>tokens</em>&nbsp;</td><td>
String containing list of delimiting characters. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Start of new token.</dl><dl compact><dt><b>
Warning: </b><dd>
<code>string</code> will be destroyed. </dl>    </td>
  </tr>
</table>
<a name="a32" doxytag="triostr.c::trio_upper"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int trio_upper </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>target</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert the alphabetic letters in the string to upper-case.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>target</em>&nbsp;</td><td>
The string to be converted. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
The number of processed characters (converted or not). </dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/group___user_defined.html
+++ avida/current/source/third-party/trio-1.9/trio/html/group___user_defined.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>User-defined Formatted Printing Functions.</h1>Functions for using customized formatting specifiers. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>trio_pointer_t&nbsp;</td><td valign=bottom><a class="el" href="group___user_defined.html#a0">trio_register</a> (trio_callback_t callback, const char *name)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Register new user-defined specifier.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="group___user_defined.html#a1">trio_unregister</a> (trio_pointer_t handle)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Unregister an existing user-defined specifier.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions for using customized formatting specifiers.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;trio.h&gt;
#include &lt;triop.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b>
<p>
This documentation is incomplete.
<p>
<b>User-defined</b> <b>Specifier</b>
<p>
The user-defined specifier consists of a start character (\074 = '&lt;'), an optional namespace string followed by a namespace separator (\072 = ':'), a format string, and an end character (\076 = '&gt;').
<p>
The namespace string can consist of alphanumeric characters, and is used to define a named reference (see below). The namespace is case-sensitive. If no namespace is specified, then we use an unnamed reference (see below).
<p>
The format can consist of any character except the end character ('&gt;'), the namespace separator (':'), and the nil character (\000).
<p>
Any modifier can be used together with the user-defined specifier.
<p>
<b>Registering</b>
<p>
A user-defined specifier must be registered before it can be used. Unregistered user-defined specifiers are ignored. The <a class="el" href="group___user_defined.html#a0">trio_register</a> function is used to register a user-defined specifier. It takes two argument, a callback function and a namespace, and it returns a handle. The handle must be used to unregister the specifier later.
<p>
The following example registers a user-define specifier with the "my_namespace" namespace:
<p>
<div class="fragment"><pre>
  my_handle = trio_register(my_callback, "my_namespace");
</pre></div>
<p>
There can only be one user-defined specifier with a given namespace. There can be an unlimited number (subject to maximum length of the namespace) of different user-defined specifiers.
<p>
Passing NULL as the namespace argument results in an anonymous reference. There can be an unlimited number of anonymous references.
<p>
<b>REFERENCES</b>
<p>
There are two ways that a registered callback can be called. Either the user-defined specifier must contain the registered namespace in the format string, or the handle is passed as an argument to the formatted printing function.
<p>
If the namespace is used, then a user-defined pointer must be passed as an argument:
<p>
<div class="fragment"><pre>
  trio_printf("&lt;my_namespace:format&gt;\n", my_data);
</pre></div>
<p>
If the handle is used, then the user-defined specifier must not contain a namespace. Instead the handle must be passed as an argument, followed by a user-defined pointer:
<p>
<div class="fragment"><pre>
  trio_printf("&lt;format&gt;\n", my_handle, my_data);
</pre></div>
<p>
The two examples above are equivalent.
<p>
There must be exactly one user-defined pointer per user-defined specifier. This pointer can be used within the callback function with the trio_get_argument getter function (see below).
<p>
The format string is optional. It can be used within the callback function with the trio_get_format getter function.
<p>
<b>Anonymous</b> <b>References</b> Anonymous references are specified by passing NULL as the namespace.
<p>
The handle must be passed as an argument followed by a user-defined pointer. No namespace can be specified.
<p>
<div class="fragment"><pre>
  anon_handle = trio_register(callback, NULL);
  trio_printf("&lt;format&gt;\n", anon_handle, my_data);
</pre></div>
<p>
<b>Restrictions</b>
<p>
<ul>
<li> The length of the namespace string cannot exceed 63 characters. <li> The length of the user-defined format string cannot exceed 255 characters. <li> User-defined formatting cannot re-define existing specifiers. This restriction was imposed because the existing formatting specifiers have a well-defined behaviour, and any re-definition would apply globally to an application (imagine a third-party library changing the behaviour of a specifier that is crusial to your application).</ul>
<b>CALLBACK</b> <b>FUNCTION</b>
<p>
The callback function will be called if a matching user-defined specifier is found within the formatting string. The callback function takes one input parameter, an opaque reference which is needed by the private functions. It returns an <code>int</code>, which is currently ignored. The prototype is
<p>
<div class="fragment"><pre>
  int (*trio_callback_t)(void *ref);
</pre></div>
<p>
See the Example section for full examples.
<p>
<b>PRINTING</b> <b>FUNCTIONS</b>
<p>
The following printing functions must only be used inside a callback function. These functions will print to the same output medium as the printf function which invoked the callback function. For example, if the user-defined specifier is used in an sprintf function, then these print functions will output their result to the same string.
<p>
<b>Elementary</b> <b>Printing</b>
<p>
There are a number of function to print elementary data types.
<p>
<ul>
<li> trio_print_int Print a signed integer. For example: <div class="fragment"><pre>
  trio_print_int(42);
</pre></div> <li> trio_print_uint Print an unsigned integer. <li> trio_print_double Print a floating-point number. <li> trio_print_string Print a string. For example: <div class="fragment"><pre>
  trio_print_string("Hello World");
  trio_print_string(trio_get_format());
</pre></div> <li> trio_print_pointer Print a pointer.</ul>
<b>Formatted</b> <b>Printing</b>
<p>
The functions trio_print_ref, trio_vprint_ref, and trio_printv_ref outputs a formatted string just like its printf equivalents.
<p>
<div class="fragment"><pre>
  trio_print_ref(ref, "There are %d towels\n", 42);
  trio_print_ref(ref, "%&lt;recursive&gt;\n", recursive_writer, trio_get_argument());
</pre></div>
<p>
<b>GETTER</b> <b>AND</b> <b>SETTER</b> <b>FUNCTIONS</b>
<p>
The following getter and setter functions must only be used inside a callback function. They can either operate on the modifiers or on special data.
<p>
<b>Modifiers</b>
<p>
The value of a modifier, or a boolean indication of its presence or absence, can be found or set with the getter and setter functions. The generic prototypes of the these getter and setter functions are
<p>
<div class="fragment"><pre>
  int  trio_get_???(void *ref);
  void trio_set_???(void *ref, int);
</pre></div>
<p>
where ??? <code>refers</code> to a modifier. For example, to get the width of the user-defined specifier use
<p>
<div class="fragment"><pre>
  int width = trio_get_width(ref);
</pre></div>
<p>
<b>Special</b> <b>Data</b>
<p>
Consider the following user-defined specifier, in its two possible referencing presentations.
<p>
<div class="fragment"><pre>
  trio_printf("%&lt;format&gt;\n", namespace_writer, argument);
  trio_printf("%&lt;namespace:format&gt;\n", argument);
</pre></div>
<p>
trio_get_format will get the <code>format</code> string, and trio_get_argument} will get the <code>argument</code> parameter. There are no associated setter functions.
<p>
<b>EXAMPLES</b>
<p>
The following examples show various types of user-defined specifiers. Although each specifier is demonstrated in isolation, they can all co-exist within the same application.
<p>
<b>Time</b> <b>Example</b>
<p>
Print the time in the format "HOUR:MINUTE:SECOND" if "time" is specified inside the user-defined specifier.
<p>
<div class="fragment"><pre>
  static int time_writer(void *ref)
  {
    const char *format;
    time_t *data;
    char buffer[256];

    format = trio_get_format(ref);
    if ((format) &amp;&amp; (strcmp(format, "time") == 0)) {
      data = trio_get_argument(ref);
      if (data == NULL)
        return -1;
      strftime(buffer, sizeof(buffer), "%H:%M:%S", localtime(data));
      trio_print_string(ref, buffer);
    }
    return 0;
  }
</pre></div>
<p>
<div class="fragment"><pre>
  int main(void)
  {
    void *handle;
    time_t now = time(NULL);

    handle = trio_register(time_print, "my_time");

    trio_printf("%&lt;time&gt;\n", handle, &amp;now);
    trio_printf("%&lt;my_time:time&gt;\n", &amp;now);

    trio_unregister(handle);
    return 0;
  }
</pre></div>
<p>
<b>Complex</b> <b>Numbers</b> <b>Example</b>
<p>
Consider a complex number consisting of a real part, re, and an imaginary part, im.
<p>
<div class="fragment"><pre>
  struct Complex {
    double re;
    double im;
  };
</pre></div>
<p>
This example can print such a complex number in one of two formats. The default format is "re + i im". If the alternative modifier is used, then the format is "r exp(i theta)", where r is the length of the complex vector (re, im) and theta is its angle.
<p>
<div class="fragment"><pre>
  static int complex_print(void *ref)
  {
    struct Complex *data;
    const char *format;

    data = (struct Complex *)trio_get_argument(ref);
    if (data) {
      format = trio_get_format(ref);

      if (trio_get_alternative(ref)) {
        double r, theta;

        r = sqrt(pow(data-&gt;re, 2) + pow(data-&gt;im, 2));
        theta = acos(data-&gt;re / r);
        trio_print_ref(ref, "%#f exp(i %#f)", r, theta);

      } else {
        trio_print_ref(ref, "%#f + i %#f", data-&gt;re, data-&gt;im);
      }
    }
    return 0;
  }
</pre></div>
<p>
<div class="fragment"><pre>
  int main(void)
  {
    void *handle;

    handle = trio_register(complex_print, "complex");

    /* Normal format. With handle and the with namespace */
    trio_printf("%&lt;&gt;\n", handle, &amp;complex);
    trio_printf("%&lt;complex:&gt;\n", &amp;complex);
    /* In exponential notation */
    trio_printf("%#&lt;&gt;\n", handle, &amp;complex);
    trio_printf("%#&lt;complex:unused data&gt;\n", &amp;complex);

    trio_unregister(handle);
    return 0;
  }
</pre></div>
<p>
<b>RETURN</b> <b>VALUES</b>
<p>
<a class="el" href="group___user_defined.html#a0">trio_register</a> returns a handle, or NULL if an error occured.
<p>
<b>SEE</b> <b>ALSO</b>
<p>
<a class="el" href="group___printf.html#a0">trio_printf</a>
<p>
<b>NOTES</b>
<p>
User-defined specifiers, <a class="el" href="group___user_defined.html#a0">trio_register</a>, and <a class="el" href="group___user_defined.html#a1">trio_unregister</a> are not thread-safe. In multi-threaded applications they must be guarded by mutexes. Trio provides two special callback functions, called ":enter" and ":leave", which are invoked every time a thread-unsafe operation is attempted. As the thread model is determined by the application, these callback functions must be implemented by the application.
<p>
The following callback functions are for demonstration-purposes only. Replace their bodies with locking and unlocking of a mutex to achieve thread-safety. <div class="fragment"><pre>
  static int enter_region(void *ref)
  {
    fprintf(stderr, "Enter Region\n");
    return 1;
  }

  static int leave_region(void *ref)
  {
    fprintf(stderr, "Leave Region\n");
    return 1;
  }
</pre></div> These two callbacks must be registered before other callbacks are registered. <div class="fragment"><pre>
  trio_register(enter_region, ":enter");
  trio_register(leave_region, ":leave");

  another_handle = trio_register(another_callback, NULL);
</pre></div> <hr><h2>Function Documentation</h2>
<a name="a0" doxytag="trio.c::trio_register"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> trio_pointer_t trio_register </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_callback_t&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>callback</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>name</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Register new user-defined specifier.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>callback</em>&nbsp;</td><td>
</td></tr>
<tr><td valign=top><em>name</em>&nbsp;</td><td>
</td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Handle. </dl>    </td>
  </tr>
</table>
<a name="a1" doxytag="trio.c::trio_unregister"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void trio_unregister </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_pointer_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>handle</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Unregister an existing user-defined specifier.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>handle</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/index.html
+++ avida/current/source/third-party/trio-1.9/trio/html/index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>TRIO Documentation</h1>
<p>
 <dl compact><dt><b>
Author: </b><dd>
Bjørn Reese , Daniel Stenberg</dl><a name="intro"><h2>Introduction</h2></a>

<p>
Trio is a fully matured and stable set of printf and string functions designed be used by applications with focus on portability or with the need for additional features that are not supported by standard stdio implementation.
<p>
There are several cases where you may want to consider using trio:
<p>
<ul>
<li> Portability across heterogeneous platforms. <li> Embedded systems without stdio support. <li> Extendability of unsupported features. <li> Your native version does not do everything you need.</ul>
When you write applications that must be portable to a wide range of platforms you often have to deal with inadequate implementations of the stdio library functions. Most notably is the lack of secure formatting functions, such as snprintf, or the lack of parameter reordering commonly used for the internationalization of applications, such as the &lt;num&gt;$ modifier. Sometimes the feature you need is simply not present in stdio. So you end up spending much effort on determining which platforms supports what, and to write your own versions of various features. This is where trio can help you. Trio is a platform-independent implementation of the stdio printf and scanf functions and the string library functions.
<p>
The functionality described in the stdio standards is a compromise, and does unfortunately not include a mechanism to extend the functionality for an individual application. Oftentimes an application has the need for an extra feature, and the application code can become much more clear and readable by using an extension mechanism. Trio supports a range of useful extensions such as user-defined specifiers, passing of arguments in arrays, localized string scanning, thousand-separators, and arbitrary integer bases.
<p>
Trio fully implements the C99 (ISO/IEC 9899:1999) and UNIX98 (the Single Unix Specification, Version 2) standards, as well as many features from other implemenations, e.g. the GNU libc and BSD4.
<p>
<a name="examples"><h2>Examples</h2></a>

<p>
<a name="ex1"><h3>Binary Numbers</h3></a>
 Output an integer as a binary number using a trio extension. <div class="fragment"><pre>
  trio_printf("%..2i\n", number);
</pre></div>
<p>
<a name="ex2"><h3>Thousand-separator</h3></a>
 Output a number with thousand-separator using a trio extension. <div class="fragment"><pre>
  trio_printf("%'f\n", 12345.6);
</pre></div> The thousand-separator described by the locale is used.
<p>
<a name="ex3"><h3>Fixed Length Array and Sticky Modifier</h3></a>
 Output an fixed length array of floating-point numbers. <div class="fragment"><pre>
  double array[] = {1.0, 2.0, 3.0};
  printf("%.2f %.2f %.2f\n", array[0], array[1], array[2]);
</pre></div> The same with two trio extensions (arguments are passed in an array, and the first formatting specifier sets the sticky option so we do not have to type all the formatting modifiers for the remaining formatting specifiers) <div class="fragment"><pre>
  trio_printfv("%!.2f %f %f\n", array);
</pre></div> Another, and more powerful, application of being able to pass arguments in an array is the creation of the printf/scanf statement at run-time, where the formatting string, and thus the argument list, is based on an external configuration file.
<p>
<a name="ex4"><h3>Localized scanning</h3></a>
 Parse a string consisting of one or more upper-case alphabetic characters followed by one or more numeric characters. <div class="fragment"><pre>
  sscanf(buffer, "%[A-Z]%[0-9]", alphabetic, numeric);
</pre></div> The same but with locale using a trio extension. <div class="fragment"><pre>
  trio_sscanf(buffer, "%[:upper:]%[:digit:]", alphabetic, numeric);
</pre></div>
<p>
<a name="legal"><h2>Legal Issues</h2></a>
 Trio is distributed under the following license, which allows practically anybody to use it in almost any kind of software, including proprietary software, without difficulty.
<p>
"Copyright (C) 1998-2001 Bjorn Reese and Daniel Stenberg.
<p>
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
<p>
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER."
<p>
<a name="contribution"><h2>Contribution</h2></a>

<p>
<a name="contribute"><h3>Contribute</h3></a>
 We appreciate any type of contribution, from ideas over improvements to error corrections.
<p>
The project space contains references to bug and feature tracking, mailing-list, and the CVS repository. We prefer communication via the mailing-list, but do not require you to be subscribed, because trio is a small project.
<p>
The project space is located at <a href="http://sourceforge.net/projects/ctrio/">http://sourceforge.net/projects/ctrio/</a>
<p>
<a name="contributors"><h3>Contributors</h3></a>
 We have received contributions from the following persons (in alphabetic order sorted by surname)
<p>
<ul>
<li> Stan Boehm <li> Robert Collins <li> Danny Dulai <li> John Fotheringham <li> Markus Henke <li> Ken Gibson <li> Paul Janzen <li> Richard Jinks <li> Tero Jänkä <li> Howard Kapustein <li> Alexander Lukyanov <li> Emmanuel Mogenet <li> Jose Ortiz <li> Joe Orton <li> Gisli Ottarsson <li> Marc Werwerft <li> Igor Zlatkovic</ul>
Please let us know, and accept our apology, if we have omitted anybody.
<p>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/modules.html
+++ avida/current/source/third-party/trio-1.9/trio/html/modules.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>TRIO Modules</h1>Here is a list of all modules:<ul>
<li><a class="el" href="group___printf.html">Formatted Printing Functions.</a>
<li><a class="el" href="group___user_defined.html">User-defined Formatted Printing Functions.</a>
<li><a class="el" href="group___scanf.html">Formatted Scanning Functions.</a>
<li><a class="el" href="group___special_quantities.html">Special Quantifies.</a>
<li><a class="el" href="group___static_strings.html">Static String Functions.</a>
<li><a class="el" href="group___dynamic_strings.html">Dynamic String Functions.</a>
</ul>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>

Index: avida/current/source/third-party/trio-1.9/trio/html/trio.css
+++ avida/current/source/third-party/trio-1.9/trio/html/trio.css
/* HTML tags */

BODY {
 background-color: white;
 color: darkblue;
}

TD { color: darkblue; }

H1 { text-align: center; }

H3 { font-style: italic; }

HR {
 width: 85%;
 align: center;
}

copyright { color: darkblue; }

/* Links */

:link { color: blue; }

:visited { color: purple; }

:active { color: red; }

el:link { font-style: italic; }

/* Examples */

DIV.fragment {
 color: maroon;
}

Index: avida/current/source/third-party/trio-1.9/yaktest/AUTHORS.0
+++ avida/current/source/third-party/trio-1.9/yaktest/AUTHORS.0
Authors of yaktest

Victor Putz.  Author of all files.

Index: avida/current/source/third-party/trio-1.9/yaktest/COPYING.0
+++ avida/current/source/third-party/trio-1.9/yaktest/COPYING.0
		  GNU LIBRARY GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1991 Free Software Foundation, Inc.
                    675 Mass Ave, Cambridge, MA 02139, USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

[This is the first released version of the library GPL.  It is
 numbered 2 because it goes with version 2 of the ordinary GPL.]

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.

  This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it.  You can use it for
your libraries, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.

  For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you.  You must make sure that they, too, receive or can get the source
code.  If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it.  And you must show them these terms so they know their rights.

  Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.

  Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library.  If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software.  To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.

  Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs.  This
license, the GNU Library General Public License, applies to certain
designated libraries.  This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.

  The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it.  Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program.  However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.

  Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries.  We
concluded that weaker conditions might promote sharing better.

  However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves.  This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them.  (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.)  The hope is that this
will lead to faster development of free libraries.

  The precise terms and conditions for copying, distribution and
modification follow.  Pay close attention to the difference between a
"work based on the library" and a "work that uses the library".  The
former contains code derived from the library, while the latter only
works together with the library.

  Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.

		  GNU LIBRARY GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License").  Each licensee is
addressed as "you".

  A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.

  The "Library", below, refers to any such software library or work
which has been distributed under these terms.  A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language.  (Hereinafter, translation is
included without limitation in the term "modification".)

  "Source code" for a work means the preferred form of the work for
making modifications to it.  For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.

  Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it).  Whether that is true depends on what the Library does
and what the program that uses the Library does.
  
  1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.

  You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.

  2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) The modified work must itself be a software library.

    b) You must cause the files modified to carry prominent notices
    stating that you changed the files and the date of any change.

    c) You must cause the whole of the work to be licensed at no
    charge to all third parties under the terms of this License.

    d) If a facility in the modified Library refers to a function or a
    table of data to be supplied by an application program that uses
    the facility, other than as an argument passed when the facility
    is invoked, then you must make a good faith effort to ensure that,
    in the event an application does not supply such function or
    table, the facility still operates, and performs whatever part of
    its purpose remains meaningful.

    (For example, a function in a library to compute square roots has
    a purpose that is entirely well-defined independent of the
    application.  Therefore, Subsection 2d requires that any
    application-supplied function or table used by this function must
    be optional: if the application does not supply it, the square
    root function must still compute square roots.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.

In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library.  To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License.  (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.)  Do not make any other change in
these notices.

  Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.

  This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.

  4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.

  If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.

  5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library".  Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.

  However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library".  The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.

  When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library.  The
threshold for this to be true is not precisely defined by law.

  If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work.  (Executables containing this object code plus portions of the
Library will still fall under Section 6.)

  Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.

  6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.

  You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License.  You must supply a copy of this License.  If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License.  Also, you must do one
of these things:

    a) Accompany the work with the complete corresponding
    machine-readable source code for the Library including whatever
    changes were used in the work (which must be distributed under
    Sections 1 and 2 above); and, if the work is an executable linked
    with the Library, with the complete machine-readable "work that
    uses the Library", as object code and/or source code, so that the
    user can modify the Library and then relink to produce a modified
    executable containing the modified Library.  (It is understood
    that the user who changes the contents of definitions files in the
    Library will not necessarily be able to recompile the application
    to use the modified definitions.)

    b) Accompany the work with a written offer, valid for at
    least three years, to give the same user the materials
    specified in Subsection 6a, above, for a charge no more
    than the cost of performing this distribution.

    c) If distribution of the work is made by offering access to copy
    from a designated place, offer equivalent access to copy the above
    specified materials from the same place.

    d) Verify that the user has already received a copy of these
    materials or that you have already sent this user a copy.

  For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it.  However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.

  It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system.  Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.

  7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:

    a) Accompany the combined library with a copy of the same work
    based on the Library, uncombined with any other library
    facilities.  This must be distributed under the terms of the
    Sections above.

    b) Give prominent notice with the combined library of the fact
    that part of it is a work based on the Library, and explaining
    where to find the accompanying uncombined form of the same work.

  8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License.  Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License.  However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.

  9. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Library or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.

  10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all.  For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded.  In such case, this License incorporates the limitation as if
written in the body of this License.

  13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number.  If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation.  If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.

  14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission.  For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this.  Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.

			    NO WARRANTY

  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

		     END OF TERMS AND CONDITIONS

     Appendix: How to Apply These Terms to Your New Libraries

  If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change.  You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

  To apply these terms, attach the following notices to the library.  It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the library's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  library `Frob' (a library for tweaking knobs) written by James Random Hacker.

  <signature of Ty Coon>, 1 April 1990
  Ty Coon, President of Vice

That's all there is to it!

Index: avida/current/source/third-party/trio-1.9/yaktest/ChangeLog.0
+++ avida/current/source/third-party/trio-1.9/yaktest/ChangeLog.0
Sat Nov 13 08:18:30 1999 Victor Putz <vputz at nyx.net>
	Initial release

Index: avida/current/source/third-party/trio-1.9/yaktest/INSTALL.0
+++ avida/current/source/third-party/trio-1.9/yaktest/INSTALL.0
Basic Installation
==================

Yaktest uses the automake package, which should do a decent
job of guessing correct values for system-dependent compilation.

The simplest way to compile this is:

  1. cd to the directory containing the configure script, and
     type `./configure' to configure the package and generate
     Makefiles.

  2. Type `make' to compile the package.

No more installation instructions yet; they will come with the
next release.


Index: avida/current/source/third-party/trio-1.9/yaktest/Makefile.am
+++ avida/current/source/third-party/trio-1.9/yaktest/Makefile.am
##process this file with automake to create Makefile.in
#CXXFLAGS=-O2
CPPFLAGS = @CPPFLAGS@

#lib_LIBRARIES = libyaktest.a
noinst_LIBRARIES = libyaktest.a

libyaktest_a_SOURCES = \
test_problem.cpp \
test_result.cpp \
test_case.cpp \
text_test_interpreter.cpp

pkginclude_HEADERS = \
stringable.h \
test_case.h \
test_problem.h \
test_result.h \
text_test_interpreter.h

SUBDIRS = . example

Index: avida/current/source/third-party/trio-1.9/yaktest/Makefile.am.0
+++ avida/current/source/third-party/trio-1.9/yaktest/Makefile.am.0
SUBDIRS=src

Index: avida/current/source/third-party/trio-1.9/yaktest/NEWS.0
+++ avida/current/source/third-party/trio-1.9/yaktest/NEWS.0
No news...
Index: avida/current/source/third-party/trio-1.9/yaktest/README.0
+++ avida/current/source/third-party/trio-1.9/yaktest/README.0
yaktest-1.00

This is a very larval stage of a testing framework intended to 
automate unit-style testing in the unix "make" testing environment.
It is based loosely on Mike Feathers' CppUnit library, which is
itself based loosely on the JUnit testing framework.

Yaktest attempts to be a cleaner, more minimal design with
primarily text output, in a form such that you can include a 
"test" target in a makefile, and get an emacs-compatible
list of failed tests with filenames and line numbers.

For an example, see the src/example directory. It compiles
and seems to work fine on gcc-2.95-2. 

The library does not currently install itself, and I confess
that I'm new to linux-style distributables, so apologies if this
is non-standard (and please let me know how to fix it!).

If you have any questions, please contact me at vputz at nyx.net.

src -- source code of the library
src/example -- example of tests written for a cartesian point class


Index: avida/current/source/third-party/trio-1.9/yaktest/aclocal.m4.0
+++ avida/current/source/third-party/trio-1.9/yaktest/aclocal.m4.0
# generated automatically by aclocal 1.7.4 -*- Autoconf -*-

# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

# Do all the work for Automake.                            -*- Autoconf -*-

# This macro actually does too much some checks are only needed if
# your package does certain things.  But this isn't really a big deal.

# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 10

AC_PREREQ([2.54])

# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
# the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl

# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out.  PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition.  After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
 AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
   test -f $srcdir/config.status; then
  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi

# test whether we have cygpath
if test -z "$CYGPATH_W"; then
  if (cygpath --version) >/dev/null 2>/dev/null; then
    CYGPATH_W='cygpath -w'
  else
    CYGPATH_W=echo
  fi
fi
AC_SUBST([CYGPATH_W])

# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
 AC_SUBST([PACKAGE], [$1])dnl
 AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl

_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl

# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_MISSING_PROG(AMTAR, tar)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
# We need awk for the "check" target.  The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl

_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
                  [_AM_DEPENDENCIES(CC)],
                  [define([AC_PROG_CC],
                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
                  [_AM_DEPENDENCIES(CXX)],
                  [define([AC_PROG_CXX],
                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])


# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated.  The stamp files are numbered to have different names.

# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
  case $_am_header in
    $1 | $1:* )
      break ;;
    * )
      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
  esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])

# Copyright 2002  Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA

# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])

# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
	 [AM_AUTOMAKE_VERSION([1.7.4])])

# Helper functions for option handling.                    -*- Autoconf -*-

# Copyright 2001, 2002  Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 2

# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])

# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME.  Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])

# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])

# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])

#
# Check to make sure that the build environment is sane.
#

# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 3

# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments.  Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
   if test "$[*]" = "X"; then
      # -L didn't work.
      set X `ls -t $srcdir/configure conftest.file`
   fi
   rm -f conftest.file
   if test "$[*]" != "X $srcdir/configure conftest.file" \
      && test "$[*]" != "X conftest.file $srcdir/configure"; then

      # If neither matched, then we have a broken ls.  This can happen
      # if, for instance, CONFIG_SHELL is bash and it inherits a
      # broken ls alias from the environment.  This has actually
      # happened.  Such a system could not be considered "sane".
      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
alias in your environment])
   fi

   test "$[2]" = conftest.file
   )
then
   # Ok.
   :
else
   AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])

#  -*- Autoconf -*-


# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 3

# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])


# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
  am_missing_run="$MISSING --run "
else
  am_missing_run=
  AC_MSG_WARN([`missing' script is too old or missing])
fi
])

# AM_AUX_DIR_EXPAND

# Copyright 2001 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory.  The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run.  This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
#    fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
#    fails if $ac_aux_dir is absolute,
#    fails when called from a subdirectory in a VPATH build with
#          a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir.  In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
#   MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH.  The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.

# Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])

AC_DEFUN([AM_AUX_DIR_EXPAND], [
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])

# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.

# Copyright 2001 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])

# AM_PROG_INSTALL_STRIP

# Copyright 2001 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries.  This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'.  However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
  AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])

#                                                          -*- Autoconf -*-
# Copyright (C) 2003  Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 1

# Check whether the underlying file-system supports filenames
# with a leading dot.  For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
  am__leading_dot=.
else
  am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])

# serial 5						-*- Autoconf -*-

# Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.


# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery.  Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...



# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl

ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
                   [depcc="$$1"   am_compiler_list=])

AC_CACHE_CHECK([dependency style of $depcc],
               [am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
  # We make a subdir and do the tests there.  Otherwise we can end up
  # making bogus files that we don't know about and never remove.  For
  # instance it was reported that on HP-UX the gcc test will end up
  # making a dummy file named `D' -- because `-MD' means `put the output
  # in D'.
  mkdir conftest.dir
  # Copy depcomp to subdir because otherwise we won't find it if we're
  # using a relative directory.
  cp "$am_depcomp" conftest.dir
  cd conftest.dir

  am_cv_$1_dependencies_compiler_type=none
  if test "$am_compiler_list" = ""; then
     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
  fi
  for depmode in $am_compiler_list; do
    # We need to recreate these files for each test, as the compiler may
    # overwrite some of them when testing with obscure command lines.
    # This happens at least with the AIX C compiler.
    echo '#include "conftest.h"' > conftest.c
    echo 'int i;' > conftest.h
    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf

    case $depmode in
    nosideeffect)
      # after this tag, mechanisms are not by side-effect, so they'll
      # only be used when explicitly requested
      if test "x$enable_dependency_tracking" = xyes; then
	continue
      else
	break
      fi
      ;;
    none) break ;;
    esac
    # We check with `-c' and `-o' for the sake of the "dashmstdout"
    # mode.  It turns out that the SunPro C++ compiler does not properly
    # handle `-M -o', and we need to detect this.
    if depmode=$depmode \
       source=conftest.c object=conftest.o \
       depfile=conftest.Po tmpdepfile=conftest.TPo \
       $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \
         >/dev/null 2>conftest.err &&
       grep conftest.h conftest.Po > /dev/null 2>&1 &&
       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
      # icc doesn't choke on unknown options, it will just issue warnings
      # (even with -Werror).  So we grep stderr for any message
      # that says an option was ignored.
      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
        am_cv_$1_dependencies_compiler_type=$depmode
        break
      fi
    fi
  done

  cd ..
  rm -rf conftest.dir
else
  am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
  test "x$enable_dependency_tracking" != xno \
  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])


# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])


# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[  --disable-dependency-tracking Speeds up one-time builds
  --enable-dependency-tracking  Do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
  am_depcomp="$ac_aux_dir/depcomp"
  AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])

# Generate code to set up dependency tracking.   -*- Autoconf -*-

# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

#serial 2

# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
  # Strip MF so we end up with the name of the file.
  mf=`echo "$mf" | sed -e 's/:.*$//'`
  # Check whether this is an Automake generated Makefile or not.
  # We used to match only the files named `Makefile.in', but
  # some people rename them; so instead we look at the file content.
  # Grep'ing the first line is not enough: some people post-process
  # each Makefile.in and add a new line on top of each file to say so.
  # So let's grep whole file.
  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
    dirpart=`AS_DIRNAME("$mf")`
  else
    continue
  fi
  grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
  # Extract the definition of DEP_FILES from the Makefile without
  # running `make'.
  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
  test -z "$DEPDIR" && continue
  # When using ansi2knr, U may be empty or an underscore; expand it
  U=`sed -n -e '/^U = / s///p' < "$mf"`
  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
  # We invoke sed twice because it is the simplest approach to
  # changing $(DEPDIR) to its actual value in the expansion.
  for file in `sed -n -e '
    /^DEP_FILES = .*\\\\$/ {
      s/^DEP_FILES = //
      :loop
	s/\\\\$//
	p
	n
	/\\\\$/ b loop
      p
    }
    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
    # Make sure the directory exists.
    test -f "$dirpart/$file" && continue
    fdir=`AS_DIRNAME(["$file"])`
    AS_MKDIR_P([$dirpart/$fdir])
    # echo "creating $dirpart/$file"
    echo '# dummy' > "$dirpart/$file"
  done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS


# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled.  FIXME.  This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])

# Check to see how 'make' treats includes.	-*- Autoconf -*-

# Copyright (C) 2001, 2002 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 2

# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
doit:
	@echo done
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
   am__include=include
   am__quote=
   _am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
   echo '.include "confinc"' > confmf
   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
      am__include=.include
      am__quote="\""
      _am_result=BSD
   fi
fi
AC_SUBST(am__include)
AC_SUBST(am__quote)
AC_MSG_RESULT($_am_result)
rm -f confinc confmf
])

# AM_CONDITIONAL                                              -*- Autoconf -*-

# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# serial 5

AC_PREREQ(2.52)

# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
  $1_TRUE=
  $1_FALSE='#'
else
  $1_TRUE='#'
  $1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
  AC_MSG_ERROR([conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.])
fi])])


Index: avida/current/source/third-party/trio-1.9/yaktest/configure.in.0
+++ avida/current/source/third-party/trio-1.9/yaktest/configure.in.0
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/lib/test_case.h)
AM_INIT_AUTOMAKE( yaktest, 1.0.1 )
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_CC

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T

dnl Checks for library functions.

AC_OUTPUT([ \
Makefile \
src/Makefile \
src/example/Makefile \
src/lib/Makefile
] )

Index: avida/current/source/third-party/trio-1.9/yaktest/depcomp.0
+++ avida/current/source/third-party/trio-1.9/yaktest/depcomp.0
#! /bin/sh

# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.

if test -z "$depmode" || test -z "$source" || test -z "$object"; then
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
  exit 1
fi
# `libtool' can also be set to `yes' or `no'.

if test -z "$depfile"; then
   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
   dir=`echo "$object" | sed 's,/.*$,/,'`
   if test "$dir" = "$object"; then
      dir=
   fi
   # FIXME: should be _deps on DOS.
   depfile="$dir.deps/$base"
fi

tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}

rm -f "$tmpdepfile"

# Some modes work just like other modes, but use different flags.  We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write.  Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
  # HP compiler uses -M and no extra arg.
  gccflag=-M
  depmode=gcc
fi

if test "$depmode" = dashXmstdout; then
   # This is just like dashmstdout with a different argument.
   dashmflag=-xM
   depmode=dashmstdout
fi

case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff.  Hmm.
  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  mv "$tmpdepfile" "$depfile"
  ;;

gcc)
## There are various ways to get dependency output from gcc.  Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
##   up in a subdir.  Having to rename by hand is ugly.
##   (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
##   -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
##   than renaming).
  if test -z "$gccflag"; then
    gccflag=-MD,
  fi
  "$@" -Wp,"$gccflag$tmpdepfile"
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
  sed -e 's/^[^:]*: / /' \
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header).  We avoid this by adding
## dummy dependencies for each header file.  Too bad gcc doesn't do
## this for us directly.
  tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'.  On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

hp)
  # This case exists only to let depend.m4 do its work.  It works by
  # looking at the text of this script.  This case will never be run,
  # since it is checked for above.
  exit 1
  ;;

sgi)
  if test "$libtool" = yes; then
    "$@" "-Wp,-MDupdate,$tmpdepfile"
  else
    "$@" -MDupdate "$tmpdepfile"
  fi
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"

  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
    echo "$object : \\" > "$depfile"

    # Clip off the initial element (the dependent).  Don't try to be
    # clever and replace this with sed code, as IRIX sed won't handle
    # lines with more than a fixed number of characters (4096 in
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
    # the IRIX cc adds comments like `#:fec' to the end of the
    # dependency line.
    tr ' ' '
' < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
    tr '
' ' ' >> $depfile
    echo >> $depfile

    # The second pass generates a dummy entry for each header file.
    tr ' ' '
' < "$tmpdepfile" \
   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
   >> $depfile
  else
    # The sourcefile does not contain any dependencies, so just
    # store a dummy comment line, to avoid errors with the Makefile
    # "include basename.Plo" scheme.
    echo "#dummy" > "$depfile"
  fi
  rm -f "$tmpdepfile"
  ;;

aix)
  # The C for AIX Compiler uses -M and outputs the dependencies
  # in a .u file.  This file always lives in the current directory.
  # Also, the AIX compiler puts `$object:' at the start of each line;
  # $object doesn't have directory information.
  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
  tmpdepfile="$stripped.u"
  outname="$stripped.o"
  if test "$libtool" = yes; then
    "$@" -Wc,-M
  else
    "$@" -M
  fi

  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi

  if test -f "$tmpdepfile"; then
    # Each line is of the form `foo.o: dependent.h'.
    # Do two passes, one to just change these to
    # `$object: dependent.h' and one to simply `dependent.h:'.
    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
  else
    # The sourcefile does not contain any dependencies, so just
    # store a dummy comment line, to avoid errors with the Makefile
    # "include basename.Plo" scheme.
    echo "#dummy" > "$depfile"
  fi
  rm -f "$tmpdepfile"
  ;;

tru64)
   # The Tru64 compiler uses -MD to generate dependencies as a side
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
   # dependencies in `foo.d' instead, so we check for that too.
   # Subdirectories are respected.
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
   test "x$dir" = "x$object" && dir=
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`

   if test "$libtool" = yes; then
      tmpdepfile1="$dir.libs/$base.lo.d"
      tmpdepfile2="$dir.libs/$base.d"
      "$@" -Wc,-MD
   else
      tmpdepfile1="$dir$base.o.d"
      tmpdepfile2="$dir$base.d"
      "$@" -MD
   fi

   stat=$?
   if test $stat -eq 0; then :
   else
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      exit $stat
   fi

   if test -f "$tmpdepfile1"; then
      tmpdepfile="$tmpdepfile1"
   else
      tmpdepfile="$tmpdepfile2"
   fi
   if test -f "$tmpdepfile"; then
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
      # That's a space and a tab in the [].
      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
      echo "#dummy" > "$depfile"
   fi
   rm -f "$tmpdepfile"
   ;;

#nosideeffect)
  # This comment above is used by automake to tell side-effect
  # dependency tracking mechanisms from slower ones.

dashmstdout)
  # Important note: in order to support this mode, a compiler *must*
  # always write the proprocessed file to stdout, regardless of -o.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test $1 != '--mode=compile'; do
      shift
    done
    shift
  fi

  # Remove `-o $object'.  We will use -o /dev/null later,
  # however we can't do the remplacement now because
  # `-o $object' might simply not be used
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    *)
      set fnord "$@" "$arg"
      shift # fnord
      shift # $arg
      ;;
    esac
  done

  test -z "$dashmflag" && dashmflag=-M
  "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
  rm -f "$depfile"
  cat < "$tmpdepfile" > "$depfile"
  tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

dashXmstdout)
  # This case only exists to satisfy depend.m4.  It is never actually
  # run, as this mode is specially recognized in the preamble.
  exit 1
  ;;

makedepend)
  "$@" || exit $?
  # X makedepend
  shift
  cleared=no
  for arg in "$@"; do
    case $cleared in
    no)
      set ""; shift
      cleared=yes ;;
    esac
    case "$arg" in
    -D*|-I*)
      set fnord "$@" "$arg"; shift ;;
    -*)
      ;;
    *)
      set fnord "$@" "$arg"; shift ;;
    esac
  done
  obj_suffix="`echo $object | sed 's/^.*\././'`"
  touch "$tmpdepfile"
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
  rm -f "$depfile"
  cat < "$tmpdepfile" > "$depfile"
  sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile" "$tmpdepfile".bak
  ;;

cpp)
  # Important note: in order to support this mode, a compiler *must*
  # always write the proprocessed file to stdout.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test $1 != '--mode=compile'; do
      shift
    done
    shift
  fi

  # Remove `-o $object'.
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    *)
      set fnord "$@" "$arg"
      shift # fnord
      shift # $arg
      ;;
    esac
  done

  "$@" -E |
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
    sed '$ s: \\$::' > "$tmpdepfile"
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  cat < "$tmpdepfile" >> "$depfile"
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

msvisualcpp)
  # Important note: in order to support this mode, a compiler *must*
  # always write the proprocessed file to stdout, regardless of -o,
  # because we must use -o when running libtool.
  "$@" || exit $?
  IFS=" "
  for arg
  do
    case "$arg" in
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
	set fnord "$@"
	shift
	shift
	;;
    *)
	set fnord "$@" "$arg"
	shift
	shift
	;;
    esac
  done
  "$@" -E |
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
  echo "	" >> "$depfile"
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

none)
  exec "$@"
  ;;

*)
  echo "Unknown depmode $depmode" 1>&2
  exit 1
  ;;
esac

exit 0

Index: avida/current/source/third-party/trio-1.9/yaktest/install-sh.0
+++ avida/current/source/third-party/trio-1.9/yaktest/install-sh.0
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission.  M.I.T. makes no representations about the
# suitability of this software for any purpose.  It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.  It can only install one file at a time, a restriction
# shared with many OS's install programs.


# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"


# put in absolute paths if you don't have them in your path; or use env. vars.

mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"

transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""

while [ x"$1" != x ]; do
    case $1 in
	-c) instcmd="$cpprog"
	    shift
	    continue;;

	-d) dir_arg=true
	    shift
	    continue;;

	-m) chmodcmd="$chmodprog $2"
	    shift
	    shift
	    continue;;

	-o) chowncmd="$chownprog $2"
	    shift
	    shift
	    continue;;

	-g) chgrpcmd="$chgrpprog $2"
	    shift
	    shift
	    continue;;

	-s) stripcmd="$stripprog"
	    shift
	    continue;;

	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
	    shift
	    continue;;

	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
	    shift
	    continue;;

	*)  if [ x"$src" = x ]
	    then
		src=$1
	    else
		# this colon is to work around a 386BSD /bin/sh bug
		:
		dst=$1
	    fi
	    shift
	    continue;;
    esac
done

if [ x"$src" = x ]
then
	echo "install:	no input file specified"
	exit 1
else
	:
fi

if [ x"$dir_arg" != x ]; then
	dst=$src
	src=""
	
	if [ -d $dst ]; then
		instcmd=:
		chmodcmd=""
	else
		instcmd=$mkdirprog
	fi
else

# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad 
# if $src (and thus $dsttmp) contains '*'.

	if [ -f "$src" ] || [ -d "$src" ]
	then
		:
	else
		echo "install:  $src does not exist"
		exit 1
	fi
	
	if [ x"$dst" = x ]
	then
		echo "install:	no destination specified"
		exit 1
	else
		:
	fi

# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic

	if [ -d $dst ]
	then
		dst="$dst"/`basename $src`
	else
		:
	fi
fi

## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`

# Make sure that the destination directory exists.
#  this part is taken from Noah Friedman's mkinstalldirs script

# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
	'
IFS="${IFS-${defaultIFS}}"

oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"

pathcomp=''

while [ $# -ne 0 ] ; do
	pathcomp="${pathcomp}${1}"
	shift

	if [ ! -d "${pathcomp}" ] ;
        then
		$mkdirprog "${pathcomp}"
	else
		:
	fi

	pathcomp="${pathcomp}/"
done
fi

if [ x"$dir_arg" != x ]
then
	$doit $instcmd $dst &&

	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
else

# If we're going to rename the final executable, determine the name now.

	if [ x"$transformarg" = x ] 
	then
		dstfile=`basename $dst`
	else
		dstfile=`basename $dst $transformbasename | 
			sed $transformarg`$transformbasename
	fi

# don't allow the sed command to completely eliminate the filename

	if [ x"$dstfile" = x ] 
	then
		dstfile=`basename $dst`
	else
		:
	fi

# Make a temp file name in the proper directory.

	dsttmp=$dstdir/#inst.$$#

# Move or copy the file name to the temp name

	$doit $instcmd $src $dsttmp &&

	trap "rm -f ${dsttmp}" 0 &&

# and set any options; do chmod last to preserve setuid bits

# If any of these fail, we abort the whole thing.  If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.

	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&

# Now rename the file to the real destination.

	$doit $rmcmd -f $dstdir/$dstfile &&
	$doit $mvcmd $dsttmp $dstdir/$dstfile 

fi &&


exit 0

Index: avida/current/source/third-party/trio-1.9/yaktest/missing.0
+++ avida/current/source/third-party/trio-1.9/yaktest/missing.0
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.

# 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; either version 2, or (at your option)
# any later version.

# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

if test $# -eq 0; then
  echo 1>&2 "Try \`$0 --help' for more information"
  exit 1
fi

run=:

# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
  configure_ac=configure.ac
else
  configure_ac=configure.in
fi

case "$1" in
--run)
  # Try to run requested program, and just exit if it succeeds.
  run=
  shift
  "$@" && exit 0
  ;;
esac

# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in

  -h|--h|--he|--hel|--help)
    echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...

Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.

Options:
  -h, --help      display this help and exit
  -v, --version   output version information and exit
  --run           try to run the given command, and emulate it if it fails

Supported PROGRAM values:
  aclocal      touch file \`aclocal.m4'
  autoconf     touch file \`configure'
  autoheader   touch file \`config.h.in'
  automake     touch all \`Makefile.in' files
  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
  flex         create \`lex.yy.c', if possible, from existing .c
  help2man     touch the output file
  lex          create \`lex.yy.c', if possible, from existing .c
  makeinfo     touch the output file
  tar          try tar, gnutar, gtar, then tar without non-portable flags
  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
    ;;

  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
    echo "missing 0.4 - GNU automake"
    ;;

  -*)
    echo 1>&2 "$0: Unknown \`$1' option"
    echo 1>&2 "Try \`$0 --help' for more information"
    exit 1
    ;;

  aclocal*)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
         to install the \`Automake' and \`Perl' packages.  Grab them from
         any GNU archive site."
    touch aclocal.m4
    ;;

  autoconf)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified \`${configure_ac}'.  You might want to install the
         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
         archive site."
    touch configure
    ;;

  autoheader)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
         from any GNU archive site."
    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
    test -z "$files" && files="config.h"
    touch_files=
    for f in $files; do
      case "$f" in
      *:*) touch_files="$touch_files "`echo "$f" |
				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
      *) touch_files="$touch_files $f.in";;
      esac
    done
    touch $touch_files
    ;;

  automake*)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
         You might want to install the \`Automake' and \`Perl' packages.
         Grab them from any GNU archive site."
    find . -type f -name Makefile.am -print |
	   sed 's/\.am$/.in/' |
	   while read f; do touch "$f"; done
    ;;

  autom4te)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
         system.  You might have modified some files without having the
         proper tools for further handling them.
         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
         archive site."

    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
    if test -f "$file"; then
	touch $file
    else
	test -z "$file" || exec >$file
	echo "#! /bin/sh"
	echo "# Created by GNU Automake missing as a replacement of"
	echo "#  $ $@"
	echo "exit 0"
	chmod +x $file
	exit 1
    fi
    ;;

  bison|yacc)
    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified a \`.y' file.  You may need the \`Bison' package
         in order for those modifications to take effect.  You can get
         \`Bison' from any GNU archive site."
    rm -f y.tab.c y.tab.h
    if [ $# -ne 1 ]; then
        eval LASTARG="\${$#}"
	case "$LASTARG" in
	*.y)
	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
	    if [ -f "$SRCFILE" ]; then
	         cp "$SRCFILE" y.tab.c
	    fi
	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
	    if [ -f "$SRCFILE" ]; then
	         cp "$SRCFILE" y.tab.h
	    fi
	  ;;
	esac
    fi
    if [ ! -f y.tab.h ]; then
	echo >y.tab.h
    fi
    if [ ! -f y.tab.c ]; then
	echo 'main() { return 0; }' >y.tab.c
    fi
    ;;

  lex|flex)
    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified a \`.l' file.  You may need the \`Flex' package
         in order for those modifications to take effect.  You can get
         \`Flex' from any GNU archive site."
    rm -f lex.yy.c
    if [ $# -ne 1 ]; then
        eval LASTARG="\${$#}"
	case "$LASTARG" in
	*.l)
	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
	    if [ -f "$SRCFILE" ]; then
	         cp "$SRCFILE" lex.yy.c
	    fi
	  ;;
	esac
    fi
    if [ ! -f lex.yy.c ]; then
	echo 'main() { return 0; }' >lex.yy.c
    fi
    ;;

  help2man)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
	 you modified a dependency of a manual page.  You may need the
	 \`Help2man' package in order for those modifications to take
	 effect.  You can get \`Help2man' from any GNU archive site."

    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    if test -z "$file"; then
	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
    fi
    if [ -f "$file" ]; then
	touch $file
    else
	test -z "$file" || exec >$file
	echo ".ab help2man is required to generate this page"
	exit 1
    fi
    ;;

  makeinfo)
    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
       # We have makeinfo, but it failed.
       exit 1
    fi

    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified a \`.texi' or \`.texinfo' file, or any other file
         indirectly affecting the aspect of the manual.  The spurious
         call might also be the consequence of using a buggy \`make' (AIX,
         DU, IRIX).  You might want to install the \`Texinfo' package or
         the \`GNU make' package.  Grab either from any GNU archive site."
    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    if test -z "$file"; then
      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
    fi
    touch $file
    ;;

  tar)
    shift
    if test -n "$run"; then
      echo 1>&2 "ERROR: \`tar' requires --run"
      exit 1
    fi

    # We have already tried tar in the generic part.
    # Look for gnutar/gtar before invocation to avoid ugly error
    # messages.
    if (gnutar --version > /dev/null 2>&1); then
       gnutar "$@" && exit 0
    fi
    if (gtar --version > /dev/null 2>&1); then
       gtar "$@" && exit 0
    fi
    firstarg="$1"
    if shift; then
	case "$firstarg" in
	*o*)
	    firstarg=`echo "$firstarg" | sed s/o//`
	    tar "$firstarg" "$@" && exit 0
	    ;;
	esac
	case "$firstarg" in
	*h*)
	    firstarg=`echo "$firstarg" | sed s/h//`
	    tar "$firstarg" "$@" && exit 0
	    ;;
	esac
    fi

    echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
         You may want to install GNU tar or Free paxutils, or check the
         command line arguments."
    exit 1
    ;;

  *)
    echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
         system.  You might have modified some files without having the
         proper tools for further handling them.  Check the \`README' file,
         it often tells you about the needed prerequirements for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing \`$1' program."
    exit 1
    ;;
esac

exit 0

Index: avida/current/source/third-party/trio-1.9/yaktest/mkinstalldirs.0
+++ avida/current/source/third-party/trio-1.9/yaktest/mkinstalldirs.0
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman at prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain

errstatus=0
dirmode=""

usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."

# process command line arguments
while test $# -gt 0 ; do
   case "${1}" in
     -h | --help | --h* )			# -h for help
	echo "${usage}" 1>&2; exit 0 ;;
     -m )					# -m PERM arg
	shift
	test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
	dirmode="${1}"
	shift ;;
     -- ) shift; break ;;			# stop option processing
     -* ) echo "${usage}" 1>&2; exit 1 ;;	# unknown option
     * )  break ;;				# first non-opt arg
   esac
done

for file
do
  if test -d "$file"; then
    shift
  else
    break
  fi
done

case $# in
0) exit 0 ;;
esac

case $dirmode in
'')
  if mkdir -p -- . 2>/dev/null; then
    echo "mkdir -p -- $*"
    exec mkdir -p -- "$@"
  fi ;;
*)
  if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
    echo "mkdir -m $dirmode -p -- $*"
    exec mkdir -m "$dirmode" -p -- "$@"
  fi ;;
esac

for file
do
   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
   shift

   pathcomp=
   for d
   do
     pathcomp="$pathcomp$d"
     case "$pathcomp" in
       -* ) pathcomp=./$pathcomp ;;
     esac

     if test ! -d "$pathcomp"; then
	echo "mkdir $pathcomp"

	mkdir "$pathcomp" || lasterr=$?

	if test ! -d "$pathcomp"; then
	  errstatus=$lasterr
	else
	  if test ! -z "$dirmode"; then
	     echo "chmod $dirmode $pathcomp"

	     lasterr=""
	     chmod "$dirmode" "$pathcomp" || lasterr=$?

	     if test ! -z "$lasterr"; then
	       errstatus=$lasterr
	     fi
	  fi
	fi
     fi

     pathcomp="$pathcomp/"
   done
done

exit $errstatus

# Local Variables:
# mode: shell-script
# sh-indentation: 3
# End:
# mkinstalldirs ends here

Index: avida/current/source/third-party/trio-1.9/yaktest/stringable.h
+++ avida/current/source/third-party/trio-1.9/yaktest/stringable.h
#ifndef STRINGABLE_H
#define STRINGABLE_H

#include <string>

class stringable
{
 public:
  virtual std::string to_string( void ) const = 0;
};

#endif

Index: avida/current/source/third-party/trio-1.9/yaktest/test_case.cpp
+++ avida/current/source/third-party/trio-1.9/yaktest/test_case.cpp
#include "test_case.h"

#include<math.h>
#include<stdio.h>

//adopts a test case; we use "adopt" because we intend to take over
//the destruction of the passed object
void
test_case::adopt_test_case( test_case* new_case )
{
  m_subtests.push_back( new_case );
}

//the number of subtests
int
test_case::subtest_count( void ) const
{
  return m_subtests.size();
}

//runs all the subtests
void
test_case::run_subtests( void ) 
{
  for ( std::vector< test_case* >::iterator iter = m_subtests.begin();
	iter != m_subtests.end();
	++iter )
    {
      (*iter)->run_test();
      m_last_result.add_result( (*iter)->last_result() );
    }
}

//actually runs the test
void
test_case::run_test( void )
{
  m_last_result.delete_contents();
  set_up();
  run_subtests();
  try
    {
      test();
    }
  catch ( std::exception& e )
    {
      test_problem new_error( "unknown file", -1, e.what() );
      m_last_result.add_error( new_error );
    }
  tear_down();
}

//tests to see if the supplied condition is true; called by the 
//test_non_error macro
void
test_case::test_non_error_stub( bool condition,
			        const std::string& condition_name,
			        const std::string& filename,
			        long line_number )
{
  if ( !condition )
    {
      std::string message = "\"";
      message.append( condition_name );
      message.append( std::string( "\" evaluated to false." ) );
      m_last_result.add_error( test_problem( filename,
					       line_number,
					       message ));
    }
}


//tests to see if the supplied condition is true; called by the 
//test_is_true macro
void
test_case::test_is_true_stub( bool condition,
			      const std::string& condition_name,
			      const std::string& filename,
			      long line_number )
{
  if ( condition )
    {
      m_last_result.add_success();
    }
  else 
    {
      std::string message = "\"";
      message.append( condition_name );
      message.append( std::string( "\" evaluated to false." ) );
      m_last_result.add_failure( test_problem( filename,
					       line_number,
					       message ));
    }
}


//creates a test problem representing an inequality
test_problem
test_case::create_equality_problem_report( const std::string& actual_message,
					   const std::string& expected_message,
					   const std::string& filename,
					   long line_number )
{
  std::string message = "Equality failed.  Got ";
  message.append( actual_message );
  message.append( ", expected " );
  message.append( expected_message );
  return test_problem( filename, line_number, message );
}


//checks to see if two longs are equal
//tests to see if two longs are equal
void
test_case::test_int_is_equal_stub( long actual,
			       long expected,
			       const std::string& filename,
			       long line_number )
{
  if ( actual == expected ) 
    {
      m_last_result.add_success();
    }
  else
    {
      char temp[100];
      sprintf( temp, "%ld", actual );
      std::string actual_message( temp );
      sprintf( temp, "%ld", expected );
      std::string expected_message( temp );
      m_last_result.add_failure( create_equality_problem_report( actual_message,
								 expected_message,
								 filename,
								 line_number ) );
    }
}

void 
test_case::test_double_is_equal_stub( double actual,
				      double expected,
				      const std::string& filename,
				      long line_number,
// msvc didn't like the redeclaration of default parameter RS 2/14/2001
//				      double tolerance = 0.005 )
				      double tolerance)
{
  if ( fabs( actual - expected ) < fabs( tolerance ) )
    {
      m_last_result.add_success();
    }
  else
    {
      char temp[100];
      sprintf( temp, "%f", actual );
      std::string actual_message( temp );
      sprintf( temp, "%f", expected );
      std::string expected_message( temp );
      m_last_result.add_failure( create_equality_problem_report( actual_message,
								 expected_message,
								 filename,
								 line_number ));
    }
}


//tests to see if two strings are equal
void 
test_case::test_string_is_equal_stub( const std::string& actual,
			   const std::string& expected,
			   const std::string& filename,
			   long line_number )
{
  if ( actual == expected ) 
    {
      m_last_result.add_success();
    }
  else
    {
      std::string actual_message = std::string( "\"" );
      actual_message.append( actual );
      actual_message.append( "\"" );
      std::string expected_message = std::string( "\"" );
      expected_message.append( expected );
      expected_message.append( "\"" );
      m_last_result.add_failure( create_equality_problem_report( actual_message,
								 expected_message,
								 filename,
								 line_number ));
    }
}



//sets up the test (here, does nothing)
void
test_case::set_up( void ) 
{
}

//tears down the test (here, does nothing)
void
test_case::tear_down( void )
{
}

//the test itself; here, does nothing
void
test_case::test( void )
{
}

//construction
test_case::test_case( void ) 
{
  m_last_result.delete_contents();
  m_subtests.clear();
}

//destruction
test_case::~test_case( void )
{
  m_last_result.delete_contents();
  for ( std::vector< test_case* >::iterator iter = m_subtests.begin();
	iter != m_subtests.end();
	++iter )
    {
      delete( (*iter) );
      (*iter) = NULL;
    }
  m_subtests.clear();
}

//the last result after testing
const test_result&
test_case::last_result( void ) const
{
  return m_last_result;
}


Index: avida/current/source/third-party/trio-1.9/yaktest/test_case.h
+++ avida/current/source/third-party/trio-1.9/yaktest/test_case.h
#ifndef TEST_CASE_H
#define TEST_CASE_H

#ifndef TEST_RESULT_H
#include "test_result.h"
#endif
#ifndef STRINGABLE_H
#include "stringable.h"
#endif
#include <vector>

#ifdef WIN32
#include <sstream>
using std::ostringstream;
#endif //WIN32

// $Id: test_case.h,v 1.1 2003/11/25 18:20:50 kaben Exp $
/*! A composite test case 
 * its atomic test can be redefined by overriding
 * test(); it can also serve as a suite of tests by adding test_cases
 * to it via the add_test_case function.  It functions as a composite
 * object (see the composite pattern in Design Patterns, p 163) without
 * methods for getting individual children.
 */
class test_case 
{
 protected:
  //private methods and data
  //!the result of the last test
  test_result m_last_result;
  //!the collection of subtests
  std::vector< test_case* >m_subtests;
  //!runs the subtests
  virtual void run_subtests( void );

 public:
  //construction/destruction
  test_case( void );
  virtual ~test_case( void );

  //composition methods
  //! adds a child to the test case
  virtual void adopt_test_case( test_case* new_case );
  //! number of child test cases
  int subtest_count( void ) const;
  
  //testing methods
  //! runs the test.  This is a template method (Design Patterns 325)
  // Made virtual so subclasses could redefine the template method.  RS 2/21/01
  // specificly I want a subclass that won't exit until it sees a QT signal
  virtual void run_test( void );
  //! tests to see if the supplied condition is true; called by the test_is_true macro
  void test_non_error_stub( bool condition, 
			    const std::string& condition_name,
			    const std::string& filename,
			    long line_number );
  //! tests to see if the supplied condition is true; called by the test_is_true macro
  void test_is_true_stub( bool condition, 
			  const std::string& condition_name,
			  const std::string& filename,
			  long line_number );
  //! tests to see if two longs are equal
  void test_int_is_equal_stub( long actual,
			   long expected,
			   const std::string& filename,
			   long line_number );
  //! tests to see if two doubles are within limits
  void test_double_is_equal_stub( double actual,
				  double expected,
				  const std::string& filename,
				  long line_number,
				  double tolerance = 0.005 );
  //! tests to see if two strings are equal
  void test_string_is_equal_stub( const std::string& actual,
				  const std::string& expected,
				  const std::string& filename,
				  long line_number );
  //! creates an "equality test failed" problem report
  test_problem create_equality_problem_report( const std::string& actual_message,
					       const std::string& expected_message,
					       const std::string& filename,
					       long line_number );
  
				 
  template< class T >void test_is_equal_stub( const T& actual,
					      const T& expected,
					      const std::string& filename,
					      long line_number )
    {
      if ( actual == expected ) 
	{
	  m_last_result.add_success();
	}
      else
	{

//msvc choked on the dynamic cast RS 2/14/2001
// static cast will cause runtime error because dynamic cast returns null if the cast is incorrect 
#ifdef LINUX
	  const stringable* actual_ptr = dynamic_cast< const stringable* >( &actual );
	  const stringable* expected_ptr = dynamic_cast< const stringable* >( &expected );
	  std::string actual_message = 
	    ( actual_ptr == NULL ) ? "" : actual_ptr->to_string();
	  std::string expected_message = 
	    ( expected_ptr == NULL ) ? "" : expected_ptr->to_string();
	  m_last_result.add_failure( create_equality_problem_report( actual_message,
								     expected_message,
							     filename,
								     line_number ) );
#endif // LINUX
        //will use strstreams to get generic i/o working
        //just make sure all components have an operator <<
#ifdef WIN32
	  ostringstream actual_message;
	  ostringstream expected_message; 

    actual_message << actual;
    expected_message << expected;
	  m_last_result.add_failure( create_equality_problem_report( actual_message.str(),
								     expected_message.str(),
							     filename,
								     line_number ) );

#endif // WIN32
	}
    };
  //! check the last result for final test results
  const test_result& last_result( void ) const;

  //overrideables
  //! sets up the test.  Key method to override
  virtual void set_up( void );
  //! tears down after the test, and cleans up   Key method to override
  virtual void tear_down( void );
  //!the test itself.    Key method to override
  /*! It should either use the test_is_true/test_is_equal methods or 
   * append to the result itself
   */
  virtual void test( void );
};


//these macros are used instead of the code stubs in test_case
//in order to use preprocessor features to get filename/line number
#define test_non_error( condition ) (this->test_non_error_stub( (condition), (#condition), __FILE__, __LINE__ ))
#define test_is_true( condition ) (this->test_is_true_stub( (condition), (#condition), __FILE__, __LINE__ ))
#define test_int_is_equal( actual_value, expected_value ) (this->test_int_is_equal_stub( actual_value, expected_value, __FILE__, __LINE__ ))
#define test_double_is_equal( actual_value, expected_value ) (this->test_double_is_equal_stub( actual_value, expected_value, __FILE__, __LINE__ ))
#define double_is_within_tolerance( actual_value, expected_value, tolerance ) ( this->test_double_is_equal_stub( actual_value, expected_value, __FILE__, __LINE__, tolerance ))
#define test_string_is_equal( actual_value, expected_value ) (this->test_string_is_equal_stub( actual_value, expected_value, __FILE__, __LINE__ ))
#define test_is_equal( actual_value, expected_value ) (this->test_is_equal_stub( actual_value, expected_value, __FILE__, __LINE__ ))

#endif



Index: avida/current/source/third-party/trio-1.9/yaktest/test_problem.cpp
+++ avida/current/source/third-party/trio-1.9/yaktest/test_problem.cpp
#include "test_problem.h"

//constructor (dumb initializer) for test_problem
test_problem::test_problem(  const std::string& filename, 
			     long line_number, 
			     const std::string& message ) :
m_line_number( line_number ),
m_filename( filename ),
m_message( message )
{
}

//copy constructor
test_problem::test_problem( const test_problem& rhs ) :
m_line_number( rhs.m_line_number ),
m_filename( rhs.m_filename ),
m_message( rhs.m_message )
{
}

//copy operator
test_problem&
test_problem::operator=( const test_problem& rhs )
{
  m_line_number = rhs.m_line_number;
  m_filename = rhs.m_filename;
  m_message = rhs.m_message;
  return *this;
}

//data access
long
test_problem::line_number( void ) const
{
  return m_line_number;
}


//data access
const std::string&
test_problem::filename( void ) const
{
  return m_filename;
}

//data access 
const std::string&
test_problem::message( void ) const
{
  return m_message;
}

Index: avida/current/source/third-party/trio-1.9/yaktest/test_problem.h
+++ avida/current/source/third-party/trio-1.9/yaktest/test_problem.h
#ifndef TEST_PROBLEM_H
#define TEST_PROBLEM_H

#include <string>

//$Id
//this is a test "problem" -- a note when a test failed or erred
class test_problem
{
 protected:
  //protected data members
  //line number of the error, if appropriate
  long m_line_number;
  //filename of the error, if appropriate
  std::string m_filename;
  //additional message as appropriate
  std::string m_message;

 public:
  //construction
  test_problem( const std::string& filename, long line_number, const std::string& message );
  test_problem( const test_problem& rhs );
  test_problem& operator= (const test_problem& rhs);
  //data access
  long line_number( void ) const;
  const std::string& filename( void ) const;
  const std::string& message( void ) const;

};

#endif

Index: avida/current/source/third-party/trio-1.9/yaktest/test_result.cpp
+++ avida/current/source/third-party/trio-1.9/yaktest/test_result.cpp
#include "test_result.h"

//adds an error to the result
void
test_result::add_error( const test_problem& new_error )
{
  m_errors.push_back( new_error );
}

//adds a failure
void
test_result::add_failure( const test_problem& new_failure )
{
  m_failures.push_back( new_failure );
}

//adds a success
void
test_result::add_success( void ) 
{
  ++m_success_count;
}

//adds another result
void
test_result::add_result( const test_result& new_result )
{
  //add errors
  m_errors.insert( m_errors.end(), 
		   new_result.m_errors.begin(),
		   new_result.m_errors.end() );
  //add failures
  m_failures.insert( m_failures.end(),
		     new_result.m_failures.begin(),
		     new_result.m_failures.end() );
  //add successes
  m_success_count += new_result.m_success_count;
}

//deletes the contents of the test result
void
test_result::delete_contents( void )
{
  m_errors.clear();
  m_failures.clear();
  m_success_count = 0;
}

const std::vector<test_problem>& 
test_result::errors( void ) const
{
  return m_errors;
}

const std::vector<test_problem>& 
test_result::failures( void ) const
{
  return m_failures;
}

int 
test_result::success_count( void ) const
{
  return m_success_count;
}

int 
test_result::total_test_count( void ) const
{
  return m_success_count 
    + m_errors.size()
    + m_failures.size();
}



Index: avida/current/source/third-party/trio-1.9/yaktest/test_result.h
+++ avida/current/source/third-party/trio-1.9/yaktest/test_result.h
#ifndef TEST_RESULT_H
#define TEST_RESULT_H

#ifndef TEST_PROBLEM_H
#include "test_problem.h"
#endif

#include<vector>
//$Id
//a class to accumulate the results of tests.  While you can add other
//test_results to it, it is not a composite; the added results
//are simply merged with the existing result

class test_result
{
 protected:
  //protected data members
  //the accumulated errors
  std::vector< test_problem > m_errors;
  //the accumulated failures
  std::vector< test_problem > m_failures;
  //the number of successes
  int m_success_count;

 public:
  //add errors and failures to the list
  //add an error (problem in testing or error in test framework)
  void add_error( const test_problem& new_error );
  //add a failure (test for truth or equality failed)
  void add_failure( const test_problem& new_error );
  //add a success 
  void add_success( void );
  //add another result
  void add_result( const test_result& result );
  //delete the contents of the result
  void delete_contents( void );
  
  //accessorts for the errors and failures in the test result
  const std::vector<test_problem>& errors( void ) const;
  const std::vector<test_problem>& failures( void ) const;
  int success_count( void ) const;
  int total_test_count( void ) const;
};


#endif

Index: avida/current/source/third-party/trio-1.9/yaktest/text_test_interpreter.cpp
+++ avida/current/source/third-party/trio-1.9/yaktest/text_test_interpreter.cpp
#include "text_test_interpreter.h"

#include <stdio.h>

std::string _yak_itoa( long input )
{
  char buffer[ 100 ];
  sprintf( buffer, "%ld", input );
  return std::string( buffer );
}

//the header for the report
std::string
text_test_interpreter::header( const test_result& result ) const
{
  std::string Result = "Test output begins; number of tests: ";
  Result.append( _yak_itoa( result.total_test_count() ) );
  Result.append( "\n\n" );
  return Result;
}

std::string
text_test_interpreter::footer( const test_result& result ) const
{
  std::string Result = "Test output ends\n";
  return Result;
}

std::string
text_test_interpreter::successes( const test_result& result ) const
{
  std::string Result = "Successes: ";
  Result.append( _yak_itoa( result.success_count() ) );
  Result.append( "\n\n" );
  return Result;
}

std::string
text_test_interpreter::failures( const test_result& result ) const
{
  std::string Result = "Failures: ";
  Result.append( _yak_itoa( result.failures().size() ) );
  Result.append( "\n" );
  Result.append( problem_vector_string( result.failures() ) );
  Result.append( "\n" );
  return Result;
}

std::string
text_test_interpreter::errors( const test_result& result ) const
{
  std::string Result = "Errors: ";
  Result.append( _yak_itoa( result.errors().size() ) );
  Result.append( "\n" );
  Result.append( problem_vector_string( result.errors() ) );
  Result.append( "\n" );
  return Result;
}

//! takes a list (vector to be precise) of problems and creates a str for each one
std::string
text_test_interpreter::problem_vector_string( const std::vector< test_problem >& vect ) const
{
  std::string Result;
  for ( std::vector< test_problem >::const_iterator iter = vect.begin();
	iter != vect.end();
	++iter )
    {
      Result.append( problem_string( *iter ) );
    }
  return Result;
}

//! converts a single test problem to a descriptive emacs compilation buffer friendly string 
std::string
text_test_interpreter::problem_string( const test_problem& problem ) const
{
  std::string Result;
  Result.append( problem.filename() );
  Result.append( ":" );
  Result.append( _yak_itoa( problem.line_number() ) );
  Result.append( ":" );
  Result.append( problem.message() );
  Result.append( "\n" );
  return Result;
}

std::string 
text_test_interpreter::interpretation( const test_result& result_to_interpret ) const
{
  std::string Result;
  Result.append( header( result_to_interpret ) );
  Result.append( successes( result_to_interpret ) );
  Result.append( failures( result_to_interpret ) );
  Result.append( errors( result_to_interpret ) );
  Result.append( footer( result_to_interpret ) );
  return Result;
}

Index: avida/current/source/third-party/trio-1.9/yaktest/text_test_interpreter.h
+++ avida/current/source/third-party/trio-1.9/yaktest/text_test_interpreter.h
#ifndef TEXT_TEST_INTERPRETER_H
#define TEXT_TEST_INTERPRETER_H

#ifndef TEST_RESULT_H
#include "test_result.h"
#endif
#include <string>

//a simple interpreter which outputs a result of testing
class text_test_interpreter
{
 protected:
  //partial interpretations
  std::string header( const test_result& result ) const;
  std::string footer( const test_result& result ) const;
  std::string successes( const test_result& result ) const;
  std::string failures( const test_result& result ) const;
  std::string errors( const test_result& result ) const;
  std::string problem_vector_string( const std::vector< test_problem >& vect ) const;
  std::string problem_string( const test_problem& problem ) const;
 public:
  //returns the interpretation of a test result
  std::string interpretation( const test_result& result_to_interpret ) const;
};

#endif

Index: avida/current/source/third-party/trio-1.9/yaktest/example/Makefile.am
+++ avida/current/source/third-party/trio-1.9/yaktest/example/Makefile.am
##process this file with automake to create Makefile.in

INCLUDES = -I$(srcdir)/..

check_PROGRAMS = test_point

test_point_SOURCES = \
test_case_point.cpp \
test_point.cpp \
test_case_point.h \
point.h

test_point_LDADD = \
./libyaktest.a

test: test_point
	./test_point

Index: avida/current/source/third-party/trio-1.9/yaktest/example/cscope.out
+++ avida/current/source/third-party/trio-1.9/yaktest/example/cscope.out
cscope 15 $HOME/Projects/software/yaktest/yaktest-1.0.1/src/example               0000035193
	@/Users/kaben/Projects/software/yaktest/yaktest-1.0.1/src/example/point.h

5 #iâdeà
POINT_H


6 
	#POINT_H


	)

8 #iâdeà
STRINGABLE_H


9 
	~"¡ršgabË.h
"

11 
	~<¡dio.h
>

15 
Çme¥aû
 
	gyak


19 
	g‹m¶©e
 < 
þass
 
	gT
 > cÏs 
	cpošt
 : 
public
 
¡ršgabË


22 
public
:

23 
pošt
 < 
	tT
 > 
	tt_pošt
;

25 
T
 
	gx
;

27 
T
 
	gy
;

29 
	gpublic
:

31 
pošt
 ():
x
 (0), 
y
 (0)

35 
pošt
 (cÚ¡ 
t_pošt
 & 
rhs
):
x
 (rhs.x), 
y
 (rhs.y)

39 
pošt
 (cÚ¡ 
T
 & 
Ãw_x
, cÚ¡ T & 
Ãw_y
):
x
 (Ãw_x), 
y
 (new_y)

43 
boÞ
 
	gÝ”©Ü
 =ð(cÚ¡ 
t_pošt
 & 
rhs
) const {

44  ((
x
 =ð
rhs
xè&& (
y
 ==„hs.y));

47 
boÞ
 
	gÝ”©Ü
 !ð(cÚ¡ 
t_pošt
 & 
rhs
) const

49  !((*
this
è=ð
rhs
);

52 
	gt_pošt
 & 
	gÝ”©Ü
 +ð(cÚ¡ 
t_pošt
 & 
rhs
)

54 
x
 +ð
rhs
x;

55 
	gy
 +ð
rhs




More information about the Avida-cvs mailing list